]> Zhao Yanbai Git Server - minix.git/commitdiff
Full switch to clang/ELF. Drop ack. Simplify.
authorBen Gras <ben@minix3.org>
Sat, 11 Feb 2012 18:31:25 +0000 (19:31 +0100)
committerBen Gras <ben@minix3.org>
Tue, 14 Feb 2012 13:52:02 +0000 (14:52 +0100)
There is important information about booting non-ack images in
docs/UPDATING. ack/aout-format images can't be built any more, and
booting clang/ELF-format ones is a little different. Updating to the
new boot monitor is recommended.

Changes in this commit:

. drop boot monitor -> allowing dropping ack support
. facility to copy ELF boot files to /boot so that old boot monitor
  can still boot fairly easily, see UPDATING
. no more ack-format libraries -> single-case libraries
. some cleanup of OBJECT_FMT, COMPILER_TYPE, etc cases
. drop several ack toolchain commands, but not all support
  commands (e.g. aal is gone but acksize is not yet).
. a few libc files moved to netbsd libc dir
. new /bin/date as minix date used code in libc/
. test compile fix
. harmonize includes
. /usr/lib is no longer special: without ack, /usr/lib plays no
  kind of special bootstrapping role any more and bootstrapping
  is done exclusively through packages, so releases depend even
  less on the state of the machine making them now.
. rename nbsd_lib* to lib*
. reduce mtree

5056 files changed:
.gitignore
Makefile
bin/Makefile
bin/Makefile.inc
bin/date/Makefile [new file with mode: 0644]
bin/date/date.1 [new file with mode: 0644]
bin/date/date.c [new file with mode: 0644]
bin/date/extern.h [moved from nbsd_include/memory.h with 87% similarity]
bin/date/netdate.c [new file with mode: 0644]
boot/Makefile [deleted file]
boot/boot.h [deleted file]
boot/boot/Makefile [deleted file]
boot/boot/boot.c [deleted file]
boot/boot/boothead.s [deleted file]
boot/boot/bootimage.c [deleted file]
boot/boot/emem.h [deleted file]
boot/bootblock/Makefile [deleted file]
boot/bootblock/bootblock.s [deleted file]
boot/cdbootblock/Makefile [deleted file]
boot/edparams/Makefile [deleted file]
boot/image.h [deleted file]
boot/installboot/Makefile [deleted file]
boot/installboot/installboot.c [deleted file]
boot/jumpboot/Makefile [deleted file]
boot/jumpboot/jumpboot.s [deleted file]
boot/masterboot/Makefile [deleted file]
boot/masterboot/masterboot.s [deleted file]
boot/minix.ack16.mk [deleted file]
boot/rawfs.c [deleted file]
boot/rawfs.h [deleted file]
boot/updateboot.sh [deleted file]
commands/M/M.sh [deleted file]
commands/M/Makefile [deleted file]
commands/Makefile
commands/Makefile.inc
commands/aal/Makefile [deleted file]
commands/aal/arch.h [deleted file]
commands/aal/archiver.c [deleted file]
commands/aal/archiver.h [deleted file]
commands/aal/byte_order.h [deleted file]
commands/aal/format.c [deleted file]
commands/aal/format.h [deleted file]
commands/aal/local.h [deleted file]
commands/aal/long2str.c [deleted file]
commands/aal/object.h [deleted file]
commands/aal/out.h [deleted file]
commands/aal/param.h [deleted file]
commands/aal/print.c [deleted file]
commands/aal/print.h [deleted file]
commands/aal/ranlib.h [deleted file]
commands/aal/rd.c [deleted file]
commands/aal/rd.h [deleted file]
commands/aal/rd_arhdr.c [deleted file]
commands/aal/rd_bytes.c [deleted file]
commands/aal/rd_bytes.h [deleted file]
commands/aal/rd_unsig2.c [deleted file]
commands/aal/sprint.c [deleted file]
commands/aal/system.c [deleted file]
commands/aal/system.h [deleted file]
commands/aal/varargs.h [deleted file]
commands/aal/wr_arhdr.c [deleted file]
commands/aal/wr_bytes.c [deleted file]
commands/aal/wr_bytes.h [deleted file]
commands/aal/wr_int2.c [deleted file]
commands/aal/wr_int2.h [deleted file]
commands/aal/wr_long.c [deleted file]
commands/aal/wr_long.h [deleted file]
commands/aal/wr_ranlib.c [deleted file]
commands/aal/write.c [deleted file]
commands/aal/write.h [deleted file]
commands/acd/Makefile [deleted file]
commands/acd/acd.c [deleted file]
commands/ackmkdep/Makefile [deleted file]
commands/ackmkdep/ackmkdep.sh [deleted file]
commands/ackstrip/Makefile [deleted file]
commands/ackstrip/ackstrip.c [deleted file]
commands/asmconv/Makefile [deleted file]
commands/asmconv/asm86.c [deleted file]
commands/asmconv/asm86.h [deleted file]
commands/asmconv/asmconv.c [deleted file]
commands/asmconv/asmconv.h [deleted file]
commands/asmconv/emit_ack.c [deleted file]
commands/asmconv/emit_gnu.c [deleted file]
commands/asmconv/languages.h [deleted file]
commands/asmconv/parse_ack.c [deleted file]
commands/asmconv/parse_bas.c [deleted file]
commands/asmconv/parse_gnu.c [deleted file]
commands/asmconv/syntax.ack [deleted file]
commands/asmconv/token.h [deleted file]
commands/asmconv/tokenize.c [deleted file]
commands/binpackage/Makefile [deleted file]
commands/binpackage/binpackage.sh [deleted file]
commands/binpackages/Makefile [deleted file]
commands/binpackages/binpackages.sh [deleted file]
commands/chmem/Makefile [deleted file]
commands/chmem/chmem.c [deleted file]
commands/cut/Makefile
commands/date/Makefile [deleted file]
commands/dis386/Makefile [deleted file]
commands/dis386/const.h [deleted file]
commands/dis386/dis386.doc [deleted file]
commands/dis386/dis386.h [deleted file]
commands/dis386/dise.c [deleted file]
commands/dis386/diso.c [deleted file]
commands/dis386/misc.c [deleted file]
commands/dis386/out.h [deleted file]
commands/dis386/type.h [deleted file]
commands/dis386/unasm.c [deleted file]
commands/dis386/var.h [deleted file]
commands/dis88/Makefile [deleted file]
commands/dis88/README [deleted file]
commands/dis88/dis.h [deleted file]
commands/dis88/disfp.c [deleted file]
commands/dis88/dishand.c [deleted file]
commands/dis88/dismain.c [deleted file]
commands/dis88/disrel.c [deleted file]
commands/dis88/distabs.c [deleted file]
commands/elf2aout/Makefile [deleted file]
commands/elf2aout/elf2aout.1 [deleted file]
commands/elf2aout/elf2aout.c [deleted file]
commands/elf2aout/elf_machdep.h [deleted file]
commands/elf2aout/exec_elf.h [deleted file]
commands/find/Makefile
commands/gas2ack/Makefile [deleted file]
commands/gas2ack/asm86.c [deleted file]
commands/gas2ack/asm86.h [deleted file]
commands/gas2ack/asmconv.h [deleted file]
commands/gas2ack/emit_ack.c [deleted file]
commands/gas2ack/gas2ack.c [deleted file]
commands/gas2ack/globals.c [deleted file]
commands/gas2ack/globals.h [deleted file]
commands/gas2ack/languages.h [deleted file]
commands/gas2ack/parse_gnu.c [deleted file]
commands/gas2ack/token.h [deleted file]
commands/gas2ack/tokenize.c [deleted file]
commands/grep/Makefile
commands/hexdump/Makefile
commands/login/Makefile
commands/ls/Makefile
commands/padtext/Makefile [deleted file]
commands/padtext/padtext.c [deleted file]
commands/postmort/Makefile [deleted file]
commands/postmort/postmort.c [deleted file]
commands/pwdauth/Makefile
commands/setup/setup.sh
commands/su/Makefile
commands/tar/Makefile
commands/time/Makefile
commands/zdump/Makefile
docs/UPDATING
drivers/Makefile.inc
drivers/acpi/Makefile
drivers/ahci/Makefile
drivers/fbd/Makefile
drivers/memory/Makefile
drivers/ramdisk/Makefile
drivers/random/Makefile
etc/Makefile
etc/descr [deleted file]
etc/mtree/minix.tree
include/Makefile
include/Makefile.minix.inc [moved from common/include/Makefile.inc with 98% similarity]
include/a.out.h
include/aio.h [moved from nbsd_include/aio.h with 100% similarity]
include/alloca.h [deleted file]
include/arch/Makefile
include/arch/i386/Makefile
include/arch/i386/_align.h [deleted file]
include/arch/i386/asm.h [deleted file]
include/arch/i386/include/Makefile [moved from nbsd_include/arch/i386/include/Makefile with 100% similarity]
include/arch/i386/include/ansi.h [moved from nbsd_include/arch/i386/include/ansi.h with 100% similarity]
include/arch/i386/include/asm.h [moved from nbsd_include/arch/i386/include/asm.h with 100% similarity]
include/arch/i386/include/bswap.h [moved from nbsd_include/arch/i386/include/bswap.h with 100% similarity]
include/arch/i386/include/byte_swap.h [moved from nbsd_include/arch/i386/include/byte_swap.h with 100% similarity]
include/arch/i386/include/cdefs.h [moved from nbsd_include/arch/i386/include/cdefs.h with 100% similarity]
include/arch/i386/include/disklabel.h [moved from nbsd_include/arch/i386/include/disklabel.h with 100% similarity]
include/arch/i386/include/endian.h [moved from nbsd_include/arch/i386/include/endian.h with 100% similarity]
include/arch/i386/include/endian_machdep.h [moved from nbsd_include/arch/i386/include/endian_machdep.h with 100% similarity]
include/arch/i386/include/fenv.h [moved from nbsd_include/arch/i386/include/fenv.h with 100% similarity]
include/arch/i386/include/float.h [moved from nbsd_include/arch/i386/include/float.h with 100% similarity]
include/arch/i386/include/ieee.h [moved from nbsd_include/arch/i386/include/ieee.h with 100% similarity]
include/arch/i386/include/ieeefp.h [moved from nbsd_include/arch/i386/include/ieeefp.h with 100% similarity]
include/arch/i386/include/int_const.h [moved from nbsd_include/arch/i386/include/int_const.h with 100% similarity]
include/arch/i386/include/int_fmtio.h [moved from nbsd_include/arch/i386/include/int_fmtio.h with 100% similarity]
include/arch/i386/include/int_limits.h [moved from nbsd_include/arch/i386/include/int_limits.h with 100% similarity]
include/arch/i386/include/int_mwgwtypes.h [moved from nbsd_include/arch/i386/include/int_mwgwtypes.h with 100% similarity]
include/arch/i386/include/int_types.h [moved from nbsd_include/arch/i386/include/int_types.h with 100% similarity]
include/arch/i386/include/limits.h [moved from nbsd_include/arch/i386/include/limits.h with 100% similarity]
include/arch/i386/include/math.h [moved from nbsd_include/arch/i386/include/math.h with 100% similarity]
include/arch/i386/include/mcontext.h [moved from nbsd_include/arch/i386/include/mcontext.h with 100% similarity]
include/arch/i386/include/npx.h [moved from nbsd_include/arch/i386/include/npx.h with 100% similarity]
include/arch/i386/include/param.h [moved from nbsd_include/arch/i386/include/param.h with 100% similarity]
include/arch/i386/include/profile.h [moved from nbsd_include/arch/i386/include/profile.h with 100% similarity]
include/arch/i386/include/setjmp.h [moved from nbsd_include/arch/i386/include/setjmp.h with 100% similarity]
include/arch/i386/include/signal.h [moved from nbsd_include/arch/i386/include/signal.h with 100% similarity]
include/arch/i386/include/stdarg.h [moved from nbsd_include/arch/i386/include/stdarg.h with 100% similarity]
include/arch/i386/include/types.h [moved from nbsd_include/arch/i386/include/types.h with 100% similarity]
include/arch/i386/include/vmparam.h [moved from nbsd_include/arch/i386/include/vmparam.h with 100% similarity]
include/arch/i386/include/wchar_limits.h [moved from nbsd_include/arch/i386/include/wchar_limits.h with 100% similarity]
include/arch/i386/mcontext.h [deleted file]
include/arch/i386/param.h [deleted file]
include/arch/x86/include/Makefile [moved from nbsd_include/arch/x86/include/Makefile with 100% similarity]
include/arch/x86/include/float.h [moved from nbsd_include/arch/x86/include/float.h with 100% similarity]
include/arch/x86/include/ieee.h [moved from nbsd_include/arch/x86/include/ieee.h with 100% similarity]
include/arch/x86/include/ieeefp.h [moved from nbsd_include/arch/x86/include/ieeefp.h with 100% similarity]
include/arch/x86/include/math.h [moved from nbsd_include/arch/x86/include/math.h with 100% similarity]
include/arch/x86/include/mutex.h [moved from nbsd_include/arch/x86/include/mutex.h with 100% similarity]
include/arpa/ftp.h [moved from nbsd_include/arpa/ftp.h with 100% similarity]
include/arpa/inet.h
include/arpa/nameser.h
include/arpa/nameser_compat.h [moved from nbsd_include/arpa/nameser_compat.h with 100% similarity]
include/arpa/telnet.h [moved from nbsd_include/arpa/telnet.h with 100% similarity]
include/arpa/tftp.h [moved from nbsd_include/arpa/tftp.h with 100% similarity]
include/assert.h
include/atomic.h [moved from nbsd_include/atomic.h with 100% similarity]
include/bitstring.h [moved from nbsd_include/bitstring.h with 100% similarity]
include/bm.h [moved from nbsd_include/bm.h with 100% similarity]
include/cdbr.h [moved from nbsd_include/cdbr.h with 100% similarity]
include/cdbw.h [moved from nbsd_include/cdbw.h with 100% similarity]
include/complex.h
include/cpio.h [moved from nbsd_include/cpio.h with 100% similarity]
include/ctype.h
include/db.h
include/ddekit/assert.h [moved from common/include/ddekit/assert.h with 100% similarity]
include/ddekit/attribs.h [moved from common/include/ddekit/attribs.h with 100% similarity]
include/ddekit/condvar.h [moved from common/include/ddekit/condvar.h with 100% similarity]
include/ddekit/ddekit.h [moved from common/include/ddekit/ddekit.h with 100% similarity]
include/ddekit/debug.h [moved from common/include/ddekit/debug.h with 100% similarity]
include/ddekit/initcall.h [moved from common/include/ddekit/initcall.h with 100% similarity]
include/ddekit/inline.h [moved from common/include/ddekit/inline.h with 100% similarity]
include/ddekit/interrupt.h [moved from common/include/ddekit/interrupt.h with 100% similarity]
include/ddekit/lock.h [moved from common/include/ddekit/lock.h with 100% similarity]
include/ddekit/memory.h [moved from common/include/ddekit/memory.h with 100% similarity]
include/ddekit/minix/msg_queue.h [moved from common/include/ddekit/minix/msg_queue.h with 100% similarity]
include/ddekit/minix/pci.h [moved from common/include/ddekit/minix/pci.h with 100% similarity]
include/ddekit/panic.h [moved from common/include/ddekit/panic.h with 100% similarity]
include/ddekit/pci.h [moved from common/include/ddekit/pci.h with 100% similarity]
include/ddekit/pgtab.h [moved from common/include/ddekit/pgtab.h with 100% similarity]
include/ddekit/printf.h [moved from common/include/ddekit/printf.h with 100% similarity]
include/ddekit/resources.h [moved from common/include/ddekit/resources.h with 100% similarity]
include/ddekit/semaphore.h [moved from common/include/ddekit/semaphore.h with 100% similarity]
include/ddekit/thread.h [moved from common/include/ddekit/thread.h with 100% similarity]
include/ddekit/timer.h [moved from common/include/ddekit/timer.h with 100% similarity]
include/ddekit/types.h [moved from common/include/ddekit/types.h with 100% similarity]
include/ddekit/usb.h [moved from common/include/ddekit/usb.h with 100% similarity]
include/dirent.h
include/disktab.h [moved from nbsd_include/disktab.h with 100% similarity]
include/dlfcn.h [moved from nbsd_include/dlfcn.h with 100% similarity]
include/env.h [moved from common/include/env.h with 100% similarity]
include/err.h
include/errno.h
include/fcntl.h [deleted file]
include/fenv.h
include/fetch.h [moved from common/include/fetch.h with 100% similarity]
include/float.h [deleted file]
include/fmtmsg.h [moved from nbsd_include/fmtmsg.h with 100% similarity]
include/fnmatch.h
include/fstab.h [moved from nbsd_include/fstab.h with 100% similarity]
include/fts.h
include/ftw.h [moved from nbsd_include/ftw.h with 100% similarity]
include/glob.h
include/grp.h
include/heimdal/config.h [moved from nbsd_include/heimdal/config.h with 100% similarity]
include/heimdal/crypto-headers.h [moved from nbsd_include/heimdal/crypto-headers.h with 100% similarity]
include/heimdal/hx509_err.h [moved from nbsd_include/heimdal/hx509_err.h with 100% similarity]
include/heimdal/krb5-types.h [moved from nbsd_include/heimdal/krb5-types.h with 100% similarity]
include/heimdal/krb_err.h [moved from nbsd_include/heimdal/krb_err.h with 100% similarity]
include/heimdal/protos.h [moved from nbsd_include/heimdal/protos.h with 100% similarity]
include/heimdal/roken.h [moved from nbsd_include/heimdal/roken.h with 100% similarity]
include/heimdal/version.h [moved from nbsd_include/heimdal/version.h with 100% similarity]
include/hesiod.h [moved from nbsd_include/hesiod.h with 100% similarity]
include/iconv.h [moved from nbsd_include/iconv.h with 100% similarity]
include/ieeefp.h [moved from nbsd_include/ieeefp.h with 100% similarity]
include/ifaddrs.h
include/inttypes.h
include/iso646.h [moved from nbsd_include/iso646.h with 100% similarity]
include/kvm.h [moved from nbsd_include/kvm.h with 100% similarity]
include/langinfo.h [moved from nbsd_include/langinfo.h with 100% similarity]
include/lib.h [moved from common/include/lib.h with 100% similarity]
include/libgen.h
include/libutil.h [moved from common/include/libutil.h with 100% similarity]
include/limits.h
include/link.h [moved from nbsd_include/link.h with 100% similarity]
include/link_aout.h [moved from nbsd_include/link_aout.h with 100% similarity]
include/link_elf.h [moved from nbsd_include/link_elf.h with 100% similarity]
include/locale.h
include/login_cap.h [moved from nbsd_include/login_cap.h with 100% similarity]
include/lwp.h [moved from nbsd_include/lwp.h with 100% similarity]
include/malloc.h [moved from nbsd_include/malloc.h with 100% similarity]
include/math.h
include/mathconst.h [deleted file]
include/md2.h [moved from nbsd_include/md2.h with 100% similarity]
include/memory.h
include/midiparser.h [deleted file]
include/minix/Makefile [moved from nbsd_include/minix/Makefile with 100% similarity]
include/minix/acpi.h [moved from common/include/minix/acpi.h with 100% similarity]
include/minix/ansi.h [moved from common/include/minix/ansi.h with 100% similarity]
include/minix/audio_fw.h [moved from common/include/minix/audio_fw.h with 100% similarity]
include/minix/bdev.h [moved from common/include/minix/bdev.h with 100% similarity]
include/minix/bitmap.h [moved from common/include/minix/bitmap.h with 100% similarity]
include/minix/blockdriver.h [moved from common/include/minix/blockdriver.h with 100% similarity]
include/minix/blockdriver_mt.h [moved from common/include/minix/blockdriver_mt.h with 100% similarity]
include/minix/btrace.h [moved from common/include/minix/btrace.h with 100% similarity]
include/minix/callnr.h [moved from common/include/minix/callnr.h with 100% similarity]
include/minix/cdrom.h [deleted file]
include/minix/chardriver.h [moved from common/include/minix/chardriver.h with 100% similarity]
include/minix/com.h [moved from common/include/minix/com.h with 100% similarity]
include/minix/compiler-ack.h [deleted file]
include/minix/compiler.h [moved from common/include/minix/compiler.h with 100% similarity]
include/minix/config.h [moved from common/include/minix/config.h with 100% similarity]
include/minix/const.h [moved from common/include/minix/const.h with 100% similarity]
include/minix/cpufeature.h [moved from common/include/minix/cpufeature.h with 100% similarity]
include/minix/crtso.h [moved from common/include/minix/crtso.h with 100% similarity]
include/minix/debug.h [moved from common/include/minix/debug.h with 100% similarity]
include/minix/devio.h [moved from common/include/minix/devio.h with 100% similarity]
include/minix/devman.h [moved from common/include/minix/devman.h with 100% similarity]
include/minix/dirent.h
include/minix/dl_eth.h [deleted file]
include/minix/dmap.h [moved from common/include/minix/dmap.h with 100% similarity]
include/minix/driver.h [moved from common/include/minix/driver.h with 100% similarity]
include/minix/drivers.h [moved from common/include/minix/drivers.h with 100% similarity]
include/minix/drvlib.h [moved from common/include/minix/drvlib.h with 100% similarity]
include/minix/ds.h [moved from common/include/minix/ds.h with 100% similarity]
include/minix/endpoint.h [moved from common/include/minix/endpoint.h with 100% similarity]
include/minix/fslib.h [moved from common/include/minix/fslib.h with 100% similarity]
include/minix/gcov.h [moved from common/include/minix/gcov.h with 100% similarity]
include/minix/hash.h [moved from common/include/minix/hash.h with 100% similarity]
include/minix/hgfs.h [moved from common/include/minix/hgfs.h with 100% similarity]
include/minix/input.h [moved from common/include/minix/input.h with 100% similarity]
include/minix/ioctl.h [moved from common/include/minix/ioctl.h with 100% similarity]
include/minix/ipc.h [moved from common/include/minix/ipc.h with 100% similarity]
include/minix/ipcconst.h [moved from common/include/minix/ipcconst.h with 100% similarity]
include/minix/keymap.h [moved from common/include/minix/keymap.h with 100% similarity]
include/minix/libminixfs.h [moved from common/include/minix/libminixfs.h with 100% similarity]
include/minix/limits.h [moved from common/include/minix/limits.h with 100% similarity]
include/minix/md5.h [deleted file]
include/minix/minlib.h [moved from common/include/minix/minlib.h with 100% similarity]
include/minix/mthread.h [moved from common/include/minix/mthread.h with 100% similarity]
include/minix/netdriver.h [moved from common/include/minix/netdriver.h with 100% similarity]
include/minix/optset.h [moved from common/include/minix/optset.h with 100% similarity]
include/minix/partition.h [moved from common/include/minix/partition.h with 100% similarity]
include/minix/paths.h [moved from nbsd_include/minix/paths.h with 100% similarity]
include/minix/portio.h [moved from common/include/minix/portio.h with 100% similarity]
include/minix/priv.h [moved from common/include/minix/priv.h with 100% similarity]
include/minix/procfs.h [moved from common/include/minix/procfs.h with 100% similarity]
include/minix/profile.h [moved from common/include/minix/profile.h with 100% similarity]
include/minix/queryparam.h [moved from common/include/minix/queryparam.h with 100% similarity]
include/minix/rs.h [moved from common/include/minix/rs.h with 100% similarity]
include/minix/safecopies.h [moved from common/include/minix/safecopies.h with 100% similarity]
include/minix/sched.h [moved from common/include/minix/sched.h with 100% similarity]
include/minix/sef.h [moved from common/include/minix/sef.h with 100% similarity]
include/minix/sha1.h [deleted file]
include/minix/sha2.h [deleted file]
include/minix/sound.h [moved from common/include/minix/sound.h with 100% similarity]
include/minix/spin.h [moved from common/include/minix/spin.h with 100% similarity]
include/minix/sys_config.h [moved from common/include/minix/sys_config.h with 100% similarity]
include/minix/sysinfo.h [moved from common/include/minix/sysinfo.h with 100% similarity]
include/minix/syslib.h [moved from common/include/minix/syslib.h with 100% similarity]
include/minix/sysutil.h [moved from common/include/minix/sysutil.h with 100% similarity]
include/minix/timers.h [moved from common/include/minix/timers.h with 100% similarity]
include/minix/tty.h [moved from common/include/minix/tty.h with 100% similarity]
include/minix/type.h [moved from common/include/minix/type.h with 100% similarity]
include/minix/types.h
include/minix/u64.h [moved from common/include/minix/u64.h with 100% similarity]
include/minix/usb.h [moved from common/include/minix/usb.h with 100% similarity]
include/minix/usb_ch9.h [moved from common/include/minix/usb_ch9.h with 100% similarity]
include/minix/vfsif.h [moved from common/include/minix/vfsif.h with 100% similarity]
include/minix/vm.h [moved from common/include/minix/vm.h with 100% similarity]
include/minix/vtreefs.h [moved from common/include/minix/vtreefs.h with 100% similarity]
include/mntopts.h [moved from nbsd_include/mntopts.h with 100% similarity]
include/monetary.h [moved from nbsd_include/monetary.h with 100% similarity]
include/mqueue.h [moved from nbsd_include/mqueue.h with 100% similarity]
include/ndbm.h
include/net/Makefile [moved from nbsd_include/net/Makefile with 100% similarity]
include/net/ethertypes.h [moved from nbsd_include/net/ethertypes.h with 100% similarity]
include/net/gen/arp_io.h [moved from common/include/net/gen/arp_io.h with 100% similarity]
include/net/gen/dhcp.h [moved from common/include/net/gen/dhcp.h with 100% similarity]
include/net/gen/eth_hdr.h [moved from common/include/net/gen/eth_hdr.h with 100% similarity]
include/net/gen/eth_io.h [moved from common/include/net/gen/eth_io.h with 100% similarity]
include/net/gen/ether.h [moved from common/include/net/gen/ether.h with 100% similarity]
include/net/gen/icmp.h [moved from common/include/net/gen/icmp.h with 100% similarity]
include/net/gen/icmp_hdr.h [moved from common/include/net/gen/icmp_hdr.h with 100% similarity]
include/net/gen/if_ether.h [moved from common/include/net/gen/if_ether.h with 100% similarity]
include/net/gen/in.h [moved from common/include/net/gen/in.h with 100% similarity]
include/net/gen/inet.h [moved from common/include/net/gen/inet.h with 100% similarity]
include/net/gen/ip_hdr.h [moved from common/include/net/gen/ip_hdr.h with 100% similarity]
include/net/gen/ip_io.h [moved from common/include/net/gen/ip_io.h with 100% similarity]
include/net/gen/nameser.h [deleted file]
include/net/gen/netdb.h [deleted file]
include/net/gen/oneCsum.h [moved from common/include/net/gen/oneCsum.h with 100% similarity]
include/net/gen/psip_hdr.h [moved from common/include/net/gen/psip_hdr.h with 100% similarity]
include/net/gen/psip_io.h [moved from common/include/net/gen/psip_io.h with 100% similarity]
include/net/gen/resolv.h [deleted file]
include/net/gen/rip.h [moved from common/include/net/gen/rip.h with 100% similarity]
include/net/gen/route.h [moved from common/include/net/gen/route.h with 100% similarity]
include/net/gen/socket.h [moved from common/include/net/gen/socket.h with 100% similarity]
include/net/gen/tcp.h [moved from common/include/net/gen/tcp.h with 100% similarity]
include/net/gen/tcp_hdr.h [moved from common/include/net/gen/tcp_hdr.h with 100% similarity]
include/net/gen/tcp_io.h [moved from common/include/net/gen/tcp_io.h with 100% similarity]
include/net/gen/udp.h [moved from common/include/net/gen/udp.h with 100% similarity]
include/net/gen/udp_hdr.h [moved from common/include/net/gen/udp_hdr.h with 100% similarity]
include/net/gen/udp_io.h [moved from common/include/net/gen/udp_io.h with 100% similarity]
include/net/gen/udp_io_hdr.h [moved from common/include/net/gen/udp_io_hdr.h with 100% similarity]
include/net/gen/vjhc.h [moved from common/include/net/gen/vjhc.h with 100% similarity]
include/net/hton.h
include/net/if.h
include/net/if_ether.h [moved from nbsd_include/net/if_ether.h with 100% similarity]
include/net/ioctl.h [deleted file]
include/net/netlib.h
include/netconfig.h [moved from nbsd_include/netconfig.h with 100% similarity]
include/netdb.h
include/netgroup.h [moved from nbsd_include/netgroup.h with 100% similarity]
include/netinet/Makefile [moved from nbsd_include/netinet/Makefile with 100% similarity]
include/netinet/if_ether.h [deleted file]
include/netinet/in.h
include/netinet/tcp.h
include/netinet6/Makefile [moved from nbsd_include/netinet6/Makefile with 100% similarity]
include/netinet6/in6.h [moved from nbsd_include/netinet6/in6.h with 100% similarity]
include/nl_types.h [moved from nbsd_include/nl_types.h with 100% similarity]
include/nlist.h [moved from nbsd_include/nlist.h with 100% similarity]
include/nsswitch.h [moved from nbsd_include/nsswitch.h with 100% similarity]
include/paths.h
include/poll.h [deleted file]
include/prop/Makefile [moved from nbsd_include/prop/Makefile with 100% similarity]
include/prop/plistref.h [moved from nbsd_include/prop/plistref.h with 100% similarity]
include/prop/prop_array.h [moved from nbsd_include/prop/prop_array.h with 100% similarity]
include/prop/prop_bool.h [moved from nbsd_include/prop/prop_bool.h with 100% similarity]
include/prop/prop_data.h [moved from nbsd_include/prop/prop_data.h with 100% similarity]
include/prop/prop_dictionary.h [moved from nbsd_include/prop/prop_dictionary.h with 100% similarity]
include/prop/prop_ingest.h [moved from nbsd_include/prop/prop_ingest.h with 100% similarity]
include/prop/prop_number.h [moved from nbsd_include/prop/prop_number.h with 100% similarity]
include/prop/prop_object.h [moved from nbsd_include/prop/prop_object.h with 100% similarity]
include/prop/prop_string.h [moved from nbsd_include/prop/prop_string.h with 100% similarity]
include/prop/proplib.h [moved from nbsd_include/prop/proplib.h with 100% similarity]
include/protocols/dumprestore.h [moved from nbsd_include/protocols/dumprestore.h with 100% similarity]
include/protocols/routed.h [moved from nbsd_include/protocols/routed.h with 100% similarity]
include/protocols/rwhod.h [moved from nbsd_include/protocols/rwhod.h with 100% similarity]
include/protocols/talkd.h [moved from nbsd_include/protocols/talkd.h with 100% similarity]
include/protocols/timed.h [moved from nbsd_include/protocols/timed.h with 100% similarity]
include/pwd.h
include/randomid.h [moved from nbsd_include/randomid.h with 100% similarity]
include/ranlib.h [moved from nbsd_include/ranlib.h with 100% similarity]
include/re_comp.h [moved from nbsd_include/re_comp.h with 100% similarity]
include/regex.h
include/regexp.h
include/res_update.h [moved from nbsd_include/res_update.h with 100% similarity]
include/resolv.h
include/rmt.h [moved from nbsd_include/rmt.h with 100% similarity]
include/rpc/Makefile [moved from nbsd_include/rpc/Makefile with 100% similarity]
include/rpc/auth.h [moved from nbsd_include/rpc/auth.h with 100% similarity]
include/rpc/auth_unix.h [moved from nbsd_include/rpc/auth_unix.h with 100% similarity]
include/rpc/clnt.h [moved from nbsd_include/rpc/clnt.h with 100% similarity]
include/rpc/clnt_soc.h [moved from nbsd_include/rpc/clnt_soc.h with 100% similarity]
include/rpc/nettype.h [moved from nbsd_include/rpc/nettype.h with 100% similarity]
include/rpc/pmap_clnt.h [moved from nbsd_include/rpc/pmap_clnt.h with 100% similarity]
include/rpc/pmap_prot.h [moved from nbsd_include/rpc/pmap_prot.h with 100% similarity]
include/rpc/pmap_rmt.h [moved from nbsd_include/rpc/pmap_rmt.h with 100% similarity]
include/rpc/raw.h [moved from nbsd_include/rpc/raw.h with 100% similarity]
include/rpc/rpc.h [moved from nbsd_include/rpc/rpc.h with 100% similarity]
include/rpc/rpc_com.h [moved from nbsd_include/rpc/rpc_com.h with 100% similarity]
include/rpc/rpc_msg.h [moved from nbsd_include/rpc/rpc_msg.h with 100% similarity]
include/rpc/rpcb_clnt.h [moved from nbsd_include/rpc/rpcb_clnt.h with 100% similarity]
include/rpc/rpcb_prot.x [moved from nbsd_include/rpc/rpcb_prot.x with 100% similarity]
include/rpc/rpcent.h [moved from nbsd_include/rpc/rpcent.h with 100% similarity]
include/rpc/svc.h [moved from nbsd_include/rpc/svc.h with 100% similarity]
include/rpc/svc_auth.h [moved from nbsd_include/rpc/svc_auth.h with 100% similarity]
include/rpc/svc_soc.h [moved from nbsd_include/rpc/svc_soc.h with 100% similarity]
include/rpc/types.h [moved from nbsd_include/rpc/types.h with 100% similarity]
include/rpc/xdr.h [moved from nbsd_include/rpc/xdr.h with 100% similarity]
include/rpcsvc/yp_prot.h [moved from nbsd_include/rpcsvc/yp_prot.h with 100% similarity]
include/rpcsvc/ypclnt.h [moved from nbsd_include/rpcsvc/ypclnt.h with 100% similarity]
include/sa.h [moved from nbsd_include/sa.h with 100% similarity]
include/sched.h [moved from nbsd_include/sched.h with 100% similarity]
include/search.h [moved from nbsd_include/search.h with 100% similarity]
include/semaphore.h [moved from nbsd_include/semaphore.h with 100% similarity]
include/setjmp.h
include/sgtty.h
include/signal.h
include/ssp/ssp.h [moved from nbsd_include/ssp/ssp.h with 100% similarity]
include/ssp/stdio.h [moved from nbsd_include/ssp/stdio.h with 100% similarity]
include/ssp/string.h [moved from nbsd_include/ssp/string.h with 100% similarity]
include/ssp/strings.h [moved from nbsd_include/ssp/strings.h with 100% similarity]
include/ssp/unistd.h [moved from nbsd_include/ssp/unistd.h with 100% similarity]
include/stab.h [moved from nbsd_include/stab.h with 100% similarity]
include/stdarg.h [deleted file]
include/stdbool.h
include/stddef.h
include/stdint.h [deleted file]
include/stdio.h
include/stdlib.h
include/string.h
include/stringlist.h [moved from nbsd_include/stringlist.h with 100% similarity]
include/strings.h
include/struct.h [moved from nbsd_include/struct.h with 100% similarity]
include/sys/Makefile
include/sys/ansi.h [moved from nbsd_include/sys/ansi.h with 100% similarity]
include/sys/atomic.h [moved from nbsd_include/sys/atomic.h with 100% similarity]
include/sys/bitops.h [moved from nbsd_include/sys/bitops.h with 100% similarity]
include/sys/bswap.h [moved from nbsd_include/sys/bswap.h with 100% similarity]
include/sys/cdefs.h
include/sys/cdefs_aout.h [moved from nbsd_include/sys/cdefs_aout.h with 100% similarity]
include/sys/cdefs_elf.h [moved from nbsd_include/sys/cdefs_elf.h with 100% similarity]
include/sys/ctype_bits.h [moved from nbsd_include/sys/ctype_bits.h with 100% similarity]
include/sys/ctype_inline.h [moved from nbsd_include/sys/ctype_inline.h with 100% similarity]
include/sys/dirent.h [moved from nbsd_include/sys/dirent.h with 100% similarity]
include/sys/endian.h [moved from nbsd_include/sys/endian.h with 100% similarity]
include/sys/errno.h [moved from nbsd_include/sys/errno.h with 100% similarity]
include/sys/fcntl.h [moved from nbsd_include/sys/fcntl.h with 100% similarity]
include/sys/fd_set.h [moved from nbsd_include/sys/fd_set.h with 100% similarity]
include/sys/featuretest.h [moved from nbsd_include/sys/featuretest.h with 100% similarity]
include/sys/file.h
include/sys/float_ieee754.h [moved from nbsd_include/sys/float_ieee754.h with 100% similarity]
include/sys/gcq.h [moved from nbsd_include/sys/gcq.h with 100% similarity]
include/sys/gmon.h [moved from nbsd_include/sys/gmon.h with 100% similarity]
include/sys/hash.h [moved from nbsd_include/sys/hash.h with 100% similarity]
include/sys/ieee754.h [moved from nbsd_include/sys/ieee754.h with 100% similarity]
include/sys/inttypes.h [moved from nbsd_include/sys/inttypes.h with 100% similarity]
include/sys/ioc_net.h [moved from nbsd_include/sys/ioc_net.h with 100% similarity]
include/sys/ioctl.h
include/sys/ipc.h
include/sys/jmp_buf.h [deleted file]
include/sys/localedef.h [moved from nbsd_include/sys/localedef.h with 100% similarity]
include/sys/md4.h [moved from nbsd_include/sys/md4.h with 100% similarity]
include/sys/md5.h [moved from nbsd_include/sys/md5.h with 100% similarity]
include/sys/mman.h
include/sys/mount.h [moved from nbsd_include/sys/mount.h with 100% similarity]
include/sys/param.h
include/sys/poll.h
include/sys/ptrace.h
include/sys/ptree.h [moved from nbsd_include/sys/ptree.h with 100% similarity]
include/sys/rbtree.h [moved from nbsd_include/sys/rbtree.h with 100% similarity]
include/sys/reboot.h [moved from nbsd_include/sys/reboot.h with 100% similarity]
include/sys/resource.h
include/sys/rmd160.h [moved from nbsd_include/sys/rmd160.h with 100% similarity]
include/sys/select.h
include/sys/sem.h
include/sys/sha1.h [moved from nbsd_include/sys/sha1.h with 100% similarity]
include/sys/sha2.h [moved from nbsd_include/sys/sha2.h with 100% similarity]
include/sys/shm.h
include/sys/sigcontext.h [deleted file]
include/sys/siginfo.h [moved from nbsd_include/sys/siginfo.h with 100% similarity]
include/sys/signal.h
include/sys/sigtypes.h [moved from nbsd_include/sys/sigtypes.h with 100% similarity]
include/sys/socket.h
include/sys/soundcard.h [deleted file]
include/sys/stat.h
include/sys/statfs.h
include/sys/statvfs.h
include/sys/stdint.h [moved from nbsd_include/sys/stdint.h with 100% similarity]
include/sys/sysctl.h [moved from nbsd_include/sys/sysctl.h with 100% similarity]
include/sys/syslimits.h [moved from nbsd_include/sys/syslimits.h with 100% similarity]
include/sys/syslog.h [moved from nbsd_include/sys/syslog.h with 100% similarity]
include/sys/termios.h [moved from nbsd_include/sys/termios.h with 100% similarity]
include/sys/time.h
include/sys/timeb.h [deleted file]
include/sys/times.h
include/sys/tree.h [moved from nbsd_include/sys/tree.h with 100% similarity]
include/sys/ttycom.h [moved from nbsd_include/sys/ttycom.h with 100% similarity]
include/sys/ttydefaults.h [moved from nbsd_include/sys/ttydefaults.h with 100% similarity]
include/sys/types.h
include/sys/ucontext.h
include/sys/ucred.h
include/sys/uio.h
include/sys/un.h
include/sys/unistd.h [moved from nbsd_include/sys/unistd.h with 100% similarity]
include/sys/utsname.h
include/sys/uuid.h [moved from nbsd_include/sys/uuid.h with 100% similarity]
include/sys/wait.h
include/sysexits.h
include/syslog.h [deleted file]
include/tar.h
include/termcap.h [deleted file]
include/tgmath.h [moved from nbsd_include/tgmath.h with 100% similarity]
include/time.h
include/timers.h [moved from common/include/timers.h with 100% similarity]
include/ttyent.h
include/tzfile.h
include/ucontext.h
include/ufs/chfs/chfs.h [moved from nbsd_include/ufs/chfs/chfs.h with 100% similarity]
include/ufs/chfs/chfs_args.h [moved from nbsd_include/ufs/chfs/chfs_args.h with 100% similarity]
include/ufs/chfs/chfs_inode.h [moved from nbsd_include/ufs/chfs/chfs_inode.h with 100% similarity]
include/ufs/chfs/chfs_pool.h [moved from nbsd_include/ufs/chfs/chfs_pool.h with 100% similarity]
include/ufs/chfs/debug.h [moved from nbsd_include/ufs/chfs/debug.h with 100% similarity]
include/ufs/chfs/ebh.h [moved from nbsd_include/ufs/chfs/ebh.h with 100% similarity]
include/ufs/chfs/ebh_media.h [moved from nbsd_include/ufs/chfs/ebh_media.h with 100% similarity]
include/ufs/chfs/ebh_misc.h [moved from nbsd_include/ufs/chfs/ebh_misc.h with 100% similarity]
include/ufs/chfs/media.h [moved from nbsd_include/ufs/chfs/media.h with 100% similarity]
include/ufs/ext2fs/ext2fs.h [moved from nbsd_include/ufs/ext2fs/ext2fs.h with 100% similarity]
include/ufs/ext2fs/ext2fs_dinode.h [moved from nbsd_include/ufs/ext2fs/ext2fs_dinode.h with 100% similarity]
include/ufs/ext2fs/ext2fs_dir.h [moved from nbsd_include/ufs/ext2fs/ext2fs_dir.h with 100% similarity]
include/ufs/ext2fs/ext2fs_extern.h [moved from nbsd_include/ufs/ext2fs/ext2fs_extern.h with 100% similarity]
include/ufs/ffs/ffs_extern.h [moved from nbsd_include/ufs/ffs/ffs_extern.h with 100% similarity]
include/ufs/ffs/fs.h [moved from nbsd_include/ufs/ffs/fs.h with 100% similarity]
include/ufs/lfs/lfs.h [moved from nbsd_include/ufs/lfs/lfs.h with 100% similarity]
include/ufs/lfs/lfs_extern.h [moved from nbsd_include/ufs/lfs/lfs_extern.h with 100% similarity]
include/ufs/mfs/mfs_extern.h [moved from nbsd_include/ufs/mfs/mfs_extern.h with 100% similarity]
include/ufs/mfs/mfsnode.h [moved from nbsd_include/ufs/mfs/mfsnode.h with 100% similarity]
include/ufs/ufs/dinode.h [moved from nbsd_include/ufs/ufs/dinode.h with 100% similarity]
include/ufs/ufs/dir.h [moved from nbsd_include/ufs/ufs/dir.h with 100% similarity]
include/ufs/ufs/dirhash.h [moved from nbsd_include/ufs/ufs/dirhash.h with 100% similarity]
include/ufs/ufs/extattr.h [moved from nbsd_include/ufs/ufs/extattr.h with 100% similarity]
include/ufs/ufs/inode.h [moved from nbsd_include/ufs/ufs/inode.h with 100% similarity]
include/ufs/ufs/quota.h [moved from nbsd_include/ufs/ufs/quota.h with 100% similarity]
include/ufs/ufs/quota1.h [moved from nbsd_include/ufs/ufs/quota1.h with 100% similarity]
include/ufs/ufs/quota2.h [moved from nbsd_include/ufs/ufs/quota2.h with 100% similarity]
include/ufs/ufs/ufs_bswap.h [moved from nbsd_include/ufs/ufs/ufs_bswap.h with 100% similarity]
include/ufs/ufs/ufs_extern.h [moved from nbsd_include/ufs/ufs/ufs_extern.h with 100% similarity]
include/ufs/ufs/ufs_quota.h [moved from nbsd_include/ufs/ufs/ufs_quota.h with 100% similarity]
include/ufs/ufs/ufs_wapbl.h [moved from nbsd_include/ufs/ufs/ufs_wapbl.h with 100% similarity]
include/ufs/ufs/ufsmount.h [moved from nbsd_include/ufs/ufs/ufsmount.h with 100% similarity]
include/ulimit.h [moved from nbsd_include/ulimit.h with 100% similarity]
include/unistd.h
include/util.h
include/utime.h
include/utmp.h
include/utmpx.h [moved from nbsd_include/utmpx.h with 100% similarity]
include/uuid.h [moved from nbsd_include/uuid.h with 100% similarity]
include/varargs.h [moved from nbsd_include/varargs.h with 100% similarity]
include/vis.h [moved from nbsd_include/vis.h with 100% similarity]
include/wchar.h
include/wctype.h
include/wordexp.h [moved from nbsd_include/wordexp.h with 100% similarity]
kernel/Makefile
kernel/arch/i386/Makefile.inc
kernel/extract-errno.sh
kernel/extract-mfield.sh
kernel/extract-mtype.sh
lib/Makefile
lib/ack/libd/Makefile [deleted file]
lib/ack/libd/fphook.c [deleted file]
lib/ack/libe/Makefile [deleted file]
lib/ack/libe/Makefile.inc [deleted file]
lib/ack/libe/arch/i386/em/Makefile.inc [deleted file]
lib/ack/libe/arch/i386/em/byte_order.h [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_adf4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_adf8.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_cff4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_cff8.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_cfi.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_cfu.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_cif4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_cif8.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_cmf4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_cmf8.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_cuf4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_cuf8.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_dvf4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_dvf8.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_fef4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_fef8.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_fif4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_fif8.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_mlf4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_mlf8.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_ngf4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_ngf8.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_sbf4.s [deleted file]
lib/ack/libe/arch/i386/em/disconnected/em_sbf8.s [deleted file]
lib/ack/libe/arch/i386/em/em_adi.s [deleted file]
lib/ack/libe/arch/i386/em/em_and.s [deleted file]
lib/ack/libe/arch/i386/em/em_blm.s [deleted file]
lib/ack/libe/arch/i386/em/em_cii.s [deleted file]
lib/ack/libe/arch/i386/em/em_cms.s [deleted file]
lib/ack/libe/arch/i386/em/em_com.s [deleted file]
lib/ack/libe/arch/i386/em/em_csa4.s [deleted file]
lib/ack/libe/arch/i386/em/em_csb4.s [deleted file]
lib/ack/libe/arch/i386/em/em_cuu.s [deleted file]
lib/ack/libe/arch/i386/em/em_dup.s [deleted file]
lib/ack/libe/arch/i386/em/em_dvi.s [deleted file]
lib/ack/libe/arch/i386/em/em_dvu.s [deleted file]
lib/ack/libe/arch/i386/em/em_error.s [deleted file]
lib/ack/libe/arch/i386/em/em_exg.s [deleted file]
lib/ack/libe/arch/i386/em/em_fat.s [deleted file]
lib/ack/libe/arch/i386/em/em_fp8087.s [deleted file]
lib/ack/libe/arch/i386/em/em_gto.s [deleted file]
lib/ack/libe/arch/i386/em/em_hol0.s [deleted file]
lib/ack/libe/arch/i386/em/em_iaar.s [deleted file]
lib/ack/libe/arch/i386/em/em_ilar.s [deleted file]
lib/ack/libe/arch/i386/em/em_inn.s [deleted file]
lib/ack/libe/arch/i386/em/em_ior.s [deleted file]
lib/ack/libe/arch/i386/em/em_isar.s [deleted file]
lib/ack/libe/arch/i386/em/em_lar4.s [deleted file]
lib/ack/libe/arch/i386/em/em_loi.s [deleted file]
lib/ack/libe/arch/i386/em/em_mli.s [deleted file]
lib/ack/libe/arch/i386/em/em_mon.s [deleted file]
lib/ack/libe/arch/i386/em/em_ngi.s [deleted file]
lib/ack/libe/arch/i386/em/em_nop.s [deleted file]
lib/ack/libe/arch/i386/em/em_print.s [deleted file]
lib/ack/libe/arch/i386/em/em_rck.s [deleted file]
lib/ack/libe/arch/i386/em/em_rmi.s [deleted file]
lib/ack/libe/arch/i386/em/em_rmu.s [deleted file]
lib/ack/libe/arch/i386/em/em_rol.s [deleted file]
lib/ack/libe/arch/i386/em/em_ror.s [deleted file]
lib/ack/libe/arch/i386/em/em_sar4.s [deleted file]
lib/ack/libe/arch/i386/em/em_sbi.s [deleted file]
lib/ack/libe/arch/i386/em/em_set.s [deleted file]
lib/ack/libe/arch/i386/em/em_sli.s [deleted file]
lib/ack/libe/arch/i386/em/em_sri.s [deleted file]
lib/ack/libe/arch/i386/em/em_sti.s [deleted file]
lib/ack/libe/arch/i386/em/em_stop.s [deleted file]
lib/ack/libe/arch/i386/em/em_trp.s [deleted file]
lib/ack/libe/arch/i386/em/em_unknown.s [deleted file]
lib/ack/libe/arch/i386/em/em_xor.s [deleted file]
lib/ack/libe/arch/i386/head/Makefile.inc [deleted file]
lib/ack/libe/arch/i386/head/em_abs.h [deleted file]
lib/ack/libe/arch/i386/head/em_head.s [deleted file]
lib/ack/libfp/FP.script [deleted file]
lib/ack/libfp/FP_bias.h [deleted file]
lib/ack/libfp/FP_shift.h [deleted file]
lib/ack/libfp/FP_trap.h [deleted file]
lib/ack/libfp/FP_types.h [deleted file]
lib/ack/libfp/Makefile [deleted file]
lib/ack/libfp/add_ext.fc [deleted file]
lib/ack/libfp/adder.fc [deleted file]
lib/ack/libfp/adder.h [deleted file]
lib/ack/libfp/adf4.fc [deleted file]
lib/ack/libfp/adf8.fc [deleted file]
lib/ack/libfp/byte_order.h [deleted file]
lib/ack/libfp/cff4.fc [deleted file]
lib/ack/libfp/cff8.fc [deleted file]
lib/ack/libfp/cfi.fc [deleted file]
lib/ack/libfp/cfu.fc [deleted file]
lib/ack/libfp/cif4.fc [deleted file]
lib/ack/libfp/cif8.fc [deleted file]
lib/ack/libfp/cmf4.fc [deleted file]
lib/ack/libfp/cmf8.fc [deleted file]
lib/ack/libfp/compact.fc [deleted file]
lib/ack/libfp/cuf4.fc [deleted file]
lib/ack/libfp/cuf8.fc [deleted file]
lib/ack/libfp/div_ext.fc [deleted file]
lib/ack/libfp/dvf4.fc [deleted file]
lib/ack/libfp/dvf8.fc [deleted file]
lib/ack/libfp/extend.fc [deleted file]
lib/ack/libfp/fef4.fc [deleted file]
lib/ack/libfp/fef8.fc [deleted file]
lib/ack/libfp/fif4.fc [deleted file]
lib/ack/libfp/fif8.fc [deleted file]
lib/ack/libfp/fptrp.s [deleted file]
lib/ack/libfp/get_put.h [deleted file]
lib/ack/libfp/mlf4.fc [deleted file]
lib/ack/libfp/mlf8.fc [deleted file]
lib/ack/libfp/mul_ext.fc [deleted file]
lib/ack/libfp/ngf4.fc [deleted file]
lib/ack/libfp/ngf8.fc [deleted file]
lib/ack/libfp/nrm_ext.fc [deleted file]
lib/ack/libfp/sbf4.fc [deleted file]
lib/ack/libfp/sbf8.fc [deleted file]
lib/ack/libfp/sft_ext.fc [deleted file]
lib/ack/libfp/shifter.fc [deleted file]
lib/ack/libfp/sub_ext.fc [deleted file]
lib/ack/libfp/zrf4.fc [deleted file]
lib/ack/libfp/zrf8.fc [deleted file]
lib/ack/libfp/zrf_ext.fc [deleted file]
lib/ack/liby/Makefile [deleted file]
lib/ack/liby/main.c [deleted file]
lib/ack/liby/yyerror.c [deleted file]
lib/ack_build.sh [deleted file]
lib/elf_build.sh [deleted file]
lib/libarchive/Makefile
lib/libarchive/minix_utils.c [deleted file]
lib/libasyn/Makefile [moved from lib/nbsd_libasyn/Makefile with 85% similarity]
lib/libasyn/Makefile.inc [moved from lib/libc/asyn/Makefile.inc with 100% similarity]
lib/libasyn/asyn.h [moved from lib/libc/asyn/asyn.h with 100% similarity]
lib/libasyn/asyn_cancel.c [moved from lib/libc/asyn/asyn_cancel.c with 100% similarity]
lib/libasyn/asyn_close.c [moved from lib/libc/asyn/asyn_close.c with 100% similarity]
lib/libasyn/asyn_init.c [moved from lib/libc/asyn/asyn_init.c with 100% similarity]
lib/libasyn/asyn_pending.c [moved from lib/libc/asyn/asyn_pending.c with 100% similarity]
lib/libasyn/asyn_read.c [moved from lib/libc/asyn/asyn_read.c with 100% similarity]
lib/libasyn/asyn_special.c [moved from lib/libc/asyn/asyn_special.c with 100% similarity]
lib/libasyn/asyn_synch.c [moved from lib/libc/asyn/asyn_synch.c with 100% similarity]
lib/libasyn/asyn_wait.c [moved from lib/libc/asyn/asyn_wait.c with 100% similarity]
lib/libasyn/asyn_write.c [moved from lib/libc/asyn/asyn_write.c with 100% similarity]
lib/libasyn/asynchio.h [moved from include/sys/asynchio.h with 100% similarity]
lib/libc/Makefile
lib/libc/Makefile.inc
lib/libc/ack/fphook/Makefile.inc [deleted file]
lib/libc/ack/fphook/fltpr.c [deleted file]
lib/libc/ack/fphook/strtod.c [deleted file]
lib/libc/ack/math/Makefile.inc [deleted file]
lib/libc/ack/math/frexp.s [deleted file]
lib/libc/ack/math/isnan.c [deleted file]
lib/libc/ack/math/ldexp.c [deleted file]
lib/libc/ack/math/modf.s [deleted file]
lib/libc/ack/rts/Makefile.inc [deleted file]
lib/libc/ack/rts/setjmp.e [deleted file]
lib/libc/ansi/Makefile.inc [deleted file]
lib/libc/ansi/abort.c [deleted file]
lib/libc/ansi/abs.c [deleted file]
lib/libc/ansi/assert.c [deleted file]
lib/libc/ansi/atexit.c [deleted file]
lib/libc/ansi/atof.c [deleted file]
lib/libc/ansi/atoi.c [deleted file]
lib/libc/ansi/atol.c [deleted file]
lib/libc/ansi/bsearch.c [deleted file]
lib/libc/ansi/chartab.c [deleted file]
lib/libc/ansi/clock.c [deleted file]
lib/libc/ansi/difftime.c [deleted file]
lib/libc/ansi/div.c [deleted file]
lib/libc/ansi/errlist.c [deleted file]
lib/libc/ansi/exit.c [deleted file]
lib/libc/ansi/ext_comp.c [deleted file]
lib/libc/ansi/ext_fmt.h [deleted file]
lib/libc/ansi/getenv.c [deleted file]
lib/libc/ansi/isalnum.c [deleted file]
lib/libc/ansi/isalpha.c [deleted file]
lib/libc/ansi/isascii.c [deleted file]
lib/libc/ansi/isblank.c [deleted file]
lib/libc/ansi/iscntrl.c [deleted file]
lib/libc/ansi/isdigit.c [deleted file]
lib/libc/ansi/isgraph.c [deleted file]
lib/libc/ansi/islower.c [deleted file]
lib/libc/ansi/isprint.c [deleted file]
lib/libc/ansi/ispunct.c [deleted file]
lib/libc/ansi/isspace.c [deleted file]
lib/libc/ansi/isupper.c [deleted file]
lib/libc/ansi/isxdigit.c [deleted file]
lib/libc/ansi/labs.c [deleted file]
lib/libc/ansi/ldiv.c [deleted file]
lib/libc/ansi/loc_time.h [deleted file]
lib/libc/ansi/localeconv.c [deleted file]
lib/libc/ansi/mblen.c [deleted file]
lib/libc/ansi/mbstowcs.c [deleted file]
lib/libc/ansi/mbtowc.c [deleted file]
lib/libc/ansi/memchr.c [deleted file]
lib/libc/ansi/memcmp.c [deleted file]
lib/libc/ansi/memcpy.c [deleted file]
lib/libc/ansi/memmove.c [deleted file]
lib/libc/ansi/memset.c [deleted file]
lib/libc/ansi/misc.c [deleted file]
lib/libc/ansi/qsort.c [deleted file]
lib/libc/ansi/rand.c [deleted file]
lib/libc/ansi/setlocale.c [deleted file]
lib/libc/ansi/sigmisc.c [deleted file]
lib/libc/ansi/signal.c [deleted file]
lib/libc/ansi/strcat.c [deleted file]
lib/libc/ansi/strchr.c [deleted file]
lib/libc/ansi/strcmp.c [deleted file]
lib/libc/ansi/strcoll.c [deleted file]
lib/libc/ansi/strcpy.c [deleted file]
lib/libc/ansi/strcspn.c [deleted file]
lib/libc/ansi/strerror.c [deleted file]
lib/libc/ansi/strlen.c [deleted file]
lib/libc/ansi/strncat.c [deleted file]
lib/libc/ansi/strncmp.c [deleted file]
lib/libc/ansi/strncpy.c [deleted file]
lib/libc/ansi/strpbrk.c [deleted file]
lib/libc/ansi/strrchr.c [deleted file]
lib/libc/ansi/strspn.c [deleted file]
lib/libc/ansi/strstr.c [deleted file]
lib/libc/ansi/strtok.c [deleted file]
lib/libc/ansi/strtol.c [deleted file]
lib/libc/ansi/strxfrm.c [deleted file]
lib/libc/ansi/system.c [deleted file]
lib/libc/ansi/tolower.c [deleted file]
lib/libc/ansi/toupper.c [deleted file]
lib/libc/ansi/wcstombs.c [deleted file]
lib/libc/ansi/wctomb.c [deleted file]
lib/libc/arch/alpha/Makefile.inc [moved from lib/nbsd_libc/arch/alpha/Makefile.inc with 100% similarity]
lib/libc/arch/alpha/SYS.h [moved from lib/nbsd_libc/arch/alpha/SYS.h with 100% similarity]
lib/libc/arch/alpha/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/alpha/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/alpha/gdtoa/arith.h [moved from lib/nbsd_libc/arch/alpha/gdtoa/arith.h with 100% similarity]
lib/libc/arch/alpha/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/alpha/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/alpha/gen/Makefile.inc [moved from lib/nbsd_libc/arch/alpha/gen/Makefile.inc with 100% similarity]
lib/libc/arch/alpha/gen/__longjmp14.c [moved from lib/nbsd_libc/arch/alpha/gen/__longjmp14.c with 100% similarity]
lib/libc/arch/alpha/gen/__setjmp14.S [moved from lib/nbsd_libc/arch/alpha/gen/__setjmp14.S with 100% similarity]
lib/libc/arch/alpha/gen/__sigsetjmp14.S [moved from lib/nbsd_libc/arch/alpha/gen/__sigsetjmp14.S with 100% similarity]
lib/libc/arch/alpha/gen/_lwp.c [moved from lib/nbsd_libc/arch/alpha/gen/_lwp.c with 100% similarity]
lib/libc/arch/alpha/gen/_resumecontext.S [moved from lib/nbsd_libc/arch/alpha/gen/_resumecontext.S with 100% similarity]
lib/libc/arch/alpha/gen/divrem.m4 [moved from lib/nbsd_libc/arch/alpha/gen/divrem.m4 with 100% similarity]
lib/libc/arch/alpha/gen/fabs.S [moved from lib/nbsd_libc/arch/alpha/gen/fabs.S with 100% similarity]
lib/libc/arch/alpha/gen/flt_rounds.c [moved from lib/nbsd_libc/arch/alpha/gen/flt_rounds.c with 100% similarity]
lib/libc/arch/alpha/gen/fpgetmask.c [moved from lib/nbsd_libc/arch/alpha/gen/fpgetmask.c with 100% similarity]
lib/libc/arch/alpha/gen/fpgetround.c [moved from lib/nbsd_libc/arch/alpha/gen/fpgetround.c with 100% similarity]
lib/libc/arch/alpha/gen/fpgetsticky.c [moved from lib/nbsd_libc/arch/alpha/gen/fpgetsticky.c with 100% similarity]
lib/libc/arch/alpha/gen/fpsetmask.c [moved from lib/nbsd_libc/arch/alpha/gen/fpsetmask.c with 100% similarity]
lib/libc/arch/alpha/gen/fpsetround.c [moved from lib/nbsd_libc/arch/alpha/gen/fpsetround.c with 100% similarity]
lib/libc/arch/alpha/gen/fpsetsticky.c [moved from lib/nbsd_libc/arch/alpha/gen/fpsetsticky.c with 100% similarity]
lib/libc/arch/alpha/gen/makecontext.c [moved from lib/nbsd_libc/arch/alpha/gen/makecontext.c with 100% similarity]
lib/libc/arch/alpha/gen/nanf.c [moved from lib/nbsd_libc/arch/alpha/gen/nanf.c with 100% similarity]
lib/libc/arch/alpha/gen/resumecontext.c [moved from lib/nbsd_libc/arch/alpha/gen/resumecontext.c with 100% similarity]
lib/libc/arch/alpha/gen/swapcontext.S [moved from lib/nbsd_libc/arch/alpha/gen/swapcontext.S with 100% similarity]
lib/libc/arch/alpha/genassym.cf [moved from lib/nbsd_libc/arch/alpha/genassym.cf with 100% similarity]
lib/libc/arch/alpha/gmon/Makefile.inc [moved from lib/nbsd_libc/arch/alpha/gmon/Makefile.inc with 100% similarity]
lib/libc/arch/alpha/net/Makefile.inc [moved from lib/nbsd_libc/arch/alpha/net/Makefile.inc with 100% similarity]
lib/libc/arch/alpha/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/alpha/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/alpha/string/Makefile.inc [moved from lib/nbsd_libc/arch/alpha/string/Makefile.inc with 100% similarity]
lib/libc/arch/alpha/sys/__clone.S [moved from lib/nbsd_libc/arch/alpha/sys/__clone.S with 100% similarity]
lib/libc/arch/alpha/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/alpha/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/alpha/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/alpha/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/alpha/sys/__syscall.S [moved from lib/nbsd_libc/arch/alpha/sys/__syscall.S with 100% similarity]
lib/libc/arch/alpha/sys/__vfork14.S [moved from lib/nbsd_libc/arch/alpha/sys/__vfork14.S with 100% similarity]
lib/libc/arch/alpha/sys/brk.S [moved from lib/nbsd_libc/arch/alpha/sys/brk.S with 100% similarity]
lib/libc/arch/alpha/sys/cerror.S [moved from lib/nbsd_libc/arch/alpha/sys/cerror.S with 100% similarity]
lib/libc/arch/alpha/sys/exect.S [moved from lib/nbsd_libc/arch/alpha/sys/exect.S with 100% similarity]
lib/libc/arch/alpha/sys/fork.S [moved from lib/nbsd_libc/arch/alpha/sys/fork.S with 100% similarity]
lib/libc/arch/alpha/sys/getcontext.S [moved from lib/nbsd_libc/arch/alpha/sys/getcontext.S with 100% similarity]
lib/libc/arch/alpha/sys/pipe.S [moved from lib/nbsd_libc/arch/alpha/sys/pipe.S with 100% similarity]
lib/libc/arch/alpha/sys/ptrace.S [moved from lib/nbsd_libc/arch/alpha/sys/ptrace.S with 100% similarity]
lib/libc/arch/alpha/sys/sbrk.S [moved from lib/nbsd_libc/arch/alpha/sys/sbrk.S with 100% similarity]
lib/libc/arch/alpha/sys/shmat.S [moved from lib/nbsd_libc/arch/alpha/sys/shmat.S with 100% similarity]
lib/libc/arch/alpha/sys/syscall.S [moved from lib/nbsd_libc/arch/alpha/sys/syscall.S with 100% similarity]
lib/libc/arch/arm/Makefile.inc [moved from lib/nbsd_libc/arch/arm/Makefile.inc with 100% similarity]
lib/libc/arch/arm/SYS.h [moved from lib/nbsd_libc/arch/arm/SYS.h with 100% similarity]
lib/libc/arch/arm/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/arm/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/arm/gdtoa/arith.h [moved from lib/nbsd_libc/arch/arm/gdtoa/arith.h with 100% similarity]
lib/libc/arch/arm/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/arm/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/arm/gen/Makefile.inc [moved from lib/nbsd_libc/arch/arm/gen/Makefile.inc with 100% similarity]
lib/libc/arch/arm/gen/_lwp.c [moved from lib/nbsd_libc/arch/arm/gen/_lwp.c with 100% similarity]
lib/libc/arch/arm/gen/_setjmp.S [moved from lib/nbsd_libc/arch/arm/gen/_setjmp.S with 100% similarity]
lib/libc/arch/arm/gen/alloca.S [moved from lib/nbsd_libc/arch/arm/gen/alloca.S with 100% similarity]
lib/libc/arch/arm/gen/fabs.c [moved from lib/nbsd_libc/arch/arm/gen/fabs.c with 100% similarity]
lib/libc/arch/arm/gen/flt_rounds.c [moved from lib/nbsd_libc/arch/arm/gen/flt_rounds.c with 100% similarity]
lib/libc/arch/arm/gen/makecontext.c [moved from lib/nbsd_libc/arch/arm/gen/makecontext.c with 100% similarity]
lib/libc/arch/arm/gen/nanf.c [moved from lib/nbsd_libc/arch/arm/gen/nanf.c with 100% similarity]
lib/libc/arch/arm/gen/resumecontext.c [moved from lib/nbsd_libc/arch/arm/gen/resumecontext.c with 100% similarity]
lib/libc/arch/arm/gen/setjmp.S [moved from lib/nbsd_libc/arch/arm/gen/setjmp.S with 100% similarity]
lib/libc/arch/arm/gen/sigsetjmp.S [moved from lib/nbsd_libc/arch/arm/gen/sigsetjmp.S with 100% similarity]
lib/libc/arch/arm/gen/swapcontext.S [moved from lib/nbsd_libc/arch/arm/gen/swapcontext.S with 100% similarity]
lib/libc/arch/arm/hardfloat/fpgetmask.S [moved from lib/nbsd_libc/arch/arm/hardfloat/fpgetmask.S with 100% similarity]
lib/libc/arch/arm/hardfloat/fpgetround.c [moved from lib/nbsd_libc/arch/arm/hardfloat/fpgetround.c with 100% similarity]
lib/libc/arch/arm/hardfloat/fpgetsticky.S [moved from lib/nbsd_libc/arch/arm/hardfloat/fpgetsticky.S with 100% similarity]
lib/libc/arch/arm/hardfloat/fpsetmask.S [moved from lib/nbsd_libc/arch/arm/hardfloat/fpsetmask.S with 100% similarity]
lib/libc/arch/arm/hardfloat/fpsetround.c [moved from lib/nbsd_libc/arch/arm/hardfloat/fpsetround.c with 100% similarity]
lib/libc/arch/arm/hardfloat/fpsetsticky.S [moved from lib/nbsd_libc/arch/arm/hardfloat/fpsetsticky.S with 100% similarity]
lib/libc/arch/arm/net/Makefile.inc [moved from lib/nbsd_libc/arch/arm/net/Makefile.inc with 100% similarity]
lib/libc/arch/arm/softfloat/arm-gcc.h [moved from lib/nbsd_libc/arch/arm/softfloat/arm-gcc.h with 100% similarity]
lib/libc/arch/arm/softfloat/milieu.h [moved from lib/nbsd_libc/arch/arm/softfloat/milieu.h with 100% similarity]
lib/libc/arch/arm/softfloat/softfloat.h [moved from lib/nbsd_libc/arch/arm/softfloat/softfloat.h with 100% similarity]
lib/libc/arch/arm/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/arm/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/arm/string/Makefile.inc [moved from lib/nbsd_libc/arch/arm/string/Makefile.inc with 100% similarity]
lib/libc/arch/arm/string/bcopy.S [moved from lib/nbsd_libc/arch/arm/string/bcopy.S with 100% similarity]
lib/libc/arch/arm/string/bzero.S [moved from lib/nbsd_libc/arch/arm/string/bzero.S with 100% similarity]
lib/libc/arch/arm/sys/__clone.S [moved from lib/nbsd_libc/arch/arm/sys/__clone.S with 100% similarity]
lib/libc/arch/arm/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/arm/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/arm/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/arm/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/arm/sys/__syscall.S [moved from lib/nbsd_libc/arch/arm/sys/__syscall.S with 100% similarity]
lib/libc/arch/arm/sys/__vfork14.S [moved from lib/nbsd_libc/arch/arm/sys/__vfork14.S with 100% similarity]
lib/libc/arch/arm/sys/brk.S [moved from lib/nbsd_libc/arch/arm/sys/brk.S with 100% similarity]
lib/libc/arch/arm/sys/cerror.S [moved from lib/nbsd_libc/arch/arm/sys/cerror.S with 100% similarity]
lib/libc/arch/arm/sys/exect.S [moved from lib/nbsd_libc/arch/arm/sys/exect.S with 100% similarity]
lib/libc/arch/arm/sys/fork.S [moved from lib/nbsd_libc/arch/arm/sys/fork.S with 100% similarity]
lib/libc/arch/arm/sys/getcontext.S [moved from lib/nbsd_libc/arch/arm/sys/getcontext.S with 100% similarity]
lib/libc/arch/arm/sys/pipe.S [moved from lib/nbsd_libc/arch/arm/sys/pipe.S with 100% similarity]
lib/libc/arch/arm/sys/ptrace.S [moved from lib/nbsd_libc/arch/arm/sys/ptrace.S with 100% similarity]
lib/libc/arch/arm/sys/sbrk.S [moved from lib/nbsd_libc/arch/arm/sys/sbrk.S with 100% similarity]
lib/libc/arch/arm/sys/shmat.S [moved from lib/nbsd_libc/arch/arm/sys/shmat.S with 100% similarity]
lib/libc/arch/arm/sys/syscall.S [moved from lib/nbsd_libc/arch/arm/sys/syscall.S with 100% similarity]
lib/libc/arch/hppa/DEFS.h [moved from lib/nbsd_libc/arch/hppa/DEFS.h with 100% similarity]
lib/libc/arch/hppa/Makefile.inc [moved from lib/nbsd_libc/arch/hppa/Makefile.inc with 100% similarity]
lib/libc/arch/hppa/SYS.h [moved from lib/nbsd_libc/arch/hppa/SYS.h with 100% similarity]
lib/libc/arch/hppa/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/hppa/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/hppa/gdtoa/arith.h [moved from lib/nbsd_libc/arch/hppa/gdtoa/arith.h with 100% similarity]
lib/libc/arch/hppa/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/hppa/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/hppa/gen/Makefile.inc [moved from lib/nbsd_libc/arch/hppa/gen/Makefile.inc with 100% similarity]
lib/libc/arch/hppa/gen/__longjmp14.c [moved from lib/nbsd_libc/arch/hppa/gen/__longjmp14.c with 100% similarity]
lib/libc/arch/hppa/gen/__setjmp14.S [moved from lib/nbsd_libc/arch/hppa/gen/__setjmp14.S with 100% similarity]
lib/libc/arch/hppa/gen/__sigsetjmp14.S [moved from lib/nbsd_libc/arch/hppa/gen/__sigsetjmp14.S with 100% similarity]
lib/libc/arch/hppa/gen/_lwp.c [moved from lib/nbsd_libc/arch/hppa/gen/_lwp.c with 100% similarity]
lib/libc/arch/hppa/gen/_resumecontext.S [moved from lib/nbsd_libc/arch/hppa/gen/_resumecontext.S with 100% similarity]
lib/libc/arch/hppa/gen/_setjmp.S [moved from lib/nbsd_libc/arch/hppa/gen/_setjmp.S with 100% similarity]
lib/libc/arch/hppa/gen/fabs.c [moved from lib/nbsd_libc/arch/hppa/gen/fabs.c with 100% similarity]
lib/libc/arch/hppa/gen/flt_rounds.c [moved from lib/nbsd_libc/arch/hppa/gen/flt_rounds.c with 100% similarity]
lib/libc/arch/hppa/gen/fpgetmask.c [moved from lib/nbsd_libc/arch/hppa/gen/fpgetmask.c with 100% similarity]
lib/libc/arch/hppa/gen/fpgetround.c [moved from lib/nbsd_libc/arch/hppa/gen/fpgetround.c with 100% similarity]
lib/libc/arch/hppa/gen/fpgetsticky.c [moved from lib/nbsd_libc/arch/hppa/gen/fpgetsticky.c with 100% similarity]
lib/libc/arch/hppa/gen/fpsetmask.c [moved from lib/nbsd_libc/arch/hppa/gen/fpsetmask.c with 100% similarity]
lib/libc/arch/hppa/gen/fpsetround.c [moved from lib/nbsd_libc/arch/hppa/gen/fpsetround.c with 100% similarity]
lib/libc/arch/hppa/gen/fpsetsticky.c [moved from lib/nbsd_libc/arch/hppa/gen/fpsetsticky.c with 100% similarity]
lib/libc/arch/hppa/gen/makecontext.c [moved from lib/nbsd_libc/arch/hppa/gen/makecontext.c with 100% similarity]
lib/libc/arch/hppa/gen/nanf.c [moved from lib/nbsd_libc/arch/hppa/gen/nanf.c with 100% similarity]
lib/libc/arch/hppa/gen/resumecontext.c [moved from lib/nbsd_libc/arch/hppa/gen/resumecontext.c with 100% similarity]
lib/libc/arch/hppa/gen/swapcontext.S [moved from lib/nbsd_libc/arch/hppa/gen/swapcontext.S with 100% similarity]
lib/libc/arch/hppa/net/Makefile.inc [moved from lib/nbsd_libc/arch/hppa/net/Makefile.inc with 100% similarity]
lib/libc/arch/hppa/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/hppa/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/hppa/string/Makefile.inc [moved from lib/nbsd_libc/arch/hppa/string/Makefile.inc with 100% similarity]
lib/libc/arch/hppa/string/bcmp.S [moved from lib/nbsd_libc/arch/hppa/string/bcmp.S with 100% similarity]
lib/libc/arch/hppa/string/bzero.S [moved from lib/nbsd_libc/arch/hppa/string/bzero.S with 100% similarity]
lib/libc/arch/hppa/string/ffs.S [moved from lib/nbsd_libc/arch/hppa/string/ffs.S with 100% similarity]
lib/libc/arch/hppa/string/strlcpy.S [moved from lib/nbsd_libc/arch/hppa/string/strlcpy.S with 100% similarity]
lib/libc/arch/hppa/sys/__clone.S [moved from lib/nbsd_libc/arch/hppa/sys/__clone.S with 100% similarity]
lib/libc/arch/hppa/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/hppa/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/hppa/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/hppa/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/hppa/sys/__syscall.S [moved from lib/nbsd_libc/arch/hppa/sys/__syscall.S with 100% similarity]
lib/libc/arch/hppa/sys/__vfork14.S [moved from lib/nbsd_libc/arch/hppa/sys/__vfork14.S with 100% similarity]
lib/libc/arch/hppa/sys/brk.S [moved from lib/nbsd_libc/arch/hppa/sys/brk.S with 100% similarity]
lib/libc/arch/hppa/sys/cerror.S [moved from lib/nbsd_libc/arch/hppa/sys/cerror.S with 100% similarity]
lib/libc/arch/hppa/sys/exect.S [moved from lib/nbsd_libc/arch/hppa/sys/exect.S with 100% similarity]
lib/libc/arch/hppa/sys/fork.S [moved from lib/nbsd_libc/arch/hppa/sys/fork.S with 100% similarity]
lib/libc/arch/hppa/sys/getcontext.S [moved from lib/nbsd_libc/arch/hppa/sys/getcontext.S with 100% similarity]
lib/libc/arch/hppa/sys/pipe.S [moved from lib/nbsd_libc/arch/hppa/sys/pipe.S with 100% similarity]
lib/libc/arch/hppa/sys/ptrace.S [moved from lib/nbsd_libc/arch/hppa/sys/ptrace.S with 100% similarity]
lib/libc/arch/hppa/sys/sbrk.S [moved from lib/nbsd_libc/arch/hppa/sys/sbrk.S with 100% similarity]
lib/libc/arch/hppa/sys/shmat.S [moved from lib/nbsd_libc/arch/hppa/sys/shmat.S with 100% similarity]
lib/libc/arch/hppa/sys/syscall.S [moved from lib/nbsd_libc/arch/hppa/sys/syscall.S with 100% similarity]
lib/libc/arch/i386/Makefile.inc [moved from lib/nbsd_libc/arch/i386/Makefile.inc with 100% similarity]
lib/libc/arch/i386/SYS.h [moved from lib/nbsd_libc/arch/i386/SYS.h with 100% similarity]
lib/libc/arch/i386/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/i386/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/i386/gdtoa/arith.h [moved from lib/nbsd_libc/arch/i386/gdtoa/arith.h with 100% similarity]
lib/libc/arch/i386/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/i386/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/i386/gen/Makefile.inc [moved from lib/nbsd_libc/arch/i386/gen/Makefile.inc with 100% similarity]
lib/libc/arch/i386/gen/_lwp.c [moved from lib/nbsd_libc/arch/i386/gen/_lwp.c with 100% similarity]
lib/libc/arch/i386/gen/_setjmp.S [moved from lib/nbsd_libc/arch/i386/gen/_setjmp.S with 100% similarity]
lib/libc/arch/i386/gen/alloca.S [moved from lib/nbsd_libc/arch/i386/gen/alloca.S with 100% similarity]
lib/libc/arch/i386/gen/divsi3.S [moved from lib/nbsd_libc/arch/i386/gen/divsi3.S with 100% similarity]
lib/libc/arch/i386/gen/fabs.S [moved from lib/nbsd_libc/arch/i386/gen/fabs.S with 100% similarity]
lib/libc/arch/i386/gen/fixdfsi.S [moved from lib/nbsd_libc/arch/i386/gen/fixdfsi.S with 100% similarity]
lib/libc/arch/i386/gen/fixunsdfsi.S [moved from lib/nbsd_libc/arch/i386/gen/fixunsdfsi.S with 100% similarity]
lib/libc/arch/i386/gen/flt_rounds.S [moved from lib/nbsd_libc/arch/i386/gen/flt_rounds.S with 100% similarity]
lib/libc/arch/i386/gen/fpclassifyl.c [moved from lib/nbsd_libc/arch/i386/gen/fpclassifyl.c with 100% similarity]
lib/libc/arch/i386/gen/fpgetmask.S [moved from lib/nbsd_libc/arch/i386/gen/fpgetmask.S with 100% similarity]
lib/libc/arch/i386/gen/fpgetround.S [moved from lib/nbsd_libc/arch/i386/gen/fpgetround.S with 100% similarity]
lib/libc/arch/i386/gen/fpgetsticky.S [moved from lib/nbsd_libc/arch/i386/gen/fpgetsticky.S with 100% similarity]
lib/libc/arch/i386/gen/fpsetmask.S [moved from lib/nbsd_libc/arch/i386/gen/fpsetmask.S with 100% similarity]
lib/libc/arch/i386/gen/fpsetround.S [moved from lib/nbsd_libc/arch/i386/gen/fpsetround.S with 100% similarity]
lib/libc/arch/i386/gen/fpsetsticky.S [moved from lib/nbsd_libc/arch/i386/gen/fpsetsticky.S with 100% similarity]
lib/libc/arch/i386/gen/infinityl.c [moved from lib/nbsd_libc/arch/i386/gen/infinityl.c with 100% similarity]
lib/libc/arch/i386/gen/isfinitel.c [moved from lib/nbsd_libc/arch/i386/gen/isfinitel.c with 100% similarity]
lib/libc/arch/i386/gen/isinfl.c [moved from lib/nbsd_libc/arch/i386/gen/isinfl.c with 100% similarity]
lib/libc/arch/i386/gen/isnanl.c [moved from lib/nbsd_libc/arch/i386/gen/isnanl.c with 100% similarity]
lib/libc/arch/i386/gen/makecontext.c [moved from lib/nbsd_libc/arch/i386/gen/makecontext.c with 100% similarity]
lib/libc/arch/i386/gen/nanf.c [moved from lib/nbsd_libc/arch/i386/gen/nanf.c with 100% similarity]
lib/libc/arch/i386/gen/resumecontext.S [moved from lib/nbsd_libc/arch/i386/gen/resumecontext.S with 100% similarity]
lib/libc/arch/i386/gen/setjmp.S [moved from lib/nbsd_libc/arch/i386/gen/setjmp.S with 100% similarity]
lib/libc/arch/i386/gen/signbitl.c [moved from lib/nbsd_libc/arch/i386/gen/signbitl.c with 100% similarity]
lib/libc/arch/i386/gen/sigsetjmp.S [moved from lib/nbsd_libc/arch/i386/gen/sigsetjmp.S with 100% similarity]
lib/libc/arch/i386/gen/swapcontext.S [moved from lib/nbsd_libc/arch/i386/gen/swapcontext.S with 100% similarity]
lib/libc/arch/i386/gen/udivsi3.S [moved from lib/nbsd_libc/arch/i386/gen/udivsi3.S with 100% similarity]
lib/libc/arch/i386/int64/Makefile.inc [deleted file]
lib/libc/arch/i386/int64/add64.S [deleted file]
lib/libc/arch/i386/int64/add64u.S [deleted file]
lib/libc/arch/i386/int64/bsr64.S [deleted file]
lib/libc/arch/i386/int64/cmp64.S [deleted file]
lib/libc/arch/i386/int64/cv64u.S [deleted file]
lib/libc/arch/i386/int64/cvu64.S [deleted file]
lib/libc/arch/i386/int64/diff64.S [deleted file]
lib/libc/arch/i386/int64/div64.c [deleted file]
lib/libc/arch/i386/int64/div64u.S [deleted file]
lib/libc/arch/i386/int64/ex64.S [deleted file]
lib/libc/arch/i386/int64/make64.S [deleted file]
lib/libc/arch/i386/int64/mul64.c [deleted file]
lib/libc/arch/i386/int64/mul64u.S [deleted file]
lib/libc/arch/i386/int64/sub64.S [deleted file]
lib/libc/arch/i386/int64/sub64u.S [deleted file]
lib/libc/arch/i386/math/Makefile.inc [deleted file]
lib/libc/arch/i386/math/arch_compare.c [deleted file]
lib/libc/arch/i386/math/arch_round.c [deleted file]
lib/libc/arch/i386/math/fegetround.c [deleted file]
lib/libc/arch/i386/math/feholdexcept.c [deleted file]
lib/libc/arch/i386/math/fesetround.c [deleted file]
lib/libc/arch/i386/math/fpu_cw.S [deleted file]
lib/libc/arch/i386/math/fpu_cw.h [deleted file]
lib/libc/arch/i386/math/fpu_round.S [deleted file]
lib/libc/arch/i386/math/fpu_round.h [deleted file]
lib/libc/arch/i386/math/fpu_sw.S [deleted file]
lib/libc/arch/i386/math/fpu_sw.h [deleted file]
lib/libc/arch/i386/misc/Makefile.inc [deleted file]
lib/libc/arch/i386/misc/_cpufeature.c [deleted file]
lib/libc/arch/i386/misc/alloca.S [deleted file]
lib/libc/arch/i386/net/Makefile.inc [moved from lib/nbsd_libc/arch/i386/net/Makefile.inc with 100% similarity]
lib/libc/arch/i386/rts/Makefile.inc [deleted file]
lib/libc/arch/i386/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/i386/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/i386/stdlib/abs.S [moved from lib/nbsd_libc/arch/i386/stdlib/abs.S with 100% similarity]
lib/libc/arch/i386/stdlib/div.S [moved from lib/nbsd_libc/arch/i386/stdlib/div.S with 100% similarity]
lib/libc/arch/i386/stdlib/labs.S [moved from lib/nbsd_libc/arch/i386/stdlib/labs.S with 100% similarity]
lib/libc/arch/i386/stdlib/ldiv.S [moved from lib/nbsd_libc/arch/i386/stdlib/ldiv.S with 100% similarity]
lib/libc/arch/i386/stdlib/llabs.S [moved from lib/nbsd_libc/arch/i386/stdlib/llabs.S with 100% similarity]
lib/libc/arch/i386/string/Makefile.inc
lib/libc/arch/i386/string/README [deleted file]
lib/libc/arch/i386/string/_memmove.S [deleted file]
lib/libc/arch/i386/string/_strncat.S [deleted file]
lib/libc/arch/i386/string/_strncmp.S [deleted file]
lib/libc/arch/i386/string/_strncpy.S [deleted file]
lib/libc/arch/i386/string/_strnlen.S [deleted file]
lib/libc/arch/i386/string/bcmp.S
lib/libc/arch/i386/string/bcopy.S
lib/libc/arch/i386/string/bzero.S
lib/libc/arch/i386/string/index.S
lib/libc/arch/i386/string/memchr.S [deleted file]
lib/libc/arch/i386/string/memcmp.S [deleted file]
lib/libc/arch/i386/string/memcpy.S [deleted file]
lib/libc/arch/i386/string/memmove.S [deleted file]
lib/libc/arch/i386/string/memset.S [deleted file]
lib/libc/arch/i386/string/rindex.S
lib/libc/arch/i386/string/strcat.S [deleted file]
lib/libc/arch/i386/string/strchr.S [deleted file]
lib/libc/arch/i386/string/strcmp.S [deleted file]
lib/libc/arch/i386/string/strcpy.S [deleted file]
lib/libc/arch/i386/string/strlen.S [deleted file]
lib/libc/arch/i386/string/strncat.S [deleted file]
lib/libc/arch/i386/string/strncmp.S
lib/libc/arch/i386/string/strncpy.S [deleted file]
lib/libc/arch/i386/string/strnlen.S [deleted file]
lib/libc/arch/i386/string/strrchr.S [deleted file]
lib/libc/arch/i386/string/swab.S [moved from lib/nbsd_libc/arch/i386/string/swab.S with 100% similarity]
lib/libc/arch/i386/sys-minix/Makefile.inc [moved from lib/nbsd_libc/arch/i386/sys-minix/Makefile.inc with 100% similarity]
lib/libc/arch/i386/sys-minix/__sigreturn.S [moved from lib/libc/arch/i386/rts/__sigreturn.S with 100% similarity]
lib/libc/arch/i386/sys-minix/_ipc.S [moved from lib/libc/arch/i386/rts/_ipc.S with 100% similarity]
lib/libc/arch/i386/sys-minix/_senda.S [moved from lib/libc/arch/i386/rts/_senda.S with 100% similarity]
lib/libc/arch/i386/sys-minix/brksize.S [moved from lib/libc/arch/i386/rts/brksize.S with 100% similarity]
lib/libc/arch/i386/sys-minix/ucontext.S [moved from lib/libc/arch/i386/misc/ucontext.S with 100% similarity]
lib/libc/arch/i386/sys/__clone.S [moved from lib/nbsd_libc/arch/i386/sys/__clone.S with 100% similarity]
lib/libc/arch/i386/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/i386/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/i386/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/i386/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/i386/sys/__syscall.S [moved from lib/nbsd_libc/arch/i386/sys/__syscall.S with 100% similarity]
lib/libc/arch/i386/sys/__vfork14.S [moved from lib/nbsd_libc/arch/i386/sys/__vfork14.S with 100% similarity]
lib/libc/arch/i386/sys/brk.S [moved from lib/nbsd_libc/arch/i386/sys/brk.S with 100% similarity]
lib/libc/arch/i386/sys/cerror.S [moved from lib/nbsd_libc/arch/i386/sys/cerror.S with 100% similarity]
lib/libc/arch/i386/sys/exect.S [moved from lib/nbsd_libc/arch/i386/sys/exect.S with 100% similarity]
lib/libc/arch/i386/sys/fork.S [moved from lib/nbsd_libc/arch/i386/sys/fork.S with 100% similarity]
lib/libc/arch/i386/sys/getcontext.S [moved from lib/nbsd_libc/arch/i386/sys/getcontext.S with 100% similarity]
lib/libc/arch/i386/sys/pipe.S [moved from lib/nbsd_libc/arch/i386/sys/pipe.S with 100% similarity]
lib/libc/arch/i386/sys/ptrace.S [moved from lib/nbsd_libc/arch/i386/sys/ptrace.S with 100% similarity]
lib/libc/arch/i386/sys/sbrk.S [moved from lib/nbsd_libc/arch/i386/sys/sbrk.S with 100% similarity]
lib/libc/arch/i386/sys/shmat.S [moved from lib/nbsd_libc/arch/i386/sys/shmat.S with 100% similarity]
lib/libc/arch/i386/sys/syscall.S [moved from lib/nbsd_libc/arch/i386/sys/syscall.S with 100% similarity]
lib/libc/arch/ia64/Makefile.inc [moved from lib/nbsd_libc/arch/ia64/Makefile.inc with 100% similarity]
lib/libc/arch/ia64/SYS.h [moved from lib/nbsd_libc/arch/ia64/SYS.h with 100% similarity]
lib/libc/arch/ia64/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/ia64/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/ia64/gdtoa/arith.h [moved from lib/nbsd_libc/arch/ia64/gdtoa/arith.h with 100% similarity]
lib/libc/arch/ia64/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/ia64/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/ia64/gen/Makefile.inc [moved from lib/nbsd_libc/arch/ia64/gen/Makefile.inc with 100% similarity]
lib/libc/arch/ia64/gen/flt_rounds.c [moved from lib/nbsd_libc/arch/ia64/gen/flt_rounds.c with 100% similarity]
lib/libc/arch/ia64/gen/fpgetmask.c [moved from lib/nbsd_libc/arch/ia64/gen/fpgetmask.c with 100% similarity]
lib/libc/arch/ia64/gen/fpgetround.c [moved from lib/nbsd_libc/arch/ia64/gen/fpgetround.c with 100% similarity]
lib/libc/arch/ia64/gen/fpsetmask.c [moved from lib/nbsd_libc/arch/ia64/gen/fpsetmask.c with 100% similarity]
lib/libc/arch/ia64/gen/fpsetround.c [moved from lib/nbsd_libc/arch/ia64/gen/fpsetround.c with 100% similarity]
lib/libc/arch/ia64/net/Makefile.inc [moved from lib/nbsd_libc/arch/ia64/net/Makefile.inc with 100% similarity]
lib/libc/arch/ia64/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/ia64/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/ia64/string/Makefile.inc [moved from lib/nbsd_libc/arch/ia64/string/Makefile.inc with 100% similarity]
lib/libc/arch/ia64/sys/__clone.S [moved from lib/nbsd_libc/arch/ia64/sys/__clone.S with 100% similarity]
lib/libc/arch/ia64/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/ia64/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/ia64/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/ia64/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/ia64/sys/__syscall.S [moved from lib/nbsd_libc/arch/ia64/sys/__syscall.S with 100% similarity]
lib/libc/arch/ia64/sys/__vfork14.S [moved from lib/nbsd_libc/arch/ia64/sys/__vfork14.S with 100% similarity]
lib/libc/arch/ia64/sys/brk.S [moved from lib/nbsd_libc/arch/ia64/sys/brk.S with 100% similarity]
lib/libc/arch/ia64/sys/cerror.S [moved from lib/nbsd_libc/arch/ia64/sys/cerror.S with 100% similarity]
lib/libc/arch/ia64/sys/exect.S [moved from lib/nbsd_libc/arch/ia64/sys/exect.S with 100% similarity]
lib/libc/arch/ia64/sys/fork.S [moved from lib/nbsd_libc/arch/ia64/sys/fork.S with 100% similarity]
lib/libc/arch/ia64/sys/getcontext.S [moved from lib/nbsd_libc/arch/ia64/sys/getcontext.S with 100% similarity]
lib/libc/arch/ia64/sys/pipe.S [moved from lib/nbsd_libc/arch/ia64/sys/pipe.S with 100% similarity]
lib/libc/arch/ia64/sys/ptrace.S [moved from lib/nbsd_libc/arch/ia64/sys/ptrace.S with 100% similarity]
lib/libc/arch/ia64/sys/sbrk.S [moved from lib/nbsd_libc/arch/ia64/sys/sbrk.S with 100% similarity]
lib/libc/arch/ia64/sys/shmat.S [moved from lib/nbsd_libc/arch/ia64/sys/shmat.S with 100% similarity]
lib/libc/arch/ia64/sys/syscall.S [moved from lib/nbsd_libc/arch/ia64/sys/syscall.S with 100% similarity]
lib/libc/arch/m68k/DEFS.h [moved from lib/nbsd_libc/arch/m68k/DEFS.h with 100% similarity]
lib/libc/arch/m68k/Makefile.inc [moved from lib/nbsd_libc/arch/m68k/Makefile.inc with 100% similarity]
lib/libc/arch/m68k/SYS.h [moved from lib/nbsd_libc/arch/m68k/SYS.h with 100% similarity]
lib/libc/arch/m68k/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/m68k/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/m68k/gdtoa/arith.h [moved from lib/nbsd_libc/arch/m68k/gdtoa/arith.h with 100% similarity]
lib/libc/arch/m68k/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/m68k/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/m68k/gen/Makefile.inc [moved from lib/nbsd_libc/arch/m68k/gen/Makefile.inc with 100% similarity]
lib/libc/arch/m68k/gen/_lwp.c [moved from lib/nbsd_libc/arch/m68k/gen/_lwp.c with 100% similarity]
lib/libc/arch/m68k/gen/_setjmp.S [moved from lib/nbsd_libc/arch/m68k/gen/_setjmp.S with 100% similarity]
lib/libc/arch/m68k/gen/adddf3.S [moved from lib/nbsd_libc/arch/m68k/gen/adddf3.S with 100% similarity]
lib/libc/arch/m68k/gen/addsf3.S [moved from lib/nbsd_libc/arch/m68k/gen/addsf3.S with 100% similarity]
lib/libc/arch/m68k/gen/alloca.S [moved from lib/nbsd_libc/arch/m68k/gen/alloca.S with 100% similarity]
lib/libc/arch/m68k/gen/ashlsi3.S [moved from lib/nbsd_libc/arch/m68k/gen/ashlsi3.S with 100% similarity]
lib/libc/arch/m68k/gen/ashrsi3.S [moved from lib/nbsd_libc/arch/m68k/gen/ashrsi3.S with 100% similarity]
lib/libc/arch/m68k/gen/cmpdf2.S [moved from lib/nbsd_libc/arch/m68k/gen/cmpdf2.S with 100% similarity]
lib/libc/arch/m68k/gen/cmpsf2.S [moved from lib/nbsd_libc/arch/m68k/gen/cmpsf2.S with 100% similarity]
lib/libc/arch/m68k/gen/divdf3.S [moved from lib/nbsd_libc/arch/m68k/gen/divdf3.S with 100% similarity]
lib/libc/arch/m68k/gen/divsf3.S [moved from lib/nbsd_libc/arch/m68k/gen/divsf3.S with 100% similarity]
lib/libc/arch/m68k/gen/extendsfdf2.S [moved from lib/nbsd_libc/arch/m68k/gen/extendsfdf2.S with 100% similarity]
lib/libc/arch/m68k/gen/fabs.S [moved from lib/nbsd_libc/arch/m68k/gen/fabs.S with 100% similarity]
lib/libc/arch/m68k/gen/fixdfsi.S [moved from lib/nbsd_libc/arch/m68k/gen/fixdfsi.S with 100% similarity]
lib/libc/arch/m68k/gen/fixunsdfsi.S [moved from lib/nbsd_libc/arch/m68k/gen/fixunsdfsi.S with 100% similarity]
lib/libc/arch/m68k/gen/floatsidf.S [moved from lib/nbsd_libc/arch/m68k/gen/floatsidf.S with 100% similarity]
lib/libc/arch/m68k/gen/flt_rounds.S [moved from lib/nbsd_libc/arch/m68k/gen/flt_rounds.S with 100% similarity]
lib/libc/arch/m68k/gen/flt_rounds_softfloat.S [moved from lib/nbsd_libc/arch/m68k/gen/flt_rounds_softfloat.S with 100% similarity]
lib/libc/arch/m68k/gen/fpclassifyl.c [moved from lib/nbsd_libc/arch/m68k/gen/fpclassifyl.c with 100% similarity]
lib/libc/arch/m68k/gen/fpfake.c [moved from lib/nbsd_libc/arch/m68k/gen/fpfake.c with 100% similarity]
lib/libc/arch/m68k/gen/fpgetmask.S [moved from lib/nbsd_libc/arch/m68k/gen/fpgetmask.S with 100% similarity]
lib/libc/arch/m68k/gen/fpgetround.S [moved from lib/nbsd_libc/arch/m68k/gen/fpgetround.S with 100% similarity]
lib/libc/arch/m68k/gen/fpgetsticky.S [moved from lib/nbsd_libc/arch/m68k/gen/fpgetsticky.S with 100% similarity]
lib/libc/arch/m68k/gen/fpsetmask.S [moved from lib/nbsd_libc/arch/m68k/gen/fpsetmask.S with 100% similarity]
lib/libc/arch/m68k/gen/fpsetround.S [moved from lib/nbsd_libc/arch/m68k/gen/fpsetround.S with 100% similarity]
lib/libc/arch/m68k/gen/fpsetsticky.S [moved from lib/nbsd_libc/arch/m68k/gen/fpsetsticky.S with 100% similarity]
lib/libc/arch/m68k/gen/infinityl.c [moved from lib/nbsd_libc/arch/m68k/gen/infinityl.c with 100% similarity]
lib/libc/arch/m68k/gen/isfinitel.c [moved from lib/nbsd_libc/arch/m68k/gen/isfinitel.c with 100% similarity]
lib/libc/arch/m68k/gen/isinfl.c [moved from lib/nbsd_libc/arch/m68k/gen/isinfl.c with 100% similarity]
lib/libc/arch/m68k/gen/isnanl.c [moved from lib/nbsd_libc/arch/m68k/gen/isnanl.c with 100% similarity]
lib/libc/arch/m68k/gen/ldexp_881.c [moved from lib/nbsd_libc/arch/m68k/gen/ldexp_881.c with 100% similarity]
lib/libc/arch/m68k/gen/longjmp.c [moved from lib/nbsd_libc/arch/m68k/gen/longjmp.c with 100% similarity]
lib/libc/arch/m68k/gen/lshlsi3.S [moved from lib/nbsd_libc/arch/m68k/gen/lshlsi3.S with 100% similarity]
lib/libc/arch/m68k/gen/lshrsi3.S [moved from lib/nbsd_libc/arch/m68k/gen/lshrsi3.S with 100% similarity]
lib/libc/arch/m68k/gen/makecontext.c [moved from lib/nbsd_libc/arch/m68k/gen/makecontext.c with 100% similarity]
lib/libc/arch/m68k/gen/modf.S [moved from lib/nbsd_libc/arch/m68k/gen/modf.S with 100% similarity]
lib/libc/arch/m68k/gen/muldf3.S [moved from lib/nbsd_libc/arch/m68k/gen/muldf3.S with 100% similarity]
lib/libc/arch/m68k/gen/mulsf3.S [moved from lib/nbsd_libc/arch/m68k/gen/mulsf3.S with 100% similarity]
lib/libc/arch/m68k/gen/nanf.c [moved from lib/nbsd_libc/arch/m68k/gen/nanf.c with 100% similarity]
lib/libc/arch/m68k/gen/negdf2.S [moved from lib/nbsd_libc/arch/m68k/gen/negdf2.S with 100% similarity]
lib/libc/arch/m68k/gen/negsf2.S [moved from lib/nbsd_libc/arch/m68k/gen/negsf2.S with 100% similarity]
lib/libc/arch/m68k/gen/resumecontext.S [moved from lib/nbsd_libc/arch/m68k/gen/resumecontext.S with 100% similarity]
lib/libc/arch/m68k/gen/setjmp.S [moved from lib/nbsd_libc/arch/m68k/gen/setjmp.S with 100% similarity]
lib/libc/arch/m68k/gen/signbitl.c [moved from lib/nbsd_libc/arch/m68k/gen/signbitl.c with 100% similarity]
lib/libc/arch/m68k/gen/sigsetjmp.S [moved from lib/nbsd_libc/arch/m68k/gen/sigsetjmp.S with 100% similarity]
lib/libc/arch/m68k/gen/subdf3.S [moved from lib/nbsd_libc/arch/m68k/gen/subdf3.S with 100% similarity]
lib/libc/arch/m68k/gen/subsf3.S [moved from lib/nbsd_libc/arch/m68k/gen/subsf3.S with 100% similarity]
lib/libc/arch/m68k/gen/swapcontext.S [moved from lib/nbsd_libc/arch/m68k/gen/swapcontext.S with 100% similarity]
lib/libc/arch/m68k/gen/truncdfsf2.S [moved from lib/nbsd_libc/arch/m68k/gen/truncdfsf2.S with 100% similarity]
lib/libc/arch/m68k/gen/umulsi3.S [moved from lib/nbsd_libc/arch/m68k/gen/umulsi3.S with 100% similarity]
lib/libc/arch/m68k/net/Makefile.inc [moved from lib/nbsd_libc/arch/m68k/net/Makefile.inc with 100% similarity]
lib/libc/arch/m68k/quad/ashldi3.S [moved from lib/nbsd_libc/arch/m68k/quad/ashldi3.S with 100% similarity]
lib/libc/arch/m68k/quad/ashrdi3.S [moved from lib/nbsd_libc/arch/m68k/quad/ashrdi3.S with 100% similarity]
lib/libc/arch/m68k/quad/lshrdi3.S [moved from lib/nbsd_libc/arch/m68k/quad/lshrdi3.S with 100% similarity]
lib/libc/arch/m68k/softfloat/m68k-gcc.h [moved from lib/nbsd_libc/arch/m68k/softfloat/m68k-gcc.h with 100% similarity]
lib/libc/arch/m68k/softfloat/milieu.h [moved from lib/nbsd_libc/arch/m68k/softfloat/milieu.h with 100% similarity]
lib/libc/arch/m68k/softfloat/softfloat.h [moved from lib/nbsd_libc/arch/m68k/softfloat/softfloat.h with 100% similarity]
lib/libc/arch/m68k/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/m68k/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/m68k/stdlib/abs.S [moved from lib/nbsd_libc/arch/m68k/stdlib/abs.S with 100% similarity]
lib/libc/arch/m68k/stdlib/llabs.S [moved from lib/nbsd_libc/arch/m68k/stdlib/llabs.S with 100% similarity]
lib/libc/arch/m68k/string/Makefile.inc [moved from lib/nbsd_libc/arch/m68k/string/Makefile.inc with 100% similarity]
lib/libc/arch/m68k/string/memccpy.S [moved from lib/nbsd_libc/arch/m68k/string/memccpy.S with 100% similarity]
lib/libc/arch/m68k/string/swab.S [moved from lib/nbsd_libc/arch/m68k/string/swab.S with 100% similarity]
lib/libc/arch/m68k/sys/__clone.S [moved from lib/nbsd_libc/arch/m68k/sys/__clone.S with 100% similarity]
lib/libc/arch/m68k/sys/__mmap.S [moved from lib/nbsd_libc/arch/m68k/sys/__mmap.S with 100% similarity]
lib/libc/arch/m68k/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/m68k/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/m68k/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/m68k/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/m68k/sys/__syscall.S [moved from lib/nbsd_libc/arch/m68k/sys/__syscall.S with 100% similarity]
lib/libc/arch/m68k/sys/__vfork14.S [moved from lib/nbsd_libc/arch/m68k/sys/__vfork14.S with 100% similarity]
lib/libc/arch/m68k/sys/_lwp_getprivate.S [moved from lib/nbsd_libc/arch/m68k/sys/_lwp_getprivate.S with 100% similarity]
lib/libc/arch/m68k/sys/brk.S [moved from lib/nbsd_libc/arch/m68k/sys/brk.S with 100% similarity]
lib/libc/arch/m68k/sys/cerror.S [moved from lib/nbsd_libc/arch/m68k/sys/cerror.S with 100% similarity]
lib/libc/arch/m68k/sys/exect.S [moved from lib/nbsd_libc/arch/m68k/sys/exect.S with 100% similarity]
lib/libc/arch/m68k/sys/fork.S [moved from lib/nbsd_libc/arch/m68k/sys/fork.S with 100% similarity]
lib/libc/arch/m68k/sys/getcontext.S [moved from lib/nbsd_libc/arch/m68k/sys/getcontext.S with 100% similarity]
lib/libc/arch/m68k/sys/mremap.S [moved from lib/nbsd_libc/arch/m68k/sys/mremap.S with 100% similarity]
lib/libc/arch/m68k/sys/pipe.S [moved from lib/nbsd_libc/arch/m68k/sys/pipe.S with 100% similarity]
lib/libc/arch/m68k/sys/ptrace.S [moved from lib/nbsd_libc/arch/m68k/sys/ptrace.S with 100% similarity]
lib/libc/arch/m68k/sys/sbrk.S [moved from lib/nbsd_libc/arch/m68k/sys/sbrk.S with 100% similarity]
lib/libc/arch/m68k/sys/shmat.S [moved from lib/nbsd_libc/arch/m68k/sys/shmat.S with 100% similarity]
lib/libc/arch/m68k/sys/syscall.S [moved from lib/nbsd_libc/arch/m68k/sys/syscall.S with 100% similarity]
lib/libc/arch/mips/Makefile.inc [moved from lib/nbsd_libc/arch/mips/Makefile.inc with 100% similarity]
lib/libc/arch/mips/SYS.h [moved from lib/nbsd_libc/arch/mips/SYS.h with 100% similarity]
lib/libc/arch/mips/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/mips/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/mips/gdtoa/arith.h [moved from lib/nbsd_libc/arch/mips/gdtoa/arith.h with 100% similarity]
lib/libc/arch/mips/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/mips/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/mips/gen/Makefile.inc [moved from lib/nbsd_libc/arch/mips/gen/Makefile.inc with 100% similarity]
lib/libc/arch/mips/gen/_lwp.c [moved from lib/nbsd_libc/arch/mips/gen/_lwp.c with 100% similarity]
lib/libc/arch/mips/gen/_resumecontext.S [moved from lib/nbsd_libc/arch/mips/gen/_resumecontext.S with 100% similarity]
lib/libc/arch/mips/gen/_setjmp.S [moved from lib/nbsd_libc/arch/mips/gen/_setjmp.S with 100% similarity]
lib/libc/arch/mips/gen/cacheflush.c [moved from lib/nbsd_libc/arch/mips/gen/cacheflush.c with 100% similarity]
lib/libc/arch/mips/gen/fabs.S [moved from lib/nbsd_libc/arch/mips/gen/fabs.S with 100% similarity]
lib/libc/arch/mips/gen/flt_rounds.c [moved from lib/nbsd_libc/arch/mips/gen/flt_rounds.c with 100% similarity]
lib/libc/arch/mips/gen/fpgetmask.c [moved from lib/nbsd_libc/arch/mips/gen/fpgetmask.c with 100% similarity]
lib/libc/arch/mips/gen/fpgetround.c [moved from lib/nbsd_libc/arch/mips/gen/fpgetround.c with 100% similarity]
lib/libc/arch/mips/gen/fpgetsticky.c [moved from lib/nbsd_libc/arch/mips/gen/fpgetsticky.c with 100% similarity]
lib/libc/arch/mips/gen/fpsetmask.c [moved from lib/nbsd_libc/arch/mips/gen/fpsetmask.c with 100% similarity]
lib/libc/arch/mips/gen/fpsetround.c [moved from lib/nbsd_libc/arch/mips/gen/fpsetround.c with 100% similarity]
lib/libc/arch/mips/gen/fpsetsticky.c [moved from lib/nbsd_libc/arch/mips/gen/fpsetsticky.c with 100% similarity]
lib/libc/arch/mips/gen/ldexp.S [moved from lib/nbsd_libc/arch/mips/gen/ldexp.S with 100% similarity]
lib/libc/arch/mips/gen/longjmp.c [moved from lib/nbsd_libc/arch/mips/gen/longjmp.c with 100% similarity]
lib/libc/arch/mips/gen/makecontext.c [moved from lib/nbsd_libc/arch/mips/gen/makecontext.c with 100% similarity]
lib/libc/arch/mips/gen/modf.S [moved from lib/nbsd_libc/arch/mips/gen/modf.S with 100% similarity]
lib/libc/arch/mips/gen/nanf.c [moved from lib/nbsd_libc/arch/mips/gen/nanf.c with 100% similarity]
lib/libc/arch/mips/gen/resumecontext.c [moved from lib/nbsd_libc/arch/mips/gen/resumecontext.c with 100% similarity]
lib/libc/arch/mips/gen/setjmp.S [moved from lib/nbsd_libc/arch/mips/gen/setjmp.S with 100% similarity]
lib/libc/arch/mips/gen/sigsetjmp.S [moved from lib/nbsd_libc/arch/mips/gen/sigsetjmp.S with 100% similarity]
lib/libc/arch/mips/gen/swapcontext.S [moved from lib/nbsd_libc/arch/mips/gen/swapcontext.S with 100% similarity]
lib/libc/arch/mips/genassym.cf [moved from lib/nbsd_libc/arch/mips/genassym.cf with 100% similarity]
lib/libc/arch/mips/net/Makefile.inc [moved from lib/nbsd_libc/arch/mips/net/Makefile.inc with 100% similarity]
lib/libc/arch/mips/softfloat/milieu.h [moved from lib/nbsd_libc/arch/mips/softfloat/milieu.h with 100% similarity]
lib/libc/arch/mips/softfloat/mips-gcc.h [moved from lib/nbsd_libc/arch/mips/softfloat/mips-gcc.h with 100% similarity]
lib/libc/arch/mips/softfloat/softfloat.h [moved from lib/nbsd_libc/arch/mips/softfloat/softfloat.h with 100% similarity]
lib/libc/arch/mips/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/mips/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/mips/string/Makefile.inc [moved from lib/nbsd_libc/arch/mips/string/Makefile.inc with 100% similarity]
lib/libc/arch/mips/string/bcmp.S [moved from lib/nbsd_libc/arch/mips/string/bcmp.S with 100% similarity]
lib/libc/arch/mips/string/bzero.S [moved from lib/nbsd_libc/arch/mips/string/bzero.S with 100% similarity]
lib/libc/arch/mips/sys/__clone.S [moved from lib/nbsd_libc/arch/mips/sys/__clone.S with 100% similarity]
lib/libc/arch/mips/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/mips/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/mips/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/mips/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/mips/sys/__syscall.S [moved from lib/nbsd_libc/arch/mips/sys/__syscall.S with 100% similarity]
lib/libc/arch/mips/sys/__vfork14.S [moved from lib/nbsd_libc/arch/mips/sys/__vfork14.S with 100% similarity]
lib/libc/arch/mips/sys/brk.S [moved from lib/nbsd_libc/arch/mips/sys/brk.S with 100% similarity]
lib/libc/arch/mips/sys/cerror.S [moved from lib/nbsd_libc/arch/mips/sys/cerror.S with 100% similarity]
lib/libc/arch/mips/sys/exect.S [moved from lib/nbsd_libc/arch/mips/sys/exect.S with 100% similarity]
lib/libc/arch/mips/sys/fork.S [moved from lib/nbsd_libc/arch/mips/sys/fork.S with 100% similarity]
lib/libc/arch/mips/sys/getcontext.S [moved from lib/nbsd_libc/arch/mips/sys/getcontext.S with 100% similarity]
lib/libc/arch/mips/sys/pipe.S [moved from lib/nbsd_libc/arch/mips/sys/pipe.S with 100% similarity]
lib/libc/arch/mips/sys/ptrace.S [moved from lib/nbsd_libc/arch/mips/sys/ptrace.S with 100% similarity]
lib/libc/arch/mips/sys/sbrk.S [moved from lib/nbsd_libc/arch/mips/sys/sbrk.S with 100% similarity]
lib/libc/arch/mips/sys/shmat.S [moved from lib/nbsd_libc/arch/mips/sys/shmat.S with 100% similarity]
lib/libc/arch/mips/sys/syscall.S [moved from lib/nbsd_libc/arch/mips/sys/syscall.S with 100% similarity]
lib/libc/arch/powerpc/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc/SYS.h [moved from lib/nbsd_libc/arch/powerpc/SYS.h with 100% similarity]
lib/libc/arch/powerpc/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc/gdtoa/arith.h [moved from lib/nbsd_libc/arch/powerpc/gdtoa/arith.h with 100% similarity]
lib/libc/arch/powerpc/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/powerpc/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/powerpc/gen/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc/gen/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc/gen/__setjmp14.S [moved from lib/nbsd_libc/arch/powerpc/gen/__setjmp14.S with 100% similarity]
lib/libc/arch/powerpc/gen/__sigsetjmp14.S [moved from lib/nbsd_libc/arch/powerpc/gen/__sigsetjmp14.S with 100% similarity]
lib/libc/arch/powerpc/gen/_lwp.c [moved from lib/nbsd_libc/arch/powerpc/gen/_lwp.c with 100% similarity]
lib/libc/arch/powerpc/gen/_setjmp.S [moved from lib/nbsd_libc/arch/powerpc/gen/_setjmp.S with 100% similarity]
lib/libc/arch/powerpc/gen/fabs.c [moved from lib/nbsd_libc/arch/powerpc/gen/fabs.c with 100% similarity]
lib/libc/arch/powerpc/gen/flt_rounds.c [moved from lib/nbsd_libc/arch/powerpc/gen/flt_rounds.c with 100% similarity]
lib/libc/arch/powerpc/gen/fpgetmask.c [moved from lib/nbsd_libc/arch/powerpc/gen/fpgetmask.c with 100% similarity]
lib/libc/arch/powerpc/gen/fpgetround.c [moved from lib/nbsd_libc/arch/powerpc/gen/fpgetround.c with 100% similarity]
lib/libc/arch/powerpc/gen/fpgetsticky.c [moved from lib/nbsd_libc/arch/powerpc/gen/fpgetsticky.c with 100% similarity]
lib/libc/arch/powerpc/gen/fpsetmask.c [moved from lib/nbsd_libc/arch/powerpc/gen/fpsetmask.c with 100% similarity]
lib/libc/arch/powerpc/gen/fpsetround.c [moved from lib/nbsd_libc/arch/powerpc/gen/fpsetround.c with 100% similarity]
lib/libc/arch/powerpc/gen/fpsetsticky.c [moved from lib/nbsd_libc/arch/powerpc/gen/fpsetsticky.c with 100% similarity]
lib/libc/arch/powerpc/gen/makecontext.c [moved from lib/nbsd_libc/arch/powerpc/gen/makecontext.c with 100% similarity]
lib/libc/arch/powerpc/gen/nanf.c [moved from lib/nbsd_libc/arch/powerpc/gen/nanf.c with 100% similarity]
lib/libc/arch/powerpc/gen/resumecontext.c [moved from lib/nbsd_libc/arch/powerpc/gen/resumecontext.c with 100% similarity]
lib/libc/arch/powerpc/gen/swapcontext.S [moved from lib/nbsd_libc/arch/powerpc/gen/swapcontext.S with 100% similarity]
lib/libc/arch/powerpc/gen/syncicache.c [moved from lib/nbsd_libc/arch/powerpc/gen/syncicache.c with 100% similarity]
lib/libc/arch/powerpc/genassym.cf [moved from lib/nbsd_libc/arch/powerpc/genassym.cf with 100% similarity]
lib/libc/arch/powerpc/net/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc/net/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc/softfloat/milieu.h [moved from lib/nbsd_libc/arch/powerpc/softfloat/milieu.h with 100% similarity]
lib/libc/arch/powerpc/softfloat/powerpc-gcc.h [moved from lib/nbsd_libc/arch/powerpc/softfloat/powerpc-gcc.h with 100% similarity]
lib/libc/arch/powerpc/softfloat/softfloat.h [moved from lib/nbsd_libc/arch/powerpc/softfloat/softfloat.h with 100% similarity]
lib/libc/arch/powerpc/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc/string/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc/string/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc/string/bzero.S [moved from lib/nbsd_libc/arch/powerpc/string/bzero.S with 100% similarity]
lib/libc/arch/powerpc/sys/__clone.S [moved from lib/nbsd_libc/arch/powerpc/sys/__clone.S with 100% similarity]
lib/libc/arch/powerpc/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/powerpc/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/powerpc/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/powerpc/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/powerpc/sys/__syscall.S [moved from lib/nbsd_libc/arch/powerpc/sys/__syscall.S with 100% similarity]
lib/libc/arch/powerpc/sys/__vfork14.S [moved from lib/nbsd_libc/arch/powerpc/sys/__vfork14.S with 100% similarity]
lib/libc/arch/powerpc/sys/brk.S [moved from lib/nbsd_libc/arch/powerpc/sys/brk.S with 100% similarity]
lib/libc/arch/powerpc/sys/cerror.S [moved from lib/nbsd_libc/arch/powerpc/sys/cerror.S with 100% similarity]
lib/libc/arch/powerpc/sys/exect.S [moved from lib/nbsd_libc/arch/powerpc/sys/exect.S with 100% similarity]
lib/libc/arch/powerpc/sys/fork.S [moved from lib/nbsd_libc/arch/powerpc/sys/fork.S with 100% similarity]
lib/libc/arch/powerpc/sys/getcontext.S [moved from lib/nbsd_libc/arch/powerpc/sys/getcontext.S with 100% similarity]
lib/libc/arch/powerpc/sys/pipe.S [moved from lib/nbsd_libc/arch/powerpc/sys/pipe.S with 100% similarity]
lib/libc/arch/powerpc/sys/ptrace.S [moved from lib/nbsd_libc/arch/powerpc/sys/ptrace.S with 100% similarity]
lib/libc/arch/powerpc/sys/sbrk.S [moved from lib/nbsd_libc/arch/powerpc/sys/sbrk.S with 100% similarity]
lib/libc/arch/powerpc/sys/shmat.S [moved from lib/nbsd_libc/arch/powerpc/sys/shmat.S with 100% similarity]
lib/libc/arch/powerpc/sys/syscall.S [moved from lib/nbsd_libc/arch/powerpc/sys/syscall.S with 100% similarity]
lib/libc/arch/powerpc64/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc64/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc64/SYS.h [moved from lib/nbsd_libc/arch/powerpc64/SYS.h with 100% similarity]
lib/libc/arch/powerpc64/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc64/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc64/gdtoa/arith.h [moved from lib/nbsd_libc/arch/powerpc64/gdtoa/arith.h with 100% similarity]
lib/libc/arch/powerpc64/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/powerpc64/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/powerpc64/gen/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc64/gen/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc64/gen/__setjmp14.S [moved from lib/nbsd_libc/arch/powerpc64/gen/__setjmp14.S with 100% similarity]
lib/libc/arch/powerpc64/gen/__sigsetjmp14.S [moved from lib/nbsd_libc/arch/powerpc64/gen/__sigsetjmp14.S with 100% similarity]
lib/libc/arch/powerpc64/gen/_lwp.c [moved from lib/nbsd_libc/arch/powerpc64/gen/_lwp.c with 100% similarity]
lib/libc/arch/powerpc64/gen/_setjmp.S [moved from lib/nbsd_libc/arch/powerpc64/gen/_setjmp.S with 100% similarity]
lib/libc/arch/powerpc64/gen/fabs.c [moved from lib/nbsd_libc/arch/powerpc64/gen/fabs.c with 100% similarity]
lib/libc/arch/powerpc64/gen/flt_rounds.c [moved from lib/nbsd_libc/arch/powerpc64/gen/flt_rounds.c with 100% similarity]
lib/libc/arch/powerpc64/gen/fpgetmask.c [moved from lib/nbsd_libc/arch/powerpc64/gen/fpgetmask.c with 100% similarity]
lib/libc/arch/powerpc64/gen/fpgetround.c [moved from lib/nbsd_libc/arch/powerpc64/gen/fpgetround.c with 100% similarity]
lib/libc/arch/powerpc64/gen/fpgetsticky.c [moved from lib/nbsd_libc/arch/powerpc64/gen/fpgetsticky.c with 100% similarity]
lib/libc/arch/powerpc64/gen/fpsetmask.c [moved from lib/nbsd_libc/arch/powerpc64/gen/fpsetmask.c with 100% similarity]
lib/libc/arch/powerpc64/gen/fpsetround.c [moved from lib/nbsd_libc/arch/powerpc64/gen/fpsetround.c with 100% similarity]
lib/libc/arch/powerpc64/gen/fpsetsticky.c [moved from lib/nbsd_libc/arch/powerpc64/gen/fpsetsticky.c with 100% similarity]
lib/libc/arch/powerpc64/gen/makecontext.c [moved from lib/nbsd_libc/arch/powerpc64/gen/makecontext.c with 100% similarity]
lib/libc/arch/powerpc64/gen/nanf.c [moved from lib/nbsd_libc/arch/powerpc64/gen/nanf.c with 100% similarity]
lib/libc/arch/powerpc64/gen/resumecontext.c [moved from lib/nbsd_libc/arch/powerpc64/gen/resumecontext.c with 100% similarity]
lib/libc/arch/powerpc64/gen/swapcontext.S [moved from lib/nbsd_libc/arch/powerpc64/gen/swapcontext.S with 100% similarity]
lib/libc/arch/powerpc64/gen/syncicache.c [moved from lib/nbsd_libc/arch/powerpc64/gen/syncicache.c with 100% similarity]
lib/libc/arch/powerpc64/net/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc64/net/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc64/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc64/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc64/string/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc64/string/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc64/string/bzero.S [moved from lib/nbsd_libc/arch/powerpc64/string/bzero.S with 100% similarity]
lib/libc/arch/powerpc64/sys/Makefile.inc [moved from lib/nbsd_libc/arch/powerpc64/sys/Makefile.inc with 100% similarity]
lib/libc/arch/powerpc64/sys/__clone.S [moved from lib/nbsd_libc/arch/powerpc64/sys/__clone.S with 100% similarity]
lib/libc/arch/powerpc64/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/powerpc64/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/powerpc64/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/powerpc64/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/powerpc64/sys/__syscall.S [moved from lib/nbsd_libc/arch/powerpc64/sys/__syscall.S with 100% similarity]
lib/libc/arch/powerpc64/sys/__vfork14.S [moved from lib/nbsd_libc/arch/powerpc64/sys/__vfork14.S with 100% similarity]
lib/libc/arch/powerpc64/sys/brk.S [moved from lib/nbsd_libc/arch/powerpc64/sys/brk.S with 100% similarity]
lib/libc/arch/powerpc64/sys/cerror.S [moved from lib/nbsd_libc/arch/powerpc64/sys/cerror.S with 100% similarity]
lib/libc/arch/powerpc64/sys/exect.S [moved from lib/nbsd_libc/arch/powerpc64/sys/exect.S with 100% similarity]
lib/libc/arch/powerpc64/sys/fork.S [moved from lib/nbsd_libc/arch/powerpc64/sys/fork.S with 100% similarity]
lib/libc/arch/powerpc64/sys/getcontext.S [moved from lib/nbsd_libc/arch/powerpc64/sys/getcontext.S with 100% similarity]
lib/libc/arch/powerpc64/sys/pipe.S [moved from lib/nbsd_libc/arch/powerpc64/sys/pipe.S with 100% similarity]
lib/libc/arch/powerpc64/sys/ptrace.S [moved from lib/nbsd_libc/arch/powerpc64/sys/ptrace.S with 100% similarity]
lib/libc/arch/powerpc64/sys/sbrk.S [moved from lib/nbsd_libc/arch/powerpc64/sys/sbrk.S with 100% similarity]
lib/libc/arch/powerpc64/sys/shmat.S [moved from lib/nbsd_libc/arch/powerpc64/sys/shmat.S with 100% similarity]
lib/libc/arch/powerpc64/sys/syscall.S [moved from lib/nbsd_libc/arch/powerpc64/sys/syscall.S with 100% similarity]
lib/libc/arch/sh3/Makefile.inc [moved from lib/nbsd_libc/arch/sh3/Makefile.inc with 100% similarity]
lib/libc/arch/sh3/SYS.h [moved from lib/nbsd_libc/arch/sh3/SYS.h with 100% similarity]
lib/libc/arch/sh3/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/sh3/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/sh3/gdtoa/arith.h [moved from lib/nbsd_libc/arch/sh3/gdtoa/arith.h with 100% similarity]
lib/libc/arch/sh3/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/sh3/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/sh3/gen/Makefile.inc [moved from lib/nbsd_libc/arch/sh3/gen/Makefile.inc with 100% similarity]
lib/libc/arch/sh3/gen/_lwp.c [moved from lib/nbsd_libc/arch/sh3/gen/_lwp.c with 100% similarity]
lib/libc/arch/sh3/gen/_setjmp.S [moved from lib/nbsd_libc/arch/sh3/gen/_setjmp.S with 100% similarity]
lib/libc/arch/sh3/gen/fabs.c [moved from lib/nbsd_libc/arch/sh3/gen/fabs.c with 100% similarity]
lib/libc/arch/sh3/gen/flt_rounds.c [moved from lib/nbsd_libc/arch/sh3/gen/flt_rounds.c with 100% similarity]
lib/libc/arch/sh3/gen/makecontext.c [moved from lib/nbsd_libc/arch/sh3/gen/makecontext.c with 100% similarity]
lib/libc/arch/sh3/gen/nanf.c [moved from lib/nbsd_libc/arch/sh3/gen/nanf.c with 100% similarity]
lib/libc/arch/sh3/gen/resumecontext.c [moved from lib/nbsd_libc/arch/sh3/gen/resumecontext.c with 100% similarity]
lib/libc/arch/sh3/gen/setjmp.S [moved from lib/nbsd_libc/arch/sh3/gen/setjmp.S with 100% similarity]
lib/libc/arch/sh3/gen/sigsetjmp.S [moved from lib/nbsd_libc/arch/sh3/gen/sigsetjmp.S with 100% similarity]
lib/libc/arch/sh3/gen/swapcontext.S [moved from lib/nbsd_libc/arch/sh3/gen/swapcontext.S with 100% similarity]
lib/libc/arch/sh3/net/Makefile.inc [moved from lib/nbsd_libc/arch/sh3/net/Makefile.inc with 100% similarity]
lib/libc/arch/sh3/net/htonl.c [moved from lib/nbsd_libc/arch/sh3/net/htonl.c with 100% similarity]
lib/libc/arch/sh3/net/htons.c [moved from lib/nbsd_libc/arch/sh3/net/htons.c with 100% similarity]
lib/libc/arch/sh3/net/ntohl.c [moved from lib/nbsd_libc/arch/sh3/net/ntohl.c with 100% similarity]
lib/libc/arch/sh3/net/ntohs.c [moved from lib/nbsd_libc/arch/sh3/net/ntohs.c with 100% similarity]
lib/libc/arch/sh3/softfloat/milieu.h [moved from lib/nbsd_libc/arch/sh3/softfloat/milieu.h with 100% similarity]
lib/libc/arch/sh3/softfloat/sh3-gcc.h [moved from lib/nbsd_libc/arch/sh3/softfloat/sh3-gcc.h with 100% similarity]
lib/libc/arch/sh3/softfloat/softfloat.h [moved from lib/nbsd_libc/arch/sh3/softfloat/softfloat.h with 100% similarity]
lib/libc/arch/sh3/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/sh3/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/sh3/string/Makefile.inc [moved from lib/nbsd_libc/arch/sh3/string/Makefile.inc with 100% similarity]
lib/libc/arch/sh3/string/bcopy.S [moved from lib/nbsd_libc/arch/sh3/string/bcopy.S with 100% similarity]
lib/libc/arch/sh3/string/bzero.S [moved from lib/nbsd_libc/arch/sh3/string/bzero.S with 100% similarity]
lib/libc/arch/sh3/sys/__clone.S [moved from lib/nbsd_libc/arch/sh3/sys/__clone.S with 100% similarity]
lib/libc/arch/sh3/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/sh3/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/sh3/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/sh3/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/sh3/sys/__syscall.S [moved from lib/nbsd_libc/arch/sh3/sys/__syscall.S with 100% similarity]
lib/libc/arch/sh3/sys/__vfork14.S [moved from lib/nbsd_libc/arch/sh3/sys/__vfork14.S with 100% similarity]
lib/libc/arch/sh3/sys/brk.S [moved from lib/nbsd_libc/arch/sh3/sys/brk.S with 100% similarity]
lib/libc/arch/sh3/sys/cerror.S [moved from lib/nbsd_libc/arch/sh3/sys/cerror.S with 100% similarity]
lib/libc/arch/sh3/sys/exect.S [moved from lib/nbsd_libc/arch/sh3/sys/exect.S with 100% similarity]
lib/libc/arch/sh3/sys/fork.S [moved from lib/nbsd_libc/arch/sh3/sys/fork.S with 100% similarity]
lib/libc/arch/sh3/sys/getcontext.S [moved from lib/nbsd_libc/arch/sh3/sys/getcontext.S with 100% similarity]
lib/libc/arch/sh3/sys/pipe.S [moved from lib/nbsd_libc/arch/sh3/sys/pipe.S with 100% similarity]
lib/libc/arch/sh3/sys/ptrace.S [moved from lib/nbsd_libc/arch/sh3/sys/ptrace.S with 100% similarity]
lib/libc/arch/sh3/sys/sbrk.S [moved from lib/nbsd_libc/arch/sh3/sys/sbrk.S with 100% similarity]
lib/libc/arch/sh3/sys/shmat.S [moved from lib/nbsd_libc/arch/sh3/sys/shmat.S with 100% similarity]
lib/libc/arch/sh3/sys/syscall.S [moved from lib/nbsd_libc/arch/sh3/sys/syscall.S with 100% similarity]
lib/libc/arch/sparc/Makefile.inc [moved from lib/nbsd_libc/arch/sparc/Makefile.inc with 100% similarity]
lib/libc/arch/sparc/SYS.h [moved from lib/nbsd_libc/arch/sparc/SYS.h with 100% similarity]
lib/libc/arch/sparc/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/sparc/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/sparc/gdtoa/arith.h [moved from lib/nbsd_libc/arch/sparc/gdtoa/arith.h with 100% similarity]
lib/libc/arch/sparc/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/sparc/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/sparc/gen/Makefile.inc [moved from lib/nbsd_libc/arch/sparc/gen/Makefile.inc with 100% similarity]
lib/libc/arch/sparc/gen/_lwp.c [moved from lib/nbsd_libc/arch/sparc/gen/_lwp.c with 100% similarity]
lib/libc/arch/sparc/gen/_setjmp.S [moved from lib/nbsd_libc/arch/sparc/gen/_setjmp.S with 100% similarity]
lib/libc/arch/sparc/gen/divrem.m4 [moved from lib/nbsd_libc/arch/sparc/gen/divrem.m4 with 100% similarity]
lib/libc/arch/sparc/gen/fabs.S [moved from lib/nbsd_libc/arch/sparc/gen/fabs.S with 100% similarity]
lib/libc/arch/sparc/gen/fixunsdfsi.S [moved from lib/nbsd_libc/arch/sparc/gen/fixunsdfsi.S with 100% similarity]
lib/libc/arch/sparc/gen/flt_rounds.c [moved from lib/nbsd_libc/arch/sparc/gen/flt_rounds.c with 100% similarity]
lib/libc/arch/sparc/gen/fpgetmask.c [moved from lib/nbsd_libc/arch/sparc/gen/fpgetmask.c with 100% similarity]
lib/libc/arch/sparc/gen/fpgetround.c [moved from lib/nbsd_libc/arch/sparc/gen/fpgetround.c with 100% similarity]
lib/libc/arch/sparc/gen/fpgetsticky.c [moved from lib/nbsd_libc/arch/sparc/gen/fpgetsticky.c with 100% similarity]
lib/libc/arch/sparc/gen/fpsetmask.c [moved from lib/nbsd_libc/arch/sparc/gen/fpsetmask.c with 100% similarity]
lib/libc/arch/sparc/gen/fpsetround.c [moved from lib/nbsd_libc/arch/sparc/gen/fpsetround.c with 100% similarity]
lib/libc/arch/sparc/gen/fpsetsticky.c [moved from lib/nbsd_libc/arch/sparc/gen/fpsetsticky.c with 100% similarity]
lib/libc/arch/sparc/gen/longjmp.c [moved from lib/nbsd_libc/arch/sparc/gen/longjmp.c with 100% similarity]
lib/libc/arch/sparc/gen/makecontext.c [moved from lib/nbsd_libc/arch/sparc/gen/makecontext.c with 100% similarity]
lib/libc/arch/sparc/gen/modf.S [moved from lib/nbsd_libc/arch/sparc/gen/modf.S with 100% similarity]
lib/libc/arch/sparc/gen/nanf.c [moved from lib/nbsd_libc/arch/sparc/gen/nanf.c with 100% similarity]
lib/libc/arch/sparc/gen/resumecontext.c [moved from lib/nbsd_libc/arch/sparc/gen/resumecontext.c with 100% similarity]
lib/libc/arch/sparc/gen/setjmp.S [moved from lib/nbsd_libc/arch/sparc/gen/setjmp.S with 100% similarity]
lib/libc/arch/sparc/gen/sigsetjmp.S [moved from lib/nbsd_libc/arch/sparc/gen/sigsetjmp.S with 100% similarity]
lib/libc/arch/sparc/gen/swapcontext.S [moved from lib/nbsd_libc/arch/sparc/gen/swapcontext.S with 100% similarity]
lib/libc/arch/sparc/net/Makefile.inc [moved from lib/nbsd_libc/arch/sparc/net/Makefile.inc with 100% similarity]
lib/libc/arch/sparc/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/sparc/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/sparc/stdlib/llabs.S [moved from lib/nbsd_libc/arch/sparc/stdlib/llabs.S with 100% similarity]
lib/libc/arch/sparc/string/Makefile.inc [moved from lib/nbsd_libc/arch/sparc/string/Makefile.inc with 100% similarity]
lib/libc/arch/sparc/sys/__clone.S [moved from lib/nbsd_libc/arch/sparc/sys/__clone.S with 100% similarity]
lib/libc/arch/sparc/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/sparc/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/sparc/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/sparc/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/sparc/sys/__syscall.S [moved from lib/nbsd_libc/arch/sparc/sys/__syscall.S with 100% similarity]
lib/libc/arch/sparc/sys/__vfork14.S [moved from lib/nbsd_libc/arch/sparc/sys/__vfork14.S with 100% similarity]
lib/libc/arch/sparc/sys/brk.S [moved from lib/nbsd_libc/arch/sparc/sys/brk.S with 100% similarity]
lib/libc/arch/sparc/sys/cerror.S [moved from lib/nbsd_libc/arch/sparc/sys/cerror.S with 100% similarity]
lib/libc/arch/sparc/sys/exect.S [moved from lib/nbsd_libc/arch/sparc/sys/exect.S with 100% similarity]
lib/libc/arch/sparc/sys/fork.S [moved from lib/nbsd_libc/arch/sparc/sys/fork.S with 100% similarity]
lib/libc/arch/sparc/sys/getcontext.S [moved from lib/nbsd_libc/arch/sparc/sys/getcontext.S with 100% similarity]
lib/libc/arch/sparc/sys/pipe.S [moved from lib/nbsd_libc/arch/sparc/sys/pipe.S with 100% similarity]
lib/libc/arch/sparc/sys/ptrace.S [moved from lib/nbsd_libc/arch/sparc/sys/ptrace.S with 100% similarity]
lib/libc/arch/sparc/sys/sbrk.S [moved from lib/nbsd_libc/arch/sparc/sys/sbrk.S with 100% similarity]
lib/libc/arch/sparc/sys/shmat.S [moved from lib/nbsd_libc/arch/sparc/sys/shmat.S with 100% similarity]
lib/libc/arch/sparc/sys/syscall.S [moved from lib/nbsd_libc/arch/sparc/sys/syscall.S with 100% similarity]
lib/libc/arch/sparc64/Makefile.inc [moved from lib/nbsd_libc/arch/sparc64/Makefile.inc with 100% similarity]
lib/libc/arch/sparc64/SYS.h [moved from lib/nbsd_libc/arch/sparc64/SYS.h with 100% similarity]
lib/libc/arch/sparc64/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/sparc64/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/sparc64/gdtoa/arith.h [moved from lib/nbsd_libc/arch/sparc64/gdtoa/arith.h with 100% similarity]
lib/libc/arch/sparc64/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/sparc64/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/sparc64/gen/Makefile.inc [moved from lib/nbsd_libc/arch/sparc64/gen/Makefile.inc with 100% similarity]
lib/libc/arch/sparc64/gen/_lwp.c [moved from lib/nbsd_libc/arch/sparc64/gen/_lwp.c with 100% similarity]
lib/libc/arch/sparc64/gen/_setjmp.S [moved from lib/nbsd_libc/arch/sparc64/gen/_setjmp.S with 100% similarity]
lib/libc/arch/sparc64/gen/divrem.m4 [moved from lib/nbsd_libc/arch/sparc64/gen/divrem.m4 with 100% similarity]
lib/libc/arch/sparc64/gen/fabs.S [moved from lib/nbsd_libc/arch/sparc64/gen/fabs.S with 100% similarity]
lib/libc/arch/sparc64/gen/fixunsdfsi.S [moved from lib/nbsd_libc/arch/sparc64/gen/fixunsdfsi.S with 100% similarity]
lib/libc/arch/sparc64/gen/flt_rounds.c [moved from lib/nbsd_libc/arch/sparc64/gen/flt_rounds.c with 100% similarity]
lib/libc/arch/sparc64/gen/fpclassifyl.c [moved from lib/nbsd_libc/arch/sparc64/gen/fpclassifyl.c with 100% similarity]
lib/libc/arch/sparc64/gen/fpgetmask.c [moved from lib/nbsd_libc/arch/sparc64/gen/fpgetmask.c with 100% similarity]
lib/libc/arch/sparc64/gen/fpgetround.c [moved from lib/nbsd_libc/arch/sparc64/gen/fpgetround.c with 100% similarity]
lib/libc/arch/sparc64/gen/fpgetsticky.c [moved from lib/nbsd_libc/arch/sparc64/gen/fpgetsticky.c with 100% similarity]
lib/libc/arch/sparc64/gen/fpsetmask.c [moved from lib/nbsd_libc/arch/sparc64/gen/fpsetmask.c with 100% similarity]
lib/libc/arch/sparc64/gen/fpsetround.c [moved from lib/nbsd_libc/arch/sparc64/gen/fpsetround.c with 100% similarity]
lib/libc/arch/sparc64/gen/fpsetsticky.c [moved from lib/nbsd_libc/arch/sparc64/gen/fpsetsticky.c with 100% similarity]
lib/libc/arch/sparc64/gen/infinityl.c [moved from lib/nbsd_libc/arch/sparc64/gen/infinityl.c with 100% similarity]
lib/libc/arch/sparc64/gen/isfinitel.c [moved from lib/nbsd_libc/arch/sparc64/gen/isfinitel.c with 100% similarity]
lib/libc/arch/sparc64/gen/isinfl.c [moved from lib/nbsd_libc/arch/sparc64/gen/isinfl.c with 100% similarity]
lib/libc/arch/sparc64/gen/isnanl.c [moved from lib/nbsd_libc/arch/sparc64/gen/isnanl.c with 100% similarity]
lib/libc/arch/sparc64/gen/longjmp.c [moved from lib/nbsd_libc/arch/sparc64/gen/longjmp.c with 100% similarity]
lib/libc/arch/sparc64/gen/makecontext.c [moved from lib/nbsd_libc/arch/sparc64/gen/makecontext.c with 100% similarity]
lib/libc/arch/sparc64/gen/modf.S [moved from lib/nbsd_libc/arch/sparc64/gen/modf.S with 100% similarity]
lib/libc/arch/sparc64/gen/nanf.c [moved from lib/nbsd_libc/arch/sparc64/gen/nanf.c with 100% similarity]
lib/libc/arch/sparc64/gen/resumecontext.c [moved from lib/nbsd_libc/arch/sparc64/gen/resumecontext.c with 100% similarity]
lib/libc/arch/sparc64/gen/setjmp.S [moved from lib/nbsd_libc/arch/sparc64/gen/setjmp.S with 100% similarity]
lib/libc/arch/sparc64/gen/signbitl.c [moved from lib/nbsd_libc/arch/sparc64/gen/signbitl.c with 100% similarity]
lib/libc/arch/sparc64/gen/sigsetjmp.S [moved from lib/nbsd_libc/arch/sparc64/gen/sigsetjmp.S with 100% similarity]
lib/libc/arch/sparc64/gen/swapcontext.S [moved from lib/nbsd_libc/arch/sparc64/gen/swapcontext.S with 100% similarity]
lib/libc/arch/sparc64/net/Makefile.inc [moved from lib/nbsd_libc/arch/sparc64/net/Makefile.inc with 100% similarity]
lib/libc/arch/sparc64/softfloat/milieu.h [moved from lib/nbsd_libc/arch/sparc64/softfloat/milieu.h with 100% similarity]
lib/libc/arch/sparc64/softfloat/qp.c [moved from lib/nbsd_libc/arch/sparc64/softfloat/qp.c with 100% similarity]
lib/libc/arch/sparc64/softfloat/softfloat-qp.h [moved from lib/nbsd_libc/arch/sparc64/softfloat/softfloat-qp.h with 100% similarity]
lib/libc/arch/sparc64/softfloat/softfloat-wrapper.c [moved from lib/nbsd_libc/arch/sparc64/softfloat/softfloat-wrapper.c with 100% similarity]
lib/libc/arch/sparc64/softfloat/softfloat.h [moved from lib/nbsd_libc/arch/sparc64/softfloat/softfloat.h with 100% similarity]
lib/libc/arch/sparc64/softfloat/sparc64-gcc.h [moved from lib/nbsd_libc/arch/sparc64/softfloat/sparc64-gcc.h with 100% similarity]
lib/libc/arch/sparc64/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/sparc64/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/sparc64/stdlib/abs.S [moved from lib/nbsd_libc/arch/sparc64/stdlib/abs.S with 100% similarity]
lib/libc/arch/sparc64/string/Makefile.inc [moved from lib/nbsd_libc/arch/sparc64/string/Makefile.inc with 100% similarity]
lib/libc/arch/sparc64/string/memcpy.S [moved from lib/nbsd_libc/arch/sparc64/string/memcpy.S with 100% similarity]
lib/libc/arch/sparc64/string/memset.S [moved from lib/nbsd_libc/arch/sparc64/string/memset.S with 100% similarity]
lib/libc/arch/sparc64/sys/__clone.S [moved from lib/nbsd_libc/arch/sparc64/sys/__clone.S with 100% similarity]
lib/libc/arch/sparc64/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/sparc64/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/sparc64/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/sparc64/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/sparc64/sys/__syscall.S [moved from lib/nbsd_libc/arch/sparc64/sys/__syscall.S with 100% similarity]
lib/libc/arch/sparc64/sys/__vfork14.S [moved from lib/nbsd_libc/arch/sparc64/sys/__vfork14.S with 100% similarity]
lib/libc/arch/sparc64/sys/brk.S [moved from lib/nbsd_libc/arch/sparc64/sys/brk.S with 100% similarity]
lib/libc/arch/sparc64/sys/cerror.S [moved from lib/nbsd_libc/arch/sparc64/sys/cerror.S with 100% similarity]
lib/libc/arch/sparc64/sys/exect.S [moved from lib/nbsd_libc/arch/sparc64/sys/exect.S with 100% similarity]
lib/libc/arch/sparc64/sys/fork.S [moved from lib/nbsd_libc/arch/sparc64/sys/fork.S with 100% similarity]
lib/libc/arch/sparc64/sys/getcontext.S [moved from lib/nbsd_libc/arch/sparc64/sys/getcontext.S with 100% similarity]
lib/libc/arch/sparc64/sys/pipe.S [moved from lib/nbsd_libc/arch/sparc64/sys/pipe.S with 100% similarity]
lib/libc/arch/sparc64/sys/ptrace.S [moved from lib/nbsd_libc/arch/sparc64/sys/ptrace.S with 100% similarity]
lib/libc/arch/sparc64/sys/sbrk.S [moved from lib/nbsd_libc/arch/sparc64/sys/sbrk.S with 100% similarity]
lib/libc/arch/sparc64/sys/shmat.S [moved from lib/nbsd_libc/arch/sparc64/sys/shmat.S with 100% similarity]
lib/libc/arch/sparc64/sys/syscall.S [moved from lib/nbsd_libc/arch/sparc64/sys/syscall.S with 100% similarity]
lib/libc/arch/vax/DEFS.h [moved from lib/nbsd_libc/arch/vax/DEFS.h with 100% similarity]
lib/libc/arch/vax/Makefile.inc [moved from lib/nbsd_libc/arch/vax/Makefile.inc with 100% similarity]
lib/libc/arch/vax/SYS.h [moved from lib/nbsd_libc/arch/vax/SYS.h with 100% similarity]
lib/libc/arch/vax/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/vax/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/vax/gdtoa/arith.h [moved from lib/nbsd_libc/arch/vax/gdtoa/arith.h with 100% similarity]
lib/libc/arch/vax/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/vax/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/vax/gen/Makefile.inc [moved from lib/nbsd_libc/arch/vax/gen/Makefile.inc with 100% similarity]
lib/libc/arch/vax/gen/__longjmp14.c [moved from lib/nbsd_libc/arch/vax/gen/__longjmp14.c with 100% similarity]
lib/libc/arch/vax/gen/__setjmp14.S [moved from lib/nbsd_libc/arch/vax/gen/__setjmp14.S with 100% similarity]
lib/libc/arch/vax/gen/__sigsetjmp14.S [moved from lib/nbsd_libc/arch/vax/gen/__sigsetjmp14.S with 100% similarity]
lib/libc/arch/vax/gen/_lwp.c [moved from lib/nbsd_libc/arch/vax/gen/_lwp.c with 100% similarity]
lib/libc/arch/vax/gen/_setjmp.S [moved from lib/nbsd_libc/arch/vax/gen/_setjmp.S with 100% similarity]
lib/libc/arch/vax/gen/alloca.S [moved from lib/nbsd_libc/arch/vax/gen/alloca.S with 100% similarity]
lib/libc/arch/vax/gen/byte_swap_2.S [moved from lib/nbsd_libc/arch/vax/gen/byte_swap_2.S with 100% similarity]
lib/libc/arch/vax/gen/byte_swap_4.S [moved from lib/nbsd_libc/arch/vax/gen/byte_swap_4.S with 100% similarity]
lib/libc/arch/vax/gen/fabs.S [moved from lib/nbsd_libc/arch/vax/gen/fabs.S with 100% similarity]
lib/libc/arch/vax/gen/fpclassifyd.c [moved from lib/nbsd_libc/arch/vax/gen/fpclassifyd.c with 100% similarity]
lib/libc/arch/vax/gen/fpclassifyf.c [moved from lib/nbsd_libc/arch/vax/gen/fpclassifyf.c with 100% similarity]
lib/libc/arch/vax/gen/frexp.c [moved from lib/nbsd_libc/arch/vax/gen/frexp.c with 100% similarity]
lib/libc/arch/vax/gen/infinity.c [moved from lib/nbsd_libc/arch/vax/gen/infinity.c with 100% similarity]
lib/libc/arch/vax/gen/infinityf.c [moved from lib/nbsd_libc/arch/vax/gen/infinityf.c with 100% similarity]
lib/libc/arch/vax/gen/infinityl.c [moved from lib/nbsd_libc/arch/vax/gen/infinityl.c with 100% similarity]
lib/libc/arch/vax/gen/isfinited.c [moved from lib/nbsd_libc/arch/vax/gen/isfinited.c with 100% similarity]
lib/libc/arch/vax/gen/isfinitef.c [moved from lib/nbsd_libc/arch/vax/gen/isfinitef.c with 100% similarity]
lib/libc/arch/vax/gen/isinf.c [moved from lib/nbsd_libc/arch/vax/gen/isinf.c with 100% similarity]
lib/libc/arch/vax/gen/isnan.c [moved from lib/nbsd_libc/arch/vax/gen/isnan.c with 100% similarity]
lib/libc/arch/vax/gen/ldexp.S [moved from lib/nbsd_libc/arch/vax/gen/ldexp.S with 100% similarity]
lib/libc/arch/vax/gen/makecontext.c [moved from lib/nbsd_libc/arch/vax/gen/makecontext.c with 100% similarity]
lib/libc/arch/vax/gen/modf.S [moved from lib/nbsd_libc/arch/vax/gen/modf.S with 100% similarity]
lib/libc/arch/vax/gen/resumecontext.c [moved from lib/nbsd_libc/arch/vax/gen/resumecontext.c with 100% similarity]
lib/libc/arch/vax/gen/signbitd.c [moved from lib/nbsd_libc/arch/vax/gen/signbitd.c with 100% similarity]
lib/libc/arch/vax/gen/signbitf.c [moved from lib/nbsd_libc/arch/vax/gen/signbitf.c with 100% similarity]
lib/libc/arch/vax/gen/swapcontext.S [moved from lib/nbsd_libc/arch/vax/gen/swapcontext.S with 100% similarity]
lib/libc/arch/vax/genassym.cf [moved from lib/nbsd_libc/arch/vax/genassym.cf with 100% similarity]
lib/libc/arch/vax/net/Makefile.inc [moved from lib/nbsd_libc/arch/vax/net/Makefile.inc with 100% similarity]
lib/libc/arch/vax/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/vax/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/vax/string/Makefile.inc [moved from lib/nbsd_libc/arch/vax/string/Makefile.inc with 100% similarity]
lib/libc/arch/vax/string/bcmp.S [moved from lib/nbsd_libc/arch/vax/string/bcmp.S with 100% similarity]
lib/libc/arch/vax/string/bcopy.S [moved from lib/nbsd_libc/arch/vax/string/bcopy.S with 100% similarity]
lib/libc/arch/vax/string/bzero.S [moved from lib/nbsd_libc/arch/vax/string/bzero.S with 100% similarity]
lib/libc/arch/vax/string/ffs.S [moved from lib/nbsd_libc/arch/vax/string/ffs.S with 100% similarity]
lib/libc/arch/vax/string/index.S [moved from lib/nbsd_libc/arch/vax/string/index.S with 100% similarity]
lib/libc/arch/vax/string/memcmp.S [moved from lib/nbsd_libc/arch/vax/string/memcmp.S with 100% similarity]
lib/libc/arch/vax/sys/__clone.S [moved from lib/nbsd_libc/arch/vax/sys/__clone.S with 100% similarity]
lib/libc/arch/vax/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/vax/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/vax/sys/__sigtramp3.S [moved from lib/nbsd_libc/arch/vax/sys/__sigtramp3.S with 100% similarity]
lib/libc/arch/vax/sys/__syscall.S [moved from lib/nbsd_libc/arch/vax/sys/__syscall.S with 100% similarity]
lib/libc/arch/vax/sys/__vfork14.S [moved from lib/nbsd_libc/arch/vax/sys/__vfork14.S with 100% similarity]
lib/libc/arch/vax/sys/brk.S [moved from lib/nbsd_libc/arch/vax/sys/brk.S with 100% similarity]
lib/libc/arch/vax/sys/cerror.S [moved from lib/nbsd_libc/arch/vax/sys/cerror.S with 100% similarity]
lib/libc/arch/vax/sys/execl.S [moved from lib/nbsd_libc/arch/vax/sys/execl.S with 100% similarity]
lib/libc/arch/vax/sys/execle.S [moved from lib/nbsd_libc/arch/vax/sys/execle.S with 100% similarity]
lib/libc/arch/vax/sys/execlp.S [moved from lib/nbsd_libc/arch/vax/sys/execlp.S with 100% similarity]
lib/libc/arch/vax/sys/exect.S [moved from lib/nbsd_libc/arch/vax/sys/exect.S with 100% similarity]
lib/libc/arch/vax/sys/fork.S [moved from lib/nbsd_libc/arch/vax/sys/fork.S with 100% similarity]
lib/libc/arch/vax/sys/getcontext.S [moved from lib/nbsd_libc/arch/vax/sys/getcontext.S with 100% similarity]
lib/libc/arch/vax/sys/pipe.S [moved from lib/nbsd_libc/arch/vax/sys/pipe.S with 100% similarity]
lib/libc/arch/vax/sys/ptrace.S [moved from lib/nbsd_libc/arch/vax/sys/ptrace.S with 100% similarity]
lib/libc/arch/vax/sys/sbrk.S [moved from lib/nbsd_libc/arch/vax/sys/sbrk.S with 100% similarity]
lib/libc/arch/vax/sys/shmat.S [moved from lib/nbsd_libc/arch/vax/sys/shmat.S with 100% similarity]
lib/libc/arch/vax/sys/syscall.S [moved from lib/nbsd_libc/arch/vax/sys/syscall.S with 100% similarity]
lib/libc/arch/x86_64/Makefile.inc [moved from lib/nbsd_libc/arch/x86_64/Makefile.inc with 100% similarity]
lib/libc/arch/x86_64/SYS.h [moved from lib/nbsd_libc/arch/x86_64/SYS.h with 100% similarity]
lib/libc/arch/x86_64/gdtoa/Makefile.inc [moved from lib/nbsd_libc/arch/x86_64/gdtoa/Makefile.inc with 100% similarity]
lib/libc/arch/x86_64/gdtoa/arith.h [moved from lib/nbsd_libc/arch/x86_64/gdtoa/arith.h with 100% similarity]
lib/libc/arch/x86_64/gdtoa/gd_qnan.h [moved from lib/nbsd_libc/arch/x86_64/gdtoa/gd_qnan.h with 100% similarity]
lib/libc/arch/x86_64/gen/Makefile.inc [moved from lib/nbsd_libc/arch/x86_64/gen/Makefile.inc with 100% similarity]
lib/libc/arch/x86_64/gen/__setjmp14.S [moved from lib/nbsd_libc/arch/x86_64/gen/__setjmp14.S with 100% similarity]
lib/libc/arch/x86_64/gen/__sigsetjmp14.S [moved from lib/nbsd_libc/arch/x86_64/gen/__sigsetjmp14.S with 100% similarity]
lib/libc/arch/x86_64/gen/_lwp.c [moved from lib/nbsd_libc/arch/x86_64/gen/_lwp.c with 100% similarity]
lib/libc/arch/x86_64/gen/_setjmp.S [moved from lib/nbsd_libc/arch/x86_64/gen/_setjmp.S with 100% similarity]
lib/libc/arch/x86_64/gen/alloca.S [moved from lib/nbsd_libc/arch/x86_64/gen/alloca.S with 100% similarity]
lib/libc/arch/x86_64/gen/fabs.S [moved from lib/nbsd_libc/arch/x86_64/gen/fabs.S with 100% similarity]
lib/libc/arch/x86_64/gen/flt_rounds.S [moved from lib/nbsd_libc/arch/x86_64/gen/flt_rounds.S with 100% similarity]
lib/libc/arch/x86_64/gen/fpclassifyl.c [moved from lib/nbsd_libc/arch/x86_64/gen/fpclassifyl.c with 100% similarity]
lib/libc/arch/x86_64/gen/fpgetmask.S [moved from lib/nbsd_libc/arch/x86_64/gen/fpgetmask.S with 100% similarity]
lib/libc/arch/x86_64/gen/fpgetround.S [moved from lib/nbsd_libc/arch/x86_64/gen/fpgetround.S with 100% similarity]
lib/libc/arch/x86_64/gen/fpgetsticky.S [moved from lib/nbsd_libc/arch/x86_64/gen/fpgetsticky.S with 100% similarity]
lib/libc/arch/x86_64/gen/fpsetmask.S [moved from lib/nbsd_libc/arch/x86_64/gen/fpsetmask.S with 100% similarity]
lib/libc/arch/x86_64/gen/fpsetround.S [moved from lib/nbsd_libc/arch/x86_64/gen/fpsetround.S with 100% similarity]
lib/libc/arch/x86_64/gen/fpsetsticky.S [moved from lib/nbsd_libc/arch/x86_64/gen/fpsetsticky.S with 100% similarity]
lib/libc/arch/x86_64/gen/infinityl.c [moved from lib/nbsd_libc/arch/x86_64/gen/infinityl.c with 100% similarity]
lib/libc/arch/x86_64/gen/isfinitel.c [moved from lib/nbsd_libc/arch/x86_64/gen/isfinitel.c with 100% similarity]
lib/libc/arch/x86_64/gen/isinfl.c [moved from lib/nbsd_libc/arch/x86_64/gen/isinfl.c with 100% similarity]
lib/libc/arch/x86_64/gen/isnanl.c [moved from lib/nbsd_libc/arch/x86_64/gen/isnanl.c with 100% similarity]
lib/libc/arch/x86_64/gen/makecontext.c [moved from lib/nbsd_libc/arch/x86_64/gen/makecontext.c with 100% similarity]
lib/libc/arch/x86_64/gen/nanf.c [moved from lib/nbsd_libc/arch/x86_64/gen/nanf.c with 100% similarity]
lib/libc/arch/x86_64/gen/resumecontext.S [moved from lib/nbsd_libc/arch/x86_64/gen/resumecontext.S with 100% similarity]
lib/libc/arch/x86_64/gen/signbitl.c [moved from lib/nbsd_libc/arch/x86_64/gen/signbitl.c with 100% similarity]
lib/libc/arch/x86_64/gen/swapcontext.S [moved from lib/nbsd_libc/arch/x86_64/gen/swapcontext.S with 100% similarity]
lib/libc/arch/x86_64/net/Makefile.inc [moved from lib/nbsd_libc/arch/x86_64/net/Makefile.inc with 100% similarity]
lib/libc/arch/x86_64/stdlib/Makefile.inc [moved from lib/nbsd_libc/arch/x86_64/stdlib/Makefile.inc with 100% similarity]
lib/libc/arch/x86_64/stdlib/abs.S [moved from lib/nbsd_libc/arch/x86_64/stdlib/abs.S with 100% similarity]
lib/libc/arch/x86_64/stdlib/div.S [moved from lib/nbsd_libc/arch/x86_64/stdlib/div.S with 100% similarity]
lib/libc/arch/x86_64/stdlib/labs.S [moved from lib/nbsd_libc/arch/x86_64/stdlib/labs.S with 100% similarity]
lib/libc/arch/x86_64/stdlib/ldiv.S [moved from lib/nbsd_libc/arch/x86_64/stdlib/ldiv.S with 100% similarity]
lib/libc/arch/x86_64/string/Makefile.inc [moved from lib/nbsd_libc/arch/x86_64/string/Makefile.inc with 100% similarity]
lib/libc/arch/x86_64/string/strncmp.S [moved from lib/nbsd_libc/arch/x86_64/string/strncmp.S with 100% similarity]
lib/libc/arch/x86_64/string/swab.S [moved from lib/nbsd_libc/arch/x86_64/string/swab.S with 100% similarity]
lib/libc/arch/x86_64/sys/__clone.S [moved from lib/nbsd_libc/arch/x86_64/sys/__clone.S with 100% similarity]
lib/libc/arch/x86_64/sys/__sigaction14_sigtramp.c [moved from lib/nbsd_libc/arch/x86_64/sys/__sigaction14_sigtramp.c with 100% similarity]
lib/libc/arch/x86_64/sys/__sigtramp2.S [moved from lib/nbsd_libc/arch/x86_64/sys/__sigtramp2.S with 100% similarity]
lib/libc/arch/x86_64/sys/__syscall.S [moved from lib/nbsd_libc/arch/x86_64/sys/__syscall.S with 100% similarity]
lib/libc/arch/x86_64/sys/__vfork14.S [moved from lib/nbsd_libc/arch/x86_64/sys/__vfork14.S with 100% similarity]
lib/libc/arch/x86_64/sys/brk.S [moved from lib/nbsd_libc/arch/x86_64/sys/brk.S with 100% similarity]
lib/libc/arch/x86_64/sys/cerror.S [moved from lib/nbsd_libc/arch/x86_64/sys/cerror.S with 100% similarity]
lib/libc/arch/x86_64/sys/exect.S [moved from lib/nbsd_libc/arch/x86_64/sys/exect.S with 100% similarity]
lib/libc/arch/x86_64/sys/fork.S [moved from lib/nbsd_libc/arch/x86_64/sys/fork.S with 100% similarity]
lib/libc/arch/x86_64/sys/getcontext.S [moved from lib/nbsd_libc/arch/x86_64/sys/getcontext.S with 100% similarity]
lib/libc/arch/x86_64/sys/pipe.S [moved from lib/nbsd_libc/arch/x86_64/sys/pipe.S with 100% similarity]
lib/libc/arch/x86_64/sys/ptrace.S [moved from lib/nbsd_libc/arch/x86_64/sys/ptrace.S with 100% similarity]
lib/libc/arch/x86_64/sys/sbrk.S [moved from lib/nbsd_libc/arch/x86_64/sys/sbrk.S with 100% similarity]
lib/libc/arch/x86_64/sys/shmat.S [moved from lib/nbsd_libc/arch/x86_64/sys/shmat.S with 100% similarity]
lib/libc/arch/x86_64/sys/syscall.S [moved from lib/nbsd_libc/arch/x86_64/sys/syscall.S with 100% similarity]
lib/libc/atomic/Makefile.inc [moved from lib/nbsd_libc/atomic/Makefile.inc with 100% similarity]
lib/libc/atomic/atomic_add.3 [moved from lib/nbsd_libc/atomic/atomic_add.3 with 100% similarity]
lib/libc/atomic/atomic_and.3 [moved from lib/nbsd_libc/atomic/atomic_and.3 with 100% similarity]
lib/libc/atomic/atomic_cas.3 [moved from lib/nbsd_libc/atomic/atomic_cas.3 with 100% similarity]
lib/libc/atomic/atomic_dec.3 [moved from lib/nbsd_libc/atomic/atomic_dec.3 with 100% similarity]
lib/libc/atomic/atomic_inc.3 [moved from lib/nbsd_libc/atomic/atomic_inc.3 with 100% similarity]
lib/libc/atomic/atomic_ops.3 [moved from lib/nbsd_libc/atomic/atomic_ops.3 with 100% similarity]
lib/libc/atomic/atomic_or.3 [moved from lib/nbsd_libc/atomic/atomic_or.3 with 100% similarity]
lib/libc/atomic/atomic_swap.3 [moved from lib/nbsd_libc/atomic/atomic_swap.3 with 100% similarity]
lib/libc/atomic/membar_ops.3 [moved from lib/nbsd_libc/atomic/membar_ops.3 with 100% similarity]
lib/libc/cdb/Makefile.inc [moved from lib/nbsd_libc/cdb/Makefile.inc with 100% similarity]
lib/libc/cdb/cdb.5 [moved from lib/nbsd_libc/cdb/cdb.5 with 100% similarity]
lib/libc/cdb/cdbr.3 [moved from lib/nbsd_libc/cdb/cdbr.3 with 100% similarity]
lib/libc/cdb/cdbr.c [moved from lib/nbsd_libc/cdb/cdbr.c with 100% similarity]
lib/libc/cdb/cdbw.3 [moved from lib/nbsd_libc/cdb/cdbw.3 with 100% similarity]
lib/libc/cdb/cdbw.c [moved from lib/nbsd_libc/cdb/cdbw.c with 100% similarity]
lib/libc/citrus/Makefile.inc [moved from lib/nbsd_libc/citrus/Makefile.inc with 100% similarity]
lib/libc/citrus/citrus_aliasname_local.h [moved from lib/nbsd_libc/citrus/citrus_aliasname_local.h with 100% similarity]
lib/libc/citrus/citrus_bcs.c [moved from lib/nbsd_libc/citrus/citrus_bcs.c with 100% similarity]
lib/libc/citrus/citrus_bcs.h [moved from lib/nbsd_libc/citrus/citrus_bcs.h with 100% similarity]
lib/libc/citrus/citrus_bcs_strtol.c [moved from lib/nbsd_libc/citrus/citrus_bcs_strtol.c with 100% similarity]
lib/libc/citrus/citrus_bcs_strtoul.c [moved from lib/nbsd_libc/citrus/citrus_bcs_strtoul.c with 100% similarity]
lib/libc/citrus/citrus_csmapper.c [moved from lib/nbsd_libc/citrus/citrus_csmapper.c with 100% similarity]
lib/libc/citrus/citrus_csmapper.h [moved from lib/nbsd_libc/citrus/citrus_csmapper.h with 100% similarity]
lib/libc/citrus/citrus_ctype.c [moved from lib/nbsd_libc/citrus/citrus_ctype.c with 100% similarity]
lib/libc/citrus/citrus_ctype.h [moved from lib/nbsd_libc/citrus/citrus_ctype.h with 100% similarity]
lib/libc/citrus/citrus_ctype_fallback.c [moved from lib/nbsd_libc/citrus/citrus_ctype_fallback.c with 100% similarity]
lib/libc/citrus/citrus_ctype_fallback.h [moved from lib/nbsd_libc/citrus/citrus_ctype_fallback.h with 100% similarity]
lib/libc/citrus/citrus_ctype_local.h [moved from lib/nbsd_libc/citrus/citrus_ctype_local.h with 100% similarity]
lib/libc/citrus/citrus_ctype_template.h [moved from lib/nbsd_libc/citrus/citrus_ctype_template.h with 100% similarity]
lib/libc/citrus/citrus_db.c [moved from lib/nbsd_libc/citrus/citrus_db.c with 100% similarity]
lib/libc/citrus/citrus_db.h [moved from lib/nbsd_libc/citrus/citrus_db.h with 100% similarity]
lib/libc/citrus/citrus_db_factory.c [moved from lib/nbsd_libc/citrus/citrus_db_factory.c with 100% similarity]
lib/libc/citrus/citrus_db_factory.h [moved from lib/nbsd_libc/citrus/citrus_db_factory.h with 100% similarity]
lib/libc/citrus/citrus_db_file.h [moved from lib/nbsd_libc/citrus/citrus_db_file.h with 100% similarity]
lib/libc/citrus/citrus_db_hash.c [moved from lib/nbsd_libc/citrus/citrus_db_hash.c with 100% similarity]
lib/libc/citrus/citrus_db_hash.h [moved from lib/nbsd_libc/citrus/citrus_db_hash.h with 100% similarity]
lib/libc/citrus/citrus_esdb.c [moved from lib/nbsd_libc/citrus/citrus_esdb.c with 100% similarity]
lib/libc/citrus/citrus_esdb.h [moved from lib/nbsd_libc/citrus/citrus_esdb.h with 100% similarity]
lib/libc/citrus/citrus_esdb_file.h [moved from lib/nbsd_libc/citrus/citrus_esdb_file.h with 100% similarity]
lib/libc/citrus/citrus_fix_grouping.h [moved from lib/nbsd_libc/citrus/citrus_fix_grouping.h with 100% similarity]
lib/libc/citrus/citrus_hash.c [moved from lib/nbsd_libc/citrus/citrus_hash.c with 100% similarity]
lib/libc/citrus/citrus_hash.h [moved from lib/nbsd_libc/citrus/citrus_hash.h with 100% similarity]
lib/libc/citrus/citrus_iconv.c [moved from lib/nbsd_libc/citrus/citrus_iconv.c with 100% similarity]
lib/libc/citrus/citrus_iconv.h [moved from lib/nbsd_libc/citrus/citrus_iconv.h with 100% similarity]
lib/libc/citrus/citrus_iconv_local.h [moved from lib/nbsd_libc/citrus/citrus_iconv_local.h with 100% similarity]
lib/libc/citrus/citrus_lc_ctype.c [moved from lib/nbsd_libc/citrus/citrus_lc_ctype.c with 100% similarity]
lib/libc/citrus/citrus_lc_messages.c [moved from lib/nbsd_libc/citrus/citrus_lc_messages.c with 100% similarity]
lib/libc/citrus/citrus_lc_messages.h [moved from lib/nbsd_libc/citrus/citrus_lc_messages.h with 100% similarity]
lib/libc/citrus/citrus_lc_monetary.c [moved from lib/nbsd_libc/citrus/citrus_lc_monetary.c with 100% similarity]
lib/libc/citrus/citrus_lc_monetary.h [moved from lib/nbsd_libc/citrus/citrus_lc_monetary.h with 100% similarity]
lib/libc/citrus/citrus_lc_numeric.c [moved from lib/nbsd_libc/citrus/citrus_lc_numeric.c with 100% similarity]
lib/libc/citrus/citrus_lc_numeric.h [moved from lib/nbsd_libc/citrus/citrus_lc_numeric.h with 100% similarity]
lib/libc/citrus/citrus_lc_template.h [moved from lib/nbsd_libc/citrus/citrus_lc_template.h with 100% similarity]
lib/libc/citrus/citrus_lc_template_decl.h [moved from lib/nbsd_libc/citrus/citrus_lc_template_decl.h with 100% similarity]
lib/libc/citrus/citrus_lc_time.c [moved from lib/nbsd_libc/citrus/citrus_lc_time.c with 100% similarity]
lib/libc/citrus/citrus_lc_time.h [moved from lib/nbsd_libc/citrus/citrus_lc_time.h with 100% similarity]
lib/libc/citrus/citrus_lookup.c [moved from lib/nbsd_libc/citrus/citrus_lookup.c with 100% similarity]
lib/libc/citrus/citrus_lookup.h [moved from lib/nbsd_libc/citrus/citrus_lookup.h with 100% similarity]
lib/libc/citrus/citrus_lookup_factory.c [moved from lib/nbsd_libc/citrus/citrus_lookup_factory.c with 100% similarity]
lib/libc/citrus/citrus_lookup_factory.h [moved from lib/nbsd_libc/citrus/citrus_lookup_factory.h with 100% similarity]
lib/libc/citrus/citrus_lookup_file.h [moved from lib/nbsd_libc/citrus/citrus_lookup_file.h with 100% similarity]
lib/libc/citrus/citrus_mapper.c [moved from lib/nbsd_libc/citrus/citrus_mapper.c with 100% similarity]
lib/libc/citrus/citrus_mapper.h [moved from lib/nbsd_libc/citrus/citrus_mapper.h with 100% similarity]
lib/libc/citrus/citrus_mapper_local.h [moved from lib/nbsd_libc/citrus/citrus_mapper_local.h with 100% similarity]
lib/libc/citrus/citrus_memstream.c [moved from lib/nbsd_libc/citrus/citrus_memstream.c with 100% similarity]
lib/libc/citrus/citrus_memstream.h [moved from lib/nbsd_libc/citrus/citrus_memstream.h with 100% similarity]
lib/libc/citrus/citrus_mmap.c [moved from lib/nbsd_libc/citrus/citrus_mmap.c with 100% similarity]
lib/libc/citrus/citrus_mmap.h [moved from lib/nbsd_libc/citrus/citrus_mmap.h with 100% similarity]
lib/libc/citrus/citrus_module.c [moved from lib/nbsd_libc/citrus/citrus_module.c with 100% similarity]
lib/libc/citrus/citrus_module.h [moved from lib/nbsd_libc/citrus/citrus_module.h with 100% similarity]
lib/libc/citrus/citrus_namespace.h [moved from lib/nbsd_libc/citrus/citrus_namespace.h with 100% similarity]
lib/libc/citrus/citrus_none.c [moved from lib/nbsd_libc/citrus/citrus_none.c with 100% similarity]
lib/libc/citrus/citrus_none.h [moved from lib/nbsd_libc/citrus/citrus_none.h with 100% similarity]
lib/libc/citrus/citrus_pivot_factory.c [moved from lib/nbsd_libc/citrus/citrus_pivot_factory.c with 100% similarity]
lib/libc/citrus/citrus_pivot_factory.h [moved from lib/nbsd_libc/citrus/citrus_pivot_factory.h with 100% similarity]
lib/libc/citrus/citrus_pivot_file.h [moved from lib/nbsd_libc/citrus/citrus_pivot_file.h with 100% similarity]
lib/libc/citrus/citrus_prop.c [moved from lib/nbsd_libc/citrus/citrus_prop.c with 100% similarity]
lib/libc/citrus/citrus_prop.h [moved from lib/nbsd_libc/citrus/citrus_prop.h with 100% similarity]
lib/libc/citrus/citrus_region.h [moved from lib/nbsd_libc/citrus/citrus_region.h with 100% similarity]
lib/libc/citrus/citrus_stdenc.c [moved from lib/nbsd_libc/citrus/citrus_stdenc.c with 100% similarity]
lib/libc/citrus/citrus_stdenc.h [moved from lib/nbsd_libc/citrus/citrus_stdenc.h with 100% similarity]
lib/libc/citrus/citrus_stdenc_local.h [moved from lib/nbsd_libc/citrus/citrus_stdenc_local.h with 100% similarity]
lib/libc/citrus/citrus_stdenc_template.h [moved from lib/nbsd_libc/citrus/citrus_stdenc_template.h with 100% similarity]
lib/libc/citrus/citrus_types.h [moved from lib/nbsd_libc/citrus/citrus_types.h with 100% similarity]
lib/libc/citrus/modules/citrus_big5.c [moved from lib/nbsd_libc/citrus/modules/citrus_big5.c with 100% similarity]
lib/libc/citrus/modules/citrus_big5.h [moved from lib/nbsd_libc/citrus/modules/citrus_big5.h with 100% similarity]
lib/libc/citrus/modules/citrus_dechanyu.c [moved from lib/nbsd_libc/citrus/modules/citrus_dechanyu.c with 100% similarity]
lib/libc/citrus/modules/citrus_dechanyu.h [moved from lib/nbsd_libc/citrus/modules/citrus_dechanyu.h with 100% similarity]
lib/libc/citrus/modules/citrus_euc.c [moved from lib/nbsd_libc/citrus/modules/citrus_euc.c with 100% similarity]
lib/libc/citrus/modules/citrus_euc.h [moved from lib/nbsd_libc/citrus/modules/citrus_euc.h with 100% similarity]
lib/libc/citrus/modules/citrus_euctw.c [moved from lib/nbsd_libc/citrus/modules/citrus_euctw.c with 100% similarity]
lib/libc/citrus/modules/citrus_euctw.h [moved from lib/nbsd_libc/citrus/modules/citrus_euctw.h with 100% similarity]
lib/libc/citrus/modules/citrus_gbk2k.c [moved from lib/nbsd_libc/citrus/modules/citrus_gbk2k.c with 100% similarity]
lib/libc/citrus/modules/citrus_gbk2k.h [moved from lib/nbsd_libc/citrus/modules/citrus_gbk2k.h with 100% similarity]
lib/libc/citrus/modules/citrus_hz.c [moved from lib/nbsd_libc/citrus/modules/citrus_hz.c with 100% similarity]
lib/libc/citrus/modules/citrus_hz.h [moved from lib/nbsd_libc/citrus/modules/citrus_hz.h with 100% similarity]
lib/libc/citrus/modules/citrus_iconv_none.c [moved from lib/nbsd_libc/citrus/modules/citrus_iconv_none.c with 100% similarity]
lib/libc/citrus/modules/citrus_iconv_none.h [moved from lib/nbsd_libc/citrus/modules/citrus_iconv_none.h with 100% similarity]
lib/libc/citrus/modules/citrus_iconv_std.c [moved from lib/nbsd_libc/citrus/modules/citrus_iconv_std.c with 100% similarity]
lib/libc/citrus/modules/citrus_iconv_std.h [moved from lib/nbsd_libc/citrus/modules/citrus_iconv_std.h with 100% similarity]
lib/libc/citrus/modules/citrus_iconv_std_local.h [moved from lib/nbsd_libc/citrus/modules/citrus_iconv_std_local.h with 100% similarity]
lib/libc/citrus/modules/citrus_iso2022.c [moved from lib/nbsd_libc/citrus/modules/citrus_iso2022.c with 100% similarity]
lib/libc/citrus/modules/citrus_iso2022.h [moved from lib/nbsd_libc/citrus/modules/citrus_iso2022.h with 100% similarity]
lib/libc/citrus/modules/citrus_johab.c [moved from lib/nbsd_libc/citrus/modules/citrus_johab.c with 100% similarity]
lib/libc/citrus/modules/citrus_johab.h [moved from lib/nbsd_libc/citrus/modules/citrus_johab.h with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_646.c [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_646.c with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_646.h [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_646.h with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_none.c [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_none.c with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_none.h [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_none.h with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_serial.c [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_serial.c with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_serial.h [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_serial.h with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_std.c [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_std.c with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_std.h [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_std.h with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_std_file.h [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_std_file.h with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_std_local.h [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_std_local.h with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_zone.c [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_zone.c with 100% similarity]
lib/libc/citrus/modules/citrus_mapper_zone.h [moved from lib/nbsd_libc/citrus/modules/citrus_mapper_zone.h with 100% similarity]
lib/libc/citrus/modules/citrus_mskanji.c [moved from lib/nbsd_libc/citrus/modules/citrus_mskanji.c with 100% similarity]
lib/libc/citrus/modules/citrus_mskanji.h [moved from lib/nbsd_libc/citrus/modules/citrus_mskanji.h with 100% similarity]
lib/libc/citrus/modules/citrus_ues.c [moved from lib/nbsd_libc/citrus/modules/citrus_ues.c with 100% similarity]
lib/libc/citrus/modules/citrus_ues.h [moved from lib/nbsd_libc/citrus/modules/citrus_ues.h with 100% similarity]
lib/libc/citrus/modules/citrus_utf1632.c [moved from lib/nbsd_libc/citrus/modules/citrus_utf1632.c with 100% similarity]
lib/libc/citrus/modules/citrus_utf1632.h [moved from lib/nbsd_libc/citrus/modules/citrus_utf1632.h with 100% similarity]
lib/libc/citrus/modules/citrus_utf7.c [moved from lib/nbsd_libc/citrus/modules/citrus_utf7.c with 100% similarity]
lib/libc/citrus/modules/citrus_utf7.h [moved from lib/nbsd_libc/citrus/modules/citrus_utf7.h with 100% similarity]
lib/libc/citrus/modules/citrus_utf8.c [moved from lib/nbsd_libc/citrus/modules/citrus_utf8.c with 100% similarity]
lib/libc/citrus/modules/citrus_utf8.h [moved from lib/nbsd_libc/citrus/modules/citrus_utf8.h with 100% similarity]
lib/libc/citrus/modules/citrus_viqr.c [moved from lib/nbsd_libc/citrus/modules/citrus_viqr.c with 100% similarity]
lib/libc/citrus/modules/citrus_viqr.h [moved from lib/nbsd_libc/citrus/modules/citrus_viqr.h with 100% similarity]
lib/libc/citrus/modules/citrus_zw.c [moved from lib/nbsd_libc/citrus/modules/citrus_zw.c with 100% similarity]
lib/libc/citrus/modules/citrus_zw.h [moved from lib/nbsd_libc/citrus/modules/citrus_zw.h with 100% similarity]
lib/libc/compat-43/Makefile.inc [moved from lib/nbsd_libc/compat-43/Makefile.inc with 100% similarity]
lib/libc/compat-43/creat.3 [moved from lib/nbsd_libc/compat-43/creat.3 with 100% similarity]
lib/libc/compat-43/creat.c [moved from lib/nbsd_libc/compat-43/creat.c with 100% similarity]
lib/libc/compat-43/getdtablesize.3 [moved from lib/nbsd_libc/compat-43/getdtablesize.3 with 100% similarity]
lib/libc/compat-43/getdtablesize.c [moved from lib/nbsd_libc/compat-43/getdtablesize.c with 100% similarity]
lib/libc/compat-43/gethostid.3 [moved from lib/nbsd_libc/compat-43/gethostid.3 with 100% similarity]
lib/libc/compat-43/gethostid.c [moved from lib/nbsd_libc/compat-43/gethostid.c with 100% similarity]
lib/libc/compat-43/getwd.c [moved from lib/nbsd_libc/compat-43/getwd.c with 100% similarity]
lib/libc/compat-43/killpg.3 [moved from lib/nbsd_libc/compat-43/killpg.3 with 100% similarity]
lib/libc/compat-43/killpg.c [moved from lib/nbsd_libc/compat-43/killpg.c with 100% similarity]
lib/libc/compat-43/sethostid.c [moved from lib/nbsd_libc/compat-43/sethostid.c with 100% similarity]
lib/libc/compat-43/setpgrp.c [moved from lib/nbsd_libc/compat-43/setpgrp.c with 100% similarity]
lib/libc/compat-43/setrgid.c [moved from lib/nbsd_libc/compat-43/setrgid.c with 100% similarity]
lib/libc/compat-43/setruid.3 [moved from lib/nbsd_libc/compat-43/setruid.3 with 100% similarity]
lib/libc/compat-43/setruid.c [moved from lib/nbsd_libc/compat-43/setruid.c with 100% similarity]
lib/libc/compat-43/sigblock.3 [moved from lib/nbsd_libc/compat-43/sigblock.3 with 100% similarity]
lib/libc/compat-43/sigcompat.c [moved from lib/nbsd_libc/compat-43/sigcompat.c with 100% similarity]
lib/libc/compat-43/sigpause.3 [moved from lib/nbsd_libc/compat-43/sigpause.3 with 100% similarity]
lib/libc/compat-43/sigsetmask.3 [moved from lib/nbsd_libc/compat-43/sigsetmask.3 with 100% similarity]
lib/libc/compat-43/sigvec.3 [moved from lib/nbsd_libc/compat-43/sigvec.3 with 100% similarity]
lib/libc/compat-minix/Makefile.inc [moved from lib/nbsd_libc/compat-minix/Makefile.inc with 100% similarity]
lib/libc/compat/Makefile [moved from lib/nbsd_libc/compat/Makefile with 100% similarity]
lib/libc/compat/Makefile.inc [moved from lib/nbsd_libc/compat/Makefile.inc with 100% similarity]
lib/libc/compat/arch/alpha/Makefile.inc [moved from lib/nbsd_libc/compat/arch/alpha/Makefile.inc with 100% similarity]
lib/libc/compat/arch/alpha/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/alpha/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/alpha/gen/compat__setjmp.S [moved from lib/nbsd_libc/compat/arch/alpha/gen/compat__setjmp.S with 100% similarity]
lib/libc/compat/arch/alpha/gen/compat_setjmp.S [moved from lib/nbsd_libc/compat/arch/alpha/gen/compat_setjmp.S with 100% similarity]
lib/libc/compat/arch/alpha/gen/compat_sigsetjmp.S [moved from lib/nbsd_libc/compat/arch/alpha/gen/compat_sigsetjmp.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/alpha/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat___sigtramp1.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat___sigtramp1.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat_sigaction.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat_sigaction.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat_sigpending.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat_sigpending.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat_sigprocmask.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat_sigprocmask.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat_sigreturn.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat_sigreturn.S with 100% similarity]
lib/libc/compat/arch/alpha/sys/compat_sigsuspend.S [moved from lib/nbsd_libc/compat/arch/alpha/sys/compat_sigsuspend.S with 100% similarity]
lib/libc/compat/arch/arm/Makefile.inc [moved from lib/nbsd_libc/compat/arch/arm/Makefile.inc with 100% similarity]
lib/libc/compat/arch/arm/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/arm/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/arm/gen/compat_setjmp.S [moved from lib/nbsd_libc/compat/arch/arm/gen/compat_setjmp.S with 100% similarity]
lib/libc/compat/arch/arm/gen/compat_sigsetjmp.S [moved from lib/nbsd_libc/compat/arch/arm/gen/compat_sigsetjmp.S with 100% similarity]
lib/libc/compat/arch/arm/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/arm/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/arm/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/arm/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/arm/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/arm/sys/compat___sigtramp1.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat___sigtramp1.S with 100% similarity]
lib/libc/compat/arch/arm/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/arm/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/arm/sys/compat_sigaction.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat_sigaction.S with 100% similarity]
lib/libc/compat/arch/arm/sys/compat_sigpending.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat_sigpending.S with 100% similarity]
lib/libc/compat/arch/arm/sys/compat_sigprocmask.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat_sigprocmask.S with 100% similarity]
lib/libc/compat/arch/arm/sys/compat_sigreturn.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat_sigreturn.S with 100% similarity]
lib/libc/compat/arch/arm/sys/compat_sigsuspend.S [moved from lib/nbsd_libc/compat/arch/arm/sys/compat_sigsuspend.S with 100% similarity]
lib/libc/compat/arch/hppa/Makefile.inc [moved from lib/nbsd_libc/compat/arch/hppa/Makefile.inc with 100% similarity]
lib/libc/compat/arch/hppa/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/hppa/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/hppa/locale/compat_setlocale32.c [moved from lib/nbsd_libc/compat/arch/hppa/locale/compat_setlocale32.c with 100% similarity]
lib/libc/compat/arch/hppa/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/hppa/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/hppa/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/hppa/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/hppa/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/hppa/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/hppa/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/hppa/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/hppa/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/hppa/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/hppa/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/hppa/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/hppa/sys/compat_sigaction.S [moved from lib/nbsd_libc/compat/arch/hppa/sys/compat_sigaction.S with 100% similarity]
lib/libc/compat/arch/hppa/sys/compat_sigpending.S [moved from lib/nbsd_libc/compat/arch/hppa/sys/compat_sigpending.S with 100% similarity]
lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S [moved from lib/nbsd_libc/compat/arch/hppa/sys/compat_sigprocmask.S with 100% similarity]
lib/libc/compat/arch/hppa/sys/compat_sigreturn.S [moved from lib/nbsd_libc/compat/arch/hppa/sys/compat_sigreturn.S with 100% similarity]
lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S [moved from lib/nbsd_libc/compat/arch/hppa/sys/compat_sigsuspend.S with 100% similarity]
lib/libc/compat/arch/i386/Makefile.inc [moved from lib/nbsd_libc/compat/arch/i386/Makefile.inc with 100% similarity]
lib/libc/compat/arch/i386/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/i386/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/i386/gen/compat_setjmp.S [moved from lib/nbsd_libc/compat/arch/i386/gen/compat_setjmp.S with 100% similarity]
lib/libc/compat/arch/i386/gen/compat_sigsetjmp.S [moved from lib/nbsd_libc/compat/arch/i386/gen/compat_sigsetjmp.S with 100% similarity]
lib/libc/compat/arch/i386/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/i386/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/i386/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/i386/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/i386/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/i386/sys/compat___sigtramp1.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat___sigtramp1.S with 100% similarity]
lib/libc/compat/arch/i386/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/i386/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/i386/sys/compat_sigaction.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat_sigaction.S with 100% similarity]
lib/libc/compat/arch/i386/sys/compat_sigpending.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat_sigpending.S with 100% similarity]
lib/libc/compat/arch/i386/sys/compat_sigprocmask.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat_sigprocmask.S with 100% similarity]
lib/libc/compat/arch/i386/sys/compat_sigreturn.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat_sigreturn.S with 100% similarity]
lib/libc/compat/arch/i386/sys/compat_sigsuspend.S [moved from lib/nbsd_libc/compat/arch/i386/sys/compat_sigsuspend.S with 100% similarity]
lib/libc/compat/arch/ia64/Makefile.inc [moved from lib/nbsd_libc/compat/arch/ia64/Makefile.inc with 100% similarity]
lib/libc/compat/arch/ia64/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/ia64/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/ia64/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/ia64/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/m68k/Makefile.inc [moved from lib/nbsd_libc/compat/arch/m68k/Makefile.inc with 100% similarity]
lib/libc/compat/arch/m68k/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/m68k/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/m68k/gen/compat_setjmp.S [moved from lib/nbsd_libc/compat/arch/m68k/gen/compat_setjmp.S with 100% similarity]
lib/libc/compat/arch/m68k/gen/compat_sigsetjmp.S [moved from lib/nbsd_libc/compat/arch/m68k/gen/compat_sigsetjmp.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/m68k/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat___sigtramp1.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat___sigtramp1.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat_sigaction.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat_sigaction.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat_sigpending.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat_sigpending.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat_sigprocmask.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat_sigprocmask.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat_sigreturn.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat_sigreturn.S with 100% similarity]
lib/libc/compat/arch/m68k/sys/compat_sigsuspend.S [moved from lib/nbsd_libc/compat/arch/m68k/sys/compat_sigsuspend.S with 100% similarity]
lib/libc/compat/arch/mips/Makefile.inc [moved from lib/nbsd_libc/compat/arch/mips/Makefile.inc with 100% similarity]
lib/libc/compat/arch/mips/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/mips/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/mips/gen/compat_setjmp.S [moved from lib/nbsd_libc/compat/arch/mips/gen/compat_setjmp.S with 100% similarity]
lib/libc/compat/arch/mips/gen/compat_sigsetjmp.S [moved from lib/nbsd_libc/compat/arch/mips/gen/compat_sigsetjmp.S with 100% similarity]
lib/libc/compat/arch/mips/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/mips/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/mips/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/mips/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/mips/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/mips/sys/compat___sigtramp1.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat___sigtramp1.S with 100% similarity]
lib/libc/compat/arch/mips/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/mips/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/mips/sys/compat_sigaction.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat_sigaction.S with 100% similarity]
lib/libc/compat/arch/mips/sys/compat_sigpending.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat_sigpending.S with 100% similarity]
lib/libc/compat/arch/mips/sys/compat_sigprocmask.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat_sigprocmask.S with 100% similarity]
lib/libc/compat/arch/mips/sys/compat_sigreturn.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat_sigreturn.S with 100% similarity]
lib/libc/compat/arch/mips/sys/compat_sigsuspend.S [moved from lib/nbsd_libc/compat/arch/mips/sys/compat_sigsuspend.S with 100% similarity]
lib/libc/compat/arch/powerpc/Makefile.inc [moved from lib/nbsd_libc/compat/arch/powerpc/Makefile.inc with 100% similarity]
lib/libc/compat/arch/powerpc/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/powerpc/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/powerpc/gen/compat_setjmp.S [moved from lib/nbsd_libc/compat/arch/powerpc/gen/compat_setjmp.S with 100% similarity]
lib/libc/compat/arch/powerpc/gen/compat_sigsetjmp.S [moved from lib/nbsd_libc/compat/arch/powerpc/gen/compat_sigsetjmp.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/powerpc/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat___sigtramp1.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat___sigtramp1.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat_sigaction13.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat_sigaction13.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat_sigpending13.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat_sigpending13.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat_sigprocmask13.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat_sigprocmask13.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat_sigreturn13.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat_sigreturn13.S with 100% similarity]
lib/libc/compat/arch/powerpc/sys/compat_sigsuspend13.S [moved from lib/nbsd_libc/compat/arch/powerpc/sys/compat_sigsuspend13.S with 100% similarity]
lib/libc/compat/arch/powerpc64/Makefile.inc [moved from lib/nbsd_libc/compat/arch/powerpc64/Makefile.inc with 100% similarity]
lib/libc/compat/arch/powerpc64/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/powerpc64/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/powerpc64/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/powerpc64/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/powerpc64/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/powerpc64/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/powerpc64/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/powerpc64/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/powerpc64/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/powerpc64/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/sh3/Makefile.inc [moved from lib/nbsd_libc/compat/arch/sh3/Makefile.inc with 100% similarity]
lib/libc/compat/arch/sh3/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/sh3/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/sh3/gen/compat_setjmp.S [moved from lib/nbsd_libc/compat/arch/sh3/gen/compat_setjmp.S with 100% similarity]
lib/libc/compat/arch/sh3/gen/compat_sigsetjmp.S [moved from lib/nbsd_libc/compat/arch/sh3/gen/compat_sigsetjmp.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/sh3/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat___sigtramp1.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat___sigtramp1.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat_sigaction.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat_sigaction.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat_sigpending.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat_sigpending.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat_sigprocmask.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat_sigprocmask.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat_sigreturn.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat_sigreturn.S with 100% similarity]
lib/libc/compat/arch/sh3/sys/compat_sigsuspend.S [moved from lib/nbsd_libc/compat/arch/sh3/sys/compat_sigsuspend.S with 100% similarity]
lib/libc/compat/arch/sparc/Makefile.inc [moved from lib/nbsd_libc/compat/arch/sparc/Makefile.inc with 100% similarity]
lib/libc/compat/arch/sparc/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/sparc/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/sparc/gen/compat_setjmp.S [moved from lib/nbsd_libc/compat/arch/sparc/gen/compat_setjmp.S with 100% similarity]
lib/libc/compat/arch/sparc/gen/compat_sigsetjmp.S [moved from lib/nbsd_libc/compat/arch/sparc/gen/compat_sigsetjmp.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/sparc/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat___sigtramp1.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat___sigtramp1.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat_sigaction.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat_sigaction.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat_sigpending.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat_sigpending.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat_sigprocmask.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat_sigprocmask.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat_sigreturn.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat_sigreturn.S with 100% similarity]
lib/libc/compat/arch/sparc/sys/compat_sigsuspend.S [moved from lib/nbsd_libc/compat/arch/sparc/sys/compat_sigsuspend.S with 100% similarity]
lib/libc/compat/arch/sparc64/Makefile.inc [moved from lib/nbsd_libc/compat/arch/sparc64/Makefile.inc with 100% similarity]
lib/libc/compat/arch/sparc64/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/sparc64/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/sparc64/gen/compat_setjmp.S [moved from lib/nbsd_libc/compat/arch/sparc64/gen/compat_setjmp.S with 100% similarity]
lib/libc/compat/arch/sparc64/gen/compat_sigsetjmp.S [moved from lib/nbsd_libc/compat/arch/sparc64/gen/compat_sigsetjmp.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/sparc64/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat___sigtramp1.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat___sigtramp1.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat_sigaction.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat_sigaction.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat_sigpending.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat_sigpending.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat_sigprocmask.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat_sigprocmask.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat_sigreturn.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat_sigreturn.S with 100% similarity]
lib/libc/compat/arch/sparc64/sys/compat_sigsuspend.S [moved from lib/nbsd_libc/compat/arch/sparc64/sys/compat_sigsuspend.S with 100% similarity]
lib/libc/compat/arch/vax/Makefile.inc [moved from lib/nbsd_libc/compat/arch/vax/Makefile.inc with 100% similarity]
lib/libc/compat/arch/vax/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/vax/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/vax/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/vax/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/vax/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/vax/sys/compat___sigtramp2.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat___sigtramp2.S with 100% similarity]
lib/libc/compat/arch/vax/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/vax/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/vax/sys/compat_sigaction13.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat_sigaction13.S with 100% similarity]
lib/libc/compat/arch/vax/sys/compat_sigpending13.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat_sigpending13.S with 100% similarity]
lib/libc/compat/arch/vax/sys/compat_sigprocmask13.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat_sigprocmask13.S with 100% similarity]
lib/libc/compat/arch/vax/sys/compat_sigreturn13.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat_sigreturn13.S with 100% similarity]
lib/libc/compat/arch/vax/sys/compat_sigsuspend13.S [moved from lib/nbsd_libc/compat/arch/vax/sys/compat_sigsuspend13.S with 100% similarity]
lib/libc/compat/arch/x86_64/Makefile.inc [moved from lib/nbsd_libc/compat/arch/x86_64/Makefile.inc with 100% similarity]
lib/libc/compat/arch/x86_64/gen/Makefile.inc [moved from lib/nbsd_libc/compat/arch/x86_64/gen/Makefile.inc with 100% similarity]
lib/libc/compat/arch/x86_64/sys/Makefile.inc [moved from lib/nbsd_libc/compat/arch/x86_64/sys/Makefile.inc with 100% similarity]
lib/libc/compat/arch/x86_64/sys/compat_Ovfork.S [moved from lib/nbsd_libc/compat/arch/x86_64/sys/compat_Ovfork.S with 100% similarity]
lib/libc/compat/arch/x86_64/sys/compat___semctl.S [moved from lib/nbsd_libc/compat/arch/x86_64/sys/compat___semctl.S with 100% similarity]
lib/libc/compat/arch/x86_64/sys/compat___sigreturn14.S [moved from lib/nbsd_libc/compat/arch/x86_64/sys/compat___sigreturn14.S with 100% similarity]
lib/libc/compat/arch/x86_64/sys/compat_msgctl.S [moved from lib/nbsd_libc/compat/arch/x86_64/sys/compat_msgctl.S with 100% similarity]
lib/libc/compat/arch/x86_64/sys/compat_shmctl.S [moved from lib/nbsd_libc/compat/arch/x86_64/sys/compat_shmctl.S with 100% similarity]
lib/libc/compat/arch/x86_64/sys/compat_sigaction.S [moved from lib/nbsd_libc/compat/arch/x86_64/sys/compat_sigaction.S with 100% similarity]
lib/libc/compat/arch/x86_64/sys/compat_sigpending.S [moved from lib/nbsd_libc/compat/arch/x86_64/sys/compat_sigpending.S with 100% similarity]
lib/libc/compat/arch/x86_64/sys/compat_sigprocmask.S [moved from lib/nbsd_libc/compat/arch/x86_64/sys/compat_sigprocmask.S with 100% similarity]
lib/libc/compat/arch/x86_64/sys/compat_sigreturn.S [moved from lib/nbsd_libc/compat/arch/x86_64/sys/compat_sigreturn.S with 100% similarity]
lib/libc/compat/arch/x86_64/sys/compat_sigsuspend.S [moved from lib/nbsd_libc/compat/arch/x86_64/sys/compat_sigsuspend.S with 100% similarity]
lib/libc/compat/db/Makefile.inc [moved from lib/nbsd_libc/compat/db/Makefile.inc with 100% similarity]
lib/libc/compat/db/hash/Makefile.inc [moved from lib/nbsd_libc/compat/db/hash/Makefile.inc with 100% similarity]
lib/libc/compat/db/hash/compat_ndbmdatum.c [moved from lib/nbsd_libc/compat/db/hash/compat_ndbmdatum.c with 100% similarity]
lib/libc/compat/gen/Makefile.inc [moved from lib/nbsd_libc/compat/gen/Makefile.inc with 100% similarity]
lib/libc/compat/gen/compat___fts13.c [moved from lib/nbsd_libc/compat/gen/compat___fts13.c with 100% similarity]
lib/libc/compat/gen/compat___fts30.c [moved from lib/nbsd_libc/compat/gen/compat___fts30.c with 100% similarity]
lib/libc/compat/gen/compat___fts31.c [moved from lib/nbsd_libc/compat/gen/compat___fts31.c with 100% similarity]
lib/libc/compat/gen/compat___fts32.c [moved from lib/nbsd_libc/compat/gen/compat___fts32.c with 100% similarity]
lib/libc/compat/gen/compat___fts50.c [moved from lib/nbsd_libc/compat/gen/compat___fts50.c with 100% similarity]
lib/libc/compat/gen/compat___glob13.c [moved from lib/nbsd_libc/compat/gen/compat___glob13.c with 100% similarity]
lib/libc/compat/gen/compat__readdir_unlocked30.c [moved from lib/nbsd_libc/compat/gen/compat__readdir_unlocked30.c with 100% similarity]
lib/libc/compat/gen/compat__sys_errlist.c [moved from lib/nbsd_libc/compat/gen/compat__sys_errlist.c with 100% similarity]
lib/libc/compat/gen/compat__sys_nerr.c [moved from lib/nbsd_libc/compat/gen/compat__sys_nerr.c with 100% similarity]
lib/libc/compat/gen/compat__sys_siglist.c [moved from lib/nbsd_libc/compat/gen/compat__sys_siglist.c with 100% similarity]
lib/libc/compat/gen/compat_alphasort.c [moved from lib/nbsd_libc/compat/gen/compat_alphasort.c with 100% similarity]
lib/libc/compat/gen/compat_devname.c [moved from lib/nbsd_libc/compat/gen/compat_devname.c with 100% similarity]
lib/libc/compat/gen/compat_errlist.c [moved from lib/nbsd_libc/compat/gen/compat_errlist.c with 100% similarity]
lib/libc/compat/gen/compat_frexp_ieee754.c [moved from lib/nbsd_libc/compat/gen/compat_frexp_ieee754.c with 100% similarity]
lib/libc/compat/gen/compat_fts.c [moved from lib/nbsd_libc/compat/gen/compat_fts.c with 100% similarity]
lib/libc/compat/gen/compat_getmntinfo.c [moved from lib/nbsd_libc/compat/gen/compat_getmntinfo.c with 100% similarity]
lib/libc/compat/gen/compat_getpwent.c [moved from lib/nbsd_libc/compat/gen/compat_getpwent.c with 100% similarity]
lib/libc/compat/gen/compat_glob.c [moved from lib/nbsd_libc/compat/gen/compat_glob.c with 100% similarity]
lib/libc/compat/gen/compat_lastlogx.c [moved from lib/nbsd_libc/compat/gen/compat_lastlogx.c with 100% similarity]
lib/libc/compat/gen/compat_ldexp_ieee754.c [moved from lib/nbsd_libc/compat/gen/compat_ldexp_ieee754.c with 100% similarity]
lib/libc/compat/gen/compat_modf_ieee754.c [moved from lib/nbsd_libc/compat/gen/compat_modf_ieee754.c with 100% similarity]
lib/libc/compat/gen/compat_opendir.c [moved from lib/nbsd_libc/compat/gen/compat_opendir.c with 100% similarity]
lib/libc/compat/gen/compat_readdir.c [moved from lib/nbsd_libc/compat/gen/compat_readdir.c with 100% similarity]
lib/libc/compat/gen/compat_scandir.c [moved from lib/nbsd_libc/compat/gen/compat_scandir.c with 100% similarity]
lib/libc/compat/gen/compat_siglist.c [moved from lib/nbsd_libc/compat/gen/compat_siglist.c with 100% similarity]
lib/libc/compat/gen/compat_signame.c [moved from lib/nbsd_libc/compat/gen/compat_signame.c with 100% similarity]
lib/libc/compat/gen/compat_sigsetops.c [moved from lib/nbsd_libc/compat/gen/compat_sigsetops.c with 100% similarity]
lib/libc/compat/gen/compat_time.c [moved from lib/nbsd_libc/compat/gen/compat_time.c with 100% similarity]
lib/libc/compat/gen/compat_times.c [moved from lib/nbsd_libc/compat/gen/compat_times.c with 100% similarity]
lib/libc/compat/gen/compat_timezone.c [moved from lib/nbsd_libc/compat/gen/compat_timezone.c with 100% similarity]
lib/libc/compat/gen/compat_unvis.c [moved from lib/nbsd_libc/compat/gen/compat_unvis.c with 100% similarity]
lib/libc/compat/gen/compat_utime.c [moved from lib/nbsd_libc/compat/gen/compat_utime.c with 100% similarity]
lib/libc/compat/gen/compat_utmp.c [moved from lib/nbsd_libc/compat/gen/compat_utmp.c with 100% similarity]
lib/libc/compat/gen/compat_utmpx.c [moved from lib/nbsd_libc/compat/gen/compat_utmpx.c with 100% similarity]
lib/libc/compat/include/aio.h [moved from lib/nbsd_libc/compat/include/aio.h with 100% similarity]
lib/libc/compat/include/dirent.h [moved from lib/nbsd_libc/compat/include/dirent.h with 100% similarity]
lib/libc/compat/include/fstypes.h [moved from lib/nbsd_libc/compat/include/fstypes.h with 100% similarity]
lib/libc/compat/include/fts.h [moved from lib/nbsd_libc/compat/include/fts.h with 100% similarity]
lib/libc/compat/include/glob.h [moved from lib/nbsd_libc/compat/include/glob.h with 100% similarity]
lib/libc/compat/include/locale.h [moved from lib/nbsd_libc/compat/include/locale.h with 100% similarity]
lib/libc/compat/include/lwp.h [moved from lib/nbsd_libc/compat/include/lwp.h with 100% similarity]
lib/libc/compat/include/mqueue.h [moved from lib/nbsd_libc/compat/include/mqueue.h with 100% similarity]
lib/libc/compat/include/ndbm.h [moved from lib/nbsd_libc/compat/include/ndbm.h with 100% similarity]
lib/libc/compat/include/ns.h [moved from lib/nbsd_libc/compat/include/ns.h with 100% similarity]
lib/libc/compat/include/pwd.h [moved from lib/nbsd_libc/compat/include/pwd.h with 100% similarity]
lib/libc/compat/include/rpc/pmap_clnt.h [moved from lib/nbsd_libc/compat/include/rpc/pmap_clnt.h with 100% similarity]
lib/libc/compat/include/rpc/rpcb_clnt.h [moved from lib/nbsd_libc/compat/include/rpc/rpcb_clnt.h with 100% similarity]
lib/libc/compat/include/setjmp.h [moved from lib/nbsd_libc/compat/include/setjmp.h with 100% similarity]
lib/libc/compat/include/signal.h [moved from lib/nbsd_libc/compat/include/signal.h with 100% similarity]
lib/libc/compat/include/stdlib.h [moved from lib/nbsd_libc/compat/include/stdlib.h with 100% similarity]
lib/libc/compat/include/time.h [moved from lib/nbsd_libc/compat/include/time.h with 100% similarity]
lib/libc/compat/include/unistd.h [moved from lib/nbsd_libc/compat/include/unistd.h with 100% similarity]
lib/libc/compat/include/utime.h [moved from lib/nbsd_libc/compat/include/utime.h with 100% similarity]
lib/libc/compat/include/utmp.h [moved from lib/nbsd_libc/compat/include/utmp.h with 100% similarity]
lib/libc/compat/include/utmpx.h [moved from lib/nbsd_libc/compat/include/utmpx.h with 100% similarity]
lib/libc/compat/include/vis.h [moved from lib/nbsd_libc/compat/include/vis.h with 100% similarity]
lib/libc/compat/locale/Makefile.inc [moved from lib/nbsd_libc/compat/locale/Makefile.inc with 100% similarity]
lib/libc/compat/locale/compat_setlocale1.c [moved from lib/nbsd_libc/compat/locale/compat_setlocale1.c with 100% similarity]
lib/libc/compat/locale/compat_setlocale32.c [moved from lib/nbsd_libc/compat/locale/compat_setlocale32.c with 100% similarity]
lib/libc/compat/net/Makefile.inc [moved from lib/nbsd_libc/compat/net/Makefile.inc with 100% similarity]
lib/libc/compat/net/compat_ns_addr.c [moved from lib/nbsd_libc/compat/net/compat_ns_addr.c with 100% similarity]
lib/libc/compat/net/compat_ns_ntoa.c [moved from lib/nbsd_libc/compat/net/compat_ns_ntoa.c with 100% similarity]
lib/libc/compat/rpc/Makefile.inc [moved from lib/nbsd_libc/compat/rpc/Makefile.inc with 100% similarity]
lib/libc/compat/rpc/compat_pmap_rmtcall.c [moved from lib/nbsd_libc/compat/rpc/compat_pmap_rmtcall.c with 100% similarity]
lib/libc/compat/rpc/compat_rpcb.c [moved from lib/nbsd_libc/compat/rpc/compat_rpcb.c with 100% similarity]
lib/libc/compat/shlib_version [moved from lib/nbsd_libc/compat/shlib_version with 100% similarity]
lib/libc/compat/stdlib/Makefile.inc [moved from lib/nbsd_libc/compat/stdlib/Makefile.inc with 100% similarity]
lib/libc/compat/stdlib/compat_unsetenv.c [moved from lib/nbsd_libc/compat/stdlib/compat_unsetenv.c with 100% similarity]
lib/libc/compat/sys/Lint_Ovfork.c [moved from lib/nbsd_libc/compat/sys/Lint_Ovfork.c with 100% similarity]
lib/libc/compat/sys/Makefile.inc [moved from lib/nbsd_libc/compat/sys/Makefile.inc with 100% similarity]
lib/libc/compat/sys/compat___fhstat30.c [moved from lib/nbsd_libc/compat/sys/compat___fhstat30.c with 100% similarity]
lib/libc/compat/sys/compat___msgctl13.c [moved from lib/nbsd_libc/compat/sys/compat___msgctl13.c with 100% similarity]
lib/libc/compat/sys/compat___ntp_gettime30.c [moved from lib/nbsd_libc/compat/sys/compat___ntp_gettime30.c with 100% similarity]
lib/libc/compat/sys/compat___semctl13.c [moved from lib/nbsd_libc/compat/sys/compat___semctl13.c with 100% similarity]
lib/libc/compat/sys/compat___shmctl13.c [moved from lib/nbsd_libc/compat/sys/compat___shmctl13.c with 100% similarity]
lib/libc/compat/sys/compat___stat13.c [moved from lib/nbsd_libc/compat/sys/compat___stat13.c with 100% similarity]
lib/libc/compat/sys/compat___stat30.c [moved from lib/nbsd_libc/compat/sys/compat___stat30.c with 100% similarity]
lib/libc/compat/sys/compat__lwp_park.c [moved from lib/nbsd_libc/compat/sys/compat__lwp_park.c with 100% similarity]
lib/libc/compat/sys/compat_adjtime.c [moved from lib/nbsd_libc/compat/sys/compat_adjtime.c with 100% similarity]
lib/libc/compat/sys/compat_aio_suspend.c [moved from lib/nbsd_libc/compat/sys/compat_aio_suspend.c with 100% similarity]
lib/libc/compat/sys/compat_clock.c [moved from lib/nbsd_libc/compat/sys/compat_clock.c with 100% similarity]
lib/libc/compat/sys/compat_fhopen.c [moved from lib/nbsd_libc/compat/sys/compat_fhopen.c with 100% similarity]
lib/libc/compat/sys/compat_fhstatvfs.c [moved from lib/nbsd_libc/compat/sys/compat_fhstatvfs.c with 100% similarity]
lib/libc/compat/sys/compat_fhstatvfs1.c [moved from lib/nbsd_libc/compat/sys/compat_fhstatvfs1.c with 100% similarity]
lib/libc/compat/sys/compat_getdents.c [moved from lib/nbsd_libc/compat/sys/compat_getdents.c with 100% similarity]
lib/libc/compat/sys/compat_getdirentries.c [moved from lib/nbsd_libc/compat/sys/compat_getdirentries.c with 100% similarity]
lib/libc/compat/sys/compat_getfh.c [moved from lib/nbsd_libc/compat/sys/compat_getfh.c with 100% similarity]
lib/libc/compat/sys/compat_getrusage.c [moved from lib/nbsd_libc/compat/sys/compat_getrusage.c with 100% similarity]
lib/libc/compat/sys/compat_gettimeofday.c [moved from lib/nbsd_libc/compat/sys/compat_gettimeofday.c with 100% similarity]
lib/libc/compat/sys/compat_itimer.c [moved from lib/nbsd_libc/compat/sys/compat_itimer.c with 100% similarity]
lib/libc/compat/sys/compat_kevent.c [moved from lib/nbsd_libc/compat/sys/compat_kevent.c with 100% similarity]
lib/libc/compat/sys/compat_lfs_segwait.c [moved from lib/nbsd_libc/compat/sys/compat_lfs_segwait.c with 100% similarity]
lib/libc/compat/sys/compat_mknod.c [moved from lib/nbsd_libc/compat/sys/compat_mknod.c with 100% similarity]
lib/libc/compat/sys/compat_mount.c [moved from lib/nbsd_libc/compat/sys/compat_mount.c with 100% similarity]
lib/libc/compat/sys/compat_mqueue.c [moved from lib/nbsd_libc/compat/sys/compat_mqueue.c with 100% similarity]
lib/libc/compat/sys/compat_msync.c [moved from lib/nbsd_libc/compat/sys/compat_msync.c with 100% similarity]
lib/libc/compat/sys/compat_nanosleep.c [moved from lib/nbsd_libc/compat/sys/compat_nanosleep.c with 100% similarity]
lib/libc/compat/sys/compat_ntp_gettime.c [moved from lib/nbsd_libc/compat/sys/compat_ntp_gettime.c with 100% similarity]
lib/libc/compat/sys/compat_sched.c [moved from lib/nbsd_libc/compat/sys/compat_sched.c with 100% similarity]
lib/libc/compat/sys/compat_select.c [moved from lib/nbsd_libc/compat/sys/compat_select.c with 100% similarity]
lib/libc/compat/sys/compat_semctl.c [moved from lib/nbsd_libc/compat/sys/compat_semctl.c with 100% similarity]
lib/libc/compat/sys/compat_settimeofday.c [moved from lib/nbsd_libc/compat/sys/compat_settimeofday.c with 100% similarity]
lib/libc/compat/sys/compat_sigaltstack.c [moved from lib/nbsd_libc/compat/sys/compat_sigaltstack.c with 100% similarity]
lib/libc/compat/sys/compat_sigtimedwait.c [moved from lib/nbsd_libc/compat/sys/compat_sigtimedwait.c with 100% similarity]
lib/libc/compat/sys/compat_socket.c [moved from lib/nbsd_libc/compat/sys/compat_socket.c with 100% similarity]
lib/libc/compat/sys/compat_stat.c [moved from lib/nbsd_libc/compat/sys/compat_stat.c with 100% similarity]
lib/libc/compat/sys/compat_statfs.c [moved from lib/nbsd_libc/compat/sys/compat_statfs.c with 100% similarity]
lib/libc/compat/sys/compat_timer.c [moved from lib/nbsd_libc/compat/sys/compat_timer.c with 100% similarity]
lib/libc/compat/sys/compat_utimes.c [moved from lib/nbsd_libc/compat/sys/compat_utimes.c with 100% similarity]
lib/libc/compat/sys/compat_wait4.c [moved from lib/nbsd_libc/compat/sys/compat_wait4.c with 100% similarity]
lib/libc/compat/sys/getdirentries.3 [moved from lib/nbsd_libc/compat/sys/getdirentries.3 with 100% similarity]
lib/libc/compat/time/Makefile.inc [moved from lib/nbsd_libc/compat/time/Makefile.inc with 100% similarity]
lib/libc/compat/time/compat_difftime.c [moved from lib/nbsd_libc/compat/time/compat_difftime.c with 100% similarity]
lib/libc/compat/time/compat_localtime.c [moved from lib/nbsd_libc/compat/time/compat_localtime.c with 100% similarity]
lib/libc/db/btree/bt_close.c
lib/libc/db/btree/bt_conv.c
lib/libc/db/btree/bt_debug.c
lib/libc/db/btree/bt_delete.c
lib/libc/db/btree/bt_get.c
lib/libc/db/btree/bt_open.c
lib/libc/db/btree/bt_overflow.c
lib/libc/db/btree/bt_page.c
lib/libc/db/btree/bt_put.c
lib/libc/db/btree/bt_search.c
lib/libc/db/btree/bt_seq.c
lib/libc/db/btree/bt_split.c
lib/libc/db/btree/bt_utils.c
lib/libc/db/db/db.c
lib/libc/db/hash/hash.c
lib/libc/db/hash/hash_bigkey.c
lib/libc/db/hash/hash_buf.c
lib/libc/db/hash/hash_func.c
lib/libc/db/hash/hash_log2.c
lib/libc/db/hash/hash_page.c
lib/libc/db/hash/ndbm.c
lib/libc/db/hash/ndbmdatum.c
lib/libc/db/man/dbopen.3
lib/libc/db/man/hash.3
lib/libc/db/man/mpool.3
lib/libc/db/mpool/mpool.c
lib/libc/db/recno/rec_close.c
lib/libc/db/recno/rec_delete.c
lib/libc/db/recno/rec_get.c
lib/libc/db/recno/rec_open.c
lib/libc/db/recno/rec_put.c
lib/libc/db/recno/rec_search.c
lib/libc/db/recno/rec_seq.c
lib/libc/db/recno/rec_utils.c
lib/libc/dlfcn/Makefile.inc [moved from lib/nbsd_libc/dlfcn/Makefile.inc with 100% similarity]
lib/libc/dlfcn/dlfcn_elf.c [moved from lib/nbsd_libc/dlfcn/dlfcn_elf.c with 100% similarity]
lib/libc/gdtoa/Makefile.inc [moved from lib/nbsd_libc/gdtoa/Makefile.inc with 100% similarity]
lib/libc/gdtoa/README [moved from lib/nbsd_libc/gdtoa/README with 100% similarity]
lib/libc/gdtoa/_strtof.c [moved from lib/nbsd_libc/gdtoa/_strtof.c with 100% similarity]
lib/libc/gdtoa/_strtold.c [moved from lib/nbsd_libc/gdtoa/_strtold.c with 100% similarity]
lib/libc/gdtoa/arithchk.c [moved from lib/nbsd_libc/gdtoa/arithchk.c with 100% similarity]
lib/libc/gdtoa/dmisc.c [moved from lib/nbsd_libc/gdtoa/dmisc.c with 100% similarity]
lib/libc/gdtoa/dtoa.c [moved from lib/nbsd_libc/gdtoa/dtoa.c with 100% similarity]
lib/libc/gdtoa/g_Qfmt.c [moved from lib/nbsd_libc/gdtoa/g_Qfmt.c with 100% similarity]
lib/libc/gdtoa/g__fmt.c [moved from lib/nbsd_libc/gdtoa/g__fmt.c with 100% similarity]
lib/libc/gdtoa/g_ddfmt.c [moved from lib/nbsd_libc/gdtoa/g_ddfmt.c with 100% similarity]
lib/libc/gdtoa/g_dfmt.c [moved from lib/nbsd_libc/gdtoa/g_dfmt.c with 100% similarity]
lib/libc/gdtoa/g_ffmt.c [moved from lib/nbsd_libc/gdtoa/g_ffmt.c with 100% similarity]
lib/libc/gdtoa/g_xLfmt.c [moved from lib/nbsd_libc/gdtoa/g_xLfmt.c with 100% similarity]
lib/libc/gdtoa/g_xfmt.c [moved from lib/nbsd_libc/gdtoa/g_xfmt.c with 100% similarity]
lib/libc/gdtoa/gdtoa.c [moved from lib/nbsd_libc/gdtoa/gdtoa.c with 100% similarity]
lib/libc/gdtoa/gdtoa.h [moved from lib/nbsd_libc/gdtoa/gdtoa.h with 100% similarity]
lib/libc/gdtoa/gdtoa_locks.c [moved from lib/nbsd_libc/gdtoa/gdtoa_locks.c with 100% similarity]
lib/libc/gdtoa/gdtoaimp.h [moved from lib/nbsd_libc/gdtoa/gdtoaimp.h with 100% similarity]
lib/libc/gdtoa/gethex.c [moved from lib/nbsd_libc/gdtoa/gethex.c with 100% similarity]
lib/libc/gdtoa/gmisc.c [moved from lib/nbsd_libc/gdtoa/gmisc.c with 100% similarity]
lib/libc/gdtoa/hd_init.c [moved from lib/nbsd_libc/gdtoa/hd_init.c with 100% similarity]
lib/libc/gdtoa/hdtoa.c [moved from lib/nbsd_libc/gdtoa/hdtoa.c with 100% similarity]
lib/libc/gdtoa/hexnan.c [moved from lib/nbsd_libc/gdtoa/hexnan.c with 100% similarity]
lib/libc/gdtoa/ldtoa.c [moved from lib/nbsd_libc/gdtoa/ldtoa.c with 100% similarity]
lib/libc/gdtoa/makefile [moved from lib/nbsd_libc/gdtoa/makefile with 100% similarity]
lib/libc/gdtoa/misc.c [moved from lib/nbsd_libc/gdtoa/misc.c with 100% similarity]
lib/libc/gdtoa/qnan.c [moved from lib/nbsd_libc/gdtoa/qnan.c with 100% similarity]
lib/libc/gdtoa/smisc.c [moved from lib/nbsd_libc/gdtoa/smisc.c with 100% similarity]
lib/libc/gdtoa/strtoIQ.c [moved from lib/nbsd_libc/gdtoa/strtoIQ.c with 100% similarity]
lib/libc/gdtoa/strtoId.c [moved from lib/nbsd_libc/gdtoa/strtoId.c with 100% similarity]
lib/libc/gdtoa/strtoIdd.c [moved from lib/nbsd_libc/gdtoa/strtoIdd.c with 100% similarity]
lib/libc/gdtoa/strtoIf.c [moved from lib/nbsd_libc/gdtoa/strtoIf.c with 100% similarity]
lib/libc/gdtoa/strtoIg.c [moved from lib/nbsd_libc/gdtoa/strtoIg.c with 100% similarity]
lib/libc/gdtoa/strtoIx.c [moved from lib/nbsd_libc/gdtoa/strtoIx.c with 100% similarity]
lib/libc/gdtoa/strtoIxL.c [moved from lib/nbsd_libc/gdtoa/strtoIxL.c with 100% similarity]
lib/libc/gdtoa/strtod.c [moved from lib/nbsd_libc/gdtoa/strtod.c with 100% similarity]
lib/libc/gdtoa/strtodI.c [moved from lib/nbsd_libc/gdtoa/strtodI.c with 100% similarity]
lib/libc/gdtoa/strtodg.c [moved from lib/nbsd_libc/gdtoa/strtodg.c with 100% similarity]
lib/libc/gdtoa/strtodnrp.c [moved from lib/nbsd_libc/gdtoa/strtodnrp.c with 100% similarity]
lib/libc/gdtoa/strtof.c [moved from lib/nbsd_libc/gdtoa/strtof.c with 100% similarity]
lib/libc/gdtoa/strtof_vaxf.c [moved from lib/nbsd_libc/gdtoa/strtof_vaxf.c with 100% similarity]
lib/libc/gdtoa/strtold_pQ.c [moved from lib/nbsd_libc/gdtoa/strtold_pQ.c with 100% similarity]
lib/libc/gdtoa/strtold_px.c [moved from lib/nbsd_libc/gdtoa/strtold_px.c with 100% similarity]
lib/libc/gdtoa/strtold_pxL.c [moved from lib/nbsd_libc/gdtoa/strtold_pxL.c with 100% similarity]
lib/libc/gdtoa/strtold_subr.c [moved from lib/nbsd_libc/gdtoa/strtold_subr.c with 100% similarity]
lib/libc/gdtoa/strtopQ.c [moved from lib/nbsd_libc/gdtoa/strtopQ.c with 100% similarity]
lib/libc/gdtoa/strtopd.c [moved from lib/nbsd_libc/gdtoa/strtopd.c with 100% similarity]
lib/libc/gdtoa/strtopdd.c [moved from lib/nbsd_libc/gdtoa/strtopdd.c with 100% similarity]
lib/libc/gdtoa/strtopf.c [moved from lib/nbsd_libc/gdtoa/strtopf.c with 100% similarity]
lib/libc/gdtoa/strtopx.c [moved from lib/nbsd_libc/gdtoa/strtopx.c with 100% similarity]
lib/libc/gdtoa/strtopxL.c [moved from lib/nbsd_libc/gdtoa/strtopxL.c with 100% similarity]
lib/libc/gdtoa/strtorQ.c [moved from lib/nbsd_libc/gdtoa/strtorQ.c with 100% similarity]
lib/libc/gdtoa/strtord.c [moved from lib/nbsd_libc/gdtoa/strtord.c with 100% similarity]
lib/libc/gdtoa/strtordd.c [moved from lib/nbsd_libc/gdtoa/strtordd.c with 100% similarity]
lib/libc/gdtoa/strtorf.c [moved from lib/nbsd_libc/gdtoa/strtorf.c with 100% similarity]
lib/libc/gdtoa/strtorx.c [moved from lib/nbsd_libc/gdtoa/strtorx.c with 100% similarity]
lib/libc/gdtoa/strtorxL.c [moved from lib/nbsd_libc/gdtoa/strtorxL.c with 100% similarity]
lib/libc/gdtoa/sum.c [moved from lib/nbsd_libc/gdtoa/sum.c with 100% similarity]
lib/libc/gdtoa/ulp.c [moved from lib/nbsd_libc/gdtoa/ulp.c with 100% similarity]
lib/libc/gdtoa/xsum0.out [moved from lib/nbsd_libc/gdtoa/xsum0.out with 100% similarity]
lib/libc/gen/Lint___setjmp14.c [moved from lib/nbsd_libc/gen/Lint___setjmp14.c with 100% similarity]
lib/libc/gen/Lint___sigsetjmp14.c [moved from lib/nbsd_libc/gen/Lint___sigsetjmp14.c with 100% similarity]
lib/libc/gen/Lint__setjmp.c [moved from lib/nbsd_libc/gen/Lint__setjmp.c with 100% similarity]
lib/libc/gen/Lint_alloca.c [moved from lib/nbsd_libc/gen/Lint_alloca.c with 100% similarity]
lib/libc/gen/Lint_bswap16.c [moved from lib/nbsd_libc/gen/Lint_bswap16.c with 100% similarity]
lib/libc/gen/Lint_bswap32.c [moved from lib/nbsd_libc/gen/Lint_bswap32.c with 100% similarity]
lib/libc/gen/Lint_bswap64.c [moved from lib/nbsd_libc/gen/Lint_bswap64.c with 100% similarity]
lib/libc/gen/Lint_fabs.c [moved from lib/nbsd_libc/gen/Lint_fabs.c with 100% similarity]
lib/libc/gen/Lint_flt_rounds.c [moved from lib/nbsd_libc/gen/Lint_flt_rounds.c with 100% similarity]
lib/libc/gen/Lint_fpgetmask.c [moved from lib/nbsd_libc/gen/Lint_fpgetmask.c with 100% similarity]
lib/libc/gen/Lint_fpgetround.c [moved from lib/nbsd_libc/gen/Lint_fpgetround.c with 100% similarity]
lib/libc/gen/Lint_fpgetsticky.c [moved from lib/nbsd_libc/gen/Lint_fpgetsticky.c with 100% similarity]
lib/libc/gen/Lint_fpsetmask.c [moved from lib/nbsd_libc/gen/Lint_fpsetmask.c with 100% similarity]
lib/libc/gen/Lint_fpsetround.c [moved from lib/nbsd_libc/gen/Lint_fpsetround.c with 100% similarity]
lib/libc/gen/Lint_fpsetsticky.c [moved from lib/nbsd_libc/gen/Lint_fpsetsticky.c with 100% similarity]
lib/libc/gen/Lint_frexp.c [moved from lib/nbsd_libc/gen/Lint_frexp.c with 100% similarity]
lib/libc/gen/Lint_ldexp.c [moved from lib/nbsd_libc/gen/Lint_ldexp.c with 100% similarity]
lib/libc/gen/Lint_modf.c [moved from lib/nbsd_libc/gen/Lint_modf.c with 100% similarity]
lib/libc/gen/Lint_resumecontext.c [moved from lib/nbsd_libc/gen/Lint_resumecontext.c with 100% similarity]
lib/libc/gen/Lint_swapcontext.c [moved from lib/nbsd_libc/gen/Lint_swapcontext.c with 100% similarity]
lib/libc/gen/Makefile.inc [moved from lib/nbsd_libc/gen/Makefile.inc with 97% similarity]
lib/libc/gen/_err.c [moved from lib/nbsd_libc/gen/_err.c with 100% similarity]
lib/libc/gen/_errno.c [moved from lib/nbsd_libc/gen/_errno.c with 100% similarity]
lib/libc/gen/_errx.c [moved from lib/nbsd_libc/gen/_errx.c with 100% similarity]
lib/libc/gen/_lwp_makecontext.3 [moved from lib/nbsd_libc/gen/_lwp_makecontext.3 with 100% similarity]
lib/libc/gen/_sysconf.c [moved from lib/nbsd_libc/gen/_sysconf.c with 100% similarity]
lib/libc/gen/_verr.c [moved from lib/nbsd_libc/gen/_verr.c with 100% similarity]
lib/libc/gen/_verrx.c [moved from lib/nbsd_libc/gen/_verrx.c with 100% similarity]
lib/libc/gen/_vwarn.c [moved from lib/nbsd_libc/gen/_vwarn.c with 100% similarity]
lib/libc/gen/_vwarnx.c [moved from lib/nbsd_libc/gen/_vwarnx.c with 100% similarity]
lib/libc/gen/_warn.c [moved from lib/nbsd_libc/gen/_warn.c with 100% similarity]
lib/libc/gen/_warnx.c [moved from lib/nbsd_libc/gen/_warnx.c with 100% similarity]
lib/libc/gen/alarm.3 [moved from lib/nbsd_libc/gen/alarm.3 with 100% similarity]
lib/libc/gen/alarm.c [moved from lib/nbsd_libc/gen/alarm.c with 100% similarity]
lib/libc/gen/alphasort.c [moved from lib/nbsd_libc/gen/alphasort.c with 100% similarity]
lib/libc/gen/arc4random.3 [moved from lib/nbsd_libc/gen/arc4random.3 with 100% similarity]
lib/libc/gen/arc4random.c [moved from lib/nbsd_libc/gen/arc4random.c with 100% similarity]
lib/libc/gen/assert.c [moved from lib/nbsd_libc/gen/assert.c with 100% similarity]
lib/libc/gen/basename.3 [moved from lib/nbsd_libc/gen/basename.3 with 100% similarity]
lib/libc/gen/basename.c [moved from lib/nbsd_libc/gen/basename.c with 100% similarity]
lib/libc/gen/bswap.3 [moved from lib/nbsd_libc/gen/bswap.3 with 100% similarity]
lib/libc/gen/cgetcap.3 [moved from lib/nbsd_libc/gen/cgetcap.3 with 100% similarity]
lib/libc/gen/clock.3 [moved from lib/nbsd_libc/gen/clock.3 with 100% similarity]
lib/libc/gen/clock.c [moved from lib/nbsd_libc/gen/clock.c with 100% similarity]
lib/libc/gen/closedir.c [moved from lib/nbsd_libc/gen/closedir.c with 100% similarity]
lib/libc/gen/closefrom.3 [moved from lib/nbsd_libc/gen/closefrom.3 with 100% similarity]
lib/libc/gen/closefrom.c [moved from lib/nbsd_libc/gen/closefrom.c with 100% similarity]
lib/libc/gen/confstr.3 [moved from lib/nbsd_libc/gen/confstr.3 with 100% similarity]
lib/libc/gen/confstr.c [moved from lib/nbsd_libc/gen/confstr.c with 100% similarity]
lib/libc/gen/cpuset.3 [moved from lib/nbsd_libc/gen/cpuset.3 with 100% similarity]
lib/libc/gen/ctermid.3 [moved from lib/nbsd_libc/gen/ctermid.3 with 100% similarity]
lib/libc/gen/ctermid.c [moved from lib/nbsd_libc/gen/ctermid.c with 100% similarity]
lib/libc/gen/ctype.3 [moved from lib/nbsd_libc/gen/ctype.3 with 100% similarity]
lib/libc/gen/ctype_.c [moved from lib/nbsd_libc/gen/ctype_.c with 100% similarity]
lib/libc/gen/daemon.3 [moved from lib/nbsd_libc/gen/daemon.3 with 100% similarity]
lib/libc/gen/daemon.c [moved from lib/nbsd_libc/gen/daemon.c with 100% similarity]
lib/libc/gen/dehumanize_number.c [moved from lib/nbsd_libc/gen/dehumanize_number.c with 100% similarity]
lib/libc/gen/devname.3 [moved from lib/nbsd_libc/gen/devname.3 with 100% similarity]
lib/libc/gen/devname.c [moved from lib/nbsd_libc/gen/devname.c with 100% similarity]
lib/libc/gen/directory.3 [moved from lib/nbsd_libc/gen/directory.3 with 100% similarity]
lib/libc/gen/dirent_private.h [moved from lib/nbsd_libc/gen/dirent_private.h with 100% similarity]
lib/libc/gen/dirname.3 [moved from lib/nbsd_libc/gen/dirname.3 with 100% similarity]
lib/libc/gen/dirname.c [moved from lib/nbsd_libc/gen/dirname.c with 100% similarity]
lib/libc/gen/disklabel.c [moved from lib/nbsd_libc/gen/disklabel.c with 100% similarity]
lib/libc/gen/endutxent.3 [moved from lib/nbsd_libc/gen/endutxent.3 with 100% similarity]
lib/libc/gen/err.3 [moved from lib/nbsd_libc/gen/err.3 with 100% similarity]
lib/libc/gen/err.c [moved from lib/libc/other/err.c with 100% similarity]
lib/libc/gen/errlist.awk [moved from lib/nbsd_libc/gen/errlist.awk with 100% similarity]
lib/libc/gen/errno.c [moved from lib/nbsd_libc/gen/errno.c with 100% similarity]
lib/libc/gen/errx.c [moved from lib/libc/other/errx.c with 100% similarity]
lib/libc/gen/exec.3 [moved from lib/nbsd_libc/gen/exec.3 with 100% similarity]
lib/libc/gen/execl.c [moved from lib/nbsd_libc/gen/execl.c with 100% similarity]
lib/libc/gen/execle.c [moved from lib/nbsd_libc/gen/execle.c with 100% similarity]
lib/libc/gen/execlp.c [moved from lib/nbsd_libc/gen/execlp.c with 100% similarity]
lib/libc/gen/execv.c [moved from lib/nbsd_libc/gen/execv.c with 100% similarity]
lib/libc/gen/execvp.c [moved from lib/nbsd_libc/gen/execvp.c with 100% similarity]
lib/libc/gen/extattr.3 [moved from lib/nbsd_libc/gen/extattr.3 with 100% similarity]
lib/libc/gen/extattr.c [moved from lib/nbsd_libc/gen/extattr.c with 100% similarity]
lib/libc/gen/fabs_ieee754.c [moved from lib/nbsd_libc/gen/fabs_ieee754.c with 100% similarity]
lib/libc/gen/fmtcheck.3 [moved from lib/nbsd_libc/gen/fmtcheck.3 with 100% similarity]
lib/libc/gen/fmtcheck.c [moved from lib/nbsd_libc/gen/fmtcheck.c with 100% similarity]
lib/libc/gen/fmtmsg.3 [moved from lib/nbsd_libc/gen/fmtmsg.3 with 100% similarity]
lib/libc/gen/fmtmsg.c [moved from lib/nbsd_libc/gen/fmtmsg.c with 100% similarity]
lib/libc/gen/fnmatch.3 [moved from lib/nbsd_libc/gen/fnmatch.3 with 100% similarity]
lib/libc/gen/fnmatch.c [moved from lib/nbsd_libc/gen/fnmatch.c with 100% similarity]
lib/libc/gen/fpclassify.3 [moved from lib/nbsd_libc/gen/fpclassify.3 with 100% similarity]
lib/libc/gen/fpclassifyd_ieee754.c [moved from lib/nbsd_libc/gen/fpclassifyd_ieee754.c with 100% similarity]
lib/libc/gen/fpclassifyf_ieee754.c [moved from lib/nbsd_libc/gen/fpclassifyf_ieee754.c with 100% similarity]
lib/libc/gen/fpclassifyl_ieee754.c [moved from lib/nbsd_libc/gen/fpclassifyl_ieee754.c with 100% similarity]
lib/libc/gen/fpgetmask.3 [moved from lib/nbsd_libc/gen/fpgetmask.3 with 100% similarity]
lib/libc/gen/fstab.c [moved from lib/nbsd_libc/gen/fstab.c with 100% similarity]
lib/libc/gen/ftok.3 [moved from lib/nbsd_libc/gen/ftok.3 with 100% similarity]
lib/libc/gen/ftok.c [moved from lib/nbsd_libc/gen/ftok.c with 100% similarity]
lib/libc/gen/fts.3 [moved from lib/nbsd_libc/gen/fts.3 with 100% similarity]
lib/libc/gen/fts.c [moved from lib/nbsd_libc/gen/fts.c with 100% similarity]
lib/libc/gen/ftw.3 [moved from lib/nbsd_libc/gen/ftw.3 with 100% similarity]
lib/libc/gen/ftw.c [moved from lib/nbsd_libc/gen/ftw.c with 100% similarity]
lib/libc/gen/getbsize.3 [moved from lib/nbsd_libc/gen/getbsize.3 with 100% similarity]
lib/libc/gen/getbsize.c [moved from lib/nbsd_libc/gen/getbsize.c with 100% similarity]
lib/libc/gen/getcap.c [moved from lib/nbsd_libc/gen/getcap.c with 100% similarity]
lib/libc/gen/getcwd.3 [moved from lib/nbsd_libc/gen/getcwd.3 with 100% similarity]
lib/libc/gen/getcwd.c [moved from lib/nbsd_libc/gen/getcwd.c with 100% similarity]
lib/libc/gen/getdevmajor.3 [moved from lib/nbsd_libc/gen/getdevmajor.3 with 100% similarity]
lib/libc/gen/getdevmajor.c [moved from lib/nbsd_libc/gen/getdevmajor.c with 100% similarity]
lib/libc/gen/getdiskbyname.3 [moved from lib/nbsd_libc/gen/getdiskbyname.3 with 100% similarity]
lib/libc/gen/getdomainname.3 [moved from lib/nbsd_libc/gen/getdomainname.3 with 100% similarity]
lib/libc/gen/getdomainname.c [moved from lib/nbsd_libc/gen/getdomainname.c with 100% similarity]
lib/libc/gen/getfsent.3 [moved from lib/nbsd_libc/gen/getfsent.3 with 100% similarity]
lib/libc/gen/getgrent.3 [moved from lib/nbsd_libc/gen/getgrent.3 with 100% similarity]
lib/libc/gen/getgrent.c [moved from lib/nbsd_libc/gen/getgrent.c with 100% similarity]
lib/libc/gen/getgrouplist.3 [moved from lib/nbsd_libc/gen/getgrouplist.3 with 100% similarity]
lib/libc/gen/getgrouplist.c [moved from lib/nbsd_libc/gen/getgrouplist.c with 100% similarity]
lib/libc/gen/getgroupmembership.c [moved from lib/nbsd_libc/gen/getgroupmembership.c with 100% similarity]
lib/libc/gen/gethostname.3 [moved from lib/nbsd_libc/gen/gethostname.3 with 100% similarity]
lib/libc/gen/gethostname.c [moved from lib/nbsd_libc/gen/gethostname.c with 100% similarity]
lib/libc/gen/getlastlogx.3 [moved from lib/nbsd_libc/gen/getlastlogx.3 with 100% similarity]
lib/libc/gen/getloadavg.3 [moved from lib/nbsd_libc/gen/getloadavg.3 with 100% similarity]
lib/libc/gen/getloadavg.c [moved from lib/nbsd_libc/gen/getloadavg.c with 100% similarity]
lib/libc/gen/getlogin.c [moved from lib/nbsd_libc/gen/getlogin.c with 100% similarity]
lib/libc/gen/getmntinfo.3 [moved from lib/nbsd_libc/gen/getmntinfo.3 with 100% similarity]
lib/libc/gen/getmntinfo.c [moved from lib/nbsd_libc/gen/getmntinfo.c with 100% similarity]
lib/libc/gen/getnetgrent.3 [moved from lib/nbsd_libc/gen/getnetgrent.3 with 100% similarity]
lib/libc/gen/getnetgrent.c [moved from lib/nbsd_libc/gen/getnetgrent.c with 100% similarity]
lib/libc/gen/getpagesize.3 [moved from lib/nbsd_libc/gen/getpagesize.3 with 100% similarity]
lib/libc/gen/getpagesize.c [moved from lib/nbsd_libc/gen/getpagesize.c with 100% similarity]
lib/libc/gen/getpass.3 [moved from lib/nbsd_libc/gen/getpass.3 with 100% similarity]
lib/libc/gen/getpass.c [moved from lib/nbsd_libc/gen/getpass.c with 100% similarity]
lib/libc/gen/getprogname.3 [moved from lib/nbsd_libc/gen/getprogname.3 with 100% similarity]
lib/libc/gen/getprogname.c [moved from lib/nbsd_libc/gen/getprogname.c with 100% similarity]
lib/libc/gen/getpwent.3 [moved from lib/nbsd_libc/gen/getpwent.3 with 100% similarity]
lib/libc/gen/getpwent.c [moved from lib/nbsd_libc/gen/getpwent.c with 100% similarity]
lib/libc/gen/getttyent.3 [moved from lib/nbsd_libc/gen/getttyent.3 with 100% similarity]
lib/libc/gen/getttyent.c [moved from lib/nbsd_libc/gen/getttyent.c with 100% similarity]
lib/libc/gen/getusershell.3 [moved from lib/nbsd_libc/gen/getusershell.3 with 100% similarity]
lib/libc/gen/getusershell.c [moved from lib/nbsd_libc/gen/getusershell.c with 100% similarity]
lib/libc/gen/glob.3 [moved from lib/nbsd_libc/gen/glob.3 with 100% similarity]
lib/libc/gen/glob.c [moved from lib/nbsd_libc/gen/glob.c with 100% similarity]
lib/libc/gen/gr_private.h [moved from lib/nbsd_libc/gen/gr_private.h with 100% similarity]
lib/libc/gen/humanize_number.3 [moved from lib/nbsd_libc/gen/humanize_number.3 with 100% similarity]
lib/libc/gen/humanize_number.c [moved from lib/nbsd_libc/gen/humanize_number.c with 100% similarity]
lib/libc/gen/infinity_ieee754.c [moved from lib/nbsd_libc/gen/infinity_ieee754.c with 100% similarity]
lib/libc/gen/infinityf_ieee754.c [moved from lib/nbsd_libc/gen/infinityf_ieee754.c with 100% similarity]
lib/libc/gen/infinityl_dbl_ieee754.c [moved from lib/nbsd_libc/gen/infinityl_dbl_ieee754.c with 100% similarity]
lib/libc/gen/infinityl_ieee754.c [moved from lib/nbsd_libc/gen/infinityl_ieee754.c with 100% similarity]
lib/libc/gen/initdir.c [moved from lib/nbsd_libc/gen/initdir.c with 100% similarity]
lib/libc/gen/initgroups.3 [moved from lib/nbsd_libc/gen/initgroups.3 with 100% similarity]
lib/libc/gen/initgroups.c [moved from lib/nbsd_libc/gen/initgroups.c with 100% similarity]
lib/libc/gen/isalnum.3 [moved from lib/nbsd_libc/gen/isalnum.3 with 100% similarity]
lib/libc/gen/isalpha.3 [moved from lib/nbsd_libc/gen/isalpha.3 with 100% similarity]
lib/libc/gen/isascii.3 [moved from lib/nbsd_libc/gen/isascii.3 with 100% similarity]
lib/libc/gen/isascii.c [moved from lib/nbsd_libc/gen/isascii.c with 100% similarity]
lib/libc/gen/isatty.c [moved from lib/nbsd_libc/gen/isatty.c with 100% similarity]
lib/libc/gen/isblank.3 [moved from lib/nbsd_libc/gen/isblank.3 with 100% similarity]
lib/libc/gen/iscntrl.3 [moved from lib/nbsd_libc/gen/iscntrl.3 with 100% similarity]
lib/libc/gen/isctype.c [moved from lib/nbsd_libc/gen/isctype.c with 100% similarity]
lib/libc/gen/isdigit.3 [moved from lib/nbsd_libc/gen/isdigit.3 with 100% similarity]
lib/libc/gen/isfinite.3 [moved from lib/nbsd_libc/gen/isfinite.3 with 100% similarity]
lib/libc/gen/isfinited_ieee754.c [moved from lib/nbsd_libc/gen/isfinited_ieee754.c with 100% similarity]
lib/libc/gen/isfinitef_ieee754.c [moved from lib/nbsd_libc/gen/isfinitef_ieee754.c with 100% similarity]
lib/libc/gen/isfinitel_ieee754.c [moved from lib/nbsd_libc/gen/isfinitel_ieee754.c with 100% similarity]
lib/libc/gen/isgraph.3 [moved from lib/nbsd_libc/gen/isgraph.3 with 100% similarity]
lib/libc/gen/isgreater.3 [moved from lib/nbsd_libc/gen/isgreater.3 with 100% similarity]
lib/libc/gen/isinf.3 [moved from lib/nbsd_libc/gen/isinf.3 with 100% similarity]
lib/libc/gen/isinfd_ieee754.c [moved from lib/nbsd_libc/gen/isinfd_ieee754.c with 100% similarity]
lib/libc/gen/isinff_ieee754.c [moved from lib/nbsd_libc/gen/isinff_ieee754.c with 100% similarity]
lib/libc/gen/isinfl_ieee754.c [moved from lib/nbsd_libc/gen/isinfl_ieee754.c with 100% similarity]
lib/libc/gen/islower.3 [moved from lib/nbsd_libc/gen/islower.3 with 100% similarity]
lib/libc/gen/isnan.3 [moved from lib/nbsd_libc/gen/isnan.3 with 100% similarity]
lib/libc/gen/isnand_ieee754.c [moved from lib/nbsd_libc/gen/isnand_ieee754.c with 100% similarity]
lib/libc/gen/isnanf_ieee754.c [moved from lib/nbsd_libc/gen/isnanf_ieee754.c with 100% similarity]
lib/libc/gen/isnanl_ieee754.c [moved from lib/nbsd_libc/gen/isnanl_ieee754.c with 100% similarity]
lib/libc/gen/isnormal.3 [moved from lib/nbsd_libc/gen/isnormal.3 with 100% similarity]
lib/libc/gen/isprint.3 [moved from lib/nbsd_libc/gen/isprint.3 with 100% similarity]
lib/libc/gen/ispunct.3 [moved from lib/nbsd_libc/gen/ispunct.3 with 100% similarity]
lib/libc/gen/isspace.3 [moved from lib/nbsd_libc/gen/isspace.3 with 100% similarity]
lib/libc/gen/isupper.3 [moved from lib/nbsd_libc/gen/isupper.3 with 100% similarity]
lib/libc/gen/isxdigit.3 [moved from lib/nbsd_libc/gen/isxdigit.3 with 100% similarity]
lib/libc/gen/ldexp_ieee754.c [moved from lib/nbsd_libc/gen/ldexp_ieee754.c with 100% similarity]
lib/libc/gen/lockf.3 [moved from lib/nbsd_libc/gen/lockf.3 with 100% similarity]
lib/libc/gen/lockf.c [moved from lib/nbsd_libc/gen/lockf.c with 100% similarity]
lib/libc/gen/makecontext.3 [moved from lib/nbsd_libc/gen/makecontext.3 with 100% similarity]
lib/libc/gen/minix/clock.c [moved from lib/nbsd_libc/gen/minix/clock.c with 100% similarity]
lib/libc/gen/minix/getdomainname.c [moved from lib/nbsd_libc/gen/minix/getdomainname.c with 100% similarity]
lib/libc/gen/minix/gethostname.c [moved from lib/nbsd_libc/gen/minix/gethostname.c with 100% similarity]
lib/libc/gen/minix/getloadavg.c [moved from lib/nbsd_libc/gen/minix/getloadavg.c with 100% similarity]
lib/libc/gen/minix/getpagesize.c [moved from lib/nbsd_libc/gen/minix/getpagesize.c with 100% similarity]
lib/libc/gen/minix/getpass.c [moved from lib/nbsd_libc/gen/minix/getpass.c with 100% similarity]
lib/libc/gen/minix/getprogname.c [moved from lib/nbsd_libc/gen/minix/getprogname.c with 100% similarity]
lib/libc/gen/minix/popen.c [moved from lib/nbsd_libc/gen/minix/popen.c with 100% similarity]
lib/libc/gen/minix/raise.c [moved from lib/libc/ansi/raise.c with 100% similarity]
lib/libc/gen/minix/siglist.c [moved from lib/nbsd_libc/gen/minix/siglist.c with 100% similarity]
lib/libc/gen/minix/sysconf.c [moved from lib/nbsd_libc/gen/minix/sysconf.c with 100% similarity]
lib/libc/gen/minix/times.c [moved from lib/nbsd_libc/gen/minix/times.c with 100% similarity]
lib/libc/gen/minix/uname.c [moved from lib/nbsd_libc/gen/minix/uname.c with 100% similarity]
lib/libc/gen/minix/utime.c [moved from lib/nbsd_libc/gen/minix/utime.c with 100% similarity]
lib/libc/gen/minix/wait.c [moved from lib/nbsd_libc/gen/minix/wait.c with 100% similarity]
lib/libc/gen/minix/waitpid.c [moved from lib/nbsd_libc/gen/minix/waitpid.c with 100% similarity]
lib/libc/gen/modf_ieee754.c [moved from lib/nbsd_libc/gen/modf_ieee754.c with 100% similarity]
lib/libc/gen/nftw.c [moved from lib/nbsd_libc/gen/nftw.c with 100% similarity]
lib/libc/gen/nice.3 [moved from lib/nbsd_libc/gen/nice.3 with 100% similarity]
lib/libc/gen/nice.c [moved from lib/nbsd_libc/gen/nice.c with 100% similarity]
lib/libc/gen/nlist.3 [moved from lib/nbsd_libc/gen/nlist.3 with 100% similarity]
lib/libc/gen/nlist.c [moved from lib/nbsd_libc/gen/nlist.c with 100% similarity]
lib/libc/gen/nlist_aout.c [moved from lib/nbsd_libc/gen/nlist_aout.c with 100% similarity]
lib/libc/gen/nlist_coff.c [moved from lib/nbsd_libc/gen/nlist_coff.c with 100% similarity]
lib/libc/gen/nlist_ecoff.c [moved from lib/nbsd_libc/gen/nlist_ecoff.c with 100% similarity]
lib/libc/gen/nlist_elf32.c [moved from lib/nbsd_libc/gen/nlist_elf32.c with 100% similarity]
lib/libc/gen/nlist_elf64.c [moved from lib/nbsd_libc/gen/nlist_elf64.c with 100% similarity]
lib/libc/gen/nlist_private.h [moved from lib/nbsd_libc/gen/nlist_private.h with 100% similarity]
lib/libc/gen/opendir.c [moved from lib/nbsd_libc/gen/opendir.c with 100% similarity]
lib/libc/gen/pause.3 [moved from lib/nbsd_libc/gen/pause.3 with 100% similarity]
lib/libc/gen/pause.c [moved from lib/nbsd_libc/gen/pause.c with 100% similarity]
lib/libc/gen/popen.3 [moved from lib/nbsd_libc/gen/popen.3 with 100% similarity]
lib/libc/gen/popen.c [moved from lib/nbsd_libc/gen/popen.c with 100% similarity]
lib/libc/gen/psignal.3 [moved from lib/nbsd_libc/gen/psignal.3 with 100% similarity]
lib/libc/gen/psignal.c [moved from lib/nbsd_libc/gen/psignal.c with 100% similarity]
lib/libc/gen/pthread_atfork.3 [moved from lib/nbsd_libc/gen/pthread_atfork.3 with 100% similarity]
lib/libc/gen/pthread_atfork.c [moved from lib/nbsd_libc/gen/pthread_atfork.c with 100% similarity]
lib/libc/gen/pw_private.h [moved from lib/nbsd_libc/gen/pw_private.h with 100% similarity]
lib/libc/gen/pw_scan.c [moved from lib/nbsd_libc/gen/pw_scan.c with 100% similarity]
lib/libc/gen/pwcache.3 [moved from lib/nbsd_libc/gen/pwcache.3 with 100% similarity]
lib/libc/gen/pwcache.c [moved from lib/nbsd_libc/gen/pwcache.c with 100% similarity]
lib/libc/gen/pwcache.h [moved from lib/libc/other/pwcache.h with 100% similarity]
lib/libc/gen/raise.3 [moved from lib/nbsd_libc/gen/raise.3 with 100% similarity]
lib/libc/gen/raise.c [moved from lib/nbsd_libc/gen/raise.c with 100% similarity]
lib/libc/gen/randomid.3 [moved from lib/nbsd_libc/gen/randomid.3 with 100% similarity]
lib/libc/gen/randomid.c [moved from lib/nbsd_libc/gen/randomid.c with 100% similarity]
lib/libc/gen/readdir.c [moved from lib/nbsd_libc/gen/readdir.c with 100% similarity]
lib/libc/gen/realpath.3 [moved from lib/nbsd_libc/gen/realpath.3 with 100% similarity]
lib/libc/gen/rewinddir.c [moved from lib/nbsd_libc/gen/rewinddir.c with 100% similarity]
lib/libc/gen/scandir.3 [moved from lib/nbsd_libc/gen/scandir.3 with 100% similarity]
lib/libc/gen/scandir.c [moved from lib/nbsd_libc/gen/scandir.c with 100% similarity]
lib/libc/gen/seekdir.c [moved from lib/nbsd_libc/gen/seekdir.c with 100% similarity]
lib/libc/gen/setdomainname.c [moved from lib/nbsd_libc/gen/setdomainname.c with 100% similarity]
lib/libc/gen/sethostname.c [moved from lib/nbsd_libc/gen/sethostname.c with 100% similarity]
lib/libc/gen/setjmp.3 [moved from lib/nbsd_libc/gen/setjmp.3 with 100% similarity]
lib/libc/gen/setjmperr.c [moved from lib/nbsd_libc/gen/setjmperr.c with 100% similarity]
lib/libc/gen/setmode.3 [moved from lib/nbsd_libc/gen/setmode.3 with 100% similarity]
lib/libc/gen/setmode.c [moved from lib/nbsd_libc/gen/setmode.c with 100% similarity]
lib/libc/gen/setproctitle.3 [moved from lib/nbsd_libc/gen/setproctitle.3 with 100% similarity]
lib/libc/gen/setproctitle.c [moved from lib/nbsd_libc/gen/setproctitle.c with 100% similarity]
lib/libc/gen/setprogname.c [moved from lib/nbsd_libc/gen/setprogname.c with 100% similarity]
lib/libc/gen/shquote.3 [moved from lib/nbsd_libc/gen/shquote.3 with 100% similarity]
lib/libc/gen/shquote.c [moved from lib/nbsd_libc/gen/shquote.c with 100% similarity]
lib/libc/gen/shquotev.c [moved from lib/nbsd_libc/gen/shquotev.c with 100% similarity]
lib/libc/gen/sighold.3 [moved from lib/nbsd_libc/gen/sighold.3 with 100% similarity]
lib/libc/gen/sighold.c [moved from lib/nbsd_libc/gen/sighold.c with 100% similarity]
lib/libc/gen/sigignore.3 [moved from lib/nbsd_libc/gen/sigignore.3 with 100% similarity]
lib/libc/gen/sigignore.c [moved from lib/nbsd_libc/gen/sigignore.c with 100% similarity]
lib/libc/gen/siginterrupt.3 [moved from lib/nbsd_libc/gen/siginterrupt.3 with 100% similarity]
lib/libc/gen/siginterrupt.c [moved from lib/nbsd_libc/gen/siginterrupt.c with 100% similarity]
lib/libc/gen/siglist.c [moved from lib/nbsd_libc/gen/siglist.c with 100% similarity]
lib/libc/gen/signal.3 [moved from lib/nbsd_libc/gen/signal.3 with 100% similarity]
lib/libc/gen/signal.c [moved from lib/nbsd_libc/gen/signal.c with 100% similarity]
lib/libc/gen/signame.c [moved from lib/nbsd_libc/gen/signame.c with 100% similarity]
lib/libc/gen/signbit.3 [moved from lib/nbsd_libc/gen/signbit.3 with 100% similarity]
lib/libc/gen/signbitd_ieee754.c [moved from lib/nbsd_libc/gen/signbitd_ieee754.c with 100% similarity]
lib/libc/gen/signbitf_ieee754.c [moved from lib/nbsd_libc/gen/signbitf_ieee754.c with 100% similarity]
lib/libc/gen/signbitl_ieee754.c [moved from lib/nbsd_libc/gen/signbitl_ieee754.c with 100% similarity]
lib/libc/gen/sigrelse.3 [moved from lib/nbsd_libc/gen/sigrelse.3 with 100% similarity]
lib/libc/gen/sigrelse.c [moved from lib/nbsd_libc/gen/sigrelse.c with 100% similarity]
lib/libc/gen/sigset.3 [moved from lib/nbsd_libc/gen/sigset.3 with 100% similarity]
lib/libc/gen/sigset.c [moved from lib/nbsd_libc/gen/sigset.c with 100% similarity]
lib/libc/gen/sigsetops.3 [moved from lib/nbsd_libc/gen/sigsetops.3 with 100% similarity]
lib/libc/gen/sigsetops.c [moved from lib/nbsd_libc/gen/sigsetops.c with 100% similarity]
lib/libc/gen/sleep.3 [moved from lib/nbsd_libc/gen/sleep.3 with 100% similarity]
lib/libc/gen/sleep.c [moved from lib/nbsd_libc/gen/sleep.c with 100% similarity]
lib/libc/gen/stringlist.3 [moved from lib/nbsd_libc/gen/stringlist.3 with 100% similarity]
lib/libc/gen/stringlist.c [moved from lib/nbsd_libc/gen/stringlist.c with 100% similarity]
lib/libc/gen/sysconf.3 [moved from lib/nbsd_libc/gen/sysconf.3 with 100% similarity]
lib/libc/gen/sysconf.c [moved from lib/nbsd_libc/gen/sysconf.c with 100% similarity]
lib/libc/gen/sysctl.3 [moved from lib/nbsd_libc/gen/sysctl.3 with 100% similarity]
lib/libc/gen/sysctl.c [moved from lib/nbsd_libc/gen/sysctl.c with 100% similarity]
lib/libc/gen/sysctlbyname.c [moved from lib/nbsd_libc/gen/sysctlbyname.c with 100% similarity]
lib/libc/gen/sysctlgetmibinfo.c [moved from lib/nbsd_libc/gen/sysctlgetmibinfo.c with 100% similarity]
lib/libc/gen/sysctlnametomib.c [moved from lib/nbsd_libc/gen/sysctlnametomib.c with 100% similarity]
lib/libc/gen/syslog.3 [moved from lib/nbsd_libc/gen/syslog.3 with 100% similarity]
lib/libc/gen/syslog.c [moved from lib/nbsd_libc/gen/syslog.c with 100% similarity]
lib/libc/gen/telldir.c [moved from lib/nbsd_libc/gen/telldir.c with 100% similarity]
lib/libc/gen/time.3 [moved from lib/nbsd_libc/gen/time.3 with 100% similarity]
lib/libc/gen/time.c [moved from lib/nbsd_libc/gen/time.c with 100% similarity]
lib/libc/gen/times.3 [moved from lib/nbsd_libc/gen/times.3 with 100% similarity]
lib/libc/gen/times.c [moved from lib/nbsd_libc/gen/times.c with 100% similarity]
lib/libc/gen/timezone.3 [moved from lib/nbsd_libc/gen/timezone.3 with 100% similarity]
lib/libc/gen/toascii.3 [moved from lib/nbsd_libc/gen/toascii.3 with 100% similarity]
lib/libc/gen/toascii.c [moved from lib/nbsd_libc/gen/toascii.c with 100% similarity]
lib/libc/gen/tolower.3 [moved from lib/nbsd_libc/gen/tolower.3 with 100% similarity]
lib/libc/gen/tolower_.c [moved from lib/nbsd_libc/gen/tolower_.c with 100% similarity]
lib/libc/gen/toupper.3 [moved from lib/nbsd_libc/gen/toupper.3 with 100% similarity]
lib/libc/gen/toupper_.c [moved from lib/nbsd_libc/gen/toupper_.c with 100% similarity]
lib/libc/gen/ttyname.3 [moved from lib/nbsd_libc/gen/ttyname.3 with 100% similarity]
lib/libc/gen/ttyname.c [moved from lib/nbsd_libc/gen/ttyname.c with 100% similarity]
lib/libc/gen/ttyslot.c [moved from lib/nbsd_libc/gen/ttyslot.c with 100% similarity]
lib/libc/gen/ualarm.3 [moved from lib/nbsd_libc/gen/ualarm.3 with 100% similarity]
lib/libc/gen/ualarm.c [moved from lib/nbsd_libc/gen/ualarm.c with 100% similarity]
lib/libc/gen/ulimit.3 [moved from lib/nbsd_libc/gen/ulimit.3 with 100% similarity]
lib/libc/gen/ulimit.c [moved from lib/nbsd_libc/gen/ulimit.c with 100% similarity]
lib/libc/gen/uname.3 [moved from lib/nbsd_libc/gen/uname.3 with 100% similarity]
lib/libc/gen/uname.c [moved from lib/nbsd_libc/gen/uname.c with 100% similarity]
lib/libc/gen/unvis.3 [moved from lib/nbsd_libc/gen/unvis.3 with 100% similarity]
lib/libc/gen/unvis.c [moved from lib/nbsd_libc/gen/unvis.c with 100% similarity]
lib/libc/gen/usleep.3 [moved from lib/nbsd_libc/gen/usleep.3 with 100% similarity]
lib/libc/gen/usleep.c [moved from lib/nbsd_libc/gen/usleep.c with 100% similarity]
lib/libc/gen/utime.3 [moved from lib/nbsd_libc/gen/utime.3 with 100% similarity]
lib/libc/gen/utime.c [moved from lib/nbsd_libc/gen/utime.c with 100% similarity]
lib/libc/gen/utmp.c [moved from lib/nbsd_libc/gen/utmp.c with 100% similarity]
lib/libc/gen/utmpx.c [moved from lib/nbsd_libc/gen/utmpx.c with 100% similarity]
lib/libc/gen/valloc.3 [moved from lib/nbsd_libc/gen/valloc.3 with 100% similarity]
lib/libc/gen/valloc.c [moved from lib/nbsd_libc/gen/valloc.c with 100% similarity]
lib/libc/gen/verr.c [moved from lib/libc/other/verr.c with 100% similarity]
lib/libc/gen/verrx.c [moved from lib/libc/other/verrx.c with 100% similarity]
lib/libc/gen/vis.3 [moved from lib/nbsd_libc/gen/vis.3 with 100% similarity]
lib/libc/gen/vis.c [moved from lib/nbsd_libc/gen/vis.c with 100% similarity]
lib/libc/gen/vwarn.c [moved from lib/libc/other/vwarn.c with 100% similarity]
lib/libc/gen/vwarnx.c [moved from lib/nbsd_libc/gen/vwarnx.c with 100% similarity]
lib/libc/gen/wait.c [moved from lib/nbsd_libc/gen/wait.c with 100% similarity]
lib/libc/gen/wait3.c [moved from lib/nbsd_libc/gen/wait3.c with 100% similarity]
lib/libc/gen/waitpid.c [moved from lib/nbsd_libc/gen/waitpid.c with 100% similarity]
lib/libc/gen/warn.c [moved from lib/libc/other/warn.c with 100% similarity]
lib/libc/gen/warnx.c [moved from lib/nbsd_libc/gen/warnx.c with 100% similarity]
lib/libc/gen/wordexp.3 [moved from lib/nbsd_libc/gen/wordexp.3 with 100% similarity]
lib/libc/gen/wordexp.c [moved from lib/nbsd_libc/gen/wordexp.c with 100% similarity]
lib/libc/gmon/Makefile.inc [moved from lib/nbsd_libc/gmon/Makefile.inc with 100% similarity]
lib/libc/gmon/gmon.c [moved from lib/nbsd_libc/gmon/gmon.c with 100% similarity]
lib/libc/gmon/moncontrol.3 [moved from lib/nbsd_libc/gmon/moncontrol.3 with 100% similarity]
lib/libc/gnu/arch/i386/rts/Makefile.inc [deleted file]
lib/libc/gnu/arch/i386/rts/__setjmp.S [deleted file]
lib/libc/gnu/arch/i386/rts/longjmp.S [deleted file]
lib/libc/gnu/ieee_float/Makefile.inc [deleted file]
lib/libc/gnu/ieee_float/fphook.c [deleted file]
lib/libc/gnu/ieee_float/frexp.c [deleted file]
lib/libc/gnu/ieee_float/ieee_float.h [deleted file]
lib/libc/gnu/ieee_float/isinf.c [deleted file]
lib/libc/gnu/ieee_float/isnan.c [deleted file]
lib/libc/gnu/ieee_float/ldexp.c [deleted file]
lib/libc/gnu/ieee_float/modf.c [deleted file]
lib/libc/hash/Makefile.inc [moved from lib/nbsd_libc/hash/Makefile.inc with 100% similarity]
lib/libc/hash/hashhl.c [moved from lib/nbsd_libc/hash/hashhl.c with 100% similarity]
lib/libc/hash/md2/Makefile.inc [moved from lib/nbsd_libc/hash/md2/Makefile.inc with 100% similarity]
lib/libc/hash/md2/md2.3 [moved from lib/nbsd_libc/hash/md2/md2.3 with 100% similarity]
lib/libc/hash/md2/md2.c [moved from lib/nbsd_libc/hash/md2/md2.c with 100% similarity]
lib/libc/hash/md2/md2hl.c [moved from lib/nbsd_libc/hash/md2/md2hl.c with 100% similarity]
lib/libc/hash/rmd160/Makefile.inc [moved from lib/nbsd_libc/hash/rmd160/Makefile.inc with 100% similarity]
lib/libc/hash/rmd160/rmd160.3 [moved from lib/nbsd_libc/hash/rmd160/rmd160.3 with 100% similarity]
lib/libc/hash/rmd160/rmd160hl.c [moved from lib/nbsd_libc/hash/rmd160/rmd160hl.c with 100% similarity]
lib/libc/hash/sha1/Makefile.inc [moved from lib/nbsd_libc/hash/sha1/Makefile.inc with 100% similarity]
lib/libc/hash/sha1/sha1.3 [moved from lib/nbsd_libc/hash/sha1/sha1.3 with 100% similarity]
lib/libc/hash/sha1/sha1hl.c [moved from lib/nbsd_libc/hash/sha1/sha1hl.c with 100% similarity]
lib/libc/hash/sha2/Makefile.inc [moved from lib/nbsd_libc/hash/sha2/Makefile.inc with 100% similarity]
lib/libc/hash/sha2/sha2.3 [moved from lib/nbsd_libc/hash/sha2/sha2.3 with 100% similarity]
lib/libc/hash/sha2/sha224hl.c [moved from lib/nbsd_libc/hash/sha2/sha224hl.c with 100% similarity]
lib/libc/hash/sha2/sha256hl.c [moved from lib/nbsd_libc/hash/sha2/sha256hl.c with 100% similarity]
lib/libc/hash/sha2/sha384hl.c [moved from lib/nbsd_libc/hash/sha2/sha384hl.c with 100% similarity]
lib/libc/hash/sha2/sha512hl.c [moved from lib/nbsd_libc/hash/sha2/sha512hl.c with 100% similarity]
lib/libc/iconv/Makefile.inc [moved from lib/nbsd_libc/iconv/Makefile.inc with 100% similarity]
lib/libc/iconv/iconv.3 [moved from lib/nbsd_libc/iconv/iconv.3 with 100% similarity]
lib/libc/iconv/iconv.c [moved from lib/nbsd_libc/iconv/iconv.c with 100% similarity]
lib/libc/include/env.h [moved from lib/nbsd_libc/include/env.h with 100% similarity]
lib/libc/include/extern.h [moved from lib/nbsd_libc/include/extern.h with 100% similarity]
lib/libc/include/fd_setsize.h [moved from lib/nbsd_libc/include/fd_setsize.h with 100% similarity]
lib/libc/include/isc/assertions.h [moved from lib/nbsd_libc/include/isc/assertions.h with 100% similarity]
lib/libc/include/isc/dst.h [moved from lib/nbsd_libc/include/isc/dst.h with 100% similarity]
lib/libc/include/isc/eventlib.h [moved from lib/nbsd_libc/include/isc/eventlib.h with 100% similarity]
lib/libc/include/isc/heap.h [moved from lib/nbsd_libc/include/isc/heap.h with 100% similarity]
lib/libc/include/isc/list.h [moved from lib/nbsd_libc/include/isc/list.h with 100% similarity]
lib/libc/include/isc/memcluster.h [moved from lib/nbsd_libc/include/isc/memcluster.h with 100% similarity]
lib/libc/include/namespace.h [moved from lib/nbsd_libc/include/namespace.h with 100% similarity]
lib/libc/include/pathnames.h [moved from lib/nbsd_libc/include/pathnames.h with 100% similarity]
lib/libc/include/port_after.h [moved from lib/nbsd_libc/include/port_after.h with 100% similarity]
lib/libc/include/port_before.h [moved from lib/nbsd_libc/include/port_before.h with 100% similarity]
lib/libc/include/reentrant.h [moved from lib/nbsd_libc/include/reentrant.h with 100% similarity]
lib/libc/include/resolv_mt.h [moved from lib/nbsd_libc/include/resolv_mt.h with 100% similarity]
lib/libc/inet/Makefile.inc [moved from lib/nbsd_libc/inet/Makefile.inc with 100% similarity]
lib/libc/inet/_inet_aton.c [moved from lib/nbsd_libc/inet/_inet_aton.c with 100% similarity]
lib/libc/inet/_inet_pton.c [moved from lib/nbsd_libc/inet/_inet_pton.c with 100% similarity]
lib/libc/inet/inet.3 [moved from lib/nbsd_libc/inet/inet.3 with 100% similarity]
lib/libc/inet/inet6_option_space.3 [moved from lib/nbsd_libc/inet/inet6_option_space.3 with 100% similarity]
lib/libc/inet/inet6_rthdr_space.3 [moved from lib/nbsd_libc/inet/inet6_rthdr_space.3 with 100% similarity]
lib/libc/inet/inet_cidr_ntop.c [moved from lib/nbsd_libc/inet/inet_cidr_ntop.c with 100% similarity]
lib/libc/inet/inet_cidr_pton.c [moved from lib/nbsd_libc/inet/inet_cidr_pton.c with 100% similarity]
lib/libc/inet/inet_lnaof.c [moved from lib/nbsd_libc/inet/inet_lnaof.c with 100% similarity]
lib/libc/inet/inet_makeaddr.c [moved from lib/nbsd_libc/inet/inet_makeaddr.c with 100% similarity]
lib/libc/inet/inet_net.3 [moved from lib/nbsd_libc/inet/inet_net.3 with 100% similarity]
lib/libc/inet/inet_net_ntop.c [moved from lib/nbsd_libc/inet/inet_net_ntop.c with 100% similarity]
lib/libc/inet/inet_net_pton.c [moved from lib/nbsd_libc/inet/inet_net_pton.c with 100% similarity]
lib/libc/inet/inet_neta.c [moved from lib/nbsd_libc/inet/inet_neta.c with 100% similarity]
lib/libc/inet/inet_netof.c [moved from lib/nbsd_libc/inet/inet_netof.c with 100% similarity]
lib/libc/inet/inet_network.c [moved from lib/nbsd_libc/inet/inet_network.c with 100% similarity]
lib/libc/inet/inet_ntoa.c [moved from lib/nbsd_libc/inet/inet_ntoa.c with 100% similarity]
lib/libc/inet/inet_ntop.c [moved from lib/nbsd_libc/inet/inet_ntop.c with 100% similarity]
lib/libc/inet/inet_pton.c [moved from lib/nbsd_libc/inet/inet_pton.c with 100% similarity]
lib/libc/inet/nsap_addr.c [moved from lib/nbsd_libc/inet/nsap_addr.c with 100% similarity]
lib/libc/ip/Makefile.inc [deleted file]
lib/libc/ip/accept.c [deleted file]
lib/libc/ip/addrinfo.c [deleted file]
lib/libc/ip/bind.c [deleted file]
lib/libc/ip/connect.c [deleted file]
lib/libc/ip/ether.h [deleted file]
lib/libc/ip/ether_line.c [deleted file]
lib/libc/ip/ethera2n.c [deleted file]
lib/libc/ip/ethere2a.c [deleted file]
lib/libc/ip/etherh2n.c [deleted file]
lib/libc/ip/ethern2h.c [deleted file]
lib/libc/ip/gai_strerror.c [deleted file]
lib/libc/ip/getdomain.c [deleted file]
lib/libc/ip/gethnmadr.c [deleted file]
lib/libc/ip/gethostent.c [deleted file]
lib/libc/ip/gethostname.c [deleted file]
lib/libc/ip/getifaddrs.c [deleted file]
lib/libc/ip/getnetbyaddr.c [deleted file]
lib/libc/ip/getnetbyname.c [deleted file]
lib/libc/ip/getnetent.c [deleted file]
lib/libc/ip/getpeereid.c [deleted file]
lib/libc/ip/getpeername.c [deleted file]
lib/libc/ip/getproto.c [deleted file]
lib/libc/ip/getprotoent.c [deleted file]
lib/libc/ip/getprotoname.c [deleted file]
lib/libc/ip/getservent.c [deleted file]
lib/libc/ip/getsockname.c [deleted file]
lib/libc/ip/getsockopt.c [deleted file]
lib/libc/ip/getsrvbyname.c [deleted file]
lib/libc/ip/getsrvbyport.c [deleted file]
lib/libc/ip/hton.c [deleted file]
lib/libc/ip/inet_addr.c [deleted file]
lib/libc/ip/inet_network.c [deleted file]
lib/libc/ip/inet_ntoa.c [deleted file]
lib/libc/ip/inet_ntop.c [deleted file]
lib/libc/ip/inet_pton.c [deleted file]
lib/libc/ip/listen.c [deleted file]
lib/libc/ip/memcspn.c [deleted file]
lib/libc/ip/nameinfo.c [deleted file]
lib/libc/ip/oneC_sum.c [deleted file]
lib/libc/ip/rcmd.c [deleted file]
lib/libc/ip/recv.c [deleted file]
lib/libc/ip/recvfrom.c [deleted file]
lib/libc/ip/recvmsg.c [deleted file]
lib/libc/ip/res_comp.c [deleted file]
lib/libc/ip/res_init.c [deleted file]
lib/libc/ip/res_mkquery.c [deleted file]
lib/libc/ip/res_query.c [deleted file]
lib/libc/ip/res_send.c [deleted file]
lib/libc/ip/ruserok.c [deleted file]
lib/libc/ip/send.c [deleted file]
lib/libc/ip/sendmsg.c [deleted file]
lib/libc/ip/sendto.c [deleted file]
lib/libc/ip/servxcheck.c [deleted file]
lib/libc/ip/sethostent.c [deleted file]
lib/libc/ip/setsockopt.c [deleted file]
lib/libc/ip/shutdown.c [deleted file]
lib/libc/ip/socket.c [deleted file]
lib/libc/ip/socketpair.c [deleted file]
lib/libc/ip/strcasecmp.c [deleted file]
lib/libc/isc/Makefile.inc [moved from lib/nbsd_libc/isc/Makefile.inc with 100% similarity]
lib/libc/isc/assertions.c [moved from lib/nbsd_libc/isc/assertions.c with 100% similarity]
lib/libc/isc/ev_streams.c [moved from lib/nbsd_libc/isc/ev_streams.c with 100% similarity]
lib/libc/isc/ev_timers.c [moved from lib/nbsd_libc/isc/ev_timers.c with 100% similarity]
lib/libc/isc/eventlib_p.h [moved from lib/nbsd_libc/isc/eventlib_p.h with 100% similarity]
lib/libc/libcincludes.mk [moved from lib/nbsd_libc/libcincludes.mk with 52% similarity]
lib/libc/locale/Makefile.inc [moved from lib/nbsd_libc/locale/Makefile.inc with 100% similarity]
lib/libc/locale/__mb_cur_max.c [moved from lib/nbsd_libc/locale/__mb_cur_max.c with 100% similarity]
lib/libc/locale/__wctoint.h [moved from lib/nbsd_libc/locale/__wctoint.h with 100% similarity]
lib/libc/locale/_def_messages.c [moved from lib/nbsd_libc/locale/_def_messages.c with 100% similarity]
lib/libc/locale/_def_monetary.c [moved from lib/nbsd_libc/locale/_def_monetary.c with 100% similarity]
lib/libc/locale/_def_numeric.c [moved from lib/nbsd_libc/locale/_def_numeric.c with 100% similarity]
lib/libc/locale/_def_time.c [moved from lib/nbsd_libc/locale/_def_time.c with 100% similarity]
lib/libc/locale/_wcstod.h [moved from lib/nbsd_libc/locale/_wcstod.h with 100% similarity]
lib/libc/locale/_wcstol.h [moved from lib/nbsd_libc/locale/_wcstol.h with 100% similarity]
lib/libc/locale/_wcstoul.h [moved from lib/nbsd_libc/locale/_wcstoul.h with 100% similarity]
lib/libc/locale/_wctrans.c [moved from lib/nbsd_libc/locale/_wctrans.c with 100% similarity]
lib/libc/locale/_wctrans_local.h [moved from lib/nbsd_libc/locale/_wctrans_local.h with 100% similarity]
lib/libc/locale/_wctype.c [moved from lib/nbsd_libc/locale/_wctype.c with 100% similarity]
lib/libc/locale/_wctype_local.h [moved from lib/nbsd_libc/locale/_wctype_local.h with 100% similarity]
lib/libc/locale/aliasname.c [moved from lib/nbsd_libc/locale/aliasname.c with 100% similarity]
lib/libc/locale/aliasname_local.h [moved from lib/nbsd_libc/locale/aliasname_local.h with 100% similarity]
lib/libc/locale/bsdctype.c [moved from lib/nbsd_libc/locale/bsdctype.c with 100% similarity]
lib/libc/locale/bsdctype_file.h [moved from lib/nbsd_libc/locale/bsdctype_file.h with 100% similarity]
lib/libc/locale/bsdctype_local.h [moved from lib/nbsd_libc/locale/bsdctype_local.h with 100% similarity]
lib/libc/locale/btowc.3 [moved from lib/nbsd_libc/locale/btowc.3 with 100% similarity]
lib/libc/locale/ctype_local.h [moved from lib/nbsd_libc/locale/ctype_local.h with 100% similarity]
lib/libc/locale/current_locale.c [moved from lib/nbsd_libc/locale/current_locale.c with 100% similarity]
lib/libc/locale/dummy_lc_collate.c [moved from lib/nbsd_libc/locale/dummy_lc_collate.c with 100% similarity]
lib/libc/locale/dummy_lc_template.h [moved from lib/nbsd_libc/locale/dummy_lc_template.h with 100% similarity]
lib/libc/locale/fix_grouping.c [moved from lib/nbsd_libc/locale/fix_grouping.c with 100% similarity]
lib/libc/locale/fix_grouping.h [moved from lib/nbsd_libc/locale/fix_grouping.h with 100% similarity]
lib/libc/locale/generic_lc_all.c [moved from lib/nbsd_libc/locale/generic_lc_all.c with 100% similarity]
lib/libc/locale/generic_lc_template.h [moved from lib/nbsd_libc/locale/generic_lc_template.h with 100% similarity]
lib/libc/locale/generic_lc_template_decl.h [moved from lib/nbsd_libc/locale/generic_lc_template_decl.h with 100% similarity]
lib/libc/locale/global_locale.c [moved from lib/nbsd_libc/locale/global_locale.c with 100% similarity]
lib/libc/locale/iswalnum.3 [moved from lib/nbsd_libc/locale/iswalnum.3 with 100% similarity]
lib/libc/locale/iswctype.3 [moved from lib/nbsd_libc/locale/iswctype.3 with 100% similarity]
lib/libc/locale/iswctype_mb.c [moved from lib/nbsd_libc/locale/iswctype_mb.c with 100% similarity]
lib/libc/locale/iswctype_sb.c [moved from lib/nbsd_libc/locale/iswctype_sb.c with 100% similarity]
lib/libc/locale/localeconv.c [moved from lib/nbsd_libc/locale/localeconv.c with 100% similarity]
lib/libc/locale/localeio.c [moved from lib/nbsd_libc/locale/localeio.c with 100% similarity]
lib/libc/locale/localeio.h [moved from lib/nbsd_libc/locale/localeio.h with 100% similarity]
lib/libc/locale/localeio_lc_ctype.c [moved from lib/nbsd_libc/locale/localeio_lc_ctype.c with 100% similarity]
lib/libc/locale/localeio_lc_messages.c [moved from lib/nbsd_libc/locale/localeio_lc_messages.c with 100% similarity]
lib/libc/locale/localeio_lc_monetary.c [moved from lib/nbsd_libc/locale/localeio_lc_monetary.c with 100% similarity]
lib/libc/locale/localeio_lc_numeric.c [moved from lib/nbsd_libc/locale/localeio_lc_numeric.c with 100% similarity]
lib/libc/locale/localeio_lc_time.c [moved from lib/nbsd_libc/locale/localeio_lc_time.c with 100% similarity]
lib/libc/locale/mblen.3 [moved from lib/nbsd_libc/locale/mblen.3 with 100% similarity]
lib/libc/locale/mbrlen.3 [moved from lib/nbsd_libc/locale/mbrlen.3 with 100% similarity]
lib/libc/locale/mbrtowc.3 [moved from lib/nbsd_libc/locale/mbrtowc.3 with 100% similarity]
lib/libc/locale/mbsinit.3 [moved from lib/nbsd_libc/locale/mbsinit.3 with 100% similarity]
lib/libc/locale/mbsrtowcs.3 [moved from lib/nbsd_libc/locale/mbsrtowcs.3 with 100% similarity]
lib/libc/locale/mbstowcs.3 [moved from lib/nbsd_libc/locale/mbstowcs.3 with 100% similarity]
lib/libc/locale/mbtowc.3 [moved from lib/nbsd_libc/locale/mbtowc.3 with 100% similarity]
lib/libc/locale/multibyte.h [moved from lib/nbsd_libc/locale/multibyte.h with 100% similarity]
lib/libc/locale/multibyte_amd1.c [moved from lib/nbsd_libc/locale/multibyte_amd1.c with 100% similarity]
lib/libc/locale/multibyte_c90.c [moved from lib/nbsd_libc/locale/multibyte_c90.c with 100% similarity]
lib/libc/locale/multibyte_sb.c [moved from lib/nbsd_libc/locale/multibyte_sb.c with 100% similarity]
lib/libc/locale/nb_lc_messages_misc.h [moved from lib/nbsd_libc/locale/nb_lc_messages_misc.h with 100% similarity]
lib/libc/locale/nb_lc_monetary_misc.h [moved from lib/nbsd_libc/locale/nb_lc_monetary_misc.h with 100% similarity]
lib/libc/locale/nb_lc_numeric_misc.h [moved from lib/nbsd_libc/locale/nb_lc_numeric_misc.h with 100% similarity]
lib/libc/locale/nb_lc_template.h [moved from lib/nbsd_libc/locale/nb_lc_template.h with 100% similarity]
lib/libc/locale/nb_lc_template_decl.h [moved from lib/nbsd_libc/locale/nb_lc_template_decl.h with 100% similarity]
lib/libc/locale/nb_lc_time_misc.h [moved from lib/nbsd_libc/locale/nb_lc_time_misc.h with 100% similarity]
lib/libc/locale/nl_langinfo.3 [moved from lib/nbsd_libc/locale/nl_langinfo.3 with 100% similarity]
lib/libc/locale/nl_langinfo.c [moved from lib/nbsd_libc/locale/nl_langinfo.c with 100% similarity]
lib/libc/locale/rune.c [moved from lib/nbsd_libc/locale/rune.c with 100% similarity]
lib/libc/locale/runetable.c [moved from lib/nbsd_libc/locale/runetable.c with 100% similarity]
lib/libc/locale/runetype_file.h [moved from lib/nbsd_libc/locale/runetype_file.h with 100% similarity]
lib/libc/locale/runetype_local.h [moved from lib/nbsd_libc/locale/runetype_local.h with 100% similarity]
lib/libc/locale/runetype_misc.h [moved from lib/nbsd_libc/locale/runetype_misc.h with 100% similarity]
lib/libc/locale/setlocale.3 [moved from lib/nbsd_libc/locale/setlocale.3 with 100% similarity]
lib/libc/locale/setlocale.c [moved from lib/nbsd_libc/locale/setlocale.c with 100% similarity]
lib/libc/locale/setlocale_local.h [moved from lib/nbsd_libc/locale/setlocale_local.h with 100% similarity]
lib/libc/locale/towctrans.3 [moved from lib/nbsd_libc/locale/towctrans.3 with 100% similarity]
lib/libc/locale/towlower.3 [moved from lib/nbsd_libc/locale/towlower.3 with 100% similarity]
lib/libc/locale/wcrtomb.3 [moved from lib/nbsd_libc/locale/wcrtomb.3 with 100% similarity]
lib/libc/locale/wcscoll.3 [moved from lib/nbsd_libc/locale/wcscoll.3 with 100% similarity]
lib/libc/locale/wcscoll.c [moved from lib/nbsd_libc/locale/wcscoll.c with 100% similarity]
lib/libc/locale/wcsftime.3 [moved from lib/nbsd_libc/locale/wcsftime.3 with 100% similarity]
lib/libc/locale/wcsftime.c [moved from lib/nbsd_libc/locale/wcsftime.c with 100% similarity]
lib/libc/locale/wcsrtombs.3 [moved from lib/nbsd_libc/locale/wcsrtombs.3 with 100% similarity]
lib/libc/locale/wcstod.3 [moved from lib/nbsd_libc/locale/wcstod.3 with 100% similarity]
lib/libc/locale/wcstod.c [moved from lib/nbsd_libc/locale/wcstod.c with 100% similarity]
lib/libc/locale/wcstof.c [moved from lib/nbsd_libc/locale/wcstof.c with 100% similarity]
lib/libc/locale/wcstoimax.c [moved from lib/nbsd_libc/locale/wcstoimax.c with 100% similarity]
lib/libc/locale/wcstol.3 [moved from lib/nbsd_libc/locale/wcstol.3 with 100% similarity]
lib/libc/locale/wcstol.c [moved from lib/nbsd_libc/locale/wcstol.c with 100% similarity]
lib/libc/locale/wcstold.c [moved from lib/nbsd_libc/locale/wcstold.c with 100% similarity]
lib/libc/locale/wcstoll.c [moved from lib/nbsd_libc/locale/wcstoll.c with 100% similarity]
lib/libc/locale/wcstombs.3 [moved from lib/nbsd_libc/locale/wcstombs.3 with 100% similarity]
lib/libc/locale/wcstoul.c [moved from lib/nbsd_libc/locale/wcstoul.c with 100% similarity]
lib/libc/locale/wcstoull.c [moved from lib/nbsd_libc/locale/wcstoull.c with 100% similarity]
lib/libc/locale/wcstoumax.c [moved from lib/nbsd_libc/locale/wcstoumax.c with 100% similarity]
lib/libc/locale/wcsxfrm.3 [moved from lib/nbsd_libc/locale/wcsxfrm.3 with 100% similarity]
lib/libc/locale/wcsxfrm.c [moved from lib/nbsd_libc/locale/wcsxfrm.c with 100% similarity]
lib/libc/locale/wctob.3 [moved from lib/nbsd_libc/locale/wctob.3 with 100% similarity]
lib/libc/locale/wctomb.3 [moved from lib/nbsd_libc/locale/wctomb.3 with 100% similarity]
lib/libc/locale/wctrans.3 [moved from lib/nbsd_libc/locale/wctrans.3 with 100% similarity]
lib/libc/locale/wctype.3 [moved from lib/nbsd_libc/locale/wctype.3 with 100% similarity]
lib/libc/locale/wcwidth.3 [moved from lib/nbsd_libc/locale/wcwidth.3 with 100% similarity]
lib/libc/math/Makefile.inc [deleted file]
lib/libc/math/asin.c [deleted file]
lib/libc/math/atan.c [deleted file]
lib/libc/math/atan2.c [deleted file]
lib/libc/math/ceil.c [deleted file]
lib/libc/math/compare.c [deleted file]
lib/libc/math/exp.c [deleted file]
lib/libc/math/fabs.c [deleted file]
lib/libc/math/floor.c [deleted file]
lib/libc/math/fmod.c [deleted file]
lib/libc/math/hugeval.c [deleted file]
lib/libc/math/localmath.h [deleted file]
lib/libc/math/log.c [deleted file]
lib/libc/math/log10.c [deleted file]
lib/libc/math/math_private.h [deleted file]
lib/libc/math/pow.c [deleted file]
lib/libc/math/s_copysign.c [deleted file]
lib/libc/math/s_finite.c [deleted file]
lib/libc/math/s_rint.c [deleted file]
lib/libc/math/scalbn.c [deleted file]
lib/libc/math/sin.c [deleted file]
lib/libc/math/sinh.c [deleted file]
lib/libc/math/sqrt.c [deleted file]
lib/libc/math/tan.c [deleted file]
lib/libc/math/tanh.c [deleted file]
lib/libc/md/Makefile.inc [moved from lib/nbsd_libc/md/Makefile.inc with 100% similarity]
lib/libc/md/md2hl.c [moved from lib/nbsd_libc/md/md2hl.c with 100% similarity]
lib/libc/md/md4.copyright [moved from lib/nbsd_libc/md/md4.copyright with 100% similarity]
lib/libc/md/md4hl.c [moved from lib/nbsd_libc/md/md4hl.c with 100% similarity]
lib/libc/md/md5.copyright [moved from lib/nbsd_libc/md/md5.copyright with 100% similarity]
lib/libc/md/md5hl.c [moved from lib/nbsd_libc/md/md5hl.c with 100% similarity]
lib/libc/md/mdX.3 [moved from lib/nbsd_libc/md/mdX.3 with 100% similarity]
lib/libc/md/mdXhl.c [moved from lib/nbsd_libc/md/mdXhl.c with 100% similarity]
lib/libc/minix-config.inc [moved from lib/nbsd_libc/minix-config.inc with 100% similarity]
lib/libc/minix/calloc.c [moved from lib/libc/ansi/calloc.c with 100% similarity]
lib/libc/minix/malloc-debug.c [moved from lib/libc/ansi/malloc-debug.c with 100% similarity]
lib/libc/minix/malloc-debug.h [moved from lib/libc/ansi/malloc-debug.h with 100% similarity]
lib/libc/minix/malloc.c [moved from lib/libc/ansi/malloc.c with 100% similarity]
lib/libc/misc/Makefile.inc [moved from lib/nbsd_libc/misc/Makefile.inc with 100% similarity]
lib/libc/misc/initfini.c [moved from lib/nbsd_libc/misc/initfini.c with 100% similarity]
lib/libc/misc/stack_protector.c [moved from lib/nbsd_libc/misc/stack_protector.c with 100% similarity]
lib/libc/nameser/Makefile.inc [moved from lib/nbsd_libc/nameser/Makefile.inc with 100% similarity]
lib/libc/nameser/ns_name.c [moved from lib/nbsd_libc/nameser/ns_name.c with 100% similarity]
lib/libc/nameser/ns_netint.c [moved from lib/nbsd_libc/nameser/ns_netint.c with 100% similarity]
lib/libc/nameser/ns_parse.c [moved from lib/nbsd_libc/nameser/ns_parse.c with 100% similarity]
lib/libc/nameser/ns_print.c [moved from lib/nbsd_libc/nameser/ns_print.c with 100% similarity]
lib/libc/nameser/ns_samedomain.c [moved from lib/nbsd_libc/nameser/ns_samedomain.c with 100% similarity]
lib/libc/nameser/ns_ttl.c [moved from lib/nbsd_libc/nameser/ns_ttl.c with 100% similarity]
lib/libc/net/Lint_htonl.c [moved from lib/nbsd_libc/net/Lint_htonl.c with 100% similarity]
lib/libc/net/Lint_htons.c [moved from lib/nbsd_libc/net/Lint_htons.c with 100% similarity]
lib/libc/net/Lint_ntohl.c [moved from lib/nbsd_libc/net/Lint_ntohl.c with 100% similarity]
lib/libc/net/Lint_ntohs.c [moved from lib/nbsd_libc/net/Lint_ntohs.c with 100% similarity]
lib/libc/net/Makefile.inc [moved from lib/nbsd_libc/net/Makefile.inc with 100% similarity]
lib/libc/net/base64.c [moved from lib/nbsd_libc/net/base64.c with 100% similarity]
lib/libc/net/byteorder.3 [moved from lib/nbsd_libc/net/byteorder.3 with 100% similarity]
lib/libc/net/ethers.3 [moved from lib/nbsd_libc/net/ethers.3 with 100% similarity]
lib/libc/net/ethers.c [moved from lib/nbsd_libc/net/ethers.c with 100% similarity]
lib/libc/net/gai_strerror.3 [moved from lib/nbsd_libc/net/gai_strerror.3 with 100% similarity]
lib/libc/net/getaddrinfo.3 [moved from lib/nbsd_libc/net/getaddrinfo.3 with 100% similarity]
lib/libc/net/getaddrinfo.c [moved from lib/nbsd_libc/net/getaddrinfo.c with 100% similarity]
lib/libc/net/gethnamaddr.c [moved from lib/nbsd_libc/net/gethnamaddr.c with 100% similarity]
lib/libc/net/gethostbyname.3 [moved from lib/nbsd_libc/net/gethostbyname.3 with 100% similarity]
lib/libc/net/getifaddrs.3 [moved from lib/nbsd_libc/net/getifaddrs.3 with 100% similarity]
lib/libc/net/getifaddrs.c [moved from lib/nbsd_libc/net/getifaddrs.c with 100% similarity]
lib/libc/net/getnameinfo.3 [moved from lib/nbsd_libc/net/getnameinfo.3 with 100% similarity]
lib/libc/net/getnameinfo.c [moved from lib/nbsd_libc/net/getnameinfo.c with 100% similarity]
lib/libc/net/getnetent.3 [moved from lib/nbsd_libc/net/getnetent.3 with 100% similarity]
lib/libc/net/getnetent.c [moved from lib/nbsd_libc/net/getnetent.c with 100% similarity]
lib/libc/net/getnetnamadr.c [moved from lib/nbsd_libc/net/getnetnamadr.c with 100% similarity]
lib/libc/net/getpeereid.3 [moved from lib/nbsd_libc/net/getpeereid.3 with 100% similarity]
lib/libc/net/getpeereid.c [moved from lib/nbsd_libc/net/getpeereid.c with 100% similarity]
lib/libc/net/getprotobyname.c [moved from lib/nbsd_libc/net/getprotobyname.c with 100% similarity]
lib/libc/net/getprotobyname_r.c [moved from lib/nbsd_libc/net/getprotobyname_r.c with 100% similarity]
lib/libc/net/getprotobynumber.c [moved from lib/nbsd_libc/net/getprotobynumber.c with 100% similarity]
lib/libc/net/getprotobynumber_r.c [moved from lib/nbsd_libc/net/getprotobynumber_r.c with 100% similarity]
lib/libc/net/getprotoent.3 [moved from lib/nbsd_libc/net/getprotoent.3 with 100% similarity]
lib/libc/net/getprotoent.c [moved from lib/nbsd_libc/net/getprotoent.c with 100% similarity]
lib/libc/net/getprotoent_r.c [moved from lib/nbsd_libc/net/getprotoent_r.c with 100% similarity]
lib/libc/net/getservbyname.c [moved from lib/nbsd_libc/net/getservbyname.c with 100% similarity]
lib/libc/net/getservbyname_r.c [moved from lib/nbsd_libc/net/getservbyname_r.c with 100% similarity]
lib/libc/net/getservbyport.c [moved from lib/nbsd_libc/net/getservbyport.c with 100% similarity]
lib/libc/net/getservbyport_r.c [moved from lib/nbsd_libc/net/getservbyport_r.c with 100% similarity]
lib/libc/net/getservent.3 [moved from lib/nbsd_libc/net/getservent.3 with 100% similarity]
lib/libc/net/getservent.c [moved from lib/nbsd_libc/net/getservent.c with 100% similarity]
lib/libc/net/getservent_r.c [moved from lib/nbsd_libc/net/getservent_r.c with 100% similarity]
lib/libc/net/hesiod.3 [moved from lib/nbsd_libc/net/hesiod.3 with 100% similarity]
lib/libc/net/hesiod.c [moved from lib/nbsd_libc/net/hesiod.c with 100% similarity]
lib/libc/net/if_indextoname.3 [moved from lib/nbsd_libc/net/if_indextoname.3 with 100% similarity]
lib/libc/net/if_indextoname.c [moved from lib/nbsd_libc/net/if_indextoname.c with 100% similarity]
lib/libc/net/if_nameindex.c [moved from lib/nbsd_libc/net/if_nameindex.c with 100% similarity]
lib/libc/net/if_nametoindex.c [moved from lib/nbsd_libc/net/if_nametoindex.c with 100% similarity]
lib/libc/net/inet6_opt_init.3 [moved from lib/nbsd_libc/net/inet6_opt_init.3 with 100% similarity]
lib/libc/net/inet6_option_space.3 [moved from lib/nbsd_libc/net/inet6_option_space.3 with 100% similarity]
lib/libc/net/inet6_rth_space.3 [moved from lib/nbsd_libc/net/inet6_rth_space.3 with 100% similarity]
lib/libc/net/inet6_rthdr_space.3 [moved from lib/nbsd_libc/net/inet6_rthdr_space.3 with 100% similarity]
lib/libc/net/ip6opt.c [moved from lib/nbsd_libc/net/ip6opt.c with 100% similarity]
lib/libc/net/iso_addr.3 [moved from lib/nbsd_libc/net/iso_addr.3 with 100% similarity]
lib/libc/net/iso_addr.c [moved from lib/nbsd_libc/net/iso_addr.c with 100% similarity]
lib/libc/net/linkaddr.3 [moved from lib/nbsd_libc/net/linkaddr.3 with 100% similarity]
lib/libc/net/linkaddr.c [moved from lib/nbsd_libc/net/linkaddr.c with 100% similarity]
lib/libc/net/minix/getifaddrs.c [moved from lib/nbsd_libc/net/minix/getifaddrs.c with 100% similarity]
lib/libc/net/minix/getpeereid.c [moved from lib/nbsd_libc/net/minix/getpeereid.c with 100% similarity]
lib/libc/net/nsdispatch.3 [moved from lib/nbsd_libc/net/nsdispatch.3 with 100% similarity]
lib/libc/net/nsdispatch.c [moved from lib/nbsd_libc/net/nsdispatch.c with 100% similarity]
lib/libc/net/nslexer.l [moved from lib/nbsd_libc/net/nslexer.l with 100% similarity]
lib/libc/net/nsparser.y [moved from lib/nbsd_libc/net/nsparser.y with 100% similarity]
lib/libc/net/protoent.h [moved from lib/nbsd_libc/net/protoent.h with 100% similarity]
lib/libc/net/rcmd.3 [moved from lib/nbsd_libc/net/rcmd.3 with 100% similarity]
lib/libc/net/rcmd.c [moved from lib/nbsd_libc/net/rcmd.c with 100% similarity]
lib/libc/net/recv.c [moved from lib/nbsd_libc/net/recv.c with 100% similarity]
lib/libc/net/resolver.3 [moved from lib/nbsd_libc/net/resolver.3 with 100% similarity]
lib/libc/net/rthdr.c [moved from lib/nbsd_libc/net/rthdr.c with 100% similarity]
lib/libc/net/send.c [moved from lib/nbsd_libc/net/send.c with 100% similarity]
lib/libc/net/servent.h [moved from lib/nbsd_libc/net/servent.h with 100% similarity]
lib/libc/net/sethostent.c [moved from lib/nbsd_libc/net/sethostent.c with 100% similarity]
lib/libc/net/sockatmark.3 [moved from lib/nbsd_libc/net/sockatmark.3 with 100% similarity]
lib/libc/net/sockatmark.c [moved from lib/nbsd_libc/net/sockatmark.c with 100% similarity]
lib/libc/net/vars6.c [moved from lib/nbsd_libc/net/vars6.c with 100% similarity]
lib/libc/nls/C.msg [moved from lib/nbsd_libc/nls/C.msg with 100% similarity]
lib/libc/nls/Makefile.inc [moved from lib/nbsd_libc/nls/Makefile.inc with 100% similarity]
lib/libc/nls/Pig.msg [moved from lib/nbsd_libc/nls/Pig.msg with 100% similarity]
lib/libc/nls/_catclose.c [moved from lib/nbsd_libc/nls/_catclose.c with 100% similarity]
lib/libc/nls/_catgets.c [moved from lib/nbsd_libc/nls/_catgets.c with 100% similarity]
lib/libc/nls/_catopen.c [moved from lib/nbsd_libc/nls/_catopen.c with 100% similarity]
lib/libc/nls/ca.msg [moved from lib/nbsd_libc/nls/ca.msg with 100% similarity]
lib/libc/nls/catclose.3 [moved from lib/nbsd_libc/nls/catclose.3 with 100% similarity]
lib/libc/nls/catclose.c [moved from lib/nbsd_libc/nls/catclose.c with 100% similarity]
lib/libc/nls/catgets.3 [moved from lib/nbsd_libc/nls/catgets.3 with 100% similarity]
lib/libc/nls/catgets.c [moved from lib/nbsd_libc/nls/catgets.c with 100% similarity]
lib/libc/nls/catopen.3 [moved from lib/nbsd_libc/nls/catopen.3 with 100% similarity]
lib/libc/nls/catopen.c [moved from lib/nbsd_libc/nls/catopen.c with 100% similarity]
lib/libc/nls/cs.msg [moved from lib/nbsd_libc/nls/cs.msg with 100% similarity]
lib/libc/nls/de.msg [moved from lib/nbsd_libc/nls/de.msg with 100% similarity]
lib/libc/nls/es.msg [moved from lib/nbsd_libc/nls/es.msg with 100% similarity]
lib/libc/nls/fi.msg [moved from lib/nbsd_libc/nls/fi.msg with 100% similarity]
lib/libc/nls/fr.msg [moved from lib/nbsd_libc/nls/fr.msg with 100% similarity]
lib/libc/nls/nl.msg [moved from lib/nbsd_libc/nls/nl.msg with 100% similarity]
lib/libc/nls/no.msg [moved from lib/nbsd_libc/nls/no.msg with 100% similarity]
lib/libc/nls/pl.msg [moved from lib/nbsd_libc/nls/pl.msg with 100% similarity]
lib/libc/nls/sk.msg [moved from lib/nbsd_libc/nls/sk.msg with 100% similarity]
lib/libc/nls/sv.msg [moved from lib/nbsd_libc/nls/sv.msg with 100% similarity]
lib/libc/other/Makefile.inc [deleted file]
lib/libc/other/__pm_findproc.c [deleted file]
lib/libc/other/_brk.c [deleted file]
lib/libc/other/_cprofile.c [deleted file]
lib/libc/other/_getdents.c [deleted file]
lib/libc/other/_getngid.c [deleted file]
lib/libc/other/_getnpid.c [deleted file]
lib/libc/other/_getnprocnr.c [deleted file]
lib/libc/other/_getnucred.c [deleted file]
lib/libc/other/_getnuid.c [deleted file]
lib/libc/other/_getpprocnr.c [deleted file]
lib/libc/other/_getprocnr.c [deleted file]
lib/libc/other/_lseek64.c [deleted file]
lib/libc/other/_mapdriver.c [deleted file]
lib/libc/other/_mcontext.c [deleted file]
lib/libc/other/_mount.c [deleted file]
lib/libc/other/_reboot.c [deleted file]
lib/libc/other/_sbrk.c [deleted file]
lib/libc/other/_seekdir.c [deleted file]
lib/libc/other/_setgroups.c [deleted file]
lib/libc/other/_sprofile.c [deleted file]
lib/libc/other/_svrctl.c [deleted file]
lib/libc/other/_sysuname.c [deleted file]
lib/libc/other/_vm_memctl.c [deleted file]
lib/libc/other/_vm_query_exit.c [deleted file]
lib/libc/other/_vm_set_priv.c [deleted file]
lib/libc/other/_vm_update.c [deleted file]
lib/libc/other/basename.c [deleted file]
lib/libc/other/bcmp.c [deleted file]
lib/libc/other/bcopy.c [deleted file]
lib/libc/other/bzero.c [deleted file]
lib/libc/other/ctermid.c [deleted file]
lib/libc/other/dirname.c [deleted file]
lib/libc/other/errno.c [deleted file]
lib/libc/other/fdopen.c [deleted file]
lib/libc/other/ffs.c [deleted file]
lib/libc/other/fgetln.c [deleted file]
lib/libc/other/flock.c [deleted file]
lib/libc/other/fts.c [deleted file]
lib/libc/other/getgrent.c [deleted file]
lib/libc/other/getlogin.c [deleted file]
lib/libc/other/getopt_long.c [deleted file]
lib/libc/other/getpagesize.c [deleted file]
lib/libc/other/getpass.c [deleted file]
lib/libc/other/getprogname.c [deleted file]
lib/libc/other/getpwent.c [deleted file]
lib/libc/other/getsubopt.c [deleted file]
lib/libc/other/getttyent.c [deleted file]
lib/libc/other/getw.c [deleted file]
lib/libc/other/hypot.c [deleted file]
lib/libc/other/index.c [deleted file]
lib/libc/other/initgroups.c [deleted file]
lib/libc/other/issetugid.c [deleted file]
lib/libc/other/loadname.c [deleted file]
lib/libc/other/lock.c [deleted file]
lib/libc/other/lrand.c [deleted file]
lib/libc/other/lsearch.c [deleted file]
lib/libc/other/memccpy.c [deleted file]
lib/libc/other/minix_rs.c [deleted file]
lib/libc/other/mtab.c [deleted file]
lib/libc/other/namespace.h [deleted file]
lib/libc/other/peekpoke.c [deleted file]
lib/libc/other/popen.c [deleted file]
lib/libc/other/putenv.c [deleted file]
lib/libc/other/putw.c [deleted file]
lib/libc/other/pwcache.c [deleted file]
lib/libc/other/random.c [deleted file]
lib/libc/other/realpath.c [deleted file]
lib/libc/other/rindex.c [deleted file]
lib/libc/other/rlimit.c [deleted file]
lib/libc/other/setenv.c [deleted file]
lib/libc/other/setmode.c [deleted file]
lib/libc/other/settimeofday.c [deleted file]
lib/libc/other/shquote.c [deleted file]
lib/libc/other/strcasestr.c [deleted file]
lib/libc/other/strdup.c [deleted file]
lib/libc/other/strlcat.c [deleted file]
lib/libc/other/strlcpy.c [deleted file]
lib/libc/other/strmode.c [deleted file]
lib/libc/other/strnstr.c [deleted file]
lib/libc/other/strsep.c [deleted file]
lib/libc/other/strtok_r.c [deleted file]
lib/libc/other/strtoll.c [deleted file]
lib/libc/other/swab.c [deleted file]
lib/libc/other/syscall.c [deleted file]
lib/libc/other/sysconf.c [deleted file]
lib/libc/other/syslog.c [deleted file]
lib/libc/other/telldir.c [deleted file]
lib/libc/other/termcap.c [deleted file]
lib/libc/other/ttyname.c [deleted file]
lib/libc/other/ttyslot.c [deleted file]
lib/libc/other/un-namespace.h [deleted file]
lib/libc/other/v8regerror.c [deleted file]
lib/libc/other/v8regexp.c [deleted file]
lib/libc/other/v8regsub.c [deleted file]
lib/libc/other/vectorio.c [deleted file]
lib/libc/other/vwarnx.c [deleted file]
lib/libc/other/warnx.c [deleted file]
lib/libc/pkgconfig/Makefile [moved from lib/nbsd_libc/pkgconfig/Makefile with 100% similarity]
lib/libc/pkgconfig/libc.pc [moved from lib/nbsd_libc/pkgconfig/libc.pc with 100% similarity]
lib/libc/posix/Makefile.inc [deleted file]
lib/libc/posix/__exit.c [deleted file]
lib/libc/posix/_access.c [deleted file]
lib/libc/posix/_alarm.c [deleted file]
lib/libc/posix/_cfgetispeed.c [deleted file]
lib/libc/posix/_cfgetospeed.c [deleted file]
lib/libc/posix/_cfsetispeed.c [deleted file]
lib/libc/posix/_cfsetospeed.c [deleted file]
lib/libc/posix/_chdir.c [deleted file]
lib/libc/posix/_chmod.c [deleted file]
lib/libc/posix/_chown.c [deleted file]
lib/libc/posix/_chroot.c [deleted file]
lib/libc/posix/_close.c [deleted file]
lib/libc/posix/_closedir.c [deleted file]
lib/libc/posix/_creat.c [deleted file]
lib/libc/posix/_dup.c [deleted file]
lib/libc/posix/_dup2.c [deleted file]
lib/libc/posix/_execl.c [deleted file]
lib/libc/posix/_execle.c [deleted file]
lib/libc/posix/_execlp.c [deleted file]
lib/libc/posix/_execv.c [deleted file]
lib/libc/posix/_execve.c [deleted file]
lib/libc/posix/_execvp.c [deleted file]
lib/libc/posix/_fchmod.c [deleted file]
lib/libc/posix/_fchown.c [deleted file]
lib/libc/posix/_fcntl.c [deleted file]
lib/libc/posix/_fork.c [deleted file]
lib/libc/posix/_fpathconf.c [deleted file]
lib/libc/posix/_fstat.c [deleted file]
lib/libc/posix/_fstatfs.c [deleted file]
lib/libc/posix/_fstatvfs.c [deleted file]
lib/libc/posix/_fsync.c [deleted file]
lib/libc/posix/_getcwd.c [deleted file]
lib/libc/posix/_getegid.c [deleted file]
lib/libc/posix/_geteuid.c [deleted file]
lib/libc/posix/_getgid.c [deleted file]
lib/libc/posix/_getgroups.c [deleted file]
lib/libc/posix/_getitimer.c [deleted file]
lib/libc/posix/_getpgrp.c [deleted file]
lib/libc/posix/_getpid.c [deleted file]
lib/libc/posix/_getppid.c [deleted file]
lib/libc/posix/_getuid.c [deleted file]
lib/libc/posix/_ioctl.c [deleted file]
lib/libc/posix/_isatty.c [deleted file]
lib/libc/posix/_kill.c [deleted file]
lib/libc/posix/_killpg.c [deleted file]
lib/libc/posix/_link.c [deleted file]
lib/libc/posix/_lseek.c [deleted file]
lib/libc/posix/_lstat.c [deleted file]
lib/libc/posix/_mkdir.c [deleted file]
lib/libc/posix/_mkfifo.c [deleted file]
lib/libc/posix/_mknod.c [deleted file]
lib/libc/posix/_mmap.c [deleted file]
lib/libc/posix/_nanosleep.c [deleted file]
lib/libc/posix/_open.c [deleted file]
lib/libc/posix/_opendir.c [deleted file]
lib/libc/posix/_pathconf.c [deleted file]
lib/libc/posix/_pause.c [deleted file]
lib/libc/posix/_pipe.c [deleted file]
lib/libc/posix/_ptrace.c [deleted file]
lib/libc/posix/_read.c [deleted file]
lib/libc/posix/_readdir.c [deleted file]
lib/libc/posix/_readlink.c [deleted file]
lib/libc/posix/_rename.c [deleted file]
lib/libc/posix/_rewinddir.c [deleted file]
lib/libc/posix/_rmdir.c [deleted file]
lib/libc/posix/_select.c [deleted file]
lib/libc/posix/_setgid.c [deleted file]
lib/libc/posix/_setitimer.c [deleted file]
lib/libc/posix/_setsid.c [deleted file]
lib/libc/posix/_setuid.c [deleted file]
lib/libc/posix/_sigaction.c [deleted file]
lib/libc/posix/_sigpending.c [deleted file]
lib/libc/posix/_sigprocmask.c [deleted file]
lib/libc/posix/_sigreturn.c [deleted file]
lib/libc/posix/_sigset.c [deleted file]
lib/libc/posix/_sigsuspend.c [deleted file]
lib/libc/posix/_sleep.c [deleted file]
lib/libc/posix/_stat.c [deleted file]
lib/libc/posix/_statvfs.c [deleted file]
lib/libc/posix/_stime.c [deleted file]
lib/libc/posix/_symlink.c [deleted file]
lib/libc/posix/_sync.c [deleted file]
lib/libc/posix/_tcdrain.c [deleted file]
lib/libc/posix/_tcflow.c [deleted file]
lib/libc/posix/_tcflush.c [deleted file]
lib/libc/posix/_tcgetattr.c [deleted file]
lib/libc/posix/_tcsendbreak.c [deleted file]
lib/libc/posix/_tcsetattr.c [deleted file]
lib/libc/posix/_time.c [deleted file]
lib/libc/posix/_times.c [deleted file]
lib/libc/posix/_truncate.c [deleted file]
lib/libc/posix/_ucontext.c [deleted file]
lib/libc/posix/_umask.c [deleted file]
lib/libc/posix/_uname.c [deleted file]
lib/libc/posix/_unlink.c [deleted file]
lib/libc/posix/_utime.c [deleted file]
lib/libc/posix/_wait.c [deleted file]
lib/libc/posix/_waitpid.c [deleted file]
lib/libc/posix/_write.c [deleted file]
lib/libc/posix/charclass.h [deleted file]
lib/libc/posix/fnmatch.c [deleted file]
lib/libc/posix/getloadavg.c [deleted file]
lib/libc/posix/getopt.c [deleted file]
lib/libc/posix/gettimeofday.c [deleted file]
lib/libc/posix/glob.c [deleted file]
lib/libc/posix/nice.c [deleted file]
lib/libc/posix/poll.c [deleted file]
lib/libc/posix/pread.c [deleted file]
lib/libc/posix/priority.c [deleted file]
lib/libc/posix/pwrite.c [deleted file]
lib/libc/posix/usleep.c [deleted file]
lib/libc/quad/Makefile.inc [moved from lib/nbsd_libc/quad/Makefile.inc with 100% similarity]
lib/libc/quad/TESTS/Makefile [moved from lib/nbsd_libc/quad/TESTS/Makefile with 100% similarity]
lib/libc/quad/TESTS/divrem.c [moved from lib/nbsd_libc/quad/TESTS/divrem.c with 100% similarity]
lib/libc/quad/TESTS/mul.c [moved from lib/nbsd_libc/quad/TESTS/mul.c with 100% similarity]
lib/libc/quad/fixdfdi.c [moved from lib/nbsd_libc/quad/fixdfdi.c with 100% similarity]
lib/libc/quad/fixsfdi.c [moved from lib/nbsd_libc/quad/fixsfdi.c with 100% similarity]
lib/libc/quad/fixunsdfdi.c [moved from lib/nbsd_libc/quad/fixunsdfdi.c with 100% similarity]
lib/libc/quad/fixunssfdi.c [moved from lib/nbsd_libc/quad/fixunssfdi.c with 100% similarity]
lib/libc/quad/floatdidf.c [moved from lib/nbsd_libc/quad/floatdidf.c with 100% similarity]
lib/libc/quad/floatdisf.c [moved from lib/nbsd_libc/quad/floatdisf.c with 100% similarity]
lib/libc/quad/floatunsdidf.c [moved from lib/nbsd_libc/quad/floatunsdidf.c with 100% similarity]
lib/libc/regex/COPYRIGHT
lib/libc/regex/Makefile.inc
lib/libc/regex/WHATSNEW [changed mode: 0755->0644]
lib/libc/regex/cclass.h
lib/libc/regex/cname.h
lib/libc/regex/engine.c
lib/libc/regex/re_format.7 [changed mode: 0755->0644]
lib/libc/regex/regcomp.c
lib/libc/regex/regerror.c
lib/libc/regex/regex.3 [changed mode: 0755->0644]
lib/libc/regex/regex2.h
lib/libc/regex/regexec.c
lib/libc/regex/regfree.c
lib/libc/regex/utils.h
lib/libc/resolv/Makefile.inc [moved from lib/nbsd_libc/resolv/Makefile.inc with 100% similarity]
lib/libc/resolv/__dn_comp.c [moved from lib/nbsd_libc/resolv/__dn_comp.c with 100% similarity]
lib/libc/resolv/__res_close.c [moved from lib/nbsd_libc/resolv/__res_close.c with 100% similarity]
lib/libc/resolv/__res_send.c [moved from lib/nbsd_libc/resolv/__res_send.c with 100% similarity]
lib/libc/resolv/h_errno.c [moved from lib/nbsd_libc/resolv/h_errno.c with 100% similarity]
lib/libc/resolv/herror.c [moved from lib/nbsd_libc/resolv/herror.c with 100% similarity]
lib/libc/resolv/mtctxres.c [moved from lib/nbsd_libc/resolv/mtctxres.c with 100% similarity]
lib/libc/resolv/res_comp.c [moved from lib/nbsd_libc/resolv/res_comp.c with 100% similarity]
lib/libc/resolv/res_compat.c [moved from lib/nbsd_libc/resolv/res_compat.c with 100% similarity]
lib/libc/resolv/res_data.c [moved from lib/nbsd_libc/resolv/res_data.c with 100% similarity]
lib/libc/resolv/res_debug.c [moved from lib/nbsd_libc/resolv/res_debug.c with 100% similarity]
lib/libc/resolv/res_debug.h [moved from lib/nbsd_libc/resolv/res_debug.h with 100% similarity]
lib/libc/resolv/res_init.c [moved from lib/nbsd_libc/resolv/res_init.c with 100% similarity]
lib/libc/resolv/res_mkquery.c [moved from lib/nbsd_libc/resolv/res_mkquery.c with 100% similarity]
lib/libc/resolv/res_private.h [moved from lib/nbsd_libc/resolv/res_private.h with 100% similarity]
lib/libc/resolv/res_query.c [moved from lib/nbsd_libc/resolv/res_query.c with 100% similarity]
lib/libc/resolv/res_send.c [moved from lib/nbsd_libc/resolv/res_send.c with 100% similarity]
lib/libc/resolv/res_state.c [moved from lib/nbsd_libc/resolv/res_state.c with 100% similarity]
lib/libc/rpc/DISCLAIMER [moved from lib/nbsd_libc/rpc/DISCLAIMER with 100% similarity]
lib/libc/rpc/Makefile.inc [moved from lib/nbsd_libc/rpc/Makefile.inc with 100% similarity]
lib/libc/rpc/README [moved from lib/nbsd_libc/rpc/README with 100% similarity]
lib/libc/rpc/__rpc_getxid.c [moved from lib/nbsd_libc/rpc/__rpc_getxid.c with 100% similarity]
lib/libc/rpc/auth_none.c [moved from lib/nbsd_libc/rpc/auth_none.c with 100% similarity]
lib/libc/rpc/auth_unix.c [moved from lib/nbsd_libc/rpc/auth_unix.c with 100% similarity]
lib/libc/rpc/authunix_prot.c [moved from lib/nbsd_libc/rpc/authunix_prot.c with 100% similarity]
lib/libc/rpc/bindresvport.3 [moved from lib/nbsd_libc/rpc/bindresvport.3 with 100% similarity]
lib/libc/rpc/bindresvport.c [moved from lib/nbsd_libc/rpc/bindresvport.c with 100% similarity]
lib/libc/rpc/clnt_bcast.c [moved from lib/nbsd_libc/rpc/clnt_bcast.c with 100% similarity]
lib/libc/rpc/clnt_dg.c [moved from lib/nbsd_libc/rpc/clnt_dg.c with 100% similarity]
lib/libc/rpc/clnt_generic.c [moved from lib/nbsd_libc/rpc/clnt_generic.c with 100% similarity]
lib/libc/rpc/clnt_perror.c [moved from lib/nbsd_libc/rpc/clnt_perror.c with 100% similarity]
lib/libc/rpc/clnt_raw.c [moved from lib/nbsd_libc/rpc/clnt_raw.c with 100% similarity]
lib/libc/rpc/clnt_simple.c [moved from lib/nbsd_libc/rpc/clnt_simple.c with 100% similarity]
lib/libc/rpc/clnt_vc.c [moved from lib/nbsd_libc/rpc/clnt_vc.c with 100% similarity]
lib/libc/rpc/getnetconfig.3 [moved from lib/nbsd_libc/rpc/getnetconfig.3 with 100% similarity]
lib/libc/rpc/getnetconfig.c [moved from lib/nbsd_libc/rpc/getnetconfig.c with 100% similarity]
lib/libc/rpc/getnetpath.3 [moved from lib/nbsd_libc/rpc/getnetpath.3 with 100% similarity]
lib/libc/rpc/getnetpath.c [moved from lib/nbsd_libc/rpc/getnetpath.c with 100% similarity]
lib/libc/rpc/getrpcent.3 [moved from lib/nbsd_libc/rpc/getrpcent.3 with 100% similarity]
lib/libc/rpc/getrpcent.c [moved from lib/nbsd_libc/rpc/getrpcent.c with 100% similarity]
lib/libc/rpc/getrpcport.3 [moved from lib/nbsd_libc/rpc/getrpcport.3 with 100% similarity]
lib/libc/rpc/getrpcport.c [moved from lib/nbsd_libc/rpc/getrpcport.c with 100% similarity]
lib/libc/rpc/mt_misc.c [moved from lib/nbsd_libc/rpc/mt_misc.c with 100% similarity]
lib/libc/rpc/pmap_clnt.c [moved from lib/nbsd_libc/rpc/pmap_clnt.c with 100% similarity]
lib/libc/rpc/pmap_getmaps.c [moved from lib/nbsd_libc/rpc/pmap_getmaps.c with 100% similarity]
lib/libc/rpc/pmap_getport.c [moved from lib/nbsd_libc/rpc/pmap_getport.c with 100% similarity]
lib/libc/rpc/pmap_prot.c [moved from lib/nbsd_libc/rpc/pmap_prot.c with 100% similarity]
lib/libc/rpc/pmap_prot2.c [moved from lib/nbsd_libc/rpc/pmap_prot2.c with 100% similarity]
lib/libc/rpc/pmap_rmt.c [moved from lib/nbsd_libc/rpc/pmap_rmt.c with 100% similarity]
lib/libc/rpc/rpc.3 [moved from lib/nbsd_libc/rpc/rpc.3 with 100% similarity]
lib/libc/rpc/rpc_callmsg.c [moved from lib/nbsd_libc/rpc/rpc_callmsg.c with 100% similarity]
lib/libc/rpc/rpc_clnt_auth.3 [moved from lib/nbsd_libc/rpc/rpc_clnt_auth.3 with 100% similarity]
lib/libc/rpc/rpc_clnt_calls.3 [moved from lib/nbsd_libc/rpc/rpc_clnt_calls.3 with 100% similarity]
lib/libc/rpc/rpc_clnt_create.3 [moved from lib/nbsd_libc/rpc/rpc_clnt_create.3 with 100% similarity]
lib/libc/rpc/rpc_commondata.c [moved from lib/nbsd_libc/rpc/rpc_commondata.c with 100% similarity]
lib/libc/rpc/rpc_dtablesize.c [moved from lib/nbsd_libc/rpc/rpc_dtablesize.c with 100% similarity]
lib/libc/rpc/rpc_generic.c [moved from lib/nbsd_libc/rpc/rpc_generic.c with 100% similarity]
lib/libc/rpc/rpc_internal.h [moved from lib/nbsd_libc/rpc/rpc_internal.h with 100% similarity]
lib/libc/rpc/rpc_prot.c [moved from lib/nbsd_libc/rpc/rpc_prot.c with 100% similarity]
lib/libc/rpc/rpc_soc.3 [moved from lib/nbsd_libc/rpc/rpc_soc.3 with 100% similarity]
lib/libc/rpc/rpc_soc.c [moved from lib/nbsd_libc/rpc/rpc_soc.c with 100% similarity]
lib/libc/rpc/rpc_svc_calls.3 [moved from lib/nbsd_libc/rpc/rpc_svc_calls.3 with 100% similarity]
lib/libc/rpc/rpc_svc_create.3 [moved from lib/nbsd_libc/rpc/rpc_svc_create.3 with 100% similarity]
lib/libc/rpc/rpc_svc_err.3 [moved from lib/nbsd_libc/rpc/rpc_svc_err.3 with 100% similarity]
lib/libc/rpc/rpc_svc_reg.3 [moved from lib/nbsd_libc/rpc/rpc_svc_reg.3 with 100% similarity]
lib/libc/rpc/rpc_xdr.3 [moved from lib/nbsd_libc/rpc/rpc_xdr.3 with 100% similarity]
lib/libc/rpc/rpcb_clnt.c [moved from lib/nbsd_libc/rpc/rpcb_clnt.c with 100% similarity]
lib/libc/rpc/rpcb_prot.c [moved from lib/nbsd_libc/rpc/rpcb_prot.c with 100% similarity]
lib/libc/rpc/rpcb_st_xdr.c [moved from lib/nbsd_libc/rpc/rpcb_st_xdr.c with 100% similarity]
lib/libc/rpc/rpcbind.3 [moved from lib/nbsd_libc/rpc/rpcbind.3 with 100% similarity]
lib/libc/rpc/svc.c [moved from lib/nbsd_libc/rpc/svc.c with 100% similarity]
lib/libc/rpc/svc_auth.c [moved from lib/nbsd_libc/rpc/svc_auth.c with 100% similarity]
lib/libc/rpc/svc_auth_unix.c [moved from lib/nbsd_libc/rpc/svc_auth_unix.c with 100% similarity]
lib/libc/rpc/svc_dg.c [moved from lib/nbsd_libc/rpc/svc_dg.c with 100% similarity]
lib/libc/rpc/svc_dg.h [moved from lib/nbsd_libc/rpc/svc_dg.h with 100% similarity]
lib/libc/rpc/svc_generic.c [moved from lib/nbsd_libc/rpc/svc_generic.c with 100% similarity]
lib/libc/rpc/svc_raw.c [moved from lib/nbsd_libc/rpc/svc_raw.c with 100% similarity]
lib/libc/rpc/svc_run.c [moved from lib/nbsd_libc/rpc/svc_run.c with 100% similarity]
lib/libc/rpc/svc_simple.c [moved from lib/nbsd_libc/rpc/svc_simple.c with 100% similarity]
lib/libc/rpc/svc_vc.c [moved from lib/nbsd_libc/rpc/svc_vc.c with 100% similarity]
lib/libc/rpc/xdr.3 [moved from lib/nbsd_libc/rpc/xdr.3 with 100% similarity]
lib/libc/rpc/xdr.c [moved from lib/nbsd_libc/rpc/xdr.c with 100% similarity]
lib/libc/rpc/xdr_array.c [moved from lib/nbsd_libc/rpc/xdr_array.c with 100% similarity]
lib/libc/rpc/xdr_float.c [moved from lib/nbsd_libc/rpc/xdr_float.c with 100% similarity]
lib/libc/rpc/xdr_mem.c [moved from lib/nbsd_libc/rpc/xdr_mem.c with 100% similarity]
lib/libc/rpc/xdr_rec.c [moved from lib/nbsd_libc/rpc/xdr_rec.c with 100% similarity]
lib/libc/rpc/xdr_reference.c [moved from lib/nbsd_libc/rpc/xdr_reference.c with 100% similarity]
lib/libc/rpc/xdr_stdio.c [moved from lib/nbsd_libc/rpc/xdr_stdio.c with 100% similarity]
lib/libc/shlib_version [moved from lib/nbsd_libc/shlib_version with 100% similarity]
lib/libc/softfloat/Makefile.inc [moved from lib/nbsd_libc/softfloat/Makefile.inc with 100% similarity]
lib/libc/softfloat/README.NetBSD [moved from lib/nbsd_libc/softfloat/README.NetBSD with 100% similarity]
lib/libc/softfloat/README.txt [moved from lib/nbsd_libc/softfloat/README.txt with 100% similarity]
lib/libc/softfloat/bits32/softfloat-macros [moved from lib/nbsd_libc/softfloat/bits32/softfloat-macros with 100% similarity]
lib/libc/softfloat/bits32/softfloat.c [moved from lib/nbsd_libc/softfloat/bits32/softfloat.c with 100% similarity]
lib/libc/softfloat/bits64/softfloat-macros [moved from lib/nbsd_libc/softfloat/bits64/softfloat-macros with 100% similarity]
lib/libc/softfloat/bits64/softfloat.c [moved from lib/nbsd_libc/softfloat/bits64/softfloat.c with 100% similarity]
lib/libc/softfloat/eqdf2.c [moved from lib/nbsd_libc/softfloat/eqdf2.c with 100% similarity]
lib/libc/softfloat/eqsf2.c [moved from lib/nbsd_libc/softfloat/eqsf2.c with 100% similarity]
lib/libc/softfloat/eqtf2.c [moved from lib/nbsd_libc/softfloat/eqtf2.c with 100% similarity]
lib/libc/softfloat/fpgetmask.c [moved from lib/nbsd_libc/softfloat/fpgetmask.c with 100% similarity]
lib/libc/softfloat/fpgetround.c [moved from lib/nbsd_libc/softfloat/fpgetround.c with 100% similarity]
lib/libc/softfloat/fpgetsticky.c [moved from lib/nbsd_libc/softfloat/fpgetsticky.c with 100% similarity]
lib/libc/softfloat/fpsetmask.c [moved from lib/nbsd_libc/softfloat/fpsetmask.c with 100% similarity]
lib/libc/softfloat/fpsetround.c [moved from lib/nbsd_libc/softfloat/fpsetround.c with 100% similarity]
lib/libc/softfloat/fpsetsticky.c [moved from lib/nbsd_libc/softfloat/fpsetsticky.c with 100% similarity]
lib/libc/softfloat/gedf2.c [moved from lib/nbsd_libc/softfloat/gedf2.c with 100% similarity]
lib/libc/softfloat/gesf2.c [moved from lib/nbsd_libc/softfloat/gesf2.c with 100% similarity]
lib/libc/softfloat/getf2.c [moved from lib/nbsd_libc/softfloat/getf2.c with 100% similarity]
lib/libc/softfloat/gexf2.c [moved from lib/nbsd_libc/softfloat/gexf2.c with 100% similarity]
lib/libc/softfloat/gtdf2.c [moved from lib/nbsd_libc/softfloat/gtdf2.c with 100% similarity]
lib/libc/softfloat/gtsf2.c [moved from lib/nbsd_libc/softfloat/gtsf2.c with 100% similarity]
lib/libc/softfloat/gttf2.c [moved from lib/nbsd_libc/softfloat/gttf2.c with 100% similarity]
lib/libc/softfloat/gtxf2.c [moved from lib/nbsd_libc/softfloat/gtxf2.c with 100% similarity]
lib/libc/softfloat/ledf2.c [moved from lib/nbsd_libc/softfloat/ledf2.c with 100% similarity]
lib/libc/softfloat/lesf2.c [moved from lib/nbsd_libc/softfloat/lesf2.c with 100% similarity]
lib/libc/softfloat/letf2.c [moved from lib/nbsd_libc/softfloat/letf2.c with 100% similarity]
lib/libc/softfloat/ltdf2.c [moved from lib/nbsd_libc/softfloat/ltdf2.c with 100% similarity]
lib/libc/softfloat/ltsf2.c [moved from lib/nbsd_libc/softfloat/ltsf2.c with 100% similarity]
lib/libc/softfloat/lttf2.c [moved from lib/nbsd_libc/softfloat/lttf2.c with 100% similarity]
lib/libc/softfloat/nedf2.c [moved from lib/nbsd_libc/softfloat/nedf2.c with 100% similarity]
lib/libc/softfloat/negdf2.c [moved from lib/nbsd_libc/softfloat/negdf2.c with 100% similarity]
lib/libc/softfloat/negsf2.c [moved from lib/nbsd_libc/softfloat/negsf2.c with 100% similarity]
lib/libc/softfloat/negtf2.c [moved from lib/nbsd_libc/softfloat/negtf2.c with 100% similarity]
lib/libc/softfloat/negxf2.c [moved from lib/nbsd_libc/softfloat/negxf2.c with 100% similarity]
lib/libc/softfloat/nesf2.c [moved from lib/nbsd_libc/softfloat/nesf2.c with 100% similarity]
lib/libc/softfloat/netf2.c [moved from lib/nbsd_libc/softfloat/netf2.c with 100% similarity]
lib/libc/softfloat/nexf2.c [moved from lib/nbsd_libc/softfloat/nexf2.c with 100% similarity]
lib/libc/softfloat/softfloat-for-gcc.h [moved from lib/nbsd_libc/softfloat/softfloat-for-gcc.h with 100% similarity]
lib/libc/softfloat/softfloat-history.txt [moved from lib/nbsd_libc/softfloat/softfloat-history.txt with 100% similarity]
lib/libc/softfloat/softfloat-source.txt [moved from lib/nbsd_libc/softfloat/softfloat-source.txt with 100% similarity]
lib/libc/softfloat/softfloat-specialize [moved from lib/nbsd_libc/softfloat/softfloat-specialize with 100% similarity]
lib/libc/softfloat/softfloat.txt [moved from lib/nbsd_libc/softfloat/softfloat.txt with 100% similarity]
lib/libc/softfloat/templates/milieu.h [moved from lib/nbsd_libc/softfloat/templates/milieu.h with 100% similarity]
lib/libc/softfloat/templates/softfloat-specialize [moved from lib/nbsd_libc/softfloat/templates/softfloat-specialize with 100% similarity]
lib/libc/softfloat/templates/softfloat.h [moved from lib/nbsd_libc/softfloat/templates/softfloat.h with 100% similarity]
lib/libc/softfloat/timesoftfloat.c [moved from lib/nbsd_libc/softfloat/timesoftfloat.c with 100% similarity]
lib/libc/softfloat/timesoftfloat.txt [moved from lib/nbsd_libc/softfloat/timesoftfloat.txt with 100% similarity]
lib/libc/softfloat/unorddf2.c [moved from lib/nbsd_libc/softfloat/unorddf2.c with 100% similarity]
lib/libc/softfloat/unordsf2.c [moved from lib/nbsd_libc/softfloat/unordsf2.c with 100% similarity]
lib/libc/ssp/Makefile.inc [moved from lib/nbsd_libc/ssp/Makefile.inc with 100% similarity]
lib/libc/ssp/__builtin_object_size.3 [moved from lib/nbsd_libc/ssp/__builtin_object_size.3 with 100% similarity]
lib/libc/ssp/fgets_chk.c [moved from lib/nbsd_libc/ssp/fgets_chk.c with 100% similarity]
lib/libc/ssp/gets_chk.c [moved from lib/nbsd_libc/ssp/gets_chk.c with 100% similarity]
lib/libc/ssp/memcpy_chk.c [moved from lib/nbsd_libc/ssp/memcpy_chk.c with 100% similarity]
lib/libc/ssp/memmove_chk.c [moved from lib/nbsd_libc/ssp/memmove_chk.c with 100% similarity]
lib/libc/ssp/memset_chk.c [moved from lib/nbsd_libc/ssp/memset_chk.c with 100% similarity]
lib/libc/ssp/snprintf_chk.c [moved from lib/nbsd_libc/ssp/snprintf_chk.c with 100% similarity]
lib/libc/ssp/sprintf_chk.c [moved from lib/nbsd_libc/ssp/sprintf_chk.c with 100% similarity]
lib/libc/ssp/ssp.3 [moved from lib/nbsd_libc/ssp/ssp.3 with 100% similarity]
lib/libc/ssp/strcat_chk.c [moved from lib/nbsd_libc/ssp/strcat_chk.c with 100% similarity]
lib/libc/ssp/strcpy_chk.c [moved from lib/nbsd_libc/ssp/strcpy_chk.c with 100% similarity]
lib/libc/ssp/strncat_chk.c [moved from lib/nbsd_libc/ssp/strncat_chk.c with 100% similarity]
lib/libc/ssp/strncpy_chk.c [moved from lib/nbsd_libc/ssp/strncpy_chk.c with 100% similarity]
lib/libc/ssp/vsnprintf_chk.c [moved from lib/nbsd_libc/ssp/vsnprintf_chk.c with 100% similarity]
lib/libc/ssp/vsprintf_chk.c [moved from lib/nbsd_libc/ssp/vsprintf_chk.c with 100% similarity]
lib/libc/stdio/Makefile.inc
lib/libc/stdio/_fileno.c [moved from lib/nbsd_libc/stdio/_fileno.c with 100% similarity]
lib/libc/stdio/_fseeko.c [moved from lib/nbsd_libc/stdio/_fseeko.c with 100% similarity]
lib/libc/stdio/_ftello.c [moved from lib/nbsd_libc/stdio/_ftello.c with 100% similarity]
lib/libc/stdio/asprintf.c
lib/libc/stdio/clearerr.c [deleted file]
lib/libc/stdio/clrerr.c [moved from lib/nbsd_libc/stdio/clrerr.c with 100% similarity]
lib/libc/stdio/data.c [deleted file]
lib/libc/stdio/doprnt.c [deleted file]
lib/libc/stdio/doscan.c [deleted file]
lib/libc/stdio/dprintf.c [moved from lib/nbsd_libc/stdio/dprintf.c with 100% similarity]
lib/libc/stdio/ecvt.c [deleted file]
lib/libc/stdio/fclose.3 [moved from lib/nbsd_libc/stdio/fclose.3 with 100% similarity]
lib/libc/stdio/fclose.c
lib/libc/stdio/fdopen.c [moved from lib/nbsd_libc/stdio/fdopen.c with 100% similarity]
lib/libc/stdio/feof.c
lib/libc/stdio/ferror.3 [moved from lib/nbsd_libc/stdio/ferror.3 with 100% similarity]
lib/libc/stdio/ferror.c
lib/libc/stdio/fflush.3 [moved from lib/nbsd_libc/stdio/fflush.3 with 100% similarity]
lib/libc/stdio/fflush.c
lib/libc/stdio/fgetc.c
lib/libc/stdio/fgetln.3 [moved from lib/nbsd_libc/stdio/fgetln.3 with 100% similarity]
lib/libc/stdio/fgetln.c [moved from lib/nbsd_libc/stdio/fgetln.c with 100% similarity]
lib/libc/stdio/fgetpos.c
lib/libc/stdio/fgets.3 [moved from lib/nbsd_libc/stdio/fgets.3 with 100% similarity]
lib/libc/stdio/fgets.c
lib/libc/stdio/fgetstr.c [moved from lib/nbsd_libc/stdio/fgetstr.c with 100% similarity]
lib/libc/stdio/fgetwc.c [moved from lib/nbsd_libc/stdio/fgetwc.c with 100% similarity]
lib/libc/stdio/fgetwln.3 [moved from lib/nbsd_libc/stdio/fgetwln.3 with 100% similarity]
lib/libc/stdio/fgetwln.c [moved from lib/nbsd_libc/stdio/fgetwln.c with 100% similarity]
lib/libc/stdio/fgetws.3 [moved from lib/nbsd_libc/stdio/fgetws.3 with 100% similarity]
lib/libc/stdio/fgetws.c [moved from lib/nbsd_libc/stdio/fgetws.c with 100% similarity]
lib/libc/stdio/fileext.h [moved from lib/nbsd_libc/stdio/fileext.h with 100% similarity]
lib/libc/stdio/fileno.c
lib/libc/stdio/fillbuf.c [deleted file]
lib/libc/stdio/findfp.c [moved from lib/nbsd_libc/stdio/findfp.c with 100% similarity]
lib/libc/stdio/flags.c [moved from lib/nbsd_libc/stdio/flags.c with 100% similarity]
lib/libc/stdio/floatio.h [moved from lib/nbsd_libc/stdio/floatio.h with 100% similarity]
lib/libc/stdio/flockfile.3 [moved from lib/nbsd_libc/stdio/flockfile.3 with 100% similarity]
lib/libc/stdio/flockfile.c [moved from lib/nbsd_libc/stdio/flockfile.c with 100% similarity]
lib/libc/stdio/flushbuf.c [deleted file]
lib/libc/stdio/fmemopen.3 [moved from lib/nbsd_libc/stdio/fmemopen.3 with 100% similarity]
lib/libc/stdio/fmemopen.c [moved from lib/nbsd_libc/stdio/fmemopen.c with 100% similarity]
lib/libc/stdio/fopen.3 [moved from lib/nbsd_libc/stdio/fopen.3 with 100% similarity]
lib/libc/stdio/fopen.c
lib/libc/stdio/fparseln.3 [moved from lib/nbsd_libc/stdio/fparseln.3 with 100% similarity]
lib/libc/stdio/fparseln.c [moved from lib/nbsd_libc/stdio/fparseln.c with 100% similarity]
lib/libc/stdio/fprintf.c
lib/libc/stdio/fpurge.c [moved from lib/nbsd_libc/stdio/fpurge.c with 100% similarity]
lib/libc/stdio/fputc.c
lib/libc/stdio/fputs.3 [moved from lib/nbsd_libc/stdio/fputs.3 with 100% similarity]
lib/libc/stdio/fputs.c
lib/libc/stdio/fputwc.c [moved from lib/nbsd_libc/stdio/fputwc.c with 100% similarity]
lib/libc/stdio/fputws.3 [moved from lib/nbsd_libc/stdio/fputws.3 with 100% similarity]
lib/libc/stdio/fputws.c [moved from lib/nbsd_libc/stdio/fputws.c with 100% similarity]
lib/libc/stdio/fread.3 [moved from lib/nbsd_libc/stdio/fread.3 with 100% similarity]
lib/libc/stdio/fread.c
lib/libc/stdio/freopen.c
lib/libc/stdio/fscanf.c
lib/libc/stdio/fseek.3 [moved from lib/nbsd_libc/stdio/fseek.3 with 100% similarity]
lib/libc/stdio/fseek.c
lib/libc/stdio/fseeko.c [moved from lib/nbsd_libc/stdio/fseeko.c with 100% similarity]
lib/libc/stdio/fsetpos.c
lib/libc/stdio/ftell.c
lib/libc/stdio/ftello.c [moved from lib/nbsd_libc/stdio/ftello.c with 100% similarity]
lib/libc/stdio/funopen.3 [moved from lib/nbsd_libc/stdio/funopen.3 with 100% similarity]
lib/libc/stdio/funopen.c [moved from lib/nbsd_libc/stdio/funopen.c with 100% similarity]
lib/libc/stdio/fvwrite.c [moved from lib/nbsd_libc/stdio/fvwrite.c with 100% similarity]
lib/libc/stdio/fvwrite.h [moved from lib/nbsd_libc/stdio/fvwrite.h with 100% similarity]
lib/libc/stdio/fwalk.c [moved from lib/nbsd_libc/stdio/fwalk.c with 100% similarity]
lib/libc/stdio/fwide.3 [moved from lib/nbsd_libc/stdio/fwide.3 with 100% similarity]
lib/libc/stdio/fwide.c [moved from lib/nbsd_libc/stdio/fwide.c with 100% similarity]
lib/libc/stdio/fwprintf.c [moved from lib/nbsd_libc/stdio/fwprintf.c with 100% similarity]
lib/libc/stdio/fwrite.c
lib/libc/stdio/fwscanf.c [moved from lib/nbsd_libc/stdio/fwscanf.c with 100% similarity]
lib/libc/stdio/getc.3 [moved from lib/nbsd_libc/stdio/getc.3 with 100% similarity]
lib/libc/stdio/getc.c
lib/libc/stdio/getchar.c
lib/libc/stdio/getdelim.3 [moved from lib/nbsd_libc/stdio/getdelim.3 with 100% similarity]
lib/libc/stdio/getdelim.c [moved from lib/nbsd_libc/stdio/getdelim.c with 100% similarity]
lib/libc/stdio/getline.c [moved from lib/nbsd_libc/stdio/getline.c with 100% similarity]
lib/libc/stdio/gets.c
lib/libc/stdio/gettemp.c [moved from lib/nbsd_libc/stdio/gettemp.c with 100% similarity]
lib/libc/stdio/getw.c [moved from lib/nbsd_libc/stdio/getw.c with 100% similarity]
lib/libc/stdio/getwc.3 [moved from lib/nbsd_libc/stdio/getwc.3 with 100% similarity]
lib/libc/stdio/getwc.c [moved from lib/nbsd_libc/stdio/getwc.c with 100% similarity]
lib/libc/stdio/getwchar.c [moved from lib/nbsd_libc/stdio/getwchar.c with 100% similarity]
lib/libc/stdio/glue.h [moved from lib/nbsd_libc/stdio/glue.h with 100% similarity]
lib/libc/stdio/icompute.c [deleted file]
lib/libc/stdio/loc_incl.h [deleted file]
lib/libc/stdio/local.h [moved from lib/nbsd_libc/stdio/local.h with 100% similarity]
lib/libc/stdio/makebuf.c [moved from lib/nbsd_libc/stdio/makebuf.c with 100% similarity]
lib/libc/stdio/mkdtemp.c [moved from lib/nbsd_libc/stdio/mkdtemp.c with 100% similarity]
lib/libc/stdio/mkstemp.c [moved from lib/nbsd_libc/stdio/mkstemp.c with 100% similarity]
lib/libc/stdio/mktemp.3 [moved from lib/nbsd_libc/stdio/mktemp.3 with 100% similarity]
lib/libc/stdio/mktemp.c
lib/libc/stdio/perror.c
lib/libc/stdio/printf.3 [moved from lib/nbsd_libc/stdio/printf.3 with 100% similarity]
lib/libc/stdio/printf.c
lib/libc/stdio/putc.3 [moved from lib/nbsd_libc/stdio/putc.3 with 100% similarity]
lib/libc/stdio/putc.c
lib/libc/stdio/putchar.c
lib/libc/stdio/puts.c
lib/libc/stdio/putw.c [moved from lib/nbsd_libc/stdio/putw.c with 100% similarity]
lib/libc/stdio/putwc.3 [moved from lib/nbsd_libc/stdio/putwc.3 with 100% similarity]
lib/libc/stdio/putwc.c [moved from lib/nbsd_libc/stdio/putwc.c with 100% similarity]
lib/libc/stdio/putwchar.c [moved from lib/nbsd_libc/stdio/putwchar.c with 100% similarity]
lib/libc/stdio/refill.c [moved from lib/nbsd_libc/stdio/refill.c with 100% similarity]
lib/libc/stdio/remove.3 [moved from lib/nbsd_libc/stdio/remove.3 with 100% similarity]
lib/libc/stdio/remove.c
lib/libc/stdio/rewind.c
lib/libc/stdio/rget.c [moved from lib/nbsd_libc/stdio/rget.c with 100% similarity]
lib/libc/stdio/scanf.3 [moved from lib/nbsd_libc/stdio/scanf.3 with 100% similarity]
lib/libc/stdio/scanf.c
lib/libc/stdio/setbuf.3 [moved from lib/nbsd_libc/stdio/setbuf.3 with 100% similarity]
lib/libc/stdio/setbuf.c
lib/libc/stdio/setbuffer.c [moved from lib/nbsd_libc/stdio/setbuffer.c with 100% similarity]
lib/libc/stdio/setvbuf.c
lib/libc/stdio/snprintf.c
lib/libc/stdio/snprintf_ss.c [moved from lib/nbsd_libc/stdio/snprintf_ss.c with 100% similarity]
lib/libc/stdio/sprintf.c
lib/libc/stdio/sscanf.c
lib/libc/stdio/stdio.3 [moved from lib/nbsd_libc/stdio/stdio.3 with 100% similarity]
lib/libc/stdio/stdio.c [moved from lib/nbsd_libc/stdio/stdio.c with 100% similarity]
lib/libc/stdio/swprintf.c [moved from lib/nbsd_libc/stdio/swprintf.c with 100% similarity]
lib/libc/stdio/swscanf.c [moved from lib/nbsd_libc/stdio/swscanf.c with 100% similarity]
lib/libc/stdio/tempnam.c [moved from lib/nbsd_libc/stdio/tempnam.c with 100% similarity]
lib/libc/stdio/tmpfile.c
lib/libc/stdio/tmpnam.3 [moved from lib/nbsd_libc/stdio/tmpnam.3 with 100% similarity]
lib/libc/stdio/tmpnam.c
lib/libc/stdio/ungetc.3 [moved from lib/nbsd_libc/stdio/ungetc.3 with 100% similarity]
lib/libc/stdio/ungetc.c
lib/libc/stdio/ungetwc.3 [moved from lib/nbsd_libc/stdio/ungetwc.3 with 100% similarity]
lib/libc/stdio/ungetwc.c [moved from lib/nbsd_libc/stdio/ungetwc.c with 100% similarity]
lib/libc/stdio/vasprintf.c [moved from lib/nbsd_libc/stdio/vasprintf.c with 100% similarity]
lib/libc/stdio/vdprintf.c [moved from lib/nbsd_libc/stdio/vdprintf.c with 100% similarity]
lib/libc/stdio/vfprintf.c
lib/libc/stdio/vfscanf.c [moved from lib/nbsd_libc/stdio/vfscanf.c with 100% similarity]
lib/libc/stdio/vfwprintf.c [moved from lib/nbsd_libc/stdio/vfwprintf.c with 100% similarity]
lib/libc/stdio/vfwscanf.c [moved from lib/nbsd_libc/stdio/vfwscanf.c with 100% similarity]
lib/libc/stdio/vprintf.c
lib/libc/stdio/vscanf.c
lib/libc/stdio/vsnprintf.c
lib/libc/stdio/vsnprintf_ss.c [moved from lib/nbsd_libc/stdio/vsnprintf_ss.c with 100% similarity]
lib/libc/stdio/vsprintf.c
lib/libc/stdio/vsscanf.c
lib/libc/stdio/vswprintf.c [moved from lib/nbsd_libc/stdio/vswprintf.c with 100% similarity]
lib/libc/stdio/vswscanf.c [moved from lib/nbsd_libc/stdio/vswscanf.c with 100% similarity]
lib/libc/stdio/vwprintf.c [moved from lib/nbsd_libc/stdio/vwprintf.c with 100% similarity]
lib/libc/stdio/vwscanf.c [moved from lib/nbsd_libc/stdio/vwscanf.c with 100% similarity]
lib/libc/stdio/wbuf.c [moved from lib/nbsd_libc/stdio/wbuf.c with 100% similarity]
lib/libc/stdio/wcio.h [moved from lib/nbsd_libc/stdio/wcio.h with 100% similarity]
lib/libc/stdio/wprintf.3 [moved from lib/nbsd_libc/stdio/wprintf.3 with 100% similarity]
lib/libc/stdio/wprintf.c [moved from lib/nbsd_libc/stdio/wprintf.c with 100% similarity]
lib/libc/stdio/wscanf.3 [moved from lib/nbsd_libc/stdio/wscanf.3 with 100% similarity]
lib/libc/stdio/wscanf.c [moved from lib/nbsd_libc/stdio/wscanf.c with 100% similarity]
lib/libc/stdio/wsetup.c [moved from lib/nbsd_libc/stdio/wsetup.c with 100% similarity]
lib/libc/stdlib/Lint_abs.c [moved from lib/nbsd_libc/stdlib/Lint_abs.c with 100% similarity]
lib/libc/stdlib/Lint_div.c [moved from lib/nbsd_libc/stdlib/Lint_div.c with 100% similarity]
lib/libc/stdlib/Lint_imaxabs.c [moved from lib/nbsd_libc/stdlib/Lint_imaxabs.c with 100% similarity]
lib/libc/stdlib/Lint_labs.c [moved from lib/nbsd_libc/stdlib/Lint_labs.c with 100% similarity]
lib/libc/stdlib/Lint_ldiv.c [moved from lib/nbsd_libc/stdlib/Lint_ldiv.c with 100% similarity]
lib/libc/stdlib/Lint_llabs.c [moved from lib/nbsd_libc/stdlib/Lint_llabs.c with 100% similarity]
lib/libc/stdlib/Makefile.inc [moved from lib/nbsd_libc/stdlib/Makefile.inc with 96% similarity]
lib/libc/stdlib/_env.c [moved from lib/nbsd_libc/stdlib/_env.c with 100% similarity]
lib/libc/stdlib/_rand48.c [moved from lib/nbsd_libc/stdlib/_rand48.c with 100% similarity]
lib/libc/stdlib/a64l.3 [moved from lib/nbsd_libc/stdlib/a64l.3 with 100% similarity]
lib/libc/stdlib/a64l.c [moved from lib/nbsd_libc/stdlib/a64l.c with 100% similarity]
lib/libc/stdlib/abort.3 [moved from lib/nbsd_libc/stdlib/abort.3 with 100% similarity]
lib/libc/stdlib/abort.c [moved from lib/nbsd_libc/stdlib/abort.c with 100% similarity]
lib/libc/stdlib/abs.3 [moved from lib/nbsd_libc/stdlib/abs.3 with 100% similarity]
lib/libc/stdlib/abs.c [moved from lib/nbsd_libc/stdlib/abs.c with 100% similarity]
lib/libc/stdlib/alloca.3 [moved from lib/nbsd_libc/stdlib/alloca.3 with 100% similarity]
lib/libc/stdlib/atexit.3 [moved from lib/nbsd_libc/stdlib/atexit.3 with 100% similarity]
lib/libc/stdlib/atexit.c [moved from lib/nbsd_libc/stdlib/atexit.c with 100% similarity]
lib/libc/stdlib/atexit.h [moved from lib/nbsd_libc/stdlib/atexit.h with 100% similarity]
lib/libc/stdlib/atof.3 [moved from lib/nbsd_libc/stdlib/atof.3 with 100% similarity]
lib/libc/stdlib/atof.c [moved from lib/nbsd_libc/stdlib/atof.c with 100% similarity]
lib/libc/stdlib/atoi.3 [moved from lib/nbsd_libc/stdlib/atoi.3 with 100% similarity]
lib/libc/stdlib/atoi.c [moved from lib/nbsd_libc/stdlib/atoi.c with 100% similarity]
lib/libc/stdlib/atol.3 [moved from lib/nbsd_libc/stdlib/atol.3 with 100% similarity]
lib/libc/stdlib/atol.c [moved from lib/nbsd_libc/stdlib/atol.c with 100% similarity]
lib/libc/stdlib/atoll.3 [moved from lib/nbsd_libc/stdlib/atoll.3 with 100% similarity]
lib/libc/stdlib/atoll.c [moved from lib/nbsd_libc/stdlib/atoll.c with 100% similarity]
lib/libc/stdlib/bsearch.3 [moved from lib/nbsd_libc/stdlib/bsearch.3 with 100% similarity]
lib/libc/stdlib/bsearch.c [moved from lib/nbsd_libc/stdlib/bsearch.c with 100% similarity]
lib/libc/stdlib/div.3 [moved from lib/nbsd_libc/stdlib/div.3 with 100% similarity]
lib/libc/stdlib/div.c [moved from lib/nbsd_libc/stdlib/div.c with 100% similarity]
lib/libc/stdlib/drand48.c [moved from lib/nbsd_libc/stdlib/drand48.c with 100% similarity]
lib/libc/stdlib/erand48.c [moved from lib/nbsd_libc/stdlib/erand48.c with 100% similarity]
lib/libc/stdlib/erand48_ieee754.c [moved from lib/nbsd_libc/stdlib/erand48_ieee754.c with 100% similarity]
lib/libc/stdlib/exit.3 [moved from lib/nbsd_libc/stdlib/exit.3 with 100% similarity]
lib/libc/stdlib/exit.c [moved from lib/nbsd_libc/stdlib/exit.c with 100% similarity]
lib/libc/stdlib/getenv.3 [moved from lib/nbsd_libc/stdlib/getenv.3 with 100% similarity]
lib/libc/stdlib/getenv.c [moved from lib/nbsd_libc/stdlib/getenv.c with 100% similarity]
lib/libc/stdlib/getopt.3 [moved from lib/nbsd_libc/stdlib/getopt.3 with 100% similarity]
lib/libc/stdlib/getopt.c [moved from lib/nbsd_libc/stdlib/getopt.c with 100% similarity]
lib/libc/stdlib/getopt_long.3 [moved from lib/nbsd_libc/stdlib/getopt_long.3 with 100% similarity]
lib/libc/stdlib/getopt_long.c [moved from lib/nbsd_libc/stdlib/getopt_long.c with 100% similarity]
lib/libc/stdlib/getsubopt.3 [moved from lib/nbsd_libc/stdlib/getsubopt.3 with 100% similarity]
lib/libc/stdlib/getsubopt.c [moved from lib/nbsd_libc/stdlib/getsubopt.c with 100% similarity]
lib/libc/stdlib/grantpt.3 [moved from lib/nbsd_libc/stdlib/grantpt.3 with 100% similarity]
lib/libc/stdlib/hcreate.3 [moved from lib/nbsd_libc/stdlib/hcreate.3 with 100% similarity]
lib/libc/stdlib/hcreate.c [moved from lib/nbsd_libc/stdlib/hcreate.c with 100% similarity]
lib/libc/stdlib/imaxabs.3 [moved from lib/nbsd_libc/stdlib/imaxabs.3 with 100% similarity]
lib/libc/stdlib/imaxabs.c [moved from lib/nbsd_libc/stdlib/imaxabs.c with 100% similarity]
lib/libc/stdlib/imaxdiv.3 [moved from lib/nbsd_libc/stdlib/imaxdiv.3 with 100% similarity]
lib/libc/stdlib/imaxdiv.c [moved from lib/nbsd_libc/stdlib/imaxdiv.c with 100% similarity]
lib/libc/stdlib/insque.3 [moved from lib/nbsd_libc/stdlib/insque.3 with 100% similarity]
lib/libc/stdlib/insque.c [moved from lib/nbsd_libc/stdlib/insque.c with 100% similarity]
lib/libc/stdlib/jemalloc.3 [moved from lib/nbsd_libc/stdlib/jemalloc.3 with 100% similarity]
lib/libc/stdlib/jemalloc.c [moved from lib/nbsd_libc/stdlib/jemalloc.c with 100% similarity]
lib/libc/stdlib/jrand48.c [moved from lib/nbsd_libc/stdlib/jrand48.c with 100% similarity]
lib/libc/stdlib/l64a.c [moved from lib/nbsd_libc/stdlib/l64a.c with 100% similarity]
lib/libc/stdlib/labs.3 [moved from lib/nbsd_libc/stdlib/labs.3 with 100% similarity]
lib/libc/stdlib/labs.c [moved from lib/nbsd_libc/stdlib/labs.c with 100% similarity]
lib/libc/stdlib/lcong48.c [moved from lib/nbsd_libc/stdlib/lcong48.c with 100% similarity]
lib/libc/stdlib/ldiv.3 [moved from lib/nbsd_libc/stdlib/ldiv.3 with 100% similarity]
lib/libc/stdlib/ldiv.c [moved from lib/nbsd_libc/stdlib/ldiv.c with 100% similarity]
lib/libc/stdlib/llabs.3 [moved from lib/nbsd_libc/stdlib/llabs.3 with 100% similarity]
lib/libc/stdlib/llabs.c [moved from lib/nbsd_libc/stdlib/llabs.c with 100% similarity]
lib/libc/stdlib/lldiv.3 [moved from lib/nbsd_libc/stdlib/lldiv.3 with 100% similarity]
lib/libc/stdlib/lldiv.c [moved from lib/nbsd_libc/stdlib/lldiv.c with 100% similarity]
lib/libc/stdlib/local.h [moved from lib/nbsd_libc/stdlib/local.h with 100% similarity]
lib/libc/stdlib/lrand48.c [moved from lib/nbsd_libc/stdlib/lrand48.c with 100% similarity]
lib/libc/stdlib/lsearch.3 [moved from lib/nbsd_libc/stdlib/lsearch.3 with 100% similarity]
lib/libc/stdlib/lsearch.c [moved from lib/nbsd_libc/stdlib/lsearch.c with 100% similarity]
lib/libc/stdlib/malloc.3 [moved from lib/nbsd_libc/stdlib/malloc.3 with 100% similarity]
lib/libc/stdlib/malloc.c [moved from lib/nbsd_libc/stdlib/malloc.c with 100% similarity]
lib/libc/stdlib/memory.3 [moved from lib/nbsd_libc/stdlib/memory.3 with 100% similarity]
lib/libc/stdlib/merge.c [moved from lib/nbsd_libc/stdlib/merge.c with 100% similarity]
lib/libc/stdlib/mi_vector_hash.3 [moved from lib/nbsd_libc/stdlib/mi_vector_hash.3 with 100% similarity]
lib/libc/stdlib/mi_vector_hash.c [moved from lib/nbsd_libc/stdlib/mi_vector_hash.c with 100% similarity]
lib/libc/stdlib/mrand48.c [moved from lib/nbsd_libc/stdlib/mrand48.c with 100% similarity]
lib/libc/stdlib/nrand48.c [moved from lib/nbsd_libc/stdlib/nrand48.c with 100% similarity]
lib/libc/stdlib/posix_memalign.3 [moved from lib/nbsd_libc/stdlib/posix_memalign.3 with 100% similarity]
lib/libc/stdlib/posix_openpt.3 [moved from lib/nbsd_libc/stdlib/posix_openpt.3 with 100% similarity]
lib/libc/stdlib/posix_openpt.c [moved from lib/nbsd_libc/stdlib/posix_openpt.c with 100% similarity]
lib/libc/stdlib/ptsname.3 [moved from lib/nbsd_libc/stdlib/ptsname.3 with 100% similarity]
lib/libc/stdlib/pty.c [moved from lib/nbsd_libc/stdlib/pty.c with 100% similarity]
lib/libc/stdlib/putenv.c [moved from lib/nbsd_libc/stdlib/putenv.c with 100% similarity]
lib/libc/stdlib/qabs.3 [moved from lib/nbsd_libc/stdlib/qabs.3 with 100% similarity]
lib/libc/stdlib/qabs.c [moved from lib/nbsd_libc/stdlib/qabs.c with 100% similarity]
lib/libc/stdlib/qdiv.3 [moved from lib/nbsd_libc/stdlib/qdiv.3 with 100% similarity]
lib/libc/stdlib/qdiv.c [moved from lib/nbsd_libc/stdlib/qdiv.c with 100% similarity]
lib/libc/stdlib/qsort.3 [moved from lib/nbsd_libc/stdlib/qsort.3 with 100% similarity]
lib/libc/stdlib/qsort.c [moved from lib/nbsd_libc/stdlib/qsort.c with 100% similarity]
lib/libc/stdlib/radixsort.3 [moved from lib/nbsd_libc/stdlib/radixsort.3 with 100% similarity]
lib/libc/stdlib/radixsort.c [moved from lib/nbsd_libc/stdlib/radixsort.c with 100% similarity]
lib/libc/stdlib/rand.3 [moved from lib/nbsd_libc/stdlib/rand.3 with 100% similarity]
lib/libc/stdlib/rand.c [moved from lib/nbsd_libc/stdlib/rand.c with 100% similarity]
lib/libc/stdlib/rand48.3 [moved from lib/nbsd_libc/stdlib/rand48.3 with 100% similarity]
lib/libc/stdlib/rand48.h [moved from lib/nbsd_libc/stdlib/rand48.h with 100% similarity]
lib/libc/stdlib/rand_r.c [moved from lib/nbsd_libc/stdlib/rand_r.c with 100% similarity]
lib/libc/stdlib/random.3 [moved from lib/nbsd_libc/stdlib/random.3 with 100% similarity]
lib/libc/stdlib/remque.c [moved from lib/nbsd_libc/stdlib/remque.c with 100% similarity]
lib/libc/stdlib/seed48.c [moved from lib/nbsd_libc/stdlib/seed48.c with 100% similarity]
lib/libc/stdlib/setenv.c [moved from lib/nbsd_libc/stdlib/setenv.c with 100% similarity]
lib/libc/stdlib/srand48.c [moved from lib/nbsd_libc/stdlib/srand48.c with 100% similarity]
lib/libc/stdlib/strfmon.3 [moved from lib/nbsd_libc/stdlib/strfmon.3 with 100% similarity]
lib/libc/stdlib/strfmon.c [moved from lib/nbsd_libc/stdlib/strfmon.c with 100% similarity]
lib/libc/stdlib/strsuftoll.3 [moved from lib/nbsd_libc/stdlib/strsuftoll.3 with 100% similarity]
lib/libc/stdlib/strsuftoll.c [moved from lib/nbsd_libc/stdlib/strsuftoll.c with 100% similarity]
lib/libc/stdlib/strtod.3 [moved from lib/nbsd_libc/stdlib/strtod.3 with 100% similarity]
lib/libc/stdlib/strtoimax.c [moved from lib/nbsd_libc/stdlib/strtoimax.c with 100% similarity]
lib/libc/stdlib/strtol.3 [moved from lib/nbsd_libc/stdlib/strtol.3 with 100% similarity]
lib/libc/stdlib/strtol.c [moved from lib/nbsd_libc/stdlib/strtol.c with 100% similarity]
lib/libc/stdlib/strtoq.c [moved from lib/nbsd_libc/stdlib/strtoq.c with 100% similarity]
lib/libc/stdlib/strtoul.3 [moved from lib/nbsd_libc/stdlib/strtoul.3 with 100% similarity]
lib/libc/stdlib/strtouq.c [moved from lib/nbsd_libc/stdlib/strtouq.c with 100% similarity]
lib/libc/stdlib/system.3 [moved from lib/nbsd_libc/stdlib/system.3 with 100% similarity]
lib/libc/stdlib/system.c [moved from lib/nbsd_libc/stdlib/system.c with 100% similarity]
lib/libc/stdlib/tdelete.c [moved from lib/nbsd_libc/stdlib/tdelete.c with 100% similarity]
lib/libc/stdlib/tfind.c [moved from lib/nbsd_libc/stdlib/tfind.c with 100% similarity]
lib/libc/stdlib/tsearch.3 [moved from lib/nbsd_libc/stdlib/tsearch.3 with 100% similarity]
lib/libc/stdlib/tsearch.c [moved from lib/nbsd_libc/stdlib/tsearch.c with 100% similarity]
lib/libc/stdlib/twalk.c [moved from lib/nbsd_libc/stdlib/twalk.c with 100% similarity]
lib/libc/stdlib/unlockpt.3 [moved from lib/nbsd_libc/stdlib/unlockpt.3 with 100% similarity]
lib/libc/stdlib/unsetenv.c [moved from lib/nbsd_libc/stdlib/unsetenv.c with 100% similarity]
lib/libc/stdtime/Makefile.inc [deleted file]
lib/libc/stdtime/asctime.c [deleted file]
lib/libc/stdtime/date.1 [deleted file]
lib/libc/stdtime/date.c [deleted file]
lib/libc/stdtime/difftime.c [deleted file]
lib/libc/stdtime/ftime.c [deleted file]
lib/libc/stdtime/ialloc.c [deleted file]
lib/libc/stdtime/localtime.c [deleted file]
lib/libc/stdtime/logwtmp.c [deleted file]
lib/libc/stdtime/private.h [deleted file]
lib/libc/stdtime/scheck.c [deleted file]
lib/libc/stdtime/strftime.c [deleted file]
lib/libc/stdtime/strptime.c [deleted file]
lib/libc/stdtime/zdump.8 [deleted file]
lib/libc/stdtime/zdump.c [deleted file]
lib/libc/stdtime/zic.8 [deleted file]
lib/libc/stdtime/zic.c [deleted file]
lib/libc/string/Lint_bcmp.c [moved from lib/nbsd_libc/string/Lint_bcmp.c with 100% similarity]
lib/libc/string/Lint_bcopy.c [moved from lib/nbsd_libc/string/Lint_bcopy.c with 100% similarity]
lib/libc/string/Lint_bzero.c [moved from lib/nbsd_libc/string/Lint_bzero.c with 100% similarity]
lib/libc/string/Lint_ffs.c [moved from lib/nbsd_libc/string/Lint_ffs.c with 100% similarity]
lib/libc/string/Lint_index.c [moved from lib/nbsd_libc/string/Lint_index.c with 100% similarity]
lib/libc/string/Lint_memccpy.c [moved from lib/nbsd_libc/string/Lint_memccpy.c with 100% similarity]
lib/libc/string/Lint_memchr.c [moved from lib/nbsd_libc/string/Lint_memchr.c with 100% similarity]
lib/libc/string/Lint_memcmp.c [moved from lib/nbsd_libc/string/Lint_memcmp.c with 100% similarity]
lib/libc/string/Lint_memcpy.c [moved from lib/nbsd_libc/string/Lint_memcpy.c with 100% similarity]
lib/libc/string/Lint_memmove.c [moved from lib/nbsd_libc/string/Lint_memmove.c with 100% similarity]
lib/libc/string/Lint_memset.c [moved from lib/nbsd_libc/string/Lint_memset.c with 100% similarity]
lib/libc/string/Lint_rindex.c [moved from lib/nbsd_libc/string/Lint_rindex.c with 100% similarity]
lib/libc/string/Lint_strcat.c [moved from lib/nbsd_libc/string/Lint_strcat.c with 100% similarity]
lib/libc/string/Lint_strchr.c [moved from lib/nbsd_libc/string/Lint_strchr.c with 100% similarity]
lib/libc/string/Lint_strcmp.c [moved from lib/nbsd_libc/string/Lint_strcmp.c with 100% similarity]
lib/libc/string/Lint_strcpy.c [moved from lib/nbsd_libc/string/Lint_strcpy.c with 100% similarity]
lib/libc/string/Lint_strlen.c [moved from lib/nbsd_libc/string/Lint_strlen.c with 100% similarity]
lib/libc/string/Lint_strncat.c [moved from lib/nbsd_libc/string/Lint_strncat.c with 100% similarity]
lib/libc/string/Lint_strncmp.c [moved from lib/nbsd_libc/string/Lint_strncmp.c with 100% similarity]
lib/libc/string/Lint_strncpy.c [moved from lib/nbsd_libc/string/Lint_strncpy.c with 100% similarity]
lib/libc/string/Lint_strrchr.c [moved from lib/nbsd_libc/string/Lint_strrchr.c with 100% similarity]
lib/libc/string/Lint_swab.c [moved from lib/nbsd_libc/string/Lint_swab.c with 100% similarity]
lib/libc/string/Makefile.inc [moved from lib/nbsd_libc/string/Makefile.inc with 100% similarity]
lib/libc/string/__strsignal.c [moved from lib/nbsd_libc/string/__strsignal.c with 100% similarity]
lib/libc/string/_strerror_r.c [moved from lib/nbsd_libc/string/_strerror_r.c with 100% similarity]
lib/libc/string/_strlcat.c [moved from lib/nbsd_libc/string/_strlcat.c with 100% similarity]
lib/libc/string/_strlcpy.c [moved from lib/nbsd_libc/string/_strlcpy.c with 100% similarity]
lib/libc/string/bcmp.3 [moved from lib/nbsd_libc/string/bcmp.3 with 100% similarity]
lib/libc/string/bcopy.3 [moved from lib/nbsd_libc/string/bcopy.3 with 100% similarity]
lib/libc/string/bm.3 [moved from lib/nbsd_libc/string/bm.3 with 100% similarity]
lib/libc/string/bm.c [moved from lib/nbsd_libc/string/bm.c with 100% similarity]
lib/libc/string/bstring.3 [moved from lib/nbsd_libc/string/bstring.3 with 100% similarity]
lib/libc/string/bzero.3 [moved from lib/nbsd_libc/string/bzero.3 with 100% similarity]
lib/libc/string/ffs.3 [moved from lib/nbsd_libc/string/ffs.3 with 100% similarity]
lib/libc/string/index.3 [moved from lib/nbsd_libc/string/index.3 with 100% similarity]
lib/libc/string/index.c [moved from lib/nbsd_libc/string/index.c with 100% similarity]
lib/libc/string/memccpy.3 [moved from lib/nbsd_libc/string/memccpy.3 with 100% similarity]
lib/libc/string/memccpy.c [moved from lib/nbsd_libc/string/memccpy.c with 100% similarity]
lib/libc/string/memchr.3 [moved from lib/nbsd_libc/string/memchr.3 with 100% similarity]
lib/libc/string/memcmp.3 [moved from lib/nbsd_libc/string/memcmp.3 with 100% similarity]
lib/libc/string/memcpy.3 [moved from lib/nbsd_libc/string/memcpy.3 with 100% similarity]
lib/libc/string/memmem.3 [moved from lib/nbsd_libc/string/memmem.3 with 100% similarity]
lib/libc/string/memmem.c [moved from lib/nbsd_libc/string/memmem.c with 100% similarity]
lib/libc/string/memmove.3 [moved from lib/nbsd_libc/string/memmove.3 with 100% similarity]
lib/libc/string/memrchr.c [moved from lib/nbsd_libc/string/memrchr.c with 100% similarity]
lib/libc/string/memset.3 [moved from lib/nbsd_libc/string/memset.3 with 100% similarity]
lib/libc/string/popcount.3 [moved from lib/nbsd_libc/string/popcount.3 with 100% similarity]
lib/libc/string/rindex.3 [moved from lib/nbsd_libc/string/rindex.3 with 100% similarity]
lib/libc/string/rindex.c [moved from lib/nbsd_libc/string/rindex.c with 100% similarity]
lib/libc/string/stpcpy.c [moved from lib/nbsd_libc/string/stpcpy.c with 100% similarity]
lib/libc/string/stpncpy.c [moved from lib/nbsd_libc/string/stpncpy.c with 100% similarity]
lib/libc/string/strcasecmp.3 [moved from lib/nbsd_libc/string/strcasecmp.3 with 100% similarity]
lib/libc/string/strcasestr.c [moved from lib/nbsd_libc/string/strcasestr.c with 100% similarity]
lib/libc/string/strcat.3 [moved from lib/nbsd_libc/string/strcat.3 with 100% similarity]
lib/libc/string/strchr.3 [moved from lib/nbsd_libc/string/strchr.3 with 100% similarity]
lib/libc/string/strcmp.3 [moved from lib/nbsd_libc/string/strcmp.3 with 100% similarity]
lib/libc/string/strcoll.3 [moved from lib/nbsd_libc/string/strcoll.3 with 100% similarity]
lib/libc/string/strcoll.c [moved from lib/nbsd_libc/string/strcoll.c with 100% similarity]
lib/libc/string/strcpy.3 [moved from lib/nbsd_libc/string/strcpy.3 with 100% similarity]
lib/libc/string/strcspn.3 [moved from lib/nbsd_libc/string/strcspn.3 with 100% similarity]
lib/libc/string/strcspn.c [moved from lib/nbsd_libc/string/strcspn.c with 100% similarity]
lib/libc/string/strdup.3 [moved from lib/nbsd_libc/string/strdup.3 with 100% similarity]
lib/libc/string/strdup.c [moved from lib/nbsd_libc/string/strdup.c with 100% similarity]
lib/libc/string/strerror.3 [moved from lib/nbsd_libc/string/strerror.3 with 100% similarity]
lib/libc/string/strerror.c [moved from lib/nbsd_libc/string/strerror.c with 100% similarity]
lib/libc/string/strerror_r.c [moved from lib/nbsd_libc/string/strerror_r.c with 100% similarity]
lib/libc/string/stresep.c [moved from lib/nbsd_libc/string/stresep.c with 100% similarity]
lib/libc/string/string.3 [moved from lib/nbsd_libc/string/string.3 with 100% similarity]
lib/libc/string/strings.3 [moved from lib/nbsd_libc/string/strings.3 with 100% similarity]
lib/libc/string/strlcpy.3 [moved from lib/nbsd_libc/string/strlcpy.3 with 100% similarity]
lib/libc/string/strlen.3 [moved from lib/nbsd_libc/string/strlen.3 with 100% similarity]
lib/libc/string/strmode.3 [moved from lib/nbsd_libc/string/strmode.3 with 100% similarity]
lib/libc/string/strmode.c [moved from lib/nbsd_libc/string/strmode.c with 100% similarity]
lib/libc/string/strncat.c [moved from lib/nbsd_libc/string/strncat.c with 100% similarity]
lib/libc/string/strndup.c [moved from lib/nbsd_libc/string/strndup.c with 100% similarity]
lib/libc/string/strnlen.c [moved from lib/nbsd_libc/string/strnlen.c with 100% similarity]
lib/libc/string/strpbrk.3 [moved from lib/nbsd_libc/string/strpbrk.3 with 100% similarity]
lib/libc/string/strpbrk.c [moved from lib/nbsd_libc/string/strpbrk.c with 100% similarity]
lib/libc/string/strrchr.3 [moved from lib/nbsd_libc/string/strrchr.3 with 100% similarity]
lib/libc/string/strsep.3 [moved from lib/nbsd_libc/string/strsep.3 with 100% similarity]
lib/libc/string/strsignal.3 [moved from lib/nbsd_libc/string/strsignal.3 with 100% similarity]
lib/libc/string/strsignal.c [moved from lib/nbsd_libc/string/strsignal.c with 100% similarity]
lib/libc/string/strspn.3 [moved from lib/nbsd_libc/string/strspn.3 with 100% similarity]
lib/libc/string/strspn.c [moved from lib/nbsd_libc/string/strspn.c with 100% similarity]
lib/libc/string/strstr.3 [moved from lib/nbsd_libc/string/strstr.3 with 100% similarity]
lib/libc/string/strtok.3 [moved from lib/nbsd_libc/string/strtok.3 with 100% similarity]
lib/libc/string/strtok.c [moved from lib/nbsd_libc/string/strtok.c with 100% similarity]
lib/libc/string/strtok_r.c [moved from lib/nbsd_libc/string/strtok_r.c with 100% similarity]
lib/libc/string/strxfrm.3 [moved from lib/nbsd_libc/string/strxfrm.3 with 100% similarity]
lib/libc/string/strxfrm.c [moved from lib/nbsd_libc/string/strxfrm.c with 100% similarity]
lib/libc/string/swab.3 [moved from lib/nbsd_libc/string/swab.3 with 100% similarity]
lib/libc/string/swab.c [moved from lib/nbsd_libc/string/swab.c with 100% similarity]
lib/libc/string/wcscasecmp.3 [moved from lib/nbsd_libc/string/wcscasecmp.3 with 100% similarity]
lib/libc/string/wcscasecmp.c [moved from lib/nbsd_libc/string/wcscasecmp.c with 100% similarity]
lib/libc/string/wcscat.c [moved from lib/nbsd_libc/string/wcscat.c with 100% similarity]
lib/libc/string/wcschr.c [moved from lib/nbsd_libc/string/wcschr.c with 100% similarity]
lib/libc/string/wcscmp.c [moved from lib/nbsd_libc/string/wcscmp.c with 100% similarity]
lib/libc/string/wcscpy.c [moved from lib/nbsd_libc/string/wcscpy.c with 100% similarity]
lib/libc/string/wcscspn.c [moved from lib/nbsd_libc/string/wcscspn.c with 100% similarity]
lib/libc/string/wcsdup.3 [moved from lib/nbsd_libc/string/wcsdup.3 with 100% similarity]
lib/libc/string/wcsdup.c [moved from lib/nbsd_libc/string/wcsdup.c with 100% similarity]
lib/libc/string/wcslcat.c [moved from lib/nbsd_libc/string/wcslcat.c with 100% similarity]
lib/libc/string/wcslcpy.c [moved from lib/nbsd_libc/string/wcslcpy.c with 100% similarity]
lib/libc/string/wcslen.c [moved from lib/nbsd_libc/string/wcslen.c with 100% similarity]
lib/libc/string/wcsncasecmp.c [moved from lib/nbsd_libc/string/wcsncasecmp.c with 100% similarity]
lib/libc/string/wcsncat.c [moved from lib/nbsd_libc/string/wcsncat.c with 100% similarity]
lib/libc/string/wcsncmp.c [moved from lib/nbsd_libc/string/wcsncmp.c with 100% similarity]
lib/libc/string/wcsncpy.c [moved from lib/nbsd_libc/string/wcsncpy.c with 100% similarity]
lib/libc/string/wcspbrk.c [moved from lib/nbsd_libc/string/wcspbrk.c with 100% similarity]
lib/libc/string/wcsrchr.c [moved from lib/nbsd_libc/string/wcsrchr.c with 100% similarity]
lib/libc/string/wcsspn.c [moved from lib/nbsd_libc/string/wcsspn.c with 100% similarity]
lib/libc/string/wcsstr.c [moved from lib/nbsd_libc/string/wcsstr.c with 100% similarity]
lib/libc/string/wcstok.3 [moved from lib/nbsd_libc/string/wcstok.3 with 100% similarity]
lib/libc/string/wcstok.c [moved from lib/nbsd_libc/string/wcstok.c with 100% similarity]
lib/libc/string/wcswcs.c [moved from lib/nbsd_libc/string/wcswcs.c with 100% similarity]
lib/libc/string/wcswidth.3 [moved from lib/nbsd_libc/string/wcswidth.3 with 100% similarity]
lib/libc/string/wmemchr.3 [moved from lib/nbsd_libc/string/wmemchr.3 with 100% similarity]
lib/libc/string/wmemchr.c [moved from lib/nbsd_libc/string/wmemchr.c with 100% similarity]
lib/libc/string/wmemcmp.c [moved from lib/nbsd_libc/string/wmemcmp.c with 100% similarity]
lib/libc/string/wmemcpy.c [moved from lib/nbsd_libc/string/wmemcpy.c with 100% similarity]
lib/libc/string/wmemmove.c [moved from lib/nbsd_libc/string/wmemmove.c with 100% similarity]
lib/libc/string/wmemset.c [moved from lib/nbsd_libc/string/wmemset.c with 100% similarity]
lib/libc/sys-minix/MISSING_SYSCALLS [moved from lib/nbsd_libc/sys-minix/MISSING_SYSCALLS with 100% similarity]
lib/libc/sys-minix/Makefile.inc [moved from lib/nbsd_libc/sys-minix/Makefile.inc with 100% similarity]
lib/libc/sys-minix/__getcwd.c [moved from lib/nbsd_libc/sys-minix/__getcwd.c with 100% similarity]
lib/libc/sys-minix/__getlogin.c [moved from lib/nbsd_libc/sys-minix/__getlogin.c with 100% similarity]
lib/libc/sys-minix/_exit.c [moved from lib/nbsd_libc/sys-minix/_exit.c with 100% similarity]
lib/libc/sys-minix/_mcontext.c [moved from lib/nbsd_libc/sys-minix/_mcontext.c with 100% similarity]
lib/libc/sys-minix/_ucontext.c [moved from lib/nbsd_libc/sys-minix/_ucontext.c with 100% similarity]
lib/libc/sys-minix/accept.c [moved from lib/nbsd_libc/sys-minix/accept.c with 100% similarity]
lib/libc/sys-minix/access.c [moved from lib/nbsd_libc/sys-minix/access.c with 100% similarity]
lib/libc/sys-minix/bind.c [moved from lib/nbsd_libc/sys-minix/bind.c with 100% similarity]
lib/libc/sys-minix/brk.c [moved from lib/nbsd_libc/sys-minix/brk.c with 100% similarity]
lib/libc/sys-minix/chdir.c [moved from lib/nbsd_libc/sys-minix/chdir.c with 100% similarity]
lib/libc/sys-minix/chmod.c [moved from lib/nbsd_libc/sys-minix/chmod.c with 100% similarity]
lib/libc/sys-minix/chown.c [moved from lib/nbsd_libc/sys-minix/chown.c with 100% similarity]
lib/libc/sys-minix/chroot.c [moved from lib/nbsd_libc/sys-minix/chroot.c with 100% similarity]
lib/libc/sys-minix/close.c [moved from lib/nbsd_libc/sys-minix/close.c with 100% similarity]
lib/libc/sys-minix/connect.c [moved from lib/nbsd_libc/sys-minix/connect.c with 100% similarity]
lib/libc/sys-minix/cprofile.c [moved from lib/nbsd_libc/sys-minix/cprofile.c with 100% similarity]
lib/libc/sys-minix/dup.c [moved from lib/nbsd_libc/sys-minix/dup.c with 100% similarity]
lib/libc/sys-minix/dup2.c [moved from lib/nbsd_libc/sys-minix/dup2.c with 100% similarity]
lib/libc/sys-minix/environ.c [moved from lib/libc/other/environ.c with 100% similarity]
lib/libc/sys-minix/execve.c [moved from lib/nbsd_libc/sys-minix/execve.c with 100% similarity]
lib/libc/sys-minix/fchmod.c [moved from lib/nbsd_libc/sys-minix/fchmod.c with 100% similarity]
lib/libc/sys-minix/fchown.c [moved from lib/nbsd_libc/sys-minix/fchown.c with 100% similarity]
lib/libc/sys-minix/fcntl.c [moved from lib/nbsd_libc/sys-minix/fcntl.c with 100% similarity]
lib/libc/sys-minix/flock.c [moved from lib/nbsd_libc/sys-minix/flock.c with 100% similarity]
lib/libc/sys-minix/fork.c [moved from lib/nbsd_libc/sys-minix/fork.c with 100% similarity]
lib/libc/sys-minix/fpathconf.c [moved from lib/nbsd_libc/sys-minix/fpathconf.c with 100% similarity]
lib/libc/sys-minix/fstatfs.c [moved from lib/nbsd_libc/sys-minix/fstatfs.c with 100% similarity]
lib/libc/sys-minix/fstatvfs.c [moved from lib/nbsd_libc/sys-minix/fstatvfs.c with 100% similarity]
lib/libc/sys-minix/fsync.c [moved from lib/nbsd_libc/sys-minix/fsync.c with 100% similarity]
lib/libc/sys-minix/ftruncate.c [moved from lib/nbsd_libc/sys-minix/ftruncate.c with 100% similarity]
lib/libc/sys-minix/getdents.c [moved from lib/nbsd_libc/sys-minix/getdents.c with 100% similarity]
lib/libc/sys-minix/getegid.c [moved from lib/nbsd_libc/sys-minix/getegid.c with 100% similarity]
lib/libc/sys-minix/geteuid.c [moved from lib/nbsd_libc/sys-minix/geteuid.c with 100% similarity]
lib/libc/sys-minix/getgid.c [moved from lib/nbsd_libc/sys-minix/getgid.c with 100% similarity]
lib/libc/sys-minix/getgroups.c [moved from lib/nbsd_libc/sys-minix/getgroups.c with 100% similarity]
lib/libc/sys-minix/getitimer.c [moved from lib/nbsd_libc/sys-minix/getitimer.c with 100% similarity]
lib/libc/sys-minix/getpeername.c [moved from lib/nbsd_libc/sys-minix/getpeername.c with 100% similarity]
lib/libc/sys-minix/getpgrp.c [moved from lib/nbsd_libc/sys-minix/getpgrp.c with 100% similarity]
lib/libc/sys-minix/getpid.c [moved from lib/nbsd_libc/sys-minix/getpid.c with 100% similarity]
lib/libc/sys-minix/getppid.c [moved from lib/nbsd_libc/sys-minix/getppid.c with 100% similarity]
lib/libc/sys-minix/getrlimit.c [moved from lib/nbsd_libc/sys-minix/getrlimit.c with 100% similarity]
lib/libc/sys-minix/getsid.c [moved from lib/nbsd_libc/sys-minix/getsid.c with 100% similarity]
lib/libc/sys-minix/getsockname.c [moved from lib/nbsd_libc/sys-minix/getsockname.c with 100% similarity]
lib/libc/sys-minix/getsockopt.c [moved from lib/nbsd_libc/sys-minix/getsockopt.c with 100% similarity]
lib/libc/sys-minix/gettimeofday.c [moved from lib/nbsd_libc/sys-minix/gettimeofday.c with 100% similarity]
lib/libc/sys-minix/getuid.c [moved from lib/nbsd_libc/sys-minix/getuid.c with 100% similarity]
lib/libc/sys-minix/ioctl.c [moved from lib/nbsd_libc/sys-minix/ioctl.c with 100% similarity]
lib/libc/sys-minix/issetugid.c [moved from lib/nbsd_libc/sys-minix/issetugid.c with 100% similarity]
lib/libc/sys-minix/kill.c [moved from lib/nbsd_libc/sys-minix/kill.c with 100% similarity]
lib/libc/sys-minix/link.c [moved from lib/nbsd_libc/sys-minix/link.c with 100% similarity]
lib/libc/sys-minix/listen.c [moved from lib/nbsd_libc/sys-minix/listen.c with 100% similarity]
lib/libc/sys-minix/loadname.c [moved from lib/nbsd_libc/sys-minix/loadname.c with 100% similarity]
lib/libc/sys-minix/lseek.c [moved from lib/nbsd_libc/sys-minix/lseek.c with 100% similarity]
lib/libc/sys-minix/lseek64.c [moved from lib/nbsd_libc/sys-minix/lseek64.c with 100% similarity]
lib/libc/sys-minix/m_closefrom.c [moved from lib/nbsd_libc/sys-minix/m_closefrom.c with 100% similarity]
lib/libc/sys-minix/minix_rs.c [moved from lib/nbsd_libc/sys-minix/minix_rs.c with 100% similarity]
lib/libc/sys-minix/mkdir.c [moved from lib/nbsd_libc/sys-minix/mkdir.c with 100% similarity]
lib/libc/sys-minix/mkfifo.c [moved from lib/nbsd_libc/sys-minix/mkfifo.c with 100% similarity]
lib/libc/sys-minix/mknod.c [moved from lib/nbsd_libc/sys-minix/mknod.c with 100% similarity]
lib/libc/sys-minix/mmap.c [moved from lib/nbsd_libc/sys-minix/mmap.c with 100% similarity]
lib/libc/sys-minix/mount.c [moved from lib/nbsd_libc/sys-minix/mount.c with 100% similarity]
lib/libc/sys-minix/nanosleep.c [moved from lib/nbsd_libc/sys-minix/nanosleep.c with 100% similarity]
lib/libc/sys-minix/open.c [moved from lib/nbsd_libc/sys-minix/open.c with 100% similarity]
lib/libc/sys-minix/pathconf.c [moved from lib/nbsd_libc/sys-minix/pathconf.c with 100% similarity]
lib/libc/sys-minix/pipe.c [moved from lib/nbsd_libc/sys-minix/pipe.c with 100% similarity]
lib/libc/sys-minix/poll.c [moved from lib/nbsd_libc/sys-minix/poll.c with 100% similarity]
lib/libc/sys-minix/pread.c [moved from lib/nbsd_libc/sys-minix/pread.c with 100% similarity]
lib/libc/sys-minix/priority.c [moved from lib/nbsd_libc/sys-minix/priority.c with 100% similarity]
lib/libc/sys-minix/ptrace.c [moved from lib/nbsd_libc/sys-minix/ptrace.c with 100% similarity]
lib/libc/sys-minix/pwrite.c [moved from lib/nbsd_libc/sys-minix/pwrite.c with 100% similarity]
lib/libc/sys-minix/read.c [moved from lib/nbsd_libc/sys-minix/read.c with 100% similarity]
lib/libc/sys-minix/readlink.c [moved from lib/nbsd_libc/sys-minix/readlink.c with 100% similarity]
lib/libc/sys-minix/reboot.c [moved from lib/nbsd_libc/sys-minix/reboot.c with 100% similarity]
lib/libc/sys-minix/recvfrom.c [moved from lib/nbsd_libc/sys-minix/recvfrom.c with 100% similarity]
lib/libc/sys-minix/recvmsg.c [moved from lib/nbsd_libc/sys-minix/recvmsg.c with 100% similarity]
lib/libc/sys-minix/rename.c [moved from lib/nbsd_libc/sys-minix/rename.c with 100% similarity]
lib/libc/sys-minix/rmdir.c [moved from lib/nbsd_libc/sys-minix/rmdir.c with 100% similarity]
lib/libc/sys-minix/sbrk.c [moved from lib/nbsd_libc/sys-minix/sbrk.c with 100% similarity]
lib/libc/sys-minix/select.c [moved from lib/nbsd_libc/sys-minix/select.c with 100% similarity]
lib/libc/sys-minix/sem.c [moved from lib/nbsd_libc/sys-minix/sem.c with 100% similarity]
lib/libc/sys-minix/sendmsg.c [moved from lib/nbsd_libc/sys-minix/sendmsg.c with 100% similarity]
lib/libc/sys-minix/sendto.c [moved from lib/nbsd_libc/sys-minix/sendto.c with 100% similarity]
lib/libc/sys-minix/setgid.c [moved from lib/nbsd_libc/sys-minix/setgid.c with 100% similarity]
lib/libc/sys-minix/setgroups.c [moved from lib/nbsd_libc/sys-minix/setgroups.c with 100% similarity]
lib/libc/sys-minix/setitimer.c [moved from lib/nbsd_libc/sys-minix/setitimer.c with 100% similarity]
lib/libc/sys-minix/setsid.c [moved from lib/nbsd_libc/sys-minix/setsid.c with 100% similarity]
lib/libc/sys-minix/setsockopt.c [moved from lib/nbsd_libc/sys-minix/setsockopt.c with 100% similarity]
lib/libc/sys-minix/settimeofday.c [moved from lib/nbsd_libc/sys-minix/settimeofday.c with 100% similarity]
lib/libc/sys-minix/setuid.c [moved from lib/nbsd_libc/sys-minix/setuid.c with 100% similarity]
lib/libc/sys-minix/shmat.c [moved from lib/nbsd_libc/sys-minix/shmat.c with 100% similarity]
lib/libc/sys-minix/shmctl.c [moved from lib/nbsd_libc/sys-minix/shmctl.c with 100% similarity]
lib/libc/sys-minix/shmget.c [moved from lib/nbsd_libc/sys-minix/shmget.c with 100% similarity]
lib/libc/sys-minix/shutdown.c [moved from lib/nbsd_libc/sys-minix/shutdown.c with 100% similarity]
lib/libc/sys-minix/sigaction.c [moved from lib/nbsd_libc/sys-minix/sigaction.c with 100% similarity]
lib/libc/sys-minix/sigpending.c [moved from lib/nbsd_libc/sys-minix/sigpending.c with 100% similarity]
lib/libc/sys-minix/sigprocmask.c [moved from lib/nbsd_libc/sys-minix/sigprocmask.c with 100% similarity]
lib/libc/sys-minix/sigreturn.c [moved from lib/nbsd_libc/sys-minix/sigreturn.c with 100% similarity]
lib/libc/sys-minix/sigsuspend.c [moved from lib/nbsd_libc/sys-minix/sigsuspend.c with 100% similarity]
lib/libc/sys-minix/sizeup.c [moved from lib/libc/other/sizeup.c with 100% similarity]
lib/libc/sys-minix/socket.c [moved from lib/nbsd_libc/sys-minix/socket.c with 100% similarity]
lib/libc/sys-minix/socketpair.c [moved from lib/nbsd_libc/sys-minix/socketpair.c with 100% similarity]
lib/libc/sys-minix/sprofile.c [moved from lib/nbsd_libc/sys-minix/sprofile.c with 100% similarity]
lib/libc/sys-minix/stat.c [moved from lib/nbsd_libc/sys-minix/stat.c with 100% similarity]
lib/libc/sys-minix/statvfs.c [moved from lib/nbsd_libc/sys-minix/statvfs.c with 100% similarity]
lib/libc/sys-minix/stime.c [moved from lib/nbsd_libc/sys-minix/stime.c with 100% similarity]
lib/libc/sys-minix/symlink.c [moved from lib/nbsd_libc/sys-minix/symlink.c with 100% similarity]
lib/libc/sys-minix/sync.c [moved from lib/nbsd_libc/sys-minix/sync.c with 100% similarity]
lib/libc/sys-minix/syscall.c [moved from lib/nbsd_libc/sys-minix/syscall.c with 100% similarity]
lib/libc/sys-minix/sysuname.c [moved from lib/nbsd_libc/sys-minix/sysuname.c with 100% similarity]
lib/libc/sys-minix/truncate.c [moved from lib/nbsd_libc/sys-minix/truncate.c with 100% similarity]
lib/libc/sys-minix/umask.c [moved from lib/nbsd_libc/sys-minix/umask.c with 100% similarity]
lib/libc/sys-minix/unlink.c [moved from lib/nbsd_libc/sys-minix/unlink.c with 100% similarity]
lib/libc/sys-minix/vectorio.c [moved from lib/nbsd_libc/sys-minix/vectorio.c with 100% similarity]
lib/libc/sys-minix/vfork.c [moved from lib/nbsd_libc/sys-minix/vfork.c with 100% similarity]
lib/libc/sys-minix/write.c [moved from lib/nbsd_libc/sys-minix/write.c with 100% similarity]
lib/libc/sys/Lint___clone.c [moved from lib/nbsd_libc/sys/Lint___clone.c with 100% similarity]
lib/libc/sys/Lint___sigaction14.c [moved from lib/nbsd_libc/sys/Lint___sigaction14.c with 100% similarity]
lib/libc/sys/Lint___syscall.c [moved from lib/nbsd_libc/sys/Lint___syscall.c with 100% similarity]
lib/libc/sys/Lint___vfork14.c [moved from lib/nbsd_libc/sys/Lint___vfork14.c with 100% similarity]
lib/libc/sys/Lint_brk.c [moved from lib/nbsd_libc/sys/Lint_brk.c with 100% similarity]
lib/libc/sys/Lint_clone.c [moved from lib/nbsd_libc/sys/Lint_clone.c with 100% similarity]
lib/libc/sys/Lint_exect.c [moved from lib/nbsd_libc/sys/Lint_exect.c with 100% similarity]
lib/libc/sys/Lint_getcontext.c [moved from lib/nbsd_libc/sys/Lint_getcontext.c with 100% similarity]
lib/libc/sys/Lint_pipe.c [moved from lib/nbsd_libc/sys/Lint_pipe.c with 100% similarity]
lib/libc/sys/Lint_ptrace.c [moved from lib/nbsd_libc/sys/Lint_ptrace.c with 100% similarity]
lib/libc/sys/Lint_sbrk.c [moved from lib/nbsd_libc/sys/Lint_sbrk.c with 100% similarity]
lib/libc/sys/Lint_syscall.c [moved from lib/nbsd_libc/sys/Lint_syscall.c with 100% similarity]
lib/libc/sys/Makefile.inc [moved from lib/nbsd_libc/sys/Makefile.inc with 100% similarity]
lib/libc/sys/_brk.c [moved from lib/nbsd_libc/sys/_brk.c with 100% similarity]
lib/libc/sys/_exit.2 [moved from lib/nbsd_libc/sys/_exit.2 with 100% similarity]
lib/libc/sys/_fork.c [moved from lib/nbsd_libc/sys/_fork.c with 100% similarity]
lib/libc/sys/_getcontext.c [moved from lib/nbsd_libc/sys/_getcontext.c with 100% similarity]
lib/libc/sys/_lwp_create.2 [moved from lib/nbsd_libc/sys/_lwp_create.2 with 100% similarity]
lib/libc/sys/_lwp_ctl.2 [moved from lib/nbsd_libc/sys/_lwp_ctl.2 with 100% similarity]
lib/libc/sys/_lwp_detach.2 [moved from lib/nbsd_libc/sys/_lwp_detach.2 with 100% similarity]
lib/libc/sys/_lwp_exit.2 [moved from lib/nbsd_libc/sys/_lwp_exit.2 with 100% similarity]
lib/libc/sys/_lwp_getname.2 [moved from lib/nbsd_libc/sys/_lwp_getname.2 with 100% similarity]
lib/libc/sys/_lwp_getprivate.2 [moved from lib/nbsd_libc/sys/_lwp_getprivate.2 with 100% similarity]
lib/libc/sys/_lwp_kill.2 [moved from lib/nbsd_libc/sys/_lwp_kill.2 with 100% similarity]
lib/libc/sys/_lwp_park.2 [moved from lib/nbsd_libc/sys/_lwp_park.2 with 100% similarity]
lib/libc/sys/_lwp_self.2 [moved from lib/nbsd_libc/sys/_lwp_self.2 with 100% similarity]
lib/libc/sys/_lwp_setname.2 [moved from lib/nbsd_libc/sys/_lwp_setname.2 with 100% similarity]
lib/libc/sys/_lwp_suspend.2 [moved from lib/nbsd_libc/sys/_lwp_suspend.2 with 100% similarity]
lib/libc/sys/_lwp_unpark.2 [moved from lib/nbsd_libc/sys/_lwp_unpark.2 with 100% similarity]
lib/libc/sys/_lwp_unpark_all.2 [moved from lib/nbsd_libc/sys/_lwp_unpark_all.2 with 100% similarity]
lib/libc/sys/_lwp_wait.2 [moved from lib/nbsd_libc/sys/_lwp_wait.2 with 100% similarity]
lib/libc/sys/_lwp_wakeup.2 [moved from lib/nbsd_libc/sys/_lwp_wakeup.2 with 100% similarity]
lib/libc/sys/_pipe.c [moved from lib/nbsd_libc/sys/_pipe.c with 100% similarity]
lib/libc/sys/_sbrk.c [moved from lib/nbsd_libc/sys/_sbrk.c with 100% similarity]
lib/libc/sys/accept.2 [moved from lib/nbsd_libc/sys/accept.2 with 100% similarity]
lib/libc/sys/access.2 [moved from lib/nbsd_libc/sys/access.2 with 100% similarity]
lib/libc/sys/acct.2 [moved from lib/nbsd_libc/sys/acct.2 with 100% similarity]
lib/libc/sys/adjtime.2 [moved from lib/nbsd_libc/sys/adjtime.2 with 100% similarity]
lib/libc/sys/adjtime.c [moved from lib/nbsd_libc/sys/adjtime.c with 100% similarity]
lib/libc/sys/bind.2 [moved from lib/nbsd_libc/sys/bind.2 with 100% similarity]
lib/libc/sys/brk.2 [moved from lib/nbsd_libc/sys/brk.2 with 100% similarity]
lib/libc/sys/chdir.2 [moved from lib/nbsd_libc/sys/chdir.2 with 100% similarity]
lib/libc/sys/chflags.2 [moved from lib/nbsd_libc/sys/chflags.2 with 100% similarity]
lib/libc/sys/chmod.2 [moved from lib/nbsd_libc/sys/chmod.2 with 100% similarity]
lib/libc/sys/chown.2 [moved from lib/nbsd_libc/sys/chown.2 with 100% similarity]
lib/libc/sys/chroot.2 [moved from lib/nbsd_libc/sys/chroot.2 with 100% similarity]
lib/libc/sys/clock_settime.2 [moved from lib/nbsd_libc/sys/clock_settime.2 with 100% similarity]
lib/libc/sys/clock_settime.c [moved from lib/nbsd_libc/sys/clock_settime.c with 100% similarity]
lib/libc/sys/clone.2 [moved from lib/nbsd_libc/sys/clone.2 with 100% similarity]
lib/libc/sys/close.2 [moved from lib/nbsd_libc/sys/close.2 with 100% similarity]
lib/libc/sys/connect.2 [moved from lib/nbsd_libc/sys/connect.2 with 100% similarity]
lib/libc/sys/dup.2 [moved from lib/nbsd_libc/sys/dup.2 with 100% similarity]
lib/libc/sys/execve.2 [moved from lib/nbsd_libc/sys/execve.2 with 100% similarity]
lib/libc/sys/extattr_get_file.2 [moved from lib/nbsd_libc/sys/extattr_get_file.2 with 100% similarity]
lib/libc/sys/fcntl.2 [moved from lib/nbsd_libc/sys/fcntl.2 with 100% similarity]
lib/libc/sys/fdatasync.2 [moved from lib/nbsd_libc/sys/fdatasync.2 with 100% similarity]
lib/libc/sys/fhopen.2 [moved from lib/nbsd_libc/sys/fhopen.2 with 100% similarity]
lib/libc/sys/flock.2 [moved from lib/nbsd_libc/sys/flock.2 with 100% similarity]
lib/libc/sys/fork.2 [moved from lib/nbsd_libc/sys/fork.2 with 100% similarity]
lib/libc/sys/fsync.2 [moved from lib/nbsd_libc/sys/fsync.2 with 100% similarity]
lib/libc/sys/ftruncate.c [moved from lib/nbsd_libc/sys/ftruncate.c with 100% similarity]
lib/libc/sys/getcontext.2 [moved from lib/nbsd_libc/sys/getcontext.2 with 100% similarity]
lib/libc/sys/getdents.2 [moved from lib/nbsd_libc/sys/getdents.2 with 100% similarity]
lib/libc/sys/getfh.2 [moved from lib/nbsd_libc/sys/getfh.2 with 100% similarity]
lib/libc/sys/getgid.2 [moved from lib/nbsd_libc/sys/getgid.2 with 100% similarity]
lib/libc/sys/getgroups.2 [moved from lib/nbsd_libc/sys/getgroups.2 with 100% similarity]
lib/libc/sys/getitimer.2 [moved from lib/nbsd_libc/sys/getitimer.2 with 100% similarity]
lib/libc/sys/getlogin.2 [moved from lib/nbsd_libc/sys/getlogin.2 with 100% similarity]
lib/libc/sys/getpeername.2 [moved from lib/nbsd_libc/sys/getpeername.2 with 100% similarity]
lib/libc/sys/getpgrp.2 [moved from lib/nbsd_libc/sys/getpgrp.2 with 100% similarity]
lib/libc/sys/getpid.2 [moved from lib/nbsd_libc/sys/getpid.2 with 100% similarity]
lib/libc/sys/getpriority.2 [moved from lib/nbsd_libc/sys/getpriority.2 with 100% similarity]
lib/libc/sys/getrlimit.2 [moved from lib/nbsd_libc/sys/getrlimit.2 with 100% similarity]
lib/libc/sys/getrusage.2 [moved from lib/nbsd_libc/sys/getrusage.2 with 100% similarity]
lib/libc/sys/getsid.2 [moved from lib/nbsd_libc/sys/getsid.2 with 100% similarity]
lib/libc/sys/getsockname.2 [moved from lib/nbsd_libc/sys/getsockname.2 with 100% similarity]
lib/libc/sys/getsockopt.2 [moved from lib/nbsd_libc/sys/getsockopt.2 with 100% similarity]
lib/libc/sys/gettimeofday.2 [moved from lib/nbsd_libc/sys/gettimeofday.2 with 100% similarity]
lib/libc/sys/getuid.2 [moved from lib/nbsd_libc/sys/getuid.2 with 100% similarity]
lib/libc/sys/getvfsstat.2 [moved from lib/nbsd_libc/sys/getvfsstat.2 with 100% similarity]
lib/libc/sys/intro.2 [moved from lib/nbsd_libc/sys/intro.2 with 100% similarity]
lib/libc/sys/ioctl.2 [moved from lib/nbsd_libc/sys/ioctl.2 with 100% similarity]
lib/libc/sys/issetugid.2 [moved from lib/nbsd_libc/sys/issetugid.2 with 100% similarity]
lib/libc/sys/kill.2 [moved from lib/nbsd_libc/sys/kill.2 with 100% similarity]
lib/libc/sys/kqueue.2 [moved from lib/nbsd_libc/sys/kqueue.2 with 100% similarity]
lib/libc/sys/ktrace.2 [moved from lib/nbsd_libc/sys/ktrace.2 with 100% similarity]
lib/libc/sys/lfs_bmapv.2 [moved from lib/nbsd_libc/sys/lfs_bmapv.2 with 100% similarity]
lib/libc/sys/lfs_markv.2 [moved from lib/nbsd_libc/sys/lfs_markv.2 with 100% similarity]
lib/libc/sys/lfs_segclean.2 [moved from lib/nbsd_libc/sys/lfs_segclean.2 with 100% similarity]
lib/libc/sys/lfs_segwait.2 [moved from lib/nbsd_libc/sys/lfs_segwait.2 with 100% similarity]
lib/libc/sys/link.2 [moved from lib/nbsd_libc/sys/link.2 with 100% similarity]
lib/libc/sys/listen.2 [moved from lib/nbsd_libc/sys/listen.2 with 100% similarity]
lib/libc/sys/lseek.2 [moved from lib/nbsd_libc/sys/lseek.2 with 100% similarity]
lib/libc/sys/lseek.c [moved from lib/nbsd_libc/sys/lseek.c with 100% similarity]
lib/libc/sys/madvise.2 [moved from lib/nbsd_libc/sys/madvise.2 with 100% similarity]
lib/libc/sys/makelintstub [moved from lib/nbsd_libc/sys/makelintstub with 100% similarity]
lib/libc/sys/mincore.2 [moved from lib/nbsd_libc/sys/mincore.2 with 100% similarity]
lib/libc/sys/minherit.2 [moved from lib/nbsd_libc/sys/minherit.2 with 100% similarity]
lib/libc/sys/mkdir.2 [moved from lib/nbsd_libc/sys/mkdir.2 with 100% similarity]
lib/libc/sys/mkfifo.2 [moved from lib/nbsd_libc/sys/mkfifo.2 with 100% similarity]
lib/libc/sys/mknod.2 [moved from lib/nbsd_libc/sys/mknod.2 with 100% similarity]
lib/libc/sys/mlock.2 [moved from lib/nbsd_libc/sys/mlock.2 with 100% similarity]
lib/libc/sys/mlockall.2 [moved from lib/nbsd_libc/sys/mlockall.2 with 100% similarity]
lib/libc/sys/mmap.2 [moved from lib/nbsd_libc/sys/mmap.2 with 100% similarity]
lib/libc/sys/mmap.c [moved from lib/nbsd_libc/sys/mmap.c with 100% similarity]
lib/libc/sys/modctl.2 [moved from lib/nbsd_libc/sys/modctl.2 with 100% similarity]
lib/libc/sys/mount.2 [moved from lib/nbsd_libc/sys/mount.2 with 100% similarity]
lib/libc/sys/mprotect.2 [moved from lib/nbsd_libc/sys/mprotect.2 with 100% similarity]
lib/libc/sys/mremap.2 [moved from lib/nbsd_libc/sys/mremap.2 with 100% similarity]
lib/libc/sys/msgctl.2 [moved from lib/nbsd_libc/sys/msgctl.2 with 100% similarity]
lib/libc/sys/msgget.2 [moved from lib/nbsd_libc/sys/msgget.2 with 100% similarity]
lib/libc/sys/msgrcv.2 [moved from lib/nbsd_libc/sys/msgrcv.2 with 100% similarity]
lib/libc/sys/msgsnd.2 [moved from lib/nbsd_libc/sys/msgsnd.2 with 100% similarity]
lib/libc/sys/msync.2 [moved from lib/nbsd_libc/sys/msync.2 with 100% similarity]
lib/libc/sys/munmap.2 [moved from lib/nbsd_libc/sys/munmap.2 with 100% similarity]
lib/libc/sys/nanosleep.2 [moved from lib/nbsd_libc/sys/nanosleep.2 with 100% similarity]
lib/libc/sys/nfssvc.2 [moved from lib/nbsd_libc/sys/nfssvc.2 with 100% similarity]
lib/libc/sys/ntp_adjtime.2 [moved from lib/nbsd_libc/sys/ntp_adjtime.2 with 100% similarity]
lib/libc/sys/ntp_adjtime.c [moved from lib/nbsd_libc/sys/ntp_adjtime.c with 100% similarity]
lib/libc/sys/open.2 [moved from lib/nbsd_libc/sys/open.2 with 100% similarity]
lib/libc/sys/pathconf.2 [moved from lib/nbsd_libc/sys/pathconf.2 with 100% similarity]
lib/libc/sys/pipe.2 [moved from lib/nbsd_libc/sys/pipe.2 with 100% similarity]
lib/libc/sys/pmc_control.2 [moved from lib/nbsd_libc/sys/pmc_control.2 with 100% similarity]
lib/libc/sys/poll.2 [moved from lib/nbsd_libc/sys/poll.2 with 100% similarity]
lib/libc/sys/posix_fadvise.2 [moved from lib/nbsd_libc/sys/posix_fadvise.2 with 100% similarity]
lib/libc/sys/posix_fadvise.c [moved from lib/nbsd_libc/sys/posix_fadvise.c with 100% similarity]
lib/libc/sys/posix_madvise.c [moved from lib/nbsd_libc/sys/posix_madvise.c with 100% similarity]
lib/libc/sys/pread.c [moved from lib/nbsd_libc/sys/pread.c with 100% similarity]
lib/libc/sys/preadv.c [moved from lib/nbsd_libc/sys/preadv.c with 100% similarity]
lib/libc/sys/profil.2 [moved from lib/nbsd_libc/sys/profil.2 with 100% similarity]
lib/libc/sys/ptrace.2 [moved from lib/nbsd_libc/sys/ptrace.2 with 100% similarity]
lib/libc/sys/pwrite.c [moved from lib/nbsd_libc/sys/pwrite.c with 100% similarity]
lib/libc/sys/pwritev.c [moved from lib/nbsd_libc/sys/pwritev.c with 100% similarity]
lib/libc/sys/quotactl.2 [moved from lib/nbsd_libc/sys/quotactl.2 with 100% similarity]
lib/libc/sys/rasctl.2 [moved from lib/nbsd_libc/sys/rasctl.2 with 100% similarity]
lib/libc/sys/read.2 [moved from lib/nbsd_libc/sys/read.2 with 100% similarity]
lib/libc/sys/readlink.2 [moved from lib/nbsd_libc/sys/readlink.2 with 100% similarity]
lib/libc/sys/reboot.2 [moved from lib/nbsd_libc/sys/reboot.2 with 100% similarity]
lib/libc/sys/recv.2 [moved from lib/nbsd_libc/sys/recv.2 with 100% similarity]
lib/libc/sys/rename.2 [moved from lib/nbsd_libc/sys/rename.2 with 100% similarity]
lib/libc/sys/revoke.2 [moved from lib/nbsd_libc/sys/revoke.2 with 100% similarity]
lib/libc/sys/rmdir.2 [moved from lib/nbsd_libc/sys/rmdir.2 with 100% similarity]
lib/libc/sys/sa_enable.2 [moved from lib/nbsd_libc/sys/sa_enable.2 with 100% similarity]
lib/libc/sys/sa_register.2 [moved from lib/nbsd_libc/sys/sa_register.2 with 100% similarity]
lib/libc/sys/sa_setconcurrency.2 [moved from lib/nbsd_libc/sys/sa_setconcurrency.2 with 100% similarity]
lib/libc/sys/sa_stacks.2 [moved from lib/nbsd_libc/sys/sa_stacks.2 with 100% similarity]
lib/libc/sys/sa_yield.2 [moved from lib/nbsd_libc/sys/sa_yield.2 with 100% similarity]
lib/libc/sys/sched.c [moved from lib/nbsd_libc/sys/sched.c with 100% similarity]
lib/libc/sys/select.2 [moved from lib/nbsd_libc/sys/select.2 with 100% similarity]
lib/libc/sys/semctl.2 [moved from lib/nbsd_libc/sys/semctl.2 with 100% similarity]
lib/libc/sys/semctl.c [moved from lib/nbsd_libc/sys/semctl.c with 100% similarity]
lib/libc/sys/semget.2 [moved from lib/nbsd_libc/sys/semget.2 with 100% similarity]
lib/libc/sys/semop.2 [moved from lib/nbsd_libc/sys/semop.2 with 100% similarity]
lib/libc/sys/send.2 [moved from lib/nbsd_libc/sys/send.2 with 100% similarity]
lib/libc/sys/setgroups.2 [moved from lib/nbsd_libc/sys/setgroups.2 with 100% similarity]
lib/libc/sys/setpgid.2 [moved from lib/nbsd_libc/sys/setpgid.2 with 100% similarity]
lib/libc/sys/setregid.2 [moved from lib/nbsd_libc/sys/setregid.2 with 100% similarity]
lib/libc/sys/setreuid.2 [moved from lib/nbsd_libc/sys/setreuid.2 with 100% similarity]
lib/libc/sys/setsid.2 [moved from lib/nbsd_libc/sys/setsid.2 with 100% similarity]
lib/libc/sys/settimeofday.c [moved from lib/nbsd_libc/sys/settimeofday.c with 100% similarity]
lib/libc/sys/setuid.2 [moved from lib/nbsd_libc/sys/setuid.2 with 100% similarity]
lib/libc/sys/shmat.2 [moved from lib/nbsd_libc/sys/shmat.2 with 100% similarity]
lib/libc/sys/shmctl.2 [moved from lib/nbsd_libc/sys/shmctl.2 with 100% similarity]
lib/libc/sys/shmget.2 [moved from lib/nbsd_libc/sys/shmget.2 with 100% similarity]
lib/libc/sys/shutdown.2 [moved from lib/nbsd_libc/sys/shutdown.2 with 100% similarity]
lib/libc/sys/sigaction.2 [moved from lib/nbsd_libc/sys/sigaction.2 with 100% similarity]
lib/libc/sys/sigaltstack.2 [moved from lib/nbsd_libc/sys/sigaltstack.2 with 100% similarity]
lib/libc/sys/sigpending.2 [moved from lib/nbsd_libc/sys/sigpending.2 with 100% similarity]
lib/libc/sys/sigprocmask.2 [moved from lib/nbsd_libc/sys/sigprocmask.2 with 100% similarity]
lib/libc/sys/sigqueue.2 [moved from lib/nbsd_libc/sys/sigqueue.2 with 100% similarity]
lib/libc/sys/sigqueue.c [moved from lib/nbsd_libc/sys/sigqueue.c with 100% similarity]
lib/libc/sys/sigstack.2 [moved from lib/nbsd_libc/sys/sigstack.2 with 100% similarity]
lib/libc/sys/sigsuspend.2 [moved from lib/nbsd_libc/sys/sigsuspend.2 with 100% similarity]
lib/libc/sys/sigtimedwait.2 [moved from lib/nbsd_libc/sys/sigtimedwait.2 with 100% similarity]
lib/libc/sys/sigtimedwait.c [moved from lib/nbsd_libc/sys/sigtimedwait.c with 100% similarity]
lib/libc/sys/sigwait.c [moved from lib/nbsd_libc/sys/sigwait.c with 100% similarity]
lib/libc/sys/sigwaitinfo.c [moved from lib/nbsd_libc/sys/sigwaitinfo.c with 100% similarity]
lib/libc/sys/socket.2 [moved from lib/nbsd_libc/sys/socket.2 with 100% similarity]
lib/libc/sys/socketpair.2 [moved from lib/nbsd_libc/sys/socketpair.2 with 100% similarity]
lib/libc/sys/stat.2 [moved from lib/nbsd_libc/sys/stat.2 with 100% similarity]
lib/libc/sys/statvfs.2 [moved from lib/nbsd_libc/sys/statvfs.2 with 100% similarity]
lib/libc/sys/statvfs.c [moved from lib/nbsd_libc/sys/statvfs.c with 100% similarity]
lib/libc/sys/swapctl.2 [moved from lib/nbsd_libc/sys/swapctl.2 with 100% similarity]
lib/libc/sys/swapon.3 [moved from lib/nbsd_libc/sys/swapon.3 with 100% similarity]
lib/libc/sys/swapon.c [moved from lib/nbsd_libc/sys/swapon.c with 100% similarity]
lib/libc/sys/symlink.2 [moved from lib/nbsd_libc/sys/symlink.2 with 100% similarity]
lib/libc/sys/sync.2 [moved from lib/nbsd_libc/sys/sync.2 with 100% similarity]
lib/libc/sys/sysarch.2 [moved from lib/nbsd_libc/sys/sysarch.2 with 100% similarity]
lib/libc/sys/syscall.2 [moved from lib/nbsd_libc/sys/syscall.2 with 100% similarity]
lib/libc/sys/timer_create.2 [moved from lib/nbsd_libc/sys/timer_create.2 with 100% similarity]
lib/libc/sys/timer_delete.2 [moved from lib/nbsd_libc/sys/timer_delete.2 with 100% similarity]
lib/libc/sys/timer_settime.2 [moved from lib/nbsd_libc/sys/timer_settime.2 with 100% similarity]
lib/libc/sys/truncate.2 [moved from lib/nbsd_libc/sys/truncate.2 with 100% similarity]
lib/libc/sys/truncate.c [moved from lib/nbsd_libc/sys/truncate.c with 100% similarity]
lib/libc/sys/umask.2 [moved from lib/nbsd_libc/sys/umask.2 with 100% similarity]
lib/libc/sys/undelete.2 [moved from lib/nbsd_libc/sys/undelete.2 with 100% similarity]
lib/libc/sys/unlink.2 [moved from lib/nbsd_libc/sys/unlink.2 with 100% similarity]
lib/libc/sys/utimes.2 [moved from lib/nbsd_libc/sys/utimes.2 with 100% similarity]
lib/libc/sys/utrace.2 [moved from lib/nbsd_libc/sys/utrace.2 with 100% similarity]
lib/libc/sys/uuidgen.2 [moved from lib/nbsd_libc/sys/uuidgen.2 with 100% similarity]
lib/libc/sys/vfork.2 [moved from lib/nbsd_libc/sys/vfork.2 with 100% similarity]
lib/libc/sys/wait.2 [moved from lib/nbsd_libc/sys/wait.2 with 100% similarity]
lib/libc/sys/write.2 [moved from lib/nbsd_libc/sys/write.2 with 100% similarity]
lib/libc/syscall/Makefile.inc [deleted file]
lib/libc/syscall/_exit.S [deleted file]
lib/libc/syscall/_pm_findproc.S [deleted file]
lib/libc/syscall/access.S [deleted file]
lib/libc/syscall/alarm.S [deleted file]
lib/libc/syscall/brk.S [deleted file]
lib/libc/syscall/cfgetispeed.S [deleted file]
lib/libc/syscall/cfgetospeed.S [deleted file]
lib/libc/syscall/cfsetispeed.S [deleted file]
lib/libc/syscall/cfsetospeed.S [deleted file]
lib/libc/syscall/chdir.S [deleted file]
lib/libc/syscall/chmod.S [deleted file]
lib/libc/syscall/chown.S [deleted file]
lib/libc/syscall/chroot.S [deleted file]
lib/libc/syscall/close.S [deleted file]
lib/libc/syscall/closedir.S [deleted file]
lib/libc/syscall/cprofile.S [deleted file]
lib/libc/syscall/creat.S [deleted file]
lib/libc/syscall/dup.S [deleted file]
lib/libc/syscall/dup2.S [deleted file]
lib/libc/syscall/execl.S [deleted file]
lib/libc/syscall/execle.S [deleted file]
lib/libc/syscall/execlp.S [deleted file]
lib/libc/syscall/execv.S [deleted file]
lib/libc/syscall/execve.S [deleted file]
lib/libc/syscall/execvp.S [deleted file]
lib/libc/syscall/fchmod.S [deleted file]
lib/libc/syscall/fchown.S [deleted file]
lib/libc/syscall/fcntl.S [deleted file]
lib/libc/syscall/fork.S [deleted file]
lib/libc/syscall/fpathconf.S [deleted file]
lib/libc/syscall/fstat.S [deleted file]
lib/libc/syscall/fstatfs.S [deleted file]
lib/libc/syscall/fstatvfs.S [deleted file]
lib/libc/syscall/getcwd.S [deleted file]
lib/libc/syscall/getdents.S [deleted file]
lib/libc/syscall/getegid.S [deleted file]
lib/libc/syscall/geteuid.S [deleted file]
lib/libc/syscall/getgid.S [deleted file]
lib/libc/syscall/getgroups.S [deleted file]
lib/libc/syscall/getitimer.S [deleted file]
lib/libc/syscall/getngid.S [deleted file]
lib/libc/syscall/getnpid.S [deleted file]
lib/libc/syscall/getnprocnr.S [deleted file]
lib/libc/syscall/getnucred.S [deleted file]
lib/libc/syscall/getnuid.S [deleted file]
lib/libc/syscall/getpgrp.S [deleted file]
lib/libc/syscall/getpid.S [deleted file]
lib/libc/syscall/getppid.S [deleted file]
lib/libc/syscall/getpprocnr.S [deleted file]
lib/libc/syscall/getprocnr.S [deleted file]
lib/libc/syscall/getuid.S [deleted file]
lib/libc/syscall/ioctl.S [deleted file]
lib/libc/syscall/isatty.S [deleted file]
lib/libc/syscall/kill.S [deleted file]
lib/libc/syscall/killpg.S [deleted file]
lib/libc/syscall/link.S [deleted file]
lib/libc/syscall/lseek.S [deleted file]
lib/libc/syscall/lseek64.S [deleted file]
lib/libc/syscall/lstat.S [deleted file]
lib/libc/syscall/mapdriver.S [deleted file]
lib/libc/syscall/mkdir.S [deleted file]
lib/libc/syscall/mkfifo.S [deleted file]
lib/libc/syscall/mknod.S [deleted file]
lib/libc/syscall/mmap.S [deleted file]
lib/libc/syscall/mount.S [deleted file]
lib/libc/syscall/munmap.S [deleted file]
lib/libc/syscall/nanosleep.S [deleted file]
lib/libc/syscall/open.S [deleted file]
lib/libc/syscall/opendir.S [deleted file]
lib/libc/syscall/pathconf.S [deleted file]
lib/libc/syscall/pause.S [deleted file]
lib/libc/syscall/pipe.S [deleted file]
lib/libc/syscall/ptrace.S [deleted file]
lib/libc/syscall/read.S [deleted file]
lib/libc/syscall/readdir.S [deleted file]
lib/libc/syscall/readlink.S [deleted file]
lib/libc/syscall/reboot.S [deleted file]
lib/libc/syscall/rename.S [deleted file]
lib/libc/syscall/rewinddir.S [deleted file]
lib/libc/syscall/rmdir.S [deleted file]
lib/libc/syscall/sbrk.S [deleted file]
lib/libc/syscall/seekdir.S [deleted file]
lib/libc/syscall/select.S [deleted file]
lib/libc/syscall/setgid.S [deleted file]
lib/libc/syscall/setgroups.S [deleted file]
lib/libc/syscall/setitimer.S [deleted file]
lib/libc/syscall/setsid.S [deleted file]
lib/libc/syscall/setuid.S [deleted file]
lib/libc/syscall/sigaction.S [deleted file]
lib/libc/syscall/sigaddset.S [deleted file]
lib/libc/syscall/sigdelset.S [deleted file]
lib/libc/syscall/sigemptyset.S [deleted file]
lib/libc/syscall/sigfillset.S [deleted file]
lib/libc/syscall/sigismember.S [deleted file]
lib/libc/syscall/sigpending.S [deleted file]
lib/libc/syscall/sigprocmask.S [deleted file]
lib/libc/syscall/sigreturn.S [deleted file]
lib/libc/syscall/sigsuspend.S [deleted file]
lib/libc/syscall/sleep.S [deleted file]
lib/libc/syscall/sprofile.S [deleted file]
lib/libc/syscall/stat.S [deleted file]
lib/libc/syscall/statvfs.S [deleted file]
lib/libc/syscall/stime.S [deleted file]
lib/libc/syscall/svrctl.S [deleted file]
lib/libc/syscall/symlink.S [deleted file]
lib/libc/syscall/sync.S [deleted file]
lib/libc/syscall/sysuname.S [deleted file]
lib/libc/syscall/tcdrain.S [deleted file]
lib/libc/syscall/tcflow.S [deleted file]
lib/libc/syscall/tcflush.S [deleted file]
lib/libc/syscall/tcgetattr.S [deleted file]
lib/libc/syscall/tcsendbreak.S [deleted file]
lib/libc/syscall/tcsetattr.S [deleted file]
lib/libc/syscall/time.S [deleted file]
lib/libc/syscall/times.S [deleted file]
lib/libc/syscall/truncate.S [deleted file]
lib/libc/syscall/umask.S [deleted file]
lib/libc/syscall/umount.S [deleted file]
lib/libc/syscall/uname.S [deleted file]
lib/libc/syscall/unlink.S [deleted file]
lib/libc/syscall/utime.S [deleted file]
lib/libc/syscall/vm_getphys.S [deleted file]
lib/libc/syscall/vm_getrefcount.S [deleted file]
lib/libc/syscall/vm_memctl.S [deleted file]
lib/libc/syscall/vm_query_exit.S [deleted file]
lib/libc/syscall/vm_remap.S [deleted file]
lib/libc/syscall/vm_set_priv.S [deleted file]
lib/libc/syscall/vm_unmap.S [deleted file]
lib/libc/syscall/vm_update.S [deleted file]
lib/libc/syscall/wait.S [deleted file]
lib/libc/syscall/waitpid.S [deleted file]
lib/libc/syscall/write.S [deleted file]
lib/libc/sysvipc/Makefile.inc [deleted file]
lib/libc/sysvipc/ftok.c [deleted file]
lib/libc/sysvipc/sem.c [deleted file]
lib/libc/sysvipc/shm.c [deleted file]
lib/libc/termios/Makefile.inc [moved from lib/nbsd_libc/termios/Makefile.inc with 100% similarity]
lib/libc/termios/cfgetispeed.c [moved from lib/nbsd_libc/termios/cfgetispeed.c with 100% similarity]
lib/libc/termios/cfgetospeed.c [moved from lib/nbsd_libc/termios/cfgetospeed.c with 100% similarity]
lib/libc/termios/cfmakeraw.c [moved from lib/nbsd_libc/termios/cfmakeraw.c with 100% similarity]
lib/libc/termios/cfsetispeed.c [moved from lib/nbsd_libc/termios/cfsetispeed.c with 100% similarity]
lib/libc/termios/cfsetospeed.c [moved from lib/nbsd_libc/termios/cfsetospeed.c with 100% similarity]
lib/libc/termios/cfsetspeed.c [moved from lib/nbsd_libc/termios/cfsetspeed.c with 100% similarity]
lib/libc/termios/tcdrain.c [moved from lib/nbsd_libc/termios/tcdrain.c with 100% similarity]
lib/libc/termios/tcflow.c [moved from lib/nbsd_libc/termios/tcflow.c with 100% similarity]
lib/libc/termios/tcflush.c [moved from lib/nbsd_libc/termios/tcflush.c with 100% similarity]
lib/libc/termios/tcgetattr.c [moved from lib/nbsd_libc/termios/tcgetattr.c with 100% similarity]
lib/libc/termios/tcgetpgrp.3 [moved from lib/nbsd_libc/termios/tcgetpgrp.3 with 100% similarity]
lib/libc/termios/tcgetpgrp.c [moved from lib/nbsd_libc/termios/tcgetpgrp.c with 100% similarity]
lib/libc/termios/tcgetsid.3 [moved from lib/nbsd_libc/termios/tcgetsid.3 with 100% similarity]
lib/libc/termios/tcgetsid.c [moved from lib/nbsd_libc/termios/tcgetsid.c with 100% similarity]
lib/libc/termios/tcsendbreak.3 [moved from lib/nbsd_libc/termios/tcsendbreak.3 with 100% similarity]
lib/libc/termios/tcsendbreak.c [moved from lib/nbsd_libc/termios/tcsendbreak.c with 100% similarity]
lib/libc/termios/tcsetattr.3 [moved from lib/nbsd_libc/termios/tcsetattr.3 with 100% similarity]
lib/libc/termios/tcsetattr.c [moved from lib/nbsd_libc/termios/tcsetattr.c with 100% similarity]
lib/libc/termios/tcsetpgrp.3 [moved from lib/nbsd_libc/termios/tcsetpgrp.3 with 100% similarity]
lib/libc/termios/tcsetpgrp.c [moved from lib/nbsd_libc/termios/tcsetpgrp.c with 100% similarity]
lib/libc/thread-stub/Makefile.inc [moved from lib/nbsd_libc/thread-stub/Makefile.inc with 100% similarity]
lib/libc/thread-stub/__isthreaded.c [moved from lib/nbsd_libc/thread-stub/__isthreaded.c with 100% similarity]
lib/libc/thread-stub/thread-stub.c [moved from lib/nbsd_libc/thread-stub/thread-stub.c with 100% similarity]
lib/libc/time/Makefile [moved from lib/nbsd_libc/time/Makefile with 100% similarity]
lib/libc/time/Makefile.inc [moved from lib/nbsd_libc/time/Makefile.inc with 100% similarity]
lib/libc/time/README [moved from lib/nbsd_libc/time/README with 100% similarity]
lib/libc/time/Theory [moved from lib/nbsd_libc/time/Theory with 100% similarity]
lib/libc/time/_daylight.c [moved from lib/nbsd_libc/time/_daylight.c with 100% similarity]
lib/libc/time/asctime.c [moved from lib/nbsd_libc/time/asctime.c with 100% similarity]
lib/libc/time/checktab.awk [moved from lib/nbsd_libc/time/checktab.awk with 100% similarity]
lib/libc/time/ctime.3 [moved from lib/nbsd_libc/time/ctime.3 with 100% similarity]
lib/libc/time/difftime.c [moved from lib/nbsd_libc/time/difftime.c with 100% similarity]
lib/libc/time/getdate.3 [moved from lib/nbsd_libc/time/getdate.3 with 100% similarity]
lib/libc/time/getdate.c [moved from lib/nbsd_libc/time/getdate.c with 100% similarity]
lib/libc/time/ialloc.c [moved from lib/nbsd_libc/time/ialloc.c with 100% similarity]
lib/libc/time/localtime.c [moved from lib/nbsd_libc/time/localtime.c with 100% similarity]
lib/libc/time/offtime.3 [moved from lib/nbsd_libc/time/offtime.3 with 100% similarity]
lib/libc/time/private.h [moved from lib/nbsd_libc/time/private.h with 100% similarity]
lib/libc/time/scheck.c [moved from lib/nbsd_libc/time/scheck.c with 100% similarity]
lib/libc/time/strftime.3 [moved from lib/nbsd_libc/time/strftime.3 with 100% similarity]
lib/libc/time/strftime.c [moved from lib/nbsd_libc/time/strftime.c with 100% similarity]
lib/libc/time/strptime.3 [moved from lib/nbsd_libc/time/strptime.3 with 100% similarity]
lib/libc/time/strptime.c [moved from lib/nbsd_libc/time/strptime.c with 100% similarity]
lib/libc/time/time2posix.3 [moved from lib/nbsd_libc/time/time2posix.3 with 100% similarity]
lib/libc/time/tz-art.htm [moved from lib/nbsd_libc/time/tz-art.htm with 100% similarity]
lib/libc/time/tz-link.htm [moved from lib/nbsd_libc/time/tz-link.htm with 100% similarity]
lib/libc/time/tzcode2netbsd [moved from lib/nbsd_libc/time/tzcode2netbsd with 100% similarity]
lib/libc/time/tzfile.5 [moved from lib/nbsd_libc/time/tzfile.5 with 100% similarity]
lib/libc/time/tzfile.h [moved from lib/nbsd_libc/time/tzfile.h with 100% similarity]
lib/libc/time/tzselect.8 [moved from lib/nbsd_libc/time/tzselect.8 with 100% similarity]
lib/libc/time/tzselect.ksh [moved from lib/nbsd_libc/time/tzselect.ksh with 100% similarity]
lib/libc/time/tzset.3 [moved from lib/nbsd_libc/time/tzset.3 with 100% similarity]
lib/libc/time/zdump.8 [moved from lib/nbsd_libc/time/zdump.8 with 100% similarity]
lib/libc/time/zdump.c [moved from lib/nbsd_libc/time/zdump.c with 100% similarity]
lib/libc/time/zic.8 [moved from lib/nbsd_libc/time/zic.8 with 100% similarity]
lib/libc/time/zic.c [moved from lib/nbsd_libc/time/zic.c with 100% similarity]
lib/libc/uuid/Makefile.inc [moved from lib/nbsd_libc/uuid/Makefile.inc with 100% similarity]
lib/libc/uuid/uuid.3 [moved from lib/nbsd_libc/uuid/uuid.3 with 100% similarity]
lib/libc/uuid/uuid_compare.c [moved from lib/nbsd_libc/uuid/uuid_compare.c with 100% similarity]
lib/libc/uuid/uuid_create.c [moved from lib/nbsd_libc/uuid/uuid_create.c with 100% similarity]
lib/libc/uuid/uuid_create_nil.c [moved from lib/nbsd_libc/uuid/uuid_create_nil.c with 100% similarity]
lib/libc/uuid/uuid_equal.c [moved from lib/nbsd_libc/uuid/uuid_equal.c with 100% similarity]
lib/libc/uuid/uuid_from_string.c [moved from lib/nbsd_libc/uuid/uuid_from_string.c with 100% similarity]
lib/libc/uuid/uuid_hash.c [moved from lib/nbsd_libc/uuid/uuid_hash.c with 100% similarity]
lib/libc/uuid/uuid_is_nil.c [moved from lib/nbsd_libc/uuid/uuid_is_nil.c with 100% similarity]
lib/libc/uuid/uuid_stream.c [moved from lib/nbsd_libc/uuid/uuid_stream.c with 100% similarity]
lib/libc/uuid/uuid_to_string.c [moved from lib/nbsd_libc/uuid/uuid_to_string.c with 100% similarity]
lib/libc/wchar/Makefile.inc [deleted file]
lib/libc/wchar/towlower.c [deleted file]
lib/libc/wchar/towupper.c [deleted file]
lib/libc/wchar/wcscasecmp.c [deleted file]
lib/libc/wchar/wcscat.c [deleted file]
lib/libc/wchar/wcschr.c [deleted file]
lib/libc/wchar/wcscmp.c [deleted file]
lib/libc/wchar/wcscpy.c [deleted file]
lib/libc/wchar/wcscspn.c [deleted file]
lib/libc/wchar/wcsdup.c [deleted file]
lib/libc/wchar/wcslcat.c [deleted file]
lib/libc/wchar/wcslcpy.c [deleted file]
lib/libc/wchar/wcslen.c [deleted file]
lib/libc/wchar/wcsncasecmp.c [deleted file]
lib/libc/wchar/wcsncat.c [deleted file]
lib/libc/wchar/wcsncmp.c [deleted file]
lib/libc/wchar/wcsncpy.c [deleted file]
lib/libc/wchar/wcspbrk.c [deleted file]
lib/libc/wchar/wcsrchr.c [deleted file]
lib/libc/wchar/wcsspn.c [deleted file]
lib/libc/wchar/wcsstr.c [deleted file]
lib/libc/wchar/wcstok.c [deleted file]
lib/libc/wchar/wcstombs.c [deleted file]
lib/libc/wchar/wcswcs.c [deleted file]
lib/libc/wchar/wctomb.c [deleted file]
lib/libc/wchar/wmemchr.c [deleted file]
lib/libc/wchar/wmemcmp.c [deleted file]
lib/libc/wchar/wmemcpy.c [deleted file]
lib/libc/wchar/wmemmove.c [deleted file]
lib/libc/wchar/wmemset.c [deleted file]
lib/libc/yp/Makefile.inc [moved from lib/nbsd_libc/yp/Makefile.inc with 100% similarity]
lib/libc/yp/local.h [moved from lib/nbsd_libc/yp/local.h with 100% similarity]
lib/libc/yp/xdryp.c [moved from lib/nbsd_libc/yp/xdryp.c with 100% similarity]
lib/libc/yp/yp_all.c [moved from lib/nbsd_libc/yp/yp_all.c with 100% similarity]
lib/libc/yp/yp_first.c [moved from lib/nbsd_libc/yp/yp_first.c with 100% similarity]
lib/libc/yp/yp_maplist.c [moved from lib/nbsd_libc/yp/yp_maplist.c with 100% similarity]
lib/libc/yp/yp_master.c [moved from lib/nbsd_libc/yp/yp_master.c with 100% similarity]
lib/libc/yp/yp_match.c [moved from lib/nbsd_libc/yp/yp_match.c with 100% similarity]
lib/libc/yp/yp_order.c [moved from lib/nbsd_libc/yp/yp_order.c with 100% similarity]
lib/libc/yp/ypclnt.3 [moved from lib/nbsd_libc/yp/ypclnt.3 with 100% similarity]
lib/libc/yp/yperr_string.c [moved from lib/nbsd_libc/yp/yperr_string.c with 100% similarity]
lib/libc/yp/yplib.c [moved from lib/nbsd_libc/yp/yplib.c with 100% similarity]
lib/libc/yp/ypprot_err.c [moved from lib/nbsd_libc/yp/ypprot_err.c with 100% similarity]
lib/libcompat_minix/Makefile [moved from lib/nbsd_libcompat_minix/Makefile with 100% similarity]
lib/libcompat_minix/configfile.c [moved from lib/libc/other/configfile.c with 100% similarity]
lib/libcompat_minix/cuserid.c [moved from lib/libc/other/cuserid.c with 100% similarity]
lib/libcompat_minix/fttyslot.c [moved from lib/nbsd_libcompat_minix/fttyslot.c with 100% similarity]
lib/libcompat_minix/include/Makefile.inc [moved from lib/nbsd_libcompat_minix/include/Makefile.inc with 82% similarity]
lib/libcompat_minix/include/compat/a.out.h [moved from include/minix/a.out.h with 100% similarity]
lib/libcompat_minix/include/compat/pwd.h [moved from lib/nbsd_libcompat_minix/include/compat/pwd.h with 100% similarity]
lib/libcompat_minix/include/compat/regexp.h [moved from lib/nbsd_libcompat_minix/include/compat/regexp.h with 100% similarity]
lib/libcompat_minix/include/compat/syslog.h [moved from lib/nbsd_libcompat_minix/include/compat/syslog.h with 100% similarity]
lib/libcompat_minix/include/configfile.h [moved from include/configfile.h with 100% similarity]
lib/libcompat_minix/include/i386/compat_jmp_buf.h [moved from lib/nbsd_libcompat_minix/include/i386/compat_jmp_buf.h with 100% similarity]
lib/libcompat_minix/include/net/gen/nameser.h [moved from lib/nbsd_libcompat_minix/include/net/gen/nameser.h with 100% similarity]
lib/libcompat_minix/include/net/gen/netdb.h [moved from lib/nbsd_libcompat_minix/include/net/gen/netdb.h with 100% similarity]
lib/libcompat_minix/include/net/gen/resolv.h [moved from lib/nbsd_libcompat_minix/include/net/gen/resolv.h with 100% similarity]
lib/libcompat_minix/include/sys/jmp_buf.h [moved from lib/nbsd_libcompat_minix/include/sys/jmp_buf.h with 100% similarity]
lib/libcompat_minix/include/sys/sigcontext.h [moved from lib/nbsd_libcompat_minix/include/sys/sigcontext.h with 100% similarity]
lib/libcompat_minix/mtab.c [moved from lib/nbsd_libcompat_minix/mtab.c with 100% similarity]
lib/libcompat_minix/nlist.c [moved from lib/libc/other/nlist.c with 100% similarity]
lib/libcompat_minix/pkgconfig/Makefile [moved from lib/nbsd_libcompat_minix/pkgconfig/Makefile with 100% similarity]
lib/libcompat_minix/pkgconfig/compat_minix.pc [moved from lib/nbsd_libcompat_minix/pkgconfig/compat_minix.pc with 100% similarity]
lib/libcompat_minix/stderr.c [moved from lib/libc/other/stderr.c with 100% similarity]
lib/libcompat_minix/v8regerror.c [moved from lib/nbsd_libcompat_minix/v8regerror.c with 100% similarity]
lib/libcompat_minix/v8regexp.c [moved from lib/nbsd_libcompat_minix/v8regexp.c with 100% similarity]
lib/libcompat_minix/v8regsub.c [moved from lib/nbsd_libcompat_minix/v8regsub.c with 100% similarity]
lib/libddekit/Makefile
lib/libddekit/build/Makefile
lib/libddekit/build/ddekit/Makefile
lib/libddekit/build/ddekit_usb_client/Makefile
lib/libddekit/build/ddekit_usb_server/Makefile
lib/libend/Makefile [deleted file]
lib/libend/Makefile.inc [deleted file]
lib/libend/edata.S [deleted file]
lib/libend/em_end.S [deleted file]
lib/libend/end.S [deleted file]
lib/libend/etext.S [deleted file]
lib/libend/gnu/Makefile.inc [deleted file]
lib/libend/gnu/gnu_end.S [deleted file]
lib/libm/Makefile
lib/libm/arch/i387/Makefile [moved from lib/nbsd_libm/arch/i387/Makefile with 100% similarity]
lib/libm/arch/i387/abi.h [moved from lib/nbsd_libm/arch/i387/abi.h with 100% similarity]
lib/libm/arch/i387/e_acos.S [moved from lib/nbsd_libm/arch/i387/e_acos.S with 100% similarity]
lib/libm/arch/i387/e_asin.S [moved from lib/nbsd_libm/arch/i387/e_asin.S with 100% similarity]
lib/libm/arch/i387/e_atan2.S [moved from lib/nbsd_libm/arch/i387/e_atan2.S with 100% similarity]
lib/libm/arch/i387/e_atan2f.S [moved from lib/nbsd_libm/arch/i387/e_atan2f.S with 100% similarity]
lib/libm/arch/i387/e_exp.S [moved from lib/nbsd_libm/arch/i387/e_exp.S with 100% similarity]
lib/libm/arch/i387/e_expf.S [moved from lib/nbsd_libm/arch/i387/e_expf.S with 100% similarity]
lib/libm/arch/i387/e_fmod.S [moved from lib/nbsd_libm/arch/i387/e_fmod.S with 100% similarity]
lib/libm/arch/i387/e_log.S [moved from lib/nbsd_libm/arch/i387/e_log.S with 100% similarity]
lib/libm/arch/i387/e_log10.S [moved from lib/nbsd_libm/arch/i387/e_log10.S with 100% similarity]
lib/libm/arch/i387/e_log10f.S [moved from lib/nbsd_libm/arch/i387/e_log10f.S with 100% similarity]
lib/libm/arch/i387/e_log2.S [moved from lib/nbsd_libm/arch/i387/e_log2.S with 100% similarity]
lib/libm/arch/i387/e_log2f.S [moved from lib/nbsd_libm/arch/i387/e_log2f.S with 100% similarity]
lib/libm/arch/i387/e_logf.S [moved from lib/nbsd_libm/arch/i387/e_logf.S with 100% similarity]
lib/libm/arch/i387/e_remainder.S [moved from lib/nbsd_libm/arch/i387/e_remainder.S with 100% similarity]
lib/libm/arch/i387/e_remainderf.S [moved from lib/nbsd_libm/arch/i387/e_remainderf.S with 100% similarity]
lib/libm/arch/i387/e_scalb.S [moved from lib/nbsd_libm/arch/i387/e_scalb.S with 100% similarity]
lib/libm/arch/i387/e_scalbf.S [moved from lib/nbsd_libm/arch/i387/e_scalbf.S with 100% similarity]
lib/libm/arch/i387/e_sqrt.S [moved from lib/nbsd_libm/arch/i387/e_sqrt.S with 100% similarity]
lib/libm/arch/i387/e_sqrtf.S [moved from lib/nbsd_libm/arch/i387/e_sqrtf.S with 100% similarity]
lib/libm/arch/i387/empty.S [moved from lib/nbsd_libm/arch/i387/empty.S with 100% similarity]
lib/libm/arch/i387/fenv.c [moved from lib/nbsd_libm/arch/i387/fenv.c with 100% similarity]
lib/libm/arch/i387/lrint.S [moved from lib/nbsd_libm/arch/i387/lrint.S with 100% similarity]
lib/libm/arch/i387/s_atan.S [moved from lib/nbsd_libm/arch/i387/s_atan.S with 100% similarity]
lib/libm/arch/i387/s_atanf.S [moved from lib/nbsd_libm/arch/i387/s_atanf.S with 100% similarity]
lib/libm/arch/i387/s_ceil.S [moved from lib/nbsd_libm/arch/i387/s_ceil.S with 100% similarity]
lib/libm/arch/i387/s_ceilf.S [moved from lib/nbsd_libm/arch/i387/s_ceilf.S with 100% similarity]
lib/libm/arch/i387/s_copysign.S [moved from lib/nbsd_libm/arch/i387/s_copysign.S with 100% similarity]
lib/libm/arch/i387/s_copysignf.S [moved from lib/nbsd_libm/arch/i387/s_copysignf.S with 100% similarity]
lib/libm/arch/i387/s_cos.S [moved from lib/nbsd_libm/arch/i387/s_cos.S with 100% similarity]
lib/libm/arch/i387/s_cosf.S [moved from lib/nbsd_libm/arch/i387/s_cosf.S with 100% similarity]
lib/libm/arch/i387/s_finite.S [moved from lib/nbsd_libm/arch/i387/s_finite.S with 100% similarity]
lib/libm/arch/i387/s_finitef.S [moved from lib/nbsd_libm/arch/i387/s_finitef.S with 100% similarity]
lib/libm/arch/i387/s_floor.S [moved from lib/nbsd_libm/arch/i387/s_floor.S with 100% similarity]
lib/libm/arch/i387/s_floorf.S [moved from lib/nbsd_libm/arch/i387/s_floorf.S with 100% similarity]
lib/libm/arch/i387/s_ilogb.S [moved from lib/nbsd_libm/arch/i387/s_ilogb.S with 100% similarity]
lib/libm/arch/i387/s_ilogbf.S [moved from lib/nbsd_libm/arch/i387/s_ilogbf.S with 100% similarity]
lib/libm/arch/i387/s_log1p.S [moved from lib/nbsd_libm/arch/i387/s_log1p.S with 100% similarity]
lib/libm/arch/i387/s_log1pf.S [moved from lib/nbsd_libm/arch/i387/s_log1pf.S with 100% similarity]
lib/libm/arch/i387/s_logb.S [moved from lib/nbsd_libm/arch/i387/s_logb.S with 100% similarity]
lib/libm/arch/i387/s_logbf.S [moved from lib/nbsd_libm/arch/i387/s_logbf.S with 100% similarity]
lib/libm/arch/i387/s_modf.S [moved from lib/nbsd_libm/arch/i387/s_modf.S with 100% similarity]
lib/libm/arch/i387/s_rint.S [moved from lib/nbsd_libm/arch/i387/s_rint.S with 100% similarity]
lib/libm/arch/i387/s_rintf.S [moved from lib/nbsd_libm/arch/i387/s_rintf.S with 100% similarity]
lib/libm/arch/i387/s_scalbn.S [moved from lib/nbsd_libm/arch/i387/s_scalbn.S with 100% similarity]
lib/libm/arch/i387/s_scalbnf.S [moved from lib/nbsd_libm/arch/i387/s_scalbnf.S with 100% similarity]
lib/libm/arch/i387/s_significand.S [moved from lib/nbsd_libm/arch/i387/s_significand.S with 100% similarity]
lib/libm/arch/i387/s_significandf.S [moved from lib/nbsd_libm/arch/i387/s_significandf.S with 100% similarity]
lib/libm/arch/i387/s_sin.S [moved from lib/nbsd_libm/arch/i387/s_sin.S with 100% similarity]
lib/libm/arch/i387/s_sinf.S [moved from lib/nbsd_libm/arch/i387/s_sinf.S with 100% similarity]
lib/libm/arch/i387/s_tan.S [moved from lib/nbsd_libm/arch/i387/s_tan.S with 100% similarity]
lib/libm/arch/i387/s_tanf.S [moved from lib/nbsd_libm/arch/i387/s_tanf.S with 100% similarity]
lib/libm/arch/i387/shlib_version [moved from lib/nbsd_libm/arch/i387/shlib_version with 100% similarity]
lib/libm/arch/x86_64/fenv.c [moved from lib/nbsd_libm/arch/x86_64/fenv.c with 100% similarity]
lib/libm/compat/compat_cabs.c [moved from lib/nbsd_libm/compat/compat_cabs.c with 100% similarity]
lib/libm/compat/compat_cabsf.c [moved from lib/nbsd_libm/compat/compat_cabsf.c with 100% similarity]
lib/libm/complex/Makefile.inc [moved from lib/nbsd_libm/complex/Makefile.inc with 100% similarity]
lib/libm/complex/cabs.3 [moved from lib/nbsd_libm/complex/cabs.3 with 100% similarity]
lib/libm/complex/cabs.c [moved from lib/nbsd_libm/complex/cabs.c with 100% similarity]
lib/libm/complex/cabsf.c [moved from lib/nbsd_libm/complex/cabsf.c with 100% similarity]
lib/libm/complex/cacos.3 [moved from lib/nbsd_libm/complex/cacos.3 with 100% similarity]
lib/libm/complex/cacos.c [moved from lib/nbsd_libm/complex/cacos.c with 100% similarity]
lib/libm/complex/cacosf.c [moved from lib/nbsd_libm/complex/cacosf.c with 100% similarity]
lib/libm/complex/cacosh.3 [moved from lib/nbsd_libm/complex/cacosh.3 with 100% similarity]
lib/libm/complex/cacosh.c [moved from lib/nbsd_libm/complex/cacosh.c with 100% similarity]
lib/libm/complex/cacoshf.c [moved from lib/nbsd_libm/complex/cacoshf.c with 100% similarity]
lib/libm/complex/carg.3 [moved from lib/nbsd_libm/complex/carg.3 with 100% similarity]
lib/libm/complex/carg.c [moved from lib/nbsd_libm/complex/carg.c with 100% similarity]
lib/libm/complex/cargf.c [moved from lib/nbsd_libm/complex/cargf.c with 100% similarity]
lib/libm/complex/casin.3 [moved from lib/nbsd_libm/complex/casin.3 with 100% similarity]
lib/libm/complex/casin.c [moved from lib/nbsd_libm/complex/casin.c with 100% similarity]
lib/libm/complex/casinf.c [moved from lib/nbsd_libm/complex/casinf.c with 100% similarity]
lib/libm/complex/casinh.3 [moved from lib/nbsd_libm/complex/casinh.3 with 100% similarity]
lib/libm/complex/casinh.c [moved from lib/nbsd_libm/complex/casinh.c with 100% similarity]
lib/libm/complex/casinhf.c [moved from lib/nbsd_libm/complex/casinhf.c with 100% similarity]
lib/libm/complex/catan.3 [moved from lib/nbsd_libm/complex/catan.3 with 100% similarity]
lib/libm/complex/catan.c [moved from lib/nbsd_libm/complex/catan.c with 100% similarity]
lib/libm/complex/catanf.c [moved from lib/nbsd_libm/complex/catanf.c with 100% similarity]
lib/libm/complex/catanh.3 [moved from lib/nbsd_libm/complex/catanh.3 with 100% similarity]
lib/libm/complex/catanh.c [moved from lib/nbsd_libm/complex/catanh.c with 100% similarity]
lib/libm/complex/catanhf.c [moved from lib/nbsd_libm/complex/catanhf.c with 100% similarity]
lib/libm/complex/ccos.3 [moved from lib/nbsd_libm/complex/ccos.3 with 100% similarity]
lib/libm/complex/ccos.c [moved from lib/nbsd_libm/complex/ccos.c with 100% similarity]
lib/libm/complex/ccosf.c [moved from lib/nbsd_libm/complex/ccosf.c with 100% similarity]
lib/libm/complex/ccosh.3 [moved from lib/nbsd_libm/complex/ccosh.3 with 100% similarity]
lib/libm/complex/ccosh.c [moved from lib/nbsd_libm/complex/ccosh.c with 100% similarity]
lib/libm/complex/ccoshf.c [moved from lib/nbsd_libm/complex/ccoshf.c with 100% similarity]
lib/libm/complex/cephes_subr.c [moved from lib/nbsd_libm/complex/cephes_subr.c with 100% similarity]
lib/libm/complex/cephes_subr.h [moved from lib/nbsd_libm/complex/cephes_subr.h with 100% similarity]
lib/libm/complex/cephes_subrf.c [moved from lib/nbsd_libm/complex/cephes_subrf.c with 100% similarity]
lib/libm/complex/cephes_subrf.h [moved from lib/nbsd_libm/complex/cephes_subrf.h with 100% similarity]
lib/libm/complex/cexp.3 [moved from lib/nbsd_libm/complex/cexp.3 with 100% similarity]
lib/libm/complex/cexp.c [moved from lib/nbsd_libm/complex/cexp.c with 100% similarity]
lib/libm/complex/cexpf.c [moved from lib/nbsd_libm/complex/cexpf.c with 100% similarity]
lib/libm/complex/cimag.3 [moved from lib/nbsd_libm/complex/cimag.3 with 100% similarity]
lib/libm/complex/cimag.c [moved from lib/nbsd_libm/complex/cimag.c with 100% similarity]
lib/libm/complex/cimagf.c [moved from lib/nbsd_libm/complex/cimagf.c with 100% similarity]
lib/libm/complex/cimagl.c [moved from lib/nbsd_libm/complex/cimagl.c with 100% similarity]
lib/libm/complex/clog.3 [moved from lib/nbsd_libm/complex/clog.3 with 100% similarity]
lib/libm/complex/clog.c [moved from lib/nbsd_libm/complex/clog.c with 100% similarity]
lib/libm/complex/clogf.c [moved from lib/nbsd_libm/complex/clogf.c with 100% similarity]
lib/libm/complex/conj.3 [moved from lib/nbsd_libm/complex/conj.3 with 100% similarity]
lib/libm/complex/conj.c [moved from lib/nbsd_libm/complex/conj.c with 100% similarity]
lib/libm/complex/conjf.c [moved from lib/nbsd_libm/complex/conjf.c with 100% similarity]
lib/libm/complex/conjl.c [moved from lib/nbsd_libm/complex/conjl.c with 100% similarity]
lib/libm/complex/cpow.3 [moved from lib/nbsd_libm/complex/cpow.3 with 100% similarity]
lib/libm/complex/cpow.c [moved from lib/nbsd_libm/complex/cpow.c with 100% similarity]
lib/libm/complex/cpowf.c [moved from lib/nbsd_libm/complex/cpowf.c with 100% similarity]
lib/libm/complex/cproj.3 [moved from lib/nbsd_libm/complex/cproj.3 with 100% similarity]
lib/libm/complex/cproj.c [moved from lib/nbsd_libm/complex/cproj.c with 100% similarity]
lib/libm/complex/cprojf.c [moved from lib/nbsd_libm/complex/cprojf.c with 100% similarity]
lib/libm/complex/cprojl.c [moved from lib/nbsd_libm/complex/cprojl.c with 100% similarity]
lib/libm/complex/creal.3 [moved from lib/nbsd_libm/complex/creal.3 with 100% similarity]
lib/libm/complex/creal.c [moved from lib/nbsd_libm/complex/creal.c with 100% similarity]
lib/libm/complex/crealf.c [moved from lib/nbsd_libm/complex/crealf.c with 100% similarity]
lib/libm/complex/creall.c [moved from lib/nbsd_libm/complex/creall.c with 100% similarity]
lib/libm/complex/csin.3 [moved from lib/nbsd_libm/complex/csin.3 with 100% similarity]
lib/libm/complex/csin.c [moved from lib/nbsd_libm/complex/csin.c with 100% similarity]
lib/libm/complex/csinf.c [moved from lib/nbsd_libm/complex/csinf.c with 100% similarity]
lib/libm/complex/csinh.3 [moved from lib/nbsd_libm/complex/csinh.3 with 100% similarity]
lib/libm/complex/csinh.c [moved from lib/nbsd_libm/complex/csinh.c with 100% similarity]
lib/libm/complex/csinhf.c [moved from lib/nbsd_libm/complex/csinhf.c with 100% similarity]
lib/libm/complex/csqrt.3 [moved from lib/nbsd_libm/complex/csqrt.3 with 100% similarity]
lib/libm/complex/csqrt.c [moved from lib/nbsd_libm/complex/csqrt.c with 100% similarity]
lib/libm/complex/csqrtf.c [moved from lib/nbsd_libm/complex/csqrtf.c with 100% similarity]
lib/libm/complex/ctan.3 [moved from lib/nbsd_libm/complex/ctan.3 with 100% similarity]
lib/libm/complex/ctan.c [moved from lib/nbsd_libm/complex/ctan.c with 100% similarity]
lib/libm/complex/ctanf.c [moved from lib/nbsd_libm/complex/ctanf.c with 100% similarity]
lib/libm/complex/ctanh.3 [moved from lib/nbsd_libm/complex/ctanh.3 with 100% similarity]
lib/libm/complex/ctanh.c [moved from lib/nbsd_libm/complex/ctanh.c with 100% similarity]
lib/libm/complex/ctanhf.c [moved from lib/nbsd_libm/complex/ctanhf.c with 100% similarity]
lib/libm/dummy.c [deleted file]
lib/libm/gen/Makefile.inc [moved from lib/nbsd_libm/gen/Makefile.inc with 100% similarity]
lib/libm/gen/nan.3 [moved from lib/nbsd_libm/gen/nan.3 with 100% similarity]
lib/libm/gen/nan.c [moved from lib/nbsd_libm/gen/nan.c with 100% similarity]
lib/libm/gen/nanf.c [moved from lib/nbsd_libm/gen/nanf.c with 100% similarity]
lib/libm/gen/nanl.c [moved from lib/nbsd_libm/gen/nanl.c with 100% similarity]
lib/libm/man/acos.3 [moved from lib/nbsd_libm/man/acos.3 with 100% similarity]
lib/libm/man/acosh.3 [moved from lib/nbsd_libm/man/acosh.3 with 100% similarity]
lib/libm/man/asin.3 [moved from lib/nbsd_libm/man/asin.3 with 100% similarity]
lib/libm/man/asinh.3 [moved from lib/nbsd_libm/man/asinh.3 with 100% similarity]
lib/libm/man/atan.3 [moved from lib/nbsd_libm/man/atan.3 with 100% similarity]
lib/libm/man/atan2.3 [moved from lib/nbsd_libm/man/atan2.3 with 100% similarity]
lib/libm/man/atanh.3 [moved from lib/nbsd_libm/man/atanh.3 with 100% similarity]
lib/libm/man/ceil.3 [moved from lib/nbsd_libm/man/ceil.3 with 100% similarity]
lib/libm/man/cos.3 [moved from lib/nbsd_libm/man/cos.3 with 100% similarity]
lib/libm/man/cosh.3 [moved from lib/nbsd_libm/man/cosh.3 with 100% similarity]
lib/libm/man/erf.3 [moved from lib/nbsd_libm/man/erf.3 with 100% similarity]
lib/libm/man/exp.3 [moved from lib/nbsd_libm/man/exp.3 with 100% similarity]
lib/libm/man/fabs.3 [moved from lib/nbsd_libm/man/fabs.3 with 100% similarity]
lib/libm/man/fdim.3 [moved from lib/nbsd_libm/man/fdim.3 with 100% similarity]
lib/libm/man/feclearexcept.3 [moved from lib/nbsd_libm/man/feclearexcept.3 with 100% similarity]
lib/libm/man/feenableexcept.3 [moved from lib/nbsd_libm/man/feenableexcept.3 with 100% similarity]
lib/libm/man/fegetenv.3 [moved from lib/nbsd_libm/man/fegetenv.3 with 100% similarity]
lib/libm/man/fegetround.3 [moved from lib/nbsd_libm/man/fegetround.3 with 100% similarity]
lib/libm/man/fenv.3 [moved from lib/nbsd_libm/man/fenv.3 with 100% similarity]
lib/libm/man/floor.3 [moved from lib/nbsd_libm/man/floor.3 with 100% similarity]
lib/libm/man/fmax.3 [moved from lib/nbsd_libm/man/fmax.3 with 100% similarity]
lib/libm/man/fmod.3 [moved from lib/nbsd_libm/man/fmod.3 with 100% similarity]
lib/libm/man/frexp.3 [moved from lib/nbsd_libm/man/frexp.3 with 100% similarity]
lib/libm/man/hypot.3 [moved from lib/nbsd_libm/man/hypot.3 with 100% similarity]
lib/libm/man/ieee.3 [moved from lib/nbsd_libm/man/ieee.3 with 100% similarity]
lib/libm/man/ieee_test.3 [moved from lib/nbsd_libm/man/ieee_test.3 with 100% similarity]
lib/libm/man/isinff.3 [moved from lib/nbsd_libm/man/isinff.3 with 100% similarity]
lib/libm/man/j0.3 [moved from lib/nbsd_libm/man/j0.3 with 100% similarity]
lib/libm/man/ldexp.3 [moved from lib/nbsd_libm/man/ldexp.3 with 100% similarity]
lib/libm/man/lgamma.3 [moved from lib/nbsd_libm/man/lgamma.3 with 100% similarity]
lib/libm/man/lrint.3 [moved from lib/nbsd_libm/man/lrint.3 with 100% similarity]
lib/libm/man/math.3 [moved from lib/nbsd_libm/man/math.3 with 100% similarity]
lib/libm/man/modf.3 [moved from lib/nbsd_libm/man/modf.3 with 100% similarity]
lib/libm/man/rint.3 [moved from lib/nbsd_libm/man/rint.3 with 100% similarity]
lib/libm/man/round.3 [moved from lib/nbsd_libm/man/round.3 with 100% similarity]
lib/libm/man/sin.3 [moved from lib/nbsd_libm/man/sin.3 with 100% similarity]
lib/libm/man/sinh.3 [moved from lib/nbsd_libm/man/sinh.3 with 100% similarity]
lib/libm/man/sqrt.3 [moved from lib/nbsd_libm/man/sqrt.3 with 100% similarity]
lib/libm/man/tan.3 [moved from lib/nbsd_libm/man/tan.3 with 100% similarity]
lib/libm/man/tanh.3 [moved from lib/nbsd_libm/man/tanh.3 with 100% similarity]
lib/libm/man/trunc.3 [moved from lib/nbsd_libm/man/trunc.3 with 100% similarity]
lib/libm/noieee_src/mathimpl.h [moved from lib/libc/math/mathimpl.h with 100% similarity]
lib/libm/noieee_src/n_acosh.c [moved from lib/nbsd_libm/noieee_src/n_acosh.c with 100% similarity]
lib/libm/noieee_src/n_asincos.c [moved from lib/nbsd_libm/noieee_src/n_asincos.c with 100% similarity]
lib/libm/noieee_src/n_asinh.c [moved from lib/nbsd_libm/noieee_src/n_asinh.c with 100% similarity]
lib/libm/noieee_src/n_atan.c [moved from lib/nbsd_libm/noieee_src/n_atan.c with 100% similarity]
lib/libm/noieee_src/n_atan2.c [moved from lib/nbsd_libm/noieee_src/n_atan2.c with 100% similarity]
lib/libm/noieee_src/n_atanh.c [moved from lib/nbsd_libm/noieee_src/n_atanh.c with 100% similarity]
lib/libm/noieee_src/n_cabs.c [moved from lib/nbsd_libm/noieee_src/n_cabs.c with 100% similarity]
lib/libm/noieee_src/n_cbrt.c [moved from lib/nbsd_libm/noieee_src/n_cbrt.c with 100% similarity]
lib/libm/noieee_src/n_cosh.c [moved from lib/nbsd_libm/noieee_src/n_cosh.c with 100% similarity]
lib/libm/noieee_src/n_erf.c [moved from lib/nbsd_libm/noieee_src/n_erf.c with 100% similarity]
lib/libm/noieee_src/n_exp.c [moved from lib/nbsd_libm/noieee_src/n_exp.c with 100% similarity]
lib/libm/noieee_src/n_exp__E.c [moved from lib/nbsd_libm/noieee_src/n_exp__E.c with 100% similarity]
lib/libm/noieee_src/n_expm1.c [moved from lib/nbsd_libm/noieee_src/n_expm1.c with 100% similarity]
lib/libm/noieee_src/n_floor.c [moved from lib/nbsd_libm/noieee_src/n_floor.c with 100% similarity]
lib/libm/noieee_src/n_fmax.c [moved from lib/nbsd_libm/noieee_src/n_fmax.c with 100% similarity]
lib/libm/noieee_src/n_fmaxf.c [moved from lib/nbsd_libm/noieee_src/n_fmaxf.c with 100% similarity]
lib/libm/noieee_src/n_fmin.c [moved from lib/nbsd_libm/noieee_src/n_fmin.c with 100% similarity]
lib/libm/noieee_src/n_fminf.c [moved from lib/nbsd_libm/noieee_src/n_fminf.c with 100% similarity]
lib/libm/noieee_src/n_fmod.c [moved from lib/nbsd_libm/noieee_src/n_fmod.c with 100% similarity]
lib/libm/noieee_src/n_gamma.c [moved from lib/nbsd_libm/noieee_src/n_gamma.c with 100% similarity]
lib/libm/noieee_src/n_j0.c [moved from lib/nbsd_libm/noieee_src/n_j0.c with 100% similarity]
lib/libm/noieee_src/n_j1.c [moved from lib/libc/math/n_j1.c with 100% similarity]
lib/libm/noieee_src/n_jn.c [moved from lib/nbsd_libm/noieee_src/n_jn.c with 100% similarity]
lib/libm/noieee_src/n_lgamma.c [moved from lib/nbsd_libm/noieee_src/n_lgamma.c with 100% similarity]
lib/libm/noieee_src/n_log.c [moved from lib/nbsd_libm/noieee_src/n_log.c with 100% similarity]
lib/libm/noieee_src/n_log10.c [moved from lib/nbsd_libm/noieee_src/n_log10.c with 100% similarity]
lib/libm/noieee_src/n_log1p.c [moved from lib/nbsd_libm/noieee_src/n_log1p.c with 100% similarity]
lib/libm/noieee_src/n_log__L.c [moved from lib/nbsd_libm/noieee_src/n_log__L.c with 100% similarity]
lib/libm/noieee_src/n_lround.c [moved from lib/nbsd_libm/noieee_src/n_lround.c with 100% similarity]
lib/libm/noieee_src/n_lroundf.c [moved from lib/nbsd_libm/noieee_src/n_lroundf.c with 100% similarity]
lib/libm/noieee_src/n_pow.c [moved from lib/nbsd_libm/noieee_src/n_pow.c with 100% similarity]
lib/libm/noieee_src/n_round.c [moved from lib/nbsd_libm/noieee_src/n_round.c with 100% similarity]
lib/libm/noieee_src/n_roundf.c [moved from lib/nbsd_libm/noieee_src/n_roundf.c with 100% similarity]
lib/libm/noieee_src/n_sincos.c [moved from lib/nbsd_libm/noieee_src/n_sincos.c with 100% similarity]
lib/libm/noieee_src/n_sinh.c [moved from lib/nbsd_libm/noieee_src/n_sinh.c with 100% similarity]
lib/libm/noieee_src/n_support.c [moved from lib/nbsd_libm/noieee_src/n_support.c with 100% similarity]
lib/libm/noieee_src/n_tan.c [moved from lib/nbsd_libm/noieee_src/n_tan.c with 100% similarity]
lib/libm/noieee_src/n_tanh.c [moved from lib/nbsd_libm/noieee_src/n_tanh.c with 100% similarity]
lib/libm/noieee_src/trig.h [moved from lib/nbsd_libm/noieee_src/trig.h with 100% similarity]
lib/libm/shlib_version [moved from lib/nbsd_libm/shlib_version with 100% similarity]
lib/libm/src/e_acos.c [moved from lib/nbsd_libm/src/e_acos.c with 100% similarity]
lib/libm/src/e_acosf.c [moved from lib/nbsd_libm/src/e_acosf.c with 100% similarity]
lib/libm/src/e_acosh.c [moved from lib/nbsd_libm/src/e_acosh.c with 100% similarity]
lib/libm/src/e_acoshf.c [moved from lib/nbsd_libm/src/e_acoshf.c with 100% similarity]
lib/libm/src/e_asin.c [moved from lib/nbsd_libm/src/e_asin.c with 100% similarity]
lib/libm/src/e_asinf.c [moved from lib/nbsd_libm/src/e_asinf.c with 100% similarity]
lib/libm/src/e_atan2.c [moved from lib/nbsd_libm/src/e_atan2.c with 100% similarity]
lib/libm/src/e_atan2f.c [moved from lib/nbsd_libm/src/e_atan2f.c with 100% similarity]
lib/libm/src/e_atanh.c [moved from lib/nbsd_libm/src/e_atanh.c with 100% similarity]
lib/libm/src/e_atanhf.c [moved from lib/nbsd_libm/src/e_atanhf.c with 100% similarity]
lib/libm/src/e_cosh.c [moved from lib/nbsd_libm/src/e_cosh.c with 100% similarity]
lib/libm/src/e_coshf.c [moved from lib/nbsd_libm/src/e_coshf.c with 100% similarity]
lib/libm/src/e_exp.c [moved from lib/nbsd_libm/src/e_exp.c with 100% similarity]
lib/libm/src/e_expf.c [moved from lib/nbsd_libm/src/e_expf.c with 100% similarity]
lib/libm/src/e_fmod.c [moved from lib/nbsd_libm/src/e_fmod.c with 100% similarity]
lib/libm/src/e_fmodf.c [moved from lib/nbsd_libm/src/e_fmodf.c with 100% similarity]
lib/libm/src/e_hypot.c [moved from lib/nbsd_libm/src/e_hypot.c with 100% similarity]
lib/libm/src/e_hypotf.c [moved from lib/nbsd_libm/src/e_hypotf.c with 100% similarity]
lib/libm/src/e_j0.c [moved from lib/nbsd_libm/src/e_j0.c with 100% similarity]
lib/libm/src/e_j0f.c [moved from lib/nbsd_libm/src/e_j0f.c with 100% similarity]
lib/libm/src/e_j1.c [moved from lib/nbsd_libm/src/e_j1.c with 100% similarity]
lib/libm/src/e_j1f.c [moved from lib/nbsd_libm/src/e_j1f.c with 100% similarity]
lib/libm/src/e_jn.c [moved from lib/nbsd_libm/src/e_jn.c with 100% similarity]
lib/libm/src/e_jnf.c [moved from lib/nbsd_libm/src/e_jnf.c with 100% similarity]
lib/libm/src/e_lgamma_r.c [moved from lib/nbsd_libm/src/e_lgamma_r.c with 100% similarity]
lib/libm/src/e_lgammaf_r.c [moved from lib/nbsd_libm/src/e_lgammaf_r.c with 100% similarity]
lib/libm/src/e_log.c [moved from lib/nbsd_libm/src/e_log.c with 100% similarity]
lib/libm/src/e_log10.c [moved from lib/nbsd_libm/src/e_log10.c with 100% similarity]
lib/libm/src/e_log10f.c [moved from lib/nbsd_libm/src/e_log10f.c with 100% similarity]
lib/libm/src/e_log2.c [moved from lib/nbsd_libm/src/e_log2.c with 100% similarity]
lib/libm/src/e_log2f.c [moved from lib/nbsd_libm/src/e_log2f.c with 100% similarity]
lib/libm/src/e_logf.c [moved from lib/nbsd_libm/src/e_logf.c with 100% similarity]
lib/libm/src/e_pow.c [moved from lib/nbsd_libm/src/e_pow.c with 100% similarity]
lib/libm/src/e_powf.c [moved from lib/nbsd_libm/src/e_powf.c with 100% similarity]
lib/libm/src/e_rem_pio2.c [moved from lib/nbsd_libm/src/e_rem_pio2.c with 100% similarity]
lib/libm/src/e_rem_pio2f.c [moved from lib/nbsd_libm/src/e_rem_pio2f.c with 100% similarity]
lib/libm/src/e_remainder.c [moved from lib/nbsd_libm/src/e_remainder.c with 100% similarity]
lib/libm/src/e_remainderf.c [moved from lib/nbsd_libm/src/e_remainderf.c with 100% similarity]
lib/libm/src/e_scalb.c [moved from lib/nbsd_libm/src/e_scalb.c with 100% similarity]
lib/libm/src/e_scalbf.c [moved from lib/nbsd_libm/src/e_scalbf.c with 100% similarity]
lib/libm/src/e_sinh.c [moved from lib/nbsd_libm/src/e_sinh.c with 100% similarity]
lib/libm/src/e_sinhf.c [moved from lib/nbsd_libm/src/e_sinhf.c with 100% similarity]
lib/libm/src/e_sqrt.c [moved from lib/nbsd_libm/src/e_sqrt.c with 100% similarity]
lib/libm/src/e_sqrtf.c [moved from lib/nbsd_libm/src/e_sqrtf.c with 100% similarity]
lib/libm/src/k_cos.c [moved from lib/nbsd_libm/src/k_cos.c with 100% similarity]
lib/libm/src/k_cosf.c [moved from lib/nbsd_libm/src/k_cosf.c with 100% similarity]
lib/libm/src/k_rem_pio2.c [moved from lib/nbsd_libm/src/k_rem_pio2.c with 100% similarity]
lib/libm/src/k_rem_pio2f.c [moved from lib/nbsd_libm/src/k_rem_pio2f.c with 100% similarity]
lib/libm/src/k_sin.c [moved from lib/nbsd_libm/src/k_sin.c with 100% similarity]
lib/libm/src/k_sinf.c [moved from lib/nbsd_libm/src/k_sinf.c with 100% similarity]
lib/libm/src/k_standard.c [moved from lib/nbsd_libm/src/k_standard.c with 100% similarity]
lib/libm/src/k_tan.c [moved from lib/nbsd_libm/src/k_tan.c with 100% similarity]
lib/libm/src/k_tanf.c [moved from lib/nbsd_libm/src/k_tanf.c with 100% similarity]
lib/libm/src/llrint.c [moved from lib/nbsd_libm/src/llrint.c with 100% similarity]
lib/libm/src/llrintf.c [moved from lib/nbsd_libm/src/llrintf.c with 100% similarity]
lib/libm/src/llround.c [moved from lib/nbsd_libm/src/llround.c with 100% similarity]
lib/libm/src/llroundf.c [moved from lib/nbsd_libm/src/llroundf.c with 100% similarity]
lib/libm/src/lrint.c [moved from lib/nbsd_libm/src/lrint.c with 100% similarity]
lib/libm/src/lrintf.c [moved from lib/nbsd_libm/src/lrintf.c with 100% similarity]
lib/libm/src/lround.c [moved from lib/nbsd_libm/src/lround.c with 100% similarity]
lib/libm/src/lroundf.c [moved from lib/nbsd_libm/src/lroundf.c with 100% similarity]
lib/libm/src/math_private.h [moved from lib/nbsd_libm/src/math_private.h with 100% similarity]
lib/libm/src/namespace.h [moved from lib/nbsd_libm/src/namespace.h with 100% similarity]
lib/libm/src/s_asinh.c [moved from lib/nbsd_libm/src/s_asinh.c with 100% similarity]
lib/libm/src/s_asinhf.c [moved from lib/nbsd_libm/src/s_asinhf.c with 100% similarity]
lib/libm/src/s_atan.c [moved from lib/nbsd_libm/src/s_atan.c with 100% similarity]
lib/libm/src/s_atanf.c [moved from lib/nbsd_libm/src/s_atanf.c with 100% similarity]
lib/libm/src/s_cbrt.c [moved from lib/nbsd_libm/src/s_cbrt.c with 100% similarity]
lib/libm/src/s_cbrtf.c [moved from lib/nbsd_libm/src/s_cbrtf.c with 100% similarity]
lib/libm/src/s_ceil.c [moved from lib/nbsd_libm/src/s_ceil.c with 100% similarity]
lib/libm/src/s_ceilf.c [moved from lib/nbsd_libm/src/s_ceilf.c with 100% similarity]
lib/libm/src/s_copysign.c [moved from lib/nbsd_libm/src/s_copysign.c with 100% similarity]
lib/libm/src/s_copysignf.c [moved from lib/nbsd_libm/src/s_copysignf.c with 100% similarity]
lib/libm/src/s_copysignl.c [moved from lib/nbsd_libm/src/s_copysignl.c with 100% similarity]
lib/libm/src/s_cos.c [moved from lib/nbsd_libm/src/s_cos.c with 100% similarity]
lib/libm/src/s_cosf.c [moved from lib/nbsd_libm/src/s_cosf.c with 100% similarity]
lib/libm/src/s_erf.c [moved from lib/nbsd_libm/src/s_erf.c with 100% similarity]
lib/libm/src/s_erff.c [moved from lib/nbsd_libm/src/s_erff.c with 100% similarity]
lib/libm/src/s_exp2.c [moved from lib/nbsd_libm/src/s_exp2.c with 100% similarity]
lib/libm/src/s_exp2f.c [moved from lib/nbsd_libm/src/s_exp2f.c with 100% similarity]
lib/libm/src/s_expm1.c [moved from lib/nbsd_libm/src/s_expm1.c with 100% similarity]
lib/libm/src/s_expm1f.c [moved from lib/nbsd_libm/src/s_expm1f.c with 100% similarity]
lib/libm/src/s_fabs.c [moved from lib/nbsd_libm/src/s_fabs.c with 100% similarity]
lib/libm/src/s_fabsf.c [moved from lib/nbsd_libm/src/s_fabsf.c with 100% similarity]
lib/libm/src/s_fabsl.c [moved from lib/nbsd_libm/src/s_fabsl.c with 100% similarity]
lib/libm/src/s_fdim.c [moved from lib/nbsd_libm/src/s_fdim.c with 100% similarity]
lib/libm/src/s_finite.c [moved from lib/nbsd_libm/src/s_finite.c with 100% similarity]
lib/libm/src/s_finitef.c [moved from lib/nbsd_libm/src/s_finitef.c with 100% similarity]
lib/libm/src/s_floor.c [moved from lib/nbsd_libm/src/s_floor.c with 100% similarity]
lib/libm/src/s_floorf.c [moved from lib/nbsd_libm/src/s_floorf.c with 100% similarity]
lib/libm/src/s_fmax.c [moved from lib/nbsd_libm/src/s_fmax.c with 100% similarity]
lib/libm/src/s_fmaxf.c [moved from lib/nbsd_libm/src/s_fmaxf.c with 100% similarity]
lib/libm/src/s_fmaxl.c [moved from lib/nbsd_libm/src/s_fmaxl.c with 100% similarity]
lib/libm/src/s_fmin.c [moved from lib/nbsd_libm/src/s_fmin.c with 100% similarity]
lib/libm/src/s_fminf.c [moved from lib/nbsd_libm/src/s_fminf.c with 100% similarity]
lib/libm/src/s_fminl.c [moved from lib/nbsd_libm/src/s_fminl.c with 100% similarity]
lib/libm/src/s_frexp.c [moved from lib/nbsd_libm/src/s_frexp.c with 100% similarity]
lib/libm/src/s_frexpf.c [moved from lib/nbsd_libm/src/s_frexpf.c with 100% similarity]
lib/libm/src/s_ilogb.c [moved from lib/nbsd_libm/src/s_ilogb.c with 100% similarity]
lib/libm/src/s_ilogbf.c [moved from lib/nbsd_libm/src/s_ilogbf.c with 100% similarity]
lib/libm/src/s_infinity.c [moved from lib/nbsd_libm/src/s_infinity.c with 100% similarity]
lib/libm/src/s_isinf.c [moved from lib/nbsd_libm/src/s_isinf.c with 100% similarity]
lib/libm/src/s_isinff.c [moved from lib/nbsd_libm/src/s_isinff.c with 100% similarity]
lib/libm/src/s_isnan.c [moved from lib/nbsd_libm/src/s_isnan.c with 100% similarity]
lib/libm/src/s_isnanf.c [moved from lib/nbsd_libm/src/s_isnanf.c with 100% similarity]
lib/libm/src/s_ldexp.c [moved from lib/nbsd_libm/src/s_ldexp.c with 100% similarity]
lib/libm/src/s_ldexpf.c [moved from lib/nbsd_libm/src/s_ldexpf.c with 100% similarity]
lib/libm/src/s_lib_version.c [moved from lib/nbsd_libm/src/s_lib_version.c with 100% similarity]
lib/libm/src/s_log1p.c [moved from lib/nbsd_libm/src/s_log1p.c with 100% similarity]
lib/libm/src/s_log1pf.c [moved from lib/nbsd_libm/src/s_log1pf.c with 100% similarity]
lib/libm/src/s_logb.c [moved from lib/nbsd_libm/src/s_logb.c with 100% similarity]
lib/libm/src/s_logbf.c [moved from lib/nbsd_libm/src/s_logbf.c with 100% similarity]
lib/libm/src/s_matherr.c [moved from lib/nbsd_libm/src/s_matherr.c with 100% similarity]
lib/libm/src/s_modf.c [moved from lib/nbsd_libm/src/s_modf.c with 100% similarity]
lib/libm/src/s_modff.c [moved from lib/nbsd_libm/src/s_modff.c with 100% similarity]
lib/libm/src/s_nextafter.c [moved from lib/nbsd_libm/src/s_nextafter.c with 100% similarity]
lib/libm/src/s_nextafterf.c [moved from lib/nbsd_libm/src/s_nextafterf.c with 100% similarity]
lib/libm/src/s_nextafterl.c [moved from lib/nbsd_libm/src/s_nextafterl.c with 100% similarity]
lib/libm/src/s_nexttoward.c [moved from lib/nbsd_libm/src/s_nexttoward.c with 100% similarity]
lib/libm/src/s_rint.c [moved from lib/nbsd_libm/src/s_rint.c with 100% similarity]
lib/libm/src/s_rintf.c [moved from lib/nbsd_libm/src/s_rintf.c with 100% similarity]
lib/libm/src/s_round.c [moved from lib/nbsd_libm/src/s_round.c with 100% similarity]
lib/libm/src/s_roundf.c [moved from lib/nbsd_libm/src/s_roundf.c with 100% similarity]
lib/libm/src/s_scalbn.c [moved from lib/nbsd_libm/src/s_scalbn.c with 100% similarity]
lib/libm/src/s_scalbnf.c [moved from lib/nbsd_libm/src/s_scalbnf.c with 100% similarity]
lib/libm/src/s_signgam.c [moved from lib/nbsd_libm/src/s_signgam.c with 100% similarity]
lib/libm/src/s_significand.c [moved from lib/nbsd_libm/src/s_significand.c with 100% similarity]
lib/libm/src/s_significandf.c [moved from lib/nbsd_libm/src/s_significandf.c with 100% similarity]
lib/libm/src/s_sin.c [moved from lib/nbsd_libm/src/s_sin.c with 100% similarity]
lib/libm/src/s_sinf.c [moved from lib/nbsd_libm/src/s_sinf.c with 100% similarity]
lib/libm/src/s_tan.c [moved from lib/nbsd_libm/src/s_tan.c with 100% similarity]
lib/libm/src/s_tanf.c [moved from lib/nbsd_libm/src/s_tanf.c with 100% similarity]
lib/libm/src/s_tanh.c [moved from lib/nbsd_libm/src/s_tanh.c with 100% similarity]
lib/libm/src/s_tanhf.c [moved from lib/nbsd_libm/src/s_tanhf.c with 100% similarity]
lib/libm/src/s_trunc.c [moved from lib/nbsd_libm/src/s_trunc.c with 100% similarity]
lib/libm/src/s_truncf.c [moved from lib/nbsd_libm/src/s_truncf.c with 100% similarity]
lib/libm/src/w_acos.c [moved from lib/nbsd_libm/src/w_acos.c with 100% similarity]
lib/libm/src/w_acosf.c [moved from lib/nbsd_libm/src/w_acosf.c with 100% similarity]
lib/libm/src/w_acosh.c [moved from lib/nbsd_libm/src/w_acosh.c with 100% similarity]
lib/libm/src/w_acoshf.c [moved from lib/nbsd_libm/src/w_acoshf.c with 100% similarity]
lib/libm/src/w_asin.c [moved from lib/nbsd_libm/src/w_asin.c with 100% similarity]
lib/libm/src/w_asinf.c [moved from lib/nbsd_libm/src/w_asinf.c with 100% similarity]
lib/libm/src/w_atan2.c [moved from lib/nbsd_libm/src/w_atan2.c with 100% similarity]
lib/libm/src/w_atan2f.c [moved from lib/nbsd_libm/src/w_atan2f.c with 100% similarity]
lib/libm/src/w_atanh.c [moved from lib/nbsd_libm/src/w_atanh.c with 100% similarity]
lib/libm/src/w_atanhf.c [moved from lib/nbsd_libm/src/w_atanhf.c with 100% similarity]
lib/libm/src/w_cosh.c [moved from lib/nbsd_libm/src/w_cosh.c with 100% similarity]
lib/libm/src/w_coshf.c [moved from lib/nbsd_libm/src/w_coshf.c with 100% similarity]
lib/libm/src/w_drem.c [moved from lib/nbsd_libm/src/w_drem.c with 100% similarity]
lib/libm/src/w_dremf.c [moved from lib/nbsd_libm/src/w_dremf.c with 100% similarity]
lib/libm/src/w_exp.c [moved from lib/nbsd_libm/src/w_exp.c with 100% similarity]
lib/libm/src/w_expf.c [moved from lib/nbsd_libm/src/w_expf.c with 100% similarity]
lib/libm/src/w_fmod.c [moved from lib/nbsd_libm/src/w_fmod.c with 100% similarity]
lib/libm/src/w_fmodf.c [moved from lib/nbsd_libm/src/w_fmodf.c with 100% similarity]
lib/libm/src/w_gamma.c [moved from lib/nbsd_libm/src/w_gamma.c with 100% similarity]
lib/libm/src/w_gamma_r.c [moved from lib/nbsd_libm/src/w_gamma_r.c with 100% similarity]
lib/libm/src/w_gammaf.c [moved from lib/nbsd_libm/src/w_gammaf.c with 100% similarity]
lib/libm/src/w_gammaf_r.c [moved from lib/nbsd_libm/src/w_gammaf_r.c with 100% similarity]
lib/libm/src/w_hypot.c [moved from lib/nbsd_libm/src/w_hypot.c with 100% similarity]
lib/libm/src/w_hypotf.c [moved from lib/nbsd_libm/src/w_hypotf.c with 100% similarity]
lib/libm/src/w_j0.c [moved from lib/nbsd_libm/src/w_j0.c with 100% similarity]
lib/libm/src/w_j0f.c [moved from lib/nbsd_libm/src/w_j0f.c with 100% similarity]
lib/libm/src/w_j1.c [moved from lib/nbsd_libm/src/w_j1.c with 100% similarity]
lib/libm/src/w_j1f.c [moved from lib/nbsd_libm/src/w_j1f.c with 100% similarity]
lib/libm/src/w_jn.c [moved from lib/nbsd_libm/src/w_jn.c with 100% similarity]
lib/libm/src/w_jnf.c [moved from lib/nbsd_libm/src/w_jnf.c with 100% similarity]
lib/libm/src/w_lgamma.c [moved from lib/nbsd_libm/src/w_lgamma.c with 100% similarity]
lib/libm/src/w_lgamma_r.c [moved from lib/nbsd_libm/src/w_lgamma_r.c with 100% similarity]
lib/libm/src/w_lgammaf.c [moved from lib/nbsd_libm/src/w_lgammaf.c with 100% similarity]
lib/libm/src/w_lgammaf_r.c [moved from lib/nbsd_libm/src/w_lgammaf_r.c with 100% similarity]
lib/libm/src/w_log.c [moved from lib/nbsd_libm/src/w_log.c with 100% similarity]
lib/libm/src/w_log10.c [moved from lib/nbsd_libm/src/w_log10.c with 100% similarity]
lib/libm/src/w_log10f.c [moved from lib/nbsd_libm/src/w_log10f.c with 100% similarity]
lib/libm/src/w_log2.c [moved from lib/nbsd_libm/src/w_log2.c with 100% similarity]
lib/libm/src/w_log2f.c [moved from lib/nbsd_libm/src/w_log2f.c with 100% similarity]
lib/libm/src/w_logf.c [moved from lib/nbsd_libm/src/w_logf.c with 100% similarity]
lib/libm/src/w_pow.c [moved from lib/nbsd_libm/src/w_pow.c with 100% similarity]
lib/libm/src/w_powf.c [moved from lib/nbsd_libm/src/w_powf.c with 100% similarity]
lib/libm/src/w_remainder.c [moved from lib/nbsd_libm/src/w_remainder.c with 100% similarity]
lib/libm/src/w_remainderf.c [moved from lib/nbsd_libm/src/w_remainderf.c with 100% similarity]
lib/libm/src/w_scalb.c [moved from lib/nbsd_libm/src/w_scalb.c with 100% similarity]
lib/libm/src/w_scalbf.c [moved from lib/nbsd_libm/src/w_scalbf.c with 100% similarity]
lib/libm/src/w_sinh.c [moved from lib/nbsd_libm/src/w_sinh.c with 100% similarity]
lib/libm/src/w_sinhf.c [moved from lib/nbsd_libm/src/w_sinhf.c with 100% similarity]
lib/libm/src/w_sqrt.c [moved from lib/nbsd_libm/src/w_sqrt.c with 100% similarity]
lib/libm/src/w_sqrtf.c [moved from lib/nbsd_libm/src/w_sqrtf.c with 100% similarity]
lib/libminc/Makefile
lib/libminixutil/Makefile [deleted file]
lib/libminixutil/efun.c [deleted file]
lib/libminixutil/md5c.c [deleted file]
lib/libminixutil/md5hl.c [deleted file]
lib/libminixutil/openpty.c [deleted file]
lib/libminixutil/sha1.c [deleted file]
lib/libminixutil/sha1hl.c [deleted file]
lib/libminixutil/sha2.c [deleted file]
lib/libminixutil/sha2hl.c [deleted file]
lib/libminlib/Makefile [moved from lib/nbsd_libminlib/Makefile with 100% similarity]
lib/libminlib/dhcp_gettag.c [moved from lib/libc/ip/dhcp_gettag.c with 100% similarity]
lib/libminlib/dhcp_settag.c [moved from lib/libc/ip/dhcp_settag.c with 100% similarity]
lib/libminlib/fslib.c [moved from lib/libc/other/fslib.c with 100% similarity]
lib/libminlib/fsversion.c [moved from lib/libc/other/fsversion.c with 100% similarity]
lib/libminlib/gcov.c [moved from lib/libc/other/gcov.c with 100% similarity]
lib/libminlib/gcov_flush.c [moved from lib/libc/other/gcov_flush.c with 100% similarity]
lib/libminlib/getngid.c [moved from lib/nbsd_libminlib/getngid.c with 100% similarity]
lib/libminlib/getnpid.c [moved from lib/nbsd_libminlib/getnpid.c with 100% similarity]
lib/libminlib/getnprocnr.c [moved from lib/nbsd_libminlib/getnprocnr.c with 100% similarity]
lib/libminlib/getnucred.c [moved from lib/nbsd_libminlib/getnucred.c with 100% similarity]
lib/libminlib/getnuid.c [moved from lib/nbsd_libminlib/getnuid.c with 100% similarity]
lib/libminlib/getprocnr.c [moved from lib/nbsd_libminlib/getprocnr.c with 100% similarity]
lib/libminlib/i386/Makefile.inc [moved from lib/nbsd_libminlib/i386/Makefile.inc with 100% similarity]
lib/libminlib/i386/_cpufeature.c [moved from lib/nbsd_libminlib/i386/_cpufeature.c with 100% similarity]
lib/libminlib/i386/_cpuid.S [moved from lib/libc/arch/i386/misc/_cpuid.S with 100% similarity]
lib/libminlib/i386/get_bp.S [moved from lib/libc/arch/i386/misc/get_bp.S with 100% similarity]
lib/libminlib/i386/getprocessor.S [moved from lib/libc/arch/i386/misc/getprocessor.S with 100% similarity]
lib/libminlib/i386/oneC_sum.S [moved from lib/libc/arch/i386/misc/oneC_sum.S with 100% similarity]
lib/libminlib/i386/read_tsc.S [moved from lib/libc/other/read_tsc.S with 100% similarity]
lib/libminlib/i386/read_tsc_64.c [moved from lib/libc/other/read_tsc_64.c with 100% similarity]
lib/libminlib/itoa.c [moved from lib/libc/other/itoa.c with 100% similarity]
lib/libminlib/mapdriver.c [moved from lib/nbsd_libminlib/mapdriver.c with 100% similarity]
lib/libminlib/paramvalue.c [moved from lib/libc/other/paramvalue.c with 100% similarity]
lib/libminlib/pkgconfig/Makefile [moved from lib/nbsd_libminlib/pkgconfig/Makefile with 100% similarity]
lib/libminlib/pkgconfig/minlib.pc [moved from lib/nbsd_libminlib/pkgconfig/minlib.pc with 100% similarity]
lib/libminlib/servxcheck.c [moved from lib/nbsd_libminlib/servxcheck.c with 100% similarity]
lib/libminlib/svrctl.c [moved from lib/nbsd_libminlib/svrctl.c with 100% similarity]
lib/libminlib/tools.h [moved from include/tools.h with 100% similarity]
lib/libminlib/u64util.c [moved from lib/libc/other/u64util.c with 100% similarity]
lib/libminlib/vm_memctl.c [moved from lib/nbsd_libminlib/vm_memctl.c with 100% similarity]
lib/libminlib/vm_query_exit.c [moved from lib/nbsd_libminlib/vm_query_exit.c with 100% similarity]
lib/libminlib/vm_set_priv.c [moved from lib/nbsd_libminlib/vm_set_priv.c with 100% similarity]
lib/libminlib/vm_update.c [moved from lib/nbsd_libminlib/vm_update.c with 100% similarity]
lib/libprop/Makefile
lib/libutil/Makefile
lib/nbsd_libasyn/asynchio.h [deleted file]
lib/nbsd_libc/Makefile [deleted file]
lib/nbsd_libc/Makefile.inc [deleted file]
lib/nbsd_libc/arch/i386/string/Makefile.inc [deleted file]
lib/nbsd_libc/arch/i386/string/bcmp.S [deleted file]
lib/nbsd_libc/arch/i386/string/bcopy.S [deleted file]
lib/nbsd_libc/arch/i386/string/bzero.S [deleted file]
lib/nbsd_libc/arch/i386/string/index.S [deleted file]
lib/nbsd_libc/arch/i386/string/rindex.S [deleted file]
lib/nbsd_libc/arch/i386/string/strncmp.S [deleted file]
lib/nbsd_libc/arch/i386/sys-minix/__sigreturn.S [deleted file]
lib/nbsd_libc/arch/i386/sys-minix/_ipc.S [deleted file]
lib/nbsd_libc/arch/i386/sys-minix/_senda.S [deleted file]
lib/nbsd_libc/arch/i386/sys-minix/brksize.S [deleted file]
lib/nbsd_libc/arch/i386/sys-minix/ucontext.S [deleted file]
lib/nbsd_libc/db/Makefile.inc [deleted file]
lib/nbsd_libc/db/README [deleted file]
lib/nbsd_libc/db/btree/Makefile.inc [deleted file]
lib/nbsd_libc/db/btree/bt_close.c [deleted file]
lib/nbsd_libc/db/btree/bt_conv.c [deleted file]
lib/nbsd_libc/db/btree/bt_debug.c [deleted file]
lib/nbsd_libc/db/btree/bt_delete.c [deleted file]
lib/nbsd_libc/db/btree/bt_get.c [deleted file]
lib/nbsd_libc/db/btree/bt_open.c [deleted file]
lib/nbsd_libc/db/btree/bt_overflow.c [deleted file]
lib/nbsd_libc/db/btree/bt_page.c [deleted file]
lib/nbsd_libc/db/btree/bt_put.c [deleted file]
lib/nbsd_libc/db/btree/bt_search.c [deleted file]
lib/nbsd_libc/db/btree/bt_seq.c [deleted file]
lib/nbsd_libc/db/btree/bt_split.c [deleted file]
lib/nbsd_libc/db/btree/bt_utils.c [deleted file]
lib/nbsd_libc/db/btree/btree.h [deleted file]
lib/nbsd_libc/db/btree/extern.h [deleted file]
lib/nbsd_libc/db/changelog [deleted file]
lib/nbsd_libc/db/db/Makefile.inc [deleted file]
lib/nbsd_libc/db/db/db.c [deleted file]
lib/nbsd_libc/db/db2netbsd [deleted file]
lib/nbsd_libc/db/hash/Makefile.inc [deleted file]
lib/nbsd_libc/db/hash/README [deleted file]
lib/nbsd_libc/db/hash/extern.h [deleted file]
lib/nbsd_libc/db/hash/hash.c [deleted file]
lib/nbsd_libc/db/hash/hash.h [deleted file]
lib/nbsd_libc/db/hash/hash_bigkey.c [deleted file]
lib/nbsd_libc/db/hash/hash_buf.c [deleted file]
lib/nbsd_libc/db/hash/hash_func.c [deleted file]
lib/nbsd_libc/db/hash/hash_log2.c [deleted file]
lib/nbsd_libc/db/hash/hash_page.c [deleted file]
lib/nbsd_libc/db/hash/ndbm.c [deleted file]
lib/nbsd_libc/db/hash/ndbmdatum.c [deleted file]
lib/nbsd_libc/db/hash/page.h [deleted file]
lib/nbsd_libc/db/man/Makefile.inc [deleted file]
lib/nbsd_libc/db/man/btree.3 [deleted file]
lib/nbsd_libc/db/man/dbm_clearerr.3 [deleted file]
lib/nbsd_libc/db/man/dbopen.3 [deleted file]
lib/nbsd_libc/db/man/hash.3 [deleted file]
lib/nbsd_libc/db/man/mpool.3 [deleted file]
lib/nbsd_libc/db/man/recno.3 [deleted file]
lib/nbsd_libc/db/mpool/Makefile.inc [deleted file]
lib/nbsd_libc/db/mpool/README [deleted file]
lib/nbsd_libc/db/mpool/mpool.c [deleted file]
lib/nbsd_libc/db/recno/Makefile.inc [deleted file]
lib/nbsd_libc/db/recno/extern.h [deleted file]
lib/nbsd_libc/db/recno/rec_close.c [deleted file]
lib/nbsd_libc/db/recno/rec_delete.c [deleted file]
lib/nbsd_libc/db/recno/rec_get.c [deleted file]
lib/nbsd_libc/db/recno/rec_open.c [deleted file]
lib/nbsd_libc/db/recno/rec_put.c [deleted file]
lib/nbsd_libc/db/recno/rec_search.c [deleted file]
lib/nbsd_libc/db/recno/rec_seq.c [deleted file]
lib/nbsd_libc/db/recno/rec_utils.c [deleted file]
lib/nbsd_libc/db/recno/recno.h [deleted file]
lib/nbsd_libc/gen/err.c [deleted file]
lib/nbsd_libc/gen/errx.c [deleted file]
lib/nbsd_libc/gen/minix/raise.c [deleted file]
lib/nbsd_libc/gen/pwcache.h [deleted file]
lib/nbsd_libc/gen/verr.c [deleted file]
lib/nbsd_libc/gen/verrx.c [deleted file]
lib/nbsd_libc/gen/vwarn.c [deleted file]
lib/nbsd_libc/gen/warn.c [deleted file]
lib/nbsd_libc/regex/COPYRIGHT [deleted file]
lib/nbsd_libc/regex/Makefile.inc [deleted file]
lib/nbsd_libc/regex/WHATSNEW [deleted file]
lib/nbsd_libc/regex/cclass.h [deleted file]
lib/nbsd_libc/regex/cname.h [deleted file]
lib/nbsd_libc/regex/engine.c [deleted file]
lib/nbsd_libc/regex/re_format.7 [deleted file]
lib/nbsd_libc/regex/regcomp.c [deleted file]
lib/nbsd_libc/regex/regerror.c [deleted file]
lib/nbsd_libc/regex/regex.3 [deleted file]
lib/nbsd_libc/regex/regex2.h [deleted file]
lib/nbsd_libc/regex/regexec.c [deleted file]
lib/nbsd_libc/regex/regfree.c [deleted file]
lib/nbsd_libc/regex/utils.h [deleted file]
lib/nbsd_libc/stdio/Makefile.inc [deleted file]
lib/nbsd_libc/stdio/asprintf.c [deleted file]
lib/nbsd_libc/stdio/fclose.c [deleted file]
lib/nbsd_libc/stdio/feof.c [deleted file]
lib/nbsd_libc/stdio/ferror.c [deleted file]
lib/nbsd_libc/stdio/fflush.c [deleted file]
lib/nbsd_libc/stdio/fgetc.c [deleted file]
lib/nbsd_libc/stdio/fgetpos.c [deleted file]
lib/nbsd_libc/stdio/fgets.c [deleted file]
lib/nbsd_libc/stdio/fileno.c [deleted file]
lib/nbsd_libc/stdio/fopen.c [deleted file]
lib/nbsd_libc/stdio/fprintf.c [deleted file]
lib/nbsd_libc/stdio/fputc.c [deleted file]
lib/nbsd_libc/stdio/fputs.c [deleted file]
lib/nbsd_libc/stdio/fread.c [deleted file]
lib/nbsd_libc/stdio/freopen.c [deleted file]
lib/nbsd_libc/stdio/fscanf.c [deleted file]
lib/nbsd_libc/stdio/fseek.c [deleted file]
lib/nbsd_libc/stdio/fsetpos.c [deleted file]
lib/nbsd_libc/stdio/ftell.c [deleted file]
lib/nbsd_libc/stdio/fwrite.c [deleted file]
lib/nbsd_libc/stdio/getc.c [deleted file]
lib/nbsd_libc/stdio/getchar.c [deleted file]
lib/nbsd_libc/stdio/gets.c [deleted file]
lib/nbsd_libc/stdio/mktemp.c [deleted file]
lib/nbsd_libc/stdio/perror.c [deleted file]
lib/nbsd_libc/stdio/printf.c [deleted file]
lib/nbsd_libc/stdio/putc.c [deleted file]
lib/nbsd_libc/stdio/putchar.c [deleted file]
lib/nbsd_libc/stdio/puts.c [deleted file]
lib/nbsd_libc/stdio/remove.c [deleted file]
lib/nbsd_libc/stdio/rewind.c [deleted file]
lib/nbsd_libc/stdio/scanf.c [deleted file]
lib/nbsd_libc/stdio/setbuf.c [deleted file]
lib/nbsd_libc/stdio/setvbuf.c [deleted file]
lib/nbsd_libc/stdio/snprintf.c [deleted file]
lib/nbsd_libc/stdio/sprintf.c [deleted file]
lib/nbsd_libc/stdio/sscanf.c [deleted file]
lib/nbsd_libc/stdio/tmpfile.c [deleted file]
lib/nbsd_libc/stdio/tmpnam.c [deleted file]
lib/nbsd_libc/stdio/ungetc.c [deleted file]
lib/nbsd_libc/stdio/vfprintf.c [deleted file]
lib/nbsd_libc/stdio/vprintf.c [deleted file]
lib/nbsd_libc/stdio/vscanf.c [deleted file]
lib/nbsd_libc/stdio/vsnprintf.c [deleted file]
lib/nbsd_libc/stdio/vsprintf.c [deleted file]
lib/nbsd_libc/stdio/vsscanf.c [deleted file]
lib/nbsd_libc/sys-minix/environ.c [deleted file]
lib/nbsd_libc/sys-minix/sizeup.c [deleted file]
lib/nbsd_libcompat_minix/configfile.c [deleted file]
lib/nbsd_libcompat_minix/cuserid.c [deleted file]
lib/nbsd_libcompat_minix/include/compat/a.out.h [deleted file]
lib/nbsd_libcompat_minix/include/configfile.h [deleted file]
lib/nbsd_libcompat_minix/nlist.c [deleted file]
lib/nbsd_libcompat_minix/stderr.c [deleted file]
lib/nbsd_libm/Makefile [deleted file]
lib/nbsd_libm/noieee_src/mathimpl.h [deleted file]
lib/nbsd_libm/noieee_src/n_j1.c [deleted file]
lib/nbsd_libminlib/dhcp_gettag.c [deleted file]
lib/nbsd_libminlib/dhcp_settag.c [deleted file]
lib/nbsd_libminlib/fslib.c [deleted file]
lib/nbsd_libminlib/fsversion.c [deleted file]
lib/nbsd_libminlib/gcov.c [deleted file]
lib/nbsd_libminlib/gcov_flush.c [deleted file]
lib/nbsd_libminlib/i386/_cpuid.S [deleted file]
lib/nbsd_libminlib/i386/get_bp.S [deleted file]
lib/nbsd_libminlib/i386/getprocessor.S [deleted file]
lib/nbsd_libminlib/i386/oneC_sum.S [deleted file]
lib/nbsd_libminlib/i386/read_tsc.S [deleted file]
lib/nbsd_libminlib/i386/read_tsc_64.c [deleted file]
lib/nbsd_libminlib/itoa.c [deleted file]
lib/nbsd_libminlib/paramvalue.c [deleted file]
lib/nbsd_libminlib/tools.h [deleted file]
lib/nbsd_libminlib/u64util.c [deleted file]
libexec/Makefile.inc
man/man1/Makefile
man/man1/cc.1 [deleted file]
man/man1x/Makefile
man/man1x/as.1x [deleted file]
man/man7/ACK.7 [deleted file]
man/man7/Makefile
nbsd_include/Makefile [deleted file]
nbsd_include/a.out.h [deleted file]
nbsd_include/ar.h [deleted file]
nbsd_include/arch/Makefile [deleted file]
nbsd_include/arch/i386/Makefile [deleted file]
nbsd_include/arpa/inet.h [deleted file]
nbsd_include/arpa/nameser.h [deleted file]
nbsd_include/assert.h [deleted file]
nbsd_include/complex.h [deleted file]
nbsd_include/ctype.h [deleted file]
nbsd_include/db.h [deleted file]
nbsd_include/dirent.h [deleted file]
nbsd_include/err.h [deleted file]
nbsd_include/errno.h [deleted file]
nbsd_include/fenv.h [deleted file]
nbsd_include/fnmatch.h [deleted file]
nbsd_include/fts.h [deleted file]
nbsd_include/getopt.h [deleted file]
nbsd_include/glob.h [deleted file]
nbsd_include/grp.h [deleted file]
nbsd_include/ifaddrs.h [deleted file]
nbsd_include/inttypes.h [deleted file]
nbsd_include/libgen.h [deleted file]
nbsd_include/limits.h [deleted file]
nbsd_include/locale.h [deleted file]
nbsd_include/math.h [deleted file]
nbsd_include/minix/dirent.h [deleted file]
nbsd_include/minix/types.h [deleted file]
nbsd_include/mpool.h [deleted file]
nbsd_include/ndbm.h [deleted file]
nbsd_include/net/hton.h [deleted file]
nbsd_include/net/if.h [deleted file]
nbsd_include/net/netlib.h [deleted file]
nbsd_include/netdb.h [deleted file]
nbsd_include/netinet/in.h [deleted file]
nbsd_include/netinet/tcp.h [deleted file]
nbsd_include/paths.h [deleted file]
nbsd_include/pwd.h [deleted file]
nbsd_include/regex.h [deleted file]
nbsd_include/regexp.h [deleted file]
nbsd_include/resolv.h [deleted file]
nbsd_include/setjmp.h [deleted file]
nbsd_include/sgtty.h [deleted file]
nbsd_include/signal.h [deleted file]
nbsd_include/stdbool.h [deleted file]
nbsd_include/stddef.h [deleted file]
nbsd_include/stdio.h [deleted file]
nbsd_include/stdlib.h [deleted file]
nbsd_include/string.h [deleted file]
nbsd_include/strings.h [deleted file]
nbsd_include/sys/Makefile [deleted file]
nbsd_include/sys/cdefs.h [deleted file]
nbsd_include/sys/file.h [deleted file]
nbsd_include/sys/ioctl.h [deleted file]
nbsd_include/sys/ipc.h [deleted file]
nbsd_include/sys/mman.h [deleted file]
nbsd_include/sys/null.h [deleted file]
nbsd_include/sys/param.h [deleted file]
nbsd_include/sys/poll.h [deleted file]
nbsd_include/sys/ptrace.h [deleted file]
nbsd_include/sys/queue.h [deleted file]
nbsd_include/sys/resource.h [deleted file]
nbsd_include/sys/select.h [deleted file]
nbsd_include/sys/sem.h [deleted file]
nbsd_include/sys/shm.h [deleted file]
nbsd_include/sys/signal.h [deleted file]
nbsd_include/sys/socket.h [deleted file]
nbsd_include/sys/stat.h [deleted file]
nbsd_include/sys/statfs.h [deleted file]
nbsd_include/sys/statvfs.h [deleted file]
nbsd_include/sys/time.h [deleted file]
nbsd_include/sys/times.h [deleted file]
nbsd_include/sys/types.h [deleted file]
nbsd_include/sys/ucontext.h [deleted file]
nbsd_include/sys/ucred.h [deleted file]
nbsd_include/sys/uio.h [deleted file]
nbsd_include/sys/un.h [deleted file]
nbsd_include/sys/utsname.h [deleted file]
nbsd_include/sys/wait.h [deleted file]
nbsd_include/sysexits.h [deleted file]
nbsd_include/tar.h [deleted file]
nbsd_include/time.h [deleted file]
nbsd_include/ttyent.h [deleted file]
nbsd_include/tzfile.h [deleted file]
nbsd_include/ucontext.h [deleted file]
nbsd_include/unistd.h [deleted file]
nbsd_include/util.h [deleted file]
nbsd_include/utime.h [deleted file]
nbsd_include/utmp.h [deleted file]
nbsd_include/wchar.h [deleted file]
nbsd_include/wctype.h [deleted file]
sbin/Makefile.inc
servers/Makefile.inc
servers/inet/Makefile
servers/init/Makefile
servers/pfs/Makefile
servers/vfs/Makefile
share/mk/Makefile
share/mk/bsd.lib.mk
share/mk/bsd.own.mk
share/mk/bsd.prog.mk
share/mk/minix.ack.mk [deleted file]
share/mk/minix.ackdep.mk [deleted file]
share/mk/minix.bootprog.mk
share/mk/minix.gcov.mk
share/mk/minix.newlibc.mk [deleted file]
share/mk/minix.service.mk
share/mk/sys.mk
sys/arch/i386/stand/mbr/Makefile.mbr
test/Makefile
test/blocktest/Makefile.inc
test/test9.c
tools/Makefile
tools/chrootmake.sh
tools/mkboot
tools/nbsd_ports
tools/release.sh
tools/tell_config
usr.bin/Makefile.inc
usr.bin/chpass/Makefile
usr.sbin/Makefile.inc
usr.sbin/pwd_mkdb/Makefile
usr.sbin/zic/Makefile

index b09fb8ae3dd9e5fe95a2faddd319a02827156aeb..0fd13dbef348f264228b5c09d2581837f5a3d7d4 100644 (file)
@@ -14,11 +14,6 @@ cscope.*
 *.d
 .depend
 nbsdsrc/*
-obj-ack
-obj-gnu
-obj-elf-base
-obj-elfbase-nbsd
-obj-gnu-nbsd
 tools/revision
 TAGS
 tags
@@ -41,3 +36,4 @@ etc/spwd.db
 tools/image
 tools/kernel
 share/zoneinfo/builddir
+lib/libc/compat__*
index 52413765dcb232fc783e016de56aa85668ce1081..e9e111758a74bc3389fe8a80e107c4e6c269da14 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,8 +12,7 @@ usage:
        @echo "Usage:" 
        @echo " make world         # Compile everything (libraries & commands)"
        @echo " make includes      # Install include files from src/"
-       @echo " make libraries     # Compile and install libraries (ack)"
-       @echo " make elf-libraries # Compile and install gcc/clang elf libs"
+       @echo " make libraries     # Compile and install libraries"
        @echo " make commands      # Compile all, commands, but don't install"
        @echo " make install       # Compile and install commands"
        @echo " make gnu-includes  # Install include files for GCC"
@@ -30,32 +29,21 @@ usage:
 # 'make install' target.
 # 
 # etcfiles has to be done first.
-.if ${COMPILER_TYPE} == "ack"
-world: mkfiles etcfiles includes libraries elf-libraries dep-all install etcforce
-.else
-world: mkfiles etcfiles includes elf-libraries dep-all install etcforce
-.endif
+world: mkfiles etcfiles includes libraries dep-all install etcforce
 
 mkfiles:
        make -C share/mk install
 
 includes:
-       $(MAKE) -C nbsd_include includes
        $(MAKE) -C include includes
        $(MAKE) -C lib includes NBSD_LIBC=yes
-.if ${COMPILER_TYPE} == "ack"
-       $(MAKE) -C lib includes NBSD_LIBC=no
-.endif
-
-libraries: includes
-       $(MAKE) -C lib build_ack
 
 MKHEADERSS=/usr/pkg/gcc*/libexec/gcc/*/*/install-tools/mkheaders
 gnu-includes: includes
        SHELL=/bin/sh; for d in $(MKHEADERSS); do if [ -f $$d ] ; then sh -e $$d ; fi; done
 
-elf-libraries: includes
-       $(MAKE) -C lib build_elf
+libraries: includes
+       $(MAKE) -C lib dependall install
 
 commands: includes libraries
        $(MAKE) -C commands all
@@ -66,8 +54,7 @@ commands: includes libraries
        $(MAKE) -C usr.sbin all
 
 dep-all:
-       $(MAKE) CC=cc -C boot dependall
-       $(MAKE) CC=clang -C sys dependall
+       $(MAKE) -C sys dependall
        $(MAKE) -C commands dependall
        $(MAKE) -C bin dependall
        $(MAKE) -C sbin dependall
@@ -85,8 +72,7 @@ etcforce:
        $(MAKE) -C etc installforce
 
 all:
-       $(MAKE) CC=cc -C boot all
-       $(MAKE) CC=clang -C sys all
+       $(MAKE) -C sys all
        $(MAKE) -C commands all
        $(MAKE) -C bin all
        $(MAKE) -C sbin all
@@ -96,8 +82,7 @@ all:
        $(MAKE) -C tools all
 
 install:
-       $(MAKE) CC=cc -C boot install
-       $(MAKE) CC=clang -C sys install
+       $(MAKE) -C sys install
        $(MAKE) -C libexec install
        $(MAKE) -C man install makedb
        $(MAKE) -C commands install
@@ -110,7 +95,6 @@ install:
        $(MAKE) -C tools install
 
 clean: mkfiles
-       $(MAKE) -C boot clean
        $(MAKE) -C sys clean
        $(MAKE) -C commands clean
        $(MAKE) -C bin clean
@@ -120,12 +104,11 @@ clean: mkfiles
        $(MAKE) -C usr.sbin clean
        $(MAKE) -C share clean
        $(MAKE) -C tools clean
-       $(MAKE) -C lib clean_all
+       $(MAKE) -C lib clean
        $(MAKE) -C test clean
 
 cleandepend: mkfiles
-       $(MAKE) -C lib cleandepend_all
-       $(MAKE) -C boot cleandepend
+       $(MAKE) -C lib cleandepend
        $(MAKE) -C sys cleandepend
        $(MAKE) -C commands cleandepend
        $(MAKE) -C bin cleandepend
@@ -134,3 +117,8 @@ cleandepend: mkfiles
        $(MAKE) -C libexec cleandepend
        $(MAKE) -C usr.sbin cleandepend
        $(MAKE) -C tools cleandepend
+
+# Warn usage change
+elf-libraries:
+       echo "That target is just libraries now."
+       false
index 4444f2aecbe77e3ac66499326f4a315d0e20fa32..b58d3008121e2dbcd3e646ade409de2636e56aa6 100644 (file)
@@ -2,6 +2,6 @@
 
 .include <bsd.own.mk>
 
-SUBDIR= mkdir rm rmdir
+SUBDIR= mkdir rm rmdir date
 
 .include <bsd.subdir.mk>
index e8bdba632f05ab3ffe884c1f217ebd0af6648b63..30100450ba2287046253a40cdd0b842f92a98e6b 100644 (file)
@@ -1,5 +1,3 @@
-.include <minix.newlibc.mk>
-
 CPPFLAGS+= -D_NETBSD_SOURCE
 
 BINDIR?=/bin
diff --git a/bin/date/Makefile b/bin/date/Makefile
new file mode 100644 (file)
index 0000000..0735d7f
--- /dev/null
@@ -0,0 +1,15 @@
+#      $NetBSD: Makefile,v 1.15 2011/08/14 10:53:16 christos Exp $
+#      @(#)Makefile    8.1 (Berkeley) 5/31/93
+
+PROG=  date
+SRCS=  date.c netdate.c
+DPADD+=        ${LIBUTIL}
+LDADD+=        -lutil
+CPPFLAGS+=-I${.CURDIR}
+
+TZDIR=  /usr/share/zoneinfo
+CPPFLAGS+= -DHAVE_ADJTIME=0 -DTZDIR=\"$(TZDIR)\"
+
+COPTS.date.c = -Wno-format-nonliteral
+
+.include <bsd.prog.mk>
diff --git a/bin/date/date.1 b/bin/date/date.1
new file mode 100644 (file)
index 0000000..98af673
--- /dev/null
@@ -0,0 +1,244 @@
+.\"    $NetBSD: date.1,v 1.41 2010/02/04 22:56:11 wiz Exp $
+.\"
+.\" Copyright (c) 1980, 1990, 1993
+.\"    The Regents of the University of California.  All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" the Institute of Electrical and Electronics Engineers, Inc.
+.\"
+.\" 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. 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.
+.\"
+.\"     @(#)date.1     8.3 (Berkeley) 4/28/95
+.\"
+.Dd November 15, 2006
+.Dt DATE 1
+.Os
+.Sh NAME
+.Nm date
+.Nd display or set date and time
+.Sh SYNOPSIS
+.Nm
+.Op Fl ajnu
+.Op Fl d Ar date
+.Op Fl r Ar seconds
+.Op Cm + Ns Ar format
+.Sm off
+.Oo Oo Oo Oo Oo Oo
+.Ar CC Oc
+.Ar yy Oc
+.Ar mm Oc
+.Ar dd Oc
+.Ar HH Oc Ar MM Oo
+.Li \&. Ar SS Oc Oc
+.Sm on
+.Sh DESCRIPTION
+.Nm
+displays the current date and time when invoked without arguments.
+Providing arguments will format the date and time in a user-defined
+way or set the date.
+Only the superuser may set the date.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl a
+Use
+.Xr adjtime 2
+to change the local system time slowly,
+maintaining it as a monotonically increasing function.
+.Fl a
+implies
+.Fl n .
+.It Fl d Ar date
+Parse the provided human-described date and time and display the result without
+actually changing the system clock.
+(See
+.Xr parsedate 3
+for examples.)
+.It Fl j
+Parse the provided canonical representation of date and time (described below)
+and display the result without actually changing the system clock.
+.It Fl n
+The utility
+.Xr timed 8
+is used to synchronize the clocks on groups of machines.
+By default, if
+timed
+is running,
+.Nm
+will set the time on all of the machines in the local group.
+The
+.Fl n
+option stops
+.Nm
+from setting the time for other than the current machine.
+.It Fl r Ar seconds
+Print out the date and time that is
+.Ar seconds
+from the Epoch.
+.It Fl u
+Display or set the date in
+.Tn UTC
+(universal) time.
+.El
+.Pp
+An operand with a leading plus
+.Pq Cm +
+sign signals a user-defined format
+string which specifies the format in which to display the date and time.
+The format string may contain any of the conversion specifications described
+in the
+.Xr strftime 3
+manual page, as well as any arbitrary text.
+A \*[Lt]newline\*[Gt] character is always output after the characters
+specified by the format string.
+The format string for the default display is:
+.Bd -literal -offset indent
+%a %b %e %H:%M:%S %Z %Y
+.Ed
+.Pp
+If an operand does not have a leading plus sign, it is interpreted as
+a value for setting the system's notion of the current date and time.
+The canonical representation for setting the date and time is:
+.Pp
+.Bl -tag -width Ds -compact -offset indent
+.It Ar CC
+The first two digits of the year (the century).
+.It Ar yy
+The second two digits of the year.
+If
+.Ar yy
+is specified, but
+.Ar CC
+is not, a value for
+.Ar yy
+between 69 and 99 results in a
+.Ar CC
+value of 19.
+Otherwise, a
+.Ar CC
+value of 20 is used.
+.It Ar mm
+The month of the year, from 01 to 12.
+.It Ar dd
+The day of the month, from 01 to 31.
+.It Ar HH
+The hour of the day, from 00 to 23.
+.It Ar MM
+The minute of the hour, from 00 to 59.
+.It Ar SS
+The second of the minute, from 00 to 61.
+.El
+.Pp
+Everything but the minutes is optional.
+.Pp
+Time changes for Daylight Saving and Standard time and leap seconds
+and years are handled automatically.
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width iTZ
+.It Ev TZ
+The timezone to use when displaying dates.
+See
+.Xr environ 7
+for more information.
+.El
+.Sh FILES
+.Bl -tag -width /var/log/messages -compact
+.It Pa /etc/localtime
+Symlink pointing to system's default timezone information file in
+.Pa /usr/share/zoneinfo
+directory.
+.It Pa /var/log/wtmp
+A record of date resets and time changes.
+.It Pa /var/log/messages
+A record of the user setting the time.
+.El
+.Sh EXAMPLES
+The command:
+.Bd -literal -offset indent
+date '+DATE: %m/%d/%y%nTIME: %H:%M:%S'
+.Ed
+.Pp
+will display:
+.Bd -literal -offset indent
+DATE: 11/21/87
+TIME: 13:36:16
+.Ed
+.Pp
+The command:
+.Bd -literal -offset indent
+date 8506131627
+.Ed
+.Pp
+sets the date to
+.Dq Li "June 13, 1985, 4:27 PM" .
+.Pp
+The command:
+.Bd -literal -offset indent
+date 1432
+.Ed
+.Pp
+sets the time to
+.Li "2:32 PM" ,
+without modifying the date.
+.Sh DIAGNOSTICS
+Exit status is 0 on success, 1 if unable to set the date, and 2
+if able to set the local date, but unable to set it globally.
+.Pp
+Occasionally, when
+.Xr timed 8
+synchronizes the time on many hosts, the setting of a new time value may
+require more than a few seconds.
+On these occasions,
+.Nm
+prints:
+.Ql Network time being set .
+The message
+.Ql Communication error with timed
+occurs when the communication
+between
+.Nm
+and
+timed
+fails.
+.Sh SEE ALSO
+.Xr adjtime 2 ,
+.Xr gettimeofday 2 ,
+.Xr settimeofday 2 ,
+.Xr parsedate 3 ,
+.Xr strftime 3 ,
+.Xr utmp 5 ,
+.Xr timed 8
+.Rs
+.%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD"
+.%A R. Gusella
+.%A S. Zatti
+.Re
+.Sh STANDARDS
+The
+.Nm
+utility is expected to be compatible with
+.St -p1003.2 .
diff --git a/bin/date/date.c b/bin/date/date.c
new file mode 100644 (file)
index 0000000..9a3d22c
--- /dev/null
@@ -0,0 +1,350 @@
+/* $NetBSD: date.c,v 1.60 2011/08/27 12:55:09 joerg Exp $ */
+
+/*
+ * Copyright (c) 1985, 1987, 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. 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/cdefs.h>
+#ifndef lint
+__COPYRIGHT(
+"@(#) Copyright (c) 1985, 1987, 1988, 1993\
+ The Regents of the University of California.  All rights reserved.");
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)date.c     8.2 (Berkeley) 4/28/95";
+#else
+__RCSID("$NetBSD: date.c,v 1.60 2011/08/27 12:55:09 joerg Exp $");
+#endif
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <sys/time.h>
+
+#include <ctype.h>
+#include <err.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <time.h>
+#include <tzfile.h>
+#include <unistd.h>
+#include <util.h>
+
+#include "extern.h"
+
+static time_t tval;
+static int aflag, jflag, rflag, nflag;
+
+__dead static void badformat(void);
+__dead static void badtime(void);
+__dead static void badvalue(const char *);
+static void setthetime(const char *);
+__dead static void usage(void);
+
+int
+main(int argc, char *argv[])
+{
+       char *buf;
+       size_t bufsiz;
+       const char *format;
+       int ch;
+       long long val;
+       struct tm *tm;
+
+       setprogname(argv[0]);
+       (void)setlocale(LC_ALL, "");
+
+       while ((ch = getopt(argc, argv, "ad:jnr:u")) != -1) {
+               switch (ch) {
+               case 'a':               /* adjust time slowly */
+                       aflag = 1;
+                       nflag = 1;
+                       break;
+               case 'd':
+#ifndef __minix
+                       rflag = 1;
+                       tval = parsedate(optarg, NULL, NULL);
+                       if (tval == -1) 
+#endif
+badarg:                                 errx(EXIT_FAILURE,
+                                   "Cannot parse `%s'", optarg);
+                       break;
+               case 'j':               /* don't set time */
+                       jflag = 1;
+                       break;
+               case 'n':               /* don't set network */
+                       nflag = 1;
+                       break;
+               case 'r':               /* user specified seconds */
+                       errno = 0;
+                       val = strtoll(optarg, &buf, 0);
+                       if (optarg[0] == '\0' || *buf != '\0')
+                               goto badarg;
+                       if (errno == ERANGE && (val == LLONG_MAX ||
+                           val == LLONG_MIN))
+                               err(EXIT_FAILURE, "Bad number `%s'", optarg);
+                       rflag = 1;
+                       tval = (time_t)val;
+                       break;
+               case 'u':               /* do everything in UTC */
+                       (void)setenv("TZ", "UTC0", 1);
+                       break;
+               default:
+                       usage();
+               }
+       }
+       argc -= optind;
+       argv += optind;
+
+       if (!rflag && time(&tval) == -1)
+               err(EXIT_FAILURE, "time");
+
+
+       /* allow the operands in any order */
+       if (*argv && **argv == '+') {
+               format = *argv;
+               ++argv;
+       } else
+               format = "+%a %b %e %H:%M:%S %Z %Y";
+
+       if (*argv) {
+               setthetime(*argv);
+               ++argv;
+       }
+
+       if (*argv && **argv == '+')
+               format = *argv;
+
+       if ((buf = malloc(bufsiz = 1024)) == NULL)
+               goto bad;
+
+       if ((tm = localtime(&tval)) == NULL)
+               err(EXIT_FAILURE, "localtime %lld failed", (long long)tval);
+
+       while (strftime(buf, bufsiz, format, tm) == 0)
+               if ((buf = realloc(buf, bufsiz <<= 1)) == NULL)
+                       goto bad;
+
+       (void)printf("%s\n", buf + 1);
+       free(buf);
+       return 0;
+bad:
+       err(EXIT_FAILURE, "Cannot allocate format buffer");
+}
+
+static void
+badformat(void)
+{
+       warnx("illegal time format");
+       usage();
+}
+
+static void
+badtime(void)
+{
+       errx(EXIT_FAILURE, "illegal time");
+       /* NOTREACHED */
+}
+
+static void
+badvalue(const char *param)
+{
+       warnx("invalid %s supplied", param);
+       usage();
+}
+
+#define ATOI2(s) ((s) += 2, ((s)[-2] - '0') * 10 + ((s)[-1] - '0'))
+
+static void
+setthetime(const char *p)
+{
+       struct timeval tv;
+       time_t new_time;
+       struct tm *lt;
+       const char *dot, *t;
+       size_t len;
+       int yearset;
+
+       for (t = p, dot = NULL; *t; ++t) {
+               if (isdigit((unsigned char)*t))
+                       continue;
+               if (*t == '.' && dot == NULL) {
+                       dot = t;
+                       continue;
+               }
+               badformat();
+       }
+
+       if ((lt = localtime(&tval)) == NULL)
+               err(EXIT_FAILURE, "localtime %lld failed", (long long)tval);
+
+       lt->tm_isdst = -1;                      /* Divine correct DST */
+
+       if (dot != NULL) {                      /* .ss */
+               len = strlen(dot);
+               if (len != 3)
+                       badformat();
+               ++dot;
+               lt->tm_sec = ATOI2(dot);
+               if (lt->tm_sec > 61)
+                       badvalue("seconds");
+       } else {
+               len = 0;
+               lt->tm_sec = 0;
+       }
+
+       yearset = 0;
+       switch (strlen(p) - len) {
+       case 12:                                /* cc */
+               lt->tm_year = ATOI2(p) * 100 - TM_YEAR_BASE;
+               if (lt->tm_year < 0)
+                       badtime();
+               yearset = 1;
+               /* FALLTHROUGH */
+       case 10:                                /* yy */
+               if (yearset) {
+                       lt->tm_year += ATOI2(p);
+               } else {
+                       yearset = ATOI2(p);
+                       if (yearset < 69)
+                               lt->tm_year = yearset + 2000 - TM_YEAR_BASE;
+                       else
+                               lt->tm_year = yearset + 1900 - TM_YEAR_BASE;
+               }
+               /* FALLTHROUGH */
+       case 8:                                 /* mm */
+               lt->tm_mon = ATOI2(p);
+               if (lt->tm_mon > 12 || lt->tm_mon == 0)
+                       badvalue("month");
+               --lt->tm_mon;                   /* time struct is 0 - 11 */
+               /* FALLTHROUGH */
+       case 6:                                 /* dd */
+               lt->tm_mday = ATOI2(p);
+               switch (lt->tm_mon) {
+               case 0:
+               case 2:
+               case 4:
+               case 6:
+               case 7:
+               case 9:
+               case 11:
+                       if (lt->tm_mday > 31 || lt->tm_mday == 0)
+                               badvalue("day of month");
+                       break;
+               case 3:
+               case 5:
+               case 8:
+               case 10:
+                       if (lt->tm_mday > 30 || lt->tm_mday == 0)
+                               badvalue("day of month");
+                       break;
+               case 1:
+                       if (lt->tm_mday > 29 || lt->tm_mday == 0 ||
+                           (lt->tm_mday == 29 &&
+                            !isleap(lt->tm_year + TM_YEAR_BASE)))
+                               badvalue("day of month");
+                       break;
+               default:
+                       badvalue("month");
+                       break;
+               }
+               /* FALLTHROUGH */
+       case 4:                                 /* hh */
+               lt->tm_hour = ATOI2(p);
+               if (lt->tm_hour > 23)
+                       badvalue("hour");
+               /* FALLTHROUGH */
+       case 2:                                 /* mm */
+               lt->tm_min = ATOI2(p);
+               if (lt->tm_min > 59)
+                       badvalue("minute");
+               break;
+       case 0:                                 /* was just .sss */
+               if (len != 0)
+                       break;
+               /* FALLTHROUGH */
+       default:
+               badformat();
+       }
+
+       /* convert broken-down time to UTC clock time */
+       if ((new_time = mktime(lt)) == -1)
+               badtime();
+
+       /* if jflag is set, don't actually change the time, just return */
+       if (jflag) {
+               tval = new_time;
+               return;
+       }
+
+       /* set the time */
+       if (nflag || netsettime(new_time)) {
+               logwtmp("|", "date", "");
+#if HAVE_ADJTIME
+               if (aflag) {
+                       tv.tv_sec = new_time - tval;
+                       tv.tv_usec = 0;
+                       if (adjtime(&tv, NULL))
+                               err(EXIT_FAILURE, "adjtime");
+               }
+#else
+               if (aflag) {
+                       err(EXIT_FAILURE, "no adjtime");
+               }
+#endif
+               else {
+                       tval = new_time;
+                       tv.tv_sec = tval;
+                       tv.tv_usec = 0;
+                       if (settimeofday(&tv, NULL))
+                               err(EXIT_FAILURE, "settimeofday");
+               }
+               logwtmp("{", "date", "");
+       }
+
+       if ((p = getlogin()) == NULL)
+               p = "???";
+       syslog(LOG_AUTH | LOG_NOTICE, "date set by %s", p);
+}
+
+static void
+usage(void)
+{
+       (void)fprintf(stderr,
+           "Usage: %s [-ajnu] [-d date] [-r seconds] [+format]",
+           getprogname());
+       (void)fprintf(stderr, " [[[[[[CC]yy]mm]dd]HH]MM[.SS]]\n");
+       exit(EXIT_FAILURE);
+       /* NOTREACHED */
+}
similarity index 87%
rename from nbsd_include/memory.h
rename to bin/date/extern.h
index a4c1b0c32a56afab3bf8a16ff0501c4ebc9b7e5f..bbb786fb3b9a13c7a266a1af47149385ae55d862 100644 (file)
@@ -1,7 +1,7 @@
-/*     $NetBSD: memory.h,v 1.5 2003/08/07 09:44:10 agc Exp $   */
+/* $NetBSD: extern.h,v 1.8 2006/11/17 22:11:28 christos Exp $ */
 
-/*
- * Copyright (c) 1988, 1993
+/*-
+ * Copyright (c) 1993
  *     The Regents of the University of California.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     @(#)memory.h    8.1 (Berkeley) 6/2/93
+ *     @(#)extern.h    8.1 (Berkeley) 5/31/93
  */
 
-#include <string.h>
+#ifndef _EXTERN_H_
+#define _EXTERN_H_
+
+int netsettime(time_t);
+
+#endif /* !_EXTERN_H_ */
diff --git a/bin/date/netdate.c b/bin/date/netdate.c
new file mode 100644 (file)
index 0000000..5b5857c
--- /dev/null
@@ -0,0 +1,200 @@
+/* $NetBSD: netdate.c,v 1.30 2011/01/29 02:16:52 christos Exp $ */
+
+/*-
+ * Copyright (c) 1990, 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. 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/cdefs.h>
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)netdate.c  8.2 (Berkeley) 4/28/95";
+#else
+__RCSID("$NetBSD: netdate.c,v 1.30 2011/01/29 02:16:52 christos Exp $");
+#endif
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <netdb.h>
+#define TSPTYPES
+#include <protocols/timed.h>
+
+#include <err.h>
+#include <errno.h>
+#include <poll.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+#define        WAITACK         2000    /* milliseconds */
+#define        WAITDATEACK     5000    /* milliseconds */
+
+static const char *
+tsp_type_to_string(const struct tsp *msg)
+{
+       unsigned i;
+
+       i = msg->tsp_type;
+       return i < TSPTYPENUMBER ? tsptype[i] : "unknown";
+}
+
+/*
+ * Set the date in the machines controlled by timedaemons by communicating the
+ * new date to the local timedaemon.  If the timedaemon is in the master state,
+ * it performs the correction on all slaves.  If it is in the slave state, it
+ * notifies the master that a correction is needed.
+ * Returns 0 on success.  Returns > 0 on failure.
+ */
+int
+netsettime(time_t tval)
+{
+       struct sockaddr_in dest;
+       struct tsp msg;
+       char hostname[MAXHOSTNAMELEN];
+       struct servent *sp;
+       struct pollfd ready;
+       int found, s, timed_ack, waittime;
+
+       if ((sp = getservbyname("timed", "udp")) == NULL) {
+               warnx("udp/timed: unknown service");
+               return 2;
+       }
+
+       (void)memset(&dest, 0, sizeof(dest));
+#ifdef BSD4_4
+       dest.sin_len = sizeof(dest);
+#endif
+       dest.sin_family = AF_INET;
+       dest.sin_port = sp->s_port;
+       dest.sin_addr.s_addr = htonl(INADDR_ANY);
+       s = socket(AF_INET, SOCK_DGRAM, 0);
+       if (s == -1) {
+               if (errno != EAFNOSUPPORT)
+                       warn("timed");
+               return 2;
+       }
+
+#ifdef IP_PORTRANGE
+       {
+               static const int on = IP_PORTRANGE_LOW;
+
+               if (setsockopt(s, IPPROTO_IP, IP_PORTRANGE, &on,
+                   sizeof(on)) == -1) {
+                       warn("setsockopt");
+                       goto bad;
+               }
+       }
+#endif
+
+       msg.tsp_type = TSP_SETDATE;
+       msg.tsp_vers = TSPVERSION;
+       if (gethostname(hostname, sizeof(hostname)) == -1) {
+               warn("gethostname");
+               goto bad;
+       }
+       (void)strlcpy(msg.tsp_name, hostname, sizeof(msg.tsp_name));
+       msg.tsp_seq = htons((in_port_t)0);
+       msg.tsp_time.tv_sec = htonl((in_addr_t)tval); /* XXX: y2038 */
+       msg.tsp_time.tv_usec = htonl((in_addr_t)0);
+       if (connect(s, (const void *)&dest, sizeof(dest)) == -1) {
+               warn("connect");
+               goto bad;
+       }
+       if (send(s, &msg, sizeof(msg), 0) == -1) {
+               if (errno != ECONNREFUSED)
+                       warn("send");
+               goto bad;
+       }
+
+       timed_ack = -1;
+       waittime = WAITACK;
+       ready.fd = s;
+       ready.events = POLLIN;
+loop:
+       found = poll(&ready, 1, waittime);
+
+       {
+               socklen_t len;
+               int error;
+
+               len = sizeof(error);
+               if (getsockopt(s, SOL_SOCKET, SO_ERROR, &error, &len) == -1) {
+                       warn("getsockopt");
+                       goto bad;
+               }
+               if (error) {
+                       if (error != ECONNREFUSED) {
+                               errno = error;
+                               warn("send (delayed error)");
+                       }
+                       goto bad;
+               }
+       }
+
+       if (found > 0 && ready.revents & POLLIN) {
+               ssize_t ret;
+
+               if ((ret = recv(s, &msg, sizeof(msg), 0)) == -1) {
+                       if (errno != ECONNREFUSED)
+                               warn("recv");
+                       goto bad;
+               } else if ((size_t)ret < sizeof(msg)) {
+                       warnx("recv: incomplete packet");
+                       goto bad;
+               }
+
+               msg.tsp_seq = ntohs(msg.tsp_seq);
+               msg.tsp_time.tv_sec = ntohl(msg.tsp_time.tv_sec);
+               msg.tsp_time.tv_usec = ntohl(msg.tsp_time.tv_usec);
+               switch (msg.tsp_type) {
+               case TSP_ACK:
+                       timed_ack = TSP_ACK;
+                       waittime = WAITDATEACK;
+                       goto loop;
+               case TSP_DATEACK:
+                       (void)close(s);
+                       return 0;
+               default:
+                       warnx("wrong ack received from timed: %s", 
+                           tsp_type_to_string(&msg));
+                       timed_ack = -1;
+                       break;
+               }
+       }
+       if (timed_ack == -1)
+               warnx("can't reach time daemon, time set locally");
+
+bad:
+       (void)close(s);
+       return 2;
+}
diff --git a/boot/Makefile b/boot/Makefile
deleted file mode 100644 (file)
index f79185e..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# Makefile for the boot monitor package.
-
-.include <bsd.own.mk>
-
-# 16-bit code; various boot blocks
-SUBDIR= masterboot bootblock cdbootblock
-
-# Supplementary MBR code (alternate to masterboot)
-SUBDIR+= jumpboot
-
-# 16-bit code; needs the i86 ACK library
-SUBDIR+= boot
-
-# Userland MINIX code
-SUBDIR+= installboot edparams
-
-.include <bsd.subdir.mk>
diff --git a/boot/boot.h b/boot/boot.h
deleted file mode 100644 (file)
index 27deb16..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*     boot.h - Info between different parts of boot.  Author: Kees J. Bot
- */
-
-#ifndef DEBUG
-#define DEBUG 0
-#endif
-
-/* Constants describing the metal: */
-
-#define SECTOR_SIZE    512
-#define SECTOR_SHIFT   9
-#define RATIO(b)               ((b) / SECTOR_SIZE)
-
-#define PARAMSEC       1       /* Sector containing boot parameters. */
-
-#define DSKBASE                0x1E    /* Floppy disk parameter vector. */
-#define DSKPARSIZE     11      /* There are this many bytes of parameters. */
-
-#define ESC            '\33'   /* Escape key. */
-
-#define HEADERPOS      0x00600L        /* Place for an array of struct exec's. */
-
-#define FREEPOS               0x08000L /* Memory from FREEPOS to caddr is free to
-                                * play with.
-                                */
-#if BIOS
-#define MSEC_PER_TICK    55    /* Clock does 18.2 ticks per second. */
-#define TICKS_PER_DAY 0x1800B0L        /* After 24 hours it wraps. */
-#endif
-
-#if UNIX
-#define MSEC_PER_TICK  1000    /* Clock does 18.2 ticks per second. */
-#define TICKS_PER_DAY  86400L  /* Doesn't wrap, but that doesn't matter. */
-#endif
-
-#define BOOTPOS               0x07C00L /* Bootstraps are loaded here. */
-#define SIGNATURE      0xAA55  /* Proper bootstraps have this signature. */
-#define SIGNATOFF      510     /* Offset within bootblock. */
-
-/* BIOS video modes. */
-#define MONO_MODE      0x07    /* 80x25 monochrome. */
-#define COLOR_MODE     0x03    /* 80x25 color. */
-
-
-/* Variables shared with boothead.s: */
-#ifndef EXTERN
-#define EXTERN extern
-#endif
-
-typedef struct vector {                /* 8086 vector */
-       u16_t   offset;
-       u16_t   segment;
-} vector;
-
-EXTERN vector rem_part;                /* Boot partition table entry. */
-
-EXTERN u32_t caddr, daddr;     /* Code and data address of the boot program. */
-EXTERN u32_t runsize;          /* Size of this program. */
-
-EXTERN u16_t device;           /* Drive being booted from. */
-EXTERN u16_t cddevice;         /* Drive that is CD if known. */
-
-#define CDNAME "cd"            /* Name of the CD device. */
-
-EXTERN int mon_return;         /* Monitor stays in memory? */
-EXTERN int cdbooted;           /* Did we boot from CD? (Set by boothead.s.) */
-
-typedef struct bios_env
-{
-       u16_t ax;
-       u16_t bx;
-       u16_t cx;
-       u16_t flags;
-} bios_env_t;
-
-#define FL_CARRY       0x0001  /* carry flag */
-
-/* Functions defined by boothead.s: */
-
-void exit(int code);
-                       /* Exit the monitor. */
-u32_t mon2abs(void *ptr);
-                       /* Local monitor address to absolute address. */
-u32_t vec2abs(vector *vec);
-                       /* Vector to absolute address. */
-void raw_copy(u32_t dstaddr, u32_t srcaddr, u32_t count);
-                       /* Copy bytes from anywhere to anywhere. */
-u16_t get_word(u32_t addr);
-                       /* Get a word from anywhere. */
-void put_word(u32_t addr, u16_t word);
-                       /* Put a word anywhere. */
-void relocate(void);
-                       /* Switch to a copy of this program. */
-int dev_open(void), dev_close(void);
-                       /* Open device and determine params / close device. */
-int dev_boundary(u32_t sector);
-                       /* True if sector is on a track boundary. */
-int readsectors(u32_t bufaddr, u32_t sector, u8_t count);
-                       /* Read 1 or more sectors from "device". */
-int writesectors(u32_t bufaddr, u32_t sector, u8_t count);
-                       /* Write 1 or more sectors to "device". */
-
-int biosreadsectors(u32_t bufaddr, u32_t sector, u8_t count);
-
-int getch(void);
-                       /* Read a keypress. */
-void scan_keyboard(void);      
-                       /* Read keypress directly from kb controller. */
-void ungetch(int c);
-                       /* Undo a keypress. */
-int escape(void);
-                       /* True if escape typed. */
-void putch(int c);
-                       /* Send a character to the screen. */
-#if BIOS
-void pause(void);
-                       /* Wait for an interrupt. */
-void serial_init(int line);
-#endif                 /* Enable copying console I/O to a serial line. */
-
-void set_mode(unsigned mode);
-void clear_screen(void);
-                       /* Set video mode / clear the screen. */
-
-u16_t get_bus(void);
-                       /* System bus type, XT, AT, or MCA. */
-u16_t get_video(void);
-                       /* Display type, MDA to VGA. */
-u32_t get_tick(void);
-                       /* Current value of the clock tick counter. */
-
-void bootstrap(int device, struct part_entry *entry);
-                       /* Execute a bootstrap routine for a different O.S. */
-void minix(u32_t koff, u32_t kcs, u32_t kds,
-                               char *bootparams, size_t paramsize, u32_t aout);
-                       /* Start Minix. */
-
-void int15(bios_env_t *);
-                       /* Do an "INT 15" call, primarily for APM. */
-void scan_keyboard(void);
-                       /* Read keyboard character.
-                        * Needs to be done in case one is waiting. */
-void reset(void);
-                       /* */
-
-/* Shared between boot.c and bootimage.c: */
-
-/* Sticky attributes. */
-#define E_SPECIAL      0x01    /* These are known to the program. */
-#define E_DEV          0x02    /* The value is a device name. */
-#define E_RESERVED     0x04    /* May not be set by user, e.g. 'boot' */
-#define E_STICKY       0x07    /* Don't go once set. */
-
-/* Volatile attributes. */
-#define E_VAR          0x08    /* Variable */
-#define E_FUNCTION     0x10    /* Function definition. */
-
-/* Variables, functions, and commands. */
-typedef struct environment {
-       struct environment *next;
-       char    flags;
-       char    *name;          /* name = value */
-       char    *arg;           /* name(arg) {value} */
-       char    *value;
-       char    *defval;        /* Safehouse for default values. */
-} environment;
-
-EXTERN environment *env;       /* Lists the environment. */
-
-char *b_value(const char *name);       /* Get/set the value of a variable. */
-int b_setvar(int flags, char *name, char *value);
-void b_unset(const char *name);
-
-void parse_code(char *code);   /* Parse boot monitor commands. */
-
-extern int fsok;       /* True if the boot device contains an FS. */
-EXTERN u32_t lowsec;   /* Offset to the file system on the boot device. */
-
-/* Called by boot.c: */
-
-void bootminix(void);          /* Load and start a Minix image. */
-
-
-/* Called by bootimage.c: */
-
-void readerr(off_t sec, int err);
-                       /* Report a read error. */
-char *ul2a(u32_t n, unsigned b), *ul2a10(u32_t n);
-                       /* Transform u32_t to ASCII at base b or base 10. */
-long a2l(const char *a);
-                       /* Cheap atol(). */
-unsigned a2x(const char *a);
-                       /* ASCII to hex. */
-dev_t name2dev(char *name);
-                       /* Translate a device name to a device number. */
-int numprefix(char *s, char **ps);
-                       /* True for a numeric prefix. */
-int numeric(char *s);
-                       /* True for a numeric string. */
-char *unix_err(int err);
-                       /* Give a descriptive text for some UNIX errors. */
-int run_trailer(void);
-                       /* Run the trailer function. */
-
-#if DOS
-/* The monitor runs under MS-DOS. */
-extern char PSP[256];  /* Program Segment Prefix. */
-EXTERN char *vdisk;    /* Name of the virtual disk. */
-EXTERN char *drun;     /* Initial command from DOS command line. */
-#else
-/* The monitor uses only the BIOS. */
-#define DOS    0
-#endif
-
-void readblock(off_t, char *, int);
-void delay(const char *);
-
-/*
- * $PchId: boot.h,v 1.12 2002/02/27 19:42:45 philip Exp $
- */
diff --git a/boot/boot/Makefile b/boot/boot/Makefile
deleted file mode 100644 (file)
index 39292b5..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# boot monitor: runs in 16-bit mode
-.include <bsd.own.mk>
-
-# XXX: Can only be built with ACK currently
-MINIXID=       -sep
-.include "${.CURDIR}/../minix.ack16.mk"
-AFLAGS+=       -Was-ncc
-STRIPFLAG=     -s
-LIBDIR?=       /usr/lib/i86
-
-PROG=  boot
-
-SRCS=          boothead.s boot.c bootimage.c rawfs.c
-# Need exec_elf.c from libexec
-SRCS+=         exec_elf.c
-.PATH: ${.CURDIR}/.. ${MINIXSRCDIR}/lib/libexec
-
-CPPFLAGS+=     -I${MINIXSRCDIR} -I${.CURDIR} -I${.CURDIR}/..
-
-DPADD+=        ${LIBSYS}       # for kprintf, kmalloc
-LDADD+=        -lsys
-
-BINDIR=                /usr/mdec
-MAN=
-
-.include <bsd.prog.mk>
-
-realall: .PHONY bootsize
-bootsize: boot
-       ${INSTALL} -S 12kb boot
diff --git a/boot/boot/boot.c b/boot/boot/boot.c
deleted file mode 100644 (file)
index 79d82f4..0000000
+++ /dev/null
@@ -1,2092 +0,0 @@
-/*     boot.c - Load and start Minix.                  Author: Kees J. Bot
- *                                                             27 Dec 1991
- */
-
-char version[]=                "2.20";
-
-#define BIOS   (!UNIX)         /* Either uses BIOS or UNIX syscalls. */
-
-#define nil 0
-#define _POSIX_SOURCE  1
-#define _MINIX         1
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
-#include <string.h>
-#include <errno.h>
-#include <machine/partition.h>
-#include <machine/bios.h>
-#include <minix/config.h>
-#include <minix/type.h>
-#include <minix/dmap.h>
-#include <minix/const.h>
-#include <minix/minlib.h>
-#include <minix/syslib.h>
-#if BIOS
-#include <kernel/const.h>
-#include <sys/video.h>
-#endif
-#if UNIX
-#include <stdio.h>
-#include <time.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <termios.h>
-#endif
-#include "rawfs.h"
-#undef EXTERN
-#define EXTERN /* Empty */
-#include "boot.h"
-#include "emem.h"
-
-#define arraysize(a)           (sizeof(a) / sizeof((a)[0]))
-#define arraylimit(a)          ((a) + arraysize(a))
-#define between(a, c, z)       ((unsigned) ((c) - (a)) <= ((z) - (a)))
-
-int serial_line = -1;
-
-u16_t vid_port;                /* Video i/o port. */
-u32_t vid_mem_base;    /* Video memory base address. */
-u32_t vid_mem_size;    /* Video memory size. */
-
-int fsok= -1;          /* File system state.  Initially unknown. */
-
-static int block_size;
-
-#if BIOS
-
-/* this data is reserved for BIOS int 0x13 to put the 'specification packet'
- * in. It has a structure of course, but we don't define a struct because
- * of compiler padding. We fiddle out the bytes ourselves later.
- */
-unsigned char boot_spec[24];
-
-static const char *bios_err(int err)
-/* Translate BIOS error code to a readable string.  (This is a rare trait
- * known as error checking and reporting.  Take a good look at it, you won't
- * see it often.)
- */
-{
-       static struct errlist {
-               int     err;
-               char    *what;
-       } errlist[] = {
-#if !DOS
-               { 0x00, "No error" },
-               { 0x01, "Invalid command" },
-               { 0x02, "Address mark not found" },
-               { 0x03, "Disk write-protected" },
-               { 0x04, "Sector not found" },
-               { 0x05, "Reset failed" },
-               { 0x06, "Floppy disk removed" },
-               { 0x07, "Bad parameter table" },
-               { 0x08, "DMA overrun" },
-               { 0x09, "DMA crossed 64 KB boundary" },
-               { 0x0A, "Bad sector flag" },
-               { 0x0B, "Bad track flag" },
-               { 0x0C, "Media type not found" },
-               { 0x0D, "Invalid number of sectors on format" },
-               { 0x0E, "Control data address mark detected" },
-               { 0x0F, "DMA arbitration level out of range" },
-               { 0x10, "Uncorrectable CRC or ECC data error" },
-               { 0x11, "ECC corrected data error" },
-               { 0x20, "Controller failed" },
-               { 0x40, "Seek failed" },
-               { 0x80, "Disk timed-out" },
-               { 0xAA, "Drive not ready" },
-               { 0xBB, "Undefined error" },
-               { 0xCC, "Write fault" },
-               { 0xE0, "Status register error" },
-               { 0xFF, "Sense operation failed" }
-#else /* DOS */
-               { 0x00, "No error" },
-               { 0x01, "Function number invalid" },
-               { 0x02, "File not found" },
-               { 0x03, "Path not found" },
-               { 0x04, "Too many open files" },
-               { 0x05, "Access denied" },
-               { 0x06, "Invalid handle" },
-               { 0x0C, "Access code invalid" },
-#endif /* DOS */
-       };
-       struct errlist *errp;
-
-       for (errp= errlist; errp < arraylimit(errlist); errp++) {
-               if (errp->err == err) return errp->what;
-       }
-       return "Unknown error";
-}
-
-/* CD's are addressed in 2048-byte sectors.
- * In order to be able to read CD's but maintain the same interface of 512-byte
- * sector addressing, we check if the device is a CD in readsectors() and if so,
- * read it into our own buffer first 
- */
-int readsectors(u32_t bufaddr, u32_t sector, u8_t count)
-{
-#define CDSECTOR_SIZE 2048
-       static char cdbuf[CDSECTOR_SIZE];
-       static i32_t cdbuf_sec = -1;
-       i32_t cdsec;
-
-       if(device != cddevice) {
-               return biosreadsectors(bufaddr, sector, count);
-       }
-
-       while(count > 0) {
-               u32_t offset;
-#define FACTOR (CDSECTOR_SIZE/SECTOR_SIZE)
-               cdsec = sector / FACTOR;
-               offset = (sector % FACTOR) * SECTOR_SIZE;
-               if(cdsec != cdbuf_sec) {
-                       int r;
-                       if((r=biosreadsectors(mon2abs(cdbuf), cdsec, 1)) != 0) {
-                               printf("error %d\n", r);
-                               return r;
-                       }
-                       cdbuf_sec = cdsec;
-               }
-               raw_copy(bufaddr, mon2abs(cdbuf) + offset, SECTOR_SIZE);
-               bufaddr += SECTOR_SIZE;
-               count--;
-               sector++;
-       }
-
-       return 0;
-}
-
-char *unix_err(int err)
-/* Translate the few errors rawfs can give. */
-{
-       switch (err) {
-       case ENOENT:    return "No such file or directory";
-       case ENOTDIR:   return "Not a directory";
-       default:        return "Unknown error";
-       }
-}
-
-static void rwerr(const char *rw, off_t sec, int err)
-{
-       printf("\n%s error 0x%02x (%s) at sector %ld absolute\n",
-               rw, err, bios_err(err), sec);
-}
-
-void readerr(off_t sec, int err)       { rwerr("Read", sec, err); }
-void writerr(off_t sec, int err)       { rwerr("Write", sec, err); }
-
-void readblock(off_t blk, char *buf, int block_size)
-/* Read blocks for the rawfs package. */
-{
-       int r;
-       u32_t sec= lowsec + blk * RATIO(block_size);
-
-       if(!block_size) {
-               printf("block_size 0\n");
-               exit(1);
-       }
-
-       if ((r= readsectors(mon2abs(buf), sec, 1 * RATIO(block_size))) != 0) {
-               readerr(sec, r); exit(1);
-       }
-}
-
-#define istty          (1)
-#define alarm(n)       do { } while(0)
-
-#endif /* BIOS */
-
-#if UNIX
-
-/* The Minix boot block must start with these bytes: */
-char boot_magic[] = { 0x31, 0xC0, 0x8E, 0xD8, 0xFA, 0x8E, 0xD0, 0xBC };
-
-struct biosdev {
-       char *name;             /* Name of device. */
-       int device;             /* Device to edit parameters. */
-} bootdev;
-
-static struct termios termbuf;
-static int istty;
-
-void quit(int status)
-{
-       if (istty) (void) tcsetattr(0, TCSANOW, &termbuf);
-       exit(status);
-}
-
-#define exit(s)        quit(s)
-
-void report(const char *label)
-/* edparams: label: No such file or directory */
-{
-       fprintf(stderr, "edparams: %s: %s\n", label, strerror(errno));
-}
-
-void fatal(const char *label)
-{
-       report(label);
-       exit(1);
-}
-
-void *alloc(void *m, size_t n)
-{
-       m= m == nil ? malloc(n) : realloc(m, n);
-       if (m == nil) fatal("");
-       return m;
-}
-
-#define malloc(n)      alloc(nil, n)
-#define realloc(m, n)  alloc(m, n)
-
-#define mon2abs(addr)  ((void *) (addr))
-
-int rwsectors(int rw, void *addr, u32_t sec, int nsec)
-{
-       ssize_t r;
-       size_t len= nsec * SECTOR_SIZE;
-
-       if (lseek(bootdev.device, sec * SECTOR_SIZE, SEEK_SET) == -1)
-               return errno;
-
-       if (rw == 0) {
-               r= read(bootdev.device, (char *) addr, len);
-       } else {
-               r= write(bootdev.device, (char *) addr, len);
-       }
-       if (r == -1) return errno;
-       if (r != len) return EIO;
-       return 0;
-}
-
-#define readsectors(a, s, n)    rwsectors(0, (a), (s), (n))
-#define writesectors(a, s, n)   rwsectors(1, (a), (s), (n))
-#define readerr(sec, err)      (errno= (err), report(bootdev.name))
-#define writerr(sec, err)      (errno= (err), report(bootdev.name))
-#define putch(c)               (void)putchar(c)
-#define unix_err(err)          strerror(err)
-
-void readblock(off_t blk, char *buf, int block_size)
-/* Read blocks for the rawfs package. */
-{
-       if(!block_size) fatal("block_size 0");
-       errno= EIO;
-       if (lseek(bootdev.device, blk * block_size, SEEK_SET) == -1
-               || read(bootdev.device, buf, block_size) != block_size)
-       {
-               fatal(bootdev.name);
-       }
-}
-
-sig_atomic_t trapsig;
-
-void trap(int sig)
-{
-       trapsig= sig;
-       signal(sig, trap);
-}
-
-int escape(void)
-{
-       if (trapsig == SIGINT) {
-               trapsig= 0;
-               return 1;
-       }
-       return 0;
-}
-
-static unsigned char unchar;
-
-int getch(void)
-{
-       unsigned char c;
-
-       fflush(stdout);
-
-       if (unchar != 0) {
-               c= unchar;
-               unchar= 0;
-               return c;
-       }
-
-       switch (read(0, &c, 1)) {
-       case -1:
-               if (errno != EINTR) fatal("");
-               return(ESC);
-       case 0:
-               if (istty) putch('\n');
-               exit(0);
-       default:
-               if (istty && c == termbuf.c_cc[VEOF]) {
-                       putch('\n');
-                       exit(0);
-               }
-               return c;
-       }
-}
-
-#define ungetch(c)     ((void) (unchar = (c)))
-
-#define get_tick()             ((u32_t) time(nil))
-#define clear_screen()         printf("[clear]")
-#define boot_device(device)    printf("[boot %s]\n", device)
-#define ctty(line)             printf("[ctty %s]\n", line)
-#define bootminix()            (void)(run_trailer() && printf("[boot]\n"))
-#define off()                  printf("[off]")
-
-#endif /* UNIX */
-
-static char *readline(void)
-/* Read a line including a newline with echoing. */
-{
-       char *line;
-       size_t i, z;
-       int c;
-
-       i= 0;
-       z= 20;
-       line= malloc(z * sizeof(char));
-
-       do {
-               c= getch();
-
-               if (strchr("\b\177\25\30", c) != nil) {
-                       /* Backspace, DEL, ctrl-U, or ctrl-X. */
-                       do {
-                               if (i == 0) break;
-                               printf("\b \b");
-                               i--;
-                       } while (c == '\25' || c == '\30');
-               } else
-               if (c < ' ' && c != '\n') {
-                       putch('\7');
-               } else {
-                       putch(c);
-                       line[i++]= c;
-                       if (i == z) {
-                               z*= 2;
-                               line= realloc(line, z * sizeof(char));
-                       }
-               }
-       } while (c != '\n');
-       line[i]= 0;
-       return line;
-}
-
-static int sugar(const char *tok)
-/* Recognize special tokens. */
-{
-       return strchr("=(){};\n", tok[0]) != nil;
-}
-
-static char *onetoken(char **aline)
-/* Returns a string with one token for tokenize. */
-{
-       char *line= *aline;
-       size_t n;
-       char *tok;
-
-       /* Skip spaces and runs of newlines. */
-       while (*line == ' ' || (*line == '\n' && line[1] == '\n')) line++;
-
-       *aline= line;
-
-       /* Don't do odd junk (nor the terminating 0!). */
-       if ((unsigned) *line < ' ' && *line != '\n') return nil;
-
-       if (*line == '(') {
-               /* Function argument, anything goes but () must match. */
-               int depth= 0;
-
-               while ((unsigned) *line >= ' ') {
-                       if (*line == '(') depth++;
-                       if (*line++ == ')' && --depth == 0) break;
-               }
-       } else
-       if (sugar(line)) {
-               /* Single character token. */
-               line++;
-       } else {
-               /* Multicharacter token. */
-               do line++; while ((unsigned) *line > ' ' && !sugar(line));
-       }
-       n= line - *aline;
-       tok= malloc((n + 1) * sizeof(char));
-       memcpy(tok, *aline, n);
-       tok[n]= 0;
-       if (tok[0] == '\n') tok[0]= ';';        /* ';' same as '\n' */
-
-       *aline= line;
-       return tok;
-}
-
-/* Typed commands form strings of tokens. */
-
-typedef struct token {
-       struct token    *next;  /* Next in a command chain. */
-       char            *token;
-} token;
-
-static token **tokenize(token **acmds, char *line)
-/* Takes a line apart to form tokens.  The tokens are inserted into a command
- * chain at *acmds.  Tokenize returns a reference to where another line could
- * be added.  Tokenize looks at spaces as token separators, and recognizes only
- * ';', '=', '{', '}', and '\n' as single character tokens.  One token is
- * formed from '(' and ')' with anything in between as long as more () match.
- */
-{
-       char *tok;
-       token *newcmd;
-
-       while ((tok= onetoken(&line)) != nil) {
-               newcmd= malloc(sizeof(*newcmd));
-               newcmd->token= tok;
-               newcmd->next= *acmds;
-               *acmds= newcmd;
-               acmds= &newcmd->next;
-       }
-       return acmds;
-}
-
-static token *cmds;            /* String of commands to execute. */
-static int err;                /* Set on an error. */
-
-static char *poptoken(void)
-/* Pop one token off the command chain. */
-{
-       token *cmd= cmds;
-       char *tok= cmd->token;
-
-       cmds= cmd->next;
-       free(cmd);
-
-       return tok;
-}
-
-static void voidtoken(void)
-/* Remove one token from the command chain. */
-{
-       free(poptoken());
-}
-
-void parse_code(char *code)
-/* Tokenize a string of monitor code, making sure there is a delimiter.  It is
- * to be executed next.  (Prepended to the current input.)
- */
-{
-       if (cmds != nil && cmds->token[0] != ';') (void) tokenize(&cmds, ";");
-       (void) tokenize(&cmds, code);
-}
-
-static int interrupt(void)
-/* Clean up after an ESC has been typed. */
-{
-       if (escape()) {
-               printf("[ESC]\n");
-               err= 1;
-               return 1;
-       }
-       return 0;
-}
-
-#if BIOS
-
-static int activate;
-
-struct biosdev {
-       char name[8];
-       int device, primary, secondary;
-} bootdev, tmpdev;
-
-/* Device number in multiboot format <drive, part1, part2, part3> */
-u32_t mbdev;
-
-static int get_master(char *master, struct part_entry **table, u32_t pos)
-/* Read a master boot sector and its partition table. */
-{
-       int r, n;
-       struct part_entry *pe, **pt;
-
-       if ((r= readsectors(mon2abs(master), pos, 1)) != 0) return r;
-
-       pe= (struct part_entry *) (master + PART_TABLE_OFF);
-       for (pt= table; pt < table + NR_PARTITIONS; pt++) *pt= pe++;
-
-       /* DOS has the misguided idea that partition tables must be sorted. */
-       if (pos != 0) return 0;         /* But only the primary. */
-
-       n= NR_PARTITIONS;
-       do {
-               for (pt= table; pt < table + NR_PARTITIONS-1; pt++) {
-                       if (pt[0]->sysind == NO_PART
-                                       || pt[0]->lowsec > pt[1]->lowsec) {
-                               pe= pt[0]; pt[0]= pt[1]; pt[1]= pe;
-                       }
-               }
-       } while (--n > 0);
-       return 0;
-}
-
-static void initialize(void)
-{
-       char master[SECTOR_SIZE];
-       struct part_entry *table[NR_PARTITIONS];
-       int r, p;
-       u32_t masterpos;
-       char *argp;
-
-       /* Copy the boot program to the far end of low memory, this must be
-        * done to get out of the way of Minix, and to put the data area
-        * cleanly inside a 64K chunk if using BIOS I/O (no DMA problems).
-        */
-       u32_t oldaddr;
-       u32_t memend;
-       u32_t newaddr;
-#if !DOS
-       u32_t dma64k;
-#endif
-
-       if (emem_entries) {
-               int i, j;
-               j = 0;
-               for(i = 0; i < emem_entries ; i++) {
-                       if (emem[i].type == 1 &&
-                           !emem[i].base_hi && !emem[i].size_hi) {
-                               if(j < MEM_ENTRIES) {
-                                       mem[j].base = emem[i].base_lo;
-                                       mem[j].size = emem[i].size_lo;
-                                       j++;
-                               } else {
-                                       printf("WARNING: boot skipping memory\n");
-                               }
-                       }
-               }
-       }
-
-       oldaddr= caddr;
-       memend= mem[0].base + mem[0].size;
-       newaddr= (memend - runsize) & ~0x0000FL;
-#if !DOS
-       dma64k= (memend - 1) & ~0x0FFFFL;
-
-
-       /* Check if data segment crosses a 64K boundary. */
-       if (newaddr + (daddr - caddr) < dma64k)  {
-               newaddr= (dma64k - runsize) & ~0x0000FL;
-       }
-#endif
-
-       /* If we were booted from CD, remember what device it was. */
-       if(cdbooted)
-               cddevice = device;
-       else
-               cddevice = 0xff;        /* Invalid. */
-
-       /* Set the new caddr for relocate. */
-       caddr= newaddr;
-
-       /* Copy code and data. */
-       raw_copy(newaddr, oldaddr, runsize);
-
-       /* Make the copy running. */
-       relocate();
-
-#if !DOS
-
-       /* Take the monitor out of the memory map if we have memory to spare,
-        * and also keep the BIOS data area safe (1.5K), plus a bit extra for
-        * where we may have to put a.out headers for older kernels.
-        */
-       if ((mon_return = (mem[1].size > 512*1024L))) mem[0].size = newaddr;
-       mem[0].base += 2048;
-       mem[0].size -= 2048;
-
-       /* Find out what the boot device and partition was. */
-       bootdev.name[0]= 0;
-       bootdev.device= device;
-       bootdev.primary= -1;
-       bootdev.secondary= -1;
-
-       if (device < 0x80) {
-               /* Floppy. */
-               strcpy(bootdev.name, "fd0");
-               bootdev.name[2] += bootdev.device;
-               return;
-       }
-
-       /* Disk: Get the partition table from the very first sector, and
-        * determine the partition we booted from using the information from
-        * the booted partition entry as passed on by the bootstrap (rem_part).
-        * All we need from it is the partition offset.
-        */
-       raw_copy(mon2abs(&lowsec),
-               vec2abs(&rem_part) + offsetof(struct part_entry, lowsec),
-               sizeof(lowsec));
-
-       masterpos= 0;   /* Master bootsector position. */
-
-       for (;;) {
-               /* Extract the partition table from the master boot sector. */
-               if ((r= get_master(master, table, masterpos)) != 0) {
-                       readerr(masterpos, r); exit(1);
-               }
-
-               /* If we're a CD, we know what we want. */
-               if(device == cddevice) {
-                       p = 1;  /* We know this is the root FS. */
-                       lowsec = table[p]->lowsec;
-                       bootdev.primary = p;
-                       break;  /* Found! */
-               }
-
-               /* See if you can find "lowsec" back. */
-               for (p= 0; p < NR_PARTITIONS; p++) {
-                       if (lowsec - table[p]->lowsec < table[p]->size) break;
-               }
-
-               if (lowsec == table[p]->lowsec) {       /* Found! */
-                       if (bootdev.primary < 0)
-                               bootdev.primary= p;
-                       else
-                               bootdev.secondary= p;
-                       break;
-               }
-
-               if (p == NR_PARTITIONS || bootdev.primary >= 0
-                                       || table[p]->sysind != MINIX_PART) {
-                       /* The boot partition cannot be named, this only means
-                        * that "bootdev" doesn't work.
-                        */
-                       bootdev.device= -1;
-                       return;
-               }
-
-               /* See if the primary partition is subpartitioned. */
-               bootdev.primary= p;
-               masterpos= table[p]->lowsec;
-       }
-
-       if(device == cddevice) {
-               strcpy(bootdev.name, CDNAME);
-       } else {
-               strcpy(bootdev.name, "d0p0");
-               bootdev.name[1] += (device - 0x80);
-               bootdev.name[3] += bootdev.primary;
-               if (bootdev.secondary >= 0) {
-                       strcat(bootdev.name, "s0");
-                       bootdev.name[5] += bootdev.secondary;
-               }
-       }
-
-       /* Find out about the video hardware. */
-        raw_copy(mon2abs(&vid_port), VDU_CRT_BASE_ADDR, sizeof(vid_port));
-       if(vid_port == C_6845) {
-               vid_mem_base = COLOR_BASE;
-               vid_mem_size = COLOR_SIZE;
-       } else {
-               vid_mem_base = MONO_BASE;
-               vid_mem_size = MONO_SIZE;
-       }
-
-       if(get_video() >= 3)
-               vid_mem_size = EGA_SIZE;
-
-#else /* DOS */
-       /* Take the monitor out of the memory map if we have memory to spare,
-        * note that only half our PSP is needed at the new place, the first
-        * half is to be kept in its place.
-        */
-       if (mem[1].size > 0) mem[0].size = newaddr + 0x80 - mem[0].base;
-
-       /* Parse the command line. */
-       argp= PSP + 0x81;
-       argp[PSP[0x80]]= 0;
-       while (between('\1', *argp, ' ')) argp++;
-       vdisk= argp;
-       while (!between('\0', *argp, ' ')) argp++;
-       while (between('\1', *argp, ' ')) *argp++= 0;
-       if (*vdisk == 0) {
-               printf("\nUsage: boot <vdisk> [commands ...]\n");
-               exit(1);
-       }
-       drun= *argp == 0 ? "main" : argp;
-
-       if ((r= dev_open()) != 0) {
-               printf("\n%s: Error %02x (%s)\n", vdisk, r, bios_err(r));
-               exit(1);
-       }
-
-       /* Find the active partition on the virtual disk. */
-       if ((r= get_master(master, table, 0)) != 0) {
-               readerr(0, r); exit(1);
-       }
-
-       strcpy(bootdev.name, "d0");
-       bootdev.primary= -1;
-       for (p= 0; p < NR_PARTITIONS; p++) {
-               if (table[p]->bootind != 0 && table[p]->sysind == MINIX_PART) {
-                       bootdev.primary= p;
-                       strcat(bootdev.name, "p0");
-                       bootdev.name[3] += p;
-                       lowsec= table[p]->lowsec;
-                       break;
-               }
-       }
-#endif /* DOS */
-}
-
-#endif /* BIOS */
-
-/* Reserved names: */
-enum resnames {
-       R_NULL, R_BOOT, R_CTTY, R_DELAY, R_ECHO, R_EXIT, R_HELP,
-       R_LS, R_MENU, R_OFF, R_SAVE, R_SET, R_TRAP, R_UNSET, R_RESET
-};
-
-static char resnames[][6] = {
-       "", "boot", "ctty", "delay", "echo", "exit", "help",
-       "ls", "menu", "off", "save", "set", "trap", "unset", "reset",
-};
-
-/* Using this for all null strings saves a lot of memory. */
-#define null (resnames[0])
-
-static enum resnames reserved(const char *s)
-/* Recognize reserved strings. */
-{
-       enum resnames r;
-
-       for (r= R_BOOT; r <= R_RESET; r++) {
-               if (strcmp(s, resnames[r]) == 0) return r;
-       }
-       return R_NULL;
-}
-
-static void sfree(char *s)
-/* Free a non-null string. */
-{
-       if (s != nil && s != null) free(s);
-}
-
-static char *copystr(const char *s)
-/* Copy a non-null string using malloc. */
-{
-       char *c;
-
-       if (*s == 0) return null;
-       c= malloc((strlen(s) + 1) * sizeof(char));
-       strcpy(c, s);
-       return c;
-}
-
-static int is_default(const environment *e)
-{
-       return (e->flags & E_SPECIAL) && e->defval == nil;
-}
-
-static environment **searchenv(const char *name)
-{
-       environment **aenv= &env;
-
-       while (*aenv != nil && strcmp((*aenv)->name, name) != 0) {
-               aenv= &(*aenv)->next;
-       }
-
-       return aenv;
-}
-
-#define b_getenv(name) (*searchenv(name))
-/* Return the environment *structure* belonging to name, or nil if not found. */
-
-char *b_value(const char *name)
-/* The value of a variable. */
-{
-       environment *e= b_getenv(name);
-
-       return e == nil || !(e->flags & E_VAR) ? nil : e->value;
-}
-
-static char *b_body(const char *name)
-/* The value of a function. */
-{
-       environment *e= b_getenv(name);
-
-       return e == nil || !(e->flags & E_FUNCTION) ? nil : e->value;
-}
-
-static int b_setenv(int flags, const char *name, const char *arg,
-  const char *value)
-/* Change the value of an environment variable.  Returns the flags of the
- * variable if you are not allowed to change it, 0 otherwise.
- */
-{
-       environment **aenv, *e;
-
-       if (*(aenv= searchenv(name)) == nil) {
-               if (reserved(name)) return E_RESERVED;
-               e= malloc(sizeof(*e));
-               e->name= copystr(name);
-               e->flags= flags;
-               e->defval= nil;
-               e->next= nil;
-               *aenv= e;
-       } else {
-               e= *aenv;
-
-               /* Don't change special variables to functions or vv. */
-               if (e->flags & E_SPECIAL
-                       && (e->flags & E_FUNCTION) != (flags & E_FUNCTION)
-               ) return e->flags;
-
-               e->flags= (e->flags & E_STICKY) | flags;
-               if (is_default(e)) {
-                       e->defval= e->value;
-               } else {
-                       sfree(e->value);
-               }
-               sfree(e->arg);
-       }
-       e->arg= copystr(arg);
-       e->value= copystr(value);
-
-       return 0;
-}
-
-int b_setvar(int flags, char *name, char *value)
-/* Set variable or simple function. */
-{
-       int r;
-
-       if((r=b_setenv(flags, name, null, value))) {
-               return r;
-       }
-
-       return r;
-}
-
-void b_unset(const char *name)
-/* Remove a variable from the environment.  A special variable is reset to
- * its default value.
- */
-{
-       environment **aenv, *e;
-
-       if ((e= *(aenv= searchenv(name))) == nil) return;
-
-       if (e->flags & E_SPECIAL) {
-               if (e->defval != nil) {
-                       sfree(e->arg);
-                       e->arg= null;
-                       sfree(e->value);
-                       e->value= e->defval;
-                       e->defval= nil;
-               }
-       } else {
-               sfree(e->name);
-               sfree(e->arg);
-               sfree(e->value);
-               *aenv= e->next;
-               free(e);
-       }
-}
-
-long a2l(const char *a)
-/* Cheap atol(). */
-{
-       int sign= 1;
-       long n= 0;
-
-       if (*a == '-') { sign= -1; a++; }
-
-       while (between('0', *a, '9')) n= n * 10 + (*a++ - '0');
-
-       return sign * n;
-}
-
-char *ul2a(u32_t n, unsigned b)
-/* Transform a long number to ascii at base b, (b >= 8). */
-{
-       static char num[(CHAR_BIT * sizeof(n) + 2) / 3 + 1];
-       char *a= arraylimit(num) - 1;
-       static char hex[16] = "0123456789ABCDEF";
-
-       do *--a = hex[(int) (n % b)]; while ((n/= b) > 0);
-       return a;
-}
-
-char *ul2a10(u32_t n)
-/* Transform a long number to ascii at base 10. */
-{
-       return ul2a(n, 10);
-}
-
-unsigned a2x(const char *a)
-/* Ascii to hex. */
-{
-       unsigned n= 0;
-       int c;
-
-       for (;;) {
-               c= *a;
-               if (between('0', c, '9')) c= c - '0' + 0x0;
-               else
-               if (between('A', c, 'F')) c= c - 'A' + 0xA;
-               else
-               if (between('a', c, 'f')) c= c - 'a' + 0xa;
-               else
-                       break;
-               n= (n<<4) | c;
-               a++;
-       }
-       return n;
-}
-
-static void get_parameters(void)
-{
-       char params[SECTOR_SIZE + 1];
-       token **acmds;
-       int r;
-#if BIOS
-       int processor;
-       memory *mp;
-       static char bus_type[][4] = {
-               "xt", "at", "mca"
-       };
-       static char vid_type[][4] = {
-               "mda", "cga", "ega", "ega", "vga", "vga"
-       };
-       static char vid_chrome[][6] = {
-               "mono", "color"
-       };
-#endif
-
-       /* Variables that Minix needs: */
-       b_setvar(E_SPECIAL|E_VAR|E_DEV, "rootdev", "ram");
-       b_setvar(E_SPECIAL|E_VAR|E_DEV, "ramimagedev", "bootdev");
-       b_setvar(E_SPECIAL|E_VAR, "ramsize", "0");
-#define STRINGIT2(x) #x
-#define STRINGIT1(x) STRINGIT2(x)
-       b_setvar(E_SPECIAL|E_VAR, "hz", STRINGIT1(DEFAULT_HZ));
-#if BIOS
-       processor = getprocessor();
-       if(processor == 1586) processor = 686;
-       b_setvar(E_SPECIAL|E_VAR, "processor", ul2a10(processor));
-       b_setvar(E_SPECIAL|E_VAR, "bus", bus_type[get_bus()]);
-       b_setvar(E_SPECIAL|E_VAR, "video", vid_type[get_video()]);
-       b_setvar(E_SPECIAL|E_VAR, "chrome", vid_chrome[get_video() & 1]);
-       params[0]= 0;
-       for (mp= mem; mp < arraylimit(mem); mp++) {
-               if (mp->size == 0) continue;
-               if (params[0] != 0) strcat(params, ",");
-               strcat(params, ul2a(mp->base, 0x10));
-               strcat(params, ":");
-               strcat(params, ul2a(mp->size, 0x10));
-       }
-       b_setvar(E_SPECIAL|E_VAR, "memory", params);
-
-#if DOS
-       b_setvar(E_SPECIAL|E_VAR, "dosfile-d0", vdisk);
-#endif
-
-#endif
-#if UNIX
-       b_setvar(E_SPECIAL|E_VAR, "processor", "?");
-       b_setvar(E_SPECIAL|E_VAR, "bus", "?");
-       b_setvar(E_SPECIAL|E_VAR, "video", "?");
-       b_setvar(E_SPECIAL|E_VAR, "chrome", "?");
-       b_setvar(E_SPECIAL|E_VAR, "memory", "?");
-       b_setvar(E_SPECIAL|E_VAR, "c0", "?");
-#endif
-
-       /* Variables boot needs: */
-       b_setvar(E_SPECIAL|E_VAR, "image", "boot/image");
-       b_setvar(E_SPECIAL|E_FUNCTION, "leader", 
-               "echo --- Welcome to MINIX 3. This is the boot monitor. ---\\n");
-       b_setvar(E_SPECIAL|E_FUNCTION, "main", "menu");
-       b_setvar(E_SPECIAL|E_FUNCTION, "trailer", "");
-
-       /* Default hidden menu function: */
-       b_setenv(E_RESERVED|E_FUNCTION, null, "=,Start MINIX", "boot");
-
-       /* Tokenize bootparams sector. */
-       if ((r= readsectors(mon2abs(params), lowsec+PARAMSEC, 1)) != 0) {
-               readerr(lowsec+PARAMSEC, r);
-               exit(1);
-       }
-       params[SECTOR_SIZE]= 0;
-       acmds= tokenize(&cmds, params);
-
-       /* Stuff the default action into the command chain. */
-#if UNIX
-       (void) tokenize(acmds, ":;");
-#elif DOS
-       (void) tokenize(tokenize(acmds, ":;leader;"), drun);
-#else /* BIOS */
-       (void) tokenize(acmds, ":;leader;main");
-#endif
-}
-
-static char *addptr;
-
-static void addparm(const char *n)
-{
-       while (*n != 0 && *addptr != 0) *addptr++ = *n++;
-}
-
-static void save_parameters(void)
-/* Save nondefault environment variables to the bootparams sector. */
-{
-       environment *e;
-       char params[SECTOR_SIZE + 1];
-       int r;
-
-       /* Default filling: */
-       memset(params, '\n', SECTOR_SIZE);
-
-       /* Don't touch the 0! */
-       params[SECTOR_SIZE]= 0;
-       addptr= params;
-
-       for (e= env; e != nil; e= e->next) {
-               if (e->flags & E_RESERVED || is_default(e)) continue;
-
-               addparm(e->name);
-               if (e->flags & E_FUNCTION) {
-                       addparm("(");
-                       addparm(e->arg);
-                       addparm(")");
-               } else {
-                       addparm((e->flags & (E_DEV|E_SPECIAL)) != E_DEV
-                                                       ? "=" : "=d ");
-               }
-               addparm(e->value);
-               if (*addptr == 0) {
-                       printf("The environment is too big\n");
-                       return;
-               }
-               *addptr++= '\n';
-       }
-
-       /* Save the parameters on disk. */
-       if ((r= writesectors(mon2abs(params), lowsec+PARAMSEC, 1)) != 0) {
-               writerr(lowsec+PARAMSEC, r);
-               printf("Can't save environment\n");
-       }
-}
-
-static void show_env(void)
-/* Show the environment settings. */
-{
-       environment *e;
-       unsigned more= 0;
-       int c;
-
-       for (e= env; e != nil; e= e->next) {
-               if (e->flags & E_RESERVED) continue;
-               if (!istty && is_default(e)) continue;
-
-               if (e->flags & E_FUNCTION) {
-                       printf("%s(%s) %s\n", e->name, e->arg, e->value);
-               } else {
-                       printf(is_default(e) ? "%s = (%s)\n" : "%s = %s\n",
-                               e->name, e->value);
-               }
-
-               if (e->next != nil && istty && ++more % 20 == 0) {
-                       printf("More? ");
-                       c= getch();
-                       if (c == ESC || c > ' ') {
-                               putch('\n');
-                               if (c > ' ') ungetch(c);
-                               break;
-                       }
-                       printf("\b\b\b\b\b\b");
-               }
-       }
-}
-
-int numprefix(char *s, char **ps)
-/* True iff s is a string of digits.  *ps will be set to the first nondigit
- * if non-nil, otherwise the string should end.
- */
-{
-       char *n= s;
-
-       while (between('0', *n, '9')) n++;
-
-       if (n == s) return 0;
-
-       if (ps == nil) return *n == 0;
-
-       *ps= n;
-       return 1;
-}
-
-int numeric(char *s)
-{
-       return numprefix(s, (char **) nil);
-}
-
-#if BIOS
-
-/* Device numbers of standard MINIX devices. */
-#define DEV_FD0                0x0200
-static dev_t dev_cNd0[] = { 0x0300, 0x0800, 0x0A00, 0x0C00, 0x1000 };
-#define minor_p0s0        128
-
-static int block_size;
-
-dev_t name2dev(char *name)
-/* Translate, say, /dev/c0d0p2 to a device number.  If the name can't be
- * found on the boot device, then do some guesswork.  The global structure
- * "tmpdev" will be filled in based on the name, so that "boot d1p0" knows
- * what device to boot without interpreting device numbers.
- */
-{
-       dev_t dev;
-       ino_t ino;
-       struct stat st;
-       char *n, *s;
-
-       /* "boot *d0p2" means: make partition 2 active before you boot it. */
-       if ((activate= (name[0] == '*'))) name++;
-
-       /* The special name "bootdev" must be translated to the boot device. */
-       if (strcmp(name, "bootdev") == 0) {
-               if (bootdev.device == -1) {
-                       printf("The boot device could not be named\n");
-                       errno= 0;
-                       return -1;
-               }
-               name= bootdev.name;
-       }
-
-       /* If our boot device doesn't have a file system, or we want to know
-        * what a name means for the BIOS, then we need to interpret the
-        * device name ourselves: "fd" = floppy, "c0d0" = hard disk, etc.
-        */
-       tmpdev.device= tmpdev.primary= tmpdev.secondary= -1;
-       dev= -1;
-       n= name;
-       if (strncmp(n, "/dev/", 5) == 0) n+= 5;
-
-       if (strcmp(n, "ram") == 0 || strcmp(n, CDNAME) == 0) {
-               dev= DEV_RAM;
-       } else
-       if (n[0] == 'f' && n[1] == 'd' && numeric(n+2)) {
-               /* Floppy. */
-               tmpdev.device= a2l(n+2);
-               dev= DEV_FD0 + tmpdev.device;
-       } else
-       if ((n[0] == 'h' || n[0] == 's') && n[1] == 'd' && numprefix(n+2, &s)
-               && (*s == 0 || (between('a', *s, 'd') && s[1] == 0))
-       ) {
-               /* Old style hard disk (backwards compatibility.) */
-               dev= a2l(n+2);
-               tmpdev.device= dev / (1 + NR_PARTITIONS);
-               tmpdev.primary= (dev % (1 + NR_PARTITIONS)) - 1;
-               if (*s != 0) {
-                       /* Subpartition. */
-                       tmpdev.secondary= *s - 'a';
-                       dev= minor_p0s0
-                               + (tmpdev.device * NR_PARTITIONS
-                                       + tmpdev.primary) * NR_PARTITIONS
-                               + tmpdev.secondary;
-               }
-               tmpdev.device+= 0x80;
-               dev+= n[0] == 'h' ? dev_cNd0[0] : dev_cNd0[2];
-       } else {
-               /* Hard disk. */
-               int ctrlr= 0;
-
-               if (n[0] == 'c' && between('0', n[1], '4')) {
-                       ctrlr= (n[1] - '0');
-                       tmpdev.device= 0;
-                       n+= 2;
-               }
-               if (n[0] == 'd' && between('0', n[1], '7')) {
-                       tmpdev.device= (n[1] - '0');
-                       n+= 2;
-                       if (n[0] == 'p' && between('0', n[1], '3')) {
-                               tmpdev.primary= (n[1] - '0');
-                               n+= 2;
-                               if (n[0] == 's' && between('0', n[1], '3')) {
-                                       tmpdev.secondary= (n[1] - '0');
-                                       n+= 2;
-                               }
-                       }
-               }
-               if (*n == 0) {
-                       dev= dev_cNd0[ctrlr];
-                       if (tmpdev.secondary < 0) {
-                               dev += tmpdev.device * (NR_PARTITIONS+1)
-                                       + (tmpdev.primary + 1);
-                       } else {
-                               dev += minor_p0s0
-                                       + (tmpdev.device * NR_PARTITIONS
-                                           + tmpdev.primary) * NR_PARTITIONS
-                                       + tmpdev.secondary;
-                       }
-                       tmpdev.device+= 0x80;
-               }
-       }
-
-       mbdev = (u32_t)(tmpdev.device & 0xff) << 24
-           | (u32_t)(tmpdev.primary & 0xff) << 16
-           | (u32_t)(tmpdev.secondary & 0xff) << 8 /* (-1 & 0xff) is 0xff */
-           | 0xff;
-
-       /* Look the name up on the boot device for the UNIX device number. */
-       if (fsok == -1) fsok= r_super(&block_size) != 0;
-       if (fsok) {
-               /* The current working directory is "/dev". */
-               ino= r_lookup(r_lookup(ROOT_INO, "dev"), name);
-
-               if (ino != 0) {
-                       /* Name has been found, extract the device number. */
-                       r_stat(ino, &st);
-                       if (!S_ISBLK(st.st_mode)) {
-                               printf("%s is not a block device\n", name);
-                               errno= 0;
-                               return (dev_t) -1;
-                       }
-                       dev= st.st_rdev;
-               }
-       }
-
-       if (tmpdev.primary < 0) activate= 0;    /* Careful now! */
-
-       if (dev == -1) {
-               printf("Can't recognize '%s' as a device\n", name);
-               errno= 0;
-       }
-       return dev;
-}
-
-#if DEBUG
-static void apm_perror(char *label, u16_t ax)
-{
-       unsigned ah;
-       char *str;
-
-       ah= (ax >> 8);
-       switch(ah)
-       {
-       case 0x01: str= "APM functionality disabled"; break;
-       case 0x03: str= "interface not connected"; break;
-       case 0x09: str= "unrecognized device ID"; break;
-       case 0x0A: str= "parameter value out of range"; break;
-       case 0x0B: str= "interface not engaged"; break;
-       case 0x60: str= "unable to enter requested state"; break;
-       case 0x86: str= "APM not present"; break;
-       default: printf("%s: error 0x%02x\n", label, ah); return;
-       }
-       printf("%s: %s\n", label, str);
-}
-
-#define apm_printf(args) printf args
-#else
-#define apm_perror(label, ax) ((void)0)
-#define apm_printf(args)
-#endif
-
-static void off(void)
-{
-       bios_env_t be;
-       unsigned al, ah;
-
-       /* Try to switch off the system. Print diagnostic information
-        * that can be useful if the operation fails.
-        */
-
-       be.ax= 0x5300;  /* APM, Installation check */
-       be.bx= 0;       /* Device, APM BIOS */
-       int15(&be);
-       if (be.flags & FL_CARRY)
-       {
-               apm_perror("APM installation check failed", be.ax);
-               return;
-       }
-       if (be.bx != (('P' << 8) | 'M'))
-       {
-               apm_printf(("APM signature not found (got 0x%04x)\n", be.bx));
-               return;
-       }
-
-       ah= be.ax >> 8;
-       if (ah > 9)
-               ah= (ah >> 4)*10 + (ah & 0xf);
-       al= be.ax & 0xff;
-       if (al > 9)
-               al= (al >> 4)*10 + (al & 0xf);
-       apm_printf(("APM version %u.%u%s%s%s%s%s\n",
-               ah, al,
-               (be.cx & 0x1) ? ", 16-bit PM" : "",
-               (be.cx & 0x2) ? ", 32-bit PM" : "",
-               (be.cx & 0x4) ? ", CPU-Idle" : "",
-               (be.cx & 0x8) ? ", APM-disabled" : "",
-               (be.cx & 0x10) ? ", APM-disengaged" : ""));
-
-       /* Connect */
-       be.ax= 0x5301;  /* APM, Real mode interface connect */
-       be.bx= 0x0000;  /* APM BIOS */
-       int15(&be);
-       if (be.flags & FL_CARRY)
-       {
-               apm_perror("APM real mode connect failed", be.ax);
-               return;
-       }
-
-       /* Ask for a seat upgrade */
-       be.ax= 0x530e;  /* APM, Driver Version */
-       be.bx= 0x0000;  /* BIOS */
-       be.cx= 0x0102;  /* version 1.2 */
-       int15(&be);
-       if (be.flags & FL_CARRY)
-       {
-               apm_perror("Set driver version failed", be.ax);
-               goto disco;
-       }
-
-       /* Is this version really worth reporting. Well, if the system
-        * does switch off, you won't see it anyway.
-        */
-       ah= be.ax >> 8;
-       if (ah > 9)
-               ah= (ah >> 4)*10 + (ah & 0xf);
-       al= be.ax & 0xff;
-       if (al > 9)
-               al= (al >> 4)*10 + (al & 0xf);
-       apm_printf(("Got APM connection version %u.%u\n", ah, al));
-
-       /* Enable */
-       be.ax= 0x5308;  /* APM, Enable/disable power management */
-       be.bx= 0x0001;  /* All device managed by APM BIOS */
-#if 0
-       /* For old APM 1.0 systems, we need 0xffff. Assume that those
-        * systems do not exist.
-        */
-       be.bx= 0xffff;  /* All device managed by APM BIOS (compat) */
-#endif
-       be.cx= 0x0001;  /* Enable power management */
-       int15(&be);
-       if (be.flags & FL_CARRY)
-       {
-               apm_perror("Enable power management failed", be.ax);
-               goto disco;
-       }
-
-       /* Off */
-       be.ax= 0x5307;  /* APM, Set Power State */
-       be.bx= 0x0001;  /* All devices managed by APM */
-       be.cx= 0x0003;  /* Off */
-       int15(&be);
-       if (be.flags & FL_CARRY)
-       {
-               apm_perror("Set power state failed", be.ax);
-               goto disco;
-       }
-
-       apm_printf(("Power off sequence successfully completed.\n\n"));
-       apm_printf(("Ha, ha, just kidding!\n"));
-
-disco:
-       /* Disconnect */
-       be.ax= 0x5304;  /* APM, interface disconnect */
-       be.bx= 0x0000;  /* APM BIOS */
-       int15(&be);
-       if (be.flags & FL_CARRY)
-       {
-               apm_perror("APM interface disconnect failed", be.ax);
-               return;
-       }
-}
-
-#if !DOS
-#define B_NOSIG                -1      /* "No signature" error code. */
-
-int exec_bootstrap(void)
-/* Load boot sector from the disk or floppy described by tmpdev and execute it.
- */
-{
-       int r, n, dirty= 0;
-       char master[SECTOR_SIZE];
-       struct part_entry *table[NR_PARTITIONS], dummy, *active= &dummy;
-       u32_t masterpos;
-
-       active->lowsec= 0;
-
-       /* Select a partition table entry. */
-       while (tmpdev.primary >= 0) {
-               masterpos= active->lowsec;
-
-               if ((r= get_master(master, table, masterpos)) != 0) return r;
-
-               active= table[tmpdev.primary];
-
-               /* How does one check a partition table entry? */
-               if (active->sysind == NO_PART) return B_NOSIG;
-
-               tmpdev.primary= tmpdev.secondary;
-               tmpdev.secondary= -1;
-       }
-
-       if (activate && !active->bootind) {
-               for (n= 0; n < NR_PARTITIONS; n++) table[n]->bootind= 0;
-               active->bootind= ACTIVE_FLAG;
-               dirty= 1;
-       }
-
-       /* Read the boot sector. */
-       if ((r= readsectors(BOOTPOS, active->lowsec, 1)) != 0) return r;
-
-       /* Check signature word. */
-       if (get_word(BOOTPOS+SIGNATOFF) != SIGNATURE) return B_NOSIG;
-
-       /* Write the partition table if a member must be made active. */
-       if (dirty && (r= writesectors(mon2abs(master), masterpos, 1)) != 0)
-               return r;
-
-       bootstrap(device, active);
-       return 0;
-}
-
-static void boot_device(char *devname)
-/* Boot the device named by devname. */
-{
-       dev_t dev= name2dev(devname);
-       int save_dev= device;
-       int r;
-       const char *err;
-
-       if (tmpdev.device < 0) {
-                /* FIXME: clearer error message. */
-               if (dev != -1) printf("Can't boot from %s\n", devname);
-               return;
-       }
-
-       /* Change current device and try to load and execute its bootstrap. */
-       device= tmpdev.device;
-
-       if ((r= dev_open()) == 0) r= exec_bootstrap();
-
-       err= r == B_NOSIG ? "Not bootable" : bios_err(r);
-       printf("Can't boot %s: %s\n", devname, err);
-
-       /* Restore boot device setting. */
-       device= save_dev;
-       (void) dev_open();
-}
-
-static void ctty(char *line)
-{
-       if (line == nil) {
-               serial_line = -1;
-       } else if (between('0', line[0], '3') && line[1] == 0) {
-               serial_line = line[0] - '0';
-       } else {
-               printf("Bad serial line number: %s\n", line);
-               return;
-       }
-       serial_init(serial_line);
-}
-
-#else /* DOS */
-
-static void boot_device(char *devname)
-/* No booting of other devices under DOS. */
-{
-       printf("Can't boot devices under DOS\n");
-}
-
-static void ctty(char *line)
-/* Don't know how to handle serial lines under DOS. */
-{
-       printf("No serial line support under DOS\n");
-}
-
-static void reset(void)
-{
-       printf("No reset support under DOS\n");
-}
-
-#endif /* DOS */
-#endif /* BIOS */
-
-static void ls(char *dir)
-/* List the contents of a directory. */
-{
-       ino_t ino;
-       struct stat st;
-       char name[MFS_DIRSIZ+1];
-
-       if (fsok == -1) fsok= r_super(&block_size) != 0;
-       if (!fsok) return;
-
-       /* (,) construct because r_stat returns void */
-       if ((ino= r_lookup(ROOT_INO, dir)) == 0 ||
-               (r_stat(ino, &st), r_readdir(name)) == -1)
-       {
-               printf("ls: %s: %s\n", dir, unix_err(errno));
-               return;
-       }
-       (void) r_readdir(name); /* Skip ".." too. */
-
-       while (r_readdir(name) != 0) printf("%s/%s\n", dir, name);
-}
-
-static u32_t milli_time(void)
-{
-       return get_tick() * MSEC_PER_TICK;
-}
-
-static u32_t milli_since(u32_t base)
-{
-       return (milli_time() + (TICKS_PER_DAY*MSEC_PER_TICK) - base)
-                       % (TICKS_PER_DAY*MSEC_PER_TICK);
-}
-
-static char *Thandler;
-static u32_t Tbase, Tcount;
-
-static void unschedule(void)
-/* Invalidate a waiting command. */
-{
-       alarm(0);
-
-       if (Thandler != nil) {
-               free(Thandler);
-               Thandler= nil;
-       }
-}
-
-static void schedule(long msec, char *cmd)
-/* Schedule command at a certain time from now. */
-{
-       unschedule();
-       Thandler= cmd;
-       Tbase= milli_time();
-       Tcount= msec;
-       alarm(1);
-}
-
-int expired(void)
-/* Check if the timer expired for getch(). */
-{
-       return (Thandler != nil && milli_since(Tbase) >= Tcount);
-}
-
-void delay(const char *msec)
-/* Delay for a given time. */
-{
-       u32_t base, count;
-
-       if ((count= a2l(msec)) == 0) return;
-       base= milli_time();
-
-       alarm(1);
-
-       do {
-               pause();
-       } while (!interrupt() && !expired() && milli_since(base) < count);
-}
-
-static enum whatfun { NOFUN, SELECT, DEFFUN, USERFUN } menufun(const environment *e)
-{
-       if (!(e->flags & E_FUNCTION) || e->arg[0] == 0) return NOFUN;
-       if (e->arg[1] != ',') return SELECT;
-       return e->flags & E_RESERVED ? DEFFUN : USERFUN;
-}
-
-void menu(void)
-/* By default:  Show a simple menu.
- * Multiple kernels/images:  Show extra selection options.
- * User defined function:  Kill the defaults and show these.
- * Wait for a keypress and execute the given function.
- */
-{
-       int c, def= 1;
-       char *choice= nil;
-       environment *e;
-
-       /* Just a default menu? */
-       for (e= env; e != nil; e= e->next) if (menufun(e) == USERFUN) def= 0;
-
-       printf("\nHit a key as follows:\n\n");
-
-       /* Show the choices. */
-       for (e= env; e != nil; e= e->next) {
-               switch (menufun(e)) {
-               case DEFFUN:
-                       if (!def) break;
-                       /*FALL THROUGH*/
-               case USERFUN:
-                       printf("    %c  %s\n", e->arg[0], e->arg+2);
-                       break;
-               case SELECT:
-                       printf("    %c  Select %s kernel\n", e->arg[0],e->name);
-                       break;
-                case NOFUN:
-               default:;
-               }
-       }
-
-       /* Wait for a keypress. */
-       do {
-               c= getch();
-               if (interrupt() || expired()) return;
-
-               unschedule();
-
-               for (e= env; e != nil; e= e->next) {
-                       switch (menufun(e)) {
-                       case DEFFUN:
-                               if (!def) break;
-                       case USERFUN:
-                       case SELECT:
-                               if (c == e->arg[0]) choice= e->value;
-                       case NOFUN:
-                               break;
-                       }
-               }
-       } while (choice == nil);
-
-       /* Execute the chosen function. */
-       printf("%c\n", c);
-       (void) tokenize(&cmds, choice);
-}
-
-void help(void)
-/* Not everyone is a rocket scientist. */
-{
-       struct help {
-               char    *thing;
-               char    *help;
-       } *pi;
-       static struct help info[] = {
-               { nil,  "Names:" },
-               { "rootdev",            "Root device" },
-               { "ramimagedev",        "Device to use as RAM disk image " },
-               { "ramsize",            "RAM disk size (if no image device) " },
-               { "bootdev",            "Special name for the boot device" },
-               { "fd0, d0p2, c0d0p1s0",        "Devices (as in /dev)" },
-               { "image",              "Name of the boot image to use" },
-               { "main",               "Startup function" },
-               { "bootdelay",          "Delay in msec after loading image" },
-               { nil,  "Commands:" },
-               { "name = [device] value",  "Set environment variable" },
-               { "name() { ... }",         "Define function" },
-               { "name(key,text) { ... }",
-                       "A menu option like: minix(=,Start MINIX) {boot}" },
-               { "name",               "Call function" },
-               { "boot [device]",      "Boot Minix or another O.S." },
-               { "ctty [line]",        "Duplicate to serial line" },
-               { "delay [msec]",       "Delay (500 msec default)" },
-               { "echo word ...",      "Display the words" },
-               { "ls [directory]",     "List contents of directory" },
-               { "menu",               "Show menu and choose menu option" },
-               { "save / set",         "Save or show environment" },
-               { "trap msec command",  "Schedule command " },
-               { "unset name ...",     "Unset variable or set to default" },
-               { "exit / off",         "Exit the Monitor / Power off" },
-       };
-
-       for (pi= info; pi < arraylimit(info); pi++) {
-               if (pi->thing != nil) printf("    %-24s- ", pi->thing);
-               printf("%s\n", pi->help);
-       }
-}
-
-static void execute(void)
-/* Get one command from the command chain and execute it. */
-{
-       token *second, *third=nil, *fourth=nil, *sep;
-       char *name;
-       enum resnames res;
-       size_t n= 0;
-
-       if (err) {
-               /* An error occured, stop interpreting. */
-               while (cmds != nil) voidtoken();
-               return;
-       }
-
-       if (expired()) {        /* Timer expired? */
-               parse_code(Thandler);
-               unschedule();
-       }
-
-       /* There must be a separator lurking somewhere. */
-       for (sep= cmds; sep != nil && sep->token[0] != ';'; sep= sep->next) n++;
-
-       name= cmds->token;
-       res= reserved(name);
-       if ((second= cmds->next) != nil
-               && (third= second->next) != nil)
-                       fourth= third->next;
-
-               /* Null command? */
-       if (n == 0) {
-               voidtoken();
-               return;
-       } else
-               /* name = [device] value? */
-       if ((n == 3 || n == 4)
-               && !sugar(name)
-               && second->token[0] == '='
-               && !sugar(third->token)
-               && (n == 3 || (n == 4 && third->token[0] == 'd'
-                                       && !sugar(fourth->token)
-       ))) {
-               char *value= third->token;
-               int flags= E_VAR;
-
-               if (n == 4) { value= fourth->token; flags|= E_DEV; }
-
-               if ((flags= b_setvar(flags, name, value)) != 0) {
-                       printf("%s is a %s\n", name,
-                               flags & E_RESERVED ? "reserved word" :
-                                               "special function");
-                       err= 1;
-               }
-               while (cmds != sep) voidtoken();
-               return;
-       } else
-               /* name '(arg)' ... ? */
-       if (n >= 3
-               && !sugar(name)
-               && second->token[0] == '('
-       ) {
-               token *fun;
-               int c, flags, depth;
-               char *body;
-               size_t len;
-
-               sep= fun= third;
-               depth= 0;
-               len= 1;
-               while (sep != nil) {
-                       if ((c= sep->token[0]) == ';' && depth == 0) break;
-                       len+= strlen(sep->token) + 1;
-                       sep= sep->next;
-                       if (c == '{') depth++;
-                       if (c == '}' && --depth == 0) break;
-               }
-
-               body= malloc(len * sizeof(char));
-               *body= 0;
-
-               while (fun != sep) {
-                       strcat(body, fun->token);
-                       if (!sugar(fun->token)
-                               && !sugar(fun->next->token)
-                       ) strcat(body, " ");
-                       fun= fun->next;
-               }
-               second->token[strlen(second->token)-1]= 0;
-
-               if (depth != 0) {
-                       printf("Missing '}'\n");
-                       err= 1;
-               } else
-               if ((flags= b_setenv(E_FUNCTION, name,
-                                       second->token+1, body)) != 0) {
-                       printf("%s is a %s\n", name,
-                               flags & E_RESERVED ? "reserved word" :
-                                               "special variable");
-                       err= 1;
-               }
-               while (cmds != sep) voidtoken();
-               free(body);
-               return;
-       } else
-               /* Grouping? */
-       if (name[0] == '{') {
-               token **acmds= &cmds->next;
-               char *t;
-               int depth= 1;
-
-               /* Find and remove matching '}' */
-               depth= 1;
-               while (*acmds != nil) {
-                       t= (*acmds)->token;
-                       if (t[0] == '{') depth++;
-                       if (t[0] == '}' && --depth == 0) { t[0]= ';'; break; }
-                       acmds= &(*acmds)->next;
-               }
-               voidtoken();
-               return;
-       } else
-               /* Command coming up, check if ESC typed. */
-       if (interrupt()) {
-               return;
-       } else
-               /* unset name ..., echo word ...? */
-       if (n >= 1 && (res == R_UNSET || res == R_ECHO)) {
-               char *arg= poptoken(), *p;
-
-               for (;;) {
-                       free(arg);
-                       if (cmds == sep) break;
-                       arg= poptoken();
-                       if (res == R_UNSET) {   /* unset arg */
-                               b_unset(arg);
-                       } else {                /* echo arg */
-                               p= arg;
-                               while (*p != 0) {
-                                       if (*p != '\\') {
-                                               putch(*p);
-                                       } else
-                                       switch (*++p) {
-                                       case 0:
-                                               if (cmds == sep) return;
-                                               continue;
-                                       case 'n':
-                                               putch('\n');
-                                               break;
-                                       case 'v':
-                                               printf("%s", version);
-                                               break;
-                                       case 'c':
-                                               clear_screen();
-                                               break;
-                                       case 'w':
-                                               for (;;) {
-                                                       if (interrupt())
-                                                               return;
-                                                       if (getch() == '\n')
-                                                               break;
-                                               }
-                                               break;
-                                       default:
-                                               putch(*p);
-                                       }
-                                       p++;
-                               }
-                               putch(cmds != sep ? ' ' : '\n');
-                       }
-               }
-               return;
-       } else
-               /* boot -opts? */
-       if (n == 2 && res == R_BOOT && second->token[0] == '-') {
-               static char optsvar[]= "bootopts";
-               (void) b_setvar(E_VAR, optsvar, second->token);
-               voidtoken();
-               voidtoken();
-               bootminix();
-               b_unset(optsvar);
-               return;
-       } else
-               /* boot device, ls dir, delay msec? */
-       if (n == 2 && (res == R_BOOT || res == R_CTTY
-                       || res == R_DELAY || res == R_LS)
-       ) {
-               if (res == R_BOOT) boot_device(second->token);
-               if (res == R_CTTY) ctty(second->token);
-               if (res == R_DELAY) delay(second->token);
-               if (res == R_LS) ls(second->token);
-               voidtoken();
-               voidtoken();
-               return;
-       } else
-               /* trap msec command? */
-       if (n == 3 && res == R_TRAP && numeric(second->token)) {
-               long msec= a2l(second->token);
-
-               voidtoken();
-               voidtoken();
-               schedule(msec, poptoken());
-               return;
-       } else
-               /* Simple command. */
-       if (n == 1) {
-               char *body;
-               int ok= 0;
-
-               name= poptoken();
-
-               switch (res) {
-               case R_BOOT:    bootminix();    ok= 1;  break;
-               case R_DELAY:   delay("500");   ok= 1;  break;
-               case R_LS:      ls(null);       ok= 1;  break;
-               case R_MENU:    menu();         ok= 1;  break;
-               case R_SAVE:    save_parameters(); ok= 1;break;
-               case R_SET:     show_env();     ok= 1;  break;
-               case R_HELP:    help();         ok= 1;  break;
-               case R_EXIT:    exit(0);
-               case R_OFF:     off();          ok= 1;  break;
-               case R_CTTY:    ctty(nil);      ok= 1;  break;
-               case R_RESET:   reset();        ok= 1;  break;
-
-               case R_NULL:
-               case R_ECHO:
-               case R_TRAP:
-               case R_UNSET:
-                       /* Handled after the switch. */
-                       break;
-               }
-
-               /* Command to check bootparams: */
-               if (strcmp(name, ":") == 0) ok= 1;
-
-               /* User defined function. */
-               if (!ok && (body= b_body(name)) != nil) {
-                       (void) tokenize(&cmds, body);
-                       ok= 1;
-               }
-               if (!ok) printf("%s: unknown function", name);
-               free(name);
-               if (ok) return;
-       } else {
-               /* Syntax error. */
-               printf("Can't parse:");
-               while (cmds != sep) {
-                       printf(" %s", cmds->token); voidtoken();
-               }
-       }
-
-       /* Getting here means that the command is not understood. */
-       printf("\nTry 'help'\n");
-       err= 1;
-}
-
-int run_trailer(void)
-/* Run the trailer function between loading Minix and handing control to it.
- * Return true iff there was no error.
- */
-{
-       token *save_cmds= cmds;
-
-       cmds= nil;
-       (void) tokenize(&cmds, "trailer");
-       while (cmds != nil) execute();
-       cmds= save_cmds;
-       return !err;
-}
-
-static void monitor(void)
-/* Read a line and tokenize it. */
-{
-       char *line;
-
-       unschedule();           /* Kill a trap. */
-       err= 0;                 /* Clear error state. */
-
-       if (istty) printf("%s>", bootdev.name);
-       line= readline();
-       (void) tokenize(&cmds, line);
-       free(line);
-       (void) escape();        /* Forget if ESC typed. */
-}
-
-#if BIOS
-
-void boot(void)
-/* Load Minix and start it, among other things. */
-{
-       /* Initialize tables. */
-       initialize();
-
-       /* Get environment variables from the parameter sector. */
-       get_parameters();
-
-       while (1) {
-               /* While there are commands, execute them! */
-
-               while (cmds != nil) execute();
-
-               /* The "monitor" is just a "read one command" thing. */
-               monitor();
-       }
-}
-#endif /* BIOS */
-
-#if UNIX
-
-int main(int argc, char **argv)
-/* Do not load or start anything, just edit parameters. */
-{
-       int i;
-       char bootcode[SECTOR_SIZE];
-       struct termios rawterm;
-
-       istty= (argc <= 2 && tcgetattr(0, &termbuf) == 0);
-
-       if (argc < 2) {
-               fprintf(stderr, "Usage: edparams device [command ...]\n");
-               exit(1);
-       }
-
-       /* Go over the arguments, changing control characters to spaces. */
-       for (i= 2; i < argc; i++) {
-               char *p;
-
-               for (p= argv[i]; *p != 0; p++) {
-                       if ((unsigned) *p < ' ' && *p != '\n') *p= ' ';
-               }
-       }
-
-       bootdev.name= argv[1];
-       if (strncmp(bootdev.name, "/dev/", 5) == 0) bootdev.name+= 5;
-       if ((bootdev.device= open(argv[1], O_RDWR, 0666)) < 0)
-               fatal(bootdev.name);
-
-       /* Check if it is a bootable Minix device. */
-       if (readsectors(mon2abs(bootcode), lowsec, 1) != 0) {
-               fprintf(stderr, "edparams: %s: not a bootable Minix device\n",
-                       bootdev.name);
-               exit(1);
-       }
-
-       /* Print greeting message.  */
-       if (istty) printf("Boot parameters editor.\n");
-
-       signal(SIGINT, trap);
-       signal(SIGALRM, trap);
-
-       if (istty) {
-               rawterm= termbuf;
-               rawterm.c_lflag&= ~(ICANON|ECHO|IEXTEN);
-               rawterm.c_cc[VINTR]= ESC;
-               if (tcsetattr(0, TCSANOW, &rawterm) < 0) fatal("");
-       }
-
-       /* Get environment variables from the parameter sector. */
-       get_parameters();
-
-       i= 2;
-       for (;;) {
-               /* While there are commands, execute them! */
-               while (cmds != nil || i < argc) {
-                       if (cmds == nil) {
-                               /* A command line command. */
-                               parse_code(argv[i++]);
-                       }
-                       execute();
-
-                       /* Bail out on errors if not interactive. */
-                       if (err && !istty) exit(1);
-               }
-
-               /* Commands on the command line? */
-               if (argc > 2) break;
-
-               /* The "monitor" is just a "read one command" thing. */
-               monitor();
-       }
-       exit(0);
-       return 0;
-}
-
-void reset(void) { }
-
-#endif /* UNIX */
-
-/*
- * $PchId: boot.c,v 1.14 2002/02/27 19:46:14 philip Exp $
- */
-
diff --git a/boot/boot/boothead.s b/boot/boot/boothead.s
deleted file mode 100644 (file)
index c2e0e6f..0000000
+++ /dev/null
@@ -1,1638 +0,0 @@
-#
-!      Boothead.s - BIOS support for boot.c            Author: Kees J. Bot
-!
-!
-! This file contains the startup and low level support for the secondary
-! boot program.  It contains functions for disk, tty and keyboard I/O,
-! copying memory to arbitrary locations, etc.
-!
-! The primary bootstrap code supplies the following parameters in registers:
-!      dl      = Boot-device.
-!      es:si   = Partition table entry if hard disk.
-!
-.text
-
-       o32         =     0x66  ! This assembler doesn't know 386 extensions
-       BOOTOFF     =   0x7C00  ! 0x0000:BOOTOFF load a bootstrap here
-       LOADSEG     =   0x1000  ! Where this code is loaded.
-       BUFFER      =   0x0600  ! First free memory
-       PENTRYSIZE  =       16  ! Partition table entry size.
-       a_flags     =        2  ! From a.out.h, struct exec
-       a_text      =        8
-       a_data      =       12
-       a_bss       =       16
-       a_total     =       24
-       A_SEP       =     0x20  ! Separate I&D flag
-       K_I386      =   0x0001  ! Call Minix in 386 mode
-       K_RET       =   0x0020  ! Returns to the monitor on reboot
-       K_INT86     =   0x0040  ! Requires generic INT support
-       K_MEML      =   0x0080  ! Pass a list of free memory
-
-       DS_SELECTOR =      3*8  ! Kernel data selector
-       ES_SELECTOR =      4*8  ! Flat 4 Gb
-       SS_SELECTOR =      5*8  ! Monitor stack
-       CS_SELECTOR =      6*8  ! Kernel code
-       MCS_SELECTOR=      7*8  ! Monitor code
-       E820_MAGIC=      0x534D4150
-
-       ESC         =     0x1B  ! Escape character
-
-       MB_BOOT_MAGIC   =         0x2BADB002    ! Multiboot BootLoader Magic
-       MULTIBOOT_STRUCT_ADDR   =       0x9500  ! Multiboot Struct's Location
-
-#include "emem.h"
-
-! Imported variables and functions:
-.extern _caddr, _daddr, _runsize, _edata, _end ! Runtime environment
-.extern _device                                        ! BIOS device number
-.extern _rem_part                              ! To pass partition info
-.extern _k_flags                               ! Special kernel flags
-.extern _mem                                   ! Free memory list
-.extern _emem                          ! Free memory list for E820
-.extern _emem_entries                          ! Free memory E820 list entries
-.extern _cdbooted                              ! Whether we booted from CD
-.extern _cddevice                              ! Whether we booted from CD
-.extern _do_multiboot                          ! Whether we are multibooting
-
-.text
-
-
-! Set segment registers and stack pointer using the programs own header!
-! The header is either 32 bytes (short form) or 48 bytes (long form).  The
-! bootblock will jump to address 0x10030 in both cases, calling one of the
-! two jmpf instructions below.
-!
-! CD bootblock jumps to address 0x10050 in both cases.
-
-       jmpf    boot, LOADSEG+3 ! Set cs right (skipping long a.out header)
-       .space  11              ! jmpf + 11 = 16 bytes
-       jmpf    boot, LOADSEG+2 ! Set cs right (skipping short a.out header)
-       .space  11              ! jmpf + 11 = 16 bytes
-       jmpf    cdboot, LOADSEG+3
-       .space  11              
-       jmpf    cdboot, LOADSEG+2
-       .space  11              
-cdboot:
-       mov     bx, #1
-       jmp     commonboot
-boot:
-       mov     bx, #0
-commonboot:
-       mov     ax, #LOADSEG
-       mov     ds, ax          ! ds = header
-
-       movb    al, a_flags
-       testb   al, #A_SEP      ! Separate I&D?
-       jnz     sepID
-comID: xor     ax, ax
-       xchg    ax, a_text      ! No text
-       add     a_data, ax      ! Treat all text as data
-sepID:
-       mov     ax, a_total     ! Total nontext memory usage
-       and     ax, #0xFFFE     ! Round down to even
-       mov     a_total, ax     ! total - text = data + bss + heap + stack
-       cli                     ! Ignore interrupts while stack in limbo
-       mov     sp, ax          ! Set sp at the top of all that
-
-       mov     ax, a_text      ! Determine offset of ds above cs
-       movb    cl, #4
-       shr     ax, cl
-       mov     cx, cs
-       add     ax, cx
-       mov     ds, ax          ! ds = cs + text / 16
-       mov     ss, ax
-       sti                     ! Stack ok now
-       push    es              ! Save es, we need it for the partition table
-       mov     es, ax
-       cld                     ! C compiler wants UP
-
-! Clear bss
-       xor     ax, ax          ! Zero
-       mov     di, #_edata     ! Start of bss is at end of data
-       mov     cx, #_end       ! End of bss (begin of heap)
-       sub     cx, di          ! Number of bss bytes
-       shr     cx, #1          ! Number of words
-       rep
-       stos                    ! Clear bss
-
-! Copy primary boot parameters to variables.  (Can do this now that bss is
-! cleared and may be written into).
-       xorb    dh, dh
-       mov     _device, dx     ! Boot device (probably 0x00 or 0x80)
-       mov     _rem_part+0, si ! Remote partition table offset
-       pop     _rem_part+2     ! and segment (saved es)
-       mov     _cdbooted, bx   ! Booted from CD? (bx set above)
-
-! Remember the current video mode for restoration on exit.
-       movb    ah, #0x0F       ! Get current video mode
-       int     0x10
-       andb    al, #0x7F       ! Mask off bit 7 (no blanking)
-       movb    old_vid_mode, al
-       movb    cur_vid_mode, al
-
-! Give C code access to the code segment, data segment and the size of this
-! process.
-       xor     ax, ax
-       mov     dx, cs
-       call    seg2abs
-       mov     _caddr+0, ax
-       mov     _caddr+2, dx
-       xor     ax, ax
-       mov     dx, ds
-       call    seg2abs
-       mov     _daddr+0, ax
-       mov     _daddr+2, dx
-       push    ds
-       mov     ax, #LOADSEG
-       mov     ds, ax          ! Back to the header once more
-       mov     ax, a_total+0
-       mov     dx, a_total+2   ! dx:ax = data + bss + heap + stack
-       add     ax, a_text+0
-       adc     dx, a_text+2    ! dx:ax = text + data + bss + heap + stack
-       pop     ds
-       mov     _runsize+0, ax
-       mov     _runsize+2, dx  ! 32 bit size of this process
-
-!Determine memory using the 0xE820 BIOS function if available
-       mov     di, #_emem
-       mov     20(di), #1      ! force a valid ACPI 3.X entry
-
-       .data1 o32
-       xor     bx, bx          ! zero EBX
-       xor     bp, bp          !zero bp
-       .data1 o32
-       mov     dx, #E820_MAGIC
-       .data1 o32
-       mov     cx, #EMEM_SIZE  ! request 24 bytes
-       
-       .data1 o32
-       mov     ax, #0xE820
-       int     0x15
-       jc      e820_failed
-
-       .data1 o32
-       mov     dx, #E820_MAGIC
-       .data1 o32
-       cmp     dx, ax
-       jne     e820_failed
-
-       .data1 o32
-       test    bx, bx
-       je      e820_failed
-       jmp     e820_gotit
-
-e820_next:
-       .data1 o32
-       mov     ax, #0xE820
-       mov     20(di), #1      ! force a valid ACPI 3.X entry
-       
-       .data1 o32
-       mov     cx, #EMEM_SIZE  ! request 24 bytes
-       int     0x15
-       jc      e820_done
-       .data1 o32
-       mov     dx, #E820_MAGIC
-
-
-e820_gotit:
-       jcxz    e820_skip
-       cmp     bp, #EMEM_ENTRIES
-       je      e820_done       ! we have EMEM_ENTRIES storage
-       inc     bp
-       add     di, #EMEM_SIZE  ! increase di for next entry
-e820_skip:
-       .data1 o32
-       test    bx, bx
-       jne     e820_next
-
-e820_done:
-       mov     _emem_entries, bp
-       jmp     memory_detected
-
-e820_failed:
-
-! Determine available memory as a list of (base,size) pairs as follows:
-! mem[0] = low memory, mem[1] = memory between 1M and 16M, mem[2] = memory
-! above 16M.  Last two coalesced into mem[1] if adjacent.
-       mov     di, #_mem       ! di = memory list
-       int     0x12            ! Returns low memory size (in K) in ax
-       mul     c1024
-       mov     4(di), ax       ! mem[0].size = low memory size in bytes
-       mov     6(di), dx
-       call    _getprocessor
-       cmp     ax, #286        ! Only 286s and above have extended memory
-       jb      no_ext
-       cmp     ax, #486        ! Assume 486s were the first to have >64M
-       jb      small_ext       ! (It helps to be paranoid when using the BIOS)
-big_ext:
-       mov     ax, #0xE801     ! Code for get memory size for >64M
-       int     0x15            ! ax = mem at 1M per 1K, bx = mem at 16M per 64K
-       jnc     got_ext
-small_ext:
-       movb    ah, #0x88       ! Code for get extended memory size
-       clc                     ! Carry will stay clear if call exists
-       int     0x15            ! Returns size (in K) in ax for AT's
-       jc      no_ext
-       test    ax, ax          ! An AT with no extended memory?
-       jz      no_ext
-       xor     bx, bx          ! bx = mem above 16M per 64K = 0
-got_ext:
-       mov     cx, ax          ! cx = copy of ext mem at 1M
-       mov     10(di), #0x0010 ! mem[1].base = 0x00100000 (1M)
-       mul     c1024
-       mov     12(di), ax      ! mem[1].size = "ext mem at 1M" * 1024
-       mov     14(di), dx
-       test    bx, bx
-       jz      no_ext          ! No more ext mem above 16M?
-       cmp     cx, #15*1024    ! Chunks adjacent? (precisely 15M at 1M?)
-       je      adj_ext
-       mov     18(di), #0x0100 ! mem[2].base = 0x01000000 (16M)
-       mov     22(di), bx      ! mem[2].size = "ext mem at 16M" * 64K
-       jmp     no_ext
-adj_ext:
-       add     14(di), bx      ! Add ext mem above 16M to mem below 16M
-no_ext:
-
-memory_detected:
-
-! Time to switch to a higher level language (not much higher)
-       call    _boot
-
-! void ..exit(int status)
-!      Exit the monitor by rebooting the system.
-.define        _exit, __exit, ___exit          ! Make various compilers happy
-_exit:
-__exit:
-___exit:
-       mov     bx, sp
-       cmp     2(bx), #0               ! Good exit status?
-       jz      reboot
-quit:  mov     ax, #any_key
-       push    ax
-       call    _printf
-       xorb    ah, ah                  ! Read character from keyboard
-       int     0x16
-reboot:        call    dev_reset
-       call    restore_video
-       int     0x19                    ! Reboot the system
-.data
-any_key:
-       .ascii  "\nHit any key to reboot\n\0"
-.text
-
-! u32_t mon2abs(void *ptr)
-!      Address in monitor data to absolute address.
-.define _mon2abs
-_mon2abs:
-       mov     bx, sp
-       mov     ax, 2(bx)       ! ptr
-       mov     dx, ds          ! Monitor data segment
-       jmp     seg2abs
-
-! u32_t vec2abs(vector *vec)
-!      8086 interrupt vector to absolute address.
-.define _vec2abs
-_vec2abs:
-       mov     bx, sp
-       mov     bx, 2(bx)
-       mov     ax, (bx)
-       mov     dx, 2(bx)       ! dx:ax vector
-       !jmp    seg2abs         ! Translate
-
-seg2abs:                       ! Translate dx:ax to the 32 bit address dx-ax
-       push    cx
-       movb    ch, dh
-       movb    cl, #4
-       shl     dx, cl
-       shrb    ch, cl          ! ch-dx = dx << 4
-       add     ax, dx
-       adcb    ch, #0          ! ch-ax = ch-dx + ax
-       movb    dl, ch
-       xorb    dh, dh          ! dx-ax = ch-ax
-       pop     cx
-       ret
-
-abs2seg:                       ! Translate the 32 bit address dx-ax to dx:ax
-       push    cx
-       movb    ch, dl
-       mov     dx, ax          ! ch-dx = dx-ax
-       and     ax, #0x000F     ! Offset in ax
-       movb    cl, #4
-       shr     dx, cl
-       shlb    ch, cl
-       orb     dh, ch          ! dx = ch-dx >> 4
-       pop     cx
-       ret
-
-! void raw_copy(u32_t dstaddr, u32_t srcaddr, u32_t count)
-!      Copy count bytes from srcaddr to dstaddr.  Don't do overlaps.
-!      Also handles copying words to or from extended memory.
-.define _raw_copy
-_raw_copy:
-       push    bp
-       mov     bp, sp
-       push    si
-       push    di              ! Save C variable registers
-copy:
-       cmp     14(bp), #0
-       jnz     bigcopy
-       mov     cx, 12(bp)
-       jcxz    copydone        ! Count is zero, end copy
-       cmp     cx, #0xFFF0
-       jb      smallcopy
-bigcopy:mov    cx, #0xFFF0     ! Don't copy more than about 64K at once
-smallcopy:
-       push    cx              ! Save copying count
-       mov     ax, 4(bp)
-       mov     dx, 6(bp)
-       cmp     dx, #0x0010     ! Copy to extended memory?
-       jae     ext_copy
-       cmp     10(bp), #0x0010 ! Copy from extended memory?
-       jae     ext_copy
-       call    abs2seg
-       mov     di, ax
-       mov     es, dx          ! es:di = dstaddr
-       mov     ax, 8(bp)
-       mov     dx, 10(bp)
-       call    abs2seg
-       mov     si, ax
-       mov     ds, dx          ! ds:si = srcaddr
-       shr     cx, #1          ! Words to move
-       rep
-       movs                    ! Do the word copy
-       adc     cx, cx          ! One more byte?
-       rep
-       movsb                   ! Do the byte copy
-       mov     ax, ss          ! Restore ds and es from the remaining ss
-       mov     ds, ax
-       mov     es, ax
-       jmp     copyadjust
-ext_copy:
-       mov     x_dst_desc+2, ax
-       movb    x_dst_desc+4, dl ! Set base of destination segment
-       movb    x_dst_desc+7, dh
-       mov     ax, 8(bp)
-       mov     dx, 10(bp)
-       mov     x_src_desc+2, ax
-       movb    x_src_desc+4, dl ! Set base of source segment
-       movb    x_src_desc+7, dh
-       mov     si, #x_gdt      ! es:si = global descriptor table
-       shr     cx, #1          ! Words to move
-       movb    ah, #0x87       ! Code for extended memory move
-       int     0x15
-copyadjust:
-       pop     cx              ! Restore count
-       add     4(bp), cx
-       adc     6(bp), #0       ! srcaddr += copycount
-       add     8(bp), cx
-       adc     10(bp), #0      ! dstaddr += copycount
-       sub     12(bp), cx
-       sbb     14(bp), #0      ! count -= copycount
-       jmp     copy            ! and repeat
-copydone:
-       pop     di
-       pop     si              ! Restore C variable registers
-       pop     bp
-       ret
-
-! u16_t get_word(u32_t addr);
-! void put_word(u32_t addr, u16_t word);
-!      Read or write a 16 bits word at an arbitrary location.
-.define        _get_word, _put_word
-_get_word:
-       mov     bx, sp
-       call    gp_getaddr
-       mov     ax, (bx)        ! Word to get from addr
-       jmp     gp_ret
-_put_word:
-       mov     bx, sp
-       push    6(bx)           ! Word to store at addr
-       call    gp_getaddr
-       pop     (bx)            ! Store the word
-       jmp     gp_ret
-gp_getaddr:
-       mov     ax, 2(bx)
-       mov     dx, 4(bx)
-       call    abs2seg
-       mov     bx, ax
-       mov     ds, dx          ! ds:bx = addr
-       ret
-gp_ret:
-       push    es
-       pop     ds              ! Restore ds
-       ret
-
-! void relocate(void);
-!      After the program has copied itself to a safer place, it needs to change
-!      the segment registers.  Caddr has already been set to the new location.
-.define _relocate
-_relocate:
-       pop     bx              ! Return address
-       mov     ax, _caddr+0
-       mov     dx, _caddr+2
-       call    abs2seg
-       mov     cx, dx          ! cx = new code segment
-       mov     ax, cs          ! Old code segment
-       sub     ax, cx          ! ax = -(new - old) = -Moving offset
-       mov     dx, ds
-       sub     dx, ax
-       mov     ds, dx          ! ds += (new - old)
-       mov     es, dx
-       mov     ss, dx
-       xor     ax, ax
-       call    seg2abs
-       mov     _daddr+0, ax
-       mov     _daddr+2, dx    ! New data address
-       push    cx              ! New text segment
-       push    bx              ! Return offset of this function
-       retf                    ! Relocate
-
-! void *brk(void *addr)
-! void *sbrk(size_t incr)
-!      Cannot fail implementations of brk(2) and sbrk(3), so we can use
-!      malloc(3).  They reboot on stack collision instead of returning -1.
-.data
-       .align  2
-break: .data2  _end            ! A fake heap pointer
-.text
-.define _brk, __brk, _sbrk, __sbrk
-_brk:
-__brk:                         ! __brk is for the standard C compiler
-       xor     ax, ax
-       jmp     sbrk            ! break= 0; return sbrk(addr);
-_sbrk:
-__sbrk:
-       mov     ax, break       ! ax= current break
-sbrk:  push    ax              ! save it as future return value
-       mov     bx, sp          ! Stack is now: (retval, retaddr, incr, ...)
-       add     ax, 4(bx)       ! ax= break + increment
-       mov     break, ax       ! Set new break
-       lea     dx, -1024(bx)   ! sp minus a bit of breathing space
-       cmp     dx, ax          ! Compare with the new break
-       jb      heaperr         ! Suffocating noises
-       lea     dx, -4096(bx)   ! A warning when heap+stack goes < 4K
-       cmp     dx, ax
-       jae     plenty          ! No reason to complain
-       mov     ax, #memwarn
-       push    ax
-       call    _printf         ! Warn about memory running low
-       pop     ax
-       movb    memwarn, #0     ! No more warnings
-plenty:        pop     ax              ! Return old break (0 for brk)
-       ret
-heaperr:mov    ax, #chmem
-       push    ax
-       mov     ax, #nomem
-       push    ax
-       call    _printf
-       jmp     quit
-.data
-nomem: .ascii  "\nOut of%s\0"
-memwarn:.ascii "\nLow on"
-chmem: .ascii  " memory, use chmem to increase the heap\n\0"
-.text
-
-! int dev_open(void);
-!      Given the device "_device" figure out if it exists and what its number
-!      of heads and sectors may be.  Return the BIOS error code on error,
-!      otherwise 0.
-.define        _dev_open
-_dev_open:
-       call    dev_reset       ! Optionally reset the disks
-       movb    dev_state, #0   ! State is "closed"
-       push    es
-       push    di              ! Save registers used by BIOS calls
-       movb    dl, _device     ! The default device
-       cmpb    dl, _cddevice
-       je      cdopen
-       cmpb    dl, #0x80       ! Floppy < 0x80, winchester >= 0x80
-       jae     winchester
-floppy:
-       mov     di, #3          ! Three tries to init drive by reading sector 0
-finit0:        xor     ax, ax
-       mov     es, ax
-       mov     bx, #BUFFER     ! es:bx = scratch buffer
-       mov     ax, #0x0201     ! Read sector, #sectors = 1
-       mov     cx, #0x0001     ! Track 0, first sector
-       xorb    dh, dh          ! Drive dl, head 0
-       int     0x13
-       jnc     finit0ok        ! Sector 0 read ok?
-       cmpb    ah, #0x80       ! Disk timed out?  (Floppy drive empty)
-       je      geoerr
-       dec     di
-       jz      geoerr
-       xorb    ah, ah          ! Reset drive
-       int     0x13
-       jc      geoerr
-       jmp     finit0          ! Retry once more, it may need to spin up
-finit0ok:
-       mov     di, #seclist    ! List of per floppy type sectors/track
-flast: movb    cl, (di)        ! Sectors per track to test
-       cmpb    cl, #9          ! No need to do the last 720K/360K test
-       je      ftestok
-       xor     ax, ax
-       mov     es, ax
-       mov     bx, #BUFFER     ! es:bx = scratch buffer
-       mov     ax, #0x0201     ! Read sector, #sectors = 1
-       xorb    ch, ch          ! Track 0, last sector
-       xorb    dh, dh          ! Drive dl, head 0
-       int     0x13
-       jnc     ftestok         ! Sector cl read ok?
-       xorb    ah, ah          ! Reset drive
-       int     0x13
-       jc      geoerr
-       inc     di              ! Try next sec/track number
-       jmp     flast
-ftestok:
-       movb    dh, #2          ! Floppies have two sides
-       jmp     geoboth
-winchester:
-       movb    ah, #0x08       ! Code for drive parameters
-       int     0x13            ! dl still contains drive
-       jc      geoerr          ! No such drive?
-       andb    cl, #0x3F       ! cl = max sector number (1-origin)
-       incb    dh              ! dh = 1 + max head number (0-origin)
-       jmp geoboth
-cdopen:
-       movb    cl, #0x3F       ! Think up geometry for CD's
-       movb    dh, #0x2
-geoboth:
-       movb    sectors, cl     ! Sectors per track
-       movb    al, cl          ! al = sectors per track
-       mulb    dh              ! ax = heads * sectors
-       mov     secspcyl, ax    ! Sectors per cylinder = heads * sectors
-       movb    dev_state, #1   ! Device state is "open"
-       xor     ax, ax          ! Code for success
-geodone:
-       pop     di
-       pop     es              ! Restore di and es registers
-       ret
-geoerr:        movb    al, ah
-       xorb    ah, ah          ! ax = BIOS error code
-       jmp     geodone
-.data
-seclist:
-       .data1  18, 15, 9       ! 1.44M, 1.2M, and 360K/720K floppy sec/track
-.text
-
-! int dev_close(void);
-!      Close the current device.  Under the BIOS this does nothing much.
-.define        _dev_close
-_dev_close:
-       xor     ax, ax
-       movb    dev_state, al   ! State is "closed"
-       ret
-
-! Reset the disks if needed.  Minix may have messed things up.
-dev_reset:
-       cmpb    dev_state, #0   ! Need reset if dev_state < 0
-       jge     0f
-       xorb    ah, ah          ! Reset (ah = 0)
-       movb    dl, #0x80       ! All disks
-       int     0x13
-       movb    dev_state, #0   ! State is "closed"
-0:     ret
-
-! int dev_boundary(u32_t sector);
-!      True if a sector is on a boundary, i.e. sector % sectors == 0.
-.define        _dev_boundary
-_dev_boundary:
-       mov     bx, sp
-       xor     dx, dx
-       mov     ax, 4(bx)       ! divide high half of sector number
-       div     sectors
-       mov     ax, 2(bx)       ! divide low half of sector number
-       div     sectors         ! dx = sector % sectors
-       sub     dx, #1          ! CF = dx == 0
-       sbb     ax, ax          ! ax = -CF
-       neg     ax              ! ax = (sector % sectors) == 0
-       ret
-
-! int biosreadsectors(u32_t bufaddr, u32_t sector, u8_t count)
-! int writesectors(u32_t bufaddr, u32_t sector, u8_t count)
-!      Read/write several sectors from/to disk or floppy.  The buffer must
-!      be between 64K boundaries!  Count must fit in a byte.  The external
-!      variables _device, sectors and secspcyl describe the disk and its
-!      geometry.  Returns 0 for success, otherwise the BIOS error code.
-!
-.define _biosreadsectors, _writesectors
-_writesectors:
-       push    bp
-       mov     bp, sp
-       movb    13(bp), #0x03   ! Code for a disk write
-       jmp     rwsec
-_biosreadsectors:
-       push    bp
-       mov     bp, sp
-       movb    13(bp), #0x02   ! Code for a disk read
-rwsec: push    si
-       push    di
-       push    es
-       cmpb    dev_state, #0   ! Device state?
-       jg      0f              ! >0 if open
-       call    _dev_open       ! Initialize
-       test    ax, ax
-       jnz     badopen
-0:     mov     ax, 4(bp)
-       mov     dx, 6(bp)
-       call    abs2seg
-       mov     bx, ax
-       mov     es, dx          ! es:bx = bufaddr
-       mov     di, #3          ! Execute 3 resets on floppy error
-       cmpb    _device, #0x80
-       jb      nohd
-       mov     di, #1          ! But only 1 reset on hard disk error
-nohd:  cmpb    12(bp), #0      ! count equals zero?
-       jz      done
-more:  mov     ax, 8(bp)
-       mov     dx, 10(bp)      ! dx:ax = abs sector.  Divide it by sectors/cyl
-       cmp     dx, #[1024*255*63-255]>>16  ! Near 8G limit?
-       jae     bigdisk
-       mov     si, _device     
-       cmp     si, _cddevice   ! Is it a CD?
-       je      bigdisk         ! CD's need extended read.
-       div     secspcyl        ! ax = cylinder, dx = sector within cylinder
-       xchg    ax, dx          ! ax = sector within cylinder, dx = cylinder
-       movb    ch, dl          ! ch = low 8 bits of cylinder
-       divb    sectors         ! al = head, ah = sector (0-origin)
-       xorb    dl, dl          ! About to shift bits 8-9 of cylinder into dl
-       shr     dx, #1
-       shr     dx, #1          ! dl[6..7] = high cylinder
-       orb     dl, ah          ! dl[0..5] = sector (0-origin)
-       movb    cl, dl          ! cl[0..5] = sector, cl[6..7] = high cyl
-       incb    cl              ! cl[0..5] = sector (1-origin)
-       movb    dh, al          ! dh = head
-       movb    dl, _device     ! dl = device to use
-       movb    al, sectors     ! Sectors per track - Sector number (0-origin)
-       subb    al, ah          ! = Sectors left on this track
-       cmpb    al, 12(bp)      ! Compare with # sectors to transfer
-       jbe     doit            ! Can't go past the end of a cylinder?
-       movb    al, 12(bp)      ! 12(bp) < sectors left on this track
-doit:  movb    ah, 13(bp)      ! Code for disk read (0x02) or write (0x03)
-       push    ax              ! Save al = sectors to read
-       int     0x13            ! call the BIOS to do the transfer
-       pop     cx              ! Restore al in cl
-       jmp     rdeval
-bigdisk:
-       mov     si, #ext_rw     ! si = extended read/write parameter packet
-       movb    cl, 12(bp)
-       movb    2(si), cl       ! Fill in # blocks to transfer
-       mov     4(si), bx       ! Buffer address = es:bx
-       mov     6(si), es
-       mov     8(si), ax       ! Starting block number = dx:ax
-       mov     10(si), dx
-       movb    dl, _device     ! dl = device to use
-       mov     ax, #0x4000     ! This, or-ed with 0x02 or 0x03 becomes
-       orb     ah, 13(bp)      ! extended read (0x4200) or write (0x4300)
-       int     0x13
-       !jmp    rdeval
-rdeval:
-       jc      ioerr           ! I/O error
-       movb    al, cl          ! Restore al = sectors read
-       addb    bh, al          ! bx += 2 * al * 256 (add bytes transferred)
-       addb    bh, al          ! es:bx = where next sector is located
-       add     8(bp), ax       ! Update address by sectors transferred
-       adc     10(bp), #0      ! Don't forget high word
-       subb    12(bp), al      ! Decrement sector count by sectors transferred
-       jnz     more            ! Not all sectors have been transferred
-done:  xorb    ah, ah          ! No error here!
-       jmp     finish
-ioerr: cmpb    ah, #0x80       ! Disk timed out?  (Floppy drive empty)
-       je      finish
-       cmpb    ah, #0x03       ! Disk write protected?
-       je      finish
-       dec     di              ! Do we allow another reset?
-       jl      finish          ! No, report the error
-       xorb    ah, ah          ! Code for a reset (0)
-       int     0x13
-       jnc     more            ! Succesful reset, try request again
-finish:        movb    al, ah
-       xorb    ah, ah          ! ax = error number
-badopen:pop    es
-       pop     di
-       pop     si
-       pop     bp
-       ret
-.data
-       .align  4
-! Extended read/write commands require a parameter packet.
-ext_rw:
-       .data1  0x10            ! Length of extended r/w packet
-       .data1  0               ! Reserved
-       .data2  0               ! Blocks to transfer (to be filled in)
-       .data2  0               ! Buffer address offset (tbfi)
-       .data2  0               ! Buffer address segment (tbfi)
-       .data4  0               ! Starting block number low 32 bits (tbfi)
-       .data4  0               ! Starting block number high 32 bits
-.text
-
-! int getch(void);
-!      Read a character from the keyboard, and check for an expired timer.
-!      A carriage return is changed into a linefeed for UNIX compatibility.
-.define _getch
-_getch:
-       xor     ax, ax
-       xchg    ax, unchar      ! Ungotten character?
-       test    ax, ax
-       jnz     gotch
-getch:
-!      hlt                     ! Play dead until interrupted (see pause())
-       movb    ah, #0x01       ! Keyboard status
-       int     0x16
-       jz      0f              ! Nothing typed
-       xorb    ah, ah          ! Read character from keyboard
-       int     0x16
-       jmp     press           ! Keypress
-0:     mov     dx, line        ! Serial line?
-       test    dx, dx
-       jz      0f
-       add     dx, #5          ! Line Status Register
-       inb     dx
-       testb   al, #0x01       ! Data Ready?
-       jz      0f
-       mov     dx, line
-       !add    dx, 0           ! Receive Buffer Register
-       inb     dx              ! Get character
-       jmp     press
-0:     call    _expired        ! Timer expired?
-       test    ax, ax
-       jz      getch
-       mov     ax, #ESC        ! Return ESC
-       ret
-press:
-       cmpb    al, #0x0D       ! Carriage return?
-       jnz     nocr
-       movb    al, #0x0A       ! Change to linefeed
-nocr:  cmpb    al, #ESC        ! Escape typed?
-       jne     noesc
-       inc     escape          ! Set flag
-noesc: xorb    ah, ah          ! ax = al
-gotch: ret
-
-! int ungetch(void);
-!      Return a character to undo a getch().
-.define _ungetch
-_ungetch:
-       mov     bx, sp
-       mov     ax, 2(bx)
-       mov     unchar, ax
-       ret
-
-! int escape(void);
-!      True if ESC has been typed.
-.define _escape
-_escape:
-       movb    ah, #0x01       ! Keyboard status
-       int     0x16
-       jz      escflg          ! Keypress?
-       cmpb    al, #ESC        ! Escape typed?
-       jne     escflg
-       xorb    ah, ah          ! Discard the escape
-       int     0x16
-       inc     escape          ! Set flag
-escflg:        xor     ax, ax
-       xchg    ax, escape      ! Escape typed flag
-       ret
-
-! int putch(int c);
-!      Write a character in teletype mode.  The putk synonym is
-!      for the kernel printf function that uses it.
-!      Newlines are automatically preceded by a carriage return.
-!
-.define _putch, _putk
-_putch:
-_putk: mov     bx, sp
-       movb    al, 2(bx)       ! al = character to be printed
-       testb   al, al          ! Kernel printf adds a null char to flush queue
-       jz      nulch
-       cmpb    al, #0x0A       ! al = newline?
-       jnz     putc
-       movb    al, #0x0D
-       call    putc            ! putc('\r')
-       movb    al, #0x0A       ! Restore the '\n' and print it
-putc:  movb    ah, #0x0E       ! Print character in teletype mode
-       mov     bx, #0x0001     ! Page 0, foreground color
-       int     0x10
-       mov     bx, line        ! Serial line?
-       test    bx, bx
-       jz      nulch
-       push    ax              ! Save character to print
-       call    _get_tick       ! Current clock tick counter
-       mov     cx, ax
-       add     cx, #2          ! Don't want to see it count twice
-1:     lea     dx, 5(bx)       ! Line Status Register
-       inb     dx
-       testb   al, #0x20       ! Transmitter Holding Register Empty?
-       jnz     0f
-       call    _get_tick
-       cmp     ax, cx          ! Clock ticked more than once?
-       jne     1b
-0:     pop     ax              ! Restore character to print
-       mov     dx, bx          ! Transmit Holding Register
-       outb    dx              ! Send character down the serial line
-nulch: ret
-
-! void pause(void);
-!      Wait for an interrupt using the HLT instruction.  This either saves
-!      power, or tells an x86 emulator that nothing is happening right now.
-.define _pause
-_pause:
-!      hlt
-       ret
-
-! void set_mode(unsigned mode);
-! void clear_screen(void);
-!      Set video mode / clear the screen.
-.define _set_mode, _clear_screen
-_set_mode:
-       mov     bx, sp
-       mov     ax, 2(bx)       ! Video mode
-       cmp     ax, cur_vid_mode
-       je      modeok          ! Mode already as requested?
-       mov     cur_vid_mode, ax
-_clear_screen:
-       xor     ax, ax
-       mov     es, ax          ! es = Vector segment
-       mov     ax, cur_vid_mode
-       movb    ch, ah          ! Copy of the special flags
-       andb    ah, #0x0F       ! Test bits 8-11, clear special flags
-       jnz     xvesa           ! VESA extended mode?
-       int     0x10            ! Reset video (ah = 0)
-       jmp     md_480
-xvesa: mov     bx, ax          ! bx = extended mode
-       mov     ax, #0x4F02     ! Reset video
-       int     0x10
-md_480:                                ! Basic video mode is set, now build on it
-       testb   ch, #0x20       ! 480 scan lines requested?
-       jz      md_14pt
-       mov     dx, #0x3CC      ! Get CRTC port
-       inb     dx
-       movb    dl, #0xD4
-       testb   al, #1          ! Mono or color?
-       jnz     0f
-       movb    dl, #0xB4
-0:     mov     ax, #0x110C     ! Vertical sync end (also unlocks CR0-7)
-       call    out2
-       mov     ax, #0x060B     ! Vertical total
-       call    out2
-       mov     ax, #0x073E     ! (Vertical) overflow
-       call    out2
-       mov     ax, #0x10EA     ! Vertical sync start
-       call    out2
-       mov     ax, #0x12DF     ! Vertical display end
-       call    out2
-       mov     ax, #0x15E7     ! Vertical blank start
-       call    out2
-       mov     ax, #0x1604     ! Vertical blank end
-       call    out2
-       push    dx
-       movb    dl, #0xCC       ! Misc output register (read)
-       inb     dx
-       movb    dl, #0xC2       ! (write)
-       andb    al, #0x0D       ! Preserve clock select bits and color bit
-       orb     al, #0xE2       ! Set correct sync polarity
-       outb    dx
-       pop     dx              ! Index register still in dx
-md_14pt:
-       testb   ch, #0x40       ! 9x14 point font requested?
-       jz      md_8pt
-       mov     ax, #0x1111     ! Load ROM 9 by 14 font
-       xorb    bl, bl          ! Load block 0
-       int     0x10
-       testb   ch, #0x20       ! 480 scan lines?
-       jz      md_8pt
-       mov     ax, #0x12DB     ! VGA vertical display end
-       call    out2
-   eseg        movb    0x0484, #33     ! Tell BIOS the last line number
-md_8pt:
-       testb   ch, #0x80       ! 8x8 point font requested?
-       jz      setcur
-       mov     ax, #0x1112     ! Load ROM 8 by 8 font
-       xorb    bl, bl          ! Load block 0
-       int     0x10
-       testb   ch, #0x20       ! 480 scan lines?
-       jz      setcur
-       mov     ax, #0x12DF     ! VGA vertical display end
-       call    out2
-   eseg        movb    0x0484, #59     ! Tell BIOS the last line number
-setcur:
-       xor     dx, dx          ! dl = column = 0, dh = row = 0
-       xorb    bh, bh          ! Page 0
-       movb    ah, #0x02       ! Set cursor position
-       int     0x10
-       push    ss
-       pop     es              ! Restore es
-modeok:        ret
-
-! Out to the usual [index, data] port pair that are common for VGA devices
-! dx = port, ah = index, al = data.
-out2:
-       push    dx
-       push    ax
-       movb    al, ah
-       outb    dx              ! Set index
-       inc     dx
-       pop     ax
-       outb    dx              ! Send data
-       pop     dx
-       ret
-
-restore_video:                 ! To restore the video mode on exit
-       mov     ax, old_vid_mode
-       push    ax
-       call    _set_mode
-       pop     ax
-       ret
-
-! void serial_init(int line)
-!      Initialize copying console I/O to a serial line.
-.define        _serial_init
-_serial_init:
-       mov     bx, sp
-       mov     dx, 2(bx)       ! Line number
-       mov     line, #0
-       test    dx, dx          ! Off if line number < 0
-       js      0f
-       push    ds
-       xor     ax, ax
-       mov     ds, ax          ! Vector and BIOS data segment
-       mov     bx, dx          ! Line number
-       shl     bx, #1          ! Word offset
-       mov     bx, 0x0400(bx)  ! I/O port for the given line
-       pop     ds
-       mov     line, bx        ! Remember I/O port
-serial_init:
-       mov     bx, line
-       test    bx, bx          ! I/O port must be nonzero
-       jz      0f
-       mov     ax, #0x00E3     ! 9600 N-8-1
-       int     0x14            ! Initialize serial line dx
-       lea     dx, 4(bx)       ! Modem Control Register
-       movb    al, #0x0B       ! DTR, RTS, OUT2
-       outb    dx
-0:     ret
-
-! u32_t get_tick(void);
-!      Return the current value of the clock tick counter.  This counter
-!      increments 18.2 times per second.  Poll it to do delays.  Does not
-!      work on the original PC, but works on the PC/XT.
-.define _get_tick
-_get_tick:
-       push    cx
-       xorb    ah, ah          ! Code for get tick count
-       int     0x1A
-       mov     ax, dx
-       mov     dx, cx          ! dx:ax = cx:dx = tick count
-       pop     cx
-       ret
-
-
-! Functions used to obtain info about the hardware.  Boot uses this information
-! itself, but will also pass them on to a pure 386 kernel, because one can't
-! make BIOS calls from protected mode.  The video type could probably be
-! determined by the kernel too by looking at the hardware, but there is a small
-! chance on errors that the monitor allows you to correct by setting variables.
-
-.define _get_bus               ! returns type of system bus
-.define _get_video             ! returns type of display
-
-! u16_t get_bus(void)
-!      Return type of system bus, in order: XT, AT, MCA.
-_get_bus:
-       call    _getprocessor
-       xor     dx, dx          ! Assume XT
-       cmp     ax, #286        ! An AT has at least a 286
-       jb      got_bus
-       inc     dx              ! Assume AT
-       movb    ah, #0xC0       ! Code for get configuration
-       int     0x15
-       jc      got_bus         ! Carry clear and ah = 00 if supported
-       testb   ah, ah
-       jne     got_bus
-       eseg
-       movb    al, 5(bx)       ! Load feature byte #1
-       inc     dx              ! Assume MCA
-       testb   al, #0x02       ! Test bit 1 - "bus is Micro Channel"
-       jnz     got_bus
-       dec     dx              ! Assume AT
-       testb   al, #0x40       ! Test bit 6 - "2nd 8259 installed"
-       jnz     got_bus
-       dec     dx              ! It is an XT
-got_bus:
-       push    ds
-       pop     es              ! Restore es
-       mov     ax, dx          ! Return bus code
-       mov     bus, ax         ! Keep bus code, A20 handler likes to know
-       ret
-
-! u16_t get_video(void)
-!      Return type of display, in order: MDA, CGA, mono EGA, color EGA,
-!      mono VGA, color VGA.
-_get_video:
-       mov     ax, #0x1A00     ! Function 1A returns display code
-       int     0x10            ! al = 1A if supported
-       cmpb    al, #0x1A
-       jnz     no_dc           ! No display code function supported
-
-       mov     ax, #2
-       cmpb    bl, #5          ! Is it a monochrome EGA?
-       jz      got_video
-       inc     ax
-       cmpb    bl, #4          ! Is it a color EGA?
-       jz      got_video
-       inc     ax
-       cmpb    bl, #7          ! Is it a monochrome VGA?
-       jz      got_video
-       inc     ax
-       cmpb    bl, #8          ! Is it a color VGA?
-       jz      got_video
-
-no_dc: movb    ah, #0x12       ! Get information about the EGA
-       movb    bl, #0x10
-       int     0x10
-       cmpb    bl, #0x10       ! Did it come back as 0x10? (No EGA)
-       jz      no_ega
-
-       mov     ax, #2
-       cmpb    bh, #1          ! Is it monochrome?
-       jz      got_video
-       inc     ax
-       jmp     got_video
-
-no_ega:        int     0x11            ! Get bit pattern for equipment
-       and     ax, #0x30       ! Isolate color/mono field
-       sub     ax, #0x30
-       jz      got_video       ! Is it an MDA?
-       mov     ax, #1          ! No it's CGA
-
-got_video:
-       ret
-
-
-! Functions to leave the boot monitor.
-.define _bootstrap             ! Call another bootstrap
-.define _minix                 ! Call Minix
-
-! void _bootstrap(int device, struct part_entry *entry)
-!      Call another bootstrap routine to boot MS-DOS for instance.  (No real
-!      need for that anymore, now that you can format floppies under Minix).
-!      The bootstrap must have been loaded at BOOTSEG from "device".
-_bootstrap:
-       call    restore_video
-       mov     bx, sp
-       movb    dl, 2(bx)       ! Device to boot from
-       mov     si, 4(bx)       ! ds:si = partition table entry
-       xor     ax, ax
-       mov     es, ax          ! Vector segment
-       mov     di, #BUFFER     ! es:di = buffer in low core
-       mov     cx, #PENTRYSIZE ! cx = size of partition table entry
- rep   movsb                   ! Copy the entry to low core
-       mov     si, #BUFFER     ! es:si = partition table entry
-       mov     ds, ax          ! Some bootstraps need zero segment registers
-       cli
-       mov     ss, ax
-       mov     sp, #BOOTOFF    ! This should do it
-       sti
-       jmpf    BOOTOFF, 0      ! Back to where the BIOS loads the boot code
-
-! void minix(u32_t koff, u32_t kcs, u32_t kds,
-!                              char *bootparams, size_t paramsize, u32_t aout);
-!      Call Minix.
-_minix:
-       push    bp
-       mov     bp, sp          ! Pointer to arguments
-
-       mov     dx, #0x03F2     ! Floppy motor drive control bits
-       movb    al, #0x0C       ! Bits 4-7 for floppy 0-3 are off
-       outb    dx              ! Kill the motors
-       push    ds
-       xor     ax, ax          ! Vector & BIOS data segments
-       mov     ds, ax
-       andb    0x043F, #0xF0   ! Clear diskette motor status bits of BIOS
-       pop     ds
-       cli                     ! No more interruptions
-
-       test    _k_flags, #K_I386 ! Switch to 386 mode?
-       jnz     minix386
-
-! Call Minix in real mode.
-minix86:
-       test    _k_flags, #K_MEML ! New memory arrangements?
-       jz      0f
-       push    22(bp)          ! Address of a.out headers
-       push    20(bp)
-0:
-       push    18(bp)          ! # bytes of boot parameters
-       push    16(bp)          ! Address of boot parameters
-
-       test    _k_flags, #K_RET ! Can the kernel return?
-       jz      noret86
-       xor     dx, dx          ! If little ext mem then monitor not preserved
-       xor     ax, ax
-       cmp     _mon_return, ax ! Minix can return to the monitor?
-       jz      0f
-       mov     dx, cs          ! Monitor far return address
-       mov     ax, #ret86
-0:     push    dx              ! Push monitor far return address or zero
-       push    ax
-noret86:
-
-       mov     ax, 8(bp)
-       mov     dx, 10(bp)
-       call    abs2seg
-       push    dx              ! Kernel code segment
-       push    4(bp)           ! Kernel code offset
-       mov     ax, 12(bp)
-       mov     dx, 14(bp)
-       call    abs2seg
-       mov     ds, dx          ! Kernel data segment
-       mov     es, dx          ! Set es to kernel data too
-       retf                    ! Make a far call to the kernel
-
-! Call Minix in 386 mode.
-minix386:
-  cseg mov     cs_real-2, cs   ! Patch CS and DS into the instructions that
-  cseg mov     ds_real-2, ds   ! reload them when switching back to real mode
-       .data1  0x0F,0x20,0xC0  ! mov   eax, cr0
-       orb     al, #0x01       ! Set PE (protection enable) bit
-       .data1  o32
-       mov     msw, ax         ! Save as protected mode machine status word
-
-       mov     dx, ds          ! Monitor ds
-       mov     ax, #p_gdt      ! dx:ax = Global descriptor table
-       call    seg2abs
-       mov     p_gdt_desc+2, ax
-       movb    p_gdt_desc+4, dl ! Set base of global descriptor table
-
-       cmp     _do_multiboot, #1
-       je      set_monss
-
-       mov     ax, 12(bp)
-       mov     dx, 14(bp)      ! Kernel ds (absolute address)
-       mov     p_ds_desc+2, ax
-       movb    p_ds_desc+4, dl ! Set base of kernel data segment
-
-       mov     ax, 8(bp)
-       mov     dx, 10(bp)      ! Kernel cs (absolute address)
-       mov     p_cs_desc+2, ax
-       movb    p_cs_desc+4, dl
-
-set_monss:
-       mov     dx, ss          ! Monitor ss
-       xor     ax, ax          ! dx:ax = Monitor stack segment
-       call    seg2abs         ! Minix starts with the stack of the monitor
-       mov     p_ss_desc+2, ax
-       movb    p_ss_desc+4, dl
-
-       mov     dx, cs          ! Monitor cs
-       xor     ax, ax          ! dx:ax = Monitor code segment
-       call    seg2abs
-       mov     p_mcs_desc+2, ax
-       movb    p_mcs_desc+4, dl
-
-       push    #MCS_SELECTOR
-       test    _k_flags, #K_INT86 ! Generic INT86 support?
-       jz      0f
-       push    #int86          ! Far address to INT86 support
-       jmp     1f
-0:     push    #bios13         ! Far address to BIOS int 13 support
-1:
-       test    _k_flags, #K_MEML ! New memory arrangements?
-       jz      0f
-       .data1  o32
-       push    20(bp)          ! Address of a.out headers
-0:
-       push    #0
-       push    18(bp)          ! 32 bit size of parameters on stack
-       push    #0
-       push    16(bp)          ! 32 bit address of parameters (ss relative)
-
-       test    _k_flags, #K_RET ! Can the kernel return?
-       jz      noret386
-       push    #MCS_SELECTOR
-       push    #ret386         ! Monitor far return address
-noret386:
-
-       push    #0
-       push    #CS_SELECTOR
-       push    6(bp)
-       push    4(bp)           ! 32 bit far address to kernel entry point
-
-       cmp     _do_multiboot, #1
-       je      multiboot
-
-       call    real2prot       ! Switch to protected mode
-       mov     ax, #DS_SELECTOR ! Kernel data
-       mov     ds, ax
-       mov     ax, #ES_SELECTOR ! Flat 4 Gb
-       mov     es, ax
-
-       .data1  o32             ! Make a far call to the kernel
-       retf
-
-multiboot:
-       call    real2prot       ! Switch to protected mode
-       mov     ax, #DS_SELECTOR ! Kernel data
-       mov     ds, ax
-       mov     ax, #ES_SELECTOR ! Flat 4 Gb
-       mov     es, ax
-!      mov     fs, ax
-!      mov     gs, ax
-       mov     bx, #MULTIBOOT_STRUCT_ADDR
-       .data1  o32             ! Make a far call to the kernel
-       retf
-
-! Minix-86 returns here on a halt or reboot.
-ret86:
-       mov     _reboot_code+0, ax
-       mov     _reboot_code+2, dx      ! Return value (obsolete method)
-       jmp     return
-
-! Minix-386 returns here on a halt or reboot.
-ret386:
-       .data1  o32
-       mov     _reboot_code, ax        ! Return value (obsolete method)
-       call    prot2real       ! Switch to real mode
-
-return:
-       mov     sp, bp          ! Pop parameters
-       sti                     ! Can take interrupts again
-
-       call    _get_video      ! MDA, CGA, EGA, ...
-       movb    dh, #24         ! dh = row 24
-       cmp     ax, #2          ! At least EGA?
-       jb      is25            ! Otherwise 25 rows
-       push    ds
-       xor     ax, ax          ! Vector & BIOS data segments
-       mov     ds, ax
-       movb    dh, 0x0484      ! Number of rows on display minus one
-       pop     ds
-is25:
-       xorb    dl, dl          ! dl = column 0
-       xorb    bh, bh          ! Page 0
-       movb    ah, #0x02       ! Set cursor position
-       int     0x10
-
-       movb    dev_state, #-1  ! Minix may have upset the disks, must reset.
-       call    serial_init     ! Likewise with our serial console
-
-       call    _getprocessor
-       cmp     ax, #286
-       jb      noclock
-       xorb    al, al
-tryclk:        decb    al
-       jz      noclock
-       movb    ah, #0x02       ! Get real-time clock time (from CMOS clock)
-       int     0x1A
-       jc      tryclk          ! Carry set, not running or being updated
-       movb    al, ch          ! ch = hour in BCD
-       call    bcd             ! al = (al >> 4) * 10 + (al & 0x0F)
-       mulb    c60             ! 60 minutes in an hour
-       mov     bx, ax          ! bx = hour * 60
-       movb    al, cl          ! cl = minutes in BCD
-       call    bcd
-       add     bx, ax          ! bx = hour * 60 + minutes
-       movb    al, dh          ! dh = seconds in BCD
-       call    bcd
-       xchg    ax, bx          ! ax = hour * 60 + minutes, bx = seconds
-       mul     c60             ! dx-ax = (hour * 60 + minutes) * 60
-       add     bx, ax
-       adc     dx, #0          ! dx-bx = seconds since midnight
-       mov     ax, dx
-       mul     c19663
-       xchg    ax, bx
-       mul     c19663
-       add     dx, bx          ! dx-ax = dx-bx * (0x1800B0 / (2*2*2*2*5))
-       mov     cx, ax          ! (0x1800B0 = ticks per day of BIOS clock)
-       mov     ax, dx
-       xor     dx, dx
-       div     c1080
-       xchg    ax, cx
-       div     c1080           ! cx-ax = dx-ax / (24*60*60 / (2*2*2*2*5))
-       mov     dx, ax          ! cx-dx = ticks since midnight
-       movb    ah, #0x01       ! Set system time
-       int     0x1A
-noclock:
-
-       pop     bp
-       ret                     ! Return to monitor as if nothing much happened
-
-! Transform BCD number in al to a regular value in ax.
-bcd:   movb    ah, al
-       shrb    ah, #4
-       andb    al, #0x0F
-       .data1 0xD5,10 ! aad    ! ax = (al >> 4) * 10 + (al & 0x0F)
-       ret                     ! (BUG: assembler messes up aad & aam!)
-
-! Support function for Minix-386 to make a BIOS int 13 call (disk I/O).
-bios13:
-       mov     bp, sp
-       call    prot2real
-       sti                     ! Enable interrupts
-
-       mov     ax, 8(bp)       ! Load parameters
-       mov     bx, 10(bp)
-       mov     cx, 12(bp)
-       mov     dx, 14(bp)
-       mov     es, 16(bp)
-       int     0x13            ! Make the BIOS call
-       mov     8(bp), ax       ! Save results
-       mov     10(bp), bx
-       mov     12(bp), cx
-       mov     14(bp), dx
-       mov     16(bp), es
-
-       cli                     ! Disable interrupts
-       call    real2prot
-       mov     ax, #DS_SELECTOR ! Kernel data
-       mov     ds, ax
-       .data1  o32
-       retf                    ! Return to the kernel
-
-! Support function for Minix-386 to make an 8086 interrupt call.
-int86:
-       mov     bp, sp
-       call    prot2real
-
-       .data1  o32
-       xor     ax, ax
-       mov     es, ax          ! Vector & BIOS data segments
-       .data1  o32
-   eseg        mov     0x046C, ax      ! Clear BIOS clock tick counter
-
-       sti                     ! Enable interrupts
-
-       movb    al, #0xCD       ! INT instruction
-       movb    ah, 8(bp)       ! Interrupt number?
-       testb   ah, ah
-       jnz     0f              ! Nonzero if INT, otherwise far call
-       push    cs
-       push    #intret+2       ! Far return address
-       .data1  o32
-       push    12(bp)          ! Far driver address
-       mov     ax, #0x90CB     ! RETF; NOP
-0:
- cseg  cmp     ax, intret      ! Needs to be changed?
-       je      0f              ! If not then avoid a huge I-cache stall
-   cseg        mov     intret, ax      ! Patch 'INT n' or 'RETF; NOP' into code
-       jmp     .+2             ! Clear instruction queue
-0:
-       mov     ds, 16(bp)      ! Load parameters
-       mov     es, 18(bp)
-       .data1  o32
-       mov     ax, 20(bp)
-       .data1  o32
-       mov     bx, 24(bp)
-       .data1  o32
-       mov     cx, 28(bp)
-       .data1  o32
-       mov     dx, 32(bp)
-       .data1  o32
-       mov     si, 36(bp)
-       .data1  o32
-       mov     di, 40(bp)
-       .data1  o32
-       mov     bp, 44(bp)
-
-intret:        int     0xFF            ! Do the interrupt or far call
-
-       .data1  o32             ! Save results
-       push    bp
-       .data1  o32
-       pushf
-       mov     bp, sp
-       .data1  o32
-       pop     8+8(bp)         ! eflags
-       mov     8+16(bp), ds
-       mov     8+18(bp), es
-       .data1  o32
-       mov     8+20(bp), ax
-       .data1  o32
-       mov     8+24(bp), bx
-       .data1  o32
-       mov     8+28(bp), cx
-       .data1  o32
-       mov     8+32(bp), dx
-       .data1  o32
-       mov     8+36(bp), si
-       .data1  o32
-       mov     8+40(bp), di
-       .data1  o32
-       pop     8+44(bp)        ! ebp
-
-       cli                     ! Disable interrupts
-
-       xor     ax, ax
-       mov     ds, ax          ! Vector & BIOS data segments
-       .data1  o32
-       mov     cx, 0x046C      ! Collect lost clock ticks in ecx
-
-       mov     ax, ss
-       mov     ds, ax          ! Restore monitor ds
-       call    real2prot
-       mov     ax, #DS_SELECTOR ! Kernel data
-       mov     ds, ax
-       .data1  o32
-       retf                    ! Return to the kernel
-
-! Switch from real to protected mode.
-real2prot:
-       movb    ah, #0x02       ! Code for A20 enable
-       call    gate_A20
-
-       lgdt    p_gdt_desc      ! Global descriptor table
-       .data1  o32
-       mov     ax, pdbr        ! Load page directory base register
-       .data1  0x0F,0x22,0xD8  ! mov   cr3, eax
-       .data1  0x0F,0x20,0xC0  ! mov   eax, cr0
-       .data1  o32
-       xchg    ax, msw         ! Exchange real mode msw for protected mode msw
-       .data1  0x0F,0x22,0xC0  ! mov   cr0, eax
-       jmpf    cs_prot, MCS_SELECTOR ! Set code segment selector
-cs_prot:
-       mov     ax, #SS_SELECTOR ! Set data selectors
-       mov     ds, ax
-       mov     es, ax
-       mov     ss, ax
-       ret
-
-! Switch from protected to real mode.
-prot2real:
-       lidt    p_idt_desc      ! Real mode interrupt vectors
-       .data1  0x0F,0x20,0xD8  ! mov   eax, cr3
-       .data1  o32
-       mov     pdbr, ax        ! Save page directory base register
-       .data1  0x0F,0x20,0xC0  ! mov   eax, cr0
-       .data1  o32
-       xchg    ax, msw         ! Exchange protected mode msw for real mode msw
-       .data1  0x0F,0x22,0xC0  ! mov   cr0, eax
-       jmpf    cs_real, 0xDEAD ! Reload cs register
-cs_real:
-       mov     ax, #0xBEEF
-ds_real:
-       mov     ds, ax          ! Reload data segment registers
-       mov     es, ax
-       mov     ss, ax
-
-       xorb    ah, ah          ! Code for A20 disable
-       !jmp    gate_A20
-
-! Enable (ah = 0x02) or disable (ah = 0x00) the A20 address line.
-gate_A20:
-       cmp     bus, #2         ! PS/2 bus?
-       je      gate_PS_A20
-       call    kb_wait
-       movb    al, #0xD1       ! Tell keyboard that a command is coming
-       outb    0x64
-       call    kb_wait
-       movb    al, #0xDD       ! 0xDD = A20 disable code if ah = 0x00
-       orb     al, ah          ! 0xDF = A20 enable code if ah = 0x02
-       outb    0x60
-       call    kb_wait
-       movb    al, #0xFF       ! Pulse output port
-       outb    0x64
-       call    kb_wait         ! Wait for the A20 line to settle down
-       ret
-kb_wait:
-       inb     0x64
-       testb   al, #0x02       ! Keyboard input buffer full?
-       jnz     kb_wait         ! If so, wait
-       ret
-
-gate_PS_A20:           ! The PS/2 can twiddle A20 using port A
-       inb     0x92            ! Read port A
-       andb    al, #0xFD
-       orb     al, ah          ! Set A20 bit to the required state
-       outb    0x92            ! Write port A
-       jmp     .+2             ! Small delay
-A20ok: inb     0x92            ! Check port A
-       andb    al, #0x02
-       cmpb    al, ah          ! A20 line settled down to the new state?
-       jne     A20ok           ! If not then wait
-       ret
-
-! void int15(bios_env_t *ep)
-!      Do an "INT 15" call, primarily for APM (Power Management).
-.define _int15
-_int15:
-       push    si              ! Save callee-save register si
-       mov     si, sp
-       mov     si, 4(si)       ! ep
-       mov     ax, (si)        ! ep->ax
-       mov     bx, 2(si)       ! ep->bx
-       mov     cx, 4(si)       ! ep->cx
-       int     0x15            ! INT 0x15 BIOS call
-       pushf                   ! Save flags
-       mov     (si), ax        ! ep->ax
-       mov     2(si), bx       ! ep->bx
-       mov     4(si), cx       ! ep->cx
-       pop     6(si)           ! ep->flags
-       pop     si              ! Restore
-       ret
-
-! void scan_keyboard(void)
-!      Read keyboard character. Needs to be done in case one is waiting.
-.define _scan_keyboard
-_scan_keyboard:
-       inb     0x60
-       inb     0x61
-       movb    ah, al
-       orb     al, #0x80
-       outb    0x61
-       movb    al, ah
-       outb    0x61
-       ret
-
-.define        _reset
-_reset:
-       lidt    idt_zero
-       int     0x3
-
-.data
-       .ascii  "(null)\0"      ! Just in case someone follows a null pointer
-       .align  2
-c60:   .data2  60              ! Constants for MUL and DIV
-c1024: .data2  1024
-c1080: .data2  1080
-c19663:        .data2  19663
-idt_zero:
-.data4 0,0
-
-! Global descriptor tables.
-       UNSET   = 0             ! Must be computed
-
-! For "Extended Memory Block Move".
-x_gdt:
-x_null_desc:
-       ! Null descriptor
-       .data2  0x0000, 0x0000
-       .data1  0x00, 0x00, 0x00, 0x00
-x_gdt_desc:
-       ! Descriptor for this descriptor table
-       .data2  6*8-1, UNSET
-       .data1  UNSET, 0x00, 0x00, 0x00
-x_src_desc:
-       ! Source segment descriptor
-       .data2  0xFFFF, UNSET
-       .data1  UNSET, 0x92, 0x00, 0x00
-x_dst_desc:
-       ! Destination segment descriptor
-       .data2  0xFFFF, UNSET
-       .data1  UNSET, 0x92, 0x00, 0x00
-x_bios_desc:
-       ! BIOS segment descriptor (scratch for int 0x15)
-       .data2  UNSET, UNSET
-       .data1  UNSET, UNSET, UNSET, UNSET
-x_ss_desc:
-       ! BIOS stack segment descriptor (scratch for int 0x15)
-       .data2  UNSET, UNSET
-       .data1  UNSET, UNSET, UNSET, UNSET
-
-! Protected mode descriptor table.
-p_gdt:
-p_null_desc:
-       ! Null descriptor
-       .data2  0x0000, 0x0000
-       .data1  0x00, 0x00, 0x00, 0x00
-p_gdt_desc:
-       ! Descriptor for this descriptor table
-       .data2  8*8-1, UNSET
-       .data1  UNSET, 0x00, 0x00, 0x00
-p_idt_desc:
-       ! Real mode interrupt descriptor table descriptor
-       .data2  0x03FF, 0x0000
-       .data1  0x00, 0x00, 0x00, 0x00
-p_ds_desc:
-       ! Kernel data segment descriptor (4 Gb flat)
-       .data2  0xFFFF, UNSET
-       .data1  UNSET, 0x92, 0xCF, 0x00
-p_es_desc:
-       ! Physical memory descriptor (4 Gb flat)
-       .data2  0xFFFF, 0x0000
-       .data1  0x00, 0x92, 0xCF, 0x00
-p_ss_desc:
-       ! Monitor data segment descriptor (64 kb flat)
-       .data2  0xFFFF, UNSET
-       .data1  UNSET, 0x92, 0x00, 0x00
-p_cs_desc:
-       ! Kernel code segment descriptor (4 Gb flat)
-       .data2  0xFFFF, UNSET
-       .data1  UNSET, 0x9A, 0xCF, 0x00
-p_mcs_desc:
-       ! Monitor code segment descriptor (64 kb flat)
-       .data2  0xFFFF, UNSET
-       .data1  UNSET, 0x9A, 0x00, 0x00
-
-
-.bss
-       .comm   old_vid_mode, 2 ! Video mode at startup
-       .comm   cur_vid_mode, 2 ! Current video mode
-       .comm   dev_state, 2    ! Device state: reset (-1), closed (0), open (1)
-       .comm   sectors, 2      ! # sectors of current device
-       .comm   secspcyl, 2     ! (Sectors * heads) of current device
-       .comm   msw, 4          ! Saved machine status word (cr0)
-       .comm   pdbr, 4         ! Saved page directory base register (cr3)
-       .comm   escape, 2       ! Escape typed?
-       .comm   bus, 2          ! Saved return value of _get_bus
-       .comm   unchar, 2       ! Char returned by ungetch(c)
-       .comm   line, 2         ! Serial line I/O port to copy console I/O to.
diff --git a/boot/boot/bootimage.c b/boot/boot/bootimage.c
deleted file mode 100644 (file)
index 92d8235..0000000
+++ /dev/null
@@ -1,1221 +0,0 @@
-/*     bootimage.c - Load an image and start it.       Author: Kees J. Bot
- *                                                             19 Jan 1992
- */
-#define BIOS           1       /* Can only be used under the BIOS. */
-#define nil 0
-#define _POSIX_SOURCE  1
-#define _MINIX         1
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
-#include <string.h>
-#include <errno.h>
-#include <a.out.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <minix/type.h>
-#include <minix/syslib.h>
-#include <minix/tty.h>
-#include <sys/video.h>
-#include <kernel/const.h>
-#include <kernel/type.h>
-#include <machine/partition.h>
-#include "rawfs.h"
-#include "image.h"
-#include "emem.h"
-#include "boot.h"
-
-#include <machine/multiboot.h>
-#include <machine/elf.h>
-
-
-static int block_size = 0;
-static int verboseboot = VERBOSEBOOT_QUIET;
-
-#define DEBUG_PRINT(params, level) do { \
-       if (verboseboot >= (level)) printf params; } while (0)
-#define DEBUGBASIC(params) DEBUG_PRINT(params, VERBOSEBOOT_BASIC)
-#define DEBUGEXTRA(params) DEBUG_PRINT(params, VERBOSEBOOT_EXTRA)
-#define DEBUGMAX(params)   DEBUG_PRINT(params, VERBOSEBOOT_MAX)
-
-extern int serial_line;
-extern u16_t vid_port;         /* Video i/o port. */
-extern u32_t vid_mem_base;     /* Video memory base address. */
-extern u32_t vid_mem_size;     /* Video memory size. */
-extern u32_t mbdev;            /* Device number in multiboot format */
-
-#define click_shift    clck_shft       /* 7 char clash with click_size. */
-
-/* Some kernels have extra features: */
-#define K_I386  0x0001 /* Make the 386 transition before you call me. */
-#define K_CLAIM         0x0002 /* I will acquire my own bss pages, thank you. */
-#define K_CHMEM  0x0004        /* This kernel listens to chmem for its stack size. */
-#define K_HIGH   0x0008        /* Load mm, fs, etc. in extended memory. */
-#define K_HDR   0x0010 /* No need to patch sizes, kernel uses the headers. */
-#define K_RET   0x0020 /* Returns to the monitor on reboot. */
-#define K_INT86         0x0040 /* Requires generic INT support. */
-#define K_MEML  0x0080 /* Pass a list of free memory. */
-#define K_BRET  0x0100 /* New monitor code on shutdown in boot parameters. */
-#define K_KHIGH  0x0200        /* Load kernel in extended memory. */
-#define K_ALL   0x03FF /* All feature bits this monitor supports. */
-
-
-/* Data about the different processes. */
-
-#define PROCESS_MAX    16      /* Must match the space in kernel/mpx.x */
-#define KERNEL_IDX     0       /* The first process is the kernel. */
-#define FS             2       /* The third must be fs. */
-
-struct process {       /* Per-process memory adresses. */
-       u32_t   entry;          /* Entry point. */
-       u32_t   cs;             /* Code segment. */
-       u32_t   ds;             /* Data segment. */
-       u32_t   data;           /* To access the data segment. */
-       u32_t   end;            /* End of this process, size = (end - cs). */
-} process[PROCESS_MAX];
-int n_procs;                   /* Number of processes. */
-
-/* Magic numbers in process' data space. */
-#define MAGIC_OFF      0       /* Offset of magic # in data seg. */
-#define CLICK_OFF      2       /* Offset in kernel text to click_shift. */
-#define FLAGS_OFF      4       /* Offset in kernel text to flags. */
-#define KERNEL_D_MAGIC 0x526F  /* Kernel magic number. */
-
-/* Offsets of sizes to be patched into kernel and fs. */
-#define P_SIZ_OFF      0       /* Process' sizes into kernel data. */
-#define P_INIT_OFF     4       /* Init cs & sizes into fs data. */
-
-/* Where multiboot info struct goes in memory */
-#define MULTIBOOT_INFO_ADDR 0x9500
-
-#define between(a, c, z)       ((unsigned) ((c) - (a)) <= ((z) - (a)))
-
-char *select_image(char *image);
-size_t strspn(const char *string, const char *in);
-char * strpbrk(register const char *string, register const char *brk);
-char * strtok(register char *string, const char *separators);
-char * strdup(const char *s1);
-
-void pretty_image(const char *image)
-/* Pretty print the name of the image to load.  Translate '/' and '_' to
- * space, first letter goes uppercase.  An 'r' before a digit prints as
- * 'revision'.  E.g. 'minix/1.6.16r10' -> 'Minix 1.6.16 revision 10'.
- * The idea is that the part before the 'r' is the official Minix release
- * and after the 'r' you can put version numbers for your own changes.
- */
-{
-       int up= 0, c;
-
-       while ((c= *image++) != 0) {
-               if (c == '/' || c == '_') c= ' ';
-
-               if (c == 'r' && between('0', *image, '9')) {
-                       printf(" revision ");
-                       continue;
-               }
-               if (!up && between('a', c, 'z')) c= c - 'a' + 'A';
-
-               if (between('A', c, 'Z')) up= 1;
-
-               putch(c);
-       }
-}
-
-#define RAW_ALIGN      16
-#define BUFSIZE_ZEROS  128
-
-void raw_clear(u32_t addr, u32_t count)
-/* Clear "count" bytes at absolute address "addr". */
-{
-       static char zerosdata[BUFSIZE_ZEROS + RAW_ALIGN];
-       char *zeros = zerosdata + RAW_ALIGN - (unsigned) &zerosdata % RAW_ALIGN;
-       u32_t dst;
-       u32_t zct;
-
-       zct= BUFSIZE_ZEROS;
-       if (zct > count) zct= count;
-       raw_copy(addr, mon2abs(zeros), zct);
-       count-= zct;
-
-       while (count > 0) {
-               dst= addr + zct;
-               if (zct > count) zct= count;
-               raw_copy(dst, addr, zct);
-               count-= zct;
-               zct*= 2;
-       }
-}
-
-/* Align a to a multiple of n (a power of 2): */
-#define align(a, n)    (((u32_t)(a) + ((u32_t)(n) - 1)) & ~((u32_t)(n) - 1))
-unsigned click_shift;
-unsigned click_size;   /* click_size = Smallest kernel memory object. */
-unsigned k_flags;      /* Not all kernels are created equal. */
-u32_t reboot_code;     /* Obsolete reboot code return pointer. */
-int do_multiboot;
-
-int params2params(char *params, size_t psize)
-/* Repackage the environment settings for the kernel. */
-{
-       size_t i, n;
-       environment *e;
-       char *name, *value;
-       dev_t dev;
-
-       i= 0;
-       for (e= env; e != nil; e= e->next) {
-               name= e->name;
-               value= e->value;
-
-               if (!(e->flags & E_VAR)) continue;
-
-               if (e->flags & E_DEV) {
-                       if ((dev= name2dev(value)) == -1) return 0;
-                       value= ul2a10((u16_t) dev);
-               }
-
-               n= i + strlen(name) + 1 + strlen(value) + 1;
-               if (n < psize) {
-                       strcpy(params + i, name);
-                       strcat(params + i, "=");
-                       strcat(params + i, value);
-               }
-               i= n;
-       }
-
-       if (!(k_flags & K_MEML)) {
-               /* Require old memory size variables. */
-
-               value= ul2a10((mem[0].base + mem[0].size) / 1024);
-               n= i + 7 + 1 + strlen(value) + 1;
-               if (n < psize) {
-                       strcpy(params + i, "memsize=");
-                       strcat(params + i, value);
-               }
-               i= n;
-               value= ul2a10(mem[1].size / 1024);
-               n= i + 7 + 1 + strlen(value) + 1;
-               if (n < psize) {
-                       strcpy(params + i, "emssize=");
-                       strcat(params + i, value);
-               }
-               i= n;
-       }
-
-       if (i >= psize) {
-               printf("Too many boot parameters\n");
-               return 0;
-       }
-       params[i]= 0;   /* End marked with empty string. */
-       return 1;
-}
-
-void patch_sizes(void)
-/* Patch sizes of each process into kernel data space, kernel ds into kernel
- * text space, and sizes of init into data space of fs.  All the patched
- * numbers are based on the kernel click size, not hardware segments.
- */
-{
-       u16_t text_size, data_size;
-       int i;
-       struct process *procp, *initp;
-       u32_t doff;
-
-       if (k_flags & K_HDR) return;    /* Uses the headers. */
-
-       /* Patch text and data sizes of the processes into kernel data space.
-        */
-       doff= process[KERNEL_IDX].data + P_SIZ_OFF;
-
-       for (i= 0; i < n_procs; i++) {
-               procp= &process[i];
-               text_size= (procp->ds - procp->cs) >> click_shift;
-               data_size= (procp->end - procp->ds) >> click_shift;
-
-               /* Two words per process, the text and data size: */
-               put_word(doff, text_size); doff+= 2;
-               put_word(doff, data_size); doff+= 2;
-
-               initp= procp;   /* The last process must be init. */
-       }
-
-       if (k_flags & (K_HIGH|K_MEML)) return;  /* Doesn't need FS patching. */
-
-       /* Patch cs and sizes of init into fs data. */
-       put_word(process[FS].data + P_INIT_OFF+0, initp->cs >> click_shift);
-       put_word(process[FS].data + P_INIT_OFF+2, text_size);
-       put_word(process[FS].data + P_INIT_OFF+4, data_size);
-}
-
-int selected(const char *name)
-/* True iff name has no label or the proper label. */
-{
-       char *colon, *label;
-       int cmp;
-
-       if ((colon= strchr(name, ':')) == nil) return 1;
-       if ((label= b_value("label")) == nil) return 1;
-
-       *colon= 0;
-       cmp= strcmp(label, name);
-       *colon= ':';
-       return cmp == 0;
-}
-
-static u32_t proc_size(const struct image_header *hdr)
-/* Return the size of a process in sectors as found in an image. */
-{
-       u32_t len= hdr->process.a_text;
-
-       if (hdr->process.a_flags & A_PAL) len+= hdr->process.a_hdrlen;
-       if (hdr->process.a_flags & A_SEP) len= align(len, SECTOR_SIZE);
-       len= align(len + hdr->process.a_data, SECTOR_SIZE);
-
-       return len >> SECTOR_SHIFT;
-}
-
-off_t image_off, image_sectors, image_bytes;
-u32_t (*vir2sec)(u32_t vsec);  /* Where is a sector on disk? */
-
-u32_t file_vir2sec(u32_t vsec)
-/* Translate a virtual sector number to an absolute disk sector. */
-{
-       off_t blk;
-
-       if(!block_size) { errno = 0;  return -1; }
-
-       if ((blk= r_vir2abs(vsec / RATIO(block_size))) == -1) {
-               errno= EIO;
-               return -1;
-       }
-       return blk == 0 ? 0 : lowsec + blk * RATIO(block_size) + vsec % RATIO(block_size);
-}
-
-u32_t flat_vir2sec(u32_t vsec)
-/* Simply add an absolute sector offset to vsec. */
-{
-       return lowsec + image_off + vsec;
-}
-
-char *get_sector(u32_t vsec)
-/* Read a sector "vsec" from the image into memory and return its address.
- * Return nil on error.  (This routine tries to read an entire track, so
- * the next request is usually satisfied from the track buffer.)
- */
-{
-       u32_t sec;
-       int r;
-#define SECBUFS 16
-       static char bufdata[SECBUFS * SECTOR_SIZE + RAW_ALIGN];
-       static size_t count;            /* Number of sectors in the buffer. */
-       static u32_t bufsec;            /* First Sector now in the buffer. */
-       char *buf = bufdata + RAW_ALIGN - (unsigned) &bufdata % RAW_ALIGN;
-
-       if (vsec == 0) count= 0;        /* First sector; initialize. */
-
-       if ((sec= (*vir2sec)(vsec)) == -1) return nil;
-
-       if (sec == 0) {
-               /* A hole. */
-               count= 0;
-               memset(buf, 0, SECTOR_SIZE);
-               return buf;
-       }
-
-       /* Can we return a sector from the buffer? */
-       if ((sec - bufsec) < count) {
-               return buf + ((size_t) (sec - bufsec) << SECTOR_SHIFT);
-       }
-
-       /* Not in the buffer. */
-       count= 0;
-       bufsec= sec;
-
-       /* Read a whole track if possible. */
-       while (++count < SECBUFS && !dev_boundary(bufsec + count)) {
-               vsec++;
-               if ((sec= (*vir2sec)(vsec)) == -1) break;
-
-               /* Consecutive? */
-               if (sec != bufsec + count) break;
-       }
-
-       /* Actually read the sectors. */
-       if ((r= readsectors(mon2abs(buf), bufsec, count)) != 0) {
-               readerr(bufsec, r);
-               count= 0;
-               errno= 0;
-               return nil;
-       }
-       return buf;
-}
-
-int get_clickshift(u32_t ksec, struct image_header *hdr)
-/* Get the click shift and special flags from kernel text. */
-{
-       char *textp;
-
-       if ((textp= get_sector(ksec)) == nil) return 0;
-
-       if (hdr->process.a_flags & A_PAL) textp+= hdr->process.a_hdrlen;
-       click_shift= * (u16_t *) (textp + CLICK_OFF);
-       k_flags= * (u16_t *) (textp + FLAGS_OFF);
-
-       if ((k_flags & ~K_ALL) != 0) {
-               printf("%s requires features this monitor doesn't offer\n",
-                       hdr->name);
-               return 0;
-       }
-
-       if (click_shift < HCLICK_SHIFT || click_shift > 16) {
-               printf("%s click size is bad\n", hdr->name);
-               errno= 0;
-               return 0;
-       }
-
-       click_size= 1 << click_shift;
-
-       return 1;
-}
-
-int get_segment(u32_t *vsec, long *size, u32_t *addr, u32_t limit)
-/* Read *size bytes starting at virtual sector *vsec to memory at *addr. */
-{
-       char *buf;
-       size_t cnt, n;
-
-       cnt= 0;
-       while (*size > 0) {
-               if (cnt == 0) {
-                       if ((buf= get_sector((*vsec)++)) == nil) return 0;
-                       cnt= SECTOR_SIZE;
-               }
-               if (*addr + click_size > limit) 
-               {
-                       DEBUGEXTRA(("get_segment: out of memory; "
-                               "addr=0x%lx; limit=0x%lx; size=%lx\n", 
-                               *addr, limit, size));
-                       errno= ENOMEM; 
-                       return 0; 
-               }
-               n= click_size;
-               if (n > cnt) n= cnt;
-               DEBUGMAX(("raw_copy(0x%lx, 0x%lx/0x%x, 0x%lx)... ", 
-                       *addr, mon2abs(buf), buf, n));
-               raw_copy(*addr, mon2abs(buf), n);
-               DEBUGMAX(("done\n"));
-               *addr+= n;
-               *size-= n;
-               buf+= n;
-               cnt-= n;
-       }
-
-       /* Zero extend to a click. */
-       n= align(*addr, click_size) - *addr;
-       DEBUGMAX(("raw_clear(0x%lx, 0x%lx)... ", *addr, n));
-       raw_clear(*addr, n);
-       DEBUGMAX(("done\n"));
-       *addr+= n;
-       *size-= n;
-       return 1;
-}
-
-static void restore_screen(void)
-{
-       struct boot_tty_info boot_tty_info;
-       u32_t info_location;
-#define LINES 25
-#define CHARS 80
-       static u16_t consolescreen[LINES][CHARS];
-
-       /* Try and find out what the main console was displaying
-        * by looking into video memory.
-        */
-
-       info_location = vid_mem_base+vid_mem_size-sizeof(boot_tty_info);
-        raw_copy(mon2abs(&boot_tty_info), info_location,
-                sizeof(boot_tty_info));
-
-        if(boot_tty_info.magic == TTYMAGIC) {
-                if((boot_tty_info.flags & (BTIF_CONSORIGIN|BTIF_CONSCURSOR)) ==
-                       (BTIF_CONSORIGIN|BTIF_CONSCURSOR)) {
-                       int line;
-                       raw_copy(mon2abs(consolescreen), 
-                               vid_mem_base + boot_tty_info.consorigin,
-                               sizeof(consolescreen));
-                       clear_screen();
-                       for(line = 0; line < LINES; line++) {
-                               int ch;
-                               for(ch = 0; ch < CHARS; ch++) {
-                                       u16_t newch = consolescreen[line][ch] & BYTE;
-                                       if(newch < ' ') newch = ' ';
-                                       putch(newch);
-                               }
-                       }
-               }
-        }
-}
-
-int split_module_list(char *modules)
-{
-       int i;
-       char *c, *s;
-
-       for (s= modules, i= 1; (c= strrchr(s, ' ')) != NULL; i++) {
-           *c = '\0';
-       }
-
-       return i;
-}
-
-void exec_mb(char *kernel, char* modules)
-/* Get a Minix image into core, patch it up and execute. */
-{
-       int i;
-       static char hdr[SECTOR_SIZE];
-       char *buf;
-       u32_t vsec, addr, limit, n, totalmem = 0;
-       u16_t kmagic, mode;
-       char *console;
-       char params[SECTOR_SIZE];
-       extern char *sbrk(int);
-       char *verb;
-       u32_t text_vaddr, text_paddr, text_filebytes, text_membytes;
-       u32_t data_vaddr, data_paddr, data_filebytes, data_membytes;
-       u32_t pc;
-       u32_t text_offset, data_offset;
-       i32_t segsize;
-       int r;
-       u32_t cs, ds;
-       char *modstring, *mod;
-       multiboot_info_t *mbinfo;
-       multiboot_module_t *mbmodinfo;
-       u32_t mbinfo_size, mbmodinfo_size;
-       char *memvar;
-       memory *mp;
-       u32_t mod_cmdline_start, kernel_cmdline_start;
-       u32_t modstringlen;
-       int modnr;
-
-       /* The stack is pretty deep here, so check if heap and stack collide. */
-       (void) sbrk(0);
-
-       if ((verb= b_value(VERBOSEBOOTVARNAME)) != nil)
-               verboseboot = a2l(verb);
-
-       printf("\nLoading %s\n", kernel);
-
-       vsec= 0;                        /* Load this sector from kernel next. */
-       addr= mem[0].base;              /* Into this memory block. */
-       limit= mem[0].base + mem[0].size;
-       if (limit > caddr) limit= caddr;
-
-       /* set click size for get_segment */
-       click_size = PAGE_SIZE;
-
-       k_flags = K_KHIGH|K_BRET|K_MEML|K_INT86|K_RET|K_HDR
-           |K_HIGH|K_CHMEM|K_I386;
-
-       /* big kernels must be loaded into extended memory */
-       addr= mem[1].base;
-       limit= mem[1].base + mem[1].size;
-
-       /* Get first sector */
-       DEBUGEXTRA(("get_sector\n"));
-       if ((buf= get_sector(vsec++)) == nil) {
-           DEBUGEXTRA(("get_sector failed\n"));
-           return;
-       }
-       memcpy(hdr, buf, SECTOR_SIZE);
-
-       /* Get ELF header */
-       DEBUGEXTRA(("read_header_elf\n"));
-       r = read_header_elf(hdr, &text_vaddr, &text_paddr,
-                           &text_filebytes, &text_membytes,
-                           &data_vaddr, &data_paddr,
-                           &data_filebytes, &data_membytes,
-                           &pc, &text_offset, &data_offset);
-       if (r < 0) { errno= ENOEXEC; return; }
-
-       /* Read the text segment. */
-       addr = text_paddr;
-       segsize = (i32_t) text_filebytes;
-       vsec = text_offset / SECTOR_SIZE;
-       DEBUGEXTRA(("get_segment(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n",
-                   vsec, segsize, addr, limit));
-       if (!get_segment(&vsec, &segsize, &addr, limit)) return;
-       DEBUGEXTRA(("get_segment done vsec=0x%lx size=0x%lx "
-                   "addr=0x%lx\n",
-                   vsec, segsize, addr));
-
-       /* Read the data segment. */
-       addr = data_paddr;
-       segsize = (i32_t) data_filebytes;
-       vsec = data_offset / SECTOR_SIZE;
-
-       DEBUGEXTRA(("get_segment(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n",
-                   vsec, segsize, addr, limit));
-       if (!get_segment(&vsec, &segsize, &addr, limit)) return;
-       DEBUGEXTRA(("get_segment done vsec=0x%lx size=0x%lx "
-                   "addr=0x%lx\n",
-                   vsec, segsize, addr));
-
-       n = data_membytes - align(data_filebytes, click_size);
-
-       /* Zero out bss. */
-       DEBUGEXTRA(("\nraw_clear(0x%lx, 0x%lx); limit=0x%lx... ", addr, n, limit));
-       if (addr + n > limit) { errno= ENOMEM; return; }
-       raw_clear(addr, n);
-       DEBUGEXTRA(("done\n"));
-       addr+= n;
-
-       /* Check the kernel magic number. */
-       raw_copy(mon2abs(&kmagic),
-                data_paddr + MAGIC_OFF, sizeof(kmagic));
-       if (kmagic != KERNEL_D_MAGIC) {
-               printf("Kernel magic number is incorrect (0x%x@0x%lx)\n",
-                       kmagic, data_paddr + MAGIC_OFF);
-               errno= 0;
-               return;
-       }
-
-       /* Translate the boot parameters to what Minix likes best. */
-       DEBUGEXTRA(("params2params(0x%x, 0x%x)... ", params, sizeof(params)));
-       if (!params2params(params, sizeof(params))) { errno= 0; return; }
-       DEBUGEXTRA(("done\n"));
-
-       /* Create multiboot info struct */
-       mbinfo = malloc(sizeof(multiboot_info_t));
-       if (mbinfo == nil) { errno= ENOMEM; return; }
-       memset(mbinfo, 0, sizeof(multiboot_info_t));
-
-       /* Module info structs start where kernel ends */
-       mbinfo->mods_addr = addr;
-
-       modstring = strdup(modules);
-       if (modstring == nil) {errno = ENOMEM; return; }
-       modstringlen = strlen(modules);
-       mbinfo->mods_count = split_module_list(modules);
-
-       mbmodinfo_size = sizeof(multiboot_module_t) * mbinfo->mods_count;
-       mbmodinfo = malloc(mbmodinfo_size);
-       if (mbmodinfo == nil) { errno= ENOMEM; return; }
-       addr+= mbmodinfo_size;
-       addr= align(addr, click_size);
-
-       mod_cmdline_start = mbinfo->mods_addr + sizeof(multiboot_module_t) *
-           mbinfo->mods_count;
-
-       raw_copy(mod_cmdline_start, mon2abs(modules),
-                modstringlen+1);
-
-       mbmodinfo[0].cmdline = mod_cmdline_start;
-       modnr = 1;
-       for (i= 0; i < modstringlen; ++i) {
-           if (modules[i] == '\0') {
-               mbmodinfo[modnr].cmdline = mod_cmdline_start + i + 1;
-               ++modnr;
-           }
-       }
-
-       kernel_cmdline_start = mod_cmdline_start + modstringlen + 1;
-       mbinfo->cmdline = kernel_cmdline_start;
-       raw_copy(kernel_cmdline_start, mon2abs(kernel),
-                strlen(kernel)+1);
-
-       mbinfo->flags = MULTIBOOT_INFO_MODS|MULTIBOOT_INFO_CMDLINE|
-           MULTIBOOT_INFO_BOOTDEV|MULTIBOOT_INFO_MEMORY;
-
-       mbinfo->boot_device = mbdev;
-       mbinfo->mem_lower = mem[0].size/1024;
-       mbinfo->mem_upper = mem[1].size/1024;
-
-       for (i = 0, mod = strtok(modstring, " "); mod != nil;
-            mod = strtok(nil, " "), i++) {
-
-               mod = select_image(mod);
-               if (mod == nil) {errno = 0; return; }
-
-               mbmodinfo[i].mod_start = addr;
-               mbmodinfo[i].mod_end = addr + image_bytes;
-               mbmodinfo[i].pad = 0;
-
-               segsize= image_bytes;
-               vsec= 0;
-               DEBUGEXTRA(("get_segment(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n",
-                      vsec, segsize, addr, limit));
-               if (!get_segment(&vsec, &segsize, &addr, limit)) return;
-               DEBUGEXTRA(("get_segment done vsec=0x%lx size=0x%lx "
-                      "addr=0x%lx\n",
-                      vsec, segsize, addr));
-               addr+= segsize;
-               addr= align(addr, click_size);
-       }
-       free(modstring);
-
-       DEBUGEXTRA(("modinfo raw_copy: dst 0x%lx src 0x%lx sz 0x%lx\n",
-           mbinfo->mods_addr, mon2abs(mbmodinfo),
-           mbmodinfo_size));
-       raw_copy(mbinfo->mods_addr, mon2abs(mbmodinfo),
-           mbmodinfo_size);
-       free(mbmodinfo);
-
-       raw_copy(MULTIBOOT_INFO_ADDR, mon2abs(mbinfo),
-                sizeof(multiboot_info_t));
-       free(mbinfo);
-
-       /* Run the trailer function just before starting Minix. */
-       DEBUGEXTRA(("run_trailer()... "));
-       if (!run_trailer()) { errno= 0; return; }
-       DEBUGEXTRA(("done\n"));
-
-       /* Set the video to the required mode. */
-       if ((console= b_value("console")) == nil || (mode= a2x(console)) == 0) {
-               mode= strcmp(b_value("chrome"), "color") == 0 ? COLOR_MODE :
-                                                               MONO_MODE;
-       }
-       DEBUGEXTRA(("set_mode(%d)... ", mode));
-       set_mode(mode);
-       DEBUGEXTRA(("done\n"));
-
-       /* Close the disk. */
-       DEBUGEXTRA(("dev_close()... "));
-       (void) dev_close();
-       DEBUGEXTRA(("done\n"));
-
-       /* Minix. */
-       cs = ds = text_paddr;
-       DEBUGEXTRA(("minix(0x%lx, 0x%lx, 0x%lx, 0x%x, 0x%x, 0x%lx)\n",
-               pc, cs, ds, params, sizeof(params), 0));
-       minix(pc, cs, ds, params, sizeof(params), 0);
-
-       if (!(k_flags & K_BRET)) {
-               extern u32_t reboot_code;
-               raw_copy(mon2abs(params), reboot_code, sizeof(params));
-       }
-       parse_code(params);
-
-       /* Return from Minix.  Things may have changed, so assume nothing. */
-       fsok= -1;
-       errno= 0;
-
-       /* Read leftover character, if any. */
-       scan_keyboard();
-
-       /* Restore screen contents. */
-       restore_screen();
-}
-
-void exec_image(char *image)
-/* Get a Minix image into core, patch it up and execute. */
-{
-       int i;
-       struct image_header hdr;
-       char *buf;
-       u32_t vsec, addr, limit, aout, n, totalmem = 0;
-       struct process *procp;          /* Process under construction. */
-       long a_text, a_data, a_bss, a_stack;
-       int banner= 0;
-       long processor= a2l(b_value("processor"));
-       u16_t kmagic, mode;
-       char *console;
-       char params[SECTOR_SIZE];
-       extern char *sbrk(int);
-       char *verb;
-
-       /* The stack is pretty deep here, so check if heap and stack collide. */
-       (void) sbrk(0);
-
-       if ((verb= b_value(VERBOSEBOOTVARNAME)) != nil)
-               verboseboot = a2l(verb);
-
-       printf("\nLoading ");
-       pretty_image(image);
-       printf(".\n");
-
-       vsec= 0;                        /* Load this sector from image next. */
-       addr= mem[0].base;              /* Into this memory block. */
-       limit= mem[0].base + mem[0].size;
-       if (limit > caddr) limit= caddr;
-
-       /* Allocate and clear the area where the headers will be placed. */
-       aout = (limit -= PROCESS_MAX * A_MINHDR);
-
-       /* Clear the area where the headers will be placed. */
-       raw_clear(aout, PROCESS_MAX * A_MINHDR);
-
-       /* Read the many different processes: */
-       for (i= 0; vsec < image_sectors; i++) {
-               u32_t startaddr;
-               startaddr = addr;
-               if (i == PROCESS_MAX) {
-                       printf("There are more then %d programs in %s\n",
-                               PROCESS_MAX, image);
-                       errno= 0;
-                       return;
-               }
-               procp= &process[i];
-
-               /* Read header. */
-               DEBUGEXTRA(("Reading header... "));
-               for (;;) {
-                       if ((buf= get_sector(vsec++)) == nil) return;
-
-                       memcpy(&hdr, buf, sizeof(hdr));
-
-                       if (BADMAG(hdr.process)) { errno= ENOEXEC; return; }
-
-                       /* Check the optional label on the process. */
-                       if (selected(hdr.name)) break;
-
-                       /* Bad label, skip this process. */
-                       vsec+= proc_size(&hdr);
-               }
-               DEBUGEXTRA(("done\n"));
-
-               /* Sanity check: an 8086 can't run a 386 kernel. */
-               if (hdr.process.a_cpu == A_I80386 && processor < 386) {
-                       printf("You can't run a 386 kernel on this 80%ld\n",
-                               processor);
-                       errno= 0;
-                       return;
-               }
-
-               /* Get the click shift from the kernel text segment. */
-               if (i == KERNEL_IDX) {
-                       if (!get_clickshift(vsec, &hdr)) return;
-                       addr= align(addr, click_size);
-
-                       /* big kernels must be loaded into extended memory */
-                       if (k_flags & K_KHIGH) {
-                               addr= mem[1].base;
-                               limit= mem[1].base + mem[1].size;
-                       }
-               }
-
-               /* Save a copy of the header for the kernel, with a_syms
-                * misused as the address where the process is loaded at.
-                */
-               DEBUGEXTRA(("raw_copy(0x%lx, 0x%lx, 0x%x)... ", 
-                       aout + i * A_MINHDR, mon2abs(&hdr.process), A_MINHDR));
-               hdr.process.a_syms= addr;
-               raw_copy(aout + i * A_MINHDR, mon2abs(&hdr.process), A_MINHDR);
-               DEBUGEXTRA(("done\n"));
-
-               if (!banner) {
-                       DEBUGBASIC(("     cs       ds     text     data      bss"));
-                       if (k_flags & K_CHMEM) DEBUGBASIC(("    stack"));
-                       DEBUGBASIC(("\n"));
-                       banner= 1;
-               }
-
-               /* Segment sizes. */
-               DEBUGEXTRA(("a_text=0x%lx; a_data=0x%lx; a_bss=0x%lx; a_flags=0x%x)\n",
-                       hdr.process.a_text, hdr.process.a_data, 
-                       hdr.process.a_bss, hdr.process.a_flags));
-
-               a_text= hdr.process.a_text;
-               a_data= hdr.process.a_data;
-               a_bss= hdr.process.a_bss;
-               if (k_flags & K_CHMEM) {
-                       a_stack= hdr.process.a_total - a_data - a_bss;
-                       if (!(hdr.process.a_flags & A_SEP)) a_stack-= a_text;
-               } else {
-                       a_stack= 0;
-               }
-
-               /* Collect info about the process to be. */
-               procp->cs= addr;
-
-               /* Process may be page aligned so that the text segment contains
-                * the header, or have an unmapped zero page against vaxisms.
-                */
-               procp->entry= hdr.process.a_entry;
-               if (hdr.process.a_flags & A_PAL) a_text+= hdr.process.a_hdrlen;
-               if (hdr.process.a_flags & A_UZP) procp->cs-= click_size;
-
-               /* Separate I&D: two segments.  Common I&D: only one. */
-               if (hdr.process.a_flags & A_SEP) {
-                       /* Read the text segment. */
-                       DEBUGEXTRA(("get_segment(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n",
-                               vsec, a_text, addr, limit));
-                       if (!get_segment(&vsec, &a_text, &addr, limit)) return;
-                       DEBUGEXTRA(("get_segment done vsec=0x%lx a_text=0x%lx "
-                               "addr=0x%lx\n", 
-                               vsec, a_text, addr));
-
-                       /* The data segment follows. */
-                       procp->ds= addr;
-                       if (hdr.process.a_flags & A_UZP) procp->ds-= click_size;
-                       procp->data= addr;
-               } else {
-                       /* Add text to data to form one segment. */
-                       procp->data= addr + a_text;
-                       procp->ds= procp->cs;
-                       a_data+= a_text;
-               }
-
-               /* Read the data segment. */
-               DEBUGEXTRA(("get_segment(0x%lx, 0x%lx, 0x%lx, 0x%lx)\n", 
-                       vsec, a_data, addr, limit));
-               if (!get_segment(&vsec, &a_data, &addr, limit)) return;
-               DEBUGEXTRA(("get_segment done vsec=0x%lx a_data=0x%lx "
-                       "addr=0x%lx\n", 
-                       vsec, a_data, addr));
-
-               /* Make space for bss and stack unless... */
-               if (i != KERNEL_IDX && (k_flags & K_CLAIM)) a_bss= a_stack= 0;
-
-               DEBUGBASIC(("%07lx  %07lx %8ld %8ld %8ld",
-                       procp->cs, procp->ds, hdr.process.a_text,
-                       hdr.process.a_data, hdr.process.a_bss));
-               if (k_flags & K_CHMEM) DEBUGBASIC((" %8ld", a_stack));
-
-               /* Note that a_data may be negative now, but we can look at it
-                * as -a_data bss bytes.
-                */
-
-               /* Compute the number of bss clicks left. */
-               a_bss+= a_data;
-               n= align(a_bss, click_size);
-               a_bss-= n;
-
-               /* Zero out bss. */
-               DEBUGEXTRA(("\nraw_clear(0x%lx, 0x%lx); limit=0x%lx... ", addr, n, limit));
-               if (addr + n > limit) { errno= ENOMEM; return; }
-               raw_clear(addr, n);
-               DEBUGEXTRA(("done\n"));
-               addr+= n;
-
-               /* And the number of stack clicks. */
-               a_stack+= a_bss;
-               n= align(a_stack, click_size);
-               a_stack-= n;
-
-               /* Add space for the stack. */
-               addr+= n;
-
-               /* Process endpoint. */
-               procp->end= addr;
-
-               if (verboseboot >= VERBOSEBOOT_BASIC)
-                       printf("  %s\n", hdr.name);
-               else {
-                       u32_t mem;
-                       mem = addr-startaddr;
-                       printf("%s ", hdr.name);
-                       totalmem += mem;
-               }
-
-               if (i == 0 && (k_flags & (K_HIGH | K_KHIGH)) == K_HIGH) {
-                       /* Load the rest in extended memory. */
-                       addr= mem[1].base;
-                       limit= mem[1].base + mem[1].size;
-               }
-       }
-
-       if (verboseboot < VERBOSEBOOT_BASIC)
-               printf("(%luk)\n", totalmem/1024);
-
-       if ((n_procs= i) == 0) {
-               printf("There are no programs in %s\n", image);
-               errno= 0;
-               return;
-       }
-
-       /* Check the kernel magic number. */
-       raw_copy(mon2abs(&kmagic), 
-               process[KERNEL_IDX].data + MAGIC_OFF, sizeof(kmagic));
-       if (kmagic != KERNEL_D_MAGIC) {
-               printf("Kernel magic number is incorrect (0x%x@0x%lx)\n", 
-                       kmagic, process[KERNEL_IDX].data + MAGIC_OFF);
-               errno= 0;
-               return;
-       }
-
-       /* Patch sizes, etc. into kernel data. */
-       DEBUGEXTRA(("patch_sizes()... "));
-       patch_sizes();
-       DEBUGEXTRA(("done\n"));
-
-#if !DOS
-       if (!(k_flags & K_MEML)) {
-               /* Copy the a.out headers to the old place. */
-               raw_copy(HEADERPOS, aout, PROCESS_MAX * A_MINHDR);
-       }
-#endif
-
-       /* Run the trailer function just before starting Minix. */
-       DEBUGEXTRA(("run_trailer()... "));
-       if (!run_trailer()) { errno= 0; return; }
-       DEBUGEXTRA(("done\n"));
-
-       /* Translate the boot parameters to what Minix likes best. */
-       DEBUGEXTRA(("params2params(0x%x, 0x%x)... ", params, sizeof(params)));
-       if (!params2params(params, sizeof(params))) { errno= 0; return; }
-       DEBUGEXTRA(("done\n"));
-
-       /* Set the video to the required mode. */
-       if ((console= b_value("console")) == nil || (mode= a2x(console)) == 0) {
-               mode= strcmp(b_value("chrome"), "color") == 0 ? COLOR_MODE :
-                                                               MONO_MODE;
-       }
-       DEBUGEXTRA(("set_mode(%d)... ", mode));
-       set_mode(mode);
-       DEBUGEXTRA(("done\n"));
-
-       /* Close the disk. */
-       DEBUGEXTRA(("dev_close()... "));
-       (void) dev_close();
-       DEBUGEXTRA(("done\n"));
-
-       /* Minix. */
-       DEBUGEXTRA(("minix(0x%lx, 0x%lx, 0x%lx, 0x%x, 0x%x, 0x%lx)\n", 
-               process[KERNEL_IDX].entry, process[KERNEL_IDX].cs,
-               process[KERNEL_IDX].ds, params, sizeof(params), aout));
-       minix(process[KERNEL_IDX].entry, process[KERNEL_IDX].cs,
-                       process[KERNEL_IDX].ds, params, sizeof(params), aout);
-
-       if (!(k_flags & K_BRET)) {
-               extern u32_t reboot_code;
-               raw_copy(mon2abs(params), reboot_code, sizeof(params));
-       }
-       parse_code(params);
-
-       /* Return from Minix.  Things may have changed, so assume nothing. */
-       fsok= -1;
-       errno= 0;
-
-       /* Read leftover character, if any. */
-       scan_keyboard();
-
-       /* Restore screen contents. */
-       restore_screen();
-}
-
-
-
-ino_t latest_version(char *version, struct stat *stp)
-/* Recursively read the current directory, selecting the newest image on
- * the way up.  (One can't use r_stat while reading a directory.)
- */
-{
-       char name[MFS_DIRSIZ + 1];
-       ino_t ino, newest;
-       time_t mtime;
-
-       if ((ino= r_readdir(name)) == 0) { stp->st_mtime= 0; return 0; }
-
-       newest= latest_version(version, stp);
-       mtime= stp->st_mtime;
-       r_stat(ino, stp);
-
-       if (S_ISREG(stp->st_mode) && stp->st_mtime > mtime) {
-               newest= ino;
-               strcpy(version, name);
-       } else {
-               stp->st_mtime= mtime;
-       }
-       return newest;
-}
-
-char *select_image(char *image)
-/* Look image up on the filesystem, if it is a file then we're done, but
- * if its a directory then we want the newest file in that directory.  If
- * it doesn't exist at all, then see if it is 'number:number' and get the
- * image from that absolute offset off the disk.
- */
-{
-       ino_t image_ino;
-       struct stat st;
-
-       image= strcpy(malloc((strlen(image) + 1 + MFS_DIRSIZ + 1)
-                                                * sizeof(char)), image);
-
-       fsok= r_super(&block_size) != 0;
-       if (!fsok || (image_ino= r_lookup(ROOT_INO, image)) == 0) {
-               char *size;
-
-               if (numprefix(image, &size) && *size++ == ':'
-                                               && numeric(size)) {
-                       vir2sec= flat_vir2sec;
-                       image_off= a2l(image);
-                       image_sectors= a2l(size);
-                       strcpy(image, "Minix");
-                       return image;
-               }
-               if (!fsok)
-                       printf("No image selected\n");
-               else
-                       printf("Can't load %s: %s\n", image, unix_err(errno));
-               goto bail_out;
-       }
-
-       r_stat(image_ino, &st);
-       image_bytes = st.st_size;
-
-       if (!S_ISREG(st.st_mode)) {
-               char *version= image + strlen(image);
-               char dots[MFS_DIRSIZ + 1];
-
-               if (!S_ISDIR(st.st_mode)) {
-                       printf("%s: %s\n", image, unix_err(ENOTDIR));
-                       goto bail_out;
-               }
-               (void) r_readdir(dots);
-               (void) r_readdir(dots); /* "." & ".." */
-               *version++= '/';
-               *version= 0;
-               if ((image_ino= latest_version(version, &st)) == 0) {
-                       printf("There are no images in %s\n", image);
-                       goto bail_out;
-               }
-               r_stat(image_ino, &st);
-       }
-       vir2sec= file_vir2sec;
-       image_sectors= (st.st_size + SECTOR_SIZE - 1) >> SECTOR_SHIFT;
-       return image;
-bail_out:
-       free(image);
-       return nil;
-}
-
-void bootminix(void)
-/* Load Minix and run it.  (Given the size of this program it is surprising
- * that it ever gets to that.)
- */
-{
-       char *image;
-       char *mb;
-       char *kernel;
-       /* FIXME: modules should come from environment */
-       char modules[] = "boot/ds boot/rs boot/pm boot/sched boot/vfs boot/memory boot/log boot/tty boot/mfs boot/vm boot/pfs boot/init";
-
-       if ((mb = b_value("mb")) != nil) {
-               do_multiboot = a2l(mb);
-               kernel = b_value("kernel");
-               if (kernel == nil) {
-                       printf("kernel not set\n");
-                       return;
-               }
-       }
-
-       if (do_multiboot) {
-               if ((kernel= select_image(b_value("kernel"))) == nil) return;
-       } else {
-               if ((image= select_image(b_value("image"))) == nil) return;
-       }
-
-       if(serial_line >= 0) {
-               char linename[2];
-               linename[0] = serial_line + '0';
-               linename[1] = '\0';
-               b_setvar(E_VAR, SERVARNAME, linename);
-       }
-
-       if (do_multiboot)
-               exec_mb(kernel, modules);
-       else
-               exec_image(image);
-
-       switch (errno) {
-       case ENOEXEC:
-               printf("%s contains a bad program header\n",
-                          do_multiboot ? kernel : image);
-               break;
-       case ENOMEM:
-               printf("Not enough memory to load %s\n",
-                          do_multiboot ? kernel : image);
-               break;
-       case EIO:
-               printf("Unexpected EOF on %s\n",
-                          do_multiboot ? kernel : image);
-       case 0:
-               /* No error or error already reported. */;
-       }
-
-       if (do_multiboot)
-               free(kernel);
-       else
-               free(image);
-
-       if(serial_line >= 0) 
-               b_unset(SERVARNAME);
-}
-
-size_t
-strspn(const char *string, const char *in)
-{
-       register const char *s1, *s2;
-
-       for (s1 = string; *s1; s1++) {
-               for (s2 = in; *s2 && *s2 != *s1; s2++)
-                       /* EMPTY */ ;
-               if (*s2 == '\0')
-                       break;
-       }
-       return s1 - string;
-}
-
-char *
-strpbrk(register const char *string, register const char *brk)
-{
-       register const char *s1;
-
-       while (*string) {
-               for (s1 = brk; *s1 && *s1 != *string; s1++)
-                       /* EMPTY */ ;
-               if (*s1)
-                       return (char *)string;
-               string++;
-       }
-       return (char *)NULL;
-}
-
-char *
-strtok(register char *string, const char *separators)
-{
-       register char *s1, *s2;
-       static char *savestring = NULL;
-
-       if (string == NULL) {
-               string = savestring;
-               if (string == NULL) return (char *)NULL;
-       }
-
-       s1 = string + strspn(string, separators);
-       if (*s1 == '\0') {
-               savestring = NULL;
-               return (char *)NULL;
-       }
-
-       s2 = strpbrk(s1, separators);
-       if (s2 != NULL)
-               *s2++ = '\0';
-       savestring = s2;
-       return s1;
-}
-
-char *
-strdup(const char *s1)
-{
-       size_t len;
-       char *s2;
-
-       len= strlen(s1)+1;
-
-       s2= malloc(len);
-       if (s2 == NULL)
-               return NULL;
-       strcpy(s2, s1);
-
-       return s2;
-}
-
-/*
- * $PchId: bootimage.c,v 1.10 2002/02/27 19:39:09 philip Exp $
- */
diff --git a/boot/boot/emem.h b/boot/boot/emem.h
deleted file mode 100644 (file)
index 3f863b6..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-
-#define EMEM_ENTRIES   16
-#define EMEM_SIZE      24      /* size in bytes of e820_memory struct */
-#define MEM_ENTRIES    3
-
-#ifndef __ASSEMBLY__
-
-typedef struct {               /* One chunk of free memory. */
-       u32_t   base;           /* Start byte. */
-       u32_t   size;           /* Number of bytes. */
-} memory;
-
-EXTERN memory mem[MEM_ENTRIES];                /* List of available memory. */
-
-typedef struct {               /* One chunk of free memory. */
-       u32_t   base_lo;        /* Start byte. */
-       u32_t   base_hi;
-       u32_t   size_lo;        /* Number of bytes. */
-       u32_t   size_hi;        /* Number of bytes. */
-       u32_t   type;
-       u32_t   acpi_attrs;
-} e820_memory;
-
-EXTERN e820_memory emem[EMEM_ENTRIES]; /* List of available memory. */
-EXTERN int emem_entries;
-#endif
diff --git a/boot/bootblock/Makefile b/boot/bootblock/Makefile
deleted file mode 100644 (file)
index 401a144..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# bootblock: secondary boot code, still 16-bit mode
-
-.include <bsd.own.mk>
-
-# XXX: Can only be built with ACK currently
-.include "${MINIXSRCDIR}/boot/minix.ack16.mk"
-AFLAGS+=       -Was-ncc
-STRIPFLAG=     -s
-
-PROG=  bootblock
-
-SRCS=          bootblock.s
-
-BINDIR=                /usr/mdec
-MAN=
-
-LIBC=  # defined, to silence bsd.*.mk
-
-.include <bsd.prog.mk>
diff --git a/boot/bootblock/bootblock.s b/boot/bootblock/bootblock.s
deleted file mode 100644 (file)
index 1c2b9ed..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-#
-!      Bootblock 1.5 - Minix boot block.               Author: Kees J. Bot
-!                                                              21 Dec 1991
-!
-! When the PC is powered on, it will try to read the first sector of floppy
-! disk 0 at address 0x7C00.  If this fails due to the absence of flexible
-! magnetic media, it will read the master boot record from the first sector
-! of the hard disk.  This sector not only contains executable code, but also
-! the partition table of the hard disk.  When executed, it will select the
-! active partition and load the first sector of that at address 0x7C00.
-! This file contains the code that is eventually read from either the floppy
-! disk, or the hard disk partition.  It is just smart enough to load /boot
-! from the boot device into memory at address 0x10000 and execute that.  The
-! disk addresses for /boot are patched into this code by installboot as 24-bit
-! sector numbers and 8-bit sector counts above enddata upwards.  /boot is in
-! turn smart enough to load the different parts of the Minix kernel into
-! memory and execute them to finally get Minix started.
-!
-
-       LOADOFF    =    0x7C00  ! 0x0000:LOADOFF is where this code is loaded
-       BOOTSEG    =    0x1000  ! Secondary boot code segment.
-#ifdef CDBOOT
-       BOOTOFF    =    0x0050  ! Offset into /boot above header
-#else
-       BOOTOFF    =    0x0030  ! Offset into /boot above header
-#endif
-       BUFFER     =    0x0600  ! First free memory
-#ifndef CDBOOT                 /* just constants, but make no sense for CDs */
-       LOWSEC     =         8  ! Offset of logical first sector in partition
-                               ! table
-
-       ! Variables addressed using bp register
-       lowsec     =         2  ! Offset of boot partition within drive
-       secpcyl    =         6  ! Sectors per cylinder = heads * sectors
-#endif
-       device     =         0  ! The boot device
-
-.text
-
-! Start boot procedure.
-
-boot:
-       xor     ax, ax          ! ax = 0x0000, the vector segment
-       mov     ds, ax
-       cli                     ! Ignore interrupts while setting stack
-       mov     ss, ax          ! ss = ds = vector segment
-       mov     sp, #LOADOFF    ! Usual place for a bootstrap stack
-       sti
-
-       push    ax
-       push    ax              ! Push a zero lowsec(bp)
-
-       push    dx              ! Boot device in dl will be device(bp)
-       mov     bp, sp          ! Using var(bp) is one byte cheaper then var.
-
-       push    es
-       push    si              ! es:si = partition table entry if hard disk
-
-       mov     di, #LOADOFF+sectors    ! char *di = sectors;
-
-#ifndef CDBOOT
-       testb   dl, dl          ! Winchester disks if dl >= 0x80
-       jge     floppy
-#endif
-
-winchester:
-
-#ifndef CDBOOT
-! Get the offset of the first sector of the boot partition from the partition
-! table.  The table is found at es:si, the lowsec parameter at offset LOWSEC.
-
-       eseg
-       les     ax, LOWSEC(si)    ! es:ax = LOWSEC+2(si):LOWSEC(si)
-       mov     lowsec+0(bp), ax  ! Low 16 bits of partitions first sector
-       mov     lowsec+2(bp), es  ! High 16 bits of partitions first sector
-
-! Get the drive parameters, the number of sectors is bluntly written into the
-! floppy disk sectors/track array.
-
-       movb    ah, #0x08       ! Code for drive parameters
-       int     0x13            ! dl still contains drive
-       andb    cl, #0x3F       ! cl = max sector number (1-origin)
-       movb    (di), cl        ! Number of sectors per track
-       incb    dh              ! dh = 1 + max head number (0-origin)
-#endif
-       jmp     loadboot
-
-#ifndef CDBOOT
-! Floppy:
-! Execute three read tests to determine the drive type.  Test for each floppy
-! type by reading the last sector on the first track.  If it fails, try a type
-! that has less sectors.  Therefore we start with 1.44M (18 sectors) then 1.2M
-! (15 sectors) ending with 720K/360K (both 9 sectors).
-
-next:  inc     di              ! Next number of sectors per track
-
-floppy:        xorb    ah, ah          ! Reset drive
-       int     0x13
-
-       movb    cl, (di)        ! cl = number of last sector on track
-
-       cmpb    cl, #9          ! No need to do the last 720K/360K test
-       je      success
-
-! Try to read the last sector on track 0
-
-       mov     es, lowsec(bp)  ! es = vector segment (lowsec = 0)
-       mov     bx, #BUFFER     ! es:bx buffer = 0x0000:0x0600
-       mov     ax, #0x0201     ! Read sector, #sectors = 1
-       xorb    ch, ch          ! Track 0, last sector
-       xorb    dh, dh          ! Drive dl, head 0
-       int     0x13
-       jc      next            ! Error, try the next floppy type
-
-success:movb   dh, #2          ! Load number of heads for multiply
-#endif
-
-loadboot:
-! Load /boot from the boot device
-
-#ifndef CDBOOT
-       movb    al, (di)        ! al = (di) = sectors per track
-       mulb    dh              ! dh = heads, ax = heads * sectors
-       mov     secpcyl(bp), ax ! Sectors per cylinder = heads * sectors
-#endif
-
-       mov     ax, #BOOTSEG    ! Segment to load /boot into
-       mov     es, ax
-       xor     bx, bx          ! Load first sector at es:bx = BOOTSEG:0x0000
-       mov     si, #LOADOFF+addresses  ! Start of the boot code addresses
-load:
-       mov     ax, 1(si)       ! Get next sector number: low 16 bits
-       movb    dl, 3(si)       ! Bits 16-23 for your up to 8GB partition
-       xorb    dh, dh          ! dx:ax = sector within partition
-#ifndef CDBOOT
-       add     ax, lowsec+0(bp)
-       adc     dx, lowsec+2(bp)! dx:ax = sector within drive
-       cmp     dx, #[1024*255*63-255]>>16  ! Near 8G limit?
-       jae     bigdisk
-       div     secpcyl(bp)     ! ax = cylinder, dx = sector within cylinder
-       xchg    ax, dx          ! ax = sector within cylinder, dx = cylinder
-       movb    ch, dl          ! ch = low 8 bits of cylinder
-       divb    (di)            ! al = head, ah = sector (0-origin)
-       xorb    dl, dl          ! About to shift bits 8-9 of cylinder into dl
-       shr     dx, #1
-       shr     dx, #1          ! dl[6..7] = high cylinder
-       orb     dl, ah          ! dl[0..5] = sector (0-origin)
-       movb    cl, dl          ! cl[0..5] = sector, cl[6..7] = high cyl
-       incb    cl              ! cl[0..5] = sector (1-origin)
-       movb    dh, al          ! dh = al = head
-       movb    dl, device(bp)  ! dl = device to read
-       movb    al, (di)        ! Sectors per track - Sector number (0-origin)
-       subb    al, ah          ! = Sectors left on this track
-       cmpb    al, (si)        ! Compare with # sectors to read
-       jbe     read            ! Cant read past the end of a cylinder?
-       movb    al, (si)        ! (si) < sectors left on this track
-read:  push    ax              ! Save al = sectors to read
-       movb    ah, #0x02       ! Code for disk read (all registers in use now!)
-       int     0x13            ! Call the BIOS for a read
-       pop     cx              ! Restore al in cl
-       jmp     rdeval
-#endif
-bigdisk:
-       movb    cl, (si)        ! Number of sectors to read
-       push    si              ! Save si
-       mov     si, #LOADOFF+ext_rw ! si = extended read/write parameter packet
-       movb    2(si), cl       ! Fill in # blocks to transfer
-       mov     4(si), bx       ! Buffer address
-       mov     8(si), ax       ! Starting block number = dx:ax
-       mov     10(si), dx
-       movb    dl, device(bp)  ! dl = device to read
-       movb    ah, #0x42       ! Extended read
-       int     0x13
-       pop     si              ! Restore si to point to the addresses array
-       !jmp    rdeval
-rdeval:
-       jc      error           ! Jump on disk read error
-       movb    al, cl          ! Restore al = sectors read
-       addb    bh, al          ! bx += 2 * al * 256 (add bytes read)
-       addb    bh, al          ! es:bx = where next sector must be read
-#ifdef CDBOOT
-       addb    bh, al          ! For CDs, a sector is 2048 bytes, so
-       addb    bh, al          ! do this 6 more times to get byte count.
-       addb    bh, al          
-       addb    bh, al          
-       addb    bh, al          
-       addb    bh, al          
-#endif
-       add     1(si), ax       ! Update address by sectors read
-       adcb    3(si), ah       ! Don't forget bits 16-23 (add ah = 0)
-       subb    (si), al        ! Decrement sector count by sectors read
-       jnz     load            ! Not all sectors have been read
-       add     si, #4          ! Next (address, count) pair
-       cmpb    ah, (si)        ! Done when no sectors to read
-       jnz     load            ! Read next chunk of /boot
-
-done:
-
-! Call /boot, assuming a long a.out header (48 bytes).  The a.out header is
-! usually short (32 bytes), but to be sure /boot has two entry points:
-! One at offset 0 for the long, and one at offset 16 for the short header.
-! Parameters passed in registers are:
-!
-!      dl      = Boot-device.
-!      es:si   = Partition table entry if hard disk.
-!
-       pop     si              ! Restore es:si = partition table entry
-       pop     es              ! dl is still loaded
-       jmpf    BOOTOFF, BOOTSEG  ! jmp to sec. boot (skipping header).
-
-! Read error: print message, hang forever
-error:
-       mov     si, #LOADOFF+errno+1
-prnum: movb    al, ah          ! Error number in ah
-       andb    al, #0x0F       ! Low 4 bits
-       cmpb    al, #10         ! A-F?
-       jb      digit           ! 0-9!
-       addb    al, #7          ! 'A' - ':'
-digit: addb    (si), al        ! Modify '0' in string
-       dec     si
-       movb    cl, #4          ! Next 4 bits
-       shrb    ah, cl
-       jnz     prnum           ! Again if digit > 0
-
-       mov     si, #LOADOFF+rderr  ! String to print
-print: lodsb                   ! al = *si++ is char to be printed
-       testb   al, al          ! Null byte marks end
-hang:  jz      hang            ! Hang forever waiting for CTRL-ALT-DEL
-       movb    ah, #0x0E       ! Print character in teletype mode
-       mov     bx, #0x0001     ! Page 0, foreground color
-       int     0x10            ! Call BIOS VIDEO_IO
-       jmp     print
-
-.data
-rderr: .ascii  "Read error "
-errno: .ascii  "00 \0"
-errend:
-
-! Floppy disk sectors per track for the 1.44M, 1.2M and 360K/720K types:
-sectors:
-       .data1  18, 15, 9
-
-! Extended read/write commands require a parameter packet.
-ext_rw:
-       .data1  0x10            ! Length of extended r/w packet
-       .data1  0               ! Reserved
-       .data2  0               ! Blocks to transfer (to be filled in)
-       .data2  0               ! Buffer address offset (tbfi)
-       .data2  BOOTSEG         ! Buffer address segment
-       .data4  0               ! Starting block number low 32 bits (tbfi)
-       .data4  0               ! Starting block number high 32 bits
-
-       .align  2
-addresses:
-! The space below this is for disk addresses for a 38K /boot program (worst
-! case, i.e. file is completely fragmented).  It should be enough.
diff --git a/boot/cdbootblock/Makefile b/boot/cdbootblock/Makefile
deleted file mode 100644 (file)
index c4286b9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# cdbootblock: secondary boot code, when booting from cd-rom
-
-.include <bsd.own.mk>
-
-# XXX: Can only be built with ACK currently
-.include "${MINIXSRCDIR}/boot/minix.ack16.mk"
-AFLAGS+=       -Was-ncc
-STRIPFLAG=     -s
-
-PROG=  cdbootblock
-
-SRCS=          bootblock.s
-.PATH: ${.CURDIR}/../bootblock
-AFLAGS+=       -DCDBOOT
-
-BINDIR=                /usr/mdec
-MAN=
-
-LIBC=  # defined, to silence bsd.*.mk
-
-.include <bsd.prog.mk>
diff --git a/boot/edparams/Makefile b/boot/edparams/Makefile
deleted file mode 100644 (file)
index 2cb7730..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# edparams: customize boot; runs on both installer's and user's machines
-
-PROG=  edparams
-BINDIR=        /usr/bin
-
-SRCS=  boot.c rawfs.c
-.PATH: ${.CURDIR}/../boot ${.CURDIR}/..
-CPPFLAGS= -DUNIX -I${MINIXSRCDIR} -I${.CURDIR}/..
-
-MAN=   # monitor.8
-
-.include <bsd.prog.mk>
diff --git a/boot/image.h b/boot/image.h
deleted file mode 100644 (file)
index 4afc8dc..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*     image.h - Info between installboot and boot.    Author: Kees J. Bot
- */
-
-#define IM_NAME_MAX    63
-
-struct image_header {
-       char            name[IM_NAME_MAX + 1];  /* Null terminated. */
-       struct exec     process;
-};
-
-/*
- * $PchId: image.h,v 1.4 1995/11/27 22:23:12 philip Exp $
- */
diff --git a/boot/installboot/Makefile b/boot/installboot/Makefile
deleted file mode 100644 (file)
index 4508afe..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# installboot: install the boot package; runs on the installer's machine
-
-PROG=  installboot_minix
-BINDIR=        /usr/bin
-
-SRCS=  installboot.c rawfs.c
-.PATH: ${.CURDIR}/..
-CPPFLAGS= -I${MINIXSRCDIR} -I${.CURDIR}/..
-
-MAN=   # installboot.8
-
-.include <bsd.prog.mk>
diff --git a/boot/installboot/installboot.c b/boot/installboot/installboot.c
deleted file mode 100644 (file)
index 17dc4f9..0000000
+++ /dev/null
@@ -1,832 +0,0 @@
-/*     installboot 3.0 - Make a device bootable        Author: Kees J. Bot
- *                                                             21 Dec 1991
- *
- * Either make a device bootable or make an image from kernel, mm, fs, etc.
- */
-#define _POSIX_SOURCE  1
-#define _MINIX         1
-#include <stdio.h>
-#include <stddef.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <dirent.h>
-#include <a.out.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <minix/partition.h>
-#include <minix/u64.h>
-#include "rawfs.h"
-#include "image.h"
-
-#define BOOTBLOCK      0       /* Of course */
-#define SECTOR_SIZE    512     /* Disk sector size. */
-#define RATIO(b)       ((b)/SECTOR_SIZE)
-#define SIGNATURE      0xAA55  /* Boot block signature. */
-#define BOOT_MAX       64      /* Absolute maximum size of secondary boot */
-#define SIGPOS         510     /* Where to put signature word. */
-#define PARTPOS                446     /* Offset to the partition table in a master
-                                * boot block.
-                                */
-
-#define between(a, c, z)       ((unsigned) ((c) - (a)) <= ((z) - (a)))
-#define control(c)             between('\0', (c), '\37')
-
-#define BOOT_BLOCK_SIZE 1024
-
-static void report(const char *label)
-/* installboot: label: No such file or directory */
-{
-       fprintf(stderr, "installboot: %s: %s\n", label, strerror(errno));
-}
-
-static void fatal(const char *label)
-{
-       report(label);
-       exit(1);
-}
-
-char *basename(char *name)
-/* Return the last component of name, stripping trailing slashes from name.
- * Precondition: name != "/".  If name is prefixed by a label, then the
- * label is copied to the basename too.
- */
-{
-       static char base[IM_NAME_MAX];
-       char *p, *bp= base;
-
-       if ((p= strchr(name, ':')) != NULL) {
-               while (name <= p && bp < base + IM_NAME_MAX - 1)
-                       *bp++ = *name++;
-       }
-       for (;;) {
-               if ((p= strrchr(name, '/')) == NULL) { p= name; break; }
-               if (*++p != 0) break;
-               *--p= 0;
-       }
-       while (*p != 0 && bp < base + IM_NAME_MAX - 1) *bp++ = *p++;
-       *bp= 0;
-       return base;
-}
-
-static void bread(FILE *f, char *name, void *buf, size_t len)
-/* Read len bytes.  Don't dare return without them. */
-{
-       if (len > 0 && fread(buf, len, 1, f) != 1) {
-               if (ferror(f)) fatal(name);
-               fprintf(stderr, "installboot: Unexpected EOF on %s\n", name);
-               exit(1);
-       }
-}
-
-static void bwrite(FILE *f, const char *name, const void *buf, size_t len)
-{
-       if (len > 0 && fwrite(buf, len, 1, f) != 1) fatal(name);
-}
-
-long total_text= 0, total_data= 0, total_bss= 0;
-int making_image= 0;
-
-void read_header(int talk, char *proc, FILE *procf, struct image_header *ihdr)
-/* Read the a.out header of a program and check it.  If procf happens to be
- * NULL then the header is already in *image_hdr and need only be checked.
- */
-{
-       int n, big= 0;
-       static int banner= 0;
-       struct exec *phdr= &ihdr->process;
-
-       if (procf == NULL) {
-               /* Header already present. */
-               n= phdr->a_hdrlen;
-       } else {
-               memset(ihdr, 0, sizeof(*ihdr));
-
-               /* Put the basename of proc in the header. */
-               strncpy(ihdr->name, basename(proc), IM_NAME_MAX);
-
-               /* Read the header. */
-               n= fread(phdr, sizeof(char), A_MINHDR, procf);
-               if (ferror(procf)) fatal(proc);
-       }
-
-       if (n < A_MINHDR || BADMAG(*phdr)) {
-               fprintf(stderr, "installboot: %s is not an executable\n", proc);
-               exit(1);
-       }
-
-       /* Get the rest of the exec header. */
-       if (procf != NULL) {
-               bread(procf, proc, ((char *) phdr) + A_MINHDR,
-                                               phdr->a_hdrlen - A_MINHDR);
-       }
-
-       if (talk && !banner) {
-               printf("     text     data      bss      size\n");
-               banner= 1;
-       }
-
-       if (talk) {
-               printf(" %8ld %8ld %8ld %9ld  %s\n",
-                       phdr->a_text, phdr->a_data, phdr->a_bss,
-                       phdr->a_text + phdr->a_data + phdr->a_bss, proc);
-       }
-       total_text+= phdr->a_text;
-       total_data+= phdr->a_data;
-       total_bss+= phdr->a_bss;
-
-       if (phdr->a_cpu == A_I8086) {
-               long data= phdr->a_data + phdr->a_bss;
-
-               if (!(phdr->a_flags & A_SEP)) data+= phdr->a_text;
-
-               if (phdr->a_text >= 65536) big|= 1;
-               if (data >= 65536) big|= 2;
-       }
-       if (big) {
-               fprintf(stderr,
-                       "%s will crash, %s%s%s segment%s larger then 64K\n",
-                       proc,
-                       big & 1 ? "text" : "",
-                       big == 3 ? " and " : "",
-                       big & 2 ? "data" : "",
-                       big == 3 ? "s are" : " is");
-       }
-}
-
-void padimage(const char *image, FILE *imagef, int n)
-/* Add n zeros to image to pad it to a sector boundary. */
-{
-       while (n > 0) {
-               if (putc(0, imagef) == EOF) fatal(image);
-               n--;
-       }
-}
-
-#define align(n)       (((n) + ((SECTOR_SIZE) - 1)) & ~((SECTOR_SIZE) - 1))
-
-void copyexec(char *proc, FILE *procf, char *image, FILE *imagef, long n)
-/* Copy n bytes from proc to image padded to fill a sector. */
-{
-       int pad, c;
-
-       /* Compute number of padding bytes. */
-       pad= align(n) - n;
-
-       while (n > 0) {
-               if ((c= getc(procf)) == EOF) {
-                       if (ferror(procf)) fatal(proc);
-                       fprintf(stderr, "installboot: premature EOF on %s\n",
-                                                                       proc);
-                       exit(1);
-               }
-               if (putc(c, imagef) == EOF) fatal(image);
-               n--;
-       }
-       padimage(image, imagef, pad);
-}
-
-void make_image(char *image, char **procv)
-/* Collect a set of files in an image, each "segment" is nicely padded out
- * to SECTOR_SIZE, so it may be read from disk into memory without trickery.
- */
-{
-       FILE *imagef, *procf;
-       char *proc, *file;
-       int procn;
-       struct image_header ihdr;
-       struct exec phdr;
-       struct stat st;
-
-       making_image= 1;
-
-       if ((imagef= fopen(image, "w")) == NULL) fatal(image);
-
-       for (procn= 0; (proc= *procv++) != NULL; procn++) {
-               /* Remove the label from the file name. */
-               if ((file= strchr(proc, ':')) != NULL) file++; else file= proc;
-
-               /* Real files please, may need to seek. */
-               if (stat(file, &st) < 0
-                       || (errno= EISDIR, !S_ISREG(st.st_mode))
-                       || (procf= fopen(file, "r")) == NULL
-               ) fatal(proc);
-
-               /* Read a.out header. */
-               read_header(1, proc, procf, &ihdr);
-
-               /* Scratch. */
-               phdr= ihdr.process;
-
-               /* The symbol table is always stripped off. */
-               ihdr.process.a_syms= 0;
-               ihdr.process.a_flags &= ~A_NSYM;
-
-               /* Write header padded to fill a sector */
-               bwrite(imagef, image, &ihdr, sizeof(ihdr));
-
-               padimage(image, imagef, SECTOR_SIZE - sizeof(ihdr));
-
-               /* A page aligned executable needs the header in text. */
-               if (phdr.a_flags & A_PAL) {
-                       rewind(procf);
-                       phdr.a_text+= phdr.a_hdrlen;
-               }
-
-               /* Copy text and data of proc to image. */
-               if (phdr.a_flags & A_SEP) {
-                       /* Separate I&D: pad text & data separately. */
-
-                       copyexec(proc, procf, image, imagef, phdr.a_text);
-                       copyexec(proc, procf, image, imagef, phdr.a_data);
-               } else {
-                       /* Common I&D: keep text and data together. */
-
-                       copyexec(proc, procf, image, imagef,
-                                               phdr.a_text + phdr.a_data);
-               }
-
-               /* Done with proc. */
-               (void) fclose(procf);
-       }
-       /* Done with image. */
-
-       if (fclose(imagef) == EOF) fatal(image);
-
-       printf("   ------   ------   ------   -------\n");
-       printf(" %8ld %8ld %8ld %9ld  total\n",
-               total_text, total_data, total_bss,
-               total_text + total_data + total_bss);
-}
-
-void extractexec(FILE *imagef, char *image, FILE *procf, char *proc,
-                                               long count, off_t *alen)
-/* Copy a segment of an executable.  It is padded to a sector in image. */
-{
-       char buf[SECTOR_SIZE];
-
-       while (count > 0) {
-               bread(imagef, image, buf, sizeof(buf));
-               *alen-= sizeof(buf);
-
-               bwrite(procf, proc, buf,
-                       count < sizeof(buf) ? (size_t) count : sizeof(buf));
-               count-= sizeof(buf);
-       }
-}
-
-void extract_image(char *image)
-/* Extract the executables from an image. */
-{
-       FILE *imagef, *procf;
-       off_t len;
-       struct stat st;
-       struct image_header ihdr;
-       struct exec phdr;
-       char buf[SECTOR_SIZE];
-
-       if (stat(image, &st) < 0) fatal(image);
-
-       /* Size of the image. */
-       len= S_ISREG(st.st_mode) ? st.st_size : -1;
-
-       if ((imagef= fopen(image, "r")) == NULL) fatal(image);
-
-       while (len != 0) {
-               /* Extract a program, first sector is an extended header. */
-               bread(imagef, image, buf, sizeof(buf));
-               len-= sizeof(buf);
-
-               memcpy(&ihdr, buf, sizeof(ihdr));
-               phdr= ihdr.process;
-
-               /* Check header. */
-               read_header(1, ihdr.name, NULL, &ihdr);
-
-               if ((procf= fopen(ihdr.name, "w")) == NULL) fatal(ihdr.name);
-
-               if (phdr.a_flags & A_PAL) {
-                       /* A page aligned process contains a header in text. */
-                       phdr.a_text+= phdr.a_hdrlen;
-               } else {
-                       bwrite(procf, ihdr.name, &ihdr.process, phdr.a_hdrlen);
-               }
-
-               /* Extract text and data segments. */
-               if (phdr.a_flags & A_SEP) {
-                       extractexec(imagef, image, procf, ihdr.name,
-                                               phdr.a_text, &len);
-                       extractexec(imagef, image, procf, ihdr.name,
-                                               phdr.a_data, &len);
-               } else {
-                       extractexec(imagef, image, procf, ihdr.name,
-                               phdr.a_text + phdr.a_data, &len);
-               }
-
-               if (fclose(procf) == EOF) fatal(ihdr.name);
-       }
-}
-
-static int rawfd;      /* File descriptor to open device. */
-static const char *rawdev;     /* Name of device. */
-
-void readblock(off_t blk, char *buf, int block_size)
-/* For rawfs, so that it can read blocks. */
-{
-       int n;
-
-       if (lseek(rawfd, blk * block_size, SEEK_SET) < 0
-               || (n= read(rawfd, buf, block_size)) < 0
-       ) fatal(rawdev);
-
-       if (n < block_size) {
-               fprintf(stderr, "installboot: Unexpected EOF on %s\n", rawdev);
-               exit(1);
-       }
-}
-
-void writeblock(off_t blk, const char *buf, int block_size)
-/* Add a function to write blocks for local use. */
-{
-       if (lseek(rawfd, blk * block_size, SEEK_SET) < 0
-               || write(rawfd, buf, block_size) < 0
-       ) fatal(rawdev);
-}
-
-int raw_install(char *file, off_t *start, off_t *len, int block_size)
-/* Copy bootcode or an image to the boot device at the given absolute disk
- * block number.  This "raw" installation is used to place bootcode and
- * image on a disk without a filesystem to make a simple boot disk.  Useful
- * in automated scripts for J. Random User.
- * Note: *len == 0 when an image is read.  It is set right afterwards.
- */
-{
-       static char buf[_MAX_BLOCK_SIZE];       /* Nonvolatile block buffer. */
-       FILE *f;
-       off_t sec;
-       unsigned long devsize;
-       static int banner= 0;
-       struct partition entry;
-
-       /* See if the device has a maximum size. */
-       devsize= -1;
-       if (ioctl(rawfd, DIOCGETP, &entry) == 0) devsize= cv64ul(entry.size);
-
-       if ((f= fopen(file, "r")) == NULL) fatal(file);
-
-       /* Copy sectors from file onto the boot device. */
-       sec= *start;
-       do {
-               int off= sec % RATIO(BOOT_BLOCK_SIZE);
-
-               if (fread(buf + off * SECTOR_SIZE, 1, SECTOR_SIZE, f) == 0)
-                       break;
-
-               if (sec >= devsize) {
-                       fprintf(stderr,
-                       "installboot: %s can't be attached to %s\n",
-                               file, rawdev);
-                       return 0;
-               }
-
-               if (off == RATIO(BOOT_BLOCK_SIZE) - 1) writeblock(sec / RATIO(BOOT_BLOCK_SIZE), buf, BOOT_BLOCK_SIZE);
-       } while (++sec != *start + *len);
-
-       if (ferror(f)) fatal(file);
-       (void) fclose(f);
-
-       /* Write a partial block, this may be the last image. */
-       if (sec % RATIO(BOOT_BLOCK_SIZE) != 0) writeblock(sec / RATIO(BOOT_BLOCK_SIZE), buf, BOOT_BLOCK_SIZE);
-
-       if (!banner) {
-               printf("  sector  length\n");
-               banner= 1;
-       }
-       *len= sec - *start;
-       printf("%8ld%8ld  %s\n", *start, *len, file);
-       *start= sec;
-       return 1;
-}
-
-enum howto { FS, BOOT };
-
-void make_bootable(enum howto how, char *device, char *bootblock,
-                                       char *bootcode, char **imagev)
-/* Install bootblock on the bootsector of device with the disk addresses to
- * bootcode patched into the data segment of bootblock.  "How" tells if there
- * should or shoudn't be a file system on the disk.  The images in the imagev
- * vector are added to the end of the device.
- */
-{
-       char buf[_MAX_BLOCK_SIZE + 256], *adrp, *parmp;
-       struct fileaddr {
-               off_t   address;
-               int     count;
-       } bootaddr[BOOT_MAX + 1], *bap= bootaddr;
-       struct exec boothdr;
-       struct image_header dummy;
-       struct stat st;
-       ino_t ino;
-       off_t sector, max_sector;
-       FILE *bootf;
-       off_t addr, fssize, pos, len;
-       char *labels, *label, *image;
-       int nolabel;
-       int block_size = 0;
-
-       /* Open device and set variables for readblock. */
-       if ((rawfd= open(rawdev= device, O_RDWR)) < 0) fatal(device);
-
-       /* Read and check the superblock. */
-       fssize= r_super(&block_size);
-
-       switch (how) {
-       case FS:
-               if (fssize == 0) {
-                       fprintf(stderr,
-                               "installboot: %s is not a Minix file system\n",
-                               device);
-                       exit(1);
-               }
-               break;
-       case BOOT:
-               if (fssize != 0) {
-                       int s;
-                       printf("%s contains a file system!\n", device);
-                       printf("Scribbling in 10 seconds");
-                       for (s= 0; s < 10; s++) {
-                               fputc('.', stdout);
-                               fflush(stdout);
-                               sleep(1);
-                       }
-                       fputc('\n', stdout);
-               }
-               fssize= 1;      /* Just a boot block. */
-       }
-
-       if (how == FS) {
-               /* See if the boot code can be found on the file system. */
-               if ((ino= r_lookup(ROOT_INO, bootcode)) == 0) {
-                       if (errno != ENOENT) fatal(bootcode);
-               }
-       } else {
-               /* Boot code must be attached at the end. */
-               ino= 0;
-       }
-
-       if (ino == 0) {
-               /* For a raw installation, we need to copy the boot code onto
-                * the device, so we need to look at the file to be copied.
-                */
-               if (stat(bootcode, &st) < 0) fatal(bootcode);
-
-               if ((bootf= fopen(bootcode, "r")) == NULL) fatal(bootcode);
-       } else {
-               /* Boot code is present in the file system. */
-               r_stat(ino, &st);
-
-               /* Get the header from the first block. */
-               if ((addr= r_vir2abs((off_t) 0)) == 0) {
-                       boothdr.a_magic[0]= !A_MAGIC0;
-               } else {
-                       readblock(addr, buf, block_size);
-                       memcpy(&boothdr, buf, sizeof(struct exec));
-               }
-               bootf= NULL;
-               dummy.process= boothdr;
-       }
-       /* See if it is an executable (read_header does the check). */
-       read_header(0, bootcode, bootf, &dummy);
-       boothdr= dummy.process;
-
-       if (bootf != NULL) fclose(bootf);
-
-       /* Get all the sector addresses of the secondary boot code. */
-       max_sector= (boothdr.a_hdrlen + boothdr.a_text
-                       + boothdr.a_data + SECTOR_SIZE - 1) / SECTOR_SIZE;
-
-       if (max_sector > BOOT_MAX * RATIO(block_size)) {
-               fprintf(stderr, "installboot: %s is way too big\n", bootcode);
-               exit(0);
-       }
-
-       /* Determine the addresses to the boot code to be patched into the
-        * boot block.
-        */
-       bap->count= 0;  /* Trick to get the address recording going. */
-
-       for (sector= 0; sector < max_sector; sector++) {
-               if (ino == 0) {
-                       addr= fssize + (sector / RATIO(block_size));
-               } else
-               if ((addr= r_vir2abs(sector / RATIO(block_size))) == 0) {
-                       fprintf(stderr, "installboot: %s has holes!\n",
-                                                               bootcode);
-                       exit(1);
-               }
-               addr= (addr * RATIO(block_size)) + (sector % RATIO(block_size));
-
-               /* First address of the addresses array? */
-               if (bap->count == 0) bap->address= addr;
-
-               /* Paste sectors together in a multisector read. */
-               if (bap->address + bap->count == addr)
-                       bap->count++;
-               else {
-                       /* New address. */
-                       bap++;
-                       bap->address= addr;
-                       bap->count= 1;
-               }
-       }
-       (++bap)->count= 0;      /* No more. */
-
-       /* Get the boot block and patch the pieces in. */
-       readblock(BOOTBLOCK, buf, BOOT_BLOCK_SIZE);
-
-       if ((bootf= fopen(bootblock, "r")) == NULL) fatal(bootblock);
-
-       read_header(0, bootblock, bootf, &dummy);
-       boothdr= dummy.process;
-
-       if (boothdr.a_text + boothdr.a_data +
-                                        4 * (bap - bootaddr) + 1 > PARTPOS) {
-               fprintf(stderr,
-       "installboot: %s + addresses to %s don't fit in the boot sector\n",
-                       bootblock, bootcode);
-               fprintf(stderr,
-                   "You can try copying/reinstalling %s to defragment it\n",
-                       bootcode);
-               exit(1);
-       }
-
-       /* All checks out right.  Read bootblock into the boot block! */
-       bread(bootf, bootblock, buf, boothdr.a_text + boothdr.a_data);
-       (void) fclose(bootf);
-
-       /* Patch the addresses in. */
-       adrp= buf + (int) (boothdr.a_text + boothdr.a_data);
-       for (bap= bootaddr; bap->count != 0; bap++) {
-               *adrp++= bap->count;
-               *adrp++= (bap->address >>  0) & 0xFF;
-               *adrp++= (bap->address >>  8) & 0xFF;
-               *adrp++= (bap->address >> 16) & 0xFF;
-       }
-       /* Zero count stops bootblock's reading loop. */
-       *adrp++= 0;
-
-       if (bap > bootaddr+1) {
-               printf("%s and %d addresses to %s patched into %s\n",
-                       bootblock, (int)(bap - bootaddr), bootcode, device);
-       }
-
-       /* Boot block signature. */
-       buf[SIGPOS+0]= (SIGNATURE >> 0) & 0xFF;
-       buf[SIGPOS+1]= (SIGNATURE >> 8) & 0xFF;
-
-       /* Sector 2 of the boot block is used for boot parameters, initially
-        * filled with null commands (newlines).  Initialize it only if
-        * necessary.
-        */
-       for (parmp= buf + SECTOR_SIZE; parmp < buf + 2*SECTOR_SIZE; parmp++) {
-               if (*imagev != NULL || (control(*parmp) && *parmp != '\n')) {
-                       /* Param sector must be initialized. */
-                       memset(buf + SECTOR_SIZE, '\n', SECTOR_SIZE);
-                       break;
-               }
-       }
-
-       /* Offset to the end of the file system to add boot code and images. */
-       pos= fssize * RATIO(block_size);
-
-       if (ino == 0) {
-               /* Place the boot code onto the boot device. */
-               len= max_sector;
-               if (!raw_install(bootcode, &pos, &len, block_size)) {
-                       if (how == FS) {
-                               fprintf(stderr,
-       "\t(Isn't there a copy of %s on %s that can be used?)\n",
-                                       bootcode, device);
-                       }
-                       exit(1);
-               }
-       }
-
-       parmp= buf + SECTOR_SIZE;
-       nolabel= 0;
-
-       if (how == BOOT) {
-               /* A boot only disk needs to have floppies swapped. */
-               strcpy(parmp,
-       "trailer()echo \\nInsert the root diskette then hit RETURN\\n\\w\\c\n");
-               parmp+= strlen(parmp);
-       }
-
-       while ((labels= *imagev++) != NULL) {
-               /* Place each kernel image on the boot device. */
-
-               if ((image= strchr(labels, ':')) != NULL)
-                       *image++= 0;
-               else {
-                       if (nolabel) {
-                               fprintf(stderr,
-                           "installboot: Only one image can be the default\n");
-                               exit(1);
-                       }
-                       nolabel= 1;
-                       image= labels;
-                       labels= NULL;
-               }
-               len= 0;
-               if (!raw_install(image, &pos, &len, block_size)) exit(1);
-
-               if (labels == NULL) {
-                       /* Let this image be the default. */
-                       sprintf(parmp, "image=%ld:%ld\n", pos-len, len);
-                       parmp+= strlen(parmp);
-               }
-
-               while (labels != NULL) {
-                       /* Image is prefixed by a comma separated list of
-                        * labels.  Define functions to select label and image.
-                        */
-                       label= labels;
-                       if ((labels= strchr(labels, ',')) != NULL) *labels++ = 0;
-
-                       sprintf(parmp,
-               "%s(%c){label=%s;image=%ld:%ld;echo %s kernel selected;menu}\n",
-                               label,
-                               between('A', label[0], 'Z')
-                                       ? label[0]-'A'+'a' : label[0],
-                               label, pos-len, len, label);
-                       parmp+= strlen(parmp);
-               }
-
-               if (parmp > buf + block_size) {
-                       fprintf(stderr,
-               "installboot: Out of parameter space, too many images\n");
-                       exit(1);
-               }
-       }
-       /* Install boot block. */
-       writeblock((off_t) BOOTBLOCK, buf, 1024);
-
-       if (pos > fssize * RATIO(block_size)) {
-               /* Tell the total size of the data on the device. */
-               printf("%16ld  (%ld kb) total\n", pos,
-                                               (pos + RATIO(block_size) - 1) / RATIO(block_size));
-       }
-}
-
-static void install_master(const char *device, char *masterboot, char **guide)
-/* Booting a hard disk is a two stage process:  The master bootstrap in sector
- * 0 loads the bootstrap from sector 0 of the active partition which in turn
- * starts the operating system.  This code installs such a master bootstrap
- * on a hard disk.  If guide[0] is non-null then the master bootstrap is
- * guided into booting a certain device.
- */
-{
-       FILE *masf;
-       unsigned long size;
-       struct stat st;
-       static char buf[_MAX_BLOCK_SIZE];
-
-       /* Open device. */
-       if ((rawfd= open(rawdev= device, O_RDWR)) < 0) fatal(device);
-
-       /* Open the master boot code. */
-       if ((masf= fopen(masterboot, "r")) == NULL) fatal(masterboot);
-
-       /* See if the user is cloning a device. */
-       if (fstat(fileno(masf), &st) >=0 && S_ISBLK(st.st_mode))
-               size= PARTPOS;
-       else {
-               /* Read and check header otherwise. */
-               struct image_header ihdr;
-
-               read_header(1, masterboot, masf, &ihdr);
-               size= ihdr.process.a_text + ihdr.process.a_data;
-       }
-       if (size > PARTPOS) {
-               fprintf(stderr, "installboot: %s is too big\n", masterboot);
-               exit(1);
-       }
-
-       /* Read the master boot block, patch it, write. */
-       readblock(BOOTBLOCK, buf, BOOT_BLOCK_SIZE);
-
-       memset(buf, 0, PARTPOS);
-       (void) bread(masf, masterboot, buf, size);
-
-       if (guide[0] != NULL) {
-               /* Fixate partition to boot. */
-               const char *keys= guide[0];
-               const char *logical= guide[1];
-               size_t i;
-               int logfd;
-               u32_t offset;
-               struct partition geometry;
-
-               /* A string of digits to be seen as keystrokes. */
-               i= 0;
-               do {
-                       if (!between('0', keys[i], '9')) {
-                               fprintf(stderr,
-                                       "installboot: bad guide keys '%s'\n",
-                                       keys);
-                               exit(1);
-                       }
-               } while (keys[++i] != 0);
-
-               if (size + i + 1 > PARTPOS) {
-                       fprintf(stderr,
-                       "installboot: not enough space after '%s' for '%s'\n",
-                               masterboot, keys);
-                       exit(1);
-               }
-               memcpy(buf + size, keys, i);
-               size += i;
-               buf[size]= '\r';
-
-               if (logical != NULL) {
-                       if ((logfd= open(logical, O_RDONLY)) < 0
-                               || ioctl(logfd, DIOCGETP, &geometry) < 0
-                       ) {
-                               fatal(logical);
-                       }
-                       offset= div64u(geometry.base, SECTOR_SIZE);
-                       if (size + 5 > PARTPOS) {
-                               fprintf(stderr,
-                                       "installboot: not enough space "
-                                       "after '%s' for '%s' and an offset "
-                                       "to '%s'\n",
-                                       masterboot, keys, logical);
-                               exit(1);
-                       }
-                       buf[size]= '#';
-                       memcpy(buf+size+1, &offset, 4);
-               }
-       }
-
-       /* Install signature. */
-       buf[SIGPOS+0]= (SIGNATURE >> 0) & 0xFF;
-       buf[SIGPOS+1]= (SIGNATURE >> 8) & 0xFF;
-
-       writeblock(BOOTBLOCK, buf, BOOT_BLOCK_SIZE);
-}
-
-static void usage(void)
-{
-       fprintf(stderr,
-         "Usage: installboot -i(mage) image kernel mm fs ... init\n"
-         "       installboot -(e)x(tract) image\n"
-         "       installboot -d(evice) device bootblock boot [image ...]\n"
-         "       installboot -b(oot) device bootblock boot image ...\n"
-         "       installboot -m(aster) device masterboot [keys [logical]]\n");
-       exit(1);
-}
-
-static int isoption(const char *option, const char *test)
-/* Check if the option argument is equals "test".  Also accept -i as short
- * for -image, and the special case -x for -extract.
- */
-{
-       if (strcmp(option, test) == 0) return 1;
-       if (option[0] != '-' && strlen(option) != 2) return 0;
-       if (option[1] == test[1]) return 1;
-       if (option[1] == 'x' && test[1] == 'e') return 1;
-       return 0;
-}
-
-int main(int argc, char **argv)
-{
-       if (argc < 2) usage();
-
-       if (argc >= 4 && isoption(argv[1], "-image")) {
-               make_image(argv[2], argv + 3);
-       } else
-       if (argc == 3 && isoption(argv[1], "-extract")) {
-               extract_image(argv[2]);
-       } else
-       if (argc >= 5 && isoption(argv[1], "-device")) {
-               make_bootable(FS, argv[2], argv[3], argv[4], argv + 5);
-       } else
-       if (argc >= 6 && isoption(argv[1], "-boot")) {
-               make_bootable(BOOT, argv[2], argv[3], argv[4], argv + 5);
-       } else
-       if ((4 <= argc && argc <= 6) && isoption(argv[1], "-master")) {
-               install_master(argv[2], argv[3], argv + 4);
-       } else {
-               usage();
-       }
-       exit(0);
-}
-
-/*
- * $PchId: installboot.c,v 1.10 2000/08/13 22:07:50 philip Exp $
- */
diff --git a/boot/jumpboot/Makefile b/boot/jumpboot/Makefile
deleted file mode 100644 (file)
index d8d88f5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# jumpboot: supplementary MBR code (alternate to masterboot)
-
-.include <bsd.own.mk>
-
-# XXX: Can only be built with ACK currently
-.include "${MINIXSRCDIR}/boot/minix.ack16.mk"
-AFLAGS+=       -Was-ncc
-STRIPFLAG=     -s
-
-PROG=  jumpboot
-
-SRCS=          jumpboot.s
-
-BINDIR=                /usr/mdec
-MAN=
-
-LIBC=  # defined, to silence bsd.*.mk
-
-.include <bsd.prog.mk>
diff --git a/boot/jumpboot/jumpboot.s b/boot/jumpboot/jumpboot.s
deleted file mode 100644 (file)
index 6e75882..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-!      jumpboot 1.0 - Jump to another bootstrap        Author: Kees J. Bot
-!                                                              14 Apr 1999
-!
-! This code may be placed into any free boot sector, like the first sector
-! of an extended partition, a file system partition other than the root,
-! or even the master bootstrap.  It will load and run another bootstrap whose
-! disk, partition, and slice number (not necessarily all three) are patched
-! into this code by installboot.  If the ALT key is held down when this code
-! is booted then you can type the disk, partition, and slice numbers manually.
-! The manual interface is default if no numbers are patched in by installboot.
-!
-
-       o32        =      0x66  ! This assembler doesn't know 386 extensions
-       LOADOFF    =    0x7C00  ! 0x0000:LOADOFF is where this code is loaded
-       BUFFER     =    0x0600  ! First free memory
-       PART_TABLE =       446  ! Location of partition table within master
-       PENTRYSIZE =        16  ! Size of one partition table entry
-       MAGIC      =       510  ! Location of the AA55 magic number
-
-       ! <ibm/partition.h>:
-       MINIX_PART =      0x81
-       sysind     =         4
-       lowsec     =         8
-
-
-.text
-
-! Find and load another bootstrap and jump to it.
-jumpboot:
-       xor     ax, ax
-       mov     ds, ax
-       mov     es, ax
-       cli
-       mov     ss, ax                  ! ds = es = ss = Vector segment
-       mov     sp, #LOADOFF
-       sti
-
-! Move this code to safety, then jump to it.
-       mov     si, sp                  ! si = start of this code
-       mov     di, #BUFFER             ! di = Buffer area
-       mov     cx, #512/2              ! One sector
-       cld
-  rep  movs
-       jmpf    BUFFER+migrate, 0       ! To safety
-migrate:
-
-       mov     bp, #BUFFER+guide       ! Patched guiding characters
-altkey:
-       movb    ah, #0x02               ! Keyboard shift status
-       int     0x16
-       testb   al, #0x08               ! Bit 3 = ALT key
-       jz      noalt                   ! ALT key pressed?
-again:
-       mov     bp, #zero               ! Ignore patched stuff
-noalt:
-
-! Follow guide characters to find the boot partition.
-       call    print
-       .ascii  "d?\b\0"                ! Initial greeting
-
-! Disk number?
-disk:
-       movb    dl, #0x80 - 0x30        ! Prepare to add an ASCII digit
-       call    getch                   ! Get number to tell which disk
-       addb    dl, al                  ! dl = 0x80 + (al - '0')
-       jns     n0nboot                 ! Result should be >= 0x80
-       mov     si, #BUFFER+zero-lowsec ! si = where lowsec(si) is zero
-       cmpb    (bp), #0x23             ! Next guide character is '#'?
-       jne     notlogical
-       lea     si, 1-lowsec(bp)        ! Logical sector offset follows '#'
-notlogical:
-       call    load                    ! Load chosen sector of chosen disk
-       cmpb    (bp), #0x23
-       je      boot                    ! Run bootstrap if a logical is chosen
-
-       call    print                   ! Intro to partition number
-       .ascii  "p?\b\0"
-
-part:
-       call    getch                   ! Get character to tell partition
-       call    gettable                ! Get partition table
-       call    sort                    ! Sort partition table
-       call    choose_load             ! Compute chosen entry and load
-
-       cmpb    sysind(si), #MINIX_PART ! Minix subpartition table possible?
-       jne     waitboot
-
-       call    print                   ! Intro to slice number
-       .ascii  "s?\b\0"
-
-slice:
-       call    getch                   ! Get character to tell slice
-       call    gettable                ! Get partition table
-       call    choose_load             ! Compute chosen entry and load
-
-waitboot:
-       call    print                   ! Intro to nothing
-       .ascii  " ?\b\0"
-       call    getch                   ! Supposed to type RETURN now
-n0nboot:jmp    nonboot                 ! Sorry, can't go further
-
-! Get a character, either the patched-in, or one from the keyboard.
-getch:
-       movb    al, (bp)        ! Get patched-in character
-       testb   al, al
-       jz      getkey
-       inc     bp
-       jmp     gotkey
-getkey:        xorb    ah, ah          ! Wait for keypress
-       int     0x16
-gotkey:        testb   dl, dl          ! Ignore CR if disk number not yet set
-       jns     putch
-       cmpb    al, #0x0D       ! Carriage return?
-       je      boot
-       !jmp    putch
-
-! Print a character
-putch: movb    ah, #0x0E       ! Print character in teletype mode
-       mov     bx, #0x0001     ! Page 0, foreground color
-       int     0x10
-       ret
-
-! Print a message.
-print: mov     cx, si          ! Save si
-       pop     si              ! si = String following 'call print'
-prnext:        lodsb                   ! al = *si++ is char to be printed
-       testb   al, al          ! Null marks end
-       jz      prdone
-       call    putch
-       jmp     prnext
-prdone:        xchg    si, cx          ! Restore si
-       jmp     (cx)            ! Continue after the string
-
-! Return typed (or in patched data) means to run the bootstrap now in core!
-boot:
-       call    print           ! Make line on screen look proper
-       .ascii  "\b  \r\n\0"
-       jmp     LOADOFF-BUFFER  ! Jump to LOADOFF
-
-! Compute address of chosen partition entry from choice al into si, then
-! continue to load the boot sector of that partition.
-choose_load:
-       subb    al, #0x30               ! al -= '0'
-       cmpb    al, #4                  ! Only four partitions
-       ja      n0nboot
-       movb    ah, #PENTRYSIZE
-       mulb    ah                      ! al *= PENTRYSIZE
-       add     ax, #BUFFER+PART_TABLE
-       mov     si, ax                  ! si = &part_table[al - '0']
-       movb    al, sysind(si)          ! System indicator
-       testb   al, al                  ! Unused partition?
-       jz      n0nboot
-       !jmp    load                    ! Continue to load boot sector
-
-! Load boot sector of the current partition.
-load:
-       push    dx              ! Save drive code
-       push    es              ! Next call sets es
-       movb    ah, #0x08       ! Code for drive parameters
-       int     0x13
-       pop     es
-       andb    cl, #0x3F       ! cl = max sector number (1-origin)
-       incb    dh              ! dh = 1 + max head number (0-origin)
-       movb    al, cl          ! al = cl = sectors per track
-       mulb    dh              ! dh = heads, ax = heads * sectors
-       mov     bx, ax          ! bx = sectors per cylinder = heads * sectors
-       mov     ax, lowsec+0(si)
-       mov     dx, lowsec+2(si) ! dx:ax = sector within drive
-       cmp     dx, #[1024*255*63-255]>>16  ! Near 8G limit?
-       jae     bigdisk
-       div     bx              ! ax = cylinder, dx = sector within cylinder
-       xchg    ax, dx          ! ax = sector within cylinder, dx = cylinder
-       movb    ch, dl          ! ch = low 8 bits of cylinder
-       divb    cl              ! al = head, ah = sector (0-origin)
-       xorb    dl, dl          ! About to shift bits 8-9 of cylinder into dl
-       shr     dx, #1
-       shr     dx, #1          ! dl[6..7] = high cylinder
-       orb     dl, ah          ! dl[0..5] = sector (0-origin)
-       movb    cl, dl          ! cl[0..5] = sector, cl[6..7] = high cyl
-       incb    cl              ! cl[0..5] = sector (1-origin)
-       pop     dx              ! Restore drive code in dl
-       movb    dh, al          ! dh = al = head
-       mov     bx, #LOADOFF    ! es:bx = where sector is loaded
-       mov     ax, #0x0201     ! ah = Code for read / al = one sector
-       int     0x13
-       jmp     rdeval          ! Evaluate read result
-bigdisk:
-       mov     bx, dx          ! bx:ax = dx:ax = sector to read
-       pop     dx              ! Restore drive code in dl
-       push    si              ! Save si
-       mov     si, #BUFFER+ext_rw ! si = extended read/write parameter packet
-       mov     8(si), ax       ! Starting block number = bx:ax
-       mov     10(si), bx
-       movb    ah, #0x42       ! Extended read
-       int     0x13
-       pop     si              ! Restore si to point to partition entry
-       !jmp    rdeval
-rdeval:
-       jnc     rdok
-rderr:
-       call    print
-       .ascii  "\r\nRead error\r\n\0"
-       jmp     again
-rdok:
-       cmp     LOADOFF+MAGIC, #0xAA55
-       je      sigok           ! Signature ok?
-nonboot:
-       call    print
-       .ascii  "\r\nNot bootable\r\n\0"
-       jmp     again
-sigok:
-       ret
-
-! Get the partition table into my space.
-gettable:
-       mov     si, #LOADOFF+PART_TABLE
-       mov     di, #BUFFER+PART_TABLE
-       mov     cx, #4*PENTRYSIZE/2
-  rep  movs
-       ret
-
-! Sort the partition table.
-sort:
-       mov     cx, #4                  ! Four times is enough to sort
-bubble:        mov     si, #BUFFER+PART_TABLE  ! First table entry
-bubble1:lea    di, PENTRYSIZE(si)      ! Next entry
-       cmpb    sysind(si), ch          ! Partition type, nonzero when in use
-       jz      exchg                   ! Unused entries sort to the end
-inuse: mov     bx, lowsec+0(di)
-       sub     bx, lowsec+0(si)        ! Compute di->lowsec - si->lowsec
-       mov     bx, lowsec+2(di)
-       sbb     bx, lowsec+2(si)
-       jae     order                   ! In order if si->lowsec <= di->lowsec
-exchg: movb    bl, (si)
-       xchgb   bl, PENTRYSIZE(si)      ! Exchange entries byte by byte
-       movb    (si), bl
-       inc     si
-       cmp     si, di
-       jb      exchg
-order: mov     si, di
-       cmp     si, #BUFFER+PART_TABLE+3*PENTRYSIZE
-       jb      bubble1
-       loop    bubble
-       ret
-
-.data
-
-! Extended read/write commands require a parameter packet.
-ext_rw:
-       .data1  0x10            ! Length of extended r/w packet
-       .data1  0               ! Reserved
-       .data2  1               ! Blocks to transfer (just one)
-       .data2  LOADOFF         ! Buffer address offset
-       .data2  0               ! Buffer address segment
-       .data4  0               ! Starting block number low 32 bits (tbfi)
-zero:  .data4  0               ! Starting block number high 32 bits
-
-       .align  2
-guide:
-! Guide characters and possibly a logical partition number patched here by
-! installboot, up to 6 bytes maximum.
diff --git a/boot/masterboot/Makefile b/boot/masterboot/Makefile
deleted file mode 100644 (file)
index f953846..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# masterboot: MBR code, first to run, 16-bit mode
-
-.include <bsd.own.mk>
-
-# XXX: Can only be built with ACK currently
-.include "${MINIXSRCDIR}/boot/minix.ack16.mk"
-AFLAGS+=       -Was-ncc
-STRIPFLAG=     -s
-
-
-PROG=  masterboot
-
-SRCS=          masterboot.s
-
-BINDIR=                /usr/mdec
-MAN=
-
-LIBC=  # defined, to silence bsd.*.mk
-
-.include <bsd.prog.mk>
diff --git a/boot/masterboot/masterboot.s b/boot/masterboot/masterboot.s
deleted file mode 100644 (file)
index 9294c98..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-!      masterboot 2.0 - Master boot block code         Author: Kees J. Bot
-!
-! This code may be placed in the first sector (the boot sector) of a floppy,
-! hard disk or hard disk primary partition.  There it will perform the
-! following actions at boot time:
-!
-! - If the booted device is a hard disk and one of the partitions is active
-!   then the active partition is booted.
-!
-! - Otherwise the next floppy or hard disk device is booted, trying them one
-!   by one.
-!
-! To make things a little clearer, the boot path might be:
-!      /dev/fd0        - Floppy disk containing data, tries fd1 then d0
-!      [/dev/fd1]      - Drive empty
-!      /dev/c0d0       - Master boot block, selects active partition 2
-!      /dev/c0d0p2     - Submaster, selects active subpartition 0
-!      /dev/c0d0p2s0   - Minix bootblock, reads Boot Monitor /boot
-!      Minix           - Started by /boot from a kernel image in /minix
-
-       LOADOFF    =    0x7C00  ! 0x0000:LOADOFF is where this code is loaded
-       BUFFER     =    0x0600  ! First free memory
-       PART_TABLE =       446  ! Location of partition table within this code
-       PENTRYSIZE =        16  ! Size of one partition table entry
-       MAGIC      =       510  ! Location of the AA55 magic number
-
-       ! <ibm/partition>.h:
-       bootind    =         0
-       sysind     =         4
-       lowsec     =         8
-
-
-.text
-
-! Find active (sub)partition, load its first sector, run it.
-
-master:
-       xor     ax, ax
-       mov     ds, ax
-       mov     es, ax
-       cli
-       mov     ss, ax                  ! ds = es = ss = Vector segment
-       mov     sp, #LOADOFF
-       sti
-
-! Copy this code to safety, then jump to it.
-       mov     si, sp                  ! si = start of this code
-       push    si                      ! Also where we'll return to eventually
-       mov     di, #BUFFER             ! Buffer area
-       mov     cx, #512/2              ! One sector
-       cld
-  rep  movs
-       jmpf    BUFFER+migrate, 0       ! To safety
-migrate:
-
-! Find the active partition
-findactive:
-       testb   dl, dl
-       jns     nextdisk                ! No bootable partitions on floppies
-       mov     si, #BUFFER+PART_TABLE
-find:  cmpb    sysind(si), #0          ! Partition type, nonzero when in use
-       jz      nextpart
-       testb   bootind(si), #0x80      ! Active partition flag in bit 7
-       jz      nextpart                ! It's not active
-loadpart:
-       call    load                    ! Load partition bootstrap
-       jc      error1                  ! Not supposed to fail
-bootstrap:
-       ret                             ! Jump to the master bootstrap
-nextpart:
-       add     si, #PENTRYSIZE
-       cmp     si, #BUFFER+PART_TABLE+4*PENTRYSIZE
-       jb      find
-! No active partition, tell 'em
-       call    print
-       .ascii  "No active partition\0"
-       jmp     reboot
-
-! There are no active partitions on this drive, try the next drive.
-nextdisk:
-       incb    dl                      ! Increment dl for the next drive
-       testb   dl, dl
-       js      nexthd                  ! Hard disk if negative
-       int     0x11                    ! Get equipment configuration
-       shl     ax, #1                  ! Highest floppy drive # in bits 6-7
-       shl     ax, #1                  ! Now in bits 0-1 of ah
-       andb    ah, #0x03               ! Extract bits
-       cmpb    dl, ah                  ! Must be dl <= ah for drive to exist
-       ja      nextdisk                ! Otherwise try disk 0 eventually
-       call    load0                   ! Read the next floppy bootstrap
-       jc      nextdisk                ! It failed, next disk please
-       ret                             ! Jump to the next master bootstrap
-nexthd:        call    load0                   ! Read the hard disk bootstrap
-error1:        jc      error                   ! No disk?
-       ret
-
-
-! Load sector 0 from the current device.  It's either a floppy bootstrap or
-! a hard disk master bootstrap.
-load0:
-       mov     si, #BUFFER+zero-lowsec ! si = where lowsec(si) is zero
-       !jmp    load
-
-! Load sector lowsec(si) from the current device.  The obvious head, sector,
-! and cylinder numbers are ignored in favour of the more trustworthy absolute
-! start of partition.
-load:
-       mov     di, #3          ! Three retries for floppy spinup
-retry: push    dx              ! Save drive code
-       push    es
-       push    di              ! Next call destroys es and di
-       movb    ah, #0x08       ! Code for drive parameters
-       int     0x13
-       pop     di
-       pop     es
-       andb    cl, #0x3F       ! cl = max sector number (1-origin)
-       incb    dh              ! dh = 1 + max head number (0-origin)
-       movb    al, cl          ! al = cl = sectors per track
-       mulb    dh              ! dh = heads, ax = heads * sectors
-       mov     bx, ax          ! bx = sectors per cylinder = heads * sectors
-       mov     ax, lowsec+0(si)
-       mov     dx, lowsec+2(si)! dx:ax = sector within drive
-       cmp     dx, #[1024*255*63-255]>>16  ! Near 8G limit?
-       jae     bigdisk
-       div     bx              ! ax = cylinder, dx = sector within cylinder
-       xchg    ax, dx          ! ax = sector within cylinder, dx = cylinder
-       movb    ch, dl          ! ch = low 8 bits of cylinder
-       divb    cl              ! al = head, ah = sector (0-origin)
-       xorb    dl, dl          ! About to shift bits 8-9 of cylinder into dl
-       shr     dx, #1
-       shr     dx, #1          ! dl[6..7] = high cylinder
-       orb     dl, ah          ! dl[0..5] = sector (0-origin)
-       movb    cl, dl          ! cl[0..5] = sector, cl[6..7] = high cyl
-       incb    cl              ! cl[0..5] = sector (1-origin)
-       pop     dx              ! Restore drive code in dl
-       movb    dh, al          ! dh = al = head
-       mov     bx, #LOADOFF    ! es:bx = where sector is loaded
-       mov     ax, #0x0201     ! Code for read, just one sector
-       int     0x13            ! Call the BIOS for a read
-       jmp     rdeval          ! Evaluate read result
-bigdisk:
-       mov     bx, dx          ! bx:ax = dx:ax = sector to read
-       pop     dx              ! Restore drive code in dl
-       push    si              ! Save si
-       mov     si, #BUFFER+ext_rw ! si = extended read/write parameter packet
-       mov     8(si), ax       ! Starting block number = bx:ax
-       mov     10(si), bx
-       movb    ah, #0x42       ! Extended read
-       int     0x13
-       pop     si              ! Restore si to point to partition entry
-       !jmp    rdeval
-rdeval:
-       jnc     rdok            ! Read succeeded
-       cmpb    ah, #0x80       ! Disk timed out?  (Floppy drive empty)
-       je      rdbad
-       dec     di
-       jl      rdbad           ! Retry count expired
-       xorb    ah, ah
-       int     0x13            ! Reset
-       jnc     retry           ! Try again
-rdbad: stc                     ! Set carry flag
-       ret
-rdok:  cmp     LOADOFF+MAGIC, #0xAA55
-       jne     nosig           ! Error if signature wrong
-       ret                     ! Return with carry still clear
-nosig: call    print
-       .ascii  "Not bootable\0"
-       jmp     reboot
-
-! A read error occurred, complain and hang
-error:
-       mov     si, #LOADOFF+errno+1
-prnum: movb    al, ah          ! Error number in ah
-       andb    al, #0x0F       ! Low 4 bits
-       cmpb    al, #10         ! A-F?
-       jb      digit           ! 0-9!
-       addb    al, #7          ! 'A' - ':'
-digit: addb    (si), al        ! Modify '0' in string
-       dec     si
-       movb    cl, #4          ! Next 4 bits
-       shrb    ah, cl
-       jnz     prnum           ! Again if digit > 0
-       call    print
-       .ascii  "Read error "
-errno: .ascii  "00\0"
-       !jmp    reboot
-
-reboot:
-       call    print
-       .ascii  ".  Hit any key to reboot.\0"
-       xorb    ah, ah          ! Wait for keypress
-       int     0x16
-       call    print
-       .ascii  "\r\n\0"
-       int     0x19
-
-! Print a message.
-print: pop     si              ! si = String following 'call print'
-prnext:        lodsb                   ! al = *si++ is char to be printed
-       testb   al, al          ! Null marks end
-       jz      prdone
-       movb    ah, #0x0E       ! Print character in teletype mode
-       mov     bx, #0x0001     ! Page 0, foreground color
-       int     0x10
-       jmp     prnext
-prdone:        jmp     (si)            ! Continue after the string
-
-.data
-
-! Extended read/write commands require a parameter packet.
-ext_rw:
-       .data1  0x10            ! Length of extended r/w packet
-       .data1  0               ! Reserved
-       .data2  1               ! Blocks to transfer (just one)
-       .data2  LOADOFF         ! Buffer address offset
-       .data2  0               ! Buffer address segment
-       .data4  0               ! Starting block number low 32 bits (tbfi)
-zero:  .data4  0               ! Starting block number high 32 bits
diff --git a/boot/minix.ack16.mk b/boot/minix.ack16.mk
deleted file mode 100644 (file)
index 0457602..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Makefile fragment to use Ack compiler (16-bit i86 target)
-ARCH=  i86
-LIBDIR=        /usr/lib/i86    # force
-
-CC:=${CC:C/.*[gp]cc/cc/:C/clang/cc/}
-AR=aal
-COMPILER_TYPE=ack
-OBJECT_FMT=a.out
-CPPFLAGS+=     -mi86
-AFLAGS+=       -mi86
-LDFLAGS+=      -mi86 -.o $(MINIXID)    # no crtso
-MINIXID?=      -com                    # common I+D default
diff --git a/boot/rawfs.c b/boot/rawfs.c
deleted file mode 100644 (file)
index 88ae6b0..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-/*     rawfs.c - Raw Minix file system support.        Author: Kees J. Bot
- *                                                             23 Dec 1991
- *                                          Based on readfs by Paul Polderman
- */
-#define _POSIX_SOURCE  1
-#define _MINIX         1
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <string.h>
-#include <errno.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <minix/type.h>
-#include <servers/mfs/const.h>
-#include <servers/mfs/type.h>
-#include <servers/mfs/super.h>
-#include <servers/mfs/inode.h>
-#include "rawfs.h"
-#include <servers/mfs/buf.h>
-
-void readblock(off_t blockno, char *buf, int);
-
-/* The following code handles two file system types: Version 1 with small
- * inodes and 16-bit disk addresses and Version 2 with big inodes and 32-bit
- * disk addresses.
-#ifdef FLEX
- * To make matters worse, Minix-vmd knows about the normal Unix Version 7
- * directories and directories with flexible entries.
-#endif
- */
-
-/* File system parameters. */
-static unsigned nr_dzones;     /* Fill these in after reading superblock. */
-static unsigned nr_indirects;
-static unsigned inodes_per_block;
-static int block_size;
-
-#if __minix_vmd
-static struct v12_super_block super;   /* Superblock of file system */
-#define s_log_zone_size s_dummy                /* Zones are obsolete. */
-#else
-static struct super_block super;       /* Superblock of file system */
-#define SUPER_V1 SUPER_MAGIC           /* V1 magic has a weird name. */
-#endif
-
-static struct inode curfil;            /* Inode of file under examination */
-static char indir[_MAX_BLOCK_SIZE];    /* Single indirect block. */
-static char dindir[_MAX_BLOCK_SIZE];   /* Double indirect block. */
-static char dirbuf[_MAX_BLOCK_SIZE];   /* Scratch/Directory block. */
-#define scratch dirbuf
-
-static block_t a_indir, a_dindir;      /* Addresses of the indirects. */
-static off_t dirpos;                   /* Reading pos in a dir. */
-
-#define fsbuf(b)       (* (union fsdata_u *) (b))
-
-#define        zone_shift      (super.s_log_zone_size) /* zone to block ratio */
-
-off_t r_super(int *bs)
-/* Initialize variables, return size of file system in blocks,
- * (zero on error).
- */
-{
-       /* Read superblock. (The superblock is always at 1kB offset,
-        * that's why we lie to readblock and say the block size is 1024
-        * and we want block number 1 (the 'second block', at offset 1kB).)
-        */
-       readblock(1, scratch, 1024);
-
-       memcpy(&super, scratch, sizeof(super));
-
-       /* Is it really a MINIX file system ? */
-       if (super.s_magic == SUPER_V2 || super.s_magic == SUPER_V3) {
-               if(super.s_magic == SUPER_V2)
-                       super.s_block_size = 1024;
-               *bs = block_size = super.s_block_size;
-               if(block_size < _MIN_BLOCK_SIZE ||
-                       block_size > _MAX_BLOCK_SIZE) {
-                       return 0;
-               }
-               nr_dzones= V2_NR_DZONES;
-               nr_indirects= V2_INDIRECTS(block_size);
-               inodes_per_block= V2_INODES_PER_BLOCK(block_size);
-               return (off_t) super.s_zones << zone_shift;
-       } else
-       if (super.s_magic == SUPER_V1) {
-               *bs = block_size = 1024;
-               nr_dzones= V1_NR_DZONES;
-               nr_indirects= V1_INDIRECTS;
-               inodes_per_block= V1_INODES_PER_BLOCK;
-               return (off_t) super.s_nzones << zone_shift;
-       } else {
-               /* Filesystem not recognized as Minix. */
-               return 0;
-       }
-}
-
-void r_stat(Ino_t inum, struct stat *stp)
-/* Return information about a file like stat(2) and remember it. */
-{
-       block_t block;
-       block_t ino_block;
-       ino_t ino_offset;
-       union fsdata_u *blockbuf;
-
-       /* Calculate start of i-list */
-       block = START_BLOCK + super.s_imap_blocks + super.s_zmap_blocks;
-
-       /* Calculate block with inode inum */
-       ino_block = ((inum - 1) / inodes_per_block);
-       ino_offset = ((inum - 1) % inodes_per_block);
-       block += ino_block;
-
-       /* Fetch the block */
-       blockbuf = (union fsdata_u *) scratch;
-       readblock(block, (char *) blockbuf, block_size);
-
-       if (super.s_magic == SUPER_V2 || super.s_magic == SUPER_V3) {
-               d2_inode *dip;
-               int i;
-
-               dip= &blockbuf->b__v2_ino[(unsigned int) ino_offset];
-
-               curfil.i_mode= dip->d2_mode;
-               curfil.i_nlinks= dip->d2_nlinks;
-               curfil.i_uid= dip->d2_uid;
-               curfil.i_gid= dip->d2_gid;
-               curfil.i_size= dip->d2_size;
-               curfil.i_atime= dip->d2_atime;
-               curfil.i_mtime= dip->d2_mtime;
-               curfil.i_ctime= dip->d2_ctime;
-               for (i= 0; i < V2_NR_TZONES; i++)
-                       curfil.i_zone[i]= dip->d2_zone[i];
-       } else {
-               d1_inode *dip;
-               int i;
-
-               dip= &blockbuf->b__v1_ino[(unsigned int) ino_offset];
-
-               curfil.i_mode= dip->d1_mode;
-               curfil.i_nlinks= dip->d1_nlinks;
-               curfil.i_uid= dip->d1_uid;
-               curfil.i_gid= dip->d1_gid;
-               curfil.i_size= dip->d1_size;
-               curfil.i_atime= dip->d1_mtime;
-               curfil.i_mtime= dip->d1_mtime;
-               curfil.i_ctime= dip->d1_mtime;
-               for (i= 0; i < V1_NR_TZONES; i++)
-                       curfil.i_zone[i]= dip->d1_zone[i];
-       }
-       curfil.i_dev= -1;       /* Can't fill this in alas. */
-       curfil.i_num= inum;
-
-       stp->st_dev= curfil.i_dev;
-       stp->st_ino= curfil.i_num;
-       stp->st_mode= curfil.i_mode;
-       stp->st_nlink= curfil.i_nlinks;
-       stp->st_uid= curfil.i_uid;
-       stp->st_gid= curfil.i_gid;
-       stp->st_rdev= (dev_t) curfil.i_zone[0];
-       stp->st_size= curfil.i_size;
-       stp->st_atime= curfil.i_atime;
-       stp->st_mtime= curfil.i_mtime;
-       stp->st_ctime= curfil.i_ctime;
-
-       a_indir= a_dindir= 0;
-       dirpos= 0;
-}
-
-ino_t r_readdir(char *name)
-/* Read next directory entry at "dirpos" from file "curfil". */
-{
-       ino_t inum= 0;
-       int blkpos;
-       struct direct *dp;
-
-       if (!S_ISDIR(curfil.i_mode)) { errno= ENOTDIR; return -1; }
-
-       if(!block_size) { errno = 0; return -1; }
-
-       while (inum == 0 && dirpos < curfil.i_size) {
-               if ((blkpos= (int) (dirpos % block_size)) == 0) {
-                       /* Need to fetch a new directory block. */
-
-                       readblock(r_vir2abs(dirpos / block_size), dirbuf, block_size);
-               }
-               /* Let dp point to the next entry. */
-               dp= (struct direct *) (dirbuf + blkpos);
-
-               if ((inum= dp->mfs_d_ino) != 0) {
-                       /* This entry is occupied, return name. */
-                       strncpy(name, dp->mfs_d_name, sizeof(dp->mfs_d_name));
-                       name[sizeof(dp->mfs_d_name)]= 0;
-               }
-               dirpos+= DIR_ENTRY_SIZE;
-       }
-       return inum;
-}
-
-off_t r_vir2abs(off_t virblk)
-/* Translate a block number in a file to an absolute disk block number.
- * Returns 0 for a hole and -1 if block is past end of file.
- */
-{
-       block_t b= virblk;
-       zone_t zone, ind_zone;
-       block_t z, zone_index;
-       int i;
-
-       if(!block_size) return -1;
-
-       /* Check if virblk within file. */
-       if (virblk * block_size >= curfil.i_size) return -1;
-
-       /* Calculate zone in which the datablock number is contained */
-       zone = (zone_t) (b >> zone_shift);
-
-       /* Calculate index of the block number in the zone */
-       zone_index = b - ((block_t) zone << zone_shift);
-
-       /* Go get the zone */
-       if (zone < (zone_t) nr_dzones) {        /* direct block */
-               zone = curfil.i_zone[(int) zone];
-               z = ((block_t) zone << zone_shift) + zone_index;
-               return z;
-       }
-
-       /* The zone is not a direct one */
-       zone -= (zone_t) nr_dzones;
-
-       /* Is it single indirect ? */
-       if (zone < (zone_t) nr_indirects) {     /* single indirect block */
-               ind_zone = curfil.i_zone[nr_dzones];
-       } else {                        /* double indirect block */
-               /* Fetch the double indirect block */
-               if ((ind_zone = curfil.i_zone[nr_dzones + 1]) == 0) return 0;
-
-               z = (block_t) ind_zone << zone_shift;
-               if (a_dindir != z) {
-                       readblock(z, dindir, block_size);
-                       a_dindir= z;
-               }
-               /* Extract the indirect zone number from it */
-               zone -= (zone_t) nr_indirects;
-
-               i = zone / (zone_t) nr_indirects;
-               ind_zone = (super.s_magic == SUPER_V2 || super.s_magic == SUPER_V3)
-                               ? fsbuf(dindir).b__v2_ind[i]
-                               : fsbuf(dindir).b__v1_ind[i];
-               zone %= (zone_t) nr_indirects;
-       }
-       if (ind_zone == 0) return 0;
-
-       /* Extract the datablock number from the indirect zone */
-       z = (block_t) ind_zone << zone_shift;
-       if (a_indir != z) {
-               readblock(z, indir, block_size);
-               a_indir= z;
-       }
-       zone = (super.s_magic == SUPER_V2 || super.s_magic == SUPER_V3)
-               ? fsbuf(indir).b__v2_ind[(int) zone]
-               : fsbuf(indir).b__v1_ind[(int) zone];
-
-       /* Calculate absolute datablock number */
-       z = ((block_t) zone << zone_shift) + zone_index;
-       return z;
-}
-
-ino_t r_lookup(Ino_t cwd, const char *path)
-/* Translates a pathname to an inode number.  This is just a nice utility
- * function, it only needs r_stat and r_readdir.
- */
-{
-       char name[MFS_DIRSIZ+1], r_name[MFS_DIRSIZ+1];
-       char *n;
-       struct stat st;
-       ino_t ino;
-
-       ino= path[0] == '/' ? ROOT_INO : cwd;
-
-       for (;;) {
-               if (ino == 0) {
-                       errno= ENOENT;
-                       return 0;
-               }
-
-               while (*path == '/') path++;
-
-               if (*path == 0) return ino;
-
-               r_stat(ino, &st);
-
-               if (!S_ISDIR(st.st_mode)) {
-                       errno= ENOTDIR;
-                       return 0;
-               }
-
-               n= name;
-               while (*path != 0 && *path != '/')
-                       if (n < name + MFS_DIRSIZ) *n++ = *path++;
-               *n= 0;
-
-               while ((ino= r_readdir(r_name)) != 0
-                                       && strcmp(name, r_name) != 0) {
-               }
-       }
-}
-
-/*
- * $PchId: rawfs.c,v 1.8 1999/11/05 23:14:15 philip Exp $
- */
diff --git a/boot/rawfs.h b/boot/rawfs.h
deleted file mode 100644 (file)
index 81fa1a6..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*     rawfs.h - Raw Minix file system support.        Author: Kees J. Bot
- *
- *             off_t r_super(int *block_size);
- *                     Initialize variables, returns the size of a valid Minix
- *                     file system blocks, but zero on error. 
- *
- *             void r_stat(ino_t file, struct stat *stp);
- *                     Return information about a file like stat(2) and
- *                     remembers file for the next two calls.
- *
- *             off_t r_vir2abs(off_t virblockno);
- *                     Translate virtual block number in file to absolute
- *                     disk block number.  Returns 0 if the file contains
- *                     a hole, or -1 if the block lies past the end of file.
- *
- *             ino_t r_readdir(char *name);
- *                     Return next directory entry or 0 if there are no more.
- *                     Returns -1 and sets errno on error.
- *
- *             ino_t r_lookup(ino_t cwd, const char *path);
- *                     A utility function that translates a pathname to an
- *                     inode number.  It starts from directory "cwd" unless
- *                     path starts with a '/', then from ROOT_INO.
- *                     Returns 0 and sets errno on error.
- *
- *     One function needs to be provided by the outside world:
- *
- *             void readblock(off_t blockno, char *buf, int block_size);
- *                     Read a block into the buffer.  Outside world handles
- *                     errors.
- */
-
-#ifndef INC_RAWFS_H
-#define INC_RAWFS_H
-
-#include <minix/dirent.h>
-#include <servers/mfs/mfsdir.h>
-
-#define ROOT_INO       ((ino_t) 1)     /* Inode nr of root dir. */
-
-extern off_t r_super(int *);
-extern void r_stat(Ino_t file, struct stat *stp);
-extern off_t r_vir2abs(off_t virblockno);
-extern ino_t r_readdir(char *name);
-extern ino_t r_lookup(Ino_t cwd, const char *path);
-
-/*
- * $PchId: rawfs.h,v 1.4 1996/04/19 08:16:36 philip Exp $
- */
-
-#endif
diff --git a/boot/updateboot.sh b/boot/updateboot.sh
deleted file mode 100755 (executable)
index 37ae083..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-set -e
-
-MDEC=/usr/mdec
-BOOT=/boot/boot
-ROOT=`printroot -r`
-
-if [ ! -b "$ROOT" ]
-then   echo root device $ROOT not found
-       exit 1
-fi
-
-echo -n "Install boot as $BOOT on current root and patch into $ROOT? (y/N) "
-read ans
-
-if [ ! "$ans" = y ]
-then   echo Aborting.
-       exit 1
-fi
-
-make install || true
-
-echo Installing boot monitor into $BOOT.
-cp $MDEC/boot $BOOT
-
-echo Patching position of $BOOT into $ROOT.
-installboot_minix -d "$ROOT" $MDEC/bootblock $BOOT
-sync
diff --git a/commands/M/M.sh b/commands/M/M.sh
deleted file mode 100644 (file)
index da6beb7..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-#      M, U - mount or unmount standard devices.
-
-case $#:$2 in
-1:|2:-r)       ;;
-*)     echo "Usage: $0 <abbreviation> [-r]" >&2; exit 1
-esac
-
-. /etc/fstab
-
-dev=$1 dir=$1
-
-case $1 in
-0)     dev=/dev/fd0 dir=fd0 ;;
-1)     dev=/dev/fd1 dir=fd1 ;;
-PS0|at0|fd0|pat0|pc0|ps0)      dev=/dev/$dev dir=fd0 ;;
-PS1|at1|fd1|pat1|pc1|ps1)      dev=/dev/$dev dir=fd1 ;;
-root)  dev=$root ;;
-tmp)   dev=$tmp ;;
-usr)   dev=$usr ;;
-*)     dev=/dev/$dev dir=mnt
-esac
-
-case $0 in
-*M)    mount $dev /$dir $2 ;;
-*U)    umount $dev
-esac
diff --git a/commands/M/Makefile b/commands/M/Makefile
deleted file mode 100644 (file)
index e8659d7..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-SCRIPTS= M.sh
-BINDIR=        /bin
-MAN=
-
-LINKS+=        ${BINDIR}/M ${BINDIR}/U
-
-.include <bsd.prog.mk>
index db18898b2e8eba0dc893c3a510ed1481dd7861b4..c8bc047498c613e2a71bac1c6c85a3c1fc2383f1 100644 (file)
@@ -2,22 +2,22 @@
 
 .include <bsd.own.mk>
 
-SUBDIR=        aal add_route arp ash at autil awk \
-       backup badblocks banner basename binpackage \
-       binpackages btrace cal calendar \
-       cat cawf cd  cdprobe checkhier chmem \
+SUBDIR=        add_route arp ash at autil awk \
+       backup badblocks banner basename \
+       btrace cal calendar \
+       cat cawf cd  cdprobe checkhier \
        chmod chown chroot ci cksum cleantmp clear cmp co \
-       comm compress cp crc cron crontab cut date \
+       comm compress cp crc cron crontab cut \
        dd decomp16 DESCRIBE dev2name devsize df dhcpd \
-       dhrystone diff dirname  dis386 dis88 diskctl du dumpcore \
+       dhrystone diff dirname diskctl du dumpcore \
        ed eject elle elvis env expand factor fbdctl file \
        find finger fingerd fix fold format fortune fsck.mfs \
        ftp101 gcore gcov-pull getty grep head hexdump host \
        hostaddr id ifconfig ifdef install \
        intr ipcrm ipcs irdpd isoread join kill last leave \
        less lex loadkeys loadramdisk logger login look lp \
-       lpd ls lspci mail make  MAKEDEV \
-       mdb  mesg mined ackmkdep mkfifo mkfs.mfs mknod \
+       lpd ls lspci mail make  MAKEDEV \
+       mdb  mesg mined mkfifo mkfs.mfs mknod \
        mkproto modem mount mt netconf newroot nice acknm nohup \
        nonamed od paste patch pax \
        ping postinstall poweroff pr prep printf printroot \
@@ -25,7 +25,7 @@ SUBDIR=       aal add_route arp ash at autil awk \
        ramdisk rarpd rawspeed rcp rdate readall readclock \
        reboot remsync rev rget rlogin rlogind \
        rotate rsh rshd sed service setup shar acksize \
-       sleep slip sort spell split srccrc ackstrip \
+       sleep slip sort spell split srccrc \
        stty su sum svclog swifi sync synctree sysenv \
        syslogd tail tar tcpd tcpdp tcpstat tee telnet \
        telnetd term termcap tget time touch tr \
@@ -35,15 +35,10 @@ SUBDIR=     aal add_route arp ash at autil awk \
        xargs yacc yes zdump zmodem pkgin_cd \
        mktemp worldstone
 
-.if ${COMPILER_TYPE} == "gnu"
-SUBDIR += elf2aout
-.endif
-
 .if ${ARCH} == "i386"
 SUBDIR+=       atnormalize dosread fdisk loadfont \
-       autopart part partition playwave postmort \
-       recwave repartition screendump padtext
-SUBDIR+=       acd asmconv gas2ack
+       autopart part partition playwave  \
+       recwave repartition screendump
 .endif
 
 .include <bsd.subdir.mk>
index adbe8e78741f11af23237022110edfc9e29ff50d..2dcded8a48348f1eec4fb130408d03db642754a0 100644 (file)
@@ -1,14 +1,3 @@
-# Any of the commands can force the new libc being used by 
-# setting NEED_NBSDLIBC
-.if defined(NEED_NBSDLIBC)
-.include <minix.newlibc.mk>
-.endif
-
-.if (${NBSD_LIBC} != "no")
 CPPFLAGS+= -D_MINIX -D_NETBSD_SOURCE -D_MINIX_COMPAT
 LDADD+= -lminlib -lcompat_minix -lasyn -lterminfo
-.else
-CPPFLAGS+= -D_MINIX -D_POSIX_SOURCE
-.endif
-
 BINDIR?=/usr/bin
diff --git a/commands/aal/Makefile b/commands/aal/Makefile
deleted file mode 100644 (file)
index 44c35dc..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# Makefile for aal
-
-PROG=  aal
-SRCS=  archiver.c print.c rd.c rd_arhdr.c rd_unsig2.c sprint.c \
-       wr_arhdr.c wr_bytes.c wr_int2.c wr_long.c wr_ranlib.c \
-       format.c rd_bytes.c system.c write.c long2str.c
-CPPFLAGS+= -I${.CURDIR} -DAAL -DSTB -DNDEBUG -DDISTRIBUTION
-
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/aal/arch.h b/commands/aal/arch.h
deleted file mode 100644 (file)
index eefd125..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-
-#ifndef __ARCH_H_INCLUDED
-#define __ARCH_H_INCLUDED
-
-#define        ARMAG   0177545
-#define AALMAG 0177454
-
-struct ar_hdr {
-       char    ar_name[14];
-       long    ar_date;
-       char    ar_uid;
-       char    ar_gid;
-       short   ar_mode;
-       long    ar_size;
-};
-
-#define AR_TOTAL       26
-#define AR_SIZE                22
-
-extern int rd_arhdr(int fd, register struct ar_hdr arhdr[]);
-extern void wr_arhdr(int fd, struct ar_hdr arhdr[]);
-
-#endif /* __ARCH_H_INCLUDED */
diff --git a/commands/aal/archiver.c b/commands/aal/archiver.c
deleted file mode 100644 (file)
index 1cdff42..0000000
+++ /dev/null
@@ -1,816 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* ar - archiver               Author: Michiel Huisjes */
-/* Made into arch/aal by Ceriel Jacobs
-*/
-
-#include <sys/types.h>
-#include <fcntl.h>
-
-#include "rd.h"
-#include "wr_bytes.h"
-#include "wr_long.h"
-#include "wr_int2.h"
-#include "arch.h"
-#include "archiver.h"
-#include "print.h"
-
-static char RcsId[] = "$Header$";
-
-/*
- * Usage: [arch|aal] [adprtvx] archive [file] ...
- *       v: verbose
- *       x: extract
- *       a: append
- *       r: replace (append when not in archive)
- *       d: delete
- *       t: print contents of archive
- *       p: print named files
- *       l: temporaries in current directory instead of /usr/tmp
- *       c: don't give "create" message
- *       u: replace only if dated later than member in archive
-#ifdef DISTRIBUTION
- *       D: make distribution: use distr_time, uid=2, gid=2, mode=0644
-#endif
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#ifdef __NBSD_LIBC
-#include <sys/time.h>
-#endif
-#ifndef        S_IREAD
-#define        S_IREAD         S_IRUSR
-#endif
-#ifndef        S_IWRITE
-#define        S_IWRITE        S_IWUSR
-#endif
-#ifndef        S_IEXEC
-#define        S_IEXEC         S_IXUSR
-#endif
-#include <signal.h>
-#include <arch.h>
-#ifdef AAL
-#include <ranlib.h>
-#include <out.h>
-#define MAGIC_NUMBER   AALMAG
-long   offset;
-struct ranlib *tab;
-unsigned int   tnum = 0;
-char   *tstrtab;
-unsigned int   tssiz = 0;
-long   time();
-unsigned int tabsz, strtabsz;
-#else
-#define MAGIC_NUMBER   ARMAG
-#endif
-long   lseek();
-
-#define odd(nr)                (nr & 01)
-#define even(nr)       (odd(nr) ? nr + 1 : nr)
-
-typedef char BOOL;
-#define FALSE          0
-#define TRUE           1
-
-#define READ           0
-#define APPEND         2
-#define CREATE         1
-
-#define MEMBER         struct ar_hdr
-
-#define IO_SIZE                (10 * 1024)
-
-#define equal(str1, str2)      (!strncmp((str1), (str2), 14))
-#ifndef S_ISDIR
-#define S_ISDIR(m)     (m & S_IFDIR)           /* is a directory */
-#endif
-
-BOOL verbose;
-BOOL app_fl;
-BOOL ex_fl;
-BOOL show_fl;
-BOOL pr_fl;
-BOOL rep_fl;
-BOOL del_fl;
-BOOL nocr_fl;
-BOOL local_fl;
-BOOL update_fl;
-#ifdef DISTRIBUTION
-BOOL distr_fl;
-long distr_time;
-#endif
-
-int ar_fd;
-
-char io_buffer[IO_SIZE];
-
-char *progname;
-
-char temp_buf[32];
-char *temp_arch = &temp_buf[0];
-extern char *mktemp();
-extern char *ctime();
-
-/* Forward declarations. */
-static void enter_name(struct outname *namep);
-static void do_names(struct outhead *headp);
-static void do_object(int f, long size);
-static void show(char *s, char *name);
-static void write_symdef(void);
-static void mwrite(int fd, char *address, int bytes);
-static void extract(register MEMBER *member);
-static void copy_member(MEMBER *member, int from, int to, int extracting);
-static void add(char *name, int fd, char *mess);
-static void get(int argc, char *argv[]);
-
-/*VARARGS2*/
-void error1(BOOL quit, char *str1)
-{
-       fputs(str1,stderr);
-       if (quit) {
-               unlink(temp_arch);
-               _exit(1);
-       }
-}
-
-void error2(BOOL quit, char *str1, char *str2)
-{
-       fprintf(stderr,str1,str2);
-       if (quit) {
-               unlink(temp_arch);
-               _exit(1);
-       }
-}
-
-void error3(BOOL quit, char *str1, char *str2, char *str3)
-{
-       fprintf(stderr,str1,str2,str3);
-       if (quit) {
-               unlink(temp_arch);
-               _exit(1);
-       }
-}
-
-void usage()
-{
-       error3(TRUE, "usage: %s %s archive [file] ...\n",
-               progname,
-#ifdef AAL
-               "[acdrtxvlu]"
-#else
-               "[acdprtxvlu]"
-#endif
-               );
-}
-
-char *basename(char *path)
-{
-  register char *ptr = path;
-  register char *last = NULL;
-
-  while (*ptr != '\0') {
-       if (*ptr == '/')
-               last = ptr;
-       ptr++;
-  }
-  if (last == NULL)
-       return path;
-  if (*(last + 1) == '\0') {
-       *last = '\0';
-       return basename(path);
-  }
-  return last + 1;
-}
-
-extern unsigned int rd_unsigned2();
-
-int open_archive(char *name, int mode)
-{
-  unsigned short magic = 0;
-  int fd;
-
-  if (mode == CREATE) {
-       if ((fd = creat(name, 0666)) < 0)
-               error2(TRUE, "cannot creat %s\n", name);
-       magic = MAGIC_NUMBER;
-       wr_int2(fd, magic);
-       return fd;
-  }
-
-  if ((fd = open(name, mode)) < 0) {
-       if (mode == APPEND) {
-               close(open_archive(name, CREATE));
-               if (!nocr_fl) error3(FALSE, "%s: creating %s\n", progname, name);
-               return open_archive(name, APPEND);
-       }
-       error2(TRUE, "cannot open %s\n", name);
-  }
-  lseek(fd, 0L, 0);
-  magic = rd_unsigned2(fd);
-  if (magic != AALMAG && magic != ARMAG)
-       error2(TRUE, "%s is not in ar format\n", name);
-  
-  return fd;
-}
-
-#if __STDC__
-void catch(int sig)
-#else
-catch()
-#endif
-{
-       unlink(temp_arch);
-       _exit (2);
-}
-
-int main(int argc, char *argv[])
-{
-  register char *ptr;
-  int needs_arg = 0;
-
-  progname = argv[0];
-
-  if (argc < 3)
-       usage();
-  
-  for (ptr = argv[1]; *ptr; ptr++) {
-       switch (*ptr) {
-               case 't' :
-                       show_fl = TRUE;
-                       break;
-               case 'v' :
-                       verbose = TRUE;
-                       break;
-               case 'x' :
-                       ex_fl = TRUE;
-                       break;
-               case 'a' :
-                       needs_arg = 1;
-                       app_fl = TRUE;
-                       break;
-               case 'c' :
-                       nocr_fl = TRUE;
-                       break;
-#ifndef AAL
-               case 'p' :
-                       needs_arg = 1;
-                       pr_fl = TRUE;
-                       break;
-#endif
-               case 'd' :
-                       needs_arg = 1;
-                       del_fl = TRUE;
-                       break;
-               case 'r' :
-                       needs_arg = 1;
-                       rep_fl = TRUE;
-                       break;
-               case 'l' :
-                       local_fl = TRUE;
-                       break;
-               case 'u' :
-                       update_fl = TRUE;
-                       break;
-#ifdef DISTRIBUTION
-               case 'D' :
-                       distr_fl = TRUE;
-                       break;
-#endif
-               default :
-                       usage();
-       }
-  }
-
-  if (needs_arg && argc <= 3)
-       usage();
-#ifdef DISTRIBUTION
-  if (distr_fl) {
-       struct stat statbuf;
-
-       stat(progname, &statbuf);
-       distr_time = statbuf.st_mtime;
-  }
-#endif
-  if (local_fl) strcpy(temp_arch, "ar.XXXXXX");
-  else strcpy(temp_arch, "/usr/tmp/ar.XXXXXX");
-
-  if (app_fl + ex_fl + del_fl + rep_fl + show_fl + pr_fl != 1)
-       usage();
-
-  if (update_fl && !rep_fl)
-       usage();
-
-  if (rep_fl || del_fl
-#ifdef AAL
-       || app_fl
-#endif
-     ) {
-       mktemp(temp_arch);
-  }
-#ifdef AAL
-  tab = (struct ranlib *) malloc(512 * sizeof(struct ranlib));
-  tstrtab = malloc(4096);
-  if (!tab || !tstrtab) error1(TRUE,"Out of core\n");
-  tabsz = 512;
-  strtabsz = 4096;
-#endif
-
-  signal(SIGINT, catch);
-  get(argc, argv);
-  
-  return 0;
-}
-
-MEMBER *
-get_member()
-{
-  static MEMBER member;
-
-again:
-  if (rd_arhdr(ar_fd, &member) == 0)
-       return NULL;
-  if (member.ar_size < 0) {
-       error1(TRUE, "archive has member with negative size\n");
-  }
-#ifdef AAL
-  if (equal(SYMDEF, member.ar_name)) {
-       lseek(ar_fd, member.ar_size, 1);
-       goto again;
-  }
-#endif
-  return &member;
-}
-
-char *get_mode();
-
-static void get(int argc, char *argv[])
-{
-  register MEMBER *member;
-  int i = 0;
-  int temp_fd, read_chars;
-
-  ar_fd = open_archive(argv[2], (show_fl || pr_fl || ex_fl) ? READ : APPEND);
-  if (rep_fl || del_fl
-#ifdef AAL
-       || app_fl
-#endif
-  )
-       temp_fd = open_archive(temp_arch, CREATE);
-  while ((member = get_member()) != NULL) {
-       if (argc > 3) {
-               for (i = 3; i < argc; i++) {
-                       if (equal(basename(argv[i]), member->ar_name))
-                               break;
-               }
-               if (i == argc || app_fl) {
-                       if (rep_fl || del_fl
-#ifdef AAL
-                               || app_fl
-#endif
-                       ) {
-#ifdef AAL
-                               if (i != argc) {
-                                       print("%s: already in archive\n", argv[i]);
-                                       argv[i] = "";
-                               }
-#endif
-                               wr_arhdr(temp_fd, member);
-                               copy_member(member, ar_fd, temp_fd, 0);
-                       }
-                       else {
-#ifndef AAL
-                               if (app_fl && i != argc) {
-                                       print("%s: already in archive\n", argv[i]);
-                                       argv[i] = "";
-                               }
-#endif
-                               lseek(ar_fd, even(member->ar_size),1);
-                       }
-                       continue;
-               }
-       }
-       if (ex_fl || pr_fl)
-               extract(member);
-       else {
-               if (rep_fl) {
-                       int isold = 0;
-                       if(update_fl) {
-                               struct stat status;
-                               if (stat(argv[i], &status) >= 0) {
-                                       if(status.st_mtime <= member->ar_date)
-                                               isold = 1;
-                               }
-                       }
-                       if(!isold)
-                               add(argv[i], temp_fd, "r - %s\n");
-                       else {
-                               wr_arhdr(temp_fd, member);
-                               copy_member(member, ar_fd, temp_fd, 0);
-                               if(verbose)
-                                       show("r - %s (old)\n", member->ar_name);
-                       }
-               }
-               else if (show_fl) {
-                       char buf[sizeof(member->ar_name) + 2];
-                       register char *p = buf, *q = member->ar_name;
-
-                       while (q <= &member->ar_name[sizeof(member->ar_name)-1] && *q) {
-                               *p++ = *q++;
-                       }
-                       *p++ = '\n';
-                       *p = '\0';
-                       if (verbose) {
-                               char *mode = get_mode(member->ar_mode);
-                               char *date = ctime(&(member->ar_date));
-
-                               *(date + 16) = '\0';
-                               *(date + 24) = '\0';
-
-                               print("%s%3u/%u%7ld %s %s %s",
-                                       mode,
-                                       (unsigned) (member->ar_uid & 0377),
-                                       (unsigned) (member->ar_gid & 0377),
-                                       member->ar_size,
-                                       date+4,
-                                       date+20,
-                                       buf);
-                       }
-                       else    print(buf);
-               }
-               else if (del_fl)
-                       show("d - %s\n", member->ar_name);
-               lseek(ar_fd, even(member->ar_size), 1);
-       }
-       argv[i] = "";
-  }
-
-  if (argc > 3) {
-       for (i = 3; i < argc; i++)
-               if (argv[i][0] != '\0') {
-#ifndef AAL
-                       if (app_fl)
-                               add(argv[i], ar_fd, "a - %s\n");
-                       else
-#endif
-                       if (rep_fl
-#ifdef AAL
-                               || app_fl
-#endif
-                       )
-                               add(argv[i], temp_fd, "a - %s\n");
-                       else {
-                               print("%s: not found\n", argv[i]);
-                       }
-               }
-  }
-
-  if (rep_fl || del_fl
-#ifdef AAL
-               || app_fl
-#endif
-  ) {
-       signal(SIGINT, SIG_IGN);
-       close(ar_fd);
-       close(temp_fd);
-       ar_fd = open_archive(argv[2], CREATE);
-       temp_fd = open_archive(temp_arch, APPEND);
-#ifdef AAL
-       write_symdef();
-#endif
-       while ((read_chars = read(temp_fd, io_buffer, IO_SIZE)) > 0)
-               mwrite(ar_fd, io_buffer, read_chars);
-       close(temp_fd);
-       unlink(temp_arch);
-  }
-  close(ar_fd);
-}
-
-static void add(char *name, int fd, char *mess)
-{
-  static MEMBER member;
-  register int read_chars;
-  struct stat status;
-  int src_fd;
-
-  if (stat(name, &status) < 0) {
-       error2(FALSE, "cannot find %s\n", name);
-       return;
-  }
-  else if (S_ISDIR(status.st_mode)) {
-       error2(FALSE, "%s is a directory (ignored)\n", name);
-       return;
-  }
-  else if ((src_fd = open(name, 0)) < 0) {
-       error2(FALSE, "cannot open %s\n", name);
-       return;
-  }
-
-  strncpy (member.ar_name, basename (name), sizeof(member.ar_name));
-  member.ar_uid = status.st_uid;
-  member.ar_gid = status.st_gid;
-  member.ar_mode = status.st_mode;
-  member.ar_date = status.st_mtime;
-  member.ar_size = status.st_size;
-#ifdef DISTRIBUTION
-  if (distr_fl) {
-       member.ar_uid = 2;
-       member.ar_gid = 2;
-       member.ar_mode = 0644;
-       member.ar_date = distr_time;
-  }
-#endif
-  wr_arhdr(fd, &member);
-#ifdef AAL
-  do_object(src_fd, member.ar_size);
-  lseek(src_fd, 0L, 0);
-  offset += AR_TOTAL + even(member.ar_size);
-#endif
-  while (status.st_size > 0) {
-       int x = IO_SIZE;
-
-       read_chars = x;
-       if (status.st_size < x) {
-               x = status.st_size;
-               read_chars = x;
-               status.st_size = 0;
-               x = even(x);
-       }
-       else    status.st_size -= x;
-       if (read(src_fd, io_buffer, read_chars) != read_chars) {
-               error2(FALSE,"%s seems to shrink\n", name);
-               break;
-       }
-       mwrite(fd, io_buffer, x);
-  }
-
-  if (verbose)
-       show(mess, member.ar_name);
-  close(src_fd);
-}
-
-static void extract(register MEMBER *member)
-{
-  int fd = 1;
-  char buf[sizeof(member->ar_name) + 1];
-
-  strncpy(buf, member->ar_name, sizeof(member->ar_name));
-  buf[sizeof(member->ar_name)] = 0;
-  if (pr_fl == FALSE && (fd = creat(buf, 0666)) < 0) {
-       error2(FALSE, "cannot create %s\n", buf);
-       fd = -1;
-  }
-
-  if (verbose) {
-       if (pr_fl == FALSE) show("x - %s\n", buf);
-       else show("\n<%s>\n\n", buf);
-  }
-
-  copy_member(member, ar_fd, fd, 1);
-
-  if (fd >= 0 && fd != 1)
-       close(fd);
-  if (pr_fl == FALSE) chmod(buf, member->ar_mode);
-}
-
-static void copy_member(MEMBER *member, int from, int to, int extracting)
-{
-  register int rest;
-  long mem_size = member->ar_size;
-  BOOL is_odd = odd(mem_size) ? TRUE : FALSE;
-
-#ifdef AAL
-  if (! extracting) {
-       long pos = lseek(from, 0L, 1);
-
-       do_object(from, mem_size);
-       offset += AR_TOTAL + even(mem_size);
-       lseek(from, pos, 0);
-  }
-#endif
-  do {
-       rest = mem_size > (long) IO_SIZE ? IO_SIZE : (int) mem_size;
-       if (read(from, io_buffer, rest) != rest) {
-               char buf[sizeof(member->ar_name) + 1];
-
-               strncpy(buf, member->ar_name, sizeof(member->ar_name));
-               buf[sizeof(member->ar_name)] = 0;
-               error2(TRUE, "read error on %s\n", buf);
-       }
-       if (to >= 0) mwrite(to, io_buffer, rest);
-       mem_size -= (long) rest;
-  } while (mem_size > 0L);
-
-  if (is_odd) {
-       lseek(from, 1L, 1);
-       if (to >= 0 && ! extracting)
-               lseek(to, 1L, 1);
-  }
-}
-
-char *
-get_mode(mode)
-register int mode;
-{
-  static char mode_buf[11];
-  register int tmp = mode;
-  int i;
-
-  mode_buf[9] = ' ';
-  for (i = 0; i < 3; i++) {
-       mode_buf[i * 3] = (tmp & S_IREAD) ? 'r' : '-';
-       mode_buf[i * 3 + 1] = (tmp & S_IWRITE) ? 'w' : '-';
-       mode_buf[i * 3 + 2] = (tmp & S_IEXEC) ? 'x' : '-';
-       tmp <<= 3;
-  }
-  if (mode & S_ISUID)
-       mode_buf[2] = 's';
-  if (mode & S_ISGID)
-       mode_buf[5] = 's';
-  return mode_buf;
-}
-
-void wr_fatal()
-{
-       error1(TRUE, "write error\n");
-}
-
-void rd_fatal()
-{
-       error1(TRUE, "read error\n");
-}
-
-static void mwrite(int fd, char *address, int bytes)
-{
-  if (write(fd, address, bytes) != bytes)
-       error1(TRUE, "write error\n");
-}
-
-static void show(char *s, char *name)
-{
-  MEMBER x;
-  char buf[sizeof(x.ar_name)+1];
-  register char *p = buf, *q = name;
-
-  while (q <= &name[sizeof(x.ar_name)-1] && *q) *p++ = *q++;
-  *p++ = '\0';
-  print(s, buf);
-}
-
-#ifdef AAL
-/*
- * Write out the ranlib table: first 4 bytes telling how many ranlib structs
- * there are, followed by the ranlib structs,
- * then 4 bytes giving the size of the string table, followed by the string
- * table itself.
- */
-static void write_symdef(void)
-{
-       register struct ranlib  *ran;
-       register int    i;
-       register long   delta;
-       MEMBER  arbuf;
-
-       if (odd(tssiz))
-               tstrtab[tssiz++] = '\0';
-       for (i = 0; i < sizeof(arbuf.ar_name); i++)
-               arbuf.ar_name[i] = '\0';
-       strcpy(arbuf.ar_name, SYMDEF);
-       arbuf.ar_size = 4 + 2 * 4 * (long)tnum + 4 + (long)tssiz;
-       time(&arbuf.ar_date);
-       arbuf.ar_uid = getuid();
-       arbuf.ar_gid = getgid();
-       arbuf.ar_mode = 0444;
-#ifdef DISTRIBUTION
-       if (distr_fl) {
-               arbuf.ar_uid = 2;
-               arbuf.ar_gid = 2;
-               arbuf.ar_date = distr_time;
-       }
-#endif
-       wr_arhdr(ar_fd,&arbuf);
-       wr_long(ar_fd, (long) tnum);
-       /*
-        * Account for the space occupied by the magic number
-        * and the ranlib table.
-        */
-       delta = 2 + AR_TOTAL + arbuf.ar_size;
-       for (ran = tab; ran < &tab[tnum]; ran++) {
-               ran->ran_pos += delta;
-       }
-
-       wr_ranlib(ar_fd, tab, (long) tnum);
-       wr_long(ar_fd, (long) tssiz);
-       wr_bytes(ar_fd, tstrtab, (long) tssiz);
-}
-
-/*
- * Return whether the bytes in `buf' form a good object header. 
- * The header is put in `headp'.
- */
-int
-is_outhead(register struct outhead *headp)
-{
-       return !BADMAGIC(*headp) && headp->oh_nname != 0;
-}
-
-static void do_object(int f, long size)
-{
-       struct outhead  headbuf;
-
-       if (size < SZ_HEAD) {
-               /* It can't be an object file. */
-               return;
-       }
-       /*
-        * Read a header to see if it is an object file.
-        */
-       if (! rd_fdopen(f)) {
-               rd_fatal();
-       }
-       rd_ohead(&headbuf);
-       if (!is_outhead(&headbuf)) {
-               return;
-       }
-       do_names(&headbuf);
-}
-
-/*
- * First skip the names and read in the string table, then seek back to the
- * name table and read and write the names one by one. Update the ranlib table
- * accordingly.
- */
-static void do_names(struct outhead    *headp)
-{
-       register char   *strings;
-       register int    nnames = headp->oh_nname;
-#define NNAMES 100
-       struct outname  namebuf[NNAMES];
-       long xxx = OFF_CHAR(*headp);
-
-       if (    headp->oh_nchar != (unsigned int)headp->oh_nchar ||
-               (strings = malloc((unsigned int)headp->oh_nchar)) == (char *)0
-          ) {
-               error1(TRUE, "string table too big\n");
-       }
-       rd_string(strings, headp->oh_nchar);
-       while (nnames) {
-               int i = nnames >= NNAMES ? NNAMES : nnames;
-               register struct outname *p = namebuf;
-
-               nnames -= i;
-               rd_name(namebuf, i);
-               while (i--) {
-                       long off = p->on_foff - xxx;
-                       if (p->on_foff == (long)0) {
-                               p++;
-                               continue; /* An unrecognizable name. */
-                       }
-                       p->on_mptr = strings + off;
-                       /*
-                        * Only enter names that are exported and are really
-                        * defined. Also enter common names. Note, that
-                        * this might cause problems when the name is really
-                        * defined in a later file, with a value != 0.
-                        * However, this problem also exists on the Unix
-                        * ranlib archives.
-                        */
-                       if (    (p->on_type & S_EXT) &&
-                               (p->on_type & S_TYP) != S_UND
-                          )
-                               enter_name(p);
-                       p++;
-               }
-       }
-       free(strings);
-}
-
-static void enter_name(struct outname *namep)
-{
-       register char   *cp;
-
-       if (tnum >= tabsz) {
-               tab = (struct ranlib *)
-                       realloc((char *) tab, (tabsz += 512) * sizeof(struct ranlib));
-               if (! tab) error1(TRUE, "Out of core\n");
-       }
-       tab[tnum].ran_off = tssiz;
-       tab[tnum].ran_pos = offset;
-
-       for (cp = namep->on_mptr;; cp++) {
-               if (tssiz >= strtabsz) {
-                       tstrtab = realloc(tstrtab, (strtabsz += 4096));
-                       if (! tstrtab) error1(TRUE, "string table overflow\n");
-               }
-               tstrtab[tssiz++]  = *cp;
-               if (!*cp) break;
-       }
-       tnum++;
-}
-#endif /* AAL */
diff --git a/commands/aal/archiver.h b/commands/aal/archiver.h
deleted file mode 100644 (file)
index 18e8bb5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-extern void rd_fatal();
-extern void wr_fatal();
diff --git a/commands/aal/byte_order.h b/commands/aal/byte_order.h
deleted file mode 100644 (file)
index 3081cf7..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#if defined(mc68020) || defined(mc68000) || defined(sparc)
-#define BYTES_REVERSED 1
-#define WORDS_REVERSED 1
-#define CHAR_UNSIGNED 0
-#else
-#define BYTES_REVERSED 0
-#define WORDS_REVERSED 0
-#define CHAR_UNSIGNED 0
-#endif
diff --git a/commands/aal/format.c b/commands/aal/format.c
deleted file mode 100644 (file)
index 0bf576d..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#if __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <string.h>
-
-extern char *long2str();
-
-static int
-integral(int c)
-{
-       switch (c) {
-       case 'b':
-               return -2;
-       case 'd':
-               return 10;
-       case 'o':
-               return -8;
-       case 'u':
-               return -10;
-       case 'x':
-               return -16;
-       }
-       return 0;
-}
-
-/*VARARGS2*/
-/*FORMAT1 $
-       %s = char *
-       %l = long
-       %c = int
-       %[uxbo] = unsigned int
-       %d = int
-$ */
-int
-_format(char *buf, char *fmt, va_list argp)
-{
-       register char *pf = fmt;
-       register char *pb = buf;
-
-       while (*pf) {
-               if (*pf == '%') {
-                       register int width, base, pad, npad;
-                       char *arg;
-                       char cbuf[2];
-                       char *badformat = "<bad format>";
-                       
-                       /* get padder */
-                       if (*++pf == '0') {
-                               pad = '0';
-                               ++pf;
-                       }
-                       else
-                               pad = ' ';
-                       
-                       /* get width */
-                       width = 0;
-                       while (*pf >= '0' && *pf <= '9')
-                               width = 10 * width + *pf++ - '0';
-                       
-                       if (*pf == 's') {
-                               arg = va_arg(argp, char *);
-                       }
-                       else
-                       if (*pf == 'c') {
-                               cbuf[0] = va_arg(argp, int);
-                               cbuf[1] = '\0';
-                               arg = &cbuf[0];
-                       }
-                       else
-                       if (*pf == 'l') {
-                               /* alignment ??? */
-                               base = integral(*++pf);
-                               if (base) {
-                                       arg = long2str(va_arg(argp,long), base);
-                               }
-                               else {
-                                       pf--;
-                                       arg = badformat;
-                               }
-                       }
-                       else
-                       if ((base = integral(*pf))) {
-                               arg = long2str((long)va_arg(argp,int), base);
-                       }
-                       else
-                       if (*pf == '%')
-                               arg = "%";
-                       else
-                               arg = badformat;
-
-                       npad = width - strlen(arg);
-
-                       while (npad-- > 0)
-                               *pb++ = pad;
-                       
-                       while (*pb++ = *arg++);
-                       pb--;
-                       pf++;
-               }
-               else
-                       *pb++ = *pf++;
-       }
-       return pb - buf;
-}
diff --git a/commands/aal/format.h b/commands/aal/format.h
deleted file mode 100644 (file)
index aee33eb..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-
-extern int _format(char *buf, char *fmt, va_list argp);
diff --git a/commands/aal/local.h b/commands/aal/local.h
deleted file mode 100644 (file)
index 825cfbf..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* collection of options, selected by including or excluding 'defines' */
-
-/* Version number of the EM object code */
-#      define  VERSION         3       /* 16 bits number */
-
-/* The default machine used by ack, acc, apc */
-#      define  ACKM            "minix"
-
-/* size of local machine, either 0 (for 16 bit address space), or 1 */
-#      undef BIGMACHINE
-
-/* operating system, SYS_5, V7, BSD4_1 or BSD4_2; Do NOT delete the comment
-   in the next line! */
-#      define V7  1       /* SYSTEM */
diff --git a/commands/aal/long2str.c b/commands/aal/long2str.c
deleted file mode 100644 (file)
index 3d622f9..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* Integer to String translator
-       -> base is a value from [-16,-2] V [2,16]
-       -> base < 0: see 'val' as unsigned value
-       -> no checks for buffer overflow and illegal parameters
-       (1985, EHB)
-*/
-
-#define MAXWIDTH 32
-
-char *
-long2str(val, base)
-       register long val;
-       register int base;
-{
-       static char numbuf[MAXWIDTH];
-       static char vec[] = "0123456789ABCDEF";
-       register char *p = &numbuf[MAXWIDTH];
-       int sign = (base > 0);
-
-       *--p = '\0';            /* null-terminate string        */
-       if (val) {
-               if (base > 0) {
-                       if (val < 0L) {
-                               long v1 = -val;
-                               if (v1 == val)
-                                       goto overflow;
-                               val = v1;
-                       }
-                       else
-                               sign = 0;
-               }
-               else
-               if (base < 0) {                 /* unsigned */
-                       base = -base;
-                       if (val < 0L) { /* taken from Amoeba src */
-                               register int mod, i;
-                       overflow:
-                               mod = 0;
-                               for (i = 0; i < 8 * sizeof val; i++) {
-                                       mod <<= 1;
-                                       if (val < 0)
-                                               mod++;
-                                       val <<= 1;
-                                       if (mod >= base) {
-                                               mod -= base;
-                                               val++;
-                                       }
-                               }
-                               *--p = vec[mod];
-                       }
-               }
-               do {
-                       *--p = vec[(int) (val % base)];
-                       val /= base;
-               } while (val != 0L);
-               if (sign)
-                       *--p = '-';     /* don't forget it !!   */
-       }
-       else
-               *--p = '0';             /* just a simple 0      */
-       return p;
-}
diff --git a/commands/aal/object.h b/commands/aal/object.h
deleted file mode 100644 (file)
index 92bc4b1..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#include "byte_order.h"
-#include <local.h>
-#include <stdio.h>
-
-#if CHAR_UNSIGNED
-#define Xchar(ch)      (ch)
-#else
-#define Xchar(ch)      ((ch) & 0377)
-#endif
-
-#if ! defined(BYTES_REVERSED)
-#define BYTES_REVERSED 1
-#endif
-
-#if ! defined(WORDS_REVERSED)
-#define WORDS_REVERSED 1
-#endif
-
-#if BYTES_REVERSED
-#define uget2(c)       (Xchar((c)[0]) | ((unsigned) Xchar((c)[1]) << 8))
-#define Xput2(i, c)    (((c)[0] = (i)), ((c)[1] = (i) >> 8))
-#define put2(i, c)     { register int j = (i); Xput2(j, c); }
-#else
-#define uget2(c)       (* ((unsigned short *) (c)))
-#define Xput2(i, c)    (* ((short *) (c)) = (i))
-#define put2(i, c)     Xput2(i, c)
-#endif
-
-#define get2(c)                ((short) uget2(c))
-
-#if WORDS_REVERSED || BYTES_REVERSED
-#define get4(c)                (uget2(c) | ((long) uget2((c)+2) << 16))
-#define put4(l, c)     { register long x=(l); \
-                         Xput2((int)x,c); \
-                         Xput2((int)(x>>16),(c)+2); \
-                       }
-#else
-#define get4(c)                (* ((long *) (c)))
-#define put4(l, c)     (* ((long *) (c)) = (l))
-#endif
-
-#define SECTCNT        3       /* number of sections with own output buffer */
-#if BIGMACHINE
-#define WBUFSIZ        (8*BUFSIZ)
-#else
-#define WBUFSIZ        BUFSIZ
-#endif
-
-struct fil {
-       int     cnt;
-       char    *pnow;
-       char    *pbegin;
-       long    currpos;
-       int     fd;
-       char    pbuf[WBUFSIZ];
-};
-
-extern struct fil __parts[];
-
-#define        PARTEMIT        0
-#define        PARTRELO        (PARTEMIT+SECTCNT)
-#define        PARTNAME        (PARTRELO+1)
-#define        PARTCHAR        (PARTNAME+1)
-#ifdef SYMDBUG
-#define PARTDBUG       (PARTCHAR+1)
-#else
-#define PARTDBUG       (PARTCHAR+0)
-#endif
-#define        NPARTS          (PARTDBUG + 1)
-
-#define getsect(s)      (PARTEMIT+((s)>=(SECTCNT-1)?(SECTCNT-1):(s)))
diff --git a/commands/aal/out.h b/commands/aal/out.h
deleted file mode 100644 (file)
index 0834f66..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#ifndef __OUT_H_INCLUDED
-#define __OUT_H_INCLUDED
-/*
- * output format for ACK assemblers
- */
-#ifndef ushort
-#define ushort unsigned short
-#endif /* ushort */
-
-struct outhead {
-       ushort  oh_magic;       /* magic number */
-       ushort  oh_stamp;       /* version stamp */
-       ushort  oh_flags;       /* several format flags */
-       ushort  oh_nsect;       /* number of outsect structures */
-       ushort  oh_nrelo;       /* number of outrelo structures */
-       ushort  oh_nname;       /* number of outname structures */
-       long    oh_nemit;       /* sum of all os_flen */
-       long    oh_nchar;       /* size of string area */
-};
-
-#define O_MAGIC        0x0201          /* magic number of output file */
-#define        O_STAMP 0               /* version stamp */
-#define MAXSECT        64              /* Maximum number of sections */
-
-#define        HF_LINK 0x0004          /* unresolved references left */
-#define        HF_8086 0x0008          /* os_base specially encoded */
-
-struct outsect {
-       long    os_base;        /* startaddress in machine */
-       long    os_size;        /* section size in machine */
-       long    os_foff;        /* startaddress in file */
-       long    os_flen;        /* section size in file */
-       long    os_lign;        /* section alignment */
-};
-
-struct outrelo {
-       char    or_type;        /* type of reference */
-       char    or_sect;        /* referencing section */
-       ushort  or_nami;        /* referenced symbol index */
-       long    or_addr;        /* referencing address */
-};
-
-struct outname {
-       union {
-         char  *on_ptr;        /* symbol name (in core) */
-         long  on_off;         /* symbol name (in file) */
-       }       on_u;
-#define on_mptr        on_u.on_ptr
-#define on_foff        on_u.on_off
-       ushort  on_type;        /* symbol type */
-       ushort  on_desc;        /* debug info */
-       long    on_valu;        /* symbol value */
-};
-
-/*
- * relocation type bits
- */
-#define RELSZ  0x07            /* relocation length */
-#define RELO1     1            /* 1 byte */
-#define RELO2     2            /* 2 bytes */
-#define RELO4     4            /* 4 bytes */
-#define RELPC  0x08            /* pc relative */
-#define RELBR  0x10            /* High order byte lowest address. */
-#define RELWR  0x20            /* High order word lowest address. */
-
-/*
- * section type bits and fields
- */
-#define S_TYP  0x007F          /* undefined, absolute or relative */
-#define S_EXT  0x0080          /* external flag */
-#define S_ETC  0x7F00          /* for symbolic debug, bypassing 'as' */
-
-/*
- * S_TYP field values
- */
-#define S_UND  0x0000          /* undefined item */
-#define S_ABS  0x0001          /* absolute item */
-#define S_MIN  0x0002          /* first user section */
-#define S_MAX  (S_TYP-1)       /* last user section */
-#define S_CRS  S_TYP           /* on_valu is symbol index which contains value */
-
-/*
- * S_ETC field values
- */
-#define S_SCT  0x0100          /* section names */
-#define S_LIN  0x0200          /* hll source line item */
-#define S_FIL  0x0300          /* hll source file item */
-#define S_MOD  0x0400          /* ass source file item */
-#define S_COM  0x1000          /* Common name. */
-#define S_STB  0xe000          /* entries with any of these bits set are
-                                  reserved for debuggers
-                               */
-
-/*
- * structure format strings
- */
-#define SF_HEAD                "22222244"
-#define SF_SECT                "44444"
-#define SF_RELO                "1124"
-#define SF_NAME                "4224"
-
-/*
- * structure sizes (bytes in file; add digits in SF_*)
- */
-#define SZ_HEAD                20
-#define SZ_SECT                20
-#define SZ_RELO                8
-#define SZ_NAME                12
-
-/*
- * file access macros
- */
-#define BADMAGIC(x)    ((x).oh_magic!=O_MAGIC)
-#define OFF_SECT(x)    SZ_HEAD
-#define OFF_EMIT(x)    (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT))
-#define OFF_RELO(x)    (OFF_EMIT(x) + (x).oh_nemit)
-#define OFF_NAME(x)    (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO))
-#define OFF_CHAR(x)    (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME))
-
-#endif /* __OUT_H_INCLUDED */
diff --git a/commands/aal/param.h b/commands/aal/param.h
deleted file mode 100644 (file)
index 884ef3e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#define SSIZE 1024
diff --git a/commands/aal/print.c b/commands/aal/print.c
deleted file mode 100644 (file)
index 3757b54..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#if __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <system.h>
-#include "param.h"
-#include "format.h"
-#include "write.h"
-
-/*VARARGS*/
-/*FORMAT0v $
-       %s = char *
-       %l = long
-       %c = int
-       %[uxbo] = unsigned int
-       %d = int
-$ */
-void
-#if __STDC__
-print(char *fmt, ...)
-#else
-print(fmt, va_alist)
-       char *fmt;
-       va_dcl
-#endif
-{
-       va_list args;
-       char buf[SSIZE];
-
-#if __STDC__
-       va_start(args, fmt);
-#else
-       va_start(args);
-#endif
-       sys_write(STDOUT, buf, _format(buf, fmt, args));
-       va_end(args);
-}
diff --git a/commands/aal/print.h b/commands/aal/print.h
deleted file mode 100644 (file)
index 28ac8ab..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-
-extern void print(char *fmt, ...);
diff --git a/commands/aal/ranlib.h b/commands/aal/ranlib.h
deleted file mode 100644 (file)
index e8c6e84..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#ifndef __RANLIB_H_INCLUDED
-#define __RANLIB_H_INCLUDED
-
-#ifndef SYMDEF
-#      define SYMDEF   "__.SYMDEF"
-#endif /* SYMDEF */
-
-/*
- * Structure of the SYMDEF table of contents for an archive.
- * SYMDEF begins with a long giving the number of ranlib
- * structures that immediately follow, and then continues with a string
- * table consisting of a long giving the number of bytes of
- * strings that follow and then the strings themselves.
- */
-struct ranlib {
-       union {
-         char  *ran__ptr;      /* symbol name (in core) */
-         long  ran__off;       /* symbol name (in file) */
-       }       ran_u;
-#define ran_ptr ran_u.ran__ptr
-#define ran_off ran_u.ran__off
-       long    ran_pos;        /* library member is at this position */
-};
-
-#define SZ_RAN 8
-#define SF_RAN "44"
-
-extern void wr_ranlib(int fd, struct ranlib ran[], long cnt);
-#endif /* __RANLIB_H_INCLUDED */
-
diff --git a/commands/aal/rd.c b/commands/aal/rd.c
deleted file mode 100644 (file)
index 43febc8..0000000
+++ /dev/null
@@ -1,247 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include "out.h"
-#include "object.h"
-#include "rd.h"
-#include "rd_bytes.h"
-
-extern long            lseek();
-
-/*
- * Parts of the output file.
- */
-#undef PARTEMIT
-#undef PARTRELO
-#undef PARTNAME
-#undef PARTCHAR
-#undef PARTDBUG
-#undef NPARTS
-
-#define        PARTEMIT        0
-#define        PARTRELO        1
-#define        PARTNAME        2
-#define        PARTCHAR        3
-#ifdef SYMDBUG
-#define PARTDBUG       4
-#else
-#define PARTDBUG       3
-#endif
-#define        NPARTS          (PARTDBUG + 1)
-
-static long            offset[MAXSECT];
-
-static int             outfile;
-static long            outseek[NPARTS];
-static long            currpos;
-static long            rd_base;
-#define OUTSECT(i) \
-       (outseek[PARTEMIT] = offset[i])
-#define BEGINSEEK(p, o) \
-       (outseek[(p)] = (o))
-
-static int sectionnr;
-
-static
-void OUTREAD(int p, char *b, long n)
-{
-       register long l = outseek[p];
-
-       if (currpos != l) {
-               lseek(outfile, l, 0);
-       }
-       rd_bytes(outfile, b, n);
-       l += n;
-       currpos = l;
-       outseek[p] = l;
-}
-
-/*
- * Open the output file according to the chosen strategy.
- */
-int
-rd_open(char *f)
-{
-       int outfile = open(f, 0);
-       if (outfile < 0)
-               return 0;
-       return rd_fdopen(outfile);
-}
-
-static int offcnt;
-
-int rd_fdopen(int fd)
-{
-       register int i;
-
-       for (i = 0; i < NPARTS; i++) outseek[i] = 0;
-       offcnt = 0;
-       rd_base = lseek(fd, 0L, 1);
-       if (rd_base < 0) {
-               return 0;
-       }
-       currpos = rd_base;
-       outseek[PARTEMIT] = currpos;
-       outfile = fd;
-       sectionnr = 0;
-       return 1;
-}
-
-void rd_close()
-{
-
-       close(outfile);
-       outfile = -1;
-}
-
-int rd_fd()
-{
-       return outfile;
-}
-
-void rd_ohead(register struct outhead *head)
-{
-       register long off;
-
-       OUTREAD(PARTEMIT, (char *) head, (long) SZ_HEAD);
-#if ! (BYTES_REVERSED || WORDS_REVERSED)
-       if (sizeof(struct outhead) != SZ_HEAD)
-#endif
-       {
-               register char *c = (char *) head + (SZ_HEAD-4);
-               
-               head->oh_nchar = get4(c);
-               c -= 4; head->oh_nemit = get4(c);
-               c -= 2; head->oh_nname = uget2(c);
-               c -= 2; head->oh_nrelo = uget2(c);
-               c -= 2; head->oh_nsect = uget2(c);
-               c -= 2; head->oh_flags = uget2(c);
-               c -= 2; head->oh_stamp = uget2(c);
-               c -= 2; head->oh_magic = uget2(c);
-       }
-       off = OFF_RELO(*head) + rd_base;
-       BEGINSEEK(PARTRELO, off);
-       off += (long) head->oh_nrelo * SZ_RELO;
-       BEGINSEEK(PARTNAME, off);
-       off += (long) head->oh_nname * SZ_NAME;
-       BEGINSEEK(PARTCHAR, off);
-#ifdef SYMDBUG
-       off += head->oh_nchar;
-       BEGINSEEK(PARTDBUG, off);
-#endif
-}
-
-void rd_rew_relos(head)
-       register struct outhead *head;
-{
-       register long off = OFF_RELO(*head) + rd_base;
-
-       BEGINSEEK(PARTRELO, off);
-}
-
-void rd_sect(sect, cnt)
-       register struct outsect *sect;
-       register unsigned int   cnt;
-{
-       register char *c = (char *) sect + cnt * SZ_SECT;
-
-       OUTREAD(PARTEMIT, (char *) sect, (long)cnt * SZ_SECT);
-       sect += cnt;
-       offcnt += cnt;
-       while (cnt--) {
-               sect--;
-#if ! (BYTES_REVERSED || WORDS_REVERSED)
-               if (sizeof(struct outsect) != SZ_SECT)
-#endif
-               {
-                       c -= 4; sect->os_lign = get4(c);
-                       c -= 4; sect->os_flen = get4(c);
-                       c -= 4; sect->os_foff = get4(c);
-               }
-               offset[--offcnt] = sect->os_foff + rd_base;
-#if ! (BYTES_REVERSED || WORDS_REVERSED)
-               if (sizeof(struct outsect) != SZ_SECT)
-#endif
-               {
-                       c -= 4; sect->os_size = get4(c);
-                       c -= 4; sect->os_base = get4(c);
-               }
-       }
-}
-
-void rd_outsect(int s)
-{
-       OUTSECT(s);
-       sectionnr = s;
-}
-
-/*
- * We don't have to worry about byte order here.
- */
-void rd_emit(emit, cnt)
-       char            *emit;
-       long            cnt;
-{
-       OUTREAD(PARTEMIT, emit, cnt);
-       offset[sectionnr] += cnt;
-}
-
-void rd_relo(relo, cnt)
-       register struct outrelo *relo;
-       register unsigned int cnt;
-{
-       OUTREAD(PARTRELO, (char *) relo, (long) cnt * SZ_RELO);
-#if ! (BYTES_REVERSED || WORDS_REVERSED)
-       if (sizeof(struct outrelo) != SZ_RELO)
-#endif
-       {
-               register char *c = (char *) relo + (long) cnt * SZ_RELO;
-
-               relo += cnt;
-               while (cnt--) {
-                       relo--;
-                       c -= 4; relo->or_addr = get4(c);
-                       c -= 2; relo->or_nami = uget2(c);
-                       relo->or_sect = *--c;
-                       relo->or_type = *--c;
-               }
-       }
-}
-
-void rd_name(struct outname *name, unsigned int cnt)
-{
-
-       OUTREAD(PARTNAME, (char *) name, (long) cnt * SZ_NAME);
-#if ! (BYTES_REVERSED || WORDS_REVERSED)
-       if (sizeof(struct outname) != SZ_NAME)
-#endif
-       {
-               register char *c = (char *) name + (long) cnt * SZ_NAME;
-
-               name += cnt;
-               while (cnt--) {
-                       name--;
-                       c -= 4; name->on_valu = get4(c);
-                       c -= 2; name->on_desc = uget2(c);
-                       c -= 2; name->on_type = uget2(c);
-                       c -= 4; name->on_foff = get4(c);
-               }
-       }
-}
-
-void rd_string(char *addr, long len)
-{
-       OUTREAD(PARTCHAR, addr, len);
-}
-
-#ifdef SYMDBUG
-void rd_dbug(char *buf, long size)
-{
-       OUTREAD(PARTDBUG, buf, size);
-}
-#endif
diff --git a/commands/aal/rd.h b/commands/aal/rd.h
deleted file mode 100644 (file)
index 39f68f7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * Headers for rd.c
- */
-
-#include "out.h"
-
-extern void rd_string(char *addr, long len);
-extern void rd_name(struct outname name[], unsigned int cnt);
-extern int rd_fdopen(int fd);
-extern void rd_ohead(register struct outhead head[]);
diff --git a/commands/aal/rd_arhdr.c b/commands/aal/rd_arhdr.c
deleted file mode 100644 (file)
index dd676a2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#include <sys/types.h>
-#include <unistd.h>
-#include <arch.h>
-#include "object.h"
-
-#include "arch.h"
-#include "archiver.h"
-
-int
-rd_arhdr(int fd, register struct ar_hdr        *arhdr)
-{
-       char buf[AR_TOTAL];
-       register char *c = buf;
-       register char *p = arhdr->ar_name;
-       register int i;
-
-       i = read(fd, c, AR_TOTAL);
-       if (i == 0) return 0;
-       if (i != AR_TOTAL) {
-               rd_fatal();
-       }
-       i = 14;
-       while (i--) {
-               *p++ = *c++;
-       }
-       arhdr->ar_date = ((long) get2(c)) << 16; c += 2;
-       arhdr->ar_date |= ((long) get2(c)) & 0xffff; c += 2;
-       arhdr->ar_uid = *c++;
-       arhdr->ar_gid = *c++;
-       arhdr->ar_mode = get2(c); c += 2;
-       arhdr->ar_size = (long) get2(c) << 16; c += 2;
-       arhdr->ar_size |= (long) get2(c) & 0xffff;
-       return 1;
-}
diff --git a/commands/aal/rd_bytes.c b/commands/aal/rd_bytes.c
deleted file mode 100644 (file)
index fd9f896..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#define MININT         (1 << (sizeof(int) * 8 - 1))
-#define MAXCHUNK       (~MININT)       /* Highest count we read(2).    */
-/* Unfortunately, MAXCHUNK is too large with some  compilers. Put it in
-   an int!
-*/
-
-#include <sys/types.h>
-#include <unistd.h>
-
-#include "archiver.h"
-#include "rd_bytes.h"
-
-static int maxchunk = MAXCHUNK;
-
-/*
- * We don't have to worry about byte order here.
- * Just read "cnt" bytes from file-descriptor "fd".
- */
-void rd_bytes(int fd, char *string, long cnt)
-{
-
-       while (cnt) {
-               register int n = cnt >= maxchunk ? maxchunk : cnt;
-
-               if (read(fd, string, n) != n)
-                       rd_fatal();
-               string += n;
-               cnt -= n;
-       }
-}
diff --git a/commands/aal/rd_bytes.h b/commands/aal/rd_bytes.h
deleted file mode 100644 (file)
index fe2c8c5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-
-extern void rd_bytes(int fd, char *string, long cnt);
diff --git a/commands/aal/rd_unsig2.c b/commands/aal/rd_unsig2.c
deleted file mode 100644 (file)
index 5885f78..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#include "object.h"
-#include "rd_bytes.h"
-
-unsigned int
-rd_unsigned2(int fd)
-{
-       char buf[2];
-
-       rd_bytes(fd, buf, 2L);
-       return uget2(buf);
-}
diff --git a/commands/aal/sprint.c b/commands/aal/sprint.c
deleted file mode 100644 (file)
index adcb5cd..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#if __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include <system.h>
-#include "param.h"
-#include "format.h"
-
-/*VARARGS*/
-/*FORMAT1v $
-       %s = char *
-       %l = long
-       %c = int
-       %[uxbo] = unsigned int
-       %d = int
-$ */
-char *
-#if __STDC__
-sprint(char *buf, char *fmt, ...)
-#else
-sprint(buf, fmt, va_alist)
-       char *buf, *fmt;
-       va_dcl
-#endif
-{
-       va_list args;
-
-#if __STDC__
-       va_start(args, fmt);
-#else
-       va_start(args);
-#endif
-       buf[_format(buf, fmt, args)] = '\0';
-       va_end(args);
-       return buf;
-}
diff --git a/commands/aal/system.c b/commands/aal/system.c
deleted file mode 100644 (file)
index 4529fea..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* RCS: $Header$ */
-
-#include <system.h>
-
-File _sys_ftab[SYS_NOPEN] = {
-       { 0, OP_READ},
-       { 1, OP_APPEND},
-       { 2, OP_APPEND}
-};
-
-File *
-_get_entry()
-{
-       register File *fp;
-
-       for (fp = &_sys_ftab[0]; fp < &_sys_ftab[SYS_NOPEN]; fp++)
-               if (fp->o_flags == 0)
-                       return fp;
-       return (File *)0;
-}
diff --git a/commands/aal/system.h b/commands/aal/system.h
deleted file mode 100644 (file)
index 489241e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* RCS: $Header$ */
-#ifndef __SYSTEM_INCLUDED__
-#define __SYSTEM_INCLUDED__
-
-struct _sys_fildes {
-       int o_fd;       /* UNIX filedescriptor */
-       int o_flags;    /* flags for open; 0 if not used */
-};
-
-typedef struct _sys_fildes File;
-
-extern File _sys_ftab[];
-
-/* flags for sys_open() */
-#define OP_READ                01
-#define OP_WRITE       02
-#define OP_APPEND      04
-
-/* flags for sys_access() */
-#define AC_EXIST       00
-#define AC_READ                04
-#define AC_WRITE       02
-#define AC_EXEC                01
-
-/* flags for sys_stop() */
-#define S_END  0
-#define S_EXIT 1
-#define S_ABORT        2
-
-/* standard file decsriptors */
-#define STDIN  &_sys_ftab[0]
-#define STDOUT &_sys_ftab[1]
-#define STDERR &_sys_ftab[2]
-
-/* maximum number of open files */
-#define SYS_NOPEN      20
-
-/* return value for sys_break */
-#define ILL_BREAK      ((char *)0)
-
-/* system's idea of block */
-#ifndef BUFSIZ
-#define BUFSIZ 1024
-#endif
-#endif /* __SYSTEM_INCLUDED__ */
diff --git a/commands/aal/varargs.h b/commands/aal/varargs.h
deleted file mode 100644 (file)
index 140836d..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#ifndef _VARARGS_H
-#define _VARARGS_H
-
-typedef char *va_list;
-# define __va_sz(mode) (((sizeof(mode) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
-# define va_dcl int va_alist;
-# define va_start(list) (list = (char *) &va_alist)
-# define va_end(list)
-# define va_arg(list,mode) (*((mode *)((list += __va_sz(mode)) - __va_sz(mode))))
-#endif /* _VARARGS_H */
diff --git a/commands/aal/wr_arhdr.c b/commands/aal/wr_arhdr.c
deleted file mode 100644 (file)
index 267aab6..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#include <arch.h>
-#include "object.h"
-#include "arch.h"
-#include "write.h"
-#include "wr_bytes.h"
-
-void wr_arhdr(int fd, struct ar_hdr *arhdr)
-{
-       char buf[AR_TOTAL];
-       register char *c = buf;
-       register char *p = arhdr->ar_name;
-       register int i = 14;
-
-       while (i--) {
-               *c++ = *p++;
-       }
-       put2((int)(arhdr->ar_date>>16),c); c += 2;
-       put2((int)(arhdr->ar_date),c); c += 2;
-       *c++ = arhdr->ar_uid;
-       *c++ = arhdr->ar_gid;
-       put2(arhdr->ar_mode,c); c += 2;
-       put2((int)(arhdr->ar_size>>16),c); c += 2;
-       put2((int)(arhdr->ar_size),c);
-       wr_bytes(fd, buf, (long) AR_TOTAL);
-}
diff --git a/commands/aal/wr_bytes.c b/commands/aal/wr_bytes.c
deleted file mode 100644 (file)
index 6787c94..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#define MININT         (1 << (sizeof(int) * 8 - 1))
-#define MAXCHUNK       (~MININT)       /* Highest count we write(2).   */
-/* Notice that MAXCHUNK itself might be too large with some compilers.
-   You have to put it in an int!
-*/
-
-#include <sys/types.h>
-#include <unistd.h>
-#include "wr_bytes.h"
-#include "archiver.h"
-
-static int maxchunk = MAXCHUNK;
-
-/*
- * Just write "cnt" bytes to file-descriptor "fd".
- */
-void wr_bytes(int fd, register char *string, long cnt)
-{
-
-       while (cnt) {
-               register int n = cnt >= maxchunk ? maxchunk : cnt;
-
-               if (write(fd, string, n) != n)
-                       wr_fatal();
-               string += n;
-               cnt -= n;
-       }
-}
diff --git a/commands/aal/wr_bytes.h b/commands/aal/wr_bytes.h
deleted file mode 100644 (file)
index 77a8609..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/*
- * Exported symbols of wr_bytes.c
- */
-extern void wr_bytes(int fd, register char *string, long cnt);
diff --git a/commands/aal/wr_int2.c b/commands/aal/wr_int2.c
deleted file mode 100644 (file)
index 4db0d9b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#include "object.h"
-#include "wr_int2.h"
-#include "wr_bytes.h"
-
-void wr_int2(int fd, int i)
-{
-       char buf[2];
-
-       put2(i, buf);
-       wr_bytes(fd, buf, 2L);
-}
diff --git a/commands/aal/wr_int2.h b/commands/aal/wr_int2.h
deleted file mode 100644 (file)
index 8e9891d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-
-extern void wr_int2(int fd, int i);
diff --git a/commands/aal/wr_long.c b/commands/aal/wr_long.c
deleted file mode 100644 (file)
index 288707c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#include "object.h"
-#include "wr_bytes.h"
-#include "wr_long.h"
-
-void wr_long(int fd, long l)
-{
-       char buf[4];
-
-       put4(l, buf);
-       wr_bytes(fd, buf, 4L);
-}
diff --git a/commands/aal/wr_long.h b/commands/aal/wr_long.h
deleted file mode 100644 (file)
index 8d849b2..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-
-extern void wr_long(int fd, long l);
diff --git a/commands/aal/wr_ranlib.c b/commands/aal/wr_ranlib.c
deleted file mode 100644 (file)
index 35cbc07..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#include <ranlib.h>
-#include "object.h"
-#include "wr_bytes.h"
-#include "ranlib.h"
-
-void wr_ranlib(int fd, struct ranlib *ran, long cnt)
-{
-#if ! (BYTES_REVERSED || WORDS_REVERSED)
-       if (sizeof (struct ranlib) != SZ_RAN)
-#endif
-       {
-               char buf[100 * SZ_RAN];
-
-               while (cnt) {
-                       register int i = (cnt > 100) ? 100 : cnt;
-                       register char *c = buf;
-                       long j = i * SZ_RAN;
-
-                       cnt -= i;
-                       while (i--) {
-                               put4(ran->ran_off,c); c += 4;
-                               put4(ran->ran_pos,c); c += 4;
-                               ran++;
-                       }
-                       wr_bytes(fd, buf, j);
-               }
-       }
-#if ! (BYTES_REVERSED || WORDS_REVERSED)
-       else    wr_bytes(fd, (char *) ran, cnt * SZ_RAN);
-#endif
-}
diff --git a/commands/aal/write.c b/commands/aal/write.c
deleted file mode 100644 (file)
index bec67fb..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <system.h>
-#include "write.h"
-
-int
-sys_write(File *fp, char *bufptr, int nbytes)
-{
-       if (! fp) return 0;
-       return write(fp->o_fd, bufptr, nbytes) == nbytes;
-}
diff --git a/commands/aal/write.h b/commands/aal/write.h
deleted file mode 100644 (file)
index fa04c1f..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-#include "system.h"
-extern int sys_write(File *fp, char *bufptr, int nbytes);
diff --git a/commands/acd/Makefile b/commands/acd/Makefile
deleted file mode 100644 (file)
index 559070b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-# Makefile for acd
-
-.include <bsd.own.mk>
-
-PROG=  acd
-CPPFLAGS+= -DARCH=\"`arch`\" -DDESCR=\"/usr/lib/descr\"
-LINKS+= ${BINDIR}/acd ${BINDIR}/cc
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/acd/acd.c b/commands/acd/acd.c
deleted file mode 100644 (file)
index 1bdba9a..0000000
+++ /dev/null
@@ -1,2701 +0,0 @@
-/*     acd 1.10 - A compiler driver                    Author: Kees J. Bot
- *                                                             7 Jan 1993
- * Needs about 25kw heap + stack.
- */
-char version[] = "1.9";
-
-#define nil 0
-#define _POSIX_SOURCE  1
-#include <sys/types.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-#include <signal.h>
-#include <errno.h>
-#include <ctype.h>
-#include <assert.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-
-#ifndef LIB
-#define LIB    "/usr/lib"      /* Default library directory. */
-#endif
-
-#define arraysize(a)   (sizeof(a) / sizeof((a)[0]))
-#define arraylimit(a)  ((a) + arraysize(a))
-
-char *program;         /* Call name. */
-
-int verbose= 0;                /* -v0: Silent.
-                        * -v1: Show abbreviated pass names.
-                        * -v2: Show executed UNIX commands.
-                        * -v3: Show executed ACD commands.
-                        * -v4: Show descr file as it is read.
-                        */
-
-int action= 2;         /*   0: An error occured, don't do anything anymore.
-                        *   1: (-vn) Do not execute, play-act.
-                        *   2: Execute UNIX commands.
-                        */
-
-void report(char *label)
-{
-       if (label == nil || label[0] == 0) {
-               fprintf(stderr, "%s: %s\n", program, strerror(errno));
-       } else {
-               fprintf(stderr, "%s: %s: %s\n",
-                                       program, label, strerror(errno));
-       }
-       action= 0;
-}
-
-void quit(int exit_code);
-
-void fatal(char *label)
-{
-       report(label);
-       quit(-1);
-}
-
-size_t heap_chunks= 0;
-
-void *allocate(void *mem, size_t size)
-/* Safe malloc/realloc.  (I have heard that one can call realloc with a
- * null first argument with the effect below, but that is of course to
- * ridiculous to believe.)
- */
-{
-       assert(size > 0);
-
-       if (mem != nil) {
-               mem= realloc(mem, size);
-       } else {
-               mem= malloc(size);
-               heap_chunks++;
-       }
-       if (mem == nil) fatal(nil);
-       return mem;
-}
-
-void deallocate(void *mem)
-{
-       if (mem != nil) {
-               free(mem);
-               heap_chunks--;
-       }
-}
-
-char *copystr(const char *s)
-{
-       char *c;
-       c= allocate(nil, (strlen(s)+1) * sizeof(*c));
-       strcpy(c, s);
-       return c;
-}
-
-/* Every object, list, letter, or variable, is made with cells. */
-typedef struct cell {
-       unsigned short  refc;           /* Reference count. */
-       char            type;           /* Type of object. */
-       unsigned char   letter;         /* Simply a letter. */
-       char            *name;          /* Name of a word. */
-       struct cell     *hash;          /* Hash chain. */
-       struct cell     *car, *cdr;     /* To form lists. */
-
-/* For a word: */
-#      define  value   car             /* Value of a variable. */
-#      define  base    cdr             /* Base-name in transformations. */
-#      define  suffix  cdr             /* Suffix in a treat-as. */
-#      define  flags   letter          /* Special flags. */
-
-/* A substitution: */
-#      define  subst   car
-
-} cell_t;
-
-typedef enum type {
-       CELL,           /* A list cell. */
-       STRING,         /* To make a list of characters and substs. */
-       SUBST,          /* Variable to substitute. */
-       /* Unique objects. */
-       LETTER,         /* A letter. */
-       WORD,           /* A string collapses to a word. */
-       EQUALS,         /* = operator, etc. */
-       OPEN,
-       CLOSE,
-       PLUS,
-       MINUS,
-       STAR,
-       INPUT,
-       OUTPUT,
-       WHITE,
-       COMMENT,
-       SEMI,
-       EOLN,
-       N_TYPES         /* number of different types */
-} type_t;
-
-#define is_unique(type) ((type) >= LETTER)
-
-/* Flags on a word. */
-#define W_SET          0x01    /* Not undefined, e.g. assigned to. */
-#define W_RDONLY       0x02    /* Read only. */
-#define W_LOCAL                0x04    /* Local variable, immediate substitution. */
-#define W_TEMP         0x08    /* Name of a temporary file, delete on quit. */
-#define W_SUFF         0x10    /* Has a suffix set on it. */
-
-void princhar(int c)
-/* Print a character, escaped if important to the shell *within* quotes. */
-{
-       if (strchr("\\'\"<>();~$^&*|{}[]?", c) != nil) fputc('\\', stdout);
-       putchar(c);
-}
-
-void prinstr(char *s)
-/* Print a string, in quotes if the shell might not like it. */
-{
-       int q= 0;
-       char *s2= s;
-
-       while (*s2 != 0)
-               if (strchr("~`$^&*()=\\|[]{};'\"<>?", *s2++) != nil) q= 1;
-
-       if (q) fputc('"', stdout);
-       while (*s != 0) princhar(*s++);
-       if (q) fputc('"', stdout);
-}
-
-void prin2(cell_t *p);
-
-void prin1(cell_t *p)
-/* Print a cell structure for debugging purposes. */
-{
-       if (p == nil) {
-               printf("(\b(\b()\b)\b)");
-               return;
-       }
-
-       switch (p->type) {
-       case CELL:
-               printf("(\b(\b(");
-               prin2(p);
-               printf(")\b)\b)");
-               break;
-       case STRING:
-               printf("\"\b\"\b\"");
-               prin2(p);
-               printf("\"\b\"\b\"");
-               break;
-       case SUBST:
-               printf("$\b$\b${%s}", p->subst->name);
-               break;
-       case LETTER:
-               princhar(p->letter);
-               break;
-       case WORD:
-               prinstr(p->name);
-               break;
-       case EQUALS:
-               printf("=\b=\b=");
-               break;
-       case PLUS:
-               printf("+\b+\b+");
-               break;
-       case MINUS:
-               printf("-\b-\b-");
-               break;
-       case STAR:
-               printf("*\b*\b*");
-               break;
-       case INPUT:
-               printf(verbose >= 3 ? "<\b<\b<" : "<");
-               break;
-       case OUTPUT:
-               printf(verbose >= 3 ? ">\b>\b>" : ">");
-               break;
-       default:
-               assert(0);
-       }
-}
-
-void prin2(cell_t *p)
-/* Print a list for debugging purposes. */
-{
-       while (p != nil && p->type <= STRING) {
-               prin1(p->car);
-
-               if (p->type == CELL && p->cdr != nil) fputc(' ', stdout);
-
-               p= p->cdr;
-       }
-       if (p != nil) prin1(p);         /* Dotted pair? */
-}
-
-void prin1n(cell_t *p) { prin1(p); fputc('\n', stdout); }
-
-void prin2n(cell_t *p) { prin2(p); fputc('\n', stdout); }
-
-/* A program is consists of a series of lists at a certain indentation level. */
-typedef struct program {
-       struct program  *next;
-       cell_t          *file;          /* Associated description file. */
-       unsigned        indent;         /* Line indentation level. */
-       unsigned        lineno;         /* Line number where this is found. */
-       cell_t          *line;          /* One line of tokens. */
-} program_t;
-
-program_t *pc;         /* Program Counter (what else?) */
-program_t *nextpc;     /* Next line to execute. */
-
-cell_t *oldcells;      /* Keep a list of old cells, don't deallocate. */
-
-cell_t *newcell(void)
-/* Make a new empty cell. */
-{
-       cell_t *p;
-
-       if (oldcells != nil) {
-               p= oldcells;
-               oldcells= p->cdr;
-               heap_chunks++;
-       } else {
-               p= allocate(nil, sizeof(*p));
-       }
-
-       p->refc= 0;
-       p->type= CELL;
-       p->letter= 0;
-       p->name= nil;
-       p->car= nil;
-       p->cdr= nil;
-       return p;
-}
-
-#define N_CHARS                (1 + (unsigned char) -1)
-#define HASHDENSE      0x400
-
-cell_t *oblist[HASHDENSE + N_CHARS + N_TYPES];
-
-unsigned hashfun(cell_t *p)
-/* Use a blender on a cell. */
-{
-       unsigned h;
-       char *name;
-
-       switch (p->type) {
-       case WORD:
-               h= 0;
-               name= p->name;
-               while (*name != 0) h= (h * 0x1111) + *name++;
-               return h % HASHDENSE;
-       case LETTER:
-               return HASHDENSE + p->letter;
-       default:
-               return HASHDENSE + N_CHARS + p->type;
-       }
-}
-
-cell_t *search(cell_t *p, cell_t ***hook)
-/* Search for *p, return the one found.  *hook may be used to insert or
- * delete.
- */
-{
-       cell_t *sp;
-
-       sp= *(*hook= &oblist[hashfun(p)]);
-
-       if (p->type == WORD) {
-               /* More than one name per hash slot. */
-               int cmp= 0;
-
-               while (sp != nil && (cmp= strcmp(p->name, sp->name)) > 0)
-                       sp= *(*hook= &sp->hash);
-
-               if (cmp != 0) sp= nil;
-       }
-       return sp;
-}
-
-void dec(cell_t *p)
-/* Decrease the number of references to p, if zero delete and recurse. */
-{
-       if (p == nil || --p->refc > 0) return;
-
-       if (is_unique(p->type)) {
-               /* Remove p from the oblist. */
-               cell_t *o, **hook;
-
-               o= search(p, &hook);
-
-               if (o == p) {
-                       /* It's there, remove it. */
-                       *hook= p->hash;
-                       p->hash= nil;
-               }
-
-               if (p->type == WORD && (p->flags & W_TEMP)) {
-                       /* A filename to remove. */
-                       if (verbose >= 2) {
-                               printf("rm -f ");
-                               prinstr(p->name);
-                               fputc('\n', stdout);
-                       }
-                       if (unlink(p->name) < 0 && errno != ENOENT)
-                               report(p->name);
-               }
-       }
-       deallocate(p->name);
-       dec(p->car);
-       dec(p->cdr);
-       p->cdr= oldcells;
-       oldcells= p;
-       heap_chunks--;
-}
-
-cell_t *inc(cell_t *p)
-/* Increase the number of references to p. */
-{
-       cell_t *o, **hook;
-
-       if (p == nil) return nil;
-
-       if (++p->refc > 1 || !is_unique(p->type)) return p;
-
-       /* First appearance, put p on the oblist. */
-       o= search(p, &hook);
-
-       if (o == nil) {
-               /* Not there yet, add it. */
-               p->hash= *hook;
-               *hook= p;
-       } else {
-               /* There is another object already there with the same info. */
-               o->refc++;
-               dec(p);
-               p= o;
-       }
-       return p;
-}
-
-cell_t *go(cell_t *p, cell_t *field)
-/* Often happening: You've got p, you want p->field. */
-{
-       field= inc(field);
-       dec(p);
-       return field;
-}
-
-cell_t *cons(type_t type, cell_t *p)
-/* P is to be added to a list (or a string). */
-{
-       cell_t *l= newcell();
-       l->type= type;
-       l->refc++;
-       l->car= p;
-       return l;
-}
-
-cell_t *append(type_t type, cell_t *p)
-/* P is to be appended to a list (or a string). */
-{
-       return p == nil || p->type == type ? p : cons(type, p);
-}
-
-cell_t *findnword(char *name, size_t n)
-/* Find the word with the given name of length n. */
-{
-       cell_t *w= newcell();
-       w->type= WORD;
-       w->name= allocate(nil, (n+1) * sizeof(*w->name));
-       memcpy(w->name, name, n);
-       w->name[n]= 0;
-       return inc(w);
-}
-
-cell_t *findword(char *name)
-/* Find the word with the given null-terminated name. */
-{
-       return findnword(name, strlen(name));
-}
-
-void quit(int exstat)
-/* Remove all temporary names, then exit. */
-{
-       cell_t **op, *p, *v, *b;
-       size_t chunks;
-
-       /* Remove cycles, like X = X. */
-       for (op= oblist; op < oblist + HASHDENSE; op++) {
-               p= *op;
-               while (p != nil) {
-                       if (p->value != nil || p->base != nil) {
-                               v= p->value;
-                               b= p->base;
-                               p->value= nil;
-                               p->base= nil;
-                               p= *op;
-                               dec(v);
-                               dec(b);
-                       } else {
-                               p= p->hash;
-                       }
-               }
-       }
-       chunks= heap_chunks;
-
-       /* Something may remain on an early quit: tempfiles. */
-       for (op= oblist; op < oblist + HASHDENSE; op++) {
-
-               while (*op != nil) { (*op)->refc= 1; dec(*op); }
-       }
-
-       if (exstat != -1 && chunks > 0) {
-               fprintf(stderr,
-                       "%s: internal fault: %d chunks still on the heap\n",
-                                               program, chunks);
-       }
-       exit(exstat);
-}
-
-void interrupt(int sig)
-{
-       signal(sig, interrupt);
-       if (verbose >= 2) write(1, "# interrupt\n", 12);
-       action= 0;
-}
-
-int extalnum(int c)
-/* Uppercase, lowercase, digit, underscore or anything non-American. */
-{
-       return isalnum(c) || c == '_' || c >= 0200;
-}
-
-char *descr;           /* Name of current description file. */
-FILE *dfp;             /* Open description file. */
-int dch;               /* Input character. */
-unsigned lineno;       /* Line number in file. */
-unsigned indent;       /* Indentation level. */
-
-void getdesc(void)
-{
-       if (dch == EOF) return;
-
-       if (dch == '\n') { lineno++; indent= 0; }
-
-       if ((dch = getc(dfp)) == EOF && ferror(dfp)) fatal(descr);
-
-       if (dch == 0) {
-               fprintf(stderr, "%s: %s is a binary file.\n", program, descr);
-               quit(-1);
-       }
-}
-
-#define E_BASH         0x01    /* Escaped by backslash. */
-#define E_QUOTE                0x02    /* Escaped by double quote. */
-#define E_SIMPLE       0x04    /* More simple characters? */
-
-cell_t *get_token(void)
-/* Read one token from the description file. */
-{
-       int whitetype= 0;
-       static int escape= 0;
-       cell_t *tok;
-       char *name;
-       int n, i;
-
-       if (escape & E_SIMPLE) {
-               /* More simple characters?  (Note: performance hack.) */
-               if (isalnum(dch)) {
-                       tok= newcell();
-                       tok->type= LETTER;
-                       tok->letter= dch;
-                       getdesc();
-                       return inc(tok);
-               }
-               escape&= ~E_SIMPLE;
-       }
-
-       /* Gather whitespace. */
-       for (;;) {
-               if (dch == '\\' && whitetype == 0) {
-                       getdesc();
-                       if (isspace(dch)) {
-                               /* \ whitespace: remove. */
-                               do {
-                                       getdesc();
-                                       if (dch == '#' && !(escape & E_QUOTE)) {
-                                               /* \ # comment */
-                                               do
-                                                       getdesc();
-                                               while (dch != '\n'
-                                                               && dch != EOF);
-                                       }
-                               } while (isspace(dch));
-                               continue;
-                       }
-                       escape|= E_BASH;        /* Escaped character. */
-               }
-
-               if (escape != 0) break;
-
-               if (dch == '#' && (indent == 0 || whitetype != 0)) {
-                       /* # Comment. */
-                       do getdesc(); while (dch != '\n' && dch != EOF);
-                       whitetype= COMMENT;
-                       break;
-               }
-
-               if (!isspace(dch) || dch == '\n' || dch == EOF) break;
-
-               whitetype= WHITE;
-
-               indent++;
-               if (dch == '\t') indent= (indent + 7) & ~7;
-
-               getdesc();
-       }
-
-       if (dch == EOF) return nil;
-
-       /* Make a token. */
-       tok= newcell();
-
-       if (whitetype != 0) {
-               tok->type= whitetype;
-               return inc(tok);
-       }
-
-       if (!(escape & E_BASH) && dch == '"') {
-               getdesc();
-               if (!(escape & E_QUOTE)) {
-                       /* Start of a string, signal this with a string cell. */
-                       escape|= E_QUOTE;
-                       tok->type= STRING;
-                       return inc(tok);
-               } else {
-                       /* End of a string, back to normal mode. */
-                       escape&= ~E_QUOTE;
-                       deallocate(tok);
-                       return get_token();
-               }
-       }
-
-       if (escape & E_BASH
-               || strchr(escape & E_QUOTE ? "$" : "$=()+-*<>;\n", dch) == nil
-       ) {
-               if (dch == '\n') {
-                       fprintf(stderr,
-                               "\"%s\", line %u: missing closing quote\n",
-                               descr, lineno);
-                       escape&= ~E_QUOTE;
-                       action= 0;
-               }
-               if (escape & E_BASH && dch == 'n') dch= '\n';
-               escape&= ~E_BASH;
-
-               /* A simple character. */
-               tok->type= LETTER;
-               tok->letter= dch;
-               getdesc();
-               escape|= E_SIMPLE;
-               return inc(tok);
-       }
-
-       if (dch != '$') {
-               /* Single character token. */
-               switch (dch) {
-               case '=':       tok->type= EQUALS;      break;
-               case '(':       tok->type= OPEN;        break;
-               case ')':       tok->type= CLOSE;       break;
-               case '+':       tok->type= PLUS;        break;
-               case '-':       tok->type= MINUS;       break;
-               case '*':       tok->type= STAR;        break;
-               case '<':       tok->type= INPUT;       break;
-               case '>':       tok->type= OUTPUT;      break;
-               case ';':       tok->type= SEMI;        break;
-               case '\n':      tok->type= EOLN;        break;
-               }
-               getdesc();
-               return inc(tok);
-       }
-
-       /* Substitution. */
-       getdesc();
-       if (dch == EOF || isspace(dch)) {
-               fprintf(stderr, "\"%s\", line %u: Word expected after '$'\n",
-                       descr, lineno);
-               action= 0;
-               deallocate(tok);
-               return get_token();
-       }
-
-       name= allocate(nil, (n= 16) * sizeof(*name));
-       i= 0;
-
-       if (dch == '{' || dch == '('  /* )} */ ) {
-               /* $(X), ${X} */
-               int lpar= dch;          /* ( */
-               int rpar= lpar == '{' ? '}' : ')';
-
-               for (;;) {
-                       getdesc();
-                       if (dch == rpar) { getdesc(); break; }
-                       if (isspace(dch) || dch == EOF) {
-                               fprintf(stderr,
-                               "\"%s\", line %u: $%c unmatched, no '%c'\n",
-                                       descr, lineno, lpar, rpar);
-                               action= 0;
-                               break;
-                       }
-                       name[i++]= dch;
-                       if (i == n)
-                               name= allocate(name, (n*= 2) * sizeof(char));
-               }
-       } else
-       if (extalnum(dch)) {
-               /* $X */
-               do {
-                       name[i++]= dch;
-                       if (i == n)
-                               name= allocate(name, (n*= 2) * sizeof(char));
-                       getdesc();
-               } while (extalnum(dch));
-       } else {
-               /* $* */
-               name[i++]= dch;
-               getdesc();
-       }
-       name[i++]= 0;
-       name= allocate(name, i * sizeof(char));
-       tok->type= SUBST;
-       tok->subst= newcell();
-       tok->subst->type= WORD;
-       tok->subst->name= name;
-       tok->subst= inc(tok->subst);
-       return inc(tok);
-}
-
-typedef enum how { SUPERFICIAL, PARTIAL, FULL, EXPLODE, IMPLODE } how_t;
-
-cell_t *explode(cell_t *p, how_t how);
-
-cell_t *get_string(cell_t **pp)
-/* Get a string: A series of letters and substs.  Special tokens '=', '+', '-'
- * and '*' are also recognized if on their own.  A finished string is "exploded"
- * to a word if it consists of letters only.
- */
-{
-       cell_t *p= *pp, *s= nil, **ps= &s;
-       int quoted= 0;
-
-       while (p != nil) {
-               switch (p->type) {
-               case STRING:
-                       quoted= 1;
-                       dec(p);
-                       break;
-               case EQUALS:
-               case PLUS:
-               case MINUS:
-               case STAR:
-               case SUBST:
-               case LETTER:
-                       *ps= cons(STRING, p);
-                       ps= &(*ps)->cdr;
-                       break;
-               default:
-                       goto got_string;
-               }
-               p= get_token();
-       }
-    got_string:
-       *pp= p;
-
-       /* A single special token must be folded up. */
-       if (!quoted && s != nil && s->cdr == nil) {
-               switch (s->car->type) {
-               case EQUALS:
-               case PLUS:
-               case MINUS:
-               case STAR:
-               case SUBST:
-                       return go(s, s->car);
-               }
-       }
-
-       /* Go over the string changing '=', '+', '-', '*' to letters. */
-       for (p= s; p != nil; p= p->cdr) {
-               int c= 0;
-
-               switch (p->car->type) {
-               case EQUALS:
-                       c= '='; break;
-               case PLUS:
-                       c= '+'; break;
-               case MINUS:
-                       c= '-'; break;
-               case STAR:
-                       c= '*'; break;
-               }
-               if (c != 0) {
-                       dec(p->car);
-                       p->car= newcell();
-                       p->car->type= LETTER;
-                       p->car->letter= c;
-                       p->car= inc(p->car);
-               }
-       }
-       return explode(s, SUPERFICIAL);
-}
-
-cell_t *get_list(cell_t **pp, type_t stop)
-/* Read a series of tokens upto a token of type "stop". */
-{
-       cell_t *p= *pp, *l= nil, **pl= &l;
-
-       while (p != nil && p->type != stop
-                               && !(stop == EOLN && p->type == SEMI)) {
-               switch (p->type) {
-               case WHITE:
-               case COMMENT:
-               case SEMI:
-               case EOLN:
-                       dec(p);
-                       p= get_token();
-                       break;
-               case OPEN:
-                       /* '(' words ')'. */
-                       dec(p);
-                       p= get_token();
-                       *pl= cons(CELL, get_list(&p, CLOSE));
-                       pl= &(*pl)->cdr;
-                       dec(p);
-                       p= get_token();
-                       break;
-               case CLOSE:
-                       /* Unexpected closing parenthesis. (*/
-                       fprintf(stderr, "\"%s\", line %u: unmatched ')'\n",
-                               descr, lineno);
-                       action= 0;
-                       dec(p);
-                       p= get_token();
-                       break;
-               case INPUT:
-               case OUTPUT:
-                       *pl= cons(CELL, p);
-                       pl= &(*pl)->cdr;
-                       p= get_token();
-                       break;
-               case STRING:
-               case EQUALS:
-               case PLUS:
-               case MINUS:
-               case STAR:
-               case LETTER:
-               case SUBST:
-                       *pl= cons(CELL, get_string(&p));
-                       pl= &(*pl)->cdr;
-                       break;
-               default:
-                       assert(0);
-               }
-       }
-
-       if (p == nil && stop == CLOSE) {
-               /* Couldn't get the closing parenthesis. */
-               fprintf(stderr, "\"%s\", lines %u-%u: unmatched '('\n", /*)*/
-                       descr, pc->lineno, lineno);
-               action= 0;
-       }
-       *pp= p;
-       return l;
-}
-
-program_t *get_line(cell_t *file)
-{
-       program_t *l;
-       cell_t *p;
-       static keep_indent= 0;
-       static unsigned old_indent= 0;
-
-       /* Skip leading whitespace to determine the indentation level. */
-       indent= 0;
-       while ((p= get_token()) != nil && p->type == WHITE) dec(p);
-
-       if (p == nil) return nil;               /* EOF */
-
-       if (p->type == EOLN) indent= old_indent;        /* Empty line. */
-
-       /* Make a program line. */
-       pc= l= allocate(nil, sizeof(*l));
-
-       l->next= nil;
-       l->file= inc(file);
-       l->indent= keep_indent ? old_indent : indent;
-       l->lineno= lineno;
-
-       l->line= get_list(&p, EOLN);
-
-       /* If the line ended in a semicolon then keep the indentation level. */
-       keep_indent= (p != nil && p->type == SEMI);
-       old_indent= l->indent;
-
-       dec(p);
-
-       if (verbose >= 4) {
-               if (l->line == nil)
-                       fputc('\n', stdout);
-               else {
-                       printf("%*s", (int) l->indent, "");
-                       prin2n(l->line);
-               }
-       }
-       return l;
-}
-
-program_t *get_prog(void)
-/* Read the description file into core. */
-{
-       cell_t *file;
-       program_t *prog, **ppg= &prog;
-
-       descr= copystr(descr);
-
-       if (descr[0] == '-' && descr[1] == 0) {
-               /* -descr -: Read from standard input. */
-               deallocate(descr);
-               descr= copystr("stdin");
-               dfp= stdin;
-       } else {
-               char *d= descr;
-
-               if (*d == '.' && *++d == '.') d++;
-               if (*d != '/') {
-                       /* -descr name: Read /usr/lib/<name>/descr. */
-
-                       d= allocate(nil, sizeof(LIB) +
-                                       (strlen(descr) + 7) * sizeof(*d));
-                       sprintf(d, "%s/%s/descr", LIB, descr);
-                       deallocate(descr);
-                       descr= d;
-               }
-               if ((dfp= fopen(descr, "r")) == nil) fatal(descr);
-       }
-       file= findword(descr);
-       deallocate(descr);
-       descr= file->name;
-
-       /* Preread the first character. */
-       dch= 0;
-       lineno= 1;
-       indent= 0;
-       getdesc();
-
-       while ((*ppg= get_line(file)) != nil) ppg= &(*ppg)->next;
-
-       if (dfp != stdin) (void) fclose(dfp);
-       dec(file);
-
-       return prog;
-}
-
-void makenames(cell_t ***ppr, cell_t *s, char **name, size_t i, size_t *n)
-/* Turn a string of letters and lists into words.  A list denotes a choice
- * between several paths, like a search on $PATH.
- */
-{
-       cell_t *p, *q;
-       size_t len;
-
-       /* Simply add letters, skip empty lists. */
-       while (s != nil && (s->car == nil || s->car->type == LETTER)) {
-               if (s->car != nil) {
-                       if (i == *n) *name= allocate(*name,
-                                               (*n *= 2) * sizeof(**name));
-                       (*name)[i++]= s->car->letter;
-               }
-               s= s->cdr;
-       }
-
-       /* If the end is reached then make a word out of the result. */
-       if (s == nil) {
-               **ppr= cons(CELL, findnword(*name, i));
-               *ppr= &(**ppr)->cdr;
-               return;
-       }
-
-       /* Elements of a list must be tried one by one. */
-       p= s->car;
-       s= s->cdr;
-
-       while (p != nil) {
-               if (p->type == WORD) {
-                       q= p; p= nil;
-               } else {
-                       assert(p->type == CELL);
-                       q= p->car; p= p->cdr;
-                       assert(q != nil);
-                       assert(q->type == WORD);
-               }
-               len= strlen(q->name);
-               if (i + len > *n) *name= allocate(*name,
-                                       (*n += i + len) * sizeof(**name));
-               memcpy(*name + i, q->name, len);
-
-               makenames(ppr, s, name, i+len, n);
-       }
-}
-
-int constant(cell_t *p)
-/* See if a string has been partially evaluated to a constant so that it
- * can be imploded to a word.
- */
-{
-       while (p != nil) {
-               switch (p->type) {
-               case CELL:
-               case STRING:
-                       if (!constant(p->car)) return 0;
-                       p= p->cdr;
-                       break;
-               case SUBST:
-                       return 0;
-               default:
-                       return 1;
-               }
-       }
-       return 1;
-}
-
-cell_t *evaluate(cell_t *p, how_t how);
-
-cell_t *explode(cell_t *s, how_t how)
-/* Explode a string with several choices to just one list of choices. */
-{
-       cell_t *t, *r= nil, **pr= &r;
-       size_t i, n;
-       char *name;
-       struct stat st;
-
-       if (how >= PARTIAL) {
-               /* Evaluate the string, expanding substitutions. */
-               while (s != nil) {
-                       assert(s->type == STRING);
-                       t= inc(s->car);
-                       s= go(s, s->cdr);
-
-                       t= evaluate(t, how == IMPLODE ? EXPLODE : how);
-
-                       /* A list of one element becomes that element. */
-                       if (t != nil && t->type == CELL && t->cdr == nil)
-                               t= go(t, t->car);
-
-                       /* Append the result, trying to flatten it. */
-                       *pr= t;
-
-                       /* Find the end of what has just been added. */
-                       while ((*pr) != nil) {
-                               *pr= append(STRING, *pr);
-                               pr= &(*pr)->cdr;
-                       }
-               }
-               s= r;
-       }
-
-       /* Is the result a simple string of constants? */
-       if (how <= PARTIAL && !constant(s)) return s;
-
-       /* Explode the string to all possible choices, by now the string is
-        * a series of characters, words and lists of words.
-        */
-       r= nil; pr= &r;
-       name= allocate(nil, (n= 16) * sizeof(char));
-       i= 0;
-
-       makenames(&pr, s, &name, i, &n);
-       deallocate(name);
-       assert(r != nil);
-       dec(s);
-       s= r;
-
-       /* "How" may specify that a choice must be made. */
-       if (how == IMPLODE) {
-               if (s->cdr != nil) {
-                       /* More than one choice, find the file. */
-                       do {
-                               assert(s->car->type == WORD);
-                               if (stat(s->car->name, &st) >= 0)
-                                       return go(r, s->car);   /* Found. */
-                       } while ((s= s->cdr) != nil);
-               }
-               /* The first name is the default if nothing is found. */
-               return go(r, r->car);
-       }
-
-       /* If the result is a list of one word then return that word, otherwise
-        * turn it into a string again unless this explode has been called
-        * by another explode.  (Exploding a string inside a string, the joys
-        * of recursion.)
-        */
-       if (s->cdr == nil) return go(s, s->car);
-
-       return how >= EXPLODE ? s : cons(STRING, s);
-}
-
-void modify(cell_t **pp, cell_t *p, type_t mode)
-/* Add or remove the element p from the list *pp. */
-{
-       while (*pp != nil) {
-               *pp= append(CELL, *pp);
-
-               if ((*pp)->car == p) {
-                       /* Found it, if adding then exit, else remove. */
-                       if (mode == PLUS) break;
-                       *pp= go(*pp, (*pp)->cdr);
-               } else
-                       pp= &(*pp)->cdr;
-       }
-
-       if (*pp == nil && mode == PLUS) {
-               /* Not found, add it. */
-               *pp= cons(CELL, p);
-       } else
-               dec(p);
-}
-
-int tainted(cell_t *p)
-/* A variable is tainted (must be substituted) if either it is marked as a
- * local variable, or some subst in its value is.
- */
-{
-       if (p == nil) return 0;
-
-       switch (p->type) {
-       case CELL:
-       case STRING:
-               return tainted(p->car) || tainted(p->cdr);
-       case SUBST:
-               return p->subst->flags & W_LOCAL || tainted(p->subst->value);
-       default:
-               return 0;
-       }
-}
-
-cell_t *evaluate(cell_t *p, how_t how)
-/* Evaluate an expression, usually the right hand side of an assignment. */
-{
-       cell_t *q, *t, *r= nil, **pr= &r;
-       type_t mode;
-
-       if (p == nil) return nil;
-
-       switch (p->type) {
-       case CELL:
-               break;  /* see below */
-       case STRING:
-               return explode(p, how);
-       case SUBST:
-               if (how >= FULL || tainted(p))
-                       p= evaluate(go(p, p->subst->value), how);
-               return p;
-       case EQUALS:
-               fprintf(stderr,
-                       "\"%s\", line %u: Can't do nested assignments\n",
-                       descr, pc->lineno);
-               action= 0;
-               dec(p);
-               return nil;
-       case LETTER:
-       case WORD:
-       case INPUT:
-       case OUTPUT:
-       case PLUS:
-       case MINUS:
-               return p;
-       default:
-               assert(0);
-       }
-
-       /* It's a list, see if there is a '*' there forcing a full expansion,
-        * or a '+' or '-' forcing an implosive expansion.  (Yeah, right.)
-        * Otherwise evaluate each element.
-        */
-       q = inc(p);
-       while (p != nil) {
-               if ((t= p->car) != nil) {
-                       if (t->type == STAR) {
-                               if (how < FULL) how= FULL;
-                               dec(q);
-                               *pr= evaluate(go(p, p->cdr), how);
-                               return r;
-                       }
-                       if (how>=FULL && (t->type == PLUS || t->type == MINUS))
-                               break;
-               }
-
-               t= evaluate(inc(t), how);
-               assert(p->type == CELL);
-               p= go(p, p->cdr);
-
-               if (how >= FULL) {
-                       /* Flatten the list. */
-                       *pr= t;
-               } else {
-                       /* Keep the nested list structure. */
-                       *pr= cons(CELL, t);
-               }
-
-               /* Find the end of what has just been added. */
-               while ((*pr) != nil) {
-                       *pr= append(CELL, *pr);
-                       pr= &(*pr)->cdr;
-               }
-       }
-
-       if (p == nil) {
-               /* No PLUS or MINUS: done. */
-               dec(q);
-               return r;
-       }
-
-       /* A PLUS or MINUS, reevaluate the original list implosively. */
-       if (how < IMPLODE) {
-               dec(r);
-               dec(p);
-               return evaluate(q, IMPLODE);
-       }
-       dec(q);
-
-       /* Execute the PLUSes and MINUSes. */
-       while (p != nil) {
-               t= inc(p->car);
-               p= go(p, p->cdr);
-
-               if (t != nil && (t->type == PLUS || t->type == MINUS)) {
-                       /* Change the add/subtract mode. */
-                       mode= t->type;
-                       dec(t);
-                       continue;
-               }
-
-               t= evaluate(t, IMPLODE);
-
-               /* Add or remove all elements of t to/from r. */
-               while (t != nil) {
-                       if (t->type == CELL) {
-                               modify(&r, inc(t->car), mode);
-                       } else {
-                               modify(&r, t, mode);
-                               break;
-                       }
-                       t= go(t, t->cdr);
-               }
-       }
-       return r;
-}
-
-/* An ACD program can be in three phases: Initialization (the first run
- * of the program), argument scanning, and compilation.
- */
-typedef enum phase { INIT, SCAN, COMPILE } phase_t;
-
-phase_t phase;
-
-typedef struct rule {          /* Transformation rule. */
-       struct rule     *next;
-       char            type;           /* arg, transform, combine */
-       char            flags;
-       unsigned short  npaths;         /* Number of paths running through. */
-#      define  match   from            /* Arg matching strings. */
-       cell_t          *from;          /* Transformation source suffixe(s) */
-       cell_t          *to;            /* Destination suffix. */
-       cell_t          *wait;          /* Files waiting to be transformed. */
-       program_t       *prog;          /* Program to execute. */
-       struct rule     *path;          /* Transformation path. */
-} rule_t;
-
-typedef enum ruletype { ARG, PREFER, TRANSFORM, COMBINE } ruletype_t;
-
-#define R_PREFER       0x01            /* A preferred transformation. */
-
-rule_t *rules= nil;
-
-void newrule(ruletype_t type, cell_t *from, cell_t *to)
-/* Make a new rule cell. */
-{
-       rule_t *r= nil, **pr= &rules;
-
-       /* See if there is a rule with the same suffixes, probably a matching
-        * transform and prefer, or a re-execution of the same arg command.
-        */
-       while ((r= *pr) != nil) {
-               if (r->from == from && r->to == to) break;
-               pr= &r->next;
-       }
-
-       if (*pr == nil) {
-               /* Add a new rule. */
-               *pr= r= allocate(nil, sizeof(*r));
-
-               r->next= nil;
-               r->type= type;
-               r->flags= 0;
-               r->from= r->to= r->wait= nil;
-               r->path= nil;
-       }
-       if (type == TRANSFORM) r->type= TRANSFORM;
-       if (type == PREFER) r->flags|= R_PREFER;
-       if (type != PREFER) r->prog= pc;
-       dec(r->from); r->from= from;
-       dec(r->to); r->to= to;
-}
-
-int talk(void)
-/* True if verbose and if so indent what is to come. */
-{
-       if (verbose < 3) return 0;
-       printf("%*s", (int) pc->indent, "");
-       return 1;
-}
-
-void unix_exec(cell_t *c)
-/* Execute the list of words p as a UNIX command. */
-{
-       cell_t *v, *a;
-       int fd[2];
-       int *pf;
-       char **argv;
-       int i, n;
-       int r, pid, status;
-
-       if (action == 0) return;        /* Error mode. */
-
-       if (talk() || verbose >= 2) prin2n(c);
-
-       fd[0]= fd[1]= -1;
-
-       argv= allocate(nil, (n= 16) * sizeof(*argv));
-       i= 0;
-
-       /* Gather argv[] and scan for I/O redirection. */
-       for (v= c; v != nil; v= v->cdr) {
-               a= v->car;
-               pf= nil;
-               if (a->type == INPUT) pf= &fd[0];
-               if (a->type == OUTPUT) pf= &fd[1];
-
-               if (pf == nil) {
-                       /* An argument. */
-                       argv[i++]= a->name;
-                       if (i==n) argv= allocate(argv, (n*= 2) * sizeof(*argv));
-                       continue;
-               }
-               /* I/O redirection. */
-               if ((v= v->cdr) == nil || (a= v->car)->type != WORD) {
-                       fprintf(stderr,
-                       "\"%s\", line %u: I/O redirection without a file\n",
-                               descr, pc->lineno);
-                       action= 0;
-                       if (v == nil) break;
-               }
-               if (*pf >= 0) close(*pf);
-
-               if (action >= 2
-                       && (*pf= open(a->name, pf == &fd[0] ? O_RDONLY
-                               : O_WRONLY | O_CREAT | O_TRUNC, 0666)) < 0
-               ) {
-                       report(a->name);
-                       action= 0;
-               }
-       }
-       argv[i]= nil;
-
-       if (i >= 0 && action > 0 && verbose == 1) {
-               char *name= strrchr(argv[0], '/');
-
-               if (name == nil) name= argv[0]; else name++;
-
-               printf("%s\n", name);
-       }
-       if (i >= 0 && action >= 2) {
-               /* Really execute the command. */
-               fflush(stdout);
-               switch (pid= fork()) {
-               case -1:
-                       fatal("fork()");
-               case 0:
-                       if (fd[0] >= 0) { dup2(fd[0], 0); close(fd[0]); }
-                       if (fd[1] >= 0) { dup2(fd[1], 1); close(fd[1]); }
-                       execvp(argv[0], argv);
-                       report(argv[0]);
-                       exit(-1);
-               }
-       }
-       if (fd[0] >= 0) close(fd[0]);
-       if (fd[1] >= 0) close(fd[1]);
-
-       if (i >= 0 && action >= 2) {
-               /* Wait for the command to terminate. */
-               while ((r= wait(&status)) != pid && (r >= 0 || errno == EINTR));
-
-               if (status != 0) {
-                       int sig= WTERMSIG(status);
-
-                       if (!WIFEXITED(status)
-                                       && sig != SIGINT && sig != SIGPIPE) {
-                               fprintf(stderr, "%s: %s: Signal %d%s\n",
-                                       program, argv[0], sig,
-                                       status & 0x80 ? " - core dumped" : "");
-                       }
-                       action= 0;
-               }
-       }
-       deallocate(argv);
-}
-
-/* Special read-only variables ($*) and lists. */
-cell_t *V_star, **pV_star;
-cell_t *L_files, **pL_files= &L_files;
-cell_t *V_in, *V_out, *V_stop, *L_args, *L_predef;
-
-typedef enum exec { DOIT, DONT } exec_t;
-
-void execute(exec_t how, unsigned indent);
-
-int equal(cell_t *p, cell_t *q)
-/* Two lists are equal if they contain each others elements. */
-{
-       cell_t *t, *m1, *m2;
-
-       t= inc(newcell());
-       t->cdr= inc(newcell());
-       t->cdr->cdr= inc(newcell());
-       t->cdr->car= newcell();
-       t->cdr->car->type= MINUS;
-       t->cdr->car= inc(t->cdr->car);
-
-       /* Compute p - q. */
-       t->car= inc(p);
-       t->cdr->cdr->car= inc(q);
-       m1= evaluate(inc(t), IMPLODE);
-       dec(m1);
-
-       /* Compute q - p. */
-       t->car= q;
-       t->cdr->cdr->car= p;
-       m2= evaluate(t, IMPLODE);
-       dec(m2);
-
-       /* Both results must be empty. */
-       return m1 == nil && m2 == nil;
-}
-
-int wordlist(cell_t **pw, int atom)
-/* Check if p is a list of words, typically an imploded list.  Return
- * the number of words seen, -1 if they are not words (INPUT/OUTPUT?).
- * If atom is true than a list of one word is turned into a word.
- */
-{
-       int n= 0;
-       cell_t *p, **pp= pw;
-
-       while (*pp != nil) {
-               *pp= append(CELL, *pp);
-               p= (*pp)->car;
-               n= n >= 0 && p != nil && p->type == WORD ? n+1 : -1;
-               pp= &(*pp)->cdr;
-       }
-       if (atom && n == 1) *pw= go(*pw, (*pw)->car);
-       return n;
-}
-
-char *template;                /* Current name of a temporary file. */
-static char *tp;       /* Current place withing the tempfile. */
-
-char *maketemp(void)
-/* Return a name that can be used as a temporary filename. */
-{
-       int i= 0;
-
-       if (tp == nil) {
-               size_t len= strlen(template);
-
-               template= allocate(template, (len+20) * sizeof(*template));
-               sprintf(template+len, "/acd%d", getpid());
-               tp= template + strlen(template);
-       }
-
-       for (;;) {
-               switch (tp[i]) {
-               case 0:         tp[i]= 'a';
-                               tp[i+1]= 0;     return template;
-               case 'z':       tp[i++]= 'a';   break;
-               default:        tp[i]++;        return template;
-               }
-       }
-}
-
-void inittemp(char *tmpdir)
-/* Initialize the temporary filename generator. */
-{
-       template= allocate(nil, (strlen(tmpdir)+20) * sizeof(*template));
-       sprintf(template, "%s/acd%d", tmpdir, getpid());
-       tp= template + strlen(template);
-
-       /* Create a directory within tempdir that we can safely play in. */
-       while (action != 1 && mkdir(template, 0700) < 0) {
-               if (errno == EEXIST) {
-                       (void) maketemp();
-               } else {
-                       report(template);
-                       action= 0;
-               }
-       }
-       if (verbose >= 2) printf("mkdir %s\n", template);
-       while (*tp != 0) tp++;
-       *tp++= '/';
-       *tp= 0;
-}
-
-void deltemp(void)
-/* Remove our temporary temporaries directory. */
-{
-       while (*--tp != '/') {}
-       *tp = 0;
-       if (rmdir(template) < 0 && errno != ENOENT) report(template);
-       if (verbose >= 2) printf("rmdir %s\n", template);
-       deallocate(template);
-}
-
-cell_t *splitenv(char *env)
-/* Split a string from the environment into several words at whitespace
- * and colons.  Two colons (::) become a dot.
- */
-{
-       cell_t *r= nil, **pr= &r;
-       char *p;
-
-       do {
-               while (*env != 0 && isspace(*env)) env++;
-
-               if (*env == 0) break;
-
-               p= env;
-               while (*p != 0 && !isspace(*p) && *p != ':') p++;
-
-               *pr= cons(CELL,
-                       p == env ? findword(".") : findnword(env, p-env));
-               pr= &(*pr)->cdr;
-               env= p;
-       } while (*env++ != 0);
-       return r;
-}
-
-void key_usage(char *how)
-{
-       fprintf(stderr, "\"%s\", line %u: Usage: %s %s\n",
-               descr, pc->lineno, pc->line->car->name, how);
-       action= 0;
-}
-
-void inappropriate(void)
-{
-       fprintf(stderr, "\"%s\", line %u: wrong execution phase for '%s'\n",
-               descr, pc->lineno, pc->line->car->name);
-       action= 0;
-}
-
-int readonly(cell_t *v)
-{
-       if (v->flags & W_RDONLY) {
-               fprintf(stderr, "\"%s\", line %u: %s is read-only\n",
-                       descr, pc->lineno, v->name);
-               action= 0;
-               return 1;
-       }
-       return 0;
-}
-
-void complain(cell_t *err)
-/* acd: err ... */
-{
-       cell_t *w;
-
-       fprintf(stderr, "%s:", program);
-
-       while (err != nil) {
-               if (err->type == CELL) {
-                       w= err->car; err= err->cdr;
-               } else {
-                       w= err; err= nil;
-               }
-               fprintf(stderr, " %s", w->name);
-       }
-       action= 0;
-}
-
-int keyword(char *name)
-/* True if the current line is headed by the given keyword. */
-{
-       cell_t *t;
-
-       return (t= pc->line) != nil && t->type == CELL
-               && (t= t->car) != nil && t->type == WORD
-               && strcmp(t->name, name) == 0;
-}
-
-cell_t *getvar(cell_t *v)
-/* Return a word or the word referenced by a subst. */
-{
-       if (v == nil) return nil;
-       if (v->type == WORD) return v;
-       if (v->type == SUBST) return v->subst;
-       return nil;
-}
-
-void argscan(void), compile(void);
-void transform(rule_t *);
-
-void exec_one(void)
-/* Execute one line of the program. */
-{
-       cell_t *v, *p, *q, *r, *t;
-       unsigned n= 0;
-       static int last_if= 1;
-
-       /* Description file this line came from. */
-       descr= pc->file->name;
-
-       for (p= pc->line; p != nil; p= p->cdr) n++;
-
-       if (n == 0) return;     /* Null statement. */
-
-       p= pc->line;
-       q= p->cdr;
-       r= q == nil ? nil : q->cdr;
-
-       /* Try one by one all the different commands. */
-
-       if (n >= 2 && q->car != nil && q->car->type == EQUALS) {
-               /* An assignment. */
-               int flags;
-
-               if ((v= getvar(p->car)) == nil) {
-                       fprintf(stderr,
-                               "\"%s\", line %u: Usage: <var> = expr ...\n",
-                               descr, pc->lineno);
-                       action= 0;
-                       return;
-               }
-
-               if (readonly(v)) return;
-
-               flags= v->flags;
-               v->flags|= W_LOCAL|W_RDONLY;
-               t= evaluate(inc(r), PARTIAL);
-               dec(v->value);
-               v->value= t;
-               v->flags= flags | W_SET;
-               if (talk()) {
-                       printf("%s =\b=\b= ", v->name);
-                       prin2n(t);
-               }
-       } else
-       if (keyword("unset")) {
-               /* Set a variable to "undefined". */
-
-               if (n != 2 || (v= getvar(q->car)) == nil) {
-                       key_usage("<var>");
-                       return;
-               }
-               if (readonly(v)) return;
-
-               if (talk()) prin2n(p);
-
-               dec(v->value);
-               v->value= nil;
-               v->flags&= ~W_SET;
-       } else
-       if (keyword("import")) {
-               /* Import a variable from the UNIX environment. */
-               char *env;
-
-               if (n != 2 || (v= getvar(q->car)) == nil) {
-                       key_usage("<var>");
-                       return;
-               }
-               if (readonly(v)) return;
-
-               if ((env= getenv(v->name)) == nil) return;
-
-               if (talk()) printf("import %s=%s\n", v->name, env);
-
-               t= splitenv(env);
-               dec(v->value);
-               v->value= t;
-               v->flags|= W_SET;
-       } else
-       if (keyword("mktemp")) {
-               /* Assign a variable the name of a temporary file. */
-               char *tmp, *suff;
-
-               r= evaluate(inc(r), IMPLODE);
-               if (n == 3 && wordlist(&r, 1) != 1) n= 0;
-
-               if ((n != 2 && n != 3) || (v= getvar(q->car)) == nil) {
-                       dec(r);
-                       key_usage("<var> [<suffix>]");
-                       return;
-               }
-               if (readonly(v)) { dec(r); return; }
-
-               tmp= maketemp();
-               suff= r == nil ? "" : r->name;
-
-               t= newcell();
-               t->type= WORD;
-               t->name= allocate(nil,
-                       (strlen(tmp) + strlen(suff) + 1) * sizeof(*t->name));
-               strcpy(t->name, tmp);
-               strcat(t->name, suff);
-               t= inc(t);
-               dec(r);
-               dec(v->value);
-               v->value= t;
-               v->flags|= W_SET;
-               t->flags|= W_TEMP;
-               if (talk()) printf("mktemp %s=%s\n", v->name, t->name);
-       } else
-       if (keyword("temporary")) {
-               /* Mark a word as a temporary file. */
-               cell_t *tmp;
-
-               tmp= evaluate(inc(q), IMPLODE);
-
-               if (wordlist(&tmp, 1) < 0) {
-                       dec(tmp);
-                       key_usage("<word>");
-                       return;
-               }
-               if (talk()) printf("temporary %s\n", tmp->name);
-
-               tmp->flags|= W_TEMP;
-               dec(tmp);
-       } else
-       if (keyword("stop")) {
-               /* Set the suffix to stop the transformation on. */
-               cell_t *suff;
-
-               if (phase > SCAN) { inappropriate(); return; }
-
-               suff= evaluate(inc(q), IMPLODE);
-
-               if (wordlist(&suff, 1) != 1) {
-                       dec(suff);
-                       key_usage("<suffix>");
-                       return;
-               }
-               dec(V_stop);
-               V_stop= suff;
-               if (talk()) printf("stop %s\n", suff->name);
-       } else
-       if (keyword("numeric")) {
-               /* Check if a string denotes a number, like $n in -O$n. */
-               cell_t *num;
-               char *pn;
-
-               num= evaluate(inc(q), IMPLODE);
-
-               if (wordlist(&num, 1) != 1) {
-                       dec(num);
-                       key_usage("<arg>");
-                       return;
-               }
-               if (talk()) printf("numeric %s\n", num->name);
-
-               (void) strtoul(num->name, &pn, 10);
-               if (*pn != 0) {
-                       complain(phase == SCAN ? V_star->value : nil);
-                       if (phase == SCAN) fputc(':', stderr);
-                       fprintf(stderr, " '%s' is not a number\n", num->name);
-               }
-               dec(num);
-       } else
-       if (keyword("error")) {
-               /* Signal an error. */
-               cell_t *err;
-
-               err= evaluate(inc(q), IMPLODE);
-
-               if (wordlist(&err, 0) < 1) {
-                       dec(err);
-                       key_usage("expr ...");
-                       return;
-               }
-
-               if (talk()) { printf("error "); prin2n(err); }
-
-               complain(err);
-               fputc('\n', stderr);
-               dec(err);
-       } else
-       if (keyword("if")) {
-               /* if (list) = (list) using set comparison. */
-               int eq;
-
-               if (n != 4 || r->car == nil || r->car->type != EQUALS) {
-                       key_usage("<expr> = <expr>");
-                       execute(DONT, pc->indent+1);
-                       last_if= 1;
-                       return;
-               }
-               q= q->car;
-               r= r->cdr->car;
-               if (talk()) {
-                       printf("if ");
-                       prin1(t= evaluate(inc(q), IMPLODE));
-                       dec(t);
-                       printf(" = ");
-                       prin1n(t= evaluate(inc(r), IMPLODE));
-                       dec(t);
-               }
-               eq= equal(q, r);
-               execute(eq ? DOIT : DONT, pc->indent+1);
-               last_if= eq;
-       } else
-       if (keyword("ifdef") || keyword("ifndef")) {
-               /* Is a variable defined or undefined? */
-               int doit;
-
-               if (n != 2 || (v= getvar(q->car)) == nil) {
-                       key_usage("<var>");
-                       execute(DONT, pc->indent+1);
-                       last_if= 1;
-                       return;
-               }
-               if (talk()) prin2n(p);
-
-               doit= ((v->flags & W_SET) != 0) ^ (p->car->name[2] == 'n');
-               execute(doit ? DOIT : DONT, pc->indent+1);
-               last_if= doit;
-       } else
-       if (keyword("iftemp") || keyword("ifhash")) {
-               /* Is a file a temporary file? */
-               /* Does a file need preprocessing? */
-               cell_t *file;
-               int doit= 0;
-
-               file= evaluate(inc(q), IMPLODE);
-
-               if (wordlist(&file, 1) != 1) {
-                       dec(file);
-                       key_usage("<arg>");
-                       return;
-               }
-               if (talk()) printf("%s %s\n", p->car->name, file->name);
-
-               if (p->car->name[2] == 't') {
-                       /* iftemp file */
-                       if (file->flags & W_TEMP) doit= 1;
-               } else {
-                       /* ifhash file */
-                       int fd;
-                       char hash;
-
-                       if ((fd= open(file->name, O_RDONLY)) >= 0) {
-                               if (read(fd, &hash, 1) == 1 && hash == '#')
-                                       doit= 1;
-                               close(fd);
-                       }
-               }
-               dec(file);
-
-               execute(doit ? DOIT : DONT, pc->indent+1);
-               last_if= doit;
-       } else
-       if (keyword("else")) {
-               /* Else clause for an if, ifdef, or ifndef. */
-               if (n != 1) {
-                       key_usage("");
-                       execute(DONT, pc->indent+1);
-                       return;
-               }
-               if (talk()) prin2n(p);
-
-               execute(!last_if ? DOIT : DONT, pc->indent+1);
-       } else
-       if (keyword("treat")) {
-               /* Treat a file as having a certain suffix. */
-
-               if (phase > SCAN) { inappropriate(); return; }
-
-               if (n == 3) {
-                       q= evaluate(inc(q->car), IMPLODE);
-                       r= evaluate(inc(r->car), IMPLODE);
-               }
-               if (n != 3 || wordlist(&q, 1) != 1 || wordlist(&r, 1) != 1) {
-                       if (n == 3) { dec(q); dec(r); }
-                       key_usage("<file> <suffix>");
-                       return;
-               }
-               if (talk()) printf("treat %s %s\n", q->name, r->name);
-
-               dec(q->suffix);
-               q->suffix= r;
-               q->flags|= W_SUFF;
-               dec(q);
-       } else
-       if (keyword("apply")) {
-               /* Apply a transformation rule to the current input file. */
-               rule_t *rule, *sav_path;
-               cell_t *sav_wait, *sav_in, *sav_out;
-               program_t *sav_next;
-
-               if (phase != COMPILE) { inappropriate(); return; }
-
-               if (V_star->value->cdr != nil) {
-                       fprintf(stderr, "\"%s\", line %u: $* is not one file\n",
-                               descr, pc->lineno);
-                       action= 0;
-                       return;
-               }
-               if (n == 3) {
-                       q= evaluate(inc(q->car), IMPLODE);
-                       r= evaluate(inc(r->car), IMPLODE);
-               }
-               if (n != 3 || wordlist(&q, 1) != 1 || wordlist(&r, 1) != 1) {
-                       if (n == 3) { dec(q); dec(r); }
-                       key_usage("<file> <suffix>");
-                       return;
-               }
-               if (talk()) printf("apply %s %s\n", q->name, r->name);
-
-               /* Find a rule */
-               for (rule= rules; rule != nil; rule= rule->next) {
-                       if (rule->type == TRANSFORM
-                               && rule->from == q && rule->to == r) break;
-               }
-               if (rule == nil) {
-                       fprintf(stderr,
-                               "\"%s\", line %u: no %s %s transformation\n",
-                               descr, pc->lineno, q->name, r->name);
-                       action= 0;
-               }
-               dec(q);
-               dec(r);
-               if (rule == nil) return;
-
-               /* Save the world. */
-               sav_path= rule->path;
-               sav_wait= rule->wait;
-               sav_in= V_in->value;
-               sav_out= V_out->value;
-               sav_next= nextpc;
-
-               /* Isolate the rule and give it new input. */
-               rule->path= rule;
-               rule->wait= V_star->value;
-               V_star->value= nil;
-               V_in->value= nil;
-               V_out->value= nil;
-
-               transform(rule);
-
-               /* Retrieve the new $* and repair. */
-               V_star->value= rule->wait;
-               rule->path= sav_path;
-               rule->wait= sav_wait;
-               V_in->value= sav_in;
-               V_out->value= sav_out;
-               V_out->flags= W_SET|W_LOCAL;
-               nextpc= sav_next;
-       } else
-       if (keyword("include")) {
-               /* Include another description file into this program. */
-               cell_t *file;
-               program_t *incl, *prog, **ppg= &prog;
-
-               file= evaluate(inc(q), IMPLODE);
-
-               if (wordlist(&file, 1) != 1) {
-                       dec(file);
-                       key_usage("<file>");
-                       return;
-               }
-               if (talk()) printf("include %s\n", file->name);
-               descr= file->name;
-               incl= pc;
-               prog= get_prog();
-               dec(file);
-
-               /* Raise the program to the include's indent level. */
-               while (*ppg != nil) {
-                       (*ppg)->indent += incl->indent;
-                       ppg= &(*ppg)->next;
-               }
-
-               /* Kill the include and splice the included program in. */
-               dec(incl->line);
-               incl->line= nil;
-               *ppg= incl->next;
-               incl->next= prog;
-               pc= incl;
-               nextpc= prog;
-       } else
-       if (keyword("arg")) {
-               /* An argument scanning rule. */
-
-               if (phase > SCAN) { inappropriate(); return; }
-
-               if (n < 2) {
-                       key_usage("<string> ...");
-                       execute(DONT, pc->indent+1);
-                       return;
-               }
-               if (talk()) prin2n(p);
-
-               newrule(ARG, inc(q), nil);
-
-               /* Always skip the body, it comes later. */
-               execute(DONT, pc->indent+1);
-       } else
-       if (keyword("transform")) {
-               /* A file transformation rule. */
-
-               if (phase > SCAN) { inappropriate(); return; }
-
-               if (n == 3) {
-                       q= evaluate(inc(q->car), IMPLODE);
-                       r= evaluate(inc(r->car), IMPLODE);
-               }
-               if (n != 3 || wordlist(&q, 1) != 1 || wordlist(&r, 1) != 1) {
-                       if (n == 3) { dec(q); dec(r); }
-                       key_usage("<suffix1> <suffix2>");
-                       execute(DONT, pc->indent+1);
-                       return;
-               }
-               if (talk()) printf("transform %s %s\n", q->name, r->name);
-
-               newrule(TRANSFORM, q, r);
-
-               /* Body comes later. */
-               execute(DONT, pc->indent+1);
-       } else
-       if (keyword("prefer")) {
-               /* Prefer a transformation over others. */
-
-               if (phase > SCAN) { inappropriate(); return; }
-
-               if (n == 3) {
-                       q= evaluate(inc(q->car), IMPLODE);
-                       r= evaluate(inc(r->car), IMPLODE);
-               }
-               if (n != 3 || wordlist(&q, 1) != 1 || wordlist(&r, 1) != 1) {
-                       if (n == 3) { dec(q); dec(r); }
-                       key_usage("<suffix1> <suffix2>");
-                       return;
-               }
-               if (talk()) printf("prefer %s %s\n", q->name, r->name);
-
-               newrule(PREFER, q, r);
-       } else
-       if (keyword("combine")) {
-               /* A file combination (loader) rule. */
-
-               if (phase > SCAN) { inappropriate(); return; }
-
-               if (n == 3) {
-                       q= evaluate(inc(q->car), IMPLODE);
-                       r= evaluate(inc(r->car), IMPLODE);
-               }
-               if (n != 3 || wordlist(&q, 0) < 1 || wordlist(&r, 1) != 1) {
-                       if (n == 3) { dec(q); dec(r); }
-                       key_usage("<suffix-list> <suffix>");
-                       execute(DONT, pc->indent+1);
-                       return;
-               }
-               if (talk()) {
-                       printf("combine ");
-                       prin1(q);
-                       printf(" %s\n", r->name);
-               }
-
-               newrule(COMBINE, q, r);
-
-               /* Body comes later. */
-               execute(DONT, pc->indent+1);
-       } else
-       if (keyword("scan") || keyword("compile")) {
-               program_t *next= nextpc;
-
-               if (n != 1) { key_usage(""); return; }
-               if (phase != INIT) { inappropriate(); return; }
-
-               if (talk()) prin2n(p);
-
-               argscan();
-               if (p->car->name[0] == 'c') compile();
-               nextpc= next;
-       } else {
-               /* A UNIX command. */
-               t= evaluate(inc(pc->line), IMPLODE);
-               unix_exec(t);
-               dec(t);
-       }
-}
-
-void execute(exec_t how, unsigned indent)
-/* Execute (or skip) all lines with at least the given indent. */
-{
-       int work= 0;    /* Need to execute at least one line. */
-       unsigned firstline;
-       unsigned nice_indent= 0;        /* 0 = Don't know what's nice yet. */
-
-       if (pc == nil) return;  /* End of program. */
-
-       firstline= pc->lineno;
-
-       if (how == DONT) {
-               /* Skipping a body, but is there another guard? */
-               pc= pc->next;
-               if (pc != nil && pc->indent < indent && pc->line != nil) {
-                       /* There is one!  Bail out, then it get's executed. */
-                       return;
-               }
-       } else {
-               /* Skip lines with a lesser indentation, they are guards for
-                * the same substatements.  Don't go past empty lines.
-                */
-               while (pc != nil && pc->indent < indent && pc->line != nil)
-                       pc= pc->next;
-       }
-
-       /* Execute all lines with an indentation of at least "indent". */
-       while (pc != nil && pc->indent >= indent) {
-               if (pc->indent != nice_indent && how == DOIT) {
-                       if (nice_indent != 0) {
-                               fprintf(stderr,
-                       "\"%s\", line %u: (warning) sudden indentation shift\n",
-                                       descr, pc->lineno);
-                       }
-                       nice_indent= pc->indent;
-               }
-               nextpc= pc->next;
-               if (how == DOIT) exec_one();
-               pc= nextpc;
-               work= 1;
-       }
-
-       if (indent > 0 && !work) {
-               fprintf(stderr, "\"%s\", line %u: empty body, no statements\n",
-                       descr, firstline);
-               action= 0;
-       }
-}
-
-int argmatch(int shift, cell_t *match, cell_t *match1, char *arg1)
-/* Try to match an arg rule to the input file list L_args.  Execute the arg
- * body (pc is set to it) on success.
- */
-{
-       cell_t *oldval, *v;
-       int m, oldflags;
-       size_t i, len;
-       int minus= 0;
-
-       if (shift) {
-               /* An argument has been accepted and may be shifted to $*. */
-               cell_t **oldpstar= pV_star;
-               *pV_star= L_args;
-               L_args= *(pV_star= &L_args->cdr);
-               *pV_star= nil;
-
-               if (argmatch(0, match->cdr, nil, nil)) return 1;
-
-               /* Undo the damage. */
-               *pV_star= L_args;
-               L_args= *(pV_star= oldpstar);
-               *pV_star= nil;
-               return 0;
-       }
-
-       if (match == nil) {
-               /* A full match, execute the arg body. */
-
-               /* Enable $>. */
-               V_out->flags= W_SET|W_LOCAL;
-
-               if (verbose >= 3) {
-                       prin2(pc->line);
-                       printf(" =\b=\b= ");
-                       prin2n(V_star->value);
-               }
-               execute(DOIT, pc->indent+1);
-
-               /* Append $> to the file list. */
-               if (V_out->value != nil) {
-                       *pL_files= cons(CELL, V_out->value);
-                       pL_files= &(*pL_files)->cdr;
-               }
-
-               /* Disable $>. */
-               V_out->value= nil;
-               V_out->flags= W_SET|W_LOCAL|W_RDONLY;
-
-               return 1;
-       }
-
-       if (L_args == nil) return 0;    /* Out of arguments to match. */
-
-       /* Match is a list of words, substs and strings containing letters and
-        * substs.  Match1 is the current element of the first element of match.
-        * Arg1 is the current character of the first element of L_args.
-        */
-       if (match1 == nil) {
-               /* match1 is at the end of a string, then arg1 must also. */
-               if (arg1 != nil) {
-                       if (*arg1 != 0) return 0;
-                       return argmatch(1, match, nil, nil);
-               }
-               /* If both are nil: Initialize. */
-               match1= match->car;
-               arg1= L_args->car->name;
-
-               /* A subst may not match a leading '-'. */
-               if (arg1[0] == '-') minus= 1;
-       }
-
-       if (match1->type == WORD && strcmp(match1->name, arg1) == 0) {
-               /* A simple match of an argument. */
-
-               return argmatch(1, match, nil, nil);
-       }
-
-       if (match1->type == SUBST && !minus) {
-               /* A simple match of a subst. */
-
-               /* The variable gets the first of the arguments as its value. */
-               v= match1->subst;
-               if (v->flags & W_RDONLY) return 0;      /* ouch */
-               oldflags= v->flags;
-               v->flags= W_SET|W_LOCAL|W_RDONLY;
-               oldval= v->value;
-               v->value= inc(L_args->car);
-
-               m= argmatch(1, match, nil, nil);
-
-               /* Recover the value of the variable. */
-               dec(v->value);
-               v->flags= oldflags;
-               v->value= oldval;
-               return m;
-       }
-       if (match1->type != STRING) return 0;
-
-       /* Match the first item in the string. */
-       if (match1->car == nil) return 0;
-
-       if (match1->car->type == LETTER
-                       && match1->car->letter == (unsigned char) *arg1) {
-               /* A letter matches, try the rest of the string. */
-
-               return argmatch(0, match, match1->cdr, arg1+1);
-       }
-
-       /* It can only be a subst in a string now. */
-       len= strlen(arg1);
-       if (match1->car->type != SUBST || minus || len == 0) return 0;
-
-       /* The variable can match from 1 character to all of the argument.
-        * Matching as few characters as possible happens to be the Right Thing.
-        */
-       v= match1->car->subst;
-       if (v->flags & W_RDONLY) return 0;      /* ouch */
-       oldflags= v->flags;
-       v->flags= W_SET|W_LOCAL|W_RDONLY;
-       oldval= v->value;
-
-       m= 0;
-       for (i= match1->cdr == nil ? len : 1; !m && i <= len; i++) {
-               v->value= findnword(arg1, i);
-
-               m= argmatch(0, match, match1->cdr, arg1+i);
-
-               dec(v->value);
-       }
-       /* Recover the value of the variable. */
-       v->flags= oldflags;
-       v->value= oldval;
-       return m;
-}
-
-void argscan(void)
-/* Match all the arguments to the arg rules, those that don't match are
- * used as files for transformation.
- */
-{
-       rule_t *rule;
-       int m;
-
-       phase= SCAN;
-
-       /* Process all the arguments. */
-       while (L_args != nil) {
-               pV_star= &V_star->value;
-
-               /* Try all the arg rules. */
-               m= 0;
-               for (rule= rules; !m && rule != nil; rule= rule->next) {
-                       if (rule->type != ARG) continue;
-
-                       pc= rule->prog;
-
-                       m= argmatch(0, rule->match, nil, nil);
-               }
-               dec(V_star->value);
-               V_star->value= nil;
-
-               /* On failure, add the first argument to the list of files. */
-               if (!m) {
-                       *pL_files= L_args;
-                       L_args= *(pL_files= &L_args->cdr);
-                       *pL_files= nil;
-               }
-       }
-       phase= INIT;
-}
-
-int member(cell_t *p, cell_t *l)
-/* True if p is a member of list l. */
-{
-       while (l != nil && l->type == CELL) {
-               if (p == l->car) return 1;
-               l= l->cdr;
-       }
-       return p == l;
-}
-
-long basefind(cell_t *f, cell_t *l)
-/* See if f has a suffix in list l + set the base name of f.
- * -1 if not found, preference number for a short basename otherwise. */
-{
-       cell_t *suff;
-       size_t blen, slen;
-       char *base;
-
-       /* Determine base name of f, with suffix. */
-       if ((base= strrchr(f->name, '/')) == nil) base= f->name; else base++;
-       blen= strlen(base);
-
-       /* Try suffixes. */
-       while (l != nil) {
-               if (l->type == CELL) {
-                       suff= l->car; l= l->cdr;
-               } else {
-                       suff= l; l= nil;
-               }
-               if (f->flags & W_SUFF) {
-                       /* F has a suffix imposed on it. */
-                       if (f->suffix == suff) return 0;
-                       continue;
-               }
-               slen= strlen(suff->name);
-               if (slen < blen && strcmp(base+blen-slen, suff->name) == 0) {
-                       /* Got it! */
-                       dec(f->base);
-                       f->base= findnword(base, blen-slen);
-                       return 10000L * (blen - slen);
-               }
-       }
-       return -1;
-}
-
-#define NO_PATH                2000000000      /* No path found yet. */
-
-long shortest;         /* Length of the shortest path as yet. */
-
-rule_t *findpath(long depth, int seek, cell_t *file, rule_t *start)
-/* Find the path of the shortest transformation to the stop suffix. */
-{
-       rule_t *rule;
-
-       if (action == 0) return nil;
-
-       if (start == nil) {
-               /* No starting point defined, find one using "file". */
-
-               for (rule= rules; rule != nil; rule= rule->next) {
-                       if (rule->type < TRANSFORM) continue;
-
-                       if ((depth= basefind(file, rule->from)) >= 0) {
-                               if (findpath(depth, seek, nil, rule) != nil)
-                                       return rule;
-                       }
-               }
-               return nil;
-       }
-
-       /* Cycle? */
-       if (start->path != nil) {
-               /* We can't have cycles through combines. */
-               if (start->type == COMBINE) {
-                       fprintf(stderr,
-                               "\"%s\": contains a combine-combine cycle\n",
-                               descr);
-                       action= 0;
-               }
-               return nil;
-       }
-
-       /* Preferred transformations are cheap. */
-       if (start->flags & R_PREFER) depth-= 100;
-
-       /* Try to go from start closer to the stop suffix. */
-       for (rule= rules; rule != nil; rule= rule->next) {
-               if (rule->type < TRANSFORM) continue;
-
-               if (member(start->to, rule->from)) {
-                       start->path= rule;
-                       rule->npaths++;
-                       if (findpath(depth+1, seek, nil, rule) != nil)
-                               return start;
-                       start->path= nil;
-                       rule->npaths--;
-               }
-       }
-
-       if (V_stop == nil) {
-               fprintf(stderr, "\"%s\": no stop suffix has been defined\n",
-                       descr);
-               action= 0;
-               return nil;
-       }
-
-       /* End of the line? */
-       if (start->to == V_stop) {
-               /* Got it. */
-               if (seek) {
-                       /* Second hunt, do we find the shortest? */
-                       if (depth == shortest) return start;
-               } else {
-                       /* Is this path shorter than the last one? */
-                       if (depth < shortest) shortest= depth;
-               }
-       }
-       return nil;     /* Fail. */
-}
-
-void transform(rule_t *rule)
-/* Transform the file(s) connected to the rule according to the rule. */
-{
-       cell_t *file, *in, *out;
-       char *base;
-
-       /* Let $* be the list of input files. */
-       while (rule->wait != nil) {
-               file= rule->wait;
-               rule->wait= file->cdr;
-               file->cdr= V_star->value;
-               V_star->value= file;
-       }
-
-       /* Set $< to the basename of the first input file. */
-       file= file->car;
-       V_in->value= in= inc(file->flags & W_SUFF ? file : file->base);
-       file->flags&= ~W_SUFF;
-
-       /* Set $> to the output file name of the transformation. */
-       out= newcell();
-       out->type= WORD;
-       base= rule->path == nil ? in->name : maketemp();
-       out->name= allocate(nil,
-               (strlen(base)+strlen(rule->to->name)+1) * sizeof(*out->name));
-       strcpy(out->name, base);
-       if (rule->path == nil || strchr(rule->to->name, '/') == nil)
-               strcat(out->name, rule->to->name);
-       out= inc(out);
-       if (rule->path != nil) out->flags|= W_TEMP;
-
-       V_out->value= out;
-       V_out->flags= W_SET|W_LOCAL;
-
-       /* Do a transformation.  (Finally) */
-       if (verbose >= 3) {
-               printf("%s ", rule->type==TRANSFORM ? "transform" : "combine");
-               prin2(V_star->value);
-               printf(" %s\n", out->name);
-       }
-       pc= rule->prog;
-       execute(DOIT, pc->indent+1);
-
-       /* Hand $> over to the next rule, it must be a single word. */
-       out= evaluate(V_out->value, IMPLODE);
-       if (wordlist(&out, 1) != 1) {
-               fprintf(stderr,
-               "\"%s\", line %u: $> should be returned as a single word\n",
-                       descr, rule->prog->lineno);
-               action= 0;
-       }
-
-       if ((rule= rule->path) != nil) {
-               /* There is a next rule. */
-               dec(out->base);
-               out->base= in;          /* Basename of input file. */
-               file= inc(newcell());
-               file->car= out;
-               file->cdr= rule->wait;
-               rule->wait= file;
-       } else {
-               dec(in);
-               dec(out);
-       }
-
-       /* Undo the damage to $*, $<, and $>. */
-       dec(V_star->value);
-       V_star->value= nil;
-       V_in->value= nil;
-       V_out->value= nil;
-       V_out->flags= W_SET|W_LOCAL|W_RDONLY;
-}
-
-void compile(void)
-{
-       rule_t *rule;
-       cell_t *file, *t;
-
-       phase= COMPILE;
-
-       /* Implode the files list. */
-       L_files= evaluate(L_files, IMPLODE);
-       if (wordlist(&L_files, 0) < 0) {
-               fprintf(stderr, "\"%s\": An assignment to $> contained junk\n",
-                       descr);
-               action= 0;
-       }
-
-       while (action != 0 && L_files != nil) {
-               file= L_files->car;
-
-               /* Initialize. */
-               shortest= NO_PATH;
-               for (rule= rules; rule != nil; rule= rule->next)
-                       rule->path= nil;
-
-               /* Try all possible transformation paths. */
-               (void) findpath(0L, 0, file, nil);
-
-               if (shortest == NO_PATH) {      /* Can't match the file. */
-                       fprintf(stderr,
-                       "%s: %s: can't compile, no transformation applies\n",
-                               program, file->name);
-                       action= 0;
-                       return;
-               }
-
-               /* Find the first short path. */
-               if ((rule= findpath(0L, 1, file, nil)) == nil) return;
-
-               /* Transform the file until you hit a combine. */
-               t= inc(newcell());
-               t->car= inc(file);
-               L_files= go(L_files, L_files->cdr);
-               t->cdr= rule->wait;
-               rule->wait= t;
-               while (action != 0 && rule != nil && rule->type != COMBINE) {
-                       transform(rule);
-                       rule= rule->path;
-               }
-       }
-
-       /* All input files have been transformed to combine rule(s).  Now
-        * we need to find the combine rule with the least number of paths
-        * running through it (this combine may be followed by another) and
-        * transform from there.
-        */
-       while (action != 0) {
-               int least;
-               rule_t *comb= nil;
-
-               for (rule= rules; rule != nil; rule= rule->next) {
-                       rule->path= nil;
-
-                       if (rule->type != COMBINE || rule->wait == nil)
-                               continue;
-
-                       if (comb == nil || rule->npaths < least) {
-                               least= rule->npaths;
-                               comb= rule;
-                       }
-               }
-
-               /* No combine?  Then we're done. */
-               if (comb == nil) break;
-
-               /* Initialize. */
-               shortest= NO_PATH;
-
-               /* Try all possible transformation paths. */
-               (void) findpath(0L, 0, nil, comb);
-
-               if (shortest == NO_PATH) break;
-
-               /* Find the first short path. */
-               if ((rule= findpath(0L, 1, nil, comb)) == nil) return;
-
-               /* Transform until you hit another combine. */
-               do {
-                       transform(rule);
-                       rule= rule->path;
-               } while (action != 0 && rule != nil && rule->type != COMBINE);
-       }
-       phase= INIT;
-}
-
-cell_t *predef(char *var, char *val)
-/* A predefined variable var with value val, or a special variable. */
-{
-       cell_t *p, *t;
-
-       p= findword(var);
-       if (val != nil) {       /* Predefined. */
-               t= findword(val);
-               dec(p->value);
-               p->value= t;
-               p->flags|= W_SET;
-               if (verbose >= 3) {
-                       prin1(p);
-                       printf(" =\b=\b= ");
-                       prin2n(t);
-               }
-       } else {                /* Special: $* and such. */
-               p->flags= W_SET|W_LOCAL|W_RDONLY;
-       }
-       t= inc(newcell());
-       t->car= p;
-       t->cdr= L_predef;
-       L_predef= t;
-       return p;
-}
-
-void usage(void)
-{
-       fprintf(stderr,
-       "Usage: %s -v<n> -vn<n> -name <name> -descr <descr> -T <dir> ...\n",
-               program);
-       exit(-1);
-}
-
-int main(int argc, char **argv)
-{
-       char *tmpdir;
-       program_t *prog;
-       cell_t **pa;
-       int i;
-
-       /* Call name of the program, decides which description to use. */
-       if ((program= strrchr(argv[0], '/')) == nil)
-               program= argv[0];
-       else
-               program++;
-
-       /* Directory for temporary files. */
-       if ((tmpdir= getenv("TMPDIR")) == nil || *tmpdir == 0)
-               tmpdir= "/tmp";
-
-       /* Transform arguments to a list, processing the few ACD options. */
-       pa= &L_args;
-       for (i= 1; i < argc; i++) {
-               if (argv[i][0] == '-' && argv[i][1] == 'v') {
-                       char *a= argv[i]+2;
-
-                       if (*a == 'n') { a++; action= 1; }
-                       verbose= 2;
-
-                       if (*a != 0) {
-                               verbose= strtoul(a, &a, 10);
-                               if (*a != 0) usage();
-                       }
-               } else
-               if (strcmp(argv[i], "-name") == 0) {
-                       if (++i == argc) usage();
-                       program= argv[i];
-               } else
-               if (strcmp(argv[i], "-descr") == 0) {
-                       if (++i == argc) usage();
-                       descr= argv[i];
-               } else
-               if (argv[i][0] == '-' && argv[i][1] == 'T') {
-                       if (argv[i][2] == 0) {
-                               if (++i == argc) usage();
-                               tmpdir= argv[i];
-                       } else
-                               tmpdir= argv[i]+2;
-               } else {
-                       /* Any other argument must be processed. */
-                       *pa= cons(CELL, findword(argv[i]));
-                       pa= &(*pa)->cdr;
-               }
-       }
-#ifndef DESCR
-       /* Default description file is based on the program name. */
-       if (descr == nil) descr= program;
-#else
-       /* Default description file is predefined. */
-       if (descr == nil) descr= DESCR;
-#endif
-
-       inittemp(tmpdir);
-
-       /* Catch user signals. */
-       if (signal(SIGHUP, SIG_IGN) != SIG_IGN) signal(SIGHUP, interrupt);
-       if (signal(SIGINT, SIG_IGN) != SIG_IGN) signal(SIGINT, interrupt);
-       if (signal(SIGTERM, SIG_IGN) != SIG_IGN) signal(SIGTERM, interrupt);
-
-       /* Predefined or special variables. */
-       predef("PROGRAM", program);
-       predef("VERSION", version);
-#ifdef ARCH
-       predef("ARCH", ARCH);           /* Cross-compilers like this. */
-#endif
-       V_star= predef("*", nil);
-       V_in= predef("<", nil);
-       V_out= predef(">", nil);
-
-       /* Read the description file. */
-       if (verbose >= 3) printf("include %s\n", descr);
-       prog= get_prog();
-
-       phase= INIT;
-       pc= prog;
-       execute(DOIT, 0);
-
-       argscan();
-       compile();
-
-       /* Delete all allocated data to test inc/dec balance. */
-       while (prog != nil) {
-               program_t *junk= prog;
-               prog= junk->next;
-               dec(junk->file);
-               dec(junk->line);
-               deallocate(junk);
-       }
-       while (rules != nil) {
-               rule_t *junk= rules;
-               rules= junk->next;
-               dec(junk->from);
-               dec(junk->to);
-               dec(junk->wait);
-               deallocate(junk);
-       }
-       deltemp();
-       dec(V_stop);
-       dec(L_args);
-       dec(L_files);
-       dec(L_predef);
-
-       quit(action == 0 ? 1 : 0);
-}
diff --git a/commands/ackmkdep/Makefile b/commands/ackmkdep/Makefile
deleted file mode 100644 (file)
index 7a05455..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-SCRIPTS= ackmkdep.sh
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/ackmkdep/ackmkdep.sh b/commands/ackmkdep/ackmkdep.sh
deleted file mode 100644 (file)
index 8906492..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/sh
-#
-#      ackmkdep 1.1 - Generate Makefile dependencies.  Author: Kees J. Bot
-#
-# Does what 'cc -M' should do, but no compiler gets it right, they all
-# strip the leading path of the '.o' file.)
-#
-# Added option to generate .depend files in subdirectories of given dir.
-#                                                      Jorrit N. Herder
-
-set -e
-
-case $# in
-
-# Display help ...
-0)     
-       echo "Usage: ackmkdep 'cpp command' file ..." >&2
-       echo "       ackmkdep directory" >&2
-;;
-
-# Create .depend files ...
-1)
-       echo "Creating .depend files in $1"
-       for dir in `find $1 -type d ! -name CVS ! -name .svn`
-       do
-               touch $dir/.depend
-       done
-
-;;
-
-
-# Get dependencies ... 
-*)
-       cpp="$1"; shift
-
-       for f
-       do
-               : < "$f" || exit
-
-               o=`expr "$f" : '\(.*\)\..*'`.o
-               o=`basename $o`
-
-               echo
-
-               $cpp "$f" | \
-                       /usr/bin/sed -e '/^#/!d
-                               s/.*"\(.*\)".*/\1/
-                               s:^\./::' \
-                           -e '/^<built-in>$/d' \
-                           -e '/^<command.line>$/d' \
-                           -e "s:^:$o\:        :" | \
-                       sort -u
-       done
-esac
-
-exit 0
-
-#
-# $PchId: mkdep.sh,v 1.3 1998/07/23 21:24:38 philip Exp $
-#
diff --git a/commands/ackstrip/Makefile b/commands/ackstrip/Makefile
deleted file mode 100644 (file)
index beb0cb0..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-PROG=  ackstrip
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/ackstrip/ackstrip.c b/commands/ackstrip/ackstrip.c
deleted file mode 100644 (file)
index 972f609..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/* strip - remove symbols.             Author: Dick van Veen */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <a.out.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-/* Strip [file] ...
- *
- *     -       when no file is present, a.out is assumed.
- *
- */
-
-#define A_OUT          "a.out"
-#define NAME_LENGTH    128     /* max file path name */
-
-char buffer[BUFSIZ];           /* used to copy executable */
-char new_file[NAME_LENGTH];    /* contains name of temporary */
-struct exec header;
-
-_PROTOTYPE(int main, (int argc, char **argv));
-_PROTOTYPE(void strip, (char *file));
-_PROTOTYPE(int read_header, (int fd));
-_PROTOTYPE(int write_header, (int fd));
-_PROTOTYPE(int make_tmp, (char *new_name, char *name));
-_PROTOTYPE(int copy_file, (int fd1, int fd2, long size));
-
-int main(argc, argv)
-int argc;
-char **argv;
-{
-  argv++;
-  if (*argv == NULL)
-       strip(A_OUT);
-  else
-       while (*argv != NULL) {
-               strip(*argv);
-               argv++;
-       }
-  return(0);
-}
-
-void strip(file)
-char *file;
-{
-  int fd, new_fd;
-  struct stat buf;
-  long symb_size, relo_size;
-
-  fd = open(file, O_RDONLY);
-  if (fd == -1) {
-       fprintf(stderr, "can't open %s\n", file);
-       close(fd);
-       return;
-  }
-  if (read_header(fd)) {
-       fprintf(stderr, "%s: not an executable file\n", file);
-       close(fd);
-       return;
-  }
-  if (header.a_syms == 0L) {
-       close(fd);              /* no symbol table present */
-       return;
-  }
-  symb_size = header.a_syms;
-  header.a_syms = 0L;          /* remove table size */
-  fstat(fd, &buf);
-  relo_size = buf.st_size - (A_MINHDR + header.a_text + header.a_data + symb_size);
-  new_fd = make_tmp(new_file, file);
-  if (new_fd == -1) {
-       fprintf(stderr, "can't create temporary file\n");
-       close(fd);
-       return;
-  }
-  if (write_header(new_fd)) {
-       fprintf(stderr, "can't write temporary file\n");
-       unlink(new_file);
-       close(fd);
-       close(new_fd);
-       return;
-  }
-  if (copy_file(fd, new_fd, header.a_text + header.a_data)) {
-       fprintf(stderr, "can't copy %s\n", file);
-       unlink(new_file);
-       close(fd);
-       close(new_fd);
-       return;
-  }
-  if (relo_size != 0) {
-       lseek(fd, symb_size, 1);
-       if (copy_file(fd, new_fd, relo_size)) {
-           fprintf(stderr, "can't copy %s\n", file);
-           unlink(new_file);
-           close(fd);
-           close(new_fd);
-           return;
-       }
-  }
-  close(fd);
-  close(new_fd);
-  if (unlink(file) == -1) {
-       fprintf(stderr, "can't unlink %s\n", file);
-       unlink(new_file);
-       return;
-  }
-  link(new_file, file);
-  unlink(new_file);
-  chmod(file, buf.st_mode);
-}
-
-int read_header(fd)
-int fd;
-{
-  if (read(fd, (char *) &header, A_MINHDR) != A_MINHDR) return(1);
-  if (BADMAG(header)) return (1);
-  if (header.a_hdrlen > sizeof(struct exec)) return (1);
-  lseek(fd, 0L, SEEK_SET);     /* variable size header */
-  if (read(fd, (char *)&header, (int)header.a_hdrlen) != (int) header.a_hdrlen)
-       return(1);
-  return(0);
-}
-
-int write_header(fd)
-int fd;
-{
-  lseek(fd, 0L, SEEK_SET);
-  if (write(fd, (char *)&header, (int)header.a_hdrlen) != (int)header.a_hdrlen)
-       return(1);
-  return(0);
-}
-
-int make_tmp(new_name, name)
-char *new_name, *name;
-{
-  int len;
-  char *nameptr;
-
-  len = strlen(name);
-  if (len + 1 > NAME_LENGTH) return(-1);
-  strcpy(new_name, name);
-  nameptr = strrchr(new_name, '/');
-  if (nameptr == NULL) nameptr = new_name - 1;
-  if (nameptr - new_name + 6 + 1 > NAME_LENGTH) return (-1);
-  strcpy(nameptr + 1, "XXXXXX");
-  mktemp(new_name);
-  return(creat(new_name, 0777));
-}
-
-int copy_file(fd1, fd2, size)
-int fd1, fd2;
-long size;
-{
-  int length;
-
-  while (size > 0) {
-       if (size < sizeof(buffer))
-               length = size;
-       else
-               length = sizeof(buffer);
-       if (read(fd1, buffer, length) != length) return(1);
-       if (write(fd2, buffer, length) != length) return (1);
-       size -= length;
-  }
-  return(0);
-}
diff --git a/commands/asmconv/Makefile b/commands/asmconv/Makefile
deleted file mode 100644 (file)
index a53897d..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# Makefile for asmconv.
-
-PROG=  asmconv
-SRCS=  asm86.c asmconv.c parse_ack.c parse_gnu.c parse_bas.c \
-       tokenize.c emit_ack.c emit_gnu.c
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/asmconv/asm86.c b/commands/asmconv/asm86.c
deleted file mode 100644 (file)
index f0850e5..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*     asm86.c - 80X86 assembly intermediate           Author: Kees J. Bot
- *                                                             24 Dec 1993
- */
-#define nil 0
-#include <stddef.h>
-#include <string.h>
-#include <assert.h>
-#include "asm86.h"
-#include "asmconv.h"
-#include "token.h"
-
-expression_t *new_expr(void)
-/* Make a new cell to build an expression. */
-{
-       expression_t *e;
-
-       e= allocate(nil, sizeof(*e));
-       e->operator= -1;
-       e->left= e->middle= e->right= nil;
-       e->name= nil;
-       e->magic= 31624;
-       return e;
-}
-
-void del_expr(expression_t *e)
-/* Delete an expression tree. */
-{
-       if (e != nil) {
-               assert(e->magic == 31624);
-               e->magic= 0;
-               deallocate(e->name);
-               del_expr(e->left);
-               del_expr(e->middle);
-               del_expr(e->right);
-               deallocate(e);
-       }
-}
-
-asm86_t *new_asm86(void)
-/* Make a new cell to hold an 80X86 instruction. */
-{
-       asm86_t *a;
-
-       a= allocate(nil, sizeof(*a));
-       a->opcode= -1;
-       get_file(&a->file, &a->line);
-       a->optype= -1;
-       a->oaz= 0;
-       a->rep= ONCE;
-       a->seg= DEFSEG;
-       a->args= nil;
-       a->magic= 37937;
-       return a;
-}
-
-void del_asm86(asm86_t *a)
-/* Delete an 80X86 instruction. */
-{
-       assert(a != nil);
-       assert(a->magic == 37937);
-       a->magic= 0;
-       del_expr(a->args);
-       deallocate(a);
-}
-
-int isregister(const char *name)
-/* True if the string is a register name.  Return its size. */
-{
-       static char *regs[] = {
-               "al", "bl", "cl", "dl", "ah", "bh", "ch", "dh",
-               "ax", "bx", "cx", "dx", "si", "di", "bp", "sp",
-               "cs", "ds", "es", "fs", "gs", "ss",
-               "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp",
-               "cr0", "cr1", "cr2", "cr3",
-               "st",
-       };
-       int reg;
-
-       for (reg= 0; reg < arraysize(regs); reg++) {
-               if (strcmp(name, regs[reg]) == 0) {
-                       return reg < 8 ? 1 : reg < 22 ? 2 : 4;
-               }
-       }
-       return 0;
-}
diff --git a/commands/asmconv/asm86.h b/commands/asmconv/asm86.h
deleted file mode 100644 (file)
index 7c1876f..0000000
+++ /dev/null
@@ -1,250 +0,0 @@
-/*     asm86.h - 80X86 assembly intermediate           Author: Kees J. Bot
- *                                                             27 Jun 1993
- */
-
-typedef enum opcode {  /* 80486 opcodes, from the i486 reference manual.
-                        * Synonyms left out, some new words invented.
-                        */
-       DOT_ALIGN,
-       DOT_ASCII,      DOT_ASCIZ,
-       DOT_ASSERT,                     /* Pseudo's invented */
-       DOT_BASE,
-       DOT_COMM,       DOT_LCOMM,
-       DOT_DATA1,
-       DOT_DATA2,
-       DOT_DATA4,
-       DOT_DEFINE,     DOT_EXTERN,
-       DOT_EQU,
-       DOT_FILE,       DOT_LINE,
-       DOT_LABEL,
-       DOT_LIST,       DOT_NOLIST,
-       DOT_SPACE,
-       DOT_SYMB,
-       DOT_TEXT,       DOT_ROM,        DOT_DATA,       DOT_BSS,        DOT_END,
-       DOT_USE16,      DOT_USE32,
-       AAA,
-       AAD,
-       AAM,
-       AAS,
-       ADC,
-       ADD,
-       AND,
-       ARPL,
-       BOUND,
-       BSF,
-       BSR,
-       BSWAP,
-       BT,
-       BTC,
-       BTR,
-       BTS,
-       CALL,   CALLF,                  /* CALLF added */
-       CBW,
-       CLC,
-       CLD,
-       CLI,
-       CLTS,
-       CMC,
-       CMP,
-       CMPS,
-       CMPXCHG,
-       CWD,
-       DAA,
-       DAS,
-       DEC,
-       DIV,
-       ENTER,
-       F2XM1,
-       FABS,
-       FADD,   FADDD,  FADDS,  FADDP,  FIADDL, FIADDS,
-       FBLD,
-       FBSTP,
-       FCHS,
-       FCLEX,
-       FCOMD,  FCOMS,  FCOMPD, FCOMPS, FCOMPP,
-       FCOS,
-       FDECSTP,
-       FDIVD,  FDIVS,  FDIVP,  FIDIVL, FIDIVS,
-       FDIVRD, FDIVRS, FDIVRP, FIDIVRL,        FIDIVRS,
-       FFREE,
-       FICOM,  FICOMP,
-       FILDQ,  FILDL,  FILDS,
-       FINCSTP,
-       FINIT,
-       FISTL,  FISTS,  FISTP,
-       FLDX,   FLDD,   FLDS,
-       FLD1,   FLDL2T, FLDL2E, FLDPI,  FLDLG2, FLDLN2, FLDZ,
-       FLDCW,
-       FLDENV,
-       FMULD,  FMULS,  FMULP,  FIMULL, FIMULS,
-       FNOP,
-       FPATAN,
-       FPREM,
-       FPREM1,
-       FPTAN,
-       FRNDINT,
-       FRSTOR,
-       FSAVE,
-       FSCALE,
-       FSIN,
-       FSINCOS,
-       FSQRT,
-       FSTD,   FSTS,   FSTP,   FSTPX,  FSTPD,  FSTPS,
-       FSTCW,
-       FSTENV,
-       FSTSW,
-       FSUBD,  FSUBS,  FSUBP,  FISUBL, FISUBS,
-       FSUBRD, FSUBRS, FSUBPR, FISUBRL, FISUBRS,
-       FTST,
-       FUCOM,  FUCOMP, FUCOMPP,
-       FXAM,
-       FXCH,
-       FXTRACT,
-       FYL2X,
-       FYL2XP1,
-       HLT,
-       IDIV,
-       IMUL,
-       IN,
-       INC,
-       INS,
-       INT,    INTO,
-       INVD,
-       INVLPG,
-       IRET,   IRETD,
-       JA,     JAE,    JB,     JBE,    JCXZ,   JE,     JG,     JGE,    JL,
-       JLE,    JNE,    JNO,    JNP,    JNS,    JO,     JP,     JS,
-       JMP,    JMPF,                   /* JMPF added */
-       LAHF,
-       LAR,
-       LEA,
-       LEAVE,
-       LGDT,   LIDT,
-       LGS,    LSS,    LDS,    LES,    LFS,
-       LLDT,
-       LMSW,
-       LOCK,
-       LODS,
-       LOOP,   LOOPE,  LOOPNE,
-       LSL,
-       LTR,
-       MOV,
-       MOVS,
-       MOVSX,
-       MOVSXB,
-       MOVZX,
-       MOVZXB,
-       MUL,
-       NEG,
-       NOP,
-       NOT,
-       OR,
-       OUT,
-       OUTS,
-       POP,
-       POPA,
-       POPF,
-       PUSH,
-       PUSHA,
-       PUSHF,
-       RCL,    RCR,    ROL,    ROR,
-       RET,    RETF,                   /* RETF added */
-       SAHF,
-       SAL,    SAR,    SHL,    SHR,
-       SBB,
-       SCAS,
-       SETA,   SETAE,  SETB,   SETBE,  SETE,   SETG,   SETGE,  SETL,
-       SETLE,  SETNE,  SETNO,  SETNP,  SETNS,  SETO,   SETP,   SETS,
-       SGDT,   SIDT,
-       SHLD,
-       SHRD,
-       SLDT,
-       SMSW,
-       STC,
-       STD,
-       STI,
-       STOS,
-       STR,
-       SUB,
-       TEST,
-       VERR,   VERW,
-       WAIT,
-       WBINVD,
-       XADD,
-       XCHG,
-       XLAT,
-       XOR
-} opcode_t;
-
-#define is_pseudo(o)   ((o) <= DOT_USE32)
-#define N_OPCODES      ((int) XOR + 1)
-
-#define OPZ    0x01            /* Operand size prefix. */
-#define ADZ    0x02            /* Address size prefix. */
-
-typedef enum optype {
-       PSEUDO, JUMP,   BYTE,   WORD,   OWORD           /* Ordered list! */
-} optype_t;
-
-typedef enum repeat {
-       ONCE,   REP,    REPE,   REPNE
-} repeat_t;
-
-typedef enum segment {
-       DEFSEG, CSEG,   DSEG,   ESEG,   FSEG,   GSEG,   SSEG
-} segment_t;
-
-typedef struct expression {
-       int             operator;
-       struct expression *left, *middle, *right;
-       char            *name;
-       size_t          len;
-       unsigned        magic;
-} expression_t;
-
-typedef struct asm86 {
-       opcode_t        opcode;         /* DOT_TEXT, MOV, ... */
-       char            *file;          /* Name of the file it is found in. */
-       long            line;           /* Line number. */
-       optype_t        optype;         /* Type of operands: byte, word... */
-       int             oaz;            /* Operand/address size prefix? */
-       repeat_t        rep;            /* Repeat prefix used on this instr. */
-       segment_t       seg;            /* Segment override. */
-       expression_t    *args;          /* Arguments in ACK order. */
-       unsigned        magic;
-} asm86_t;
-
-expression_t *new_expr(void);
-void del_expr(expression_t *a);
-asm86_t *new_asm86(void);
-void del_asm86(asm86_t *a);
-int isregister(const char *name);
-
-/*
- * Format of the arguments of the asm86_t structure:
- *
- *
- * ACK assembly operands       expression_t cell:
- * or part of operand:         {operator, left, middle, right, name, len}
- *
- * [expr]                      {'[', nil, expr, nil}
- * word                                {'W', nil, nil, nil, word}
- * "string"                    {'S', nil, nil, nil, "string", strlen("string")}
- * label = expr                        {'=', nil, expr, nil, label}
- * expr * expr                 {'*', expr, nil, expr}
- * - expr                      {'-', nil, expr, nil}
- * (memory)                    {'(', nil, memory, nil}
- * offset(base)(index*n)       {'O', offset, base, index*n}
- * base                                {'B', nil, nil, nil, base}
- * index*4                     {'4', nil, nil, nil, index}
- * operand, oplist             {',', operand, nil, oplist}
- * label :                     {':', nil, nil, nil, label}
- *
- * The precedence of operators is ignored.  The expression is simply copied
- * as is, including parentheses.  Problems like missing operators in the
- * target language will have to be handled by rewriting the source language.
- * 16-bit or 32-bit registers must be used where they are required by the
- * target assembler even though ACK makes no difference between 'ax' and
- * 'eax'.  Asmconv is smart enough to transform compiler output.  Human made
- * assembly can be fixed up to be transformable.
- */
diff --git a/commands/asmconv/asmconv.c b/commands/asmconv/asmconv.c
deleted file mode 100644 (file)
index 2ee3b78..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/*     asmconv 1.11 - convert 80X86 assembly           Author: Kees J. Bot
- *                                                             24 Dec 1993
- */
-static char version[] = "1.11";
-
-#define nil 0
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "asm86.h"
-#include "languages.h"
-
-void fatal(char *label)
-{
-       fprintf(stderr, "asmconv: %s: %s\n", label, strerror(errno));
-       exit(EXIT_FAILURE);
-}
-
-void *allocate(void *mem, size_t size)
-/* A checked malloc/realloc().  Yes, I know ISO C allows realloc(NULL, size). */
-{
-       mem= mem == nil ? malloc(size) : realloc(mem, size);
-       if (mem == nil) fatal("malloc()");
-       return mem;
-}
-
-void deallocate(void *mem)
-/* Free a malloc()d cell.  (Yes I know ISO C allows free(NULL) */
-{
-       if (mem != nil) free(mem);
-}
-
-char *copystr(const char *s)
-{
-       char *c;
-
-       c= allocate(nil, (strlen(s) + 1) * sizeof(s[0]));
-       strcpy(c, s);
-       return c;
-}
-
-int isanumber(const char *s)
-/* True if s can be turned into a number. */
-{
-       char *end;
-
-       (void) strtol(s, &end, 0);
-       return end != s && *end == 0;
-}
-
-/* "Invisible" globals. */
-int asm_mode32= (sizeof(int) == 4);
-int err_code= EXIT_SUCCESS;
-
-int main(int argc, char **argv)
-{
-       void (*parse_init)(char *file);
-       asm86_t *(*get_instruction)(void);
-       void (*emit_init)(char *file, const char *banner);
-       void (*emit_instruction)(asm86_t *instr);
-       char *lang_parse, *lang_emit, *input_file, *output_file;
-       asm86_t *instr;
-       char banner[80];
-
-       if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'm') {
-               if (strcmp(argv[1], "-mi86") == 0) {
-                       set_use16();
-               } else
-               if (strcmp(argv[1], "-mi386") == 0) {
-                       set_use32();
-               } else {
-                       fprintf(stderr, "asmconv: '%s': unknown machine\n",
-                               argv[1]+2);
-               }
-               argc--;
-               argv++;
-       }
-
-       if (argc < 3 || argc > 5) {
-               fprintf(stderr,
-"Usage: asmconv <input-type> <output-type> [input-file [output-file]]\n");
-               exit(EXIT_FAILURE);
-       }
-
-       lang_parse= argv[1];
-       lang_emit= argv[2];
-       input_file= argc < 4 ? nil : argv[3];
-       output_file= argc < 5 ? nil : argv[4];
-
-       /* Choose the parsing routines. */
-       if (strcmp(lang_parse, "ack") == 0) {
-               /* Standard ACK. */
-               parse_init= ack_parse_init;
-               get_instruction= ack_get_instruction;
-       } else
-       if (strcmp(lang_parse, "ncc") == 0) {
-               /* ACK Xenix assembly, a black sheep among ACK assemblies. */
-               parse_init= ncc_parse_init;
-               get_instruction= ncc_get_instruction;
-       } else
-       if (strcmp(lang_parse, "gnu") == 0) {
-               /* GNU assembly.  Parser by R.S. Veldema. */
-               parse_init= gnu_parse_init;
-               get_instruction= gnu_get_instruction;
-       } else
-       if (strcmp(lang_parse, "bas") == 0) {
-               /* Bruce Evans' assembler. */
-               parse_init= bas_parse_init;
-               get_instruction= bas_get_instruction;
-       } else {
-               fprintf(stderr, "asmconv: '%s': unknown input language\n",
-                       lang_parse);
-               exit(EXIT_FAILURE);
-       }
-
-       /* Choose the output language. */
-       if (strcmp(lang_emit, "ack") == 0) {
-               /* Standard ACK. */
-               emit_init= ack_emit_init;
-               emit_instruction= ack_emit_instruction;
-       } else
-       if (strcmp(lang_emit, "ncc") == 0) {
-               /* ACK Xenix assembly, can be read by BAS and the 8086 ACK
-                * ANSI C compiler.  (Allows us to compile the Boot Monitor.)
-                */
-               emit_init= ncc_emit_init;
-               emit_instruction= ncc_emit_instruction;
-       } else
-       if (strcmp(lang_emit, "gnu") == 0) {
-               /* GNU assembler.  So we can assemble the ACK stuff among the
-                * kernel sources and in the library.
-                */
-               emit_init= gnu_emit_init;
-               emit_instruction= gnu_emit_instruction;
-       } else {
-               fprintf(stderr, "asmconv: '%s': unknown output language\n",
-                       lang_emit);
-               exit(EXIT_FAILURE);
-       }
-
-       sprintf(banner, "Translated from %s to %s by asmconv %s",
-                                       lang_parse, lang_emit, version);
-
-       (*parse_init)(input_file);
-       (*emit_init)(output_file, banner);
-       for (;;) {
-               instr= (*get_instruction)();
-               (*emit_instruction)(instr);
-               if (instr == nil) break;
-               del_asm86(instr);
-       }
-       exit(err_code);
-}
diff --git a/commands/asmconv/asmconv.h b/commands/asmconv/asmconv.h
deleted file mode 100644 (file)
index 4ef2eaa..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*     asmconv.h - shared functions                    Author: Kees J. Bot
- *                                                             19 Dec 1993
- */
-
-#define arraysize(a)   (sizeof(a)/sizeof((a)[0]))
-#define arraylimit(a)  ((a) + arraysize(a))
-#define between(a, c, z)       \
-                       ((unsigned)((c) - (a)) <= (unsigned)((z) - (a)))
-
-void *allocate(void *mem, size_t size);
-void deallocate(void *mem);
-void fatal(char *label);
-char *copystr(const char *s);
-int isanumber(const char *s);
-
-extern int asm_mode32; /* In 32 bit mode if true. */
-
-#define use16()                (!asm_mode32)
-#define use32()                ((int) asm_mode32)
-#define set_use16()    ((void) (asm_mode32= 0))
-#define set_use32()    ((void) (asm_mode32= 1))
-
-extern int err_code;   /* Exit code. */
-#define set_error()    ((void) (err_code= EXIT_FAILURE))
diff --git a/commands/asmconv/emit_ack.c b/commands/asmconv/emit_ack.c
deleted file mode 100644 (file)
index 48f9c39..0000000
+++ /dev/null
@@ -1,621 +0,0 @@
-/*     emit_ack.c - emit ACK assembly                  Author: Kees J. Bot
- *                  emit NCC assembly                          27 Dec 1993
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-
-typedef struct mnemonic {      /* ACK as86 mnemonics translation table. */
-       opcode_t        opcode;
-       char            *name;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {
-       { AAA,          "aaa"           },
-       { AAD,          "aad"           },
-       { AAM,          "aam"           },
-       { AAS,          "aas"           },
-       { ADC,          "adc%"          },
-       { ADD,          "add%"          },
-       { AND,          "and%"          },
-       { ARPL,         "arpl"          },
-       { BOUND,        "bound"         },
-       { BSF,          "bsf"           },
-       { BSR,          "bsr"           },
-       { BSWAP,        "bswap"         },
-       { BT,           "bt"            },
-       { BTC,          "btc"           },
-       { BTR,          "btr"           },
-       { BTS,          "bts"           },
-       { CALL,         "call"          },
-       { CALLF,        "callf"         },
-       { CBW,          "cbw"           },
-       { CLC,          "clc"           },
-       { CLD,          "cld"           },
-       { CLI,          "cli"           },
-       { CLTS,         "clts"          },
-       { CMC,          "cmc"           },
-       { CMP,          "cmp%"          },
-       { CMPS,         "cmps%"         },
-       { CMPXCHG,      "cmpxchg"       },
-       { CWD,          "cwd"           },
-       { DAA,          "daa"           },
-       { DAS,          "das"           },
-       { DEC,          "dec%"          },
-       { DIV,          "div%"          },
-       { DOT_ALIGN,    ".align"        },
-       { DOT_ASCII,    ".ascii"        },
-       { DOT_ASCIZ,    ".asciz"        },
-       { DOT_ASSERT,   ".assert"       },
-       { DOT_BASE,     ".base"         },
-       { DOT_BSS,      ".sect .bss"    },
-       { DOT_COMM,     ".comm"         },
-       { DOT_DATA,     ".sect .data"   },
-       { DOT_DATA1,    ".data1"        },
-       { DOT_DATA2,    ".data2"        },
-       { DOT_DATA4,    ".data4"        },
-       { DOT_DEFINE,   ".define"       },
-       { DOT_END,      ".sect .end"    },
-       { DOT_EXTERN,   ".extern"       },
-       { DOT_FILE,     ".file"         },
-       { DOT_LCOMM,    ".comm"         },
-       { DOT_LINE,     ".line"         },
-       { DOT_LIST,     ".list"         },
-       { DOT_NOLIST,   ".nolist"       },
-       { DOT_ROM,      ".sect .rom"    },
-       { DOT_SPACE,    ".space"        },
-       { DOT_SYMB,     ".symb"         },
-       { DOT_TEXT,     ".sect .text"   },
-       { DOT_USE16,    ".use16"        },
-       { DOT_USE32,    ".use32"        },
-       { ENTER,        "enter"         },
-       { F2XM1,        "f2xm1"         },
-       { FABS,         "fabs"          },
-       { FADD,         "fadd"          },
-       { FADDD,        "faddd"         },
-       { FADDP,        "faddp"         },
-       { FADDS,        "fadds"         },
-       { FBLD,         "fbld"          },
-       { FBSTP,        "fbstp"         },
-       { FCHS,         "fchs"          },
-       { FCLEX,        "fclex"         },
-       { FCOMD,        "fcomd"         },
-       { FCOMPD,       "fcompd"        },
-       { FCOMPP,       "fcompp"        },
-       { FCOMPS,       "fcomps"        },
-       { FCOMS,        "fcoms"         },
-       { FCOS,         "fcos"          },
-       { FDECSTP,      "fdecstp"       },
-       { FDIVD,        "fdivd"         },
-       { FDIVP,        "fdivp"         },
-       { FDIVRD,       "fdivrd"        },
-       { FDIVRP,       "fdivrp"        },
-       { FDIVRS,       "fdivrs"        },
-       { FDIVS,        "fdivs"         },
-       { FFREE,        "ffree"         },
-       { FIADDL,       "fiaddl"        },
-       { FIADDS,       "fiadds"        },
-       { FICOM,        "ficom"         },
-       { FICOMP,       "ficomp"        },
-       { FIDIVL,       "fidivl"        },
-       { FIDIVRL,      "fidivrl"       },
-       { FIDIVRS,      "fidivrs"       },
-       { FIDIVS,       "fidivs"        },
-       { FILDL,        "fildl"         },
-       { FILDQ,        "fildq"         },
-       { FILDS,        "filds"         },
-       { FIMULL,       "fimull"        },
-       { FIMULS,       "fimuls"        },
-       { FINCSTP,      "fincstp"       },
-       { FINIT,        "finit"         },
-       { FISTL,        "fistl"         },
-       { FISTP,        "fistp"         },
-       { FISTS,        "fists"         },
-       { FISUBL,       "fisubl"        },
-       { FISUBRL,      "fisubrl"       },
-       { FISUBRS,      "fisubrs"       },
-       { FISUBS,       "fisubs"        },
-       { FLD1,         "fld1"          },
-       { FLDCW,        "fldcw"         },
-       { FLDD,         "fldd"          },
-       { FLDENV,       "fldenv"        },
-       { FLDL2E,       "fldl2e"        },
-       { FLDL2T,       "fldl2t"        },
-       { FLDLG2,       "fldlg2"        },
-       { FLDLN2,       "fldln2"        },
-       { FLDPI,        "fldpi"         },
-       { FLDS,         "flds"          },
-       { FLDX,         "fldx"          },
-       { FLDZ,         "fldz"          },
-       { FMULD,        "fmuld"         },
-       { FMULP,        "fmulp"         },
-       { FMULS,        "fmuls"         },
-       { FNOP,         "fnop"          },
-       { FPATAN,       "fpatan"        },
-       { FPREM,        "fprem"         },
-       { FPREM1,       "fprem1"        },
-       { FPTAN,        "fptan"         },
-       { FRNDINT,      "frndint"       },
-       { FRSTOR,       "frstor"        },
-       { FSAVE,        "fsave"         },
-       { FSCALE,       "fscale"        },
-       { FSIN,         "fsin"          },
-       { FSINCOS,      "fsincos"       },
-       { FSQRT,        "fsqrt"         },
-       { FSTCW,        "fstcw"         },
-       { FSTD,         "fstd"          },
-       { FSTENV,       "fstenv"        },
-       { FSTPD,        "fstpd"         },
-       { FSTPS,        "fstps"         },
-       { FSTPX,        "fstpx"         },
-       { FSTS,         "fsts"          },
-       { FSTSW,        "fstsw"         },
-       { FSUBD,        "fsubd"         },
-       { FSUBP,        "fsubp"         },
-       { FSUBPR,       "fsubpr"        },
-       { FSUBRD,       "fsubrd"        },
-       { FSUBRS,       "fsubrs"        },
-       { FSUBS,        "fsubs"         },
-       { FTST,         "ftst"          },
-       { FUCOM,        "fucom"         },
-       { FUCOMP,       "fucomp"        },
-       { FUCOMPP,      "fucompp"       },
-       { FXAM,         "fxam"          },
-       { FXCH,         "fxch"          },
-       { FXTRACT,      "fxtract"       },
-       { FYL2X,        "fyl2x"         },
-       { FYL2XP1,      "fyl2xp1"       },
-       { HLT,          "hlt"           },
-       { IDIV,         "idiv%"         },
-       { IMUL,         "imul%"         },
-       { IN,           "in%"           },
-       { INC,          "inc%"          },
-       { INS,          "ins%"          },
-       { INT,          "int"           },
-       { INTO,         "into"          },
-       { INVD,         "invd"          },
-       { INVLPG,       "invlpg"        },
-       { IRET,         "iret"          },
-       { IRETD,        "iretd"         },
-       { JA,           "ja"            },
-       { JAE,          "jae"           },
-       { JB,           "jb"            },
-       { JBE,          "jbe"           },
-       { JCXZ,         "jcxz"          },
-       { JE,           "je"            },
-       { JG,           "jg"            },
-       { JGE,          "jge"           },
-       { JL,           "jl"            },
-       { JLE,          "jle"           },
-       { JMP,          "jmp"           },
-       { JMPF,         "jmpf"          },
-       { JNE,          "jne"           },
-       { JNO,          "jno"           },
-       { JNP,          "jnp"           },
-       { JNS,          "jns"           },
-       { JO,           "jo"            },
-       { JP,           "jp"            },
-       { JS,           "js"            },
-       { LAHF,         "lahf"          },
-       { LAR,          "lar"           },
-       { LDS,          "lds"           },
-       { LEA,          "lea"           },
-       { LEAVE,        "leave"         },
-       { LES,          "les"           },
-       { LFS,          "lfs"           },
-       { LGDT,         "lgdt"          },
-       { LGS,          "lgs"           },
-       { LIDT,         "lidt"          },
-       { LLDT,         "lldt"          },
-       { LMSW,         "lmsw"          },
-       { LOCK,         "lock"          },
-       { LODS,         "lods%"         },
-       { LOOP,         "loop"          },
-       { LOOPE,        "loope"         },
-       { LOOPNE,       "loopne"        },
-       { LSL,          "lsl"           },
-       { LSS,          "lss"           },
-       { LTR,          "ltr"           },
-       { MOV,          "mov%"          },
-       { MOVS,         "movs%"         },
-       { MOVSX,        "movsx"         },
-       { MOVSXB,       "movsxb"        },
-       { MOVZX,        "movzx"         },
-       { MOVZXB,       "movzxb"        },
-       { MUL,          "mul%"          },
-       { NEG,          "neg%"          },
-       { NOP,          "nop"           },
-       { NOT,          "not%"          },
-       { OR,           "or%"           },
-       { OUT,          "out%"          },
-       { OUTS,         "outs%"         },
-       { POP,          "pop"           },
-       { POPA,         "popa"          },
-       { POPF,         "popf"          },
-       { PUSH,         "push"          },
-       { PUSHA,        "pusha"         },
-       { PUSHF,        "pushf"         },
-       { RCL,          "rcl%"          },
-       { RCR,          "rcr%"          },
-       { RET,          "ret"           },
-       { RETF,         "retf"          },
-       { ROL,          "rol%"          },
-       { ROR,          "ror%"          },
-       { SAHF,         "sahf"          },
-       { SAL,          "sal%"          },
-       { SAR,          "sar%"          },
-       { SBB,          "sbb%"          },
-       { SCAS,         "scas%"         },
-       { SETA,         "seta"          },
-       { SETAE,        "setae"         },
-       { SETB,         "setb"          },
-       { SETBE,        "setbe"         },
-       { SETE,         "sete"          },
-       { SETG,         "setg"          },
-       { SETGE,        "setge"         },
-       { SETL,         "setl"          },
-       { SETLE,        "setle"         },
-       { SETNE,        "setne"         },
-       { SETNO,        "setno"         },
-       { SETNP,        "setnp"         },
-       { SETNS,        "setns"         },
-       { SETO,         "seto"          },
-       { SETP,         "setp"          },
-       { SETS,         "sets"          },
-       { SGDT,         "sgdt"          },
-       { SHL,          "shl%"          },
-       { SHLD,         "shld"          },
-       { SHR,          "shr%"          },
-       { SHRD,         "shrd"          },
-       { SIDT,         "sidt"          },
-       { SLDT,         "sldt"          },
-       { SMSW,         "smsw"          },
-       { STC,          "stc"           },
-       { STD,          "std"           },
-       { STI,          "sti"           },
-       { STOS,         "stos%"         },
-       { STR,          "str"           },
-       { SUB,          "sub%"          },
-       { TEST,         "test%"         },
-       { VERR,         "verr"          },
-       { VERW,         "verw"          },
-       { WAIT,         "wait"          },
-       { WBINVD,       "wbinvd"        },
-       { XADD,         "xadd"          },
-       { XCHG,         "xchg%"         },
-       { XLAT,         "xlat"          },
-       { XOR,          "xor%"          },
-};
-
-#define farjmp(o)      ((o) == JMPF || (o) == CALLF)
-
-static FILE *ef;
-static long eline= 1;
-static char *efile;
-static char *orig_efile;
-static char *opcode2name_tab[N_OPCODES];
-static enum dialect { ACK, NCC } dialect= ACK;
-
-static void ack_putchar(int c)
-/* LOOK, this programmer checks the return code of putc!  What an idiot, noone
- * does that!
- */
-{
-       if (putc(c, ef) == EOF) fatal(orig_efile);
-}
-
-static void ack_printf(const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       if (vfprintf(ef, fmt, ap) == EOF) fatal(orig_efile);
-       va_end(ap);
-}
-
-void ack_emit_init(char *file, const char *banner)
-/* Prepare producing an ACK assembly file. */
-{
-       mnemonic_t *mp;
-
-       if (file == nil) {
-               file= "stdout";
-               ef= stdout;
-       } else {
-               if ((ef= fopen(file, "w")) == nil) fatal(file);
-       }
-       orig_efile= file;
-       efile= file;
-       ack_printf("! %s", banner);
-       if (dialect == ACK) {
-               /* Declare the four sections used under Minix. */
-               ack_printf(
-       "\n.sect .text; .sect .rom; .sect .data; .sect .bss\n.sect .text");
-       }
-
-       /* Initialize the opcode to mnemonic translation table. */
-       for (mp= mnemtab; mp < arraylimit(mnemtab); mp++) {
-               assert(opcode2name_tab[mp->opcode] == nil);
-               opcode2name_tab[mp->opcode]= mp->name;
-       }
-}
-
-#define opcode2name(op)                (opcode2name_tab[op] + 0)
-
-static void ack_put_string(const char *s, size_t n)
-/* Emit a string with weird characters quoted. */
-{
-       while (n > 0) {
-               int c= *s;
-
-               if (c < ' ' || c > 0177) {
-                       ack_printf("\\%03o", c & 0xFF);
-               } else
-               if (c == '"' || c == '\\') {
-                       ack_printf("\\%c", c);
-               } else {
-                       ack_putchar(c);
-               }
-               s++;
-               n--;
-       }
-}
-
-static void ack_put_expression(asm86_t *a, expression_t *e, int deref)
-/* Send an expression, i.e. instruction operands, to the output file.  Deref
- * is true when the rewrite for the ncc dialect may be made.
- */
-{
-       assert(e != nil);
-
-       switch (e->operator) {
-       case ',':
-               if (dialect == NCC && farjmp(a->opcode)) {
-                       /* ACK jmpf seg:off  ->  NCC jmpf off,seg */
-                       ack_put_expression(a, e->right, deref);
-                       ack_printf(", ");
-                       ack_put_expression(a, e->left, deref);
-               } else {
-                       ack_put_expression(a, e->left, deref);
-                       ack_printf(farjmp(a->opcode) ? ":" : ", ");
-                       ack_put_expression(a, e->right, deref);
-               }
-               break;
-       case 'O':
-               if (deref && a->optype == JUMP) ack_putchar('@');
-               if (e->left != nil) ack_put_expression(a, e->left, 0);
-               if (e->middle != nil) ack_put_expression(a, e->middle, 0);
-               if (e->right != nil) ack_put_expression(a, e->right, 0);
-               break;
-       case '(':
-               if (deref && a->optype == JUMP) ack_putchar('@');
-               if (!deref) ack_putchar('(');
-               ack_put_expression(a, e->middle, 0);
-               if (!deref) ack_putchar(')');
-               break;
-       case 'B':
-               ack_printf("(%s)", e->name);
-               break;
-       case '1':
-       case '2':
-       case '4':
-       case '8':
-               ack_printf((use16() && e->operator == '1')
-                               ? "(%s)" : "(%s*%c)", e->name, e->operator);
-               break;
-       case '+':
-       case '-':
-       case '~':
-               if (e->middle != nil) {
-                       if (deref && a->optype != JUMP) ack_putchar('#');
-                       ack_putchar(e->operator);
-                       ack_put_expression(a, e->middle, 0);
-                       break;
-               }
-               /*FALL THROUGH*/
-       case '*':
-       case '/':
-       case '%':
-       case '&':
-       case '|':
-       case '^':
-       case S_LEFTSHIFT:
-       case S_RIGHTSHIFT:
-               if (deref && a->optype != JUMP) ack_putchar('#');
-               ack_put_expression(a, e->left, 0);
-               if (e->operator == S_LEFTSHIFT) {
-                       ack_printf("<<");
-               } else
-               if (e->operator == S_RIGHTSHIFT) {
-                       ack_printf(">>");
-               } else {
-                       ack_putchar(e->operator);
-               }
-               ack_put_expression(a, e->right, 0);
-               break;
-       case '[':
-               if (deref && a->optype != JUMP) ack_putchar('#');
-               ack_putchar('[');
-               ack_put_expression(a, e->middle, 0);
-               ack_putchar(']');
-               break;
-       case 'W':
-               if (deref && a->optype == JUMP && isregister(e->name))
-               {
-                       ack_printf("(%s)", e->name);
-                       break;
-               }
-               if (deref && a->optype != JUMP && !isregister(e->name)) {
-                       ack_putchar('#');
-               }
-               ack_printf("%s", e->name);
-               break;
-       case 'S':
-               ack_putchar('"');
-               ack_put_string(e->name, e->len);
-               ack_putchar('"');
-               break;
-       default:
-               fprintf(stderr,
-               "asmconv: internal error, unknown expression operator '%d'\n",
-                       e->operator);
-               exit(EXIT_FAILURE);
-       }
-}
-
-void ack_emit_instruction(asm86_t *a)
-/* Output one instruction and its operands. */
-{
-       int same= 0;
-       char *p;
-       static int high_seg;
-       int deref;
-
-       if (a == nil) {
-               /* Last call */
-               ack_putchar('\n');
-               return;
-       }
-
-       /* Make sure the line number of the line to be emitted is ok. */
-       if ((a->file != efile && strcmp(a->file, efile) != 0)
-                               || a->line < eline || a->line > eline+10) {
-               ack_putchar('\n');
-               ack_printf("# %ld \"%s\"\n", a->line, a->file);
-               efile= a->file;
-               eline= a->line;
-       } else {
-               if (a->line == eline) {
-                       ack_printf("; ");
-                       same= 1;
-               }
-               while (eline < a->line) {
-                       ack_putchar('\n');
-                       eline++;
-               }
-       }
-
-       if (a->opcode == DOT_LABEL) {
-               assert(a->args->operator == ':');
-               ack_printf("%s:", a->args->name);
-       } else
-       if (a->opcode == DOT_EQU) {
-               assert(a->args->operator == '=');
-               ack_printf("\t%s = ", a->args->name);
-               ack_put_expression(a, a->args->middle, 0);
-       } else
-       if ((p= opcode2name(a->opcode)) != nil) {
-               char *sep= dialect == ACK ? "" : ";";
-
-               if (!is_pseudo(a->opcode) && !same) ack_putchar('\t');
-
-               switch (a->rep) {
-               case ONCE:      break;
-               case REP:       ack_printf("rep");      break;
-               case REPE:      ack_printf("repe");     break;
-               case REPNE:     ack_printf("repne");    break;
-               default:        assert(0);
-               }
-               if (a->rep != ONCE) {
-                       ack_printf(dialect == ACK ? " " : "; ");
-               }
-               switch (a->seg) {
-               case DEFSEG:    break;
-               case CSEG:      ack_printf("cseg");     break;
-               case DSEG:      ack_printf("dseg");     break;
-               case ESEG:      ack_printf("eseg");     break;
-               case FSEG:      ack_printf("fseg");     break;
-               case GSEG:      ack_printf("gseg");     break;
-               case SSEG:      ack_printf("sseg");     break;
-               default:        assert(0);
-               }
-               if (a->seg != DEFSEG) {
-                       ack_printf(dialect == ACK ? " " : "; ");
-               }
-               if (a->oaz & OPZ) ack_printf(use16() ? "o32 " : "o16 ");
-               if (a->oaz & ADZ) ack_printf(use16() ? "a32 " : "a16 ");
-
-               if (a->opcode == CBW) {
-                       p= !(a->oaz & OPZ) == use16() ? "cbw" : "cwde";
-               }
-
-               if (a->opcode == CWD) {
-                       p= !(a->oaz & OPZ) == use16() ? "cwd" : "cdq";
-               }
-
-               if (a->opcode == DOT_COMM && a->args != nil
-                       && a->args->operator == ','
-                       && a->args->left->operator == 'W'
-               ) {
-                       ack_printf(".define\t%s; ", a->args->left->name);
-               }
-               while (*p != 0) {
-                       if (*p == '%') {
-                               if (a->optype == BYTE) ack_putchar('b');
-                       } else {
-                               ack_putchar(*p);
-                       }
-                       p++;
-               }
-               if (a->args != nil) {
-                       ack_putchar('\t');
-                       switch (a->opcode) {
-                       case IN:
-                       case OUT:
-                       case INT:
-                               deref= 0;
-                               break;
-                       default:
-                               deref= (dialect == NCC && a->optype != PSEUDO);
-                       }
-                       ack_put_expression(a, a->args, deref);
-               }
-               if (a->opcode == DOT_USE16) set_use16();
-               if (a->opcode == DOT_USE32) set_use32();
-       } else {
-               fprintf(stderr,
-                       "asmconv: internal error, unknown opcode '%d'\n",
-                       a->opcode);
-               exit(EXIT_FAILURE);
-       }
-}
-
-/* A few ncc mnemonics are different. */
-static mnemonic_t ncc_mnemtab[] = {
-       { DOT_BSS,      ".bss"          },
-       { DOT_DATA,     ".data"         },
-       { DOT_END,      ".end"          },
-       { DOT_ROM,      ".rom"          },
-       { DOT_TEXT,     ".text"         },
-};
-
-void ncc_emit_init(char *file, const char *banner)
-/* The assembly produced by the Minix ACK ANSI C compiler for the 8086 is
- * different from the normal ACK assembly, and different from the old K&R
- * assembler.  This brings us endless joy.  (It was supposed to make
- * translation of the assembly used by the old K&R assembler easier by
- * not deviating too much from that dialect.)
- */
-{
-       mnemonic_t *mp;
-
-       dialect= NCC;
-       ack_emit_init(file, banner);
-
-       /* Replace a few mnemonics. */
-       for (mp= ncc_mnemtab; mp < arraylimit(ncc_mnemtab); mp++) {
-               opcode2name_tab[mp->opcode]= mp->name;
-       }
-}
-
-void ncc_emit_instruction(asm86_t *a)
-{
-       ack_emit_instruction(a);
-}
diff --git a/commands/asmconv/emit_gnu.c b/commands/asmconv/emit_gnu.c
deleted file mode 100644 (file)
index 060cb01..0000000
+++ /dev/null
@@ -1,679 +0,0 @@
-/*     emit_gnu.c - emit GNU assembly                  Author: Kees J. Bot
- *                                                             28 Dec 1993
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-
-typedef struct mnemonic {      /* GNU as386 mnemonics translation table. */
-       opcode_t        opcode;
-       char            *name;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {
-       { AAA,          "aaa"           },
-       { AAD,          "aad"           },
-       { AAM,          "aam"           },
-       { AAS,          "aas"           },
-       { ADC,          "adc%"          },
-       { ADD,          "add%"          },
-       { AND,          "and%"          },
-       { ARPL,         "arpl"          },
-       { BOUND,        "bound%"        },
-       { BSF,          "bsf%"          },
-       { BSR,          "bsr%"          },
-       { BSWAP,        "bswap"         },
-       { BT,           "bt%"           },
-       { BTC,          "btc%"          },
-       { BTR,          "btr%"          },
-       { BTS,          "bts%"          },
-       { CALL,         "call"          },
-       { CALLF,        "lcall"         },
-       { CBW,          "cbtw"          },
-       { CLC,          "clc"           },
-       { CLD,          "cld"           },
-       { CLI,          "cli"           },
-       { CLTS,         "clts"          },
-       { CMC,          "cmc"           },
-       { CMP,          "cmp%"          },
-       { CMPS,         "cmps%"         },
-       { CMPXCHG,      "cmpxchg"       },
-       { CWD,          "cwtd"          },
-       { DAA,          "daa"           },
-       { DAS,          "das"           },
-       { DEC,          "dec%"          },
-       { DIV,          "div%"          },
-       { DOT_ALIGN,    ".align"        },
-       { DOT_ASCII,    ".ascii"        },
-       { DOT_ASCIZ,    ".asciz"        },
-       { DOT_ASSERT,   ".assert"       },
-       { DOT_BASE,     ".base"         },
-       { DOT_BSS,      ".bss"          },
-       { DOT_COMM,     ".comm"         },
-       { DOT_DATA,     ".data"         },
-       { DOT_DATA1,    ".byte"         },
-       { DOT_DATA2,    ".short"        },
-       { DOT_DATA4,    ".long"         },
-       { DOT_DEFINE,   ".globl"        },
-       { DOT_EXTERN,   ".globl"        },
-       { DOT_FILE,     ".file"         },
-       { DOT_LCOMM,    ".lcomm"        },
-       { DOT_LINE,     ".line"         },
-       { DOT_LIST,     ".list"         },
-       { DOT_NOLIST,   ".nolist"       },
-       { DOT_ROM,      ".data"         },      /* Minix -- separate I&D. */
-       { DOT_SPACE,    ".space"        },
-       { DOT_SYMB,     ".symb"         },
-       { DOT_TEXT,     ".text"         },
-       { DOT_USE16,    ".use16"        },
-       { DOT_USE32,    ".use32"        },
-       { ENTER,        "enter"         },
-       { F2XM1,        "f2xm1"         },
-       { FABS,         "fabs"          },
-       { FADD,         "fadd"          },
-       { FADDD,        "faddl"         },
-       { FADDP,        "faddp"         },
-       { FADDS,        "fadds"         },
-       { FBLD,         "fbld"          },
-       { FBSTP,        "fbstp"         },
-       { FCHS,         "fchs"          },
-       { FCLEX,        "fnclex"        },
-       { FCOMD,        "fcoml"         },
-       { FCOMPD,       "fcompl"        },
-       { FCOMPP,       "fcompp"        },
-       { FCOMPS,       "fcomps"        },
-       { FCOMS,        "fcoms"         },
-       { FCOS,         "fcos"          },
-       { FDECSTP,      "fdecstp"       },
-       { FDIVD,        "fdivl"         },
-       { FDIVP,        "fdivp"         },
-       { FDIVRD,       "fdivrl"        },
-       { FDIVRP,       "fdivrp"        },
-       { FDIVRS,       "fdivrs"        },
-       { FDIVS,        "fdivs"         },
-       { FFREE,        "ffree"         },
-       { FIADDL,       "fiaddl"        },
-       { FIADDS,       "fiadds"        },
-       { FICOM,        "ficom"         },
-       { FICOMP,       "ficomp"        },
-       { FIDIVL,       "fidivl"        },
-       { FIDIVRL,      "fidivrl"       },
-       { FIDIVRS,      "fidivrs"       },
-       { FIDIVS,       "fidivs"        },
-       { FILDL,        "fildl"         },
-       { FILDQ,        "fildq"         },
-       { FILDS,        "filds"         },
-       { FIMULL,       "fimull"        },
-       { FIMULS,       "fimuls"        },
-       { FINCSTP,      "fincstp"       },
-       { FINIT,        "fninit"        },
-       { FISTL,        "fistl"         },
-       { FISTP,        "fistp"         },
-       { FISTS,        "fists"         },
-       { FISUBL,       "fisubl"        },
-       { FISUBRL,      "fisubrl"       },
-       { FISUBRS,      "fisubrs"       },
-       { FISUBS,       "fisubs"        },
-       { FLD1,         "fld1"          },
-       { FLDCW,        "fldcw"         },
-       { FLDD,         "fldl"          },
-       { FLDENV,       "fldenv"        },
-       { FLDL2E,       "fldl2e"        },
-       { FLDL2T,       "fldl2t"        },
-       { FLDLG2,       "fldlg2"        },
-       { FLDLN2,       "fldln2"        },
-       { FLDPI,        "fldpi"         },
-       { FLDS,         "flds"          },
-       { FLDX,         "fldt"          },
-       { FLDZ,         "fldz"          },
-       { FMULD,        "fmull"         },
-       { FMULP,        "fmulp"         },
-       { FMULS,        "fmuls"         },
-       { FNOP,         "fnop"          },
-       { FPATAN,       "fpatan"        },
-       { FPREM,        "fprem"         },
-       { FPREM1,       "fprem1"        },
-       { FPTAN,        "fptan"         },
-       { FRNDINT,      "frndint"       },
-       { FRSTOR,       "frstor"        },
-       { FSAVE,        "fnsave"        },
-       { FSCALE,       "fscale"        },
-       { FSIN,         "fsin"          },
-       { FSINCOS,      "fsincos"       },
-       { FSQRT,        "fsqrt"         },
-       { FSTCW,        "fnstcw"        },
-       { FSTD,         "fstl"          },
-       { FSTENV,       "fnstenv"       },
-       { FSTP,         "fstp"          },
-       { FSTPD,        "fstpl"         },
-       { FSTPS,        "fstps"         },
-       { FSTPX,        "fstpt"         },
-       { FSTS,         "fsts"          },
-       { FSTSW,        "fstsw"         },
-       { FSUBD,        "fsubl"         },
-       { FSUBP,        "fsubp"         },
-       { FSUBPR,       "fsubpr"        },
-       { FSUBRD,       "fsubrl"        },
-       { FSUBRS,       "fsubrs"        },
-       { FSUBS,        "fsubs"         },
-       { FTST,         "ftst"          },
-       { FUCOM,        "fucom"         },
-       { FUCOMP,       "fucomp"        },
-       { FUCOMPP,      "fucompp"       },
-       { FXAM,         "fxam"          },
-       { FXCH,         "fxch"          },
-       { FXTRACT,      "fxtract"       },
-       { FYL2X,        "fyl2x"         },
-       { FYL2XP1,      "fyl2xp1"       },
-       { HLT,          "hlt"           },
-       { IDIV,         "idiv%"         },
-       { IMUL,         "imul%"         },
-       { IN,           "in%"           },
-       { INC,          "inc%"          },
-       { INS,          "ins%"          },
-       { INT,          "int"           },
-       { INTO,         "into"          },
-       { INVD,         "invd"          },
-       { INVLPG,       "invlpg"        },
-       { IRET,         "iret"          },
-       { IRETD,        "iret"          },
-       { JA,           "ja"            },
-       { JAE,          "jae"           },
-       { JB,           "jb"            },
-       { JBE,          "jbe"           },
-       { JCXZ,         "jcxz"          },
-       { JE,           "je"            },
-       { JG,           "jg"            },
-       { JGE,          "jge"           },
-       { JL,           "jl"            },
-       { JLE,          "jle"           },
-       { JMP,          "jmp"           },
-       { JMPF,         "ljmp"          },
-       { JNE,          "jne"           },
-       { JNO,          "jno"           },
-       { JNP,          "jnp"           },
-       { JNS,          "jns"           },
-       { JO,           "jo"            },
-       { JP,           "jp"            },
-       { JS,           "js"            },
-       { LAHF,         "lahf"          },
-       { LAR,          "lar"           },
-       { LDS,          "lds"           },
-       { LEA,          "lea%"          },
-       { LEAVE,        "leave"         },
-       { LES,          "les"           },
-       { LFS,          "lfs"           },
-       { LGDT,         "lgdt"          },
-       { LGS,          "lgs"           },
-       { LIDT,         "lidt"          },
-       { LLDT,         "lldt"          },
-       { LMSW,         "lmsw"          },
-       { LOCK,         "lock"          },
-       { LODS,         "lods%"         },
-       { LOOP,         "loop"          },
-       { LOOPE,        "loope"         },
-       { LOOPNE,       "loopne"        },
-       { LSL,          "lsl"           },
-       { LSS,          "lss"           },
-       { LTR,          "ltr"           },
-       { MOV,          "mov%"          },
-       { MOVS,         "movs%"         },
-       { MOVSX,        "movswl"        },
-       { MOVSXB,       "movsb%"        },
-       { MOVZX,        "movzwl"        },
-       { MOVZXB,       "movzb%"        },
-       { MUL,          "mul%"          },
-       { NEG,          "neg%"          },
-       { NOP,          "nop"           },
-       { NOT,          "not%"          },
-       { OR,           "or%"           },
-       { OUT,          "out%"          },
-       { OUTS,         "outs%"         },
-       { POP,          "pop%"          },
-       { POPA,         "popa%"         },
-       { POPF,         "popf%"         },
-       { PUSH,         "push%"         },
-       { PUSHA,        "pusha%"        },
-       { PUSHF,        "pushf%"        },
-       { RCL,          "rcl%"          },
-       { RCR,          "rcr%"          },
-       { RET,          "ret"           },
-       { RETF,         "lret"          },
-       { ROL,          "rol%"          },
-       { ROR,          "ror%"          },
-       { SAHF,         "sahf"          },
-       { SAL,          "sal%"          },
-       { SAR,          "sar%"          },
-       { SBB,          "sbb%"          },
-       { SCAS,         "scas%"         },
-       { SETA,         "setab"         },
-       { SETAE,        "setaeb"        },
-       { SETB,         "setbb"         },
-       { SETBE,        "setbeb"        },
-       { SETE,         "seteb"         },
-       { SETG,         "setgb"         },
-       { SETGE,        "setgeb"        },
-       { SETL,         "setlb"         },
-       { SETLE,        "setleb"        },
-       { SETNE,        "setneb"        },
-       { SETNO,        "setnob"        },
-       { SETNP,        "setnpb"        },
-       { SETNS,        "setnsb"        },
-       { SETO,         "setob"         },
-       { SETP,         "setpb"         },
-       { SETS,         "setsb"         },
-       { SGDT,         "sgdt"          },
-       { SHL,          "shl%"          },
-       { SHLD,         "shld%"         },
-       { SHR,          "shr%"          },
-       { SHRD,         "shrd%"         },
-       { SIDT,         "sidt"          },
-       { SLDT,         "sldt"          },
-       { SMSW,         "smsw"          },
-       { STC,          "stc"           },
-       { STD,          "std"           },
-       { STI,          "sti"           },
-       { STOS,         "stos%"         },
-       { STR,          "str"           },
-       { SUB,          "sub%"          },
-       { TEST,         "test%"         },
-       { VERR,         "verr"          },
-       { VERW,         "verw"          },
-       { WAIT,         "wait"          },
-       { WBINVD,       "wbinvd"        },
-       { XADD,         "xadd"          },
-       { XCHG,         "xchg%"         },
-       { XLAT,         "xlat"          },
-       { XOR,          "xor%"          },
-};
-
-static FILE *ef;
-static long eline= 1;
-static char *efile;
-static char *orig_efile;
-static char *opcode2name_tab[N_OPCODES];
-
-static void gnu_putchar(int c)
-/* LOOK, this programmer checks the return code of putc!  What an idiot, noone
- * does that!
- */
-{
-       if (putc(c, ef) == EOF) fatal(orig_efile);
-}
-
-static void gnu_printf(const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       if (vfprintf(ef, fmt, ap) == EOF) fatal(orig_efile);
-       va_end(ap);
-}
-
-void gnu_emit_init(char *file, const char *banner)
-/* Prepare producing a GNU assembly file. */
-{
-       mnemonic_t *mp;
-
-       if (file == nil) {
-               file= "stdout";
-               ef= stdout;
-       } else {
-               if ((ef= fopen(file, "w")) == nil) fatal(file);
-       }
-       orig_efile= file;
-       efile= file;
-       gnu_printf("/ %s", banner);
-
-       /* Initialize the opcode to mnemonic translation table. */
-       for (mp= mnemtab; mp < arraylimit(mnemtab); mp++) {
-               assert(opcode2name_tab[mp->opcode] == nil);
-               opcode2name_tab[mp->opcode]= mp->name;
-       }
-}
-
-#define opcode2name(op)                (opcode2name_tab[op] + 0)
-
-static void gnu_put_string(const char *s, size_t n)
-/* Emit a string with weird characters quoted. */
-{
-       while (n > 0) {
-               int c= *s;
-
-               if (c < ' ' || c > 0177) {
-                       gnu_printf("\\%03o", c);
-               } else
-               if (c == '"' || c == '\\') {
-                       gnu_printf("\\%c", c & 0xFF);
-               } else {
-                       gnu_putchar(c);
-               }
-               s++;
-               n--;
-       }
-}
-
-static void gnu_put_expression(asm86_t *a, expression_t *e, int deref)
-/* Send an expression, i.e. instruction operands, to the output file.  Deref
- * is true when the rewrite of "x" -> "#x" or "(x)" -> "x" may be made.
- */
-{
-       assert(e != nil);
-
-       switch (e->operator) {
-       case ',':
-               if (is_pseudo(a->opcode)) {
-                       /* Pseudo's are normal. */
-                       gnu_put_expression(a, e->left, deref);
-                       gnu_printf(", ");
-                       gnu_put_expression(a, e->right, deref);
-               } else {
-                       /* He who invented GNU assembly has seen one VAX too
-                        * many, operands are given in the wrong order.  This
-                        * makes coding from an Intel databook a real delight.
-                        * A good thing this program allows us to write the
-                        * more normal ACK assembly.
-                        */
-                       gnu_put_expression(a, e->right, deref);
-                       gnu_printf(", ");
-                       gnu_put_expression(a, e->left, deref);
-               }
-               break;
-       case 'O':
-               if (deref && a->optype == JUMP) gnu_putchar('*');
-               if (e->left != nil) gnu_put_expression(a, e->left, 0);
-               gnu_putchar('(');
-               if (e->middle != nil) gnu_put_expression(a, e->middle, 0);
-               if (e->right != nil) {
-                       gnu_putchar(',');
-                       gnu_put_expression(a, e->right, 0);
-               }
-               gnu_putchar(')');
-               break;
-       case '(':
-               if (!deref) gnu_putchar('(');
-               if (deref && a->optype == JUMP) gnu_putchar('*');
-               gnu_put_expression(a, e->middle, 0);
-               if (!deref) gnu_putchar(')');
-               break;
-       case 'B':
-               gnu_printf("%%%s", e->name);
-               break;
-       case '1':
-       case '2':
-       case '4':
-       case '8':
-               gnu_printf("%%%s,%c", e->name, e->operator);
-               break;
-       case '+':
-       case '-':
-       case '~':
-               if (e->middle != nil) {
-                       if (deref && a->optype >= BYTE) gnu_putchar('$');
-                       gnu_putchar(e->operator);
-                       gnu_put_expression(a, e->middle, 0);
-                       break;
-               }
-               /*FALL THROUGH*/
-       case '*':
-       case '/':
-       case '%':
-       case '&':
-       case '|':
-       case '^':
-       case S_LEFTSHIFT:
-       case S_RIGHTSHIFT:
-               if (deref && a->optype >= BYTE) gnu_putchar('$');
-               gnu_put_expression(a, e->left, 0);
-               if (e->operator == S_LEFTSHIFT) {
-                       gnu_printf("<<");
-               } else
-               if (e->operator == S_RIGHTSHIFT) {
-                       gnu_printf(">>");
-               } else {
-                       gnu_putchar(e->operator);
-               }
-               gnu_put_expression(a, e->right, 0);
-               break;
-       case '[':
-               if (deref && a->optype >= BYTE) gnu_putchar('$');
-               gnu_putchar('(');
-               gnu_put_expression(a, e->middle, 0);
-               gnu_putchar(')');
-               break;
-       case 'W':
-               if (isregister(e->name)) {
-                       if (a->optype == JUMP) gnu_putchar('*');
-                       gnu_printf("%%%s", e->name);
-               } else {
-                       if (deref && a->optype >= BYTE) gnu_putchar('$');
-                       gnu_printf("%s", e->name);
-               }
-               break;
-       case 'S':
-               gnu_putchar('"');
-               gnu_put_string(e->name, e->len);
-               gnu_putchar('"');
-               break;
-       default:
-               fprintf(stderr,
-               "asmconv: internal error, unknown expression operator '%d'\n",
-                       e->operator);
-               exit(EXIT_FAILURE);
-       }
-}
-
-void gnu_emit_instruction(asm86_t *a)
-/* Output one instruction and its operands. */
-{
-       int same= 0;
-       char *p;
-
-       if (a == nil) {
-               /* Last call */
-               gnu_putchar('\n');
-               return;
-       }
-
-       if (use16()) {
-               fprintf(stderr,
-               "asmconv: the GNU assembler can't translate 8086 code\n");
-               exit(EXIT_FAILURE);
-       }
-
-       /* Make sure the line number of the line to be emitted is ok. */
-       if ((a->file != efile && strcmp(a->file, efile) != 0)
-                               || a->line < eline || a->line > eline+10) {
-               gnu_putchar('\n');
-               gnu_printf("# %ld \"%s\"\n", a->line, a->file);
-               efile= a->file;
-               eline= a->line;
-       } else {
-               if (a->line == eline) {
-                       gnu_printf("; ");
-                       same= 1;
-               }
-               while (eline < a->line) {
-                       gnu_putchar('\n');
-                       eline++;
-               }
-       }
-
-       if (a->opcode == DOT_END) {
-               /* Stop translating after .sect .end. */
-               exit(0);
-       } else
-       if (a->opcode == DOT_LABEL) {
-               assert(a->args->operator == ':');
-               gnu_printf("%s:", a->args->name);
-       } else
-       if (a->opcode == DOT_EQU) {
-               assert(a->args->operator == '=');
-               gnu_printf("\t%s = ", a->args->name);
-               gnu_put_expression(a, a->args->middle, 0);
-       } else
-       if (a->opcode == DOT_ALIGN) {
-               /* GNU .align thinks in powers of two. */
-               unsigned long n;
-               unsigned s;
-
-               assert(a->args->operator == 'W' && isanumber(a->args->name));
-               n= strtoul(a->args->name, nil, 0);
-               for (s= 0; s <= 16 && (1 << s) < n; s++) {}
-               gnu_printf(".align\t%u", s);
-       } else
-       if ((p= opcode2name(a->opcode)) != nil) {
-               if (!is_pseudo(a->opcode) && !same) gnu_putchar('\t');
-
-               switch (a->rep) {
-               case ONCE:      break;
-               case REP:       gnu_printf("rep; ");    break;
-               case REPE:      gnu_printf("repe; ");   break;
-               case REPNE:     gnu_printf("repne; ");  break;
-               default:        assert(0);
-               }
-               switch (a->seg) {
-               /* Kludge to avoid knowing where to put the "%es:" */
-               case DEFSEG:    break;
-               case CSEG:      gnu_printf(".byte 0x2e; ");     break;
-               case DSEG:      gnu_printf(".byte 0x3e; ");     break;
-               case ESEG:      gnu_printf(".byte 0x26; ");     break;
-               case FSEG:      gnu_printf(".byte 0x64; ");     break;
-               case GSEG:      gnu_printf(".byte 0x65; ");     break;
-               case SSEG:      gnu_printf(".byte 0x36; ");     break;
-               default:        assert(0);
-               }
-
-               /* Exceptions, exceptions... */
-               if (a->opcode == CBW) {
-                       if (!(a->oaz & OPZ)) p= "cwtl";
-                       a->oaz&= ~OPZ;
-               }
-               if (a->opcode == CWD) {
-                       if (!(a->oaz & OPZ)) p= "cltd";
-                       a->oaz&= ~OPZ;
-               }
-
-               if (a->opcode == RET || a->opcode == RETF) {
-                       /* Argument of RET needs a '$'. */
-                       a->optype= WORD;
-               }
-
-               if (a->opcode == MUL && a->args != nil
-                                               && a->args->operator == ',') {
-                       /* Two operand MUL is an IMUL? */
-                       p="imul%";
-               }
-
-               /* GAS doesn't understand the interesting combinations. */
-               if (a->oaz & ADZ) gnu_printf(".byte 0x67; ");
-               if (a->oaz & OPZ && strchr(p, '%') == nil)
-                       gnu_printf(".byte 0x66; ");
-
-               /* Unsupported instructions that Minix code needs. */
-               if (a->opcode == JMPF && a->args != nil
-                                       && a->args->operator == ',') {
-                       /* JMPF seg:off. */
-                       gnu_printf(".byte 0xEA; .long ");
-                       gnu_put_expression(a, a->args->right, 0);
-                       gnu_printf("; .short ");
-                       gnu_put_expression(a, a->args->left, 0);
-                       return;
-               }
-               if (a->opcode == JMPF && a->args != nil
-                       && a->args->operator == 'O'
-                       && a->args->left != nil
-                       && a->args->right == nil
-                       && a->args->middle != nil
-                       && a->args->middle->operator == 'B'
-                       && strcmp(a->args->middle->name, "esp") == 0
-               ) {
-                       /* JMPF offset(ESP). */
-                       gnu_printf(".byte 0xFF,0x6C,0x24,");
-                       gnu_put_expression(a, a->args->left, 0);
-                       return;
-               }
-               if (a->opcode == MOV && a->args != nil
-                       && a->args->operator == ','
-                       && a->args->left != nil
-                       && a->args->left->operator == 'W'
-                       && (strcmp(a->args->left->name, "ds") == 0
-                               || strcmp(a->args->left->name, "es") == 0)
-                       && a->args->right->operator == 'O'
-                       && a->args->right->left != nil
-                       && a->args->right->right == nil
-                       && a->args->right->middle != nil
-                       && a->args->right->middle->operator == 'B'
-                       && strcmp(a->args->right->middle->name, "esp") == 0
-               ) {
-                       /* MOV DS, offset(ESP); MOV ES, offset(ESP) */
-                       gnu_printf(".byte 0x8E,0x%02X,0x24,",
-                               a->args->left->name[0] == 'd' ? 0x5C : 0x44);
-                       gnu_put_expression(a, a->args->right->left, 0);
-                       return;
-               }
-               if (a->opcode == MOV && a->args != nil
-                       && a->args->operator == ','
-                       && a->args->left != nil
-                       && a->args->left->operator == 'W'
-                       && (strcmp(a->args->left->name, "ds") == 0
-                               || strcmp(a->args->left->name, "es") == 0)
-                       && a->args->right->operator == '('
-                       && a->args->right->middle != nil
-               ) {
-                       /* MOV DS, (memory); MOV ES, (memory) */
-                       gnu_printf(".byte 0x8E,0x%02X; .long ",
-                               a->args->left->name[0] == 'd' ? 0x1D : 0x05);
-                       gnu_put_expression(a, a->args->right->middle, 0);
-                       return;
-               }
-
-               while (*p != 0) {
-                       if (*p == '%') {
-                               if (a->optype == BYTE) {
-                                       gnu_putchar('b');
-                               } else
-                               if (a->optype == WORD) {
-                                       gnu_putchar((a->oaz & OPZ) ? 'w' : 'l');
-                               } else {
-                                       assert(0);
-                               }
-                       } else {
-                               gnu_putchar(*p);
-                       }
-                       p++;
-               }
-
-               if (a->args != nil) {
-                       static char *aregs[] = { "al", "ax", "eax" };
-
-                       gnu_putchar('\t');
-                       switch (a->opcode) {
-                       case IN:
-                               gnu_put_expression(a, a->args, 1);
-                               gnu_printf(", %%%s", aregs[a->optype - BYTE]);
-                               break;
-                       case OUT:
-                               gnu_printf("%%%s, ", aregs[a->optype - BYTE]);
-                               gnu_put_expression(a, a->args, 1);
-                               break;
-                       default:
-                               gnu_put_expression(a, a->args, 1);
-                       }
-               }
-               if (a->opcode == DOT_USE16) set_use16();
-               if (a->opcode == DOT_USE32) set_use32();
-       } else {
-               fprintf(stderr,
-                       "asmconv: internal error, unknown opcode '%d'\n",
-                       a->opcode);
-               exit(EXIT_FAILURE);
-       }
-}
diff --git a/commands/asmconv/languages.h b/commands/asmconv/languages.h
deleted file mode 100644 (file)
index a34ec9f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*     languages.h - functions that parse or emit assembly
- *                                                     Author: Kees J. Bot
- *                                                             27 Dec 1993
- */
-
-void ack_parse_init(char *file);
-asm86_t *ack_get_instruction(void);
-
-void ncc_parse_init(char *file);
-asm86_t *ncc_get_instruction(void);
-
-void gnu_parse_init(char *file);
-asm86_t *gnu_get_instruction(void);
-
-void bas_parse_init(char *file);
-asm86_t *bas_get_instruction(void);
-
-void ack_emit_init(char *file, const char *banner);
-void ack_emit_instruction(asm86_t *instr);
-
-void ncc_emit_init(char *file, const char *banner);
-void ncc_emit_instruction(asm86_t *instr);
-
-void gnu_emit_init(char *file, const char *banner);
-void gnu_emit_instruction(asm86_t *instr);
diff --git a/commands/asmconv/parse_ack.c b/commands/asmconv/parse_ack.c
deleted file mode 100644 (file)
index b0c1714..0000000
+++ /dev/null
@@ -1,911 +0,0 @@
-/*     parse_ack.c - parse ACK assembly                Author: Kees J. Bot
- *                   parse NCC assembly                        18 Dec 1993
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-
-typedef struct mnemonic {      /* ACK as86 mnemonics translation table. */
-       char            *name;
-       opcode_t        opcode;
-       optype_t        optype;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {                        /* This array is sorted. */
-       { ".align",     DOT_ALIGN,      PSEUDO },
-       { ".ascii",     DOT_ASCII,      PSEUDO },
-       { ".asciz",     DOT_ASCIZ,      PSEUDO },
-       { ".assert",    DOT_ASSERT,     PSEUDO },
-       { ".base",      DOT_BASE,       PSEUDO },
-       { ".bss",       DOT_BSS,        PSEUDO },
-       { ".comm",      DOT_LCOMM,      PSEUDO },
-       { ".data",      DOT_DATA,       PSEUDO },
-       { ".data1",     DOT_DATA1,      PSEUDO },
-       { ".data2",     DOT_DATA2,      PSEUDO },
-       { ".data4",     DOT_DATA4,      PSEUDO },
-       { ".define",    DOT_DEFINE,     PSEUDO },
-       { ".end",       DOT_END,        PSEUDO },
-       { ".extern",    DOT_EXTERN,     PSEUDO },
-       { ".file",      DOT_FILE,       PSEUDO },
-       { ".line",      DOT_LINE,       PSEUDO },
-       { ".list",      DOT_LIST,       PSEUDO },
-       { ".nolist",    DOT_NOLIST,     PSEUDO },
-       { ".rom",       DOT_ROM,        PSEUDO },
-       { ".space",     DOT_SPACE,      PSEUDO },
-       { ".symb",      DOT_SYMB,       PSEUDO },
-       { ".text",      DOT_TEXT,       PSEUDO },
-       { ".use16",     DOT_USE16,      PSEUDO },
-       { ".use32",     DOT_USE32,      PSEUDO },
-       { "aaa",        AAA,            WORD },
-       { "aad",        AAD,            WORD },
-       { "aam",        AAM,            WORD },
-       { "aas",        AAS,            WORD },
-       { "adc",        ADC,            WORD },
-       { "adcb",       ADC,            BYTE },
-       { "add",        ADD,            WORD },
-       { "addb",       ADD,            BYTE },
-       { "and",        AND,            WORD },
-       { "andb",       AND,            BYTE },
-       { "arpl",       ARPL,           WORD },
-       { "bound",      BOUND,          WORD },
-       { "bsf",        BSF,            WORD },
-       { "bsr",        BSR,            WORD },
-       { "bswap",      BSWAP,          WORD },
-       { "bt",         BT,             WORD },
-       { "btc",        BTC,            WORD },
-       { "btr",        BTR,            WORD },
-       { "bts",        BTS,            WORD },
-       { "call",       CALL,           JUMP },
-       { "callf",      CALLF,          JUMP },
-       { "cbw",        CBW,            WORD },
-       { "cdq",        CWD,            WORD },
-       { "clc",        CLC,            WORD },
-       { "cld",        CLD,            WORD },
-       { "cli",        CLI,            WORD },
-       { "clts",       CLTS,           WORD },
-       { "cmc",        CMC,            WORD },
-       { "cmp",        CMP,            WORD },
-       { "cmpb",       CMP,            BYTE },
-       { "cmps",       CMPS,           WORD },
-       { "cmpsb",      CMPS,           BYTE },
-       { "cmpxchg",    CMPXCHG,        WORD },
-       { "cwd",        CWD,            WORD },
-       { "cwde",       CBW,            WORD },
-       { "daa",        DAA,            WORD },
-       { "das",        DAS,            WORD },
-       { "dec",        DEC,            WORD },
-       { "decb",       DEC,            BYTE },
-       { "div",        DIV,            WORD },
-       { "divb",       DIV,            BYTE },
-       { "enter",      ENTER,          WORD },
-       { "f2xm1",      F2XM1,          WORD },
-       { "fabs",       FABS,           WORD },
-       { "fadd",       FADD,           WORD },
-       { "faddd",      FADDD,          WORD },
-       { "faddp",      FADDP,          WORD },
-       { "fadds",      FADDS,          WORD },
-       { "fbld",       FBLD,           WORD },
-       { "fbstp",      FBSTP,          WORD },
-       { "fchs",       FCHS,           WORD },
-       { "fclex",      FCLEX,          WORD },
-       { "fcomd",      FCOMD,          WORD },
-       { "fcompd",     FCOMPD,         WORD },
-       { "fcompp",     FCOMPP,         WORD },
-       { "fcomps",     FCOMPS,         WORD },
-       { "fcoms",      FCOMS,          WORD },
-       { "fcos",       FCOS,           WORD },
-       { "fdecstp",    FDECSTP,        WORD },
-       { "fdivd",      FDIVD,          WORD },
-       { "fdivp",      FDIVP,          WORD },
-       { "fdivrd",     FDIVRD,         WORD },
-       { "fdivrp",     FDIVRP,         WORD },
-       { "fdivrs",     FDIVRS,         WORD },
-       { "fdivs",      FDIVS,          WORD },
-       { "ffree",      FFREE,          WORD },
-       { "fiaddl",     FIADDL,         WORD },
-       { "fiadds",     FIADDS,         WORD },
-       { "ficom",      FICOM,          WORD },
-       { "ficomp",     FICOMP,         WORD },
-       { "fidivl",     FIDIVL,         WORD },
-       { "fidivrl",    FIDIVRL,        WORD },
-       { "fidivrs",    FIDIVRS,        WORD },
-       { "fidivs",     FIDIVS,         WORD },
-       { "fildl",      FILDL,          WORD },
-       { "fildq",      FILDQ,          WORD },
-       { "filds",      FILDS,          WORD },
-       { "fimull",     FIMULL,         WORD },
-       { "fimuls",     FIMULS,         WORD },
-       { "fincstp",    FINCSTP,        WORD },
-       { "finit",      FINIT,          WORD },
-       { "fistl",      FISTL,          WORD },
-       { "fistp",      FISTP,          WORD },
-       { "fists",      FISTS,          WORD },
-       { "fisubl",     FISUBL,         WORD },
-       { "fisubrl",    FISUBRL,        WORD },
-       { "fisubrs",    FISUBRS,        WORD },
-       { "fisubs",     FISUBS,         WORD },
-       { "fld1",       FLD1,           WORD },
-       { "fldcw",      FLDCW,          WORD },
-       { "fldd",       FLDD,           WORD },
-       { "fldenv",     FLDENV,         WORD },
-       { "fldl2e",     FLDL2E,         WORD },
-       { "fldl2t",     FLDL2T,         WORD },
-       { "fldlg2",     FLDLG2,         WORD },
-       { "fldln2",     FLDLN2,         WORD },
-       { "fldpi",      FLDPI,          WORD },
-       { "flds",       FLDS,           WORD },
-       { "fldx",       FLDX,           WORD },
-       { "fldz",       FLDZ,           WORD },
-       { "fmuld",      FMULD,          WORD },
-       { "fmulp",      FMULP,          WORD },
-       { "fmuls",      FMULS,          WORD },
-       { "fnop",       FNOP,           WORD },
-       { "fpatan",     FPATAN,         WORD },
-       { "fprem",      FPREM,          WORD },
-       { "fprem1",     FPREM1,         WORD },
-       { "fptan",      FPTAN,          WORD },
-       { "frndint",    FRNDINT,        WORD },
-       { "frstor",     FRSTOR,         WORD },
-       { "fsave",      FSAVE,          WORD },
-       { "fscale",     FSCALE,         WORD },
-       { "fsin",       FSIN,           WORD },
-       { "fsincos",    FSINCOS,        WORD },
-       { "fsqrt",      FSQRT,          WORD },
-       { "fstcw",      FSTCW,          WORD },
-       { "fstd",       FSTD,           WORD },
-       { "fstenv",     FSTENV,         WORD },
-       { "fstp",       FSTP,           WORD },
-       { "fstpd",      FSTPD,          WORD },
-       { "fstps",      FSTPS,          WORD },
-       { "fstpx",      FSTPX,          WORD },
-       { "fsts",       FSTS,           WORD },
-       { "fstsw",      FSTSW,          WORD },
-       { "fsubd",      FSUBD,          WORD },
-       { "fsubp",      FSUBP,          WORD },
-       { "fsubpr",     FSUBPR,         WORD },
-       { "fsubrd",     FSUBRD,         WORD },
-       { "fsubrs",     FSUBRS,         WORD },
-       { "fsubs",      FSUBS,          WORD },
-       { "ftst",       FTST,           WORD },
-       { "fucom",      FUCOM,          WORD },
-       { "fucomp",     FUCOMP,         WORD },
-       { "fucompp",    FUCOMPP,        WORD },
-       { "fxam",       FXAM,           WORD },
-       { "fxch",       FXCH,           WORD },
-       { "fxtract",    FXTRACT,        WORD },
-       { "fyl2x",      FYL2X,          WORD },
-       { "fyl2xp1",    FYL2XP1,        WORD },
-       { "hlt",        HLT,            WORD },
-       { "idiv",       IDIV,           WORD },
-       { "idivb",      IDIV,           BYTE },
-       { "imul",       IMUL,           WORD },
-       { "imulb",      IMUL,           BYTE },
-       { "in",         IN,             WORD },
-       { "inb",        IN,             BYTE },
-       { "inc",        INC,            WORD },
-       { "incb",       INC,            BYTE },
-       { "ins",        INS,            WORD },
-       { "insb",       INS,            BYTE },
-       { "int",        INT,            WORD },
-       { "into",       INTO,           JUMP },
-       { "invd",       INVD,           WORD },
-       { "invlpg",     INVLPG,         WORD },
-       { "iret",       IRET,           JUMP },
-       { "iretd",      IRETD,          JUMP },
-       { "ja",         JA,             JUMP },
-       { "jae",        JAE,            JUMP },
-       { "jb",         JB,             JUMP },
-       { "jbe",        JBE,            JUMP },
-       { "jc",         JB,             JUMP },
-       { "jcxz",       JCXZ,           JUMP },
-       { "je",         JE,             JUMP },
-       { "jecxz",      JCXZ,           JUMP },
-       { "jg",         JG,             JUMP },
-       { "jge",        JGE,            JUMP },
-       { "jl",         JL,             JUMP },
-       { "jle",        JLE,            JUMP },
-       { "jmp",        JMP,            JUMP },
-       { "jmpf",       JMPF,           JUMP },
-       { "jna",        JBE,            JUMP },
-       { "jnae",       JB,             JUMP },
-       { "jnb",        JAE,            JUMP },
-       { "jnbe",       JA,             JUMP },
-       { "jnc",        JAE,            JUMP },
-       { "jne",        JNE,            JUMP },
-       { "jng",        JLE,            JUMP },
-       { "jnge",       JL,             JUMP },
-       { "jnl",        JGE,            JUMP },
-       { "jnle",       JG,             JUMP },
-       { "jno",        JNO,            JUMP },
-       { "jnp",        JNP,            JUMP },
-       { "jns",        JNS,            JUMP },
-       { "jnz",        JNE,            JUMP },
-       { "jo",         JO,             JUMP },
-       { "jp",         JP,             JUMP },
-       { "js",         JS,             JUMP },
-       { "jz",         JE,             JUMP },
-       { "lahf",       LAHF,           WORD },
-       { "lar",        LAR,            WORD },
-       { "lds",        LDS,            WORD },
-       { "lea",        LEA,            WORD },
-       { "leave",      LEAVE,          WORD },
-       { "les",        LES,            WORD },
-       { "lfs",        LFS,            WORD },
-       { "lgdt",       LGDT,           WORD },
-       { "lgs",        LGS,            WORD },
-       { "lidt",       LIDT,           WORD },
-       { "lldt",       LLDT,           WORD },
-       { "lmsw",       LMSW,           WORD },
-       { "lock",       LOCK,           WORD },
-       { "lods",       LODS,           WORD },
-       { "lodsb",      LODS,           BYTE },
-       { "loop",       LOOP,           JUMP },
-       { "loope",      LOOPE,          JUMP },
-       { "loopne",     LOOPNE,         JUMP },
-       { "loopnz",     LOOPNE,         JUMP },
-       { "loopz",      LOOPE,          JUMP },
-       { "lsl",        LSL,            WORD },
-       { "lss",        LSS,            WORD },
-       { "ltr",        LTR,            WORD },
-       { "mov",        MOV,            WORD },
-       { "movb",       MOV,            BYTE },
-       { "movs",       MOVS,           WORD },
-       { "movsb",      MOVS,           BYTE },
-       { "movsx",      MOVSX,          WORD },
-       { "movsxb",     MOVSXB,         WORD },
-       { "movzx",      MOVZX,          WORD },
-       { "movzxb",     MOVZXB,         WORD },
-       { "mul",        MUL,            WORD },
-       { "mulb",       MUL,            BYTE },
-       { "neg",        NEG,            WORD },
-       { "negb",       NEG,            BYTE },
-       { "nop",        NOP,            WORD },
-       { "not",        NOT,            WORD },
-       { "notb",       NOT,            BYTE },
-       { "or",         OR,             WORD },
-       { "orb",        OR,             BYTE },
-       { "out",        OUT,            WORD },
-       { "outb",       OUT,            BYTE },
-       { "outs",       OUTS,           WORD },
-       { "outsb",      OUTS,           BYTE },
-       { "pop",        POP,            WORD },
-       { "popa",       POPA,           WORD },
-       { "popad",      POPA,           WORD },
-       { "popf",       POPF,           WORD },
-       { "push",       PUSH,           WORD },
-       { "pusha",      PUSHA,          WORD },
-       { "pushad",     PUSHA,          WORD },
-       { "pushf",      PUSHF,          WORD },
-       { "rcl",        RCL,            WORD },
-       { "rclb",       RCL,            BYTE },
-       { "rcr",        RCR,            WORD },
-       { "rcrb",       RCR,            BYTE },
-       { "ret",        RET,            JUMP },
-       { "retf",       RETF,           JUMP },
-       { "rol",        ROL,            WORD },
-       { "rolb",       ROL,            BYTE },
-       { "ror",        ROR,            WORD },
-       { "rorb",       ROR,            BYTE },
-       { "sahf",       SAHF,           WORD },
-       { "sal",        SAL,            WORD },
-       { "salb",       SAL,            BYTE },
-       { "sar",        SAR,            WORD },
-       { "sarb",       SAR,            BYTE },
-       { "sbb",        SBB,            WORD },
-       { "sbbb",       SBB,            BYTE },
-       { "scas",       SCAS,           WORD },
-       { "scasb",      SCAS,           BYTE },
-       { "seta",       SETA,           BYTE },
-       { "setae",      SETAE,          BYTE },
-       { "setb",       SETB,           BYTE },
-       { "setbe",      SETBE,          BYTE },
-       { "sete",       SETE,           BYTE },
-       { "setg",       SETG,           BYTE },
-       { "setge",      SETGE,          BYTE },
-       { "setl",       SETL,           BYTE },
-       { "setna",      SETBE,          BYTE },
-       { "setnae",     SETB,           BYTE },
-       { "setnb",      SETAE,          BYTE },
-       { "setnbe",     SETA,           BYTE },
-       { "setne",      SETNE,          BYTE },
-       { "setng",      SETLE,          BYTE },
-       { "setnge",     SETL,           BYTE },
-       { "setnl",      SETGE,          BYTE },
-       { "setnle",     SETG,           BYTE },
-       { "setno",      SETNO,          BYTE },
-       { "setnp",      SETNP,          BYTE },
-       { "setns",      SETNS,          BYTE },
-       { "seto",       SETO,           BYTE },
-       { "setp",       SETP,           BYTE },
-       { "sets",       SETS,           BYTE },
-       { "setz",       SETE,           BYTE },
-       { "sgdt",       SGDT,           WORD },
-       { "shl",        SHL,            WORD },
-       { "shlb",       SHL,            BYTE },
-       { "shld",       SHLD,           WORD },
-       { "shr",        SHR,            WORD },
-       { "shrb",       SHR,            BYTE },
-       { "shrd",       SHRD,           WORD },
-       { "sidt",       SIDT,           WORD },
-       { "sldt",       SLDT,           WORD },
-       { "smsw",       SMSW,           WORD },
-       { "stc",        STC,            WORD },
-       { "std",        STD,            WORD },
-       { "sti",        STI,            WORD },
-       { "stos",       STOS,           WORD },
-       { "stosb",      STOS,           BYTE },
-       { "str",        STR,            WORD },
-       { "sub",        SUB,            WORD },
-       { "subb",       SUB,            BYTE },
-       { "test",       TEST,           WORD },
-       { "testb",      TEST,           BYTE },
-       { "verr",       VERR,           WORD },
-       { "verw",       VERW,           WORD },
-       { "wait",       WAIT,           WORD },
-       { "wbinvd",     WBINVD,         WORD },
-       { "xadd",       XADD,           WORD },
-       { "xchg",       XCHG,           WORD },
-       { "xchgb",      XCHG,           BYTE },
-       { "xlat",       XLAT,           WORD },
-       { "xor",        XOR,            WORD },
-       { "xorb",       XOR,            BYTE },
-};
-
-static enum dialect { ACK, NCC } dialect= ACK;
-
-void ack_parse_init(char *file)
-/* Prepare parsing of an ACK assembly file. */
-{
-       tok_init(file, '!');
-}
-
-void ncc_parse_init(char *file)
-/* Prepare parsing of an ACK Xenix assembly file.  See emit_ack.c for comments
- * on this fine assembly dialect.
- */
-{
-       dialect= NCC;
-       ack_parse_init(file);
-}
-
-static void zap(void)
-/* An error, zap the rest of the line. */
-{
-       token_t *t;
-
-       while ((t= get_token(0))->type != T_EOF && t->symbol != ';')
-               skip_token(1);
-}
-
-static mnemonic_t *search_mnem(char *name)
-/* Binary search for a mnemonic.  (That's why the table is sorted.) */
-{
-       int low, mid, high;
-       int cmp;
-       mnemonic_t *m;
-
-       low= 0;
-       high= arraysize(mnemtab)-1;
-       while (low <= high) {
-               mid= (low + high) / 2;
-               m= &mnemtab[mid];
-
-               if ((cmp= strcmp(name, m->name)) == 0) return m;
-
-               if (cmp < 0) high= mid-1; else low= mid+1;
-       }
-       return nil;
-}
-
-static expression_t *ack_get_C_expression(int *pn)
-/* Read a "C-like" expression.  Note that we don't worry about precedence,
- * the expression is printed later like it is read.  If the target language
- * does not have all the operators (like ~) then this has to be repaired by
- * changing the source file.  (No problem, you still have one source file
- * to maintain, not two.)
- */
-{
-       expression_t *e, *a1, *a2;
-       token_t *t;
-
-       if ((t= get_token(*pn))->symbol == '[') {
-               /* [ expr ]: grouping. */
-               (*pn)++;
-               if ((a1= ack_get_C_expression(pn)) == nil) return nil;
-               if (get_token(*pn)->symbol != ']') {
-                       parse_err(1, t, "missing ]\n");
-                       del_expr(a1);
-                       return nil;
-               }
-               (*pn)++;
-               e= new_expr();
-               e->operator= '[';
-               e->middle= a1;
-       } else
-       if (t->type == T_WORD || t->type == T_STRING) {
-               /* Label, number, or string. */
-               e= new_expr();
-               e->operator= t->type == T_WORD ? 'W' : 'S';
-               e->name= allocate(nil, (t->len+1) * sizeof(e->name[0]));
-               memcpy(e->name, t->name, t->len+1);
-               e->len= t->len;
-               (*pn)++;
-       } else
-       if (t->symbol == '+' || t->symbol == '-' || t->symbol == '~') {
-               /* Unary operator. */
-               (*pn)++;
-               if ((a1= ack_get_C_expression(pn)) == nil) return nil;
-               e= new_expr();
-               e->operator= t->symbol;
-               e->middle= a1;
-       } else {
-               parse_err(1, t, "expression syntax error\n");
-               return nil;
-       }
-
-       switch ((t= get_token(*pn))->symbol) {
-       case '+':
-       case '-':
-       case '*':
-       case '/':
-       case '%':
-       case '&':
-       case '|':
-       case '^':
-       case S_LEFTSHIFT:
-       case S_RIGHTSHIFT:
-               (*pn)++;
-               a1= e;
-               if ((a2= ack_get_C_expression(pn)) == nil) {
-                       del_expr(a1);
-                       return nil;
-               }
-               e= new_expr();
-               e->operator= t->symbol;
-               e->left= a1;
-               e->right= a2;
-       }
-       return e;
-}
-
-static expression_t *ack_get_operand(int *pn, int deref)
-/* Get something like: (memory), offset(base)(index*scale), or simpler. */
-{
-       expression_t *e, *offset, *base, *index;
-       token_t *t;
-       int c;
-
-       /* Is it (memory)? */
-       if (get_token(*pn)->symbol == '('
-               && ((t= get_token(*pn + 1))->type != T_WORD
-                       || !isregister(t->name))
-       ) {
-               /* A memory dereference. */
-               (*pn)++;
-               if ((offset= ack_get_C_expression(pn)) == nil) return nil;
-               if (get_token(*pn)->symbol != ')') {
-                       parse_err(1, t, "operand syntax error\n");
-                       del_expr(offset);
-                       return nil;
-               }
-               (*pn)++;
-               e= new_expr();
-               e->operator= '(';
-               e->middle= offset;
-               return e;
-       }
-
-       /* #constant? */
-       if (dialect == NCC && deref
-                       && ((c= get_token(*pn)->symbol) == '#' || c == '*')) {
-               /* NCC: mov ax,#constant  ->  ACK: mov ax,constant */
-               (*pn)++;
-               return ack_get_C_expression(pn);
-       }
-
-       /* @address? */
-       if (dialect == NCC && get_token(*pn)->symbol == '@') {
-               /* NCC: jmp @address  ->  ACK: jmp (address) */
-               (*pn)++;
-               if ((offset= ack_get_operand(pn, deref)) == nil) return nil;
-               e= new_expr();
-               e->operator= '(';
-               e->middle= offset;
-               return e;
-       }
-
-       /* Offset? */
-       if (get_token(*pn)->symbol != '(') {
-               /* There is an offset. */
-               if ((offset= ack_get_C_expression(pn)) == nil) return nil;
-       } else {
-               /* No offset. */
-               offset= nil;
-       }
-
-       /* (base)? */
-       if (get_token(*pn)->symbol == '('
-               && (t= get_token(*pn + 1))->type == T_WORD
-               && isregister(t->name)
-               && get_token(*pn + 2)->symbol == ')'
-       ) {
-               /* A base register expression. */
-               base= new_expr();
-               base->operator= 'B';
-               base->name= copystr(t->name);
-               (*pn)+= 3;
-       } else {
-               /* No base register expression. */
-               base= nil;
-       }
-
-       /* (index*scale)? */
-       if (get_token(*pn)->symbol == '(') {
-               /* An index most likely. */
-               token_t *m= nil;
-
-               if (!(          /* This must be true: */
-                       (t= get_token(*pn + 1))->type == T_WORD
-                       && isregister(t->name)
-                       && (get_token(*pn + 2)->symbol == ')' || (
-                               get_token(*pn + 2)->symbol == '*'
-                               && (m= get_token(*pn + 3))->type == T_WORD
-                               && strchr("1248", m->name[0]) != nil
-                               && m->name[1] == 0
-                               && get_token(*pn + 4)->symbol == ')'
-                       ))
-               )) {
-                       /* Alas it isn't */
-                       parse_err(1, t, "operand syntax error\n");
-                       del_expr(offset);
-                       del_expr(base);
-                       return nil;
-               }
-               /* Found an index. */
-               index= new_expr();
-               index->operator= m == nil ? '1' : m->name[0];
-               index->name= copystr(t->name);
-               (*pn)+= (m == nil ? 3 : 5);
-       } else {
-               /* No index. */
-               index= nil;
-       }
-
-       if (dialect == NCC && deref && base == nil && index == nil
-               && !(offset != nil && offset->operator == 'W'
-                                       && isregister(offset->name))
-       ) {
-               /* NCC: mov ax,thing  ->  ACK mov ax,(thing) */
-               e= new_expr();
-               e->operator= '(';
-               e->middle= offset;
-               return e;
-       }
-
-       if (base == nil && index == nil) {
-               /* Return a lone offset as is. */
-               e= offset;
-       } else {
-               e= new_expr();
-               e->operator= 'O';
-               e->left= offset;
-               e->middle= base;
-               e->right= index;
-       }
-       return e;
-}
-
-static expression_t *ack_get_oplist(int *pn, int deref)
-/* Get a comma (or colon for jmpf and callf) separated list of instruction
- * operands.
- */
-{
-       expression_t *e, *o1, *o2;
-       token_t *t;
-
-       if ((e= ack_get_operand(pn, deref)) == nil) return nil;
-
-       if ((t= get_token(*pn))->symbol == ',' || t->symbol == ':') {
-               o1= e;
-               (*pn)++;
-               if ((o2= ack_get_oplist(pn, deref)) == nil) {
-                       del_expr(o1);
-                       return nil;
-               }
-               e= new_expr();
-               e->operator= ',';
-               e->left= o1;
-               e->right= o2;
-       }
-       return e;
-}
-
-static asm86_t *ack_get_statement(void)
-/* Get a pseudo op or machine instruction with arguments. */
-{
-       token_t *t= get_token(0);
-       asm86_t *a;
-       mnemonic_t *m;
-       int n;
-       int prefix_seen;
-       int oaz_prefix;
-       int deref;
-
-       assert(t->type == T_WORD);
-
-       if (strcmp(t->name, ".sect") == 0) {
-               /* .sect .text etc.  Accept only four segment names. */
-               skip_token(1);
-               t= get_token(0);
-               if (t->type != T_WORD || (
-                       strcmp(t->name, ".text") != 0
-                       && strcmp(t->name, ".rom") != 0
-                       && strcmp(t->name, ".data") != 0
-                       && strcmp(t->name, ".bss") != 0
-                       && strcmp(t->name, ".end") != 0
-               )) {
-                       parse_err(1, t, "weird section name to .sect\n");
-                       return nil;
-               }
-       }
-       a= new_asm86();
-
-       /* Process instruction prefixes. */
-       oaz_prefix= 0;
-       for (prefix_seen= 0;; prefix_seen= 1) {
-               if (strcmp(t->name, "o16") == 0) {
-                       if (use16()) {
-                               parse_err(1, t, "o16 in an 8086 section\n");
-                       }
-                       oaz_prefix|= OPZ;
-               } else
-               if (strcmp(t->name, "o32") == 0) {
-                       if (use32()) {
-                               parse_err(1, t, "o32 in an 80386 section\n");
-                       }
-                       oaz_prefix|= OPZ;
-               } else
-               if (strcmp(t->name, "a16") == 0) {
-                       if (use16()) {
-                               parse_err(1, t, "a16 in an 8086 section\n");
-                       }
-                       oaz_prefix|= ADZ;
-               } else
-               if (strcmp(t->name, "a32") == 0) {
-                       if (use32()) {
-                               parse_err(1, t, "a32 in an 80386 section\n");
-                       }
-                       oaz_prefix|= ADZ;
-               } else
-               if (strcmp(t->name, "rep") == 0
-                       || strcmp(t->name, "repe") == 0
-                       || strcmp(t->name, "repne") == 0
-                       || strcmp(t->name, "repz") == 0
-                       || strcmp(t->name, "repnz") == 0
-               ) {
-                       if (a->rep != ONCE) {
-                               parse_err(1, t,
-                                       "can't have more than one rep\n");
-                       }
-                       switch (t->name[3]) {
-                       case 0:         a->rep= REP;    break;
-                       case 'e':
-                       case 'z':       a->rep= REPE;   break;
-                       case 'n':       a->rep= REPNE;  break;
-                       }
-               } else
-               if (strchr("cdefgs", t->name[0]) != nil
-                                       && strcmp(t->name+1, "seg") == 0) {
-                       if (a->seg != DEFSEG) {
-                               parse_err(1, t,
-                               "can't have more than one segment prefix\n");
-                       }
-                       switch (t->name[0]) {
-                       case 'c':       a->seg= CSEG;   break;
-                       case 'd':       a->seg= DSEG;   break;
-                       case 'e':       a->seg= ESEG;   break;
-                       case 'f':       a->seg= FSEG;   break;
-                       case 'g':       a->seg= GSEG;   break;
-                       case 's':       a->seg= SSEG;   break;
-                       }
-               } else
-               if (!prefix_seen) {
-                       /* No prefix here, get out! */
-                       break;
-               } else {
-                       /* No more prefixes, next must be an instruction. */
-                       if (t->type != T_WORD
-                               || (m= search_mnem(t->name)) == nil
-                               || m->optype == PSEUDO
-                       ) {
-                               parse_err(1, t,
-               "machine instruction expected after instruction prefix\n");
-                               del_asm86(a);
-                               return nil;
-                       }
-                       if (oaz_prefix != 0 && m->optype != JUMP
-                                               && m->optype != WORD) {
-                               parse_err(1, t,
-                       "'%s' can't have an operand size prefix\n", m->name);
-                       }
-                       break;
-               }
-
-               /* Skip the prefix and extra newlines. */
-               do {
-                       skip_token(1);
-               } while ((t= get_token(0))->symbol == ';');
-       }
-
-       /* All the readahead being done upsets the line counter. */
-       a->line= t->line;
-
-       /* Read a machine instruction or pseudo op. */
-       if ((m= search_mnem(t->name)) == nil) {
-               parse_err(1, t, "unknown instruction '%s'\n", t->name);
-               del_asm86(a);
-               return nil;
-       }
-       a->opcode= m->opcode;
-       a->optype= m->optype;
-       a->oaz= oaz_prefix;
-
-       switch (a->opcode) {
-       case IN:
-       case OUT:
-       case INT:
-               deref= 0;
-               break;
-       default:
-               deref= (a->optype >= BYTE);
-       }
-       n= 1;
-       if (get_token(1)->symbol != ';'
-                       && (a->args= ack_get_oplist(&n, deref)) == nil) {
-               del_asm86(a);
-               return nil;
-       }
-       if (get_token(n)->symbol != ';') {
-               parse_err(1, t, "garbage at end of instruction\n");
-               del_asm86(a);
-               return nil;
-       }
-       switch (a->opcode) {
-       case DOT_ALIGN:
-               /* Restrict .align to have a single numeric argument, some
-                * assemblers think of the argument as a power of two, so
-                * we need to be able to change the value.
-                */
-               if (a->args == nil || a->args->operator != 'W'
-                                       || !isanumber(a->args->name)) {
-                       parse_err(1, t,
-                         ".align is restricted to one numeric argument\n");
-                       del_asm86(a);
-                       return nil;
-               }
-               break;
-       case JMPF:
-       case CALLF:
-               /* NCC jmpf off,seg  ->  ACK jmpf seg:off */
-               if (dialect == NCC && a->args != nil
-                                               && a->args->operator == ',') {
-                       expression_t *t;
-
-                       t= a->args->left;
-                       a->args->left= a->args->right;
-                       a->args->right= t;
-                       break;
-               }
-               /*FALL THROUGH*/
-       case JMP:
-       case CALL:
-               /* NCC jmp @(reg)  ->  ACK jmp (reg) */
-               if (dialect == NCC && a->args != nil && (
-                       (a->args->operator == '('
-                               && a->args->middle != nil
-                               && a->args->middle->operator == 'O')
-                       || (a->args->operator == 'O'
-                               && a->args->left == nil
-                               && a->args->middle != nil
-                               && a->args->right == nil)
-               )) {
-                       expression_t *t;
-
-                       t= a->args;
-                       a->args= a->args->middle;
-                       t->middle= nil;
-                       del_expr(t);
-                       if (a->args->operator == 'B') a->args->operator= 'W';
-               }
-               break;
-       default:;
-       }
-       skip_token(n+1);
-       return a;
-}
-
-asm86_t *ack_get_instruction(void)
-{
-       asm86_t *a= nil;
-       expression_t *e;
-       token_t *t;
-
-       while ((t= get_token(0))->symbol == ';')
-               skip_token(1);
-
-       if (t->type == T_EOF) return nil;
-
-       if (t->symbol == '#') {
-               /* Preprocessor line and file change. */
-
-               if ((t= get_token(1))->type != T_WORD || !isanumber(t->name)
-                       || get_token(2)->type != T_STRING
-               ) {
-                       parse_err(1, t, "file not preprocessed?\n");
-                       zap();
-               } else {
-                       set_file(get_token(2)->name,
-                               strtol(get_token(1)->name, nil, 0) - 1);
-
-                       /* GNU CPP adds extra cruft, simply zap the line. */
-                       zap();
-               }
-               a= ack_get_instruction();
-       } else
-       if (t->type == T_WORD && get_token(1)->symbol == ':') {
-               /* A label definition. */
-               a= new_asm86();
-               a->line= t->line;
-               a->opcode= DOT_LABEL;
-               a->optype= PSEUDO;
-               a->args= e= new_expr();
-               e->operator= ':';
-               e->name= copystr(t->name);
-               skip_token(2);
-       } else
-       if (t->type == T_WORD && get_token(1)->symbol == '=') {
-               int n= 2;
-
-               if ((e= ack_get_C_expression(&n)) == nil) {
-                       zap();
-                       a= ack_get_instruction();
-               } else
-               if (get_token(n)->symbol != ';') {
-                       parse_err(1, t, "garbage after assignment\n");
-                       zap();
-                       a= ack_get_instruction();
-               } else {
-                       a= new_asm86();
-                       a->line= t->line;
-                       a->opcode= DOT_EQU;
-                       a->optype= PSEUDO;
-                       a->args= new_expr();
-                       a->args->operator= '=';
-                       a->args->name= copystr(t->name);
-                       a->args->middle= e;
-                       skip_token(n+1);
-               }
-       } else
-       if (t->type == T_WORD) {
-               if ((a= ack_get_statement()) == nil) {
-                       zap();
-                       a= ack_get_instruction();
-               }
-       } else {
-               parse_err(1, t, "syntax error\n");
-               zap();
-               a= ack_get_instruction();
-       }
-       return a;
-}
-
-asm86_t *ncc_get_instruction(void)
-{
-       return ack_get_instruction();
-}
diff --git a/commands/asmconv/parse_bas.c b/commands/asmconv/parse_bas.c
deleted file mode 100644 (file)
index 3eacc89..0000000
+++ /dev/null
@@ -1,940 +0,0 @@
-/*     parse_bas.c - parse BCC AS assembly             Author: Kees J. Bot
- *                                                             13 Nov 1994
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-
-typedef struct mnemonic {      /* BAS mnemonics translation table. */
-       char            *name;
-       opcode_t        opcode;
-       optype_t        optype;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {                        /* This array is sorted. */
-       { ".align",     DOT_ALIGN,      PSEUDO },
-       { ".ascii",     DOT_ASCII,      PSEUDO },
-       { ".asciz",     DOT_ASCIZ,      PSEUDO },
-       { ".assert",    DOT_ASSERT,     PSEUDO },
-       { ".base",      DOT_BASE,       PSEUDO },
-       { ".blkb",      DOT_SPACE,      PSEUDO },
-       { ".bss",       DOT_BSS,        PSEUDO },
-       { ".byte",      DOT_DATA1,      PSEUDO },
-       { ".comm",      DOT_COMM,       PSEUDO },
-       { ".data",      DOT_DATA,       PSEUDO },
-       { ".define",    DOT_DEFINE,     PSEUDO },
-       { ".end",       DOT_END,        PSEUDO },
-       { ".even",      DOT_ALIGN,      PSEUDO },
-       { ".extern",    DOT_EXTERN,     PSEUDO },
-       { ".file",      DOT_FILE,       PSEUDO },
-       { ".globl",     DOT_DEFINE,     PSEUDO },
-       { ".lcomm",     DOT_LCOMM,      PSEUDO },
-       { ".line",      DOT_LINE,       PSEUDO },
-       { ".list",      DOT_LIST,       PSEUDO },
-       { ".long",      DOT_DATA4,      PSEUDO },
-       { ".nolist",    DOT_NOLIST,     PSEUDO },
-       { ".rom",       DOT_ROM,        PSEUDO },
-       { ".space",     DOT_SPACE,      PSEUDO },
-       { ".symb",      DOT_SYMB,       PSEUDO },
-       { ".text",      DOT_TEXT,       PSEUDO },
-       { ".use16",     DOT_USE16,      PSEUDO },
-       { ".use32",     DOT_USE32,      PSEUDO },
-       { ".word",      DOT_DATA2,      PSEUDO },
-       { ".zerob",     DOT_SPACE,      PSEUDO },
-       { ".zerow",     DOT_SPACE,      PSEUDO },
-       { "aaa",        AAA,            WORD },
-       { "aad",        AAD,            WORD },
-       { "aam",        AAM,            WORD },
-       { "aas",        AAS,            WORD },
-       { "adc",        ADC,            WORD },
-       { "add",        ADD,            WORD },
-       { "and",        AND,            WORD },
-       { "arpl",       ARPL,           WORD },
-       { "bc",         JB,             JUMP },
-       { "beq",        JE,             JUMP },
-       { "bge",        JGE,            JUMP },
-       { "bgt",        JG,             JUMP },
-       { "bhi",        JA,             JUMP },
-       { "bhis",       JAE,            JUMP },
-       { "ble",        JLE,            JUMP },
-       { "blo",        JB,             JUMP },
-       { "blos",       JBE,            JUMP },
-       { "blt",        JL,             JUMP },
-       { "bnc",        JAE,            JUMP },
-       { "bne",        JNE,            JUMP },
-       { "bound",      BOUND,          WORD },
-       { "br",         JMP,            JUMP },
-       { "bsf",        BSF,            WORD },
-       { "bsr",        BSR,            WORD },
-       { "bswap",      BSWAP,          WORD },
-       { "bt",         BT,             WORD },
-       { "btc",        BTC,            WORD },
-       { "btr",        BTR,            WORD },
-       { "bts",        BTS,            WORD },
-       { "bz",         JE,             JUMP },
-       { "call",       CALL,           JUMP },
-       { "callf",      CALLF,          JUMP },
-       { "cbw",        CBW,            WORD },
-       { "cdq",        CWD,            WORD },
-       { "clc",        CLC,            WORD },
-       { "cld",        CLD,            WORD },
-       { "cli",        CLI,            WORD },
-       { "clts",       CLTS,           WORD },
-       { "cmc",        CMC,            WORD },
-       { "cmp",        CMP,            WORD },
-       { "cmps",       CMPS,           WORD },
-       { "cmpsb",      CMPS,           BYTE },
-       { "cmpxchg",    CMPXCHG,        WORD },
-       { "cwd",        CWD,            WORD },
-       { "cwde",       CBW,            WORD },
-       { "daa",        DAA,            WORD },
-       { "das",        DAS,            WORD },
-       { "dd",         DOT_DATA4,      PSEUDO },
-       { "dec",        DEC,            WORD },
-       { "div",        DIV,            WORD },
-       { "enter",      ENTER,          WORD },
-       { "export",     DOT_DEFINE,     PSEUDO },
-       { "f2xm1",      F2XM1,          WORD },
-       { "fabs",       FABS,           WORD },
-       { "fadd",       FADD,           WORD },
-       { "faddd",      FADDD,          WORD },
-       { "faddp",      FADDP,          WORD },
-       { "fadds",      FADDS,          WORD },
-       { "fbld",       FBLD,           WORD },
-       { "fbstp",      FBSTP,          WORD },
-       { "fchs",       FCHS,           WORD },
-       { "fclex",      FCLEX,          WORD },
-       { "fcomd",      FCOMD,          WORD },
-       { "fcompd",     FCOMPD,         WORD },
-       { "fcompp",     FCOMPP,         WORD },
-       { "fcomps",     FCOMPS,         WORD },
-       { "fcoms",      FCOMS,          WORD },
-       { "fcos",       FCOS,           WORD },
-       { "fdecstp",    FDECSTP,        WORD },
-       { "fdivd",      FDIVD,          WORD },
-       { "fdivp",      FDIVP,          WORD },
-       { "fdivrd",     FDIVRD,         WORD },
-       { "fdivrp",     FDIVRP,         WORD },
-       { "fdivrs",     FDIVRS,         WORD },
-       { "fdivs",      FDIVS,          WORD },
-       { "ffree",      FFREE,          WORD },
-       { "fiaddl",     FIADDL,         WORD },
-       { "fiadds",     FIADDS,         WORD },
-       { "ficom",      FICOM,          WORD },
-       { "ficomp",     FICOMP,         WORD },
-       { "fidivl",     FIDIVL,         WORD },
-       { "fidivrl",    FIDIVRL,        WORD },
-       { "fidivrs",    FIDIVRS,        WORD },
-       { "fidivs",     FIDIVS,         WORD },
-       { "fildl",      FILDL,          WORD },
-       { "fildq",      FILDQ,          WORD },
-       { "filds",      FILDS,          WORD },
-       { "fimull",     FIMULL,         WORD },
-       { "fimuls",     FIMULS,         WORD },
-       { "fincstp",    FINCSTP,        WORD },
-       { "finit",      FINIT,          WORD },
-       { "fistl",      FISTL,          WORD },
-       { "fistp",      FISTP,          WORD },
-       { "fists",      FISTS,          WORD },
-       { "fisubl",     FISUBL,         WORD },
-       { "fisubrl",    FISUBRL,        WORD },
-       { "fisubrs",    FISUBRS,        WORD },
-       { "fisubs",     FISUBS,         WORD },
-       { "fld1",       FLD1,           WORD },
-       { "fldcw",      FLDCW,          WORD },
-       { "fldd",       FLDD,           WORD },
-       { "fldenv",     FLDENV,         WORD },
-       { "fldl2e",     FLDL2E,         WORD },
-       { "fldl2t",     FLDL2T,         WORD },
-       { "fldlg2",     FLDLG2,         WORD },
-       { "fldln2",     FLDLN2,         WORD },
-       { "fldpi",      FLDPI,          WORD },
-       { "flds",       FLDS,           WORD },
-       { "fldx",       FLDX,           WORD },
-       { "fldz",       FLDZ,           WORD },
-       { "fmuld",      FMULD,          WORD },
-       { "fmulp",      FMULP,          WORD },
-       { "fmuls",      FMULS,          WORD },
-       { "fnop",       FNOP,           WORD },
-       { "fpatan",     FPATAN,         WORD },
-       { "fprem",      FPREM,          WORD },
-       { "fprem1",     FPREM1,         WORD },
-       { "fptan",      FPTAN,          WORD },
-       { "frndint",    FRNDINT,        WORD },
-       { "frstor",     FRSTOR,         WORD },
-       { "fsave",      FSAVE,          WORD },
-       { "fscale",     FSCALE,         WORD },
-       { "fsin",       FSIN,           WORD },
-       { "fsincos",    FSINCOS,        WORD },
-       { "fsqrt",      FSQRT,          WORD },
-       { "fstcw",      FSTCW,          WORD },
-       { "fstd",       FSTD,           WORD },
-       { "fstenv",     FSTENV,         WORD },
-       { "fstpd",      FSTPD,          WORD },
-       { "fstps",      FSTPS,          WORD },
-       { "fstpx",      FSTPX,          WORD },
-       { "fsts",       FSTS,           WORD },
-       { "fstsw",      FSTSW,          WORD },
-       { "fsubd",      FSUBD,          WORD },
-       { "fsubp",      FSUBP,          WORD },
-       { "fsubpr",     FSUBPR,         WORD },
-       { "fsubrd",     FSUBRD,         WORD },
-       { "fsubrs",     FSUBRS,         WORD },
-       { "fsubs",      FSUBS,          WORD },
-       { "ftst",       FTST,           WORD },
-       { "fucom",      FUCOM,          WORD },
-       { "fucomp",     FUCOMP,         WORD },
-       { "fucompp",    FUCOMPP,        WORD },
-       { "fxam",       FXAM,           WORD },
-       { "fxch",       FXCH,           WORD },
-       { "fxtract",    FXTRACT,        WORD },
-       { "fyl2x",      FYL2X,          WORD },
-       { "fyl2xp1",    FYL2XP1,        WORD },
-       { "hlt",        HLT,            WORD },
-       { "idiv",       IDIV,           WORD },
-       { "imul",       IMUL,           WORD },
-       { "in",         IN,             WORD },
-       { "inb",        IN,             BYTE },
-       { "inc",        INC,            WORD },
-       { "ins",        INS,            WORD },
-       { "insb",       INS,            BYTE },
-       { "int",        INT,            WORD },
-       { "into",       INTO,           JUMP },
-       { "invd",       INVD,           WORD },
-       { "invlpg",     INVLPG,         WORD },
-       { "iret",       IRET,           JUMP },
-       { "iretd",      IRETD,          JUMP },
-       { "j",          JMP,            JUMP },
-       { "ja",         JA,             JUMP },
-       { "jae",        JAE,            JUMP },
-       { "jb",         JB,             JUMP },
-       { "jbe",        JBE,            JUMP },
-       { "jc",         JB,             JUMP },
-       { "jcxz",       JCXZ,           JUMP },
-       { "je",         JE,             JUMP },
-       { "jecxz",      JCXZ,           JUMP },
-       { "jeq",        JE,             JUMP },
-       { "jg",         JG,             JUMP },
-       { "jge",        JGE,            JUMP },
-       { "jgt",        JG,             JUMP },
-       { "jhi",        JA,             JUMP },
-       { "jhis",       JAE,            JUMP },
-       { "jl",         JL,             JUMP },
-       { "jle",        JLE,            JUMP },
-       { "jlo",        JB,             JUMP },
-       { "jlos",       JBE,            JUMP },
-       { "jlt",        JL,             JUMP },
-       { "jmp",        JMP,            JUMP },
-       { "jmpf",       JMPF,           JUMP },
-       { "jna",        JBE,            JUMP },
-       { "jnae",       JB,             JUMP },
-       { "jnb",        JAE,            JUMP },
-       { "jnbe",       JA,             JUMP },
-       { "jnc",        JAE,            JUMP },
-       { "jne",        JNE,            JUMP },
-       { "jng",        JLE,            JUMP },
-       { "jnge",       JL,             JUMP },
-       { "jnl",        JGE,            JUMP },
-       { "jnle",       JG,             JUMP },
-       { "jno",        JNO,            JUMP },
-       { "jnp",        JNP,            JUMP },
-       { "jns",        JNS,            JUMP },
-       { "jnz",        JNE,            JUMP },
-       { "jo",         JO,             JUMP },
-       { "jp",         JP,             JUMP },
-       { "js",         JS,             JUMP },
-       { "jz",         JE,             JUMP },
-       { "lahf",       LAHF,           WORD },
-       { "lar",        LAR,            WORD },
-       { "lds",        LDS,            WORD },
-       { "lea",        LEA,            WORD },
-       { "leave",      LEAVE,          WORD },
-       { "les",        LES,            WORD },
-       { "lfs",        LFS,            WORD },
-       { "lgdt",       LGDT,           WORD },
-       { "lgs",        LGS,            WORD },
-       { "lidt",       LIDT,           WORD },
-       { "lldt",       LLDT,           WORD },
-       { "lmsw",       LMSW,           WORD },
-       { "lock",       LOCK,           WORD },
-       { "lods",       LODS,           WORD },
-       { "lodsb",      LODS,           BYTE },
-       { "loop",       LOOP,           JUMP },
-       { "loope",      LOOPE,          JUMP },
-       { "loopne",     LOOPNE,         JUMP },
-       { "loopnz",     LOOPNE,         JUMP },
-       { "loopz",      LOOPE,          JUMP },
-       { "lsl",        LSL,            WORD },
-       { "lss",        LSS,            WORD },
-       { "ltr",        LTR,            WORD },
-       { "mov",        MOV,            WORD },
-       { "movs",       MOVS,           WORD },
-       { "movsb",      MOVS,           BYTE },
-       { "movsx",      MOVSX,          WORD },
-       { "movzx",      MOVZX,          WORD },
-       { "mul",        MUL,            WORD },
-       { "neg",        NEG,            WORD },
-       { "nop",        NOP,            WORD },
-       { "not",        NOT,            WORD },
-       { "or",         OR,             WORD },
-       { "out",        OUT,            WORD },
-       { "outb",       OUT,            BYTE },
-       { "outs",       OUTS,           WORD },
-       { "outsb",      OUTS,           BYTE },
-       { "pop",        POP,            WORD },
-       { "popa",       POPA,           WORD },
-       { "popad",      POPA,           WORD },
-       { "popf",       POPF,           WORD },
-       { "popfd",      POPF,           WORD },
-       { "push",       PUSH,           WORD },
-       { "pusha",      PUSHA,          WORD },
-       { "pushad",     PUSHA,          WORD },
-       { "pushf",      PUSHF,          WORD },
-       { "pushfd",     PUSHF,          WORD },
-       { "rcl",        RCL,            WORD },
-       { "rcr",        RCR,            WORD },
-       { "ret",        RET,            JUMP },
-       { "retf",       RETF,           JUMP },
-       { "rol",        ROL,            WORD },
-       { "ror",        ROR,            WORD },
-       { "sahf",       SAHF,           WORD },
-       { "sal",        SAL,            WORD },
-       { "sar",        SAR,            WORD },
-       { "sbb",        SBB,            WORD },
-       { "scas",       SCAS,           WORD },
-       { "seta",       SETA,           BYTE },
-       { "setae",      SETAE,          BYTE },
-       { "setb",       SETB,           BYTE },
-       { "setbe",      SETBE,          BYTE },
-       { "sete",       SETE,           BYTE },
-       { "setg",       SETG,           BYTE },
-       { "setge",      SETGE,          BYTE },
-       { "setl",       SETL,           BYTE },
-       { "setna",      SETBE,          BYTE },
-       { "setnae",     SETB,           BYTE },
-       { "setnb",      SETAE,          BYTE },
-       { "setnbe",     SETA,           BYTE },
-       { "setne",      SETNE,          BYTE },
-       { "setng",      SETLE,          BYTE },
-       { "setnge",     SETL,           BYTE },
-       { "setnl",      SETGE,          BYTE },
-       { "setnle",     SETG,           BYTE },
-       { "setno",      SETNO,          BYTE },
-       { "setnp",      SETNP,          BYTE },
-       { "setns",      SETNS,          BYTE },
-       { "seto",       SETO,           BYTE },
-       { "setp",       SETP,           BYTE },
-       { "sets",       SETS,           BYTE },
-       { "setz",       SETE,           BYTE },
-       { "sgdt",       SGDT,           WORD },
-       { "shl",        SHL,            WORD },
-       { "shld",       SHLD,           WORD },
-       { "shr",        SHR,            WORD },
-       { "shrd",       SHRD,           WORD },
-       { "sidt",       SIDT,           WORD },
-       { "sldt",       SLDT,           WORD },
-       { "smsw",       SMSW,           WORD },
-       { "stc",        STC,            WORD },
-       { "std",        STD,            WORD },
-       { "sti",        STI,            WORD },
-       { "stos",       STOS,           WORD },
-       { "stosb",      STOS,           BYTE },
-       { "str",        STR,            WORD },
-       { "sub",        SUB,            WORD },
-       { "test",       TEST,           WORD },
-       { "verr",       VERR,           WORD },
-       { "verw",       VERW,           WORD },
-       { "wait",       WAIT,           WORD },
-       { "wbinvd",     WBINVD,         WORD },
-       { "xadd",       XADD,           WORD },
-       { "xchg",       XCHG,           WORD },
-       { "xlat",       XLAT,           WORD },
-       { "xor",        XOR,            WORD },
-};
-
-void bas_parse_init(char *file)
-/* Prepare parsing of an BAS assembly file. */
-{
-       tok_init(file, '!');
-}
-
-static void zap(void)
-/* An error, zap the rest of the line. */
-{
-       token_t *t;
-
-       while ((t= get_token(0))->type != T_EOF && t->symbol != ';')
-               skip_token(1);
-}
-
-static mnemonic_t *search_mnem(char *name)
-/* Binary search for a mnemonic.  (That's why the table is sorted.) */
-{
-       int low, mid, high;
-       int cmp;
-       mnemonic_t *m;
-
-       low= 0;
-       high= arraysize(mnemtab)-1;
-       while (low <= high) {
-               mid= (low + high) / 2;
-               m= &mnemtab[mid];
-
-               if ((cmp= strcmp(name, m->name)) == 0) return m;
-
-               if (cmp < 0) high= mid-1; else low= mid+1;
-       }
-       return nil;
-}
-
-static expression_t *bas_get_C_expression(int *pn)
-/* Read a "C-like" expression.  Note that we don't worry about precedence,
- * the expression is printed later like it is read.  If the target language
- * does not have all the operators (like ~) then this has to be repaired by
- * changing the source file.  (No problem, you still have one source file
- * to maintain, not two.)
- */
-{
-       expression_t *e, *a1, *a2;
-       token_t *t;
-
-       if ((t= get_token(*pn))->symbol == '(') {
-               /* ( expr ): grouping. */
-               (*pn)++;
-               if ((a1= bas_get_C_expression(pn)) == nil) return nil;
-               if (get_token(*pn)->symbol != ')') {
-                       parse_err(1, t, "missing )\n");
-                       del_expr(a1);
-                       return nil;
-               }
-               (*pn)++;
-               e= new_expr();
-               e->operator= '[';
-               e->middle= a1;
-       } else
-       if (t->type == T_WORD || t->type == T_STRING) {
-               /* Label, number, or string. */
-               e= new_expr();
-               e->operator= t->type == T_WORD ? 'W' : 'S';
-               e->name= allocate(nil, (t->len+1) * sizeof(e->name[0]));
-               memcpy(e->name, t->name, t->len+1);
-               e->len= t->len;
-               (*pn)++;
-       } else
-       if (t->symbol == '+' || t->symbol == '-' || t->symbol == '~') {
-               /* Unary operator. */
-               (*pn)++;
-               if ((a1= bas_get_C_expression(pn)) == nil) return nil;
-               e= new_expr();
-               e->operator= t->symbol;
-               e->middle= a1;
-       } else
-       if (t->symbol == '$' && get_token(*pn + 1)->type == T_WORD) {
-               /* A hexadecimal number. */
-               t= get_token(*pn + 1);
-               e= new_expr();
-               e->operator= 'W';
-               e->name= allocate(nil, (t->len+3) * sizeof(e->name[0]));
-               strcpy(e->name, "0x");
-               memcpy(e->name+2, t->name, t->len+1);
-               e->len= t->len+2;
-               (*pn)+= 2;
-       } else {
-               parse_err(1, t, "expression syntax error\n");
-               return nil;
-       }
-
-       switch ((t= get_token(*pn))->symbol) {
-       case '+':
-       case '-':
-       case '*':
-       case '/':
-       case '%':
-       case '&':
-       case '|':
-       case '^':
-       case S_LEFTSHIFT:
-       case S_RIGHTSHIFT:
-               (*pn)++;
-               a1= e;
-               if ((a2= bas_get_C_expression(pn)) == nil) {
-                       del_expr(a1);
-                       return nil;
-               }
-               e= new_expr();
-               e->operator= t->symbol;
-               e->left= a1;
-               e->right= a2;
-       }
-       return e;
-}
-
-/* We want to know the sizes of the first two operands. */
-static optype_t optypes[2];
-static int op_idx;
-
-static expression_t *bas_get_operand(int *pn)
-/* Get something like: [memory], offset[base+index*scale], or simpler. */
-{
-       expression_t *e, *offset, *base, *index;
-       token_t *t;
-       int c;
-       optype_t optype;
-
-       /* Prefixed by 'byte', 'word' or 'dword'? */
-       if ((t= get_token(*pn))->type == T_WORD && (
-               strcmp(t->name, "byte") == 0
-               || strcmp(t->name, "word") == 0
-               || strcmp(t->name, "dword") == 0)
-       ) {
-               switch (t->name[0]) {
-               case 'b':       optype= BYTE; break;
-               case 'w':       optype= use16() ? WORD : OWORD; break;
-               case 'd':       optype= use32() ? WORD : OWORD; break;
-               }
-               if (op_idx < arraysize(optypes)) optypes[op_idx++]= optype;
-               (*pn)++;
-
-               /* It may even be "byte ptr"... */
-               if ((t= get_token(*pn))->type == T_WORD
-                                       && strcmp(t->name, "ptr") == 0) {
-                       (*pn)++;
-               }
-       }
-
-       /* Is it [memory]? */
-       if (get_token(*pn)->symbol == '['
-               && ((t= get_token(*pn + 1))->type != T_WORD
-                       || !isregister(t->name))
-       ) {
-               /* A memory dereference. */
-               (*pn)++;
-               if ((offset= bas_get_C_expression(pn)) == nil) return nil;
-               if (get_token(*pn)->symbol != ']') {
-                       parse_err(1, t, "operand syntax error\n");
-                       del_expr(offset);
-                       return nil;
-               }
-               (*pn)++;
-               e= new_expr();
-               e->operator= '(';
-               e->middle= offset;
-               return e;
-       }
-
-       /* #something? *something? */
-       if ((c= get_token(*pn)->symbol) == '#' || c == '*') {
-               /* '#' and '*' are often used to introduce some constant. */
-               (*pn)++;
-       }
-
-       /* Offset? */
-       if (get_token(*pn)->symbol != '[') {
-               /* There is an offset. */
-               if ((offset= bas_get_C_expression(pn)) == nil) return nil;
-       } else {
-               /* No offset. */
-               offset= nil;
-       }
-
-       /* [base]? [base+? base-? */
-       c= 0;
-       if (get_token(*pn)->symbol == '['
-               && (t= get_token(*pn + 1))->type == T_WORD
-               && isregister(t->name)
-               && ((c= get_token(*pn + 2)->symbol) == ']' || c=='+' || c=='-')
-       ) {
-               /* A base register expression. */
-               base= new_expr();
-               base->operator= 'B';
-               base->name= copystr(t->name);
-               (*pn)+= c == ']' ? 3 : 2;
-       } else {
-               /* No base register expression. */
-               base= nil;
-       }
-
-       /* +offset]? -offset]? */
-       if (offset == nil
-               && (c == '+' || c == '-')
-               && (t= get_token(*pn + 1))->type == T_WORD
-               && !isregister(t->name)
-       ) {
-               (*pn)++;
-               if ((offset= bas_get_C_expression(pn)) == nil) return nil;
-               if (get_token(*pn)->symbol != ']') {
-                       parse_err(1, t, "operand syntax error\n");
-                       del_expr(offset);
-                       del_expr(base);
-                       return nil;
-               }
-               (*pn)++;
-               c= 0;
-       }
-
-       /* [index*scale]? +index*scale]? */
-       if (c == '+' || get_token(*pn)->symbol == '[') {
-               /* An index most likely. */
-               token_t *m= nil;
-
-               if (!(          /* This must be true: */
-                       (t= get_token(*pn + 1))->type == T_WORD
-                       && isregister(t->name)
-                       && (get_token(*pn + 2)->symbol == ']' || (
-                               get_token(*pn + 2)->symbol == '*'
-                               && (m= get_token(*pn + 3))->type == T_WORD
-                               && strchr("1248", m->name[0]) != nil
-                               && m->name[1] == 0
-                               && get_token(*pn + 4)->symbol == ']'
-                       ))
-               )) {
-                       /* Alas it isn't */
-                       parse_err(1, t, "operand syntax error\n");
-                       del_expr(offset);
-                       del_expr(base);
-                       return nil;
-               }
-               /* Found an index. */
-               index= new_expr();
-               index->operator= m == nil ? '1' : m->name[0];
-               index->name= copystr(t->name);
-               (*pn)+= (m == nil ? 3 : 5);
-       } else {
-               /* No index. */
-               index= nil;
-       }
-
-       if (base == nil && index == nil) {
-               /* Return a lone offset as is. */
-               e= offset;
-
-               /* Lone registers tell operand size. */
-               if (offset->operator == 'W' && isregister(offset->name)) {
-                       switch (isregister(offset->name)) {
-                       case 1: optype= BYTE; break;
-                       case 2: optype= use16() ? WORD : OWORD; break;
-                       case 4: optype= use32() ? WORD : OWORD; break;
-                       }
-                       if (op_idx < arraysize(optypes))
-                               optypes[op_idx++]= optype;
-               }
-       } else {
-               e= new_expr();
-               e->operator= 'O';
-               e->left= offset;
-               e->middle= base;
-               e->right= index;
-       }
-       return e;
-}
-
-static expression_t *bas_get_oplist(int *pn)
-/* Get a comma (or colon for jmpf and callf) separated list of instruction
- * operands.
- */
-{
-       expression_t *e, *o1, *o2;
-       token_t *t;
-
-       if ((e= bas_get_operand(pn)) == nil) return nil;
-
-       if ((t= get_token(*pn))->symbol == ',' || t->symbol == ':') {
-               o1= e;
-               (*pn)++;
-               if ((o2= bas_get_oplist(pn)) == nil) {
-                       del_expr(o1);
-                       return nil;
-               }
-               e= new_expr();
-               e->operator= ',';
-               e->left= o1;
-               e->right= o2;
-       }
-       return e;
-}
-
-static asm86_t *bas_get_statement(void)
-/* Get a pseudo op or machine instruction with arguments. */
-{
-       token_t *t= get_token(0);
-       asm86_t *a;
-       mnemonic_t *m;
-       int n;
-       int prefix_seen;
-
-
-       assert(t->type == T_WORD);
-
-       if (strcmp(t->name, ".sect") == 0) {
-               /* .sect .text etc.  Accept only four segment names. */
-               skip_token(1);
-               t= get_token(0);
-               if (t->type != T_WORD || (
-                       strcmp(t->name, ".text") != 0
-                       && strcmp(t->name, ".rom") != 0
-                       && strcmp(t->name, ".data") != 0
-                       && strcmp(t->name, ".bss") != 0
-                       && strcmp(t->name, ".end") != 0
-               )) {
-                       parse_err(1, t, "weird section name to .sect\n");
-                       return nil;
-               }
-       }
-       a= new_asm86();
-
-       /* Process instruction prefixes. */
-       for (prefix_seen= 0;; prefix_seen= 1) {
-               if (strcmp(t->name, "rep") == 0
-                       || strcmp(t->name, "repe") == 0
-                       || strcmp(t->name, "repne") == 0
-                       || strcmp(t->name, "repz") == 0
-                       || strcmp(t->name, "repnz") == 0
-               ) {
-                       if (a->rep != ONCE) {
-                               parse_err(1, t,
-                                       "can't have more than one rep\n");
-                       }
-                       switch (t->name[3]) {
-                       case 0:         a->rep= REP;    break;
-                       case 'e':
-                       case 'z':       a->rep= REPE;   break;
-                       case 'n':       a->rep= REPNE;  break;
-                       }
-               } else
-               if (strcmp(t->name, "seg") == 0
-                                       && get_token(1)->type == T_WORD) {
-                       if (a->seg != DEFSEG) {
-                               parse_err(1, t,
-                               "can't have more than one segment prefix\n");
-                       }
-                       switch (get_token(1)->name[0]) {
-                       case 'c':       a->seg= CSEG;   break;
-                       case 'd':       a->seg= DSEG;   break;
-                       case 'e':       a->seg= ESEG;   break;
-                       case 'f':       a->seg= FSEG;   break;
-                       case 'g':       a->seg= GSEG;   break;
-                       case 's':       a->seg= SSEG;   break;
-                       }
-                       skip_token(1);
-               } else
-               if (!prefix_seen) {
-                       /* No prefix here, get out! */
-                       break;
-               } else {
-                       /* No more prefixes, next must be an instruction. */
-                       if (t->type != T_WORD
-                               || (m= search_mnem(t->name)) == nil
-                               || m->optype == PSEUDO
-                       ) {
-                               parse_err(1, t,
-               "machine instruction expected after instruction prefix\n");
-                               del_asm86(a);
-                               return nil;
-                       }
-                       break;
-               }
-
-               /* Skip the prefix and extra newlines. */
-               do {
-                       skip_token(1);
-               } while ((t= get_token(0))->symbol == ';');
-       }
-
-       /* All the readahead being done upsets the line counter. */
-       a->line= t->line;
-
-       /* Read a machine instruction or pseudo op. */
-       if ((m= search_mnem(t->name)) == nil) {
-               parse_err(1, t, "unknown instruction '%s'\n", t->name);
-               del_asm86(a);
-               return nil;
-       }
-       a->opcode= m->opcode;
-       a->optype= m->optype;
-       if (a->opcode == CBW || a->opcode == CWD) {
-               a->optype= (strcmp(t->name, "cbw") == 0
-                   || strcmp(t->name, "cwd") == 0) == use16() ? WORD : OWORD;
-       }
-       for (op_idx= 0; op_idx < arraysize(optypes); op_idx++)
-               optypes[op_idx]= m->optype;
-       op_idx= 0;
-
-       n= 1;
-       if (get_token(1)->symbol != ';'
-                               && (a->args= bas_get_oplist(&n)) == nil) {
-               del_asm86(a);
-               return nil;
-       }
-
-       if (m->optype == WORD) {
-               /* Does one of the operands overide the optype? */
-               for (op_idx= 0; op_idx < arraysize(optypes); op_idx++) {
-                       if (optypes[op_idx] != m->optype)
-                               a->optype= optypes[op_idx];
-               }
-       }
-
-       if (get_token(n)->symbol != ';') {
-               parse_err(1, t, "garbage at end of instruction\n");
-               del_asm86(a);
-               return nil;
-       }
-       switch (a->opcode) {
-       case DOT_ALIGN:
-               /* Restrict .align to have a single numeric argument, some
-                * assemblers think of the argument as a power of two, so
-                * we need to be able to change the value.
-                */
-               if (strcmp(t->name, ".even") == 0 && a->args == nil) {
-                       /* .even becomes .align 2. */
-                       expression_t *e;
-                       a->args= e= new_expr();
-                       e->operator= 'W';
-                       e->name= copystr("2");
-                       e->len= 2;
-               }
-               if (a->args == nil || a->args->operator != 'W'
-                                       || !isanumber(a->args->name)) {
-                       parse_err(1, t,
-                         ".align is restricted to one numeric argument\n");
-                       del_asm86(a);
-                       return nil;
-               }
-               break;
-       case MOVSX:
-       case MOVZX:
-               /* Types of both operands tell the instruction type. */
-               a->optype= optypes[0];
-               if (optypes[1] == BYTE) {
-                       a->opcode= a->opcode == MOVSX ? MOVSXB : MOVZXB;
-               }
-               break;
-       case SAL:
-       case SAR:
-       case SHL:
-       case SHR:
-       case RCL:
-       case RCR:
-       case ROL:
-       case ROR:
-               /* Only the first operand tells the operand size. */
-               a->optype= optypes[0];
-               break;
-       default:;
-       }
-       skip_token(n+1);
-       return a;
-}
-
-asm86_t *bas_get_instruction(void)
-{
-       asm86_t *a= nil;
-       expression_t *e;
-       token_t *t;
-
-       while ((t= get_token(0))->symbol == ';')
-               skip_token(1);
-
-       if (t->type == T_EOF) return nil;
-
-       if (t->symbol == '#') {
-               /* Preprocessor line and file change. */
-
-               if ((t= get_token(1))->type != T_WORD || !isanumber(t->name)
-                       || get_token(2)->type != T_STRING
-               ) {
-                       parse_err(1, t, "file not preprocessed?\n");
-                       zap();
-               } else {
-                       set_file(get_token(2)->name,
-                               strtol(get_token(1)->name, nil, 0) - 1);
-
-                       /* GNU CPP adds extra cruft, simply zap the line. */
-                       zap();
-               }
-               a= bas_get_instruction();
-       } else
-       if (t->type == T_WORD && get_token(1)->symbol == ':') {
-               /* A label definition. */
-               a= new_asm86();
-               a->line= t->line;
-               a->opcode= DOT_LABEL;
-               a->optype= PSEUDO;
-               a->args= e= new_expr();
-               e->operator= ':';
-               e->name= copystr(t->name);
-               skip_token(2);
-       } else
-       if (t->type == T_WORD && get_token(1)->symbol == '=') {
-               int n= 2;
-
-               if ((e= bas_get_C_expression(&n)) == nil) {
-                       zap();
-                       a= bas_get_instruction();
-               } else
-               if (get_token(n)->symbol != ';') {
-                       parse_err(1, t, "garbage after assignment\n");
-                       zap();
-                       a= bas_get_instruction();
-               } else {
-                       a= new_asm86();
-                       a->line= t->line;
-                       a->opcode= DOT_EQU;
-                       a->optype= PSEUDO;
-                       a->args= new_expr();
-                       a->args->operator= '=';
-                       a->args->name= copystr(t->name);
-                       a->args->middle= e;
-                       skip_token(n+1);
-               }
-       } else
-       if (t->type == T_WORD && get_token(1)->type == T_WORD
-                               && strcmp(get_token(1)->name, "lcomm") == 0) {
-               /* Local common block definition. */
-               int n= 2;
-
-               if ((e= bas_get_C_expression(&n)) == nil) {
-                       zap();
-                       a= bas_get_instruction();
-               } else
-               if (get_token(n)->symbol != ';') {
-                       parse_err(1, t, "garbage after lcomm\n");
-                       zap();
-                       a= bas_get_instruction();
-               } else {
-                       a= new_asm86();
-                       a->line= t->line;
-                       a->opcode= DOT_LCOMM;
-                       a->optype= PSEUDO;
-                       a->args= new_expr();
-                       a->args->operator= ',';
-                       a->args->right= e;
-                       a->args->left= e= new_expr();
-                       e->operator= 'W';
-                       e->name= copystr(t->name);
-                       e->len= strlen(e->name)+1;
-                       skip_token(n+1);
-               }
-       } else
-       if (t->type == T_WORD) {
-               if ((a= bas_get_statement()) == nil) {
-                       zap();
-                       a= bas_get_instruction();
-               }
-       } else {
-               parse_err(1, t, "syntax error\n");
-               zap();
-               a= bas_get_instruction();
-       }
-       if (a->optype == OWORD) {
-               a->optype= WORD;
-               a->oaz|= OPZ;
-       }
-       return a;
-}
diff --git a/commands/asmconv/parse_gnu.c b/commands/asmconv/parse_gnu.c
deleted file mode 100644 (file)
index bac4a6f..0000000
+++ /dev/null
@@ -1,879 +0,0 @@
-/*     parse_ack.c - parse GNU assembly                Author: R.S. Veldema
- *                                                      <rveldema@cs.vu.nl>
- *                                                             26 Aug 1996
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-
-typedef struct mnemonic {      /* GNU as86 mnemonics translation table. */
-       char            *name;
-       opcode_t        opcode;
-       optype_t        optype;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {                        /* This array is sorted. */
-       { ".align",     DOT_ALIGN,      PSEUDO },
-       { ".ascii",     DOT_ASCII,      PSEUDO },
-       { ".asciz",     DOT_ASCIZ,      PSEUDO },
-       { ".assert",    DOT_ASSERT,     PSEUDO },
-       { ".base",      DOT_BASE,       PSEUDO },
-       { ".bss",       DOT_BSS,        PSEUDO },
-       { ".byte",      DOT_DATA1,      PSEUDO },
-       { ".comm",      DOT_COMM,       PSEUDO },
-       { ".data",      DOT_DATA,       PSEUDO },
-       { ".data1",     DOT_DATA1,      PSEUDO },
-       { ".data2",     DOT_DATA2,      PSEUDO },
-       { ".data4",     DOT_DATA4,      PSEUDO },
-       { ".end",       DOT_END,        PSEUDO },
-       { ".extern",    DOT_EXTERN,     PSEUDO },
-       { ".file",      DOT_FILE,       PSEUDO },
-       { ".globl",     DOT_DEFINE,     PSEUDO },
-       { ".lcomm",     DOT_LCOMM,      PSEUDO },
-       { ".line",      DOT_LINE,       PSEUDO },
-       { ".list",      DOT_LIST,       PSEUDO },
-       { ".long",      DOT_DATA4,      PSEUDO },
-       { ".nolist",    DOT_NOLIST,     PSEUDO },
-       { ".rom",       DOT_ROM,        PSEUDO },
-       { ".space",     DOT_SPACE,      PSEUDO },
-       { ".symb",      DOT_SYMB,       PSEUDO },
-       { ".text",      DOT_TEXT,       PSEUDO },
-       { ".word",      DOT_DATA2,      PSEUDO },
-       { "aaa",        AAA,            WORD },
-       { "aad",        AAD,            WORD },
-       { "aam",        AAM,            WORD },
-       { "aas",        AAS,            WORD },
-       { "adcb",       ADC,            BYTE },
-       { "adcl",       ADC,            WORD },
-       { "adcw",       ADC,            OWORD },
-       { "addb",       ADD,            BYTE },
-       { "addl",       ADD,            WORD },
-       { "addw",       ADD,            OWORD },
-       { "andb",       AND,            BYTE },
-       { "andl",       AND,            WORD },
-       { "andw",       AND,            OWORD },
-       { "arpl",       ARPL,           WORD },
-       { "bound",      BOUND,          WORD },
-       { "bsf",        BSF,            WORD },
-       { "bsr",        BSR,            WORD },
-       { "bswap",      BSWAP,          WORD },
-       { "btc",        BTC,            WORD },
-       { "btl",        BT,             WORD },
-       { "btr",        BTR,            WORD },
-       { "bts",        BTS,            WORD },
-       { "btw",        BT,             OWORD },
-       { "call",       CALL,           JUMP },
-       { "callf",      CALLF,          JUMP },
-       { "cbtw",       CBW,            OWORD },
-       { "cbw",        CBW,            WORD },
-       { "cdq",        CWD,            WORD },
-       { "clc",        CLC,            WORD },
-       { "cld",        CLD,            WORD },
-       { "cli",        CLI,            WORD },
-       { "cltd",       CWD,            WORD },
-       { "clts",       CLTS,           WORD },
-       { "cmc",        CMC,            WORD },
-       { "cmpb",       CMP,            BYTE },
-       { "cmpl",       CMP,            WORD },
-       { "cmps",       CMPS,           WORD },
-       { "cmpsb",      CMPS,           BYTE },
-       { "cmpw",       CMP,            OWORD },
-       { "cmpxchg",    CMPXCHG,        WORD },
-       { "cwd",        CWD,            WORD },
-       { "cwde",       CBW,            WORD },
-       { "cwtd",       CWD,            OWORD },
-       { "cwtl",       CBW,            WORD },
-       { "daa",        DAA,            WORD },
-       { "das",        DAS,            WORD },
-       { "decb",       DEC,            BYTE },
-       { "decl",       DEC,            WORD },
-       { "decw",       DEC,            OWORD },
-       { "divb",       DIV,            BYTE },
-       { "divl",       DIV,            WORD },
-       { "divw",       DIV,            OWORD },
-       { "enter",      ENTER,          WORD },
-       { "f2xm1",      F2XM1,          WORD },
-       { "fabs",       FABS,           WORD },
-       { "fadd",       FADD,           WORD },
-       { "faddd",      FADDD,          WORD },
-       { "faddp",      FADDP,          WORD },
-       { "fadds",      FADDS,          WORD },
-       { "fbld",       FBLD,           WORD },
-       { "fbstp",      FBSTP,          WORD },
-       { "fchs",       FCHS,           WORD },
-       { "fcomd",      FCOMD,          WORD },
-       { "fcompd",     FCOMPD,         WORD },
-       { "fcompp",     FCOMPP,         WORD },
-       { "fcomps",     FCOMPS,         WORD },
-       { "fcoms",      FCOMS,          WORD },
-       { "fcos",       FCOS,           WORD },
-       { "fdecstp",    FDECSTP,        WORD },
-       { "fdivd",      FDIVD,          WORD },
-       { "fdivp",      FDIVP,          WORD },
-       { "fdivrd",     FDIVRD,         WORD },
-       { "fdivrp",     FDIVRP,         WORD },
-       { "fdivrs",     FDIVRS,         WORD },
-       { "fdivs",      FDIVS,          WORD },
-       { "ffree",      FFREE,          WORD },
-       { "fiaddl",     FIADDL,         WORD },
-       { "fiadds",     FIADDS,         WORD },
-       { "ficom",      FICOM,          WORD },
-       { "ficomp",     FICOMP,         WORD },
-       { "fidivl",     FIDIVL,         WORD },
-       { "fidivrl",    FIDIVRL,        WORD },
-       { "fidivrs",    FIDIVRS,        WORD },
-       { "fidivs",     FIDIVS,         WORD },
-       { "fildl",      FILDL,          WORD },
-       { "fildq",      FILDQ,          WORD },
-       { "filds",      FILDS,          WORD },
-       { "fimull",     FIMULL,         WORD },
-       { "fimuls",     FIMULS,         WORD },
-       { "fincstp",    FINCSTP,        WORD },
-       { "fistl",      FISTL,          WORD },
-       { "fistp",      FISTP,          WORD },
-       { "fists",      FISTS,          WORD },
-       { "fisubl",     FISUBL,         WORD },
-       { "fisubrl",    FISUBRL,        WORD },
-       { "fisubrs",    FISUBRS,        WORD },
-       { "fisubs",     FISUBS,         WORD },
-       { "fld1",       FLD1,           WORD },
-       { "fldcw",      FLDCW,          WORD },
-       { "fldd",       FLDD,           WORD },
-       { "fldenv",     FLDENV,         WORD },
-       { "fldl2e",     FLDL2E,         WORD },
-       { "fldl2t",     FLDL2T,         WORD },
-       { "fldlg2",     FLDLG2,         WORD },
-       { "fldln2",     FLDLN2,         WORD },
-       { "fldpi",      FLDPI,          WORD },
-       { "flds",       FLDS,           WORD },
-       { "fldx",       FLDX,           WORD },
-       { "fldz",       FLDZ,           WORD },
-       { "fmuld",      FMULD,          WORD },
-       { "fmulp",      FMULP,          WORD },
-       { "fmuls",      FMULS,          WORD },
-       { "fnclex",     FCLEX,          WORD },
-       { "fninit",     FINIT,          WORD },
-       { "fnop",       FNOP,           WORD },
-       { "fnsave",     FSAVE,          WORD },
-       { "fnstcw",     FSTCW,          WORD },
-       { "fnstenv",    FSTENV,         WORD },
-       { "fpatan",     FPATAN,         WORD },
-       { "fprem",      FPREM,          WORD },
-       { "fprem1",     FPREM1,         WORD },
-       { "fptan",      FPTAN,          WORD },
-       { "frndint",    FRNDINT,        WORD },
-       { "frstor",     FRSTOR,         WORD },
-       { "fscale",     FSCALE,         WORD },
-       { "fsin",       FSIN,           WORD },
-       { "fsincos",    FSINCOS,        WORD },
-       { "fsqrt",      FSQRT,          WORD },
-       { "fstd",       FSTD,           WORD },
-       { "fstpd",      FSTPD,          WORD },
-       { "fstps",      FSTPS,          WORD },
-       { "fstpx",      FSTPX,          WORD },
-       { "fsts",       FSTS,           WORD },
-       { "fstsw",      FSTSW,          WORD },
-       { "fsubd",      FSUBD,          WORD },
-       { "fsubp",      FSUBP,          WORD },
-       { "fsubpr",     FSUBPR,         WORD },
-       { "fsubrd",     FSUBRD,         WORD },
-       { "fsubrs",     FSUBRS,         WORD },
-       { "fsubs",      FSUBS,          WORD },
-       { "ftst",       FTST,           WORD },
-       { "fucom",      FUCOM,          WORD },
-       { "fucomp",     FUCOMP,         WORD },
-       { "fucompp",    FUCOMPP,        WORD },
-       { "fxam",       FXAM,           WORD },
-       { "fxch",       FXCH,           WORD },
-       { "fxtract",    FXTRACT,        WORD },
-       { "fyl2x",      FYL2X,          WORD },
-       { "fyl2xp1",    FYL2XP1,        WORD },
-       { "hlt",        HLT,            WORD },
-       { "idivb",      IDIV,           BYTE },
-       { "idivl",      IDIV,           WORD },
-       { "idivw",      IDIV,           OWORD },
-       { "imulb",      IMUL,           BYTE },
-       { "imull",      IMUL,           WORD },
-       { "imulw",      IMUL,           OWORD },
-       { "inb",        IN,             BYTE },
-       { "incb",       INC,            BYTE },
-       { "incl",       INC,            WORD },
-       { "incw",       INC,            OWORD },
-       { "inl",        IN,             WORD },
-       { "insb",       INS,            BYTE },
-       { "insl",       INS,            WORD },
-       { "insw",       INS,            OWORD },
-       { "int",        INT,            WORD },
-       { "into",       INTO,           JUMP },
-       { "invd",       INVD,           WORD },
-       { "invlpg",     INVLPG,         WORD },
-       { "inw",        IN,             OWORD },
-       { "iret",       IRET,           JUMP },
-       { "iretd",      IRETD,          JUMP },
-       { "ja",         JA,             JUMP },
-       { "jae",        JAE,            JUMP },
-       { "jb",         JB,             JUMP },
-       { "jbe",        JBE,            JUMP },
-       { "jc",         JB,             JUMP },
-       { "jcxz",       JCXZ,           JUMP },
-       { "je",         JE,             JUMP },
-       { "jecxz",      JCXZ,           JUMP },
-       { "jg",         JG,             JUMP },
-       { "jge",        JGE,            JUMP },
-       { "jl",         JL,             JUMP },
-       { "jle",        JLE,            JUMP },
-       { "jmp",        JMP,            JUMP },
-       { "jmpf",       JMPF,           JUMP },
-       { "jna",        JBE,            JUMP },
-       { "jnae",       JB,             JUMP },
-       { "jnb",        JAE,            JUMP },
-       { "jnbe",       JA,             JUMP },
-       { "jnc",        JAE,            JUMP },
-       { "jne",        JNE,            JUMP },
-       { "jng",        JLE,            JUMP },
-       { "jnge",       JL,             JUMP },
-       { "jnl",        JGE,            JUMP },
-       { "jnle",       JG,             JUMP },
-       { "jno",        JNO,            JUMP },
-       { "jnp",        JNP,            JUMP },
-       { "jns",        JNS,            JUMP },
-       { "jnz",        JNE,            JUMP },
-       { "jo",         JO,             JUMP },
-       { "jp",         JP,             JUMP },
-       { "js",         JS,             JUMP },
-       { "jz",         JE,             JUMP },
-       { "lahf",       LAHF,           WORD },
-       { "lar",        LAR,            WORD },
-       { "lds",        LDS,            WORD },
-       { "leal",       LEA,            WORD },
-       { "leave",      LEAVE,          WORD },
-       { "leaw",       LEA,            OWORD },
-       { "les",        LES,            WORD },
-       { "lfs",        LFS,            WORD },
-       { "lgdt",       LGDT,           WORD },
-       { "lgs",        LGS,            WORD },
-       { "lidt",       LIDT,           WORD },
-       { "lldt",       LLDT,           WORD },
-       { "lmsw",       LMSW,           WORD },
-       { "lock",       LOCK,           WORD },
-       { "lods",       LODS,           WORD },
-       { "lodsb",      LODS,           BYTE },
-       { "loop",       LOOP,           JUMP },
-       { "loope",      LOOPE,          JUMP },
-       { "loopne",     LOOPNE,         JUMP },
-       { "loopnz",     LOOPNE,         JUMP },
-       { "loopz",      LOOPE,          JUMP },
-       { "lsl",        LSL,            WORD },
-       { "lss",        LSS,            WORD },
-       { "ltr",        LTR,            WORD },
-       { "movb",       MOV,            BYTE },
-       { "movl",       MOV,            WORD },
-       { "movsb",      MOVS,           BYTE },
-       { "movsbl",     MOVSXB,         WORD },
-       { "movsbw",     MOVSXB,         OWORD },
-       { "movsl",      MOVS,           WORD },
-       { "movsw",      MOVS,           OWORD },
-       { "movswl",     MOVSX,          WORD },
-       { "movw",       MOV,            OWORD },
-       { "movzbl",     MOVZXB,         WORD },
-       { "movzbw",     MOVZXB,         OWORD },
-       { "movzwl",     MOVZX,          WORD },
-       { "mulb",       MUL,            BYTE },
-       { "mull",       MUL,            WORD },
-       { "mulw",       MUL,            OWORD },
-       { "negb",       NEG,            BYTE },
-       { "negl",       NEG,            WORD },
-       { "negw",       NEG,            OWORD },
-       { "nop",        NOP,            WORD },
-       { "notb",       NOT,            BYTE },
-       { "notl",       NOT,            WORD },
-       { "notw",       NOT,            OWORD },
-       { "orb",        OR,             BYTE },
-       { "orl",        OR,             WORD },
-       { "orw",        OR,             OWORD },
-       { "outb",       OUT,            BYTE },
-       { "outl",       OUT,            WORD },
-       { "outsb",      OUTS,           BYTE },
-       { "outsl",      OUTS,           WORD },
-       { "outsw",      OUTS,           OWORD },
-       { "outw",       OUT,            OWORD },
-       { "pop",        POP,            WORD },
-       { "popa",       POPA,           WORD },
-       { "popad",      POPA,           WORD },
-       { "popf",       POPF,           WORD },
-       { "popl",       POP,            WORD },
-       { "push",       PUSH,           WORD },
-       { "pusha",      PUSHA,          WORD },
-       { "pushad",     PUSHA,          WORD },
-       { "pushf",      PUSHF,          WORD },
-       { "pushl",      PUSH,           WORD },
-       { "rclb",       RCL,            BYTE },
-       { "rcll",       RCL,            WORD },
-       { "rclw",       RCL,            OWORD },
-       { "rcrb",       RCR,            BYTE },
-       { "rcrl",       RCR,            WORD },
-       { "rcrw",       RCR,            OWORD },
-       { "ret",        RET,            JUMP },
-       { "retf",       RETF,           JUMP },
-       { "rolb",       ROL,            BYTE },
-       { "roll",       ROL,            WORD },
-       { "rolw",       ROL,            OWORD },
-       { "rorb",       ROR,            BYTE },
-       { "rorl",       ROR,            WORD },
-       { "rorw",       ROR,            OWORD },
-       { "sahf",       SAHF,           WORD },
-       { "salb",       SAL,            BYTE },
-       { "sall",       SAL,            WORD },
-       { "salw",       SAL,            OWORD },
-       { "sarb",       SAR,            BYTE },
-       { "sarl",       SAR,            WORD },
-       { "sarw",       SAR,            OWORD },
-       { "sbbb",       SBB,            BYTE },
-       { "sbbl",       SBB,            WORD },
-       { "sbbw",       SBB,            OWORD },
-       { "scasb",      SCAS,           BYTE },
-       { "scasl",      SCAS,           WORD },
-       { "scasw",      SCAS,           OWORD },
-       { "seta",       SETA,           BYTE },
-       { "setae",      SETAE,          BYTE },
-       { "setb",       SETB,           BYTE },
-       { "setbe",      SETBE,          BYTE },
-       { "sete",       SETE,           BYTE },
-       { "setg",       SETG,           BYTE },
-       { "setge",      SETGE,          BYTE },
-       { "setl",       SETL,           BYTE },
-       { "setna",      SETBE,          BYTE },
-       { "setnae",     SETB,           BYTE },
-       { "setnb",      SETAE,          BYTE },
-       { "setnbe",     SETA,           BYTE },
-       { "setne",      SETNE,          BYTE },
-       { "setng",      SETLE,          BYTE },
-       { "setnge",     SETL,           BYTE },
-       { "setnl",      SETGE,          BYTE },
-       { "setnle",     SETG,           BYTE },
-       { "setno",      SETNO,          BYTE },
-       { "setnp",      SETNP,          BYTE },
-       { "setns",      SETNS,          BYTE },
-       { "seto",       SETO,           BYTE },
-       { "setp",       SETP,           BYTE },
-       { "sets",       SETS,           BYTE },
-       { "setz",       SETE,           BYTE },
-       { "sgdt",       SGDT,           WORD },
-       { "shlb",       SHL,            BYTE },
-       { "shldl",      SHLD,           WORD },
-       { "shll",       SHL,            WORD },
-       { "shlw",       SHL,            OWORD },
-       { "shrb",       SHR,            BYTE },
-       { "shrdl",      SHRD,           WORD },
-       { "shrl",       SHR,            WORD },
-       { "shrw",       SHR,            OWORD },
-       { "sidt",       SIDT,           WORD },
-       { "sldt",       SLDT,           WORD },
-       { "smsw",       SMSW,           WORD },
-       { "stc",        STC,            WORD },
-       { "std",        STD,            WORD },
-       { "sti",        STI,            WORD },
-       { "stosb",      STOS,           BYTE },
-       { "stosl",      STOS,           WORD },
-       { "stosw",      STOS,           OWORD },
-       { "str",        STR,            WORD },
-       { "subb",       SUB,            BYTE },
-       { "subl",       SUB,            WORD },
-       { "subw",       SUB,            OWORD },
-       { "testb",      TEST,           BYTE },
-       { "testl",      TEST,           WORD },
-       { "testw",      TEST,           OWORD },
-       { "verr",       VERR,           WORD },
-       { "verw",       VERW,           WORD },
-       { "wait",       WAIT,           WORD },
-       { "wbinvd",     WBINVD,         WORD },
-       { "xadd",       XADD,           WORD },
-       { "xchgb",      XCHG,           BYTE },
-       { "xchgl",      XCHG,           WORD },
-       { "xchgw",      XCHG,           OWORD },
-       { "xlat",       XLAT,           WORD },
-       { "xorb",       XOR,            BYTE },
-       { "xorl",       XOR,            WORD },
-       { "xorw",       XOR,            OWORD },
-};
-
-void gnu_parse_init(char *file)
-/* Prepare parsing of an GNU assembly file. */
-{
-       tok_init(file, '#');
-}
-
-static void zap(void)
-/* An error, zap the rest of the line. */
-{
-       token_t *t;
-
-       while ((t= get_token(0))->type != T_EOF && t->symbol != ';')
-               skip_token(1);
-}
-
-static mnemonic_t *search_mnem(char *name)
-/* Binary search for a mnemonic.  (That's why the table is sorted.) */
-{
-       int low, mid, high;
-       int cmp;
-       mnemonic_t *m;
-
-       low= 0;
-       high= arraysize(mnemtab)-1;
-       while (low <= high) {
-               mid= (low + high) / 2;
-               m= &mnemtab[mid];
-
-               if ((cmp= strcmp(name, m->name)) == 0) return m;
-
-               if (cmp < 0) high= mid-1; else low= mid+1;
-       }
-       return nil;
-}
-
-static expression_t *gnu_get_C_expression(int *pn)
-/* Read a "C-like" expression.  Note that we don't worry about precedence,
- * the expression is printed later like it is read.  If the target language
- * does not have all the operators (like ~) then this has to be repaired by
- * changing the source file.  (No problem, you still have one source file
- * to maintain, not two.)
- */
-{
-       expression_t *e, *a1, *a2;
-       token_t *t;
-
-       if ((t= get_token(*pn))->symbol == '(') {
-               /* ( expr ): grouping. */
-               (*pn)++;
-               if ((a1= gnu_get_C_expression(pn)) == nil) return nil;
-               if (get_token(*pn)->symbol != ')') {
-                       parse_err(1, t, "missing )\n");
-                       del_expr(a1);
-                       return nil;
-               }
-               (*pn)++;
-               e= new_expr();
-               e->operator= '[';
-               e->middle= a1;
-       } else
-       if (t->type == T_WORD || t->type == T_STRING) {
-               /* Label, number, or string. */
-               e= new_expr();
-               e->operator= t->type == T_WORD ? 'W' : 'S';
-               e->name= allocate(nil, (t->len+1) * sizeof(e->name[0]));
-               memcpy(e->name, t->name , t->len+1);
-               e->len= t->len;
-               (*pn)++;
-       } else
-       if (t->symbol == '+' || t->symbol == '-' || t->symbol == '~') {
-               /* Unary operator. */
-               (*pn)++;
-               if ((a1= gnu_get_C_expression(pn)) == nil) return nil;
-               e= new_expr();
-               e->operator= t->symbol;
-               e->middle= a1;
-       } else {
-               parse_err(1, t, "expression syntax error\n");
-               return nil;
-       }
-
-       switch ((t= get_token(*pn))->symbol) {
-       case '%': 
-       case '+':
-       case '-':
-       case '*':
-       case '/':
-       case '&':
-       case '|':
-       case '^':
-       case S_LEFTSHIFT:
-       case S_RIGHTSHIFT:
-               (*pn)++;
-               a1= e;
-               if ((a2= gnu_get_C_expression(pn)) == nil) {
-                       del_expr(a1);
-                       return nil;
-               }
-               e= new_expr();
-               e->operator= t->symbol;
-               e->left= a1;
-               e->right= a2;
-       }
-       return e;
-}
-
-static expression_t *gnu_get_operand(int *pn, int deref)
-/* Get something like: $immed, memory, offset(%base,%index,scale), or simpler. */
-{
-       expression_t *e, *offset, *base, *index;
-       token_t *t;
-       int c;
-
-       if (get_token(*pn)->symbol == '$') {
-               /* An immediate value. */
-               (*pn)++;
-               return gnu_get_C_expression(pn);
-       }
-
-       if (get_token(*pn)->symbol == '*') {
-               /* Indirection. */
-               (*pn)++;
-               if ((offset= gnu_get_operand(pn, deref)) == nil) return nil;
-               e= new_expr();
-               e->operator= '(';
-               e->middle= offset;
-               return e;
-       }
-
-       if ((get_token(*pn)->symbol == '%')
-               && (t= get_token(*pn + 1))->type == T_WORD
-               && isregister(t->name)
-       ) {
-               /* A register operand. */
-               (*pn)+= 2;
-               e= new_expr();
-               e->operator= 'W';
-               e->name= copystr(t->name);
-               return e;
-       }
-
-       /* Offset? */
-       if (get_token(*pn)->symbol != '('
-                               || get_token(*pn + 1)->symbol != '%') {
-               /* There is an offset. */
-               if ((offset= gnu_get_C_expression(pn)) == nil) return nil;
-       } else {
-               /* No offset. */
-               offset= nil;
-       }
-
-       /* (%base,%index,scale) ? */
-       base= index= nil;
-       if (get_token(*pn)->symbol == '(') {
-               (*pn)++;
-
-               /* %base ? */
-               if (get_token(*pn)->symbol == '%'
-                       && (t= get_token(*pn + 1))->type == T_WORD
-                       && isregister(t->name)
-               ) {
-                       /* A base register expression. */
-                       base= new_expr();
-                       base->operator= 'B';
-                       base->name= copystr(t->name);
-                       (*pn)+= 2;
-               }
-
-               if (get_token(*pn)->symbol == ',') (*pn)++;
-
-               /* %index ? */
-               if (get_token(*pn)->symbol == '%'
-                       && (t= get_token(*pn + 1))->type == T_WORD
-                       && isregister(t->name)
-               ) {
-                       /* A index register expression. */
-                       index= new_expr();
-                       index->operator= '1';           /* for now */
-                       index->name= copystr(t->name);
-                       (*pn)+= 2;
-               }
-
-               if (get_token(*pn)->symbol == ',') (*pn)++;
-
-               /* scale ? */
-               if ((base != nil || index != nil)
-                       && (t= get_token(*pn))->type == T_WORD
-                       && strchr("1248", t->name[0]) != nil
-                       && t->name[1] == 0
-               ) {             
-                       if (index == nil) {
-                               /* Base is really an index register. */
-                               index= base;
-                               base= nil;
-                       }
-                       index->operator= t->name[0];
-                       (*pn)++;
-               }
-
-               if (get_token(*pn)->symbol == ')') {
-                       /* Ending paren. */
-                       (*pn)++;
-               } else {
-                       /* Alas. */
-                       parse_err(1, t, "operand syntax error\n");
-                       del_expr(offset);
-                       del_expr(base);
-                       del_expr(index);
-                       return nil;
-               }
-       }
-
-       if (base == nil && index == nil) {
-               if (deref) {
-                       /* Return a lone offset as (offset). */
-                       e= new_expr();
-                       e->operator= '(';
-                       e->middle= offset;
-               } else {
-                       /* Return a lone offset as is. */
-                       e= offset;
-               }
-       } else {
-               e= new_expr();
-               e->operator= 'O';
-               e->left= offset;
-
-               e->middle= base;
-               e->right= index;
-       }
-       return e;
-}
-
-static expression_t *gnu_get_oplist(int *pn, int deref)
-/* Get a comma (or colon for jmpf and callf) separated list of instruction
- * operands.
- */
-{
-       expression_t *e, *o1, *o2;
-       token_t *t;
-
-       if ((e= gnu_get_operand(pn, deref)) == nil) return nil;
-
-       if ((t= get_token(*pn))->symbol == ',' || t->symbol == ':') {
-               o1= e;
-               (*pn)++;
-               if ((o2= gnu_get_oplist(pn, deref)) == nil) {
-                       del_expr(o1);
-                       return nil;
-               }
-               e= new_expr();
-               e->operator= ',';
-               e->left= o1;
-               e->right= o2;
-       }
-       return e;
-}
-
-
-static asm86_t *gnu_get_statement(void)
-/* Get a pseudo op or machine instruction with arguments. */
-{
-       token_t *t= get_token(0);
-       asm86_t *a;
-       mnemonic_t *m;
-       int n;
-       int prefix_seen;
-       int deref;
-
-       assert(t->type == T_WORD);
-
-       a= new_asm86();
-
-       /* Process instruction prefixes. */
-       for (prefix_seen= 0;; prefix_seen= 1) {
-               if (strcmp(t->name, "rep") == 0
-                       || strcmp(t->name, "repe") == 0
-                       || strcmp(t->name, "repne") == 0
-                       || strcmp(t->name, "repz") == 0
-                       || strcmp(t->name, "repnz") == 0
-               ) {
-                       if (a->rep != ONCE) {
-                               parse_err(1, t,
-                                       "can't have more than one rep\n");
-                       }
-                       switch (t->name[3]) {
-                       case 0:         a->rep= REP;    break;
-                       case 'e':
-                       case 'z':       a->rep= REPE;   break;
-                       case 'n':       a->rep= REPNE;  break;
-                       }
-               } else
-               if (!prefix_seen) {
-                       /* No prefix here, get out! */
-                       break;
-               } else {
-                       /* No more prefixes, next must be an instruction. */
-                       if (t->type != T_WORD
-                               || (m= search_mnem(t->name)) == nil
-                               || m->optype == PSEUDO
-                       ) {
-                               parse_err(1, t,
-               "machine instruction expected after instruction prefix\n");
-                               del_asm86(a);
-                               return nil;
-                       }
-                       break;
-               }
-
-               /* Skip the prefix and extra newlines. */
-               do {
-                       skip_token(1);
-               } while ((t= get_token(0))->symbol == ';');
-       }
-
-       /* All the readahead being done upsets the line counter. */
-       a->line= t->line;
-
-       /* Read a machine instruction or pseudo op. */
-       if ((m= search_mnem(t->name)) == nil) {
-               parse_err(1, t, "unknown instruction '%s'\n", t->name);
-               del_asm86(a);
-               return nil;
-       }
-       a->opcode= m->opcode;
-       a->optype= m->optype;
-       a->oaz= 0;
-       if (a->optype == OWORD) {
-               a->oaz|= OPZ;
-               a->optype= WORD;
-       }
-
-       switch (a->opcode) {
-       case IN:
-       case OUT:
-       case INT:
-               deref= 0;
-               break;
-       default:
-               deref= (a->optype >= BYTE);
-       }
-       n= 1;
-       if (get_token(1)->symbol != ';'
-                       && (a->args= gnu_get_oplist(&n, deref)) == nil) {
-               del_asm86(a);
-               return nil;
-       }
-       if (get_token(n)->symbol != ';') {
-               parse_err(1, t, "garbage at end of instruction\n");
-               del_asm86(a);
-               return nil;
-       }
-       if (!is_pseudo(a->opcode)) {
-               /* GNU operand order is the other way around. */
-               expression_t *e, *t;
-
-               e= a->args;
-               while (e != nil && e->operator == ',') {
-                       t= e->right; e->right= e->left; e->left= t;
-                       e= e->left;
-               }
-       }
-       switch (a->opcode) {
-       case DOT_ALIGN:
-               /* Delete two argument .align, because ACK can't do it.
-                * Raise 2 to the power of .align's argument.
-                */
-               if (a->args == nil || a->args->operator != 'W') {       
-                       del_asm86(a);
-                       return nil;
-               }
-               if (a->args != nil && a->args->operator == 'W'
-                       && isanumber(a->args->name)
-               ) {     
-                       unsigned n;
-                       char num[sizeof(int) * CHAR_BIT / 3 + 1];
-
-                       n= 1 << strtoul(a->args->name, nil, 0);
-                       sprintf(num, "%u", n);
-                       deallocate(a->args->name);
-                       a->args->name= copystr(num);
-               }
-               break;
-       case JMPF:
-       case CALLF:
-               /*FALL THROUGH*/
-       case JMP:
-       case CALL:
-               break;
-       default:;
-       }
-       skip_token(n+1);
-       return a;
-}
-
-
-asm86_t *gnu_get_instruction(void)
-{
-       asm86_t *a= nil;
-       expression_t *e;
-       token_t *t;
-
-       while ((t= get_token(0))->symbol == ';' || t->symbol == '/') {
-               zap();          /* if a comment started by a '/' */
-               skip_token(1);
-       }
-
-       if (t->type == T_EOF) return nil;
-
-       if (t->symbol == '#') {
-               /* Preprocessor line and file change. */
-
-               if ((t= get_token(1))->type != T_WORD || !isanumber(t->name)
-                       || get_token(2)->type != T_STRING
-               ) {
-                       parse_err(1, t, "file not preprocessed?\n");
-                       zap();
-               } else {
-                       set_file(get_token(2)->name,
-                               strtol(get_token(1)->name, nil, 0) - 1);
-
-                       /* GNU CPP adds extra cruft, simply zap the line. */
-                       zap();
-               }
-               a= gnu_get_instruction();
-       } else
-       if (t->type == T_WORD && get_token(1)->symbol == ':') {
-               /* A label definition. */
-
-               a= new_asm86();
-               a->line= t->line;
-               a->opcode= DOT_LABEL;
-               a->optype= PSEUDO;
-               a->args= e= new_expr();
-               e->operator= ':';
-               e->name= copystr(t->name);
-               skip_token(2);
-       } else
-       if (t->type == T_WORD && get_token(1)->symbol == '=') {
-               int n= 2;
-
-               if ((e= gnu_get_C_expression(&n)) == nil) {
-                       zap();
-                       a= gnu_get_instruction();
-               } else
-               if (get_token(n)->symbol != ';') {
-                       parse_err(1, t, "garbage after assignment\n");
-                       zap();
-                       a= gnu_get_instruction();
-               } else {
-                       a= new_asm86();
-                       a->line= t->line;
-                       a->opcode= DOT_EQU;
-                       a->optype= PSEUDO;
-                       a->args= new_expr();
-                       a->args->operator= '=';
-                       a->args->name= copystr(t->name);
-                       a->args->middle= e;
-                       skip_token(n+1);
-               }
-       } else
-       if (t->type == T_WORD) {
-               if ((a= gnu_get_statement()) == nil) {
-                       zap();
-                       a= gnu_get_instruction();
-               }
-       } else {
-               parse_err(1, t, "syntax error\n");
-               zap();
-               a= gnu_get_instruction();
-       }
-       return a;
-}
diff --git a/commands/asmconv/syntax.ack b/commands/asmconv/syntax.ack
deleted file mode 100755 (executable)
index 8281b7c..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-asmprog:
-       comment ?
-       statement
-       asmprog ; asmprog
-       asmprog comment ? \n asmprog
-
-letter:
-       [._a-zA-Z]
-
-digit:
-       [0-9]
-
-identifier:
-       letter (letter | digit)*
-       digit [bf]
-
-string:
-       'C-like string sequence'
-       "C-like string sequence"
-
-number:
-       C-like number
-
-comment:
-       ! .*
-
-statement:
-       label-definition statement
-       empty
-       assignment
-       instruction
-       pseudo-instruction
-
-label-definition:
-       identifier :
-       digit :
-
-assignment:
-       identifier = expression
-
-instruction:
-       iX86-instruction
-
-pseudo-instruction:
-       .extern identifier (, identifier)*
-       .define identifier (, identifier)*
-       .data1 expression (, expression)*
-       .data2 expression (, expression)*
-       .data4 expression (, expression)*
-       .ascii string
-       .asciz string
-       .align expression
-       .space expression
-       .comm identifier , expression
-       .sect identifier
-       .base expression
-       .assert expression
-       .symb XXX
-       .line XXX
-       .file XXX
-       .nolist
-       .list
-       iX86-pseudo
-
-expression:
-       C-like expression with [ and ] for grouping
-
-iX86-instruction:
-       prefix
-       prefix iX86-instruction
-       identifier
-       identifier iX86operand
-       identifier iX86operand , iX86operand
-       identifier iX86operand : iX86operand
-
-prefix:
-       o16
-       o32
-       a16
-       a32
-       rep
-       repz
-       repnz
-       repe
-       repne
-       cseg | dseg | eseg | fseg | gseg | sseg
-
-iX86operand:
-       register
-       ( register )
-       expression
-       ( expression )
-       expression ( register )
-       expression ( register * [1248] )
-       expression ? ( register ) ( register )
-       expression ? ( register ) ( register * [1248] )
-
-register:
-       al | bl | cl | dl | ah | bh | ch | dh
-       ax | bx | cx | dx | si | di | bp | sp
-       eax | ebx | ecx | edx | esi | edi | ebp | esp
-       cs | ds | es | fs | gs | ss
-       cr0 | cr1 | cr2 | cr3
-
-iX86-pseudo:
-       .use16
-       .use32
diff --git a/commands/asmconv/token.h b/commands/asmconv/token.h
deleted file mode 100644 (file)
index f6720d1..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*     token.h - token definition                      Author: Kees J. Bot
- *                                                             13 Dec 1993
- */
-
-typedef enum toktype {
-       T_EOF,
-       T_CHAR,
-       T_WORD,
-       T_STRING
-} toktype_t;
-
-typedef struct token {
-       struct token    *next;
-       long            line;
-       toktype_t       type;
-       int             symbol;         /* Single character symbol. */
-       char            *name;          /* Word, number, etc. */
-       size_t          len;            /* Length of string. */
-} token_t;
-
-#define S_LEFTSHIFT    0x100           /* << */
-#define S_RIGHTSHIFT   0x101           /* >> */
-
-void set_file(char *file, long line);
-void get_file(char **file, long *line);
-void parse_err(int err, token_t *where, const char *fmt, ...);
-void tok_init(char *file, int comment);
-token_t *get_token(int n);
-void skip_token(int n);
diff --git a/commands/asmconv/tokenize.c b/commands/asmconv/tokenize.c
deleted file mode 100644 (file)
index 222c525..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-/*     tokenize.c - split input into tokens            Author: Kees J. Bot
- *                                                             13 Dec 1993
- */
-#define nil 0
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-
-static FILE *tf;
-static char *tfile;
-static char *orig_tfile;
-static int tcomment;
-static int tc;
-static long tline;
-static token_t *tq;
-
-static void readtc(void)
-/* Read one character from the input file and put it in the global 'tc'. */
-{
-       static int nl= 0;
-
-       if (nl) tline++;
-       if ((tc= getc(tf)) == EOF && ferror(tf)) fatal(orig_tfile);
-       nl= (tc == '\n');
-}
-
-void set_file(char *file, long line)
-/* Set file name and line number, changed by a preprocessor trick. */
-{
-       deallocate(tfile);
-       tfile= allocate(nil, (strlen(file) + 1) * sizeof(tfile[0]));
-       strcpy(tfile, file);
-       tline= line;
-}
-
-void get_file(char **file, long *line)
-/* Get file name and line number. */
-{
-       *file= tfile;
-       *line= tline;
-}
-
-void parse_err(int err, token_t *t, const char *fmt, ...)
-/* Report a parsing error. */
-{
-       va_list ap;
-
-       fprintf(stderr, "\"%s\", line %ld: ", tfile,
-                                               t == nil ? tline : t->line);
-       va_start(ap, fmt);
-       vfprintf(stderr, fmt, ap);
-       va_end(ap);
-       if (err) set_error();
-}
-
-void tok_init(char *file, int comment)
-/* Open the file to tokenize and initialize the tokenizer. */
-{
-       if (file == nil) {
-               file= "stdin";
-               tf= stdin;
-       } else {
-               if ((tf= fopen(file, "r")) == nil) fatal(file);
-       }
-       orig_tfile= file;
-       set_file(file, 1);
-       readtc();
-       tcomment= comment;
-}
-
-static int isspace(int c)
-{
-       return between('\0', c, ' ') && c != '\n';
-}
-
-#define iscomment(c)   ((c) == tcomment)
-
-static int isidentchar(int c)
-{
-       return between('a', c, 'z')
-               || between('A', c, 'Z')
-               || between('0', c, '9')
-               || c == '.'
-               || c == '_'
-               ;
-}
-
-static token_t *new_token(void)
-{
-       token_t *new;
-
-       new= allocate(nil, sizeof(*new));
-       new->next= nil;
-       new->line= tline;
-       new->name= nil;
-       new->symbol= -1;
-       return new;
-}
-
-static token_t *get_word(void)
-/* Read one word, an identifier, a number, a label, or a mnemonic. */
-{
-       token_t *w;
-       char *name;
-       size_t i, len;
-
-       i= 0;
-       len= 16;
-       name= allocate(nil, len * sizeof(name[0]));
-
-       while (isidentchar(tc)) {
-               name[i++]= tc;
-               readtc();
-               if (i == len) name= allocate(name, (len*= 2) * sizeof(name[0]));
-       }
-       name[i]= 0;
-       name= allocate(name, (i+1) * sizeof(name[0]));
-       w= new_token();
-       w->type= T_WORD;
-       w->name= name;
-       w->len= i;
-       return w;
-}
-
-static token_t *get_string(void)
-/* Read a single or double quotes delimited string. */
-{
-       token_t *s;
-       int quote;
-       char *str;
-       size_t i, len;
-       int n, j;
-       int seen;
-
-       quote= tc;
-       readtc();
-
-       i= 0;
-       len= 16;
-       str= allocate(nil, len * sizeof(str[0]));
-
-       while (tc != quote && tc != '\n' && tc != EOF) {
-               seen= -1;
-               if (tc == '\\') {
-                       readtc();
-                       if (tc == '\n' || tc == EOF) break;
-
-                       switch (tc) {
-                       case 'a':       tc= '\a'; break;
-                       case 'b':       tc= '\b'; break;
-                       case 'f':       tc= '\f'; break;
-                       case 'n':       tc= '\n'; break;
-                       case 'r':       tc= '\r'; break;
-                       case 't':       tc= '\t'; break;
-                       case 'v':       tc= '\v'; break;
-                       case 'x':
-                               n= 0;
-                               for (j= 0; j < 3; j++) {
-                                       readtc();
-                                       if (between('0', tc, '9'))
-                                               tc-= '0' + 0x0;
-                                       else
-                                       if (between('A', tc, 'A'))
-                                               tc-= 'A' + 0xA;
-                                       else
-                                       if (between('a', tc, 'a'))
-                                               tc-= 'a' + 0xa;
-                                       else {
-                                               seen= tc;
-                                               break;
-                                       }
-                                       n= n*0x10 + tc;
-                               }
-                               tc= n;
-                               break;
-                       default:
-                               if (!between('0', tc, '9')) break;
-                               n= 0;
-                               for (j= 0; j < 3; j++) {
-                                       if (between('0', tc, '9'))
-                                               tc-= '0';
-                                       else {
-                                               seen= tc;
-                                               break;
-                                       }
-                                       n= n*010 + tc;
-                                       readtc();
-                               }
-                               tc= n;
-                       }
-               }
-               str[i++]= tc;
-               if (i == len) str= allocate(str, (len*= 2) * sizeof(str[0]));
-
-               if (seen < 0) readtc(); else tc= seen;
-       }
-
-       if (tc == quote) {
-               readtc();
-       } else {
-               parse_err(1, nil, "string contains newline\n");
-       }
-       str[i]= 0;
-       str= allocate(str, (i+1) * sizeof(str[0]));
-       s= new_token();
-       s->type= T_STRING;
-       s->name= str;
-       s->len= i;
-       return s;
-}
-
-static int old_n= 0;           /* To speed up n, n+1, n+2, ... accesses. */
-static token_t **old_ptq= &tq;
-
-token_t *get_token(int n)
-/* Return the n-th token on the input queue. */
-{
-       token_t *t, **ptq;
-
-       assert(n >= 0);
-
-       if (0 && n >= old_n) {
-               /* Go forward from the previous point. */
-               n-= old_n;
-               old_n+= n;
-               ptq= old_ptq;
-       } else {
-               /* Restart from the head of the queue. */
-               old_n= n;
-               ptq= &tq;
-       }
-
-       for (;;) {
-               if ((t= *ptq) == nil) {
-                       /* Token queue doesn't have element <n>, read a
-                        * new token from the input stream.
-                        */
-                       while (isspace(tc) || iscomment(tc)) {
-                               if (iscomment(tc)) {
-                                       while (tc != '\n' && tc != EOF)
-                                               readtc();
-                               } else {
-                                       readtc();
-                               }
-                       }
-
-                       if (tc == EOF) {
-                               t= new_token();
-                               t->type= T_EOF;
-                       } else
-                       if (isidentchar(tc)) {
-                               t= get_word();
-                       } else
-                       if (tc == '\'' || tc == '"') {
-                               t= get_string();
-                       } else {
-                               if (tc == '\n') tc= ';';
-                               t= new_token();
-                               t->type= T_CHAR;
-                               t->symbol= tc;
-                               readtc();
-                               if (t->symbol == '<' && tc == '<') {
-                                       t->symbol= S_LEFTSHIFT;
-                                       readtc();
-                               } else
-                               if (t->symbol == '>' && tc == '>') {
-                                       t->symbol= S_RIGHTSHIFT;
-                                       readtc();
-                               }
-                       }
-                       *ptq= t;
-               }
-               if (n == 0) break;
-               n--;
-               ptq= &t->next;
-       }
-       old_ptq= ptq;
-       return t;
-}
-
-void skip_token(int n)
-/* Remove n tokens from the input queue.  One is not allowed to skip unread
- * tokens.
- */
-{
-       token_t *junk;
-
-       assert(n >= 0);
-
-       while (n > 0) {
-               assert(tq != nil);
-
-               junk= tq;
-               tq= tq->next;
-               deallocate(junk->name);
-               deallocate(junk);
-               n--;
-       }
-       /* Reset the old reference. */
-       old_n= 0;
-       old_ptq= &tq;
-}
diff --git a/commands/binpackage/Makefile b/commands/binpackage/Makefile
deleted file mode 100644 (file)
index 7587f2b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-SCRIPTS= binpackage.sh
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/binpackage/binpackage.sh b/commands/binpackage/binpackage.sh
deleted file mode 100644 (file)
index f525e56..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/sh 
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-PI=.postinstall
-INFO=.minixpackage
-
-set -e
-
-# No trailing slashes in the directory, because we want to base the
-# package filename on it.
-dir=`echo "$1" | sed 's/\/*$//'`
-
-if [ $# -ne 2 ]
-then   echo "Usage: $0 sourcedir packagedir"
-       exit 1
-fi
-
-if [ ! -d "$dir" ]
-then   echo "Error: $dir isn't a directory."
-       exit 1
-fi
-
-here=`pwd`
-
-case "$dir" in
-/*) srcdir="$dir" ;;
-*) srcdir="$here/$dir" ;;
-esac
-
-case $2 in
-/*) pdir="$2" ;;
-*) pdir="$here/$2" ;;
-esac
-
-packagestart=$srcdir/now
-findlist=$srcdir/findlist
-tar=$srcdir/"`basename ${dir}`".tar
-tarbz=$tar.bz2
-
-mkdir $pdir 2>/dev/null || true
-rc=$dir/.binpackage
-if [ -f $rc ]
-then    . $rc
-fi
-
-prunedirs="$srcdir dev tmp usr/bigports usr/src usr/tmp usr/log usr/adm usr/run home etc/utmp var/run var/log /var/spool"
-
-for d in $prunedirs
-do     pruneexpr="$pruneexpr $n -path /$d -prune"
-       n="-o "
-done
-
-touch $packagestart
-sleep 1
-cd $dir
-
-if [ ! -f build -a ! -f build.minix ]
-then   echo "Error: No build or build.minix script in $dir."
-       exit 1
-fi
-
-if [ -f build.minix ]
-then   sh -e build.minix
-else   sh -e build
-fi
-
-echo " * Building package"
-echo "Minix package $dir built `date`." >$INFO
-(
-       echo $INFO
-       if [ -f $PI ]
-       then    echo $PI
-       fi
-       find / \( $pruneexpr \) -o -cnewer $packagestart -print | fgrep -v /.svn
-) | pax -w -d | bzip2 >$tarbz
-rm -f $packagestart $findlist $tarcmd
-mv $tarbz $pdir
-exit 0
diff --git a/commands/binpackages/Makefile b/commands/binpackages/Makefile
deleted file mode 100644 (file)
index 575951d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-SCRIPTS= binpackages.sh
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/binpackages/binpackages.sh b/commands/binpackages/binpackages.sh
deleted file mode 100644 (file)
index a29345b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-pdir=Packages
-
-for d in */build
-do
-       dir="`echo $d | sed 's/\/build$//'`"
-       if [ ! -f $pdir/$dir.tar.gz ]
-       then
-               echo " * $dir"
-               binpackage $dir $pdir
-       fi
-done
diff --git a/commands/chmem/Makefile b/commands/chmem/Makefile
deleted file mode 100644 (file)
index cb61b5a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-PROG=  chmem
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/chmem/chmem.c b/commands/chmem/chmem.c
deleted file mode 100644 (file)
index b6187b1..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/* chmem - set total memory size for execution Author: Andy Tanenbaum */
-
-#include <minix/config.h>
-#include <sys/types.h>
-#include <a.out.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#define MAX_8086     0x10000L  /* maximum allocation size for 8086 */
-#define MAX_386          0x7FFFFFFFL   /* etc */
-#define MAX_68K   0x7FFFFFFFL
-#define MAX_SPARC 0x20000000L  /* No more than 512MB on a SparcStation! */
-
-char *progname;
-
-_PROTOTYPE(int main, (int argc, char **argv));
-_PROTOTYPE(void error, (char *s1, char *s2));
-_PROTOTYPE(void usage, (void));
-
-int main(argc, argv)
-int argc;
-char *argv[];
-{
-/* The 8088 architecture does not make it possible to catch stacks that grow
- * big.  The only way to deal with this problem is to let the stack grow down
- * towards the data segment and the data segment grow up towards the stack.
- * Normally, a total of 64K is allocated for the two of them, but if the
- * programmer knows that a smaller amount is sufficient, he can change it
- * using chmem.
- *
- * chmem =4096 prog  sets the total space for stack + data growth to 4096
- * chmem +200  prog  increments the total space for stack + data growth by 200
- */
-
-  char *p;
-  int fd = -1, separate;
-  size_t s;
-  long lsize, olddynam, newdynam, newtot, overflow;
-  struct exec exec;
-  char cpu;
-  long max;
-  int last_failed = 0, any_failed = 0;
-
-  progname = argv[0];
-  if (argc < 3) usage();
-  p = argv[1];
-  if (*p != '=' && *p != '+' && *p != '-') usage();
-  lsize = atol(p + 1);
-  s = sizeof(struct exec);
-
-  if (lsize < 0) {
-       error(p + 1, "is negative");
-       exit(1);
-  }
-  argc -= 1;
-  argv += 1;
-
-  while (--argc) {
-       if(last_failed) any_failed = 1;
-
-       /* Unless we reach the end of this loop, this one failed. */
-       last_failed = 1;
-       ++argv;
-       if(fd != -1) close(fd);
-       fd = open(*argv, O_RDWR);
-       if (fd < 0) {
-               error("can't open", *argv);
-               continue;
-       }
-       if (read(fd, (char *) &exec, s) != s) {
-               error("can't read header in", *argv);
-               continue;
-       }
-       if (BADMAG(exec)) {
-               error(*argv, "is not executable");
-               continue;
-       }
-       separate = (exec.a_flags & A_SEP ? 1 : 0);
-       cpu = exec.a_cpu;
-
-#if (CHIP == M68000)
-       if (cpu == A_I8086) cpu = A_M68K;
-#endif
-
-       switch (cpu) {
-           case A_I8086:       max = MAX_8086; break;
-           case A_I80386:      max = MAX_386;  break;
-           case A_M68K:        max = MAX_68K;  break;
-           case A_SPARC:       max = MAX_SPARC;        break;
-           default:
-               error("bad CPU type in", *argv);
-               continue;
-       }
-
-       if (lsize > max) {
-               error("size is too large for", *argv);
-               continue;
-       }
-       olddynam = exec.a_total - exec.a_data - exec.a_bss;
-       if (separate == 0) olddynam -= exec.a_text;
-
-       if (*p == '=')
-               newdynam = lsize;
-       else if (*p == '+')
-               newdynam = olddynam + lsize;
-       else if (*p == '-')
-               newdynam = olddynam - lsize;
-
-       newtot = exec.a_data + exec.a_bss + newdynam;
-       if (separate == 0) newtot += exec.a_text;
-       overflow = (newtot > max ? newtot - max : 0);
-       newdynam -= overflow;
-       newtot -= overflow;
-       exec.a_total = newtot;
-       lseek(fd, (long) 0, SEEK_SET);
-       if (write(fd, (char *) &exec, s) != s) {
-               error("can't modify", *argv);
-               continue;
-       }
-       printf("%s: Stack+malloc area changed from %ld to %ld bytes.\n",
-              *argv, olddynam, newdynam);
-
-       /* This one didn't fail. */
-       last_failed = 0;
-  }
-  return(any_failed || last_failed ? 1 : 0);
-}
-
-void error(s1, s2)
-char *s1;
-char *s2;
-{
-  fprintf(stderr, "%s: %s ", progname, s1);
-  if (errno != 0)
-       perror(s2);
-  else
-       fprintf(stderr, "%s\n", s2);
-  errno = 0;
-}
-
-void usage()
-{
-  fprintf(stderr, "Usage: %s {=+-} amount file\n", progname);
-  exit(1);
-}
index 0904d61e82d5b58e141662efe2ad00b4a4efe0a2..1aed929efa542f368c56e83674eeee89a45b7d38 100644 (file)
@@ -3,12 +3,7 @@
 
 PROG=  cut
 
-.if ${COMPILER_TYPE} != "gnu"
-LDADD+=        -lminixutil
-DPADD+=        ${LIBMINIXUTIL}
-.else
 LDADD+=        -lutil
 DPADD+=        ${LIBUTIL}
-.endif
 
 .include <bsd.prog.mk>
diff --git a/commands/date/Makefile b/commands/date/Makefile
deleted file mode 100644 (file)
index 2c82a24..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.include <bsd.own.mk>
-
-PROG=  date
-SRCS=  date.c logwtmp.c
-TZDIR= /usr/share/zoneinfo
-CPPFLAGS+= -DHAVE_ADJTIME=0 -DTZDIR=\"$(TZDIR)\"
-BINDIR= /bin
-
-.PATH: ${MINIXSRCDIR}/lib/libc/stdtime
-
-.include <bsd.prog.mk>
diff --git a/commands/dis386/Makefile b/commands/dis386/Makefile
deleted file mode 100644 (file)
index c813372..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# Makefile for dis386
-
-PROGS= dis386e dis386o
-SRCS.dis386e=dise.c misc.c unasm.c
-SRCS.dis386o=diso.c misc.c unasm.c
-MAN.dis386e=
-MAN.dis386o=
-
-.include <bsd.prog.mk>
diff --git a/commands/dis386/const.h b/commands/dis386/const.h
deleted file mode 100644 (file)
index 98cd093..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/* const.h - constants for db.
- *
- * $Id: const.h,v 1.0 1990/10/06 12:00:00 cwr Exp cwr $
- */
-
-/* general constants */
-#define FALSE          0
-#undef NULL
-#define NULL           0
-#define TRUE           1
-
-/* C tricks */
-#define EXTERN         extern
-#define FORWARD                static
-#define PRIVATE                static
-#define PUBLIC
-
-/* ASCII codes */
-#define CAN            24
-#define CR             13
-#define EOF            (-1)
-#define LF             10
-#define XOFF           19
-
-/* hardware processor-specific for 8088 through 80386 */
-#ifndef HCLICK_SIZE
-#define HCLICK_SIZE    0x10
-#endif
-#define IF             0x0200  /* interrupt disable bit in flags */
-#define INT_BREAKPOINT 0xCC    /* byte for breakpoint interrupt */
-#define LINEARADR(seg, off) \
-       (HCLICK_SIZE * (physoff_t) (segment_t) (seg) + (off))
-#define TF             0x0100  /* trap bit in flags */
-
-/* hardware processor-specific for 80386 and emulated for others */
-#define BS             0x4000  /* single-step bit in dr6 */
-
-/* use hardware codes for segments for simplest decoding */
-#define CSEG           0x2E    /* 8088 through 80386 */
-#define DSEG           0x3E
-#define ESEG           0x26
-#define FSEG           0x64
-#define GSEG           0x65    /* 80386 only */
-#define SSEG           0x36
-
-/* software machine-specific for PC family */
-#define BIOS_DATA_SEG  0x40
-#  define KB_FLAG      0x17    /* offset to 16-bits of keyboard shift flags */
-
-/* switches to handle non-conforming compilers */
-#define UCHAR_BUG              /* compiler converts unsigned chars wrong */
-
-#ifdef UCHAR_BUG
-#  define UCHAR(x)     ((x) & 0xFF)
-#endif
-
diff --git a/commands/dis386/dis386.doc b/commands/dis386/dis386.doc
deleted file mode 100644 (file)
index 44e7ef9..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-Dis36: a static disassembler for Minix 2.0.  C W Rose, 20 Oct 97.
-
-SUMMARY
-
-This is the second release of dis386, a disassembler for Minix 2.0  At present
-it is comprised of two programs, dise which understands executable files, and
-diso which understands object files.   The programs have been written using as
-much common code as possible, and in time they will be merged.  Meantime, they
-are easier to debug separately.
-
-The two programs are both front ends for Bruce Evan's x86 disassembler.  The
-disassembler can handle both 16-bit and 32-bit code, but since the programs
-use large data tables (kept in memory for speedy access) they have been tested
-only on 32-bit Minix.
-
-The changes between versions 1.0 and 1.1 are small, but add to the ease of
-use: addresses can now be entered in decimal or hexadecimal (leading 0x),
-and starting offset and program counter now have more intelligble values.
-
-OPTIONS
-
-Object, executable and core files have the following structures, where
-Name is the section name, and Option the option needed to display the section.
-
-Object file                    Executable file         Core file
-Name                   Option  Name            Option  Name            Option
-Header         }       h       Header          h       Memory map      m
-Section headers        }                                       Process table   p
-Sections               -       Sections        -       Sections        -
- text                  t        text           t       text            t
- rom                   m
- data                  d        data           d       data            d
- bss                   -                               stack           k
-Relocation structures  r
-Symbol table           s       Symbol table    s
-Symbol names           n
-
-Other options are:
-       -A str  set executable file name
-       -C str  set core file name
-       -O str  set object file name
-       -a      display all sections
-       -b      dump in straight binary
-       -f #    set the first address to be displayed
-       -l #    set the last address to be displayed
-       -x #    set debugging level
-
-Not all these options are functional at present; in particular, the file type
-override of -A/C/O isn't implemented (since the programs are single-purpose).
-
-The default option is -h.  The default input file is a.out for dise, and test.o
-for diso.  Otherwise, input is taken from the first file option on the command
-line.  Output is always written to standard output, and error messages to
-standard error.
-
-BUGS AND FEATURES
-
-The programs search the data area for possible local symbols; generally, these
-are the start of strings.  At the moment this search is limited, and accepts
-even single printing characters as strings; it should probably accept only
-runs of three or more characters.
-
-There is no search for local text symbols, as opposed to data symbols; this
-would need two full passes over the text with the disassembler, and doesn't
-seem worthwhile.  Once the data symbols are out of the way, the disassembled
-text is fairly easy to read.
-
-The programs do a fair amount of error checking to ensure that they are
-using eg. addresses that are within scope, but if they do fail they tend
-to abandon the task completely and bale out with a (supposedly informative)
-error message.
-
-There are many apparent dead-ends in the code, left as hooks for later
-additions.
-
-/* eof */
-
diff --git a/commands/dis386/dis386.h b/commands/dis386/dis386.h
deleted file mode 100644 (file)
index b1ab4f8..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * dis386.h: header file for dis386.c.
- *
- * $Id: dis386.h,v 1.1 1997/10/20 12:00:00 cwr Exp cwr $
- *
- * Written by C W Rose.
- */
-
-#ifndef EXTERN
-#define EXTERN extern
-#endif
-
-/* Generally used variables */
-struct locname {                       /* local symbol table entry */
-  char l_name[8];                      /* symbol name */
-  unsigned char l_sclass;              /* storage class */
-  long l_value;                                /* symbol value */
-  struct locname *l_next;              /* pointer to next entry */
-};
-EXTERN struct locname *locsym[MAXSECT];        /* local symbol tables */
-
-EXTERN FILE *aoutfp;                   /* executable file pointer */
-EXTERN FILE *corefp;                   /* core file pointer */
-EXTERN FILE *disfp;                    /* disassembly file pointer */
-EXTERN FILE *objfp;                    /* object file pointer */
-EXTERN FILE *symfp;                    /* symbol file pointer */
-
-/* executable file variables */
-EXTERN struct exec a_hdrbuf;           /* executable header structure */
-EXTERN struct nlist *a_symtab;         /* executable symbol table */
-
-/* .o file variables */
-EXTERN struct outhead o_hdrbuf;                /* object file header data */
-EXTERN struct outsect o_sectab[MAXSECT];/* object file section data */
-EXTERN char *o_secnam[MAXSECT];                /* object file section names */
-EXTERN struct outrelo *o_reltab;       /* object file relocation table */
-EXTERN struct outname *o_symtab;       /* object file symbol table */
-EXTERN char *o_strtab;                 /* object file symbol names */
-
-/* Generally used functions */
-PUBLIC int dasm(unsigned long addr, unsigned long count); /* disassemble opcodes */
-
-/*
- * EOF
- */
-
diff --git a/commands/dis386/dise.c b/commands/dis386/dise.c
deleted file mode 100644 (file)
index 913a1c5..0000000
+++ /dev/null
@@ -1,1036 +0,0 @@
-/*
- * dis_e386: disassemble 386 executable files.
- *
- * $Id: dise.c,v 1.1 1997/10/20 12:00:00 cwr Exp cwr $
- *
- * Written by C W Rose.
- */
-
-/* Version settings */
-#define MINIX
-#undef OS2
-#undef TEST
-
-#ifdef MINIX
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <a.out.h>
-#include <minix/ansi.h>
-#include <assert.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#undef S_ABS           /* used in a.out.h */
-#include "out.h"       /* ACK compiler output header */
-#undef EXTERN
-#define EXTERN
-#include "dis386.h"    /* dis386 header */
-#endif
-
-#ifdef OS2
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include </local/minix/minix/config.h>
-#include </local/minix/minix/const.h>
-#include </local/minix/a.out.h>
-#include </local/minix/ansi.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#undef S_ABS           /* used in a.out.h */
-#include "out.h"       /* ACK compiler output header */
-#undef EXTERN
-#define EXTERN
-#include "dis386.h"    /* dis386 header */
-#endif
-
-/* Standard defines */
-#define FALSE          0
-#undef TRUE
-#define TRUE           !FALSE
-#define FAILED         -1
-#define MAYBE          0
-#define OK             1
-#define SAME           0
-
-/* Local defines */
-#define L_BUFF_LEN     1024
-#define BUFF_LEN       256
-#define S_BUFF_LEN     20
-#define L_BUFF_MAX     (L_BUFF_LEN-1)
-#define BUFF_MAX       (BUFF_LEN-1)
-#define S_BUFF_MAX     (S_BUFF_LEN-1)
-#define PSEP           '\\'
-
-#define AOUT           "a.out"
-#define CORE           "core"
-#define STAB           "symbol.tab"
-#define LINE_LEN       16
-#define SYMLEN         8
-
-#define TEXT           0       /* section indices for locsym[] */
-#define ROM            1
-#define DATA           2
-#define BSS            3
-
-#ifndef lint
-static char *Version = "@(#) dis_e386.c $Revision: 1.1 $ $Date: 1997/10/20 12:00:00 $";
-#endif
-
-/* Global variables */
-int opt_C = FALSE;             /* core file name */
-int opt_E = FALSE;             /* executable file name */
-int opt_O = FALSE;             /* object file name */
-int opt_S = FALSE;             /* symbol table name */
-int opt_a = FALSE;             /* dump tables and disassemble segments */
-int opt_b = FALSE;             /* dump straight binary */
-int opt_d = FALSE;             /* dump the data segment */
-int opt_f = FALSE;             /* first address of dump */
-int opt_h = FALSE;             /* dump the header structure */
-int opt_l = FALSE;             /* last address of dump */
-int opt_m = FALSE;             /* dump the rom segment */
-int opt_n = FALSE;             /* dump the symbol names */
-int opt_r = FALSE;             /* dump the relocation structures */
-int opt_s = FALSE;             /* dump the symbol table */
-int opt_t = FALSE;             /* dump the text segment */
-int opt_u = FALSE;             /* dump the bss segment */
-int opt_x = FALSE;             /* debugging flag */
-
-char progname[BUFF_LEN];       /* program name */
-int dbglvl = 0;                        /* debugging level */
-
-struct a_sec {                 /* a.out section data */
-  char *name;                  /* section name */
-  int first;                   /* first index */
-  int last;                    /* last index */
-  int total;
-} a_sectab[] = {               /* all known a.out sections */
-  "undefined", 0, 0, 0,
-  "absolute", 0, 0, 0,
-  "text", 0, 0, 0,
-  "data", 0, 0, 0,
-  "bss", 0, 0, 0,
-  "common", 0, 0, 0,
-  "rom", 0, 0, 0,              /* this one is unknown */
-  (char *)NULL, 0, 0, 0
-};
-
-/* Forward declarations */
-unsigned long atoaddr(char *);                 /* Convert ascii hex/dec to unsigned long */
-int binary(unsigned char, char*);              /* Binary output of 8-bit number */
-int dump_ahdr(struct exec *ep);                        /* Dump an a.out file header */
-int dump_adata(FILE *fp, int start, int count);        /* Dump an a.out file data section */
-int dump_asym(struct nlist *np, int start, int count); /* Dump an a.out file symbol table */
-int dump_hex(FILE *fp, int start, int count);  /* Dump bytes in hex and ascii */
-int find_asym(long value, int section);                /* Find an a.out symbol */
-int gen_locsym(FILE *fp, int sec);             /* Generate local symbols */
-int init_aout(FILE *fp);                       /* Initialise the a.out file tables */
-void usage(void);                              /* Usage message */
-
-
-/*
- * a t o a d d r
- *
- * Convert ascii hex/dec to unsigned long.
- *
- * Returns:    Conversion result       Always
- */
-unsigned long atoaddr(char *sp)
-{
-  char c, *cp, buff[S_BUFF_LEN];
-  int j;
-  unsigned long int result = 0;
-
-  /* flip to upper */
-  for (j = 0 ; j < S_BUFF_MAX && *(sp + j) != '\0' ; j++)
-       buff[j] = toupper(*(sp + j));
-  buff[j] = '\0';
-
-  /* lose leading whitespace */
-  cp = buff;
-  while isspace(*cp)
-       cp++;
-
-  /* check for hexadecimal entry */
-  if (*cp == '0' && *(cp + 1) == 'X') {
-       cp += 2;
-       while (isxdigit(*cp)) {
-               c = *cp++;
-               j = (c < 'A') ? c - '0' : c - 'A' + 10;
-               result = (result << 4) + (c < 'A' ? c - '0' : c - 'A' + 10);
-       }
-  }
-  else
-       result = atol(buff);
-
-  return result;
-}
-
-
-/*
- * b i n a r y
- *
- * Produce a binary representation of an 8-bit number.
- *
- * Returns:    0       Always
- */
-int binary(unsigned char uc, char *sp)
-{
-  int j;
-  unsigned char k;
-
-  for (k = 0x80, j = 0 ; j < 8 ; j++) {
-       if ((uc & k) == 0) *sp++ = '0';
-       else *sp++ = '1';
-       if (j == 3) *sp++ = '$';
-       k >>= 1;
-  }
-  *sp = '\0';
-
-  return(0);
-}
-
-
-/*
- * d u m p _ a h d r
- *
- * Dump an a.out file header.
- *
- * Returns:    OK      Always
- */
-int dump_ahdr(struct exec *ep)
-{
-  char buff[BUFF_LEN];
-
-  fprintf(stdout, "Magic number is:             0x%02x%02x\n",
-               ep->a_magic[0], ep->a_magic[1]);
-  sprintf(buff, "Flags are:                   0x%02x", ep->a_flags);
-  if (ep->a_flags & A_UZP) strcat(buff, " A_UZP");
-  if (ep->a_flags & A_PAL) strcat(buff, " A_PAL");
-  if (ep->a_flags & A_NSYM) strcat(buff, " A_NSYM");
-  if (ep->a_flags & A_EXEC) strcat(buff, " A_EXEC");
-  if (ep->a_flags & A_SEP) strcat(buff, " A_SEP");
-  if (ep->a_flags & A_PURE) strcat(buff, " A_PURE");
-  if (ep->a_flags & A_TOVLY) strcat(buff, " A_TOVLY");
-  if (ep->a_flags & ~(A_UZP | A_PAL | A_NSYM | A_EXEC | A_SEP | A_PURE | A_TOVLY))
-       strcat(buff, " UNKNOWN");
-  fprintf(stdout, "%s\n", buff);
-
-  sprintf(buff, "CPU type is:                 0x%02x", ep->a_cpu);
-  if (ep->a_cpu == A_NONE) strcat(buff, " A_NONE");
-  else if (ep->a_cpu == A_I8086) strcat(buff, " A_I8086");
-  else if (ep->a_cpu == A_M68K) strcat(buff, " A_M68K");
-  else if (ep->a_cpu == A_NS16K) strcat(buff, " A_NS16K");
-  else if (ep->a_cpu == A_I80386) strcat(buff, " A_I80386");
-  else if (ep->a_cpu == A_SPARC) strcat(buff, " A_SPARC");
-  else strcat(buff, " UNKNOWN");
-  fprintf(stdout, "%s\n", buff);
-
-  fprintf(stdout, "Byte order is:               %s\n",
-               A_BLR(ep->a_cpu) ? "left to right" : "right to left");
-  fprintf(stdout, "Word order is:               %s\n",
-               A_WLR(ep->a_cpu) ? "left to right" : "right to left");
-
-  fprintf(stdout, "Header length is:            0x%02x\n", ep->a_hdrlen);
-  fprintf(stdout, "Reserved byte is:            0x%02x\n", ep->a_unused);
-  fprintf(stdout, "Version stamp is:            0x%04x\n", ep->a_version);
-  fprintf(stdout, "Size of text segment is:     0x%08.8x\n", ep->a_text);
-  fprintf(stdout, "Size of data segment is:     0x%08.8x\n", ep->a_data);
-  fprintf(stdout, "Size of bss segment is:      0x%08.8x\n", ep->a_bss);
-  fprintf(stdout, "Entry point is:              0x%08.8x\n", ep->a_entry);
-  fprintf(stdout, "Total memory allocated is:   0x%08.8x\n", ep->a_total);
-  fprintf(stdout, "Size of symbol table is:     0x%08.8x bytes, %d entries\n",
-               ep->a_syms, ep->a_syms / sizeof(struct nlist));
-
-  /* SHORT FORM ENDS HERE */
-#if 0
-  fprintf(stdout, "Size of text relocation is 0x%08.8x\n", ep->a_trsize);
-  fprintf(stdout, "Size of data relocation is 0x%08.8x\n", ep->a_drsize);
-  fprintf(stdout, "Base of text relocation is 0x%08.8x\n", ep->a_tbase);
-  fprintf(stdout, "Base of data relocation is 0x%08.8x\n", ep->a_dbase);
-#endif
-
-  return(OK);
-}
-
-
-/*
- * d u m p _ a d a t a
- *
- * Dump an a.out data section.
- *
- * Returns:    OK      Success
- *             FAILED  File read failure, invalid arguments
- *
- * The a_hdrbuf structure is read to determine section addresses.
- * The a_symtab structure is read to determine symbol names (if available).
- */
-int dump_adata(FILE *fp, int start, int count)
-{
-  char label[S_BUFF_LEN], data[S_BUFF_LEN], buff[BUFF_LEN];
-  char *hex = "0123456789ABCDEF";
-  int j, k, newflg, index, last, status, found, quit;
-  long int addr;
-  unsigned long int ulj;
-  struct locname *np;
-
-  if (start < 0 || (start + count) > (A_SYMPOS(a_hdrbuf) - a_hdrbuf.a_hdrlen))
-       return(FAILED);
-
-  ulj = start;
-  quit = FALSE;
-  status = OK;
-  for (addr = start ; addr < (start + count) ; addr += 16) {
-       /* get a line's worth of data */
-       for (j = 0 ; j < 16 ; j++) {
-               if (j == (start + count - addr)) {
-                       quit = TRUE;
-                       break;
-               }
-               if ((k = fgetc(fp)) == EOF) {
-                       status = FAILED;
-                       quit = TRUE;
-                       break;
-               }
-               data[j] = (char)k;
-       }
-
-       /* adjust for an unexpected EOF */
-       if (quit && status == FAILED) {
-               if (j == 0)
-                       break;
-               else
-                       j--;
-       }
-       last = j;
-
-       /* write out the address and clear the rest of the buffer */
-       sprintf(buff, "%06lx", ulj);
-       for (k = strlen(buff) ; k < BUFF_MAX ; k++)
-               buff[k] = ' ';
-
-       /* build the hex and ascii data representations */
-       newflg = TRUE;
-       found = FALSE;
-       for (j = 0 ; j < last ; j++ ) {
-
-               /* find a local symbol, one per address */
-               for (np = locsym[DATA] ; !found && np != (struct locname *)NULL ;
-                                                                       np = np->l_next) {
-                       if (ulj == np->l_value) {
-                               /* write out any outstanding data */
-                               if (j != 0) {
-                                       buff[75] = '\0';
-                                       fprintf(stdout, "%s\n", buff);
-                                       for (k = 8 ; k < 75 ; k++)
-                                               buff[k] = ' ';
-                               }
-                               /* write out the symbol name */
-                               for (k = 0 ; k < 8 ; k++)
-                                       label[k] = np->l_name[k];
-                               label[k] = '\0';
-                               fprintf(stdout, "%s\n", label);
-                               found = TRUE;
-                       }
-               }
-
-               /* find any global symbols, several per address */
-               while (!found && (index = find_asym(ulj, N_DATA)) != -1) {
-                       /* for the first symbol, write out any outstanding data */
-                       if (newflg && j != 0) {
-                               buff[75] = '\0';
-                               fprintf(stdout, "%s\n", buff);
-                               for (k = 8 ; k < 75 ; k++)
-                                       buff[k] = ' ';
-                               newflg = FALSE;
-                       }
-                       /* write out the symbol name */
-                       for (k = 0 ; k < 8 ; k++)
-                               label[k] = a_symtab[index].n_name[k];
-                       label[k] = '\0';
-                       /* for some reason, some table entries are empty */
-                       if (label[0] != '\0') fprintf(stdout, "%s\n", label);
-               }
-
-               /* set up for the next pass */
-               newflg = TRUE;
-               found = FALSE;
-               ulj++;
-               /* hex digits */
-               buff[8 + (3 * j) + (j < 8 ? 0 : 2)] = hex[(data[j] >> 4) & 0x0f];
-               buff[9 + (3 * j) + (j < 8 ? 0 : 2)] = hex[data[j] & 0x0f];
-               /* ascii conversion */
-               if (data[j] < 32 || data[j] > 127)
-                       buff[59 + j] = '.';
-               else
-                       buff[59 + j] = data[j];
-               if (j == 8)
-                       buff[32] = '-';
-       }
-       buff[75] = '\0';
-
-       /* write out the result */
-       fprintf(stdout, "%s\n", buff);
-
-       if (quit) break;
-  }
-
-  return(status);
-}
-
-
-/*
- * d u m p _ a s y m
- *
- * Dump an a.out file symbol table.
- *
- * Returns:    OK      Success
- *             FAILED  Invalid arguments
- *
- * The a_hdrbuf structure is read to determine section addresses.
- */
-int dump_asym(struct nlist *np, int start, int count)
-{
-  char buff[BUFF_LEN], data[S_BUFF_LEN];
-  unsigned char uc;
-  int j, k;
-
-  if (start < 0 || (start + count) > (a_hdrbuf.a_syms / sizeof(struct nlist)))
-       return(FAILED);
-
-  for (j = start ; j < (start + count) ; j++) {
-       sprintf(buff, "%-4d ", j);
-       for (k = 0 ; k < SYMLEN ; k++)
-               data[k] = (np[j].n_name[k] == '\0') ? ' ' : np[j].n_name[k];
-       data[k] = '\0';
-       strcat(buff, data);
-       sprintf(data, " Val: 0x%08x", np[j].n_value);
-       strcat(buff, data);
-       sprintf(data, " Sto: 0x%02x", np[j].n_sclass);
-       strcat(buff, data);
-       uc = np[j].n_sclass;
-       if ((uc & N_SECT) == N_UNDF) strcat(buff, " N_UNDF");
-       else if ((uc & N_SECT) == N_ABS) strcat(buff, " N_ABS ");
-       else if ((uc & N_SECT) == N_TEXT) strcat(buff, " N_TEXT");
-       else if ((uc & N_SECT) == N_DATA) strcat(buff, " N_DATA");
-       else if ((uc & N_SECT) == N_BSS) strcat(buff, " N_BSS ");
-       else if ((uc & N_SECT) == N_COMM) strcat(buff, " N_COMM");
-       else strcat(buff, " UNKNOWN");
-       if ((uc & N_CLASS) == 0) strcat(buff, " C_NULL");
-       else if ((uc & N_CLASS) == C_EXT) strcat(buff, " C_EXT ");
-       else if ((uc & N_CLASS) == C_STAT) strcat(buff, " C_STAT");
-       else strcat(buff, " UNKNOWN");
-       sprintf(data, " Aux: 0x%02x", np[j].n_numaux);
-       strcat(buff, data);
-       sprintf(data, " Typ: 0x%04x", np[j].n_type);
-       strcat(buff, data);
-       fprintf(stdout, "%s\n", buff);
-  }
-
-  return(OK);
-}
-
-
-/*
- * d u m p _ h e x
- *
- * Dump bytes in hex and ascii.
- *
- * Returns:    OK      Success
- *             FAILED  File read failure, invalid arguments
- */
-int dump_hex(FILE *fp, int start, int count)
-{
-  char c, buff[S_BUFF_LEN];
-  int j, k, status, quit, last;
-  unsigned long int ulj;
-
-  if (start < 0)
-       return(FAILED);
-
-  ulj = 0;
-  quit = FALSE;
-  status = OK;
-  while (TRUE) {
-       /* get 16 bytes of data */
-       for (j = 0 ; j < 16 ; j++) {
-               if ((k = fgetc(fp)) == EOF) {
-                       quit = TRUE;
-                       break;
-               }
-               else
-                       buff[j] = (char)k;
-       }
-
-       /* set up to dump any remaining data */
-       if (quit) {
-               status = FAILED;
-               if (j == 0)
-                       break;
-               else
-                       j--;
-       }
-       last = j;
-
-       /* print the address */
-       fprintf(stdout, "%06lx ", start + ulj);
-       ulj += 16;
-       if (ulj >= count) {
-               quit = TRUE;
-               if (last == 16)
-                       last = (count - 1) % 16;
-       }
-
-       /* print a line of hex data */
-       for (j = 0 ; j < 16 ; j++ ) {
-               if (j <= last)
-                       fprintf(stdout, " %02x", buff[j] & 0xff);
-               else
-                       fprintf(stdout, "   ");
-               if (j == 7)
-                       fprintf(stdout, " -");
-       }
-
-       /* print a trailer of ascii data */
-       fprintf(stdout, "  ");
-       for (j = 0 ; j < 16 ; j++ ) {
-               if (j <= last)
-                       c = buff[j];
-               else
-                       c = ' ';
-               if (c < 32 || c > 127)
-                       c = '.';
-               (void) fputc(c, stdout);
-       }
-
-       fprintf(stdout, "\n");
-       if (quit)
-               break;
-  }
-
-  return(status);
-}
-
-
-/*
- * f i n d _ a s y m
- *
- * Find an a.out symbol index in a sorted list.
- * There may be several symbols with the same value:
- * return the first in the sequence.
- *
- * Returns:    index           Success
- *             -1              Failure
- *
- * The a_sectab structure is read to determine section indices.
- * The a_symtab structure is read to determine symbol names.
- */
-int find_asym(long value, int sec)
-{
-  static int index = 0;
-  static long oldval = 0;
-  static int oldsec = 0;
-  int j;
-
-  /* check for a repeated search */
-  if (value != oldval || sec != oldsec) {
-       oldval = value;
-       oldsec = sec;
-       index = a_sectab[sec].first;
-  }
-  /* never happen */
-  else if (index == -1)
-       return(FAILED);
-
-  /* do a linear search for a symbol, since repeated searches may be needed */
-  for (j = index ; j < a_sectab[sec].last ; j++) {
-       if (value == a_symtab[j].n_value)
-               break;
-  }
-
-  /* set up the index for the next pass */
-  if (j == a_sectab[sec].last) {
-       index = a_sectab[sec].first;
-       return(-1);
-  }
-  else {
-       index = j + 1;
-       return(j);
-  }
-  /* NOTREACHED */
-}
-
-
-/*
- * g e n _ l o c s y m
- *
- * Generate local symbols.
- *
- * Returns:    OK      Success
- *             FAILED  Invalid arguments, malloc failure
- *
- * This works only for data and bss segments.  Text symbols need
- * a disassembly of the text section, and intelligent guesses as
- * to whether a local address refers to text or data.  In fact,
- * this routine is hardwired to the data area, and the bss area
- * is ignored.
- */
-int gen_locsym(FILE *fp, int sec)
-{
-  char data[20];
-  int j, txtflg, hdrflg;
-  long int addrcount;
-  struct locname *np, *current;
-
-  /* check that all offsets are valid - this routine won't work for text */
-  if (sec < ROM || sec > BSS) {
-       fprintf(stderr, "Invalid section %s\n", a_sectab[sec & 7].name);
-       return(FAILED);
-  }
-
-  /* initialise the label string */
-  strncpy(data, ".DAT", 4);
-  data[4] = '\0';
-
-  /* initialise the in-memory local name table pointers */
-  current = (struct locname *)(NULL);
-
-  /* read the data area and load the symbols */
-  (void) fseek(aoutfp, A_DATAPOS(a_hdrbuf), SEEK_SET);
-  addrcount = 0;
-  txtflg = hdrflg = FALSE;
-  while (addrcount < a_hdrbuf.a_data) {
-       j = fgetc(fp);
-       if (j < 040 || j > 0177) {
-               txtflg = FALSE;
-               hdrflg = FALSE;
-       }
-       else
-               txtflg = TRUE;
-
-       /* ensure that the start of each apparent string has a related symbol */
-       if (txtflg && !hdrflg) {
-               if (find_asym(addrcount, sec) == -1) {
-                       /* if malloc fails, just collapse */
-                       if ((np = (struct locname *)malloc(sizeof(struct locname)))
-                                       == (struct locname *)NULL) {
-                               fprintf(stderr, "%s: malloc failed\n", progname);
-                               return(FAILED);
-                       }
-                       /* update the current record */
-                       sprintf(np->l_name, "%s%04x", data,
-                                       (a_hdrbuf.a_text + addrcount) & 0xffff);
-                       /* nb. must follow l_name update */
-                       if (sec == TEXT) np->l_sclass = S_TEXT & 0xff;
-                       else if (sec == ROM) np->l_sclass = S_DATA & 0xff;
-                       else if (sec == DATA) np->l_sclass = S_DATA & 0xff;
-                       else if (sec == BSS) np->l_sclass = S_BSS & 0xff;
-                       else sec = 0;
-                       np->l_value = a_hdrbuf.a_text + addrcount;
-                       np->l_next = (struct locname *)NULL;
-                       /* and add it to the list */
-                       if (current == (struct locname *)NULL)
-                               locsym[sec] = np;
-                       else
-                               current->l_next = np;
-                       current = np;
-               }
-               hdrflg = TRUE;
-       }
-       addrcount++;
-  }
-
-  return(OK);
-}
-
-
-/*
- * i n i t _ a o u t
- *
- * Initialise the a.out file tables.
- *
- * Returns:    OK      Success
- *             FAILED  File read failure
- *
- * The a_hdrbuf and a_symtab and a_sectab structures are
- * all initialised here.  Also, the ability to read the
- * entire file is checked; no read checking is done
- * later in the program.
- */
-int init_aout(FILE *fp)
-{
-  char *cp;
-  int j, k, maxsym;
-  struct nlist *np;
-  struct nlist ntmp;
-
-  /* load the header into memory for fast access.
-   * the header length is the fifth byte of the header.
-   */
-  cp = (char *)&a_hdrbuf;
-  if (fread(cp, sizeof(char), 5, aoutfp) != 5) {
-       fprintf(stderr, "Cannot read executable header.\n");
-       return(FAILED);
-  }
-  j = cp[4] - 5;
-  cp += 5;
-  if (fread(cp, sizeof(char), j, aoutfp) != j) {
-       fprintf(stderr, "Cannot read executable header.\n");
-       return(FAILED);
-  }
-  if(BADMAG(a_hdrbuf)) {
-       fprintf(stderr, "%s: bad magic number.\n", progname);
-       return(FAILED);
-  }
-
-  /* check that the whole file can be read */
-  if (fseek(aoutfp, A_SYMPOS(a_hdrbuf) + a_hdrbuf.a_syms, SEEK_SET) != 0) {
-       fprintf(stderr, "%s: cannot seek to end of file.\n", progname);
-       return(FAILED);
-  }
-
-  /* load the symbol table into memory for fast access */
-  a_symtab = (struct nlist *)NULL;
-  if (a_hdrbuf.a_syms != 0) {
-       /* get space for the nlist data */
-       if ((cp = (char *)malloc(a_hdrbuf.a_syms)) == (char *)NULL) {
-               fprintf(stderr, "%s: malloc failed\n", progname);
-               return(FAILED);
-       }
-       if (fseek(aoutfp, -a_hdrbuf.a_syms, SEEK_CUR) != 0) {
-               fprintf(stderr, "%s: cannot seek to symbol area.\n", progname);
-               return(FAILED);
-       }
-       /* load the symbols into a sorted list */
-       np = (struct nlist *)cp;
-       maxsym = 0;
-       for (j = 0 ; j < a_hdrbuf.a_syms / sizeof(struct nlist) ; j++) {
-               if (fread(&ntmp, sizeof(struct nlist), 1, aoutfp) != 1) {
-                       fprintf(stderr, "%s: cannot read symbol area.\n", progname);
-                       return(FAILED);
-               }
-               /* insertion sort, by class and value */
-               for (k = maxsym ; k > 0 ; k--) {
-                       if ((ntmp.n_sclass & N_SECT) < (np[k-1].n_sclass & N_SECT))
-                               np[k] = np[k - 1];
-                       else if ((ntmp.n_sclass & N_SECT) == (np[k-1].n_sclass & N_SECT) &&
-                                       ntmp.n_value < np[k-1].n_value)
-                               np[k] = np[k - 1];
-                       else
-                               break;
-               }
-               np[k] = ntmp;
-               maxsym++;
-       }
-       /* finally, we have a valid symbol table */
-       a_symtab = (struct nlist *)cp;
-
-       /* update the symbol section index list */
-       a_sectab[a_symtab[0].n_sclass & N_SECT].first = 0;
-       for (j = 1 ; j < (a_hdrbuf.a_syms / sizeof(struct nlist)) ; j++) {
-               if ((a_symtab[j].n_sclass & N_SECT) != (a_symtab[j-1].n_sclass & N_SECT)) {
-                       a_sectab[a_symtab[j-1].n_sclass & N_SECT].last = j - 1;
-                       a_sectab[a_symtab[j-1].n_sclass & N_SECT].total =
-                               j - a_sectab[a_symtab[j-1].n_sclass & N_SECT].first;
-                       a_sectab[a_symtab[j].n_sclass & N_SECT].first = j;
-               }
-       }
-       a_sectab[a_symtab[j-1].n_sclass & N_SECT].last = j - 1;
-
-       /* build the local symbol tables */
-       for (j = 0 ; j < MAXSECT ; j++)
-               locsym[j] = (struct locname *)NULL;
-
-       /* build the local .text symbol table */
-       /* ### full disassembly ? */
-
-       /* build the local data symbol table */
-       if (gen_locsym(fp, DATA) == FAILED)
-               return(FAILED);
-  }
-
-  return(OK);
-}
-
-
-/*
- * m a i n
- *
- * Main routine of dis_a386.
- */
-int main(int argc, char *argv[])
-{
-  char *cp, binfile[BUFF_LEN], symbfile[BUFF_LEN];
-  int j, errors;
-  unsigned long int addrfirst, addrlast, addrcount;
-  struct stat statbuff;
-
-  /* initial set up */
-  if ((cp = strrchr(argv[0], PSEP)) == (char *)NULL)
-       cp = argv[0];
-  else
-       cp++;
-  strncpy(progname, cp, BUFF_MAX);
-  strncpy(binfile, AOUT, BUFF_MAX);
-  addrfirst = addrlast = addrcount = 0;
-
-  /* check for an MSDOS-style option */
-  if (argc == 2 && argv[1][0] == '/') {
-       usage();
-       exit(0);
-  }
-
-  /* parse arguments */
-  errors = opterr = 0;
-  while ((j = getopt(argc, argv, "E:abdf:hl:stx:")) != EOF) {
-       switch (j & 0177) {
-#if 0
-       case 'C':                       /* core file name */
-               opt_C = TRUE;
-               if (optarg != (char *)NULL)
-                       strncpy(binfile, optarg, BUFF_MAX);
-               else
-                       errors++;
-               break;
-#endif
-       case 'E':                       /* executable file name */
-               opt_E = TRUE;
-               if (optarg != (char *)NULL)
-                       strncpy(binfile, optarg, BUFF_MAX);
-               else
-                       errors++;
-               break;
-#if 0
-       case 'O':                       /* object file name */
-               opt_O = TRUE;
-               if (optarg != (char *)NULL)
-                       strncpy(binfile, optarg, BUFF_MAX);
-               else
-                       errors++;
-               break;
-       case 'S':                       /* symbol table name */
-               opt_S = TRUE;
-               if (optarg != (char *)NULL)
-                       strncpy(symbfile, optarg, BUFF_MAX);
-               else
-                       errors++;
-               break;
-#endif
-       case 'a':                       /* dump tables and disassemble segments */
-               opt_a = TRUE;
-               break;
-       case 'b':                       /* dump straight binary */
-               opt_b = TRUE;
-               break;
-       case 'd':                       /* dump the data segment */
-               opt_d = TRUE;
-               break;
-       case 'f':                       /* first address of dump */
-               opt_f = TRUE;
-               if (optarg != (char *)NULL)
-                       addrfirst = atoaddr(optarg);
-               else
-                       errors++;
-               break;
-       case 'h':                       /* dump the header */
-               opt_h = TRUE;
-               break;
-       case 'l':                       /* last address of dump */
-               opt_l = TRUE;
-               if (optarg != (char *)NULL)
-                       addrlast = atoaddr(optarg);
-               else
-                       errors++;
-               break;
-#if 0
-       case 'm':                       /* dump the rom segment */
-               opt_m = TRUE;
-               break;
-       case 'n':                       /* dump the symbol names */
-               opt_n = TRUE;
-               break;
-       case 'r':                       /* dump the relocation structures */
-               opt_r = TRUE;
-               break;
-#endif
-       case 's':                       /* dump the symbol table */
-               opt_s = TRUE;
-               break;
-       case 't':                       /* dump the text segment */
-               opt_t = TRUE;
-               break;
-#if 0
-       case 'u':                       /* dump the bss segment */
-               opt_u = TRUE;
-               break;
-#endif
-       case 'x':                       /* debugging flag */
-               opt_x = TRUE;
-               if (optarg != (char *)NULL)
-                       dbglvl = atoi(optarg);
-               break;
-       case '?':
-       default:
-               usage();
-               exit(1);
-               break;
-       }
-  }
-
-  /* check the flags */
-  if (errors > 0) {
-       usage();
-       exit(1);
-  }
-  if (opt_a && (opt_d || opt_h || opt_s || opt_t)) {
-       usage();
-       exit(1);
-  }
-  if ((opt_f || opt_l) && (addrlast != 0 && addrfirst > addrlast)) {
-       usage();
-       exit(1);
-  }
-
-  /* check for a specific input file */
-  if (optind < argc)
-       strncpy(binfile, argv[optind], BUFF_MAX);
-
-  /* we must have a binary file of some sort */
-  if ((aoutfp = fopen(binfile, "rb")) == (FILE *)NULL ||
-               stat(binfile, &statbuff) == -1) {
-       perror(binfile);
-       exit(1);
-  }
-
-  /* initialise the a.out data structures */
-  if (init_aout(aoutfp) == FAILED) {
-       perror(binfile);
-       exit(1);
-  }
-
-  /* show the output file name and date */
-  fprintf(stdout, "File name: %s\nFile date: %s",
-               binfile, ctime(&statbuff.st_ctime));
-
-  /* show the header section - default behaviour */
-  if (opt_a || opt_h || (!opt_d && !opt_s && !opt_t)) {
-       fprintf(stdout, "\nHeader data:\n");
-       (void) dump_ahdr(&a_hdrbuf);
-  }
-
-  /* dump the data section */
-  if (opt_d && opt_b) {
-       /* check that all offsets are valid */
-       if (addrfirst > a_hdrbuf.a_data || addrlast > a_hdrbuf.a_data) {
-               fprintf(stderr, "Invalid data address range 0x%08.8lu to 0x%08.8lu\n",
-                                                               addrfirst, addrlast);
-       }
-       else {
-               addrcount = (addrlast == 0) ? a_hdrbuf.a_data : addrlast;
-               addrcount -= addrfirst;
-               (void) fseek(aoutfp, A_DATAPOS(a_hdrbuf) + addrfirst, SEEK_SET);
-               fprintf(stdout, "\nData:\n");
-               (void) dump_hex(aoutfp, A_DATAPOS(a_hdrbuf) - a_hdrbuf.a_hdrlen + addrfirst,
-                                                               addrcount);
-       }
-  }
-
-  /* disassemble the data section */
-  if (opt_a || (opt_d && !opt_b)) {
-       /* check that all offsets are valid */
-       if (addrfirst > a_hdrbuf.a_data || addrlast > a_hdrbuf.a_data) {
-               fprintf(stderr, "Invalid data address range 0x%08.8lu to 0x%08.8lu\n",
-                                                               addrfirst, addrlast);
-       }
-       else {
-               addrcount = (addrlast == 0) ? a_hdrbuf.a_data : addrlast;
-               addrcount -= addrfirst;
-               (void) fseek(aoutfp, A_DATAPOS(a_hdrbuf) + addrfirst, SEEK_SET);
-               fprintf(stdout, "\nDisassembled data:\n");
-               (void) dump_adata(aoutfp, A_DATAPOS(a_hdrbuf) - a_hdrbuf.a_hdrlen
-                                                       + addrfirst, addrcount);
-       }
-  }
-
-  /* dump the text section */
-  if (opt_t && opt_b) {
-       /* check that all offsets are valid */
-       if (addrfirst > a_hdrbuf.a_text || addrlast > a_hdrbuf.a_text) {
-               fprintf(stderr, "Invalid text address range 0x%08.8lu to 0x%08.8lu\n",
-                                                               addrfirst, addrlast);
-       }
-       else {
-               addrcount = (addrlast == 0) ? a_hdrbuf.a_text : addrlast;
-               addrcount -= addrfirst;
-               (void) fseek(aoutfp, A_TEXTPOS(a_hdrbuf) + addrfirst, SEEK_SET);
-               fprintf(stdout, "\nText:\n");
-               (void) dump_hex(aoutfp, A_TEXTPOS(a_hdrbuf) - a_hdrbuf.a_hdrlen
-                                                       + addrfirst, addrcount);
-       }
-  }
-
-  /* disassemble the text section */
-  if (opt_a || (opt_t && !opt_b)) {
-       /* check that all offsets are valid */
-       if (addrfirst > a_hdrbuf.a_text || addrlast > a_hdrbuf.a_text) {
-               fprintf(stderr, "Invalid text address range 0x%08.8lu to 0x%08.8lu\n",
-                                                               addrfirst, addrlast);
-       }
-       else {
-               addrcount = (addrlast == 0) ? a_hdrbuf.a_text : addrlast;
-               addrcount -= addrfirst;
-               disfp = aoutfp;                 /* file to be disassembled */
-               objfp = (FILE *)NULL;           /* without relocation information */
-               (void) fseek(disfp, A_TEXTPOS(a_hdrbuf) + addrfirst, SEEK_SET);
-               fprintf(stdout, "\nDisassembled text:\n");
-               (void) dasm(addrfirst, addrcount);
-       }
-  }
-
-  /* show the symbol data */
-  if (opt_a || opt_s) {
-       fprintf(stdout, "\nSymbol data:\n");
-       if (a_hdrbuf.a_syms == 0)
-               fprintf(stdout, "No symbol table available.\n");
-       else
-               (void) dump_asym(a_symtab, 0, a_hdrbuf.a_syms / sizeof(struct nlist));
-  }
-
-  /* wrap up */
-  (void) fclose(aoutfp);
-
-  exit(0);
-  /* NOTREACHED */
-}
-
-
-/*
- * u s a g e
- *
- * Usage message.
- *
- * Returns:    Nothing         Always
- */
-void usage()
-{
-  fprintf(stderr, "Usage: %s [-a|-dhst] [-b] [-f #] [-l #] [-E executable]\n",
-               progname);
-}
-
-/*
- * EOF
- */
-
diff --git a/commands/dis386/diso.c b/commands/dis386/diso.c
deleted file mode 100644 (file)
index 4eb86ad..0000000
+++ /dev/null
@@ -1,1322 +0,0 @@
-/*
- * dis_o386: disassemble 386 object files.
- *
- * $Id: diso.c,v 1.1 1997/10/20 12:00:00 cwr Exp cwr $
- *
- * Written by C W Rose.
- */
-
-/* Version settings */
-#define MINIX
-#undef OS2
-#undef TEST
-
-#ifdef MINIX
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <a.out.h>
-#include <minix/ansi.h>
-#include <assert.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#undef S_ABS           /* used in a.out.h */
-#include "out.h"       /* ACK compiler output header */
-#undef EXTERN
-#define EXTERN
-#include "dis386.h"    /* dis386 header */
-#endif
-
-#ifdef OS2
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include </local/minix/minix/config.h>
-#include </local/minix/minix/const.h>
-#include </local/minix/a.out.h>
-#include </local/minix/ansi.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <io.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#undef S_ABS           /* used in a.out.h */
-#include "out.h"       /* ACK compiler output header */
-#undef EXTERN
-#define EXTERN
-#include "dis386.h"    /* dis386 header */
-#endif
-
-/* Standard defines */
-#define FALSE          0
-#undef TRUE
-#define TRUE           !FALSE
-#define FAILED         -1
-#define MAYBE          0
-#define OK             1
-#define SAME           0
-
-/* Local defines */
-#define L_BUFF_LEN     1024
-#define BUFF_LEN       256
-#define S_BUFF_LEN     20
-#define L_BUFF_MAX     (L_BUFF_LEN-1)
-#define BUFF_MAX       (BUFF_LEN-1)
-#define S_BUFF_MAX     (S_BUFF_LEN-1)
-#define PSEP           '\\'
-
-#define AOUT           "a.out" /* useful default file names */
-#define CORE           "core"
-#define OBJF           "test.o"
-#define STAB           "symbol.tab"
-#define LINE_LEN       16
-#define SYMLEN         8
-
-#define TEXT           0       /* section indices for locsym[] */
-#define ROM            1
-#define DATA           2
-#define BSS            3
-
-#ifndef lint
-static char *Version = "@(#) dis_o386.c $Revision: 1.1 $ $Date: 1997/10/20 12:00:00 $";
-#endif
-
-/* Global variables */
-int opt_C = FALSE;             /* core file name */
-int opt_E = FALSE;             /* executable file name */
-int opt_O = FALSE;             /* object file name */
-int opt_S = FALSE;             /* symbol table name */
-int opt_a = FALSE;             /* dump tables and disassemble segments */
-int opt_b = FALSE;             /* dump straight binary */
-int opt_d = FALSE;             /* dump the data segment */
-int opt_f = FALSE;             /* first address of dump */
-int opt_h = FALSE;             /* dump the header structure */
-int opt_l = FALSE;             /* last address of dump */
-int opt_m = FALSE;             /* dump the rom segment */
-int opt_n = FALSE;             /* dump the symbol names */
-int opt_r = FALSE;             /* dump the relocation structures */
-int opt_s = FALSE;             /* dump the symbol table */
-int opt_t = FALSE;             /* dump the text segment */
-int opt_u = FALSE;             /* dump the bss segment */
-int opt_x = FALSE;             /* debugging flag */
-
-char progname[BUFF_LEN];       /* program name */
-int dbglvl = 0;                        /* debugging level */
-
-/* Forward declarations */
-/* _PROTOTYPE(void usage, (void)); */
-unsigned long int atoaddr(char *sp);                   /* Convert ascii hex/dec to ulong */
-int dump_hex(FILE *fp, long s, long n);                        /* Dump bytes in hex and ascii */
-int dump_odata(FILE *fp, long s, long n, int sec);     /* Dump object file data section */
-int dump_ohdr(struct outhead *ph);                     /* Dump object file header */
-int dump_orel(FILE *fp, long s, long n);               /* Dump object file relocation section */
-int dump_osec(long b, long e, int sec, int flg);       /* Dump object file section */
-int dump_oshdr(FILE *fp, long s, long n);              /* Dump object file section headers */
-int dump_ostr(FILE *fp, long s, long n);               /* Dump object file string data */
-int dump_osym(FILE *fp, long s, long n);               /* Dump object file symbol table data */
-int find_osym(long val, int sec);                      /* Find object file symbol index */
-int gen_locsym(FILE *fp, int sec);                     /* Generate local symbols */
-int getstruct(FILE *fp, char *bp, char *s);            /* Get values from the input file */
-int init_objf(FILE *fp);                               /* Initialise object file tables */
-void usage(void);                                      /* Usage message */
-
-
-/*
- * a t o a d d r
- *
- * Convert ascii hex/dec to unsigned long.
- *
- * Returns:    Conversion result       Always
- */
-unsigned long int atoaddr(char *sp)
-{
-  char c, *cp, buff[S_BUFF_LEN];
-  int j;
-  unsigned long int result = 0;
-
-  /* flip to upper */
-  for (j = 0 ; j < S_BUFF_MAX && *(sp + j) != '\0' ; j++)
-       buff[j] = toupper(*(sp + j));
-  buff[j] = '\0';
-
-  /* lose leading whitespace */
-  cp = buff;
-  while isspace(*cp)
-       cp++;
-
-  /* check for hexadecimal entry */
-  if (*cp == '0' && *(cp + 1) == 'X') {
-       cp += 2;
-       while (isxdigit(*cp)) {
-               c = *cp++;
-               j = (c < 'A') ? c - '0' : c - 'A' + 10;
-               result = (result << 4) + (c < 'A' ? c - '0' : c - 'A' + 10);
-       }
-  }
-  else
-       result = atol(buff);
-
-  return result;
-}
-
-
-/*
- * d u m p _ h e x
- *
- * Dump bytes in hex and ascii.
- *
- * Returns:    OK      Success
- *             FAILED  File read failure, invalid arguments
- */
-int dump_hex(FILE *fp, long start, long count)
-{
-  char c, buff[S_BUFF_LEN];
-  int j, k, status, quit, last;
-  unsigned long int ulj;
-
-  if (start < 0)
-       return(FAILED);
-
-  ulj = 0;
-  quit = FALSE;
-  status = OK;
-  while (TRUE) {
-       /* get 16 bytes of data */
-       for (j = 0 ; j < 16 ; j++) {
-               if ((k = fgetc(fp)) == EOF) {
-                       quit = TRUE;
-                       break;
-               }
-               else
-                       buff[j] = (char)k;
-       }
-
-       /* set up to dump any remaining data */
-       if (quit) {
-               status = FAILED;
-               if (j == 0)
-                       break;
-               else
-                       j--;
-       }
-       last = j;
-
-       /* print the address */
-       fprintf(stdout, "%06lx ", start + ulj);
-       ulj += 16;
-       if (ulj >= count) {
-               quit = TRUE;
-               if (last == 16)
-                       last = (count - 1) % 16;
-       }
-
-       /* print a line of hex data */
-       for (j = 0 ; j < 16 ; j++ ) {
-               if (j <= last)
-                       fprintf(stdout, " %02x", buff[j] & 0xff);
-               else
-                       fprintf(stdout, "   ");
-               if (j == 7)
-                       fprintf(stdout, " -");
-       }
-
-       /* print a trailer of ascii data */
-       fprintf(stdout, "  ");
-       for (j = 0 ; j < 16 ; j++ ) {
-               if (j <= last)
-                       c = buff[j];
-               else
-                       c = ' ';
-               if (c < 32 || c > 127)
-                       c = '.';
-               fputc(c, stdout);
-       }
-
-       fprintf(stdout, "\n");
-       if (quit)
-               break;
-  }
-
-  return(status);
-}
-
-
-/*
- * d u m p _ o d a t a
- *
- * Dump object file data section.
- *
- * Returns:    OK      Success
- *             FAILED  File read failure, invalid arguments
- *
- * The o_hdrbuf and o_sectab structures are read to determine section addresses.
- * The o_symtab and o_strtab structures are read to determine symbol names.
- */
-int dump_odata(FILE *fp, long start, long count, int sec)
-{
-  char label[S_BUFF_LEN], data[S_BUFF_LEN], buff[BUFF_LEN];
-  char *hex = "0123456789ABCDEF";
-  int j, k, newflg, index, last, status, found, quit;
-  long int lj, addr;
-  unsigned long int ulj;
-  struct locname *np;
-
-  if (start < 0 || (start + count) > o_sectab[sec].os_flen)
-       return(FAILED);
-
-  ulj = start;
-  quit = FALSE;
-  status = OK;
-  for (addr = start ; addr < (start + count) ; addr += 16) {
-       /* get a line's worth of data */
-       for (j = 0 ; j < 16 ; j++) {
-               if (j == (start + count - addr)) {
-                       quit = TRUE;
-                       break;
-               }
-               if ((k = fgetc(fp)) == EOF) {
-                       status = FAILED;
-                       quit = TRUE;
-                       break;
-               }
-               data[j] = (char)k;
-       }
-
-       /* adjust for an unexpected EOF */
-       if (quit && status == FAILED) {
-               if (j == 0)
-                       break;
-               else
-                       j--;
-       }
-       last = j;
-
-       /* write out the address and clear the rest of the buffer */
-       sprintf(buff, "%06lx", ulj);
-       for (k = strlen(buff) ; k < BUFF_MAX ; k++)
-               buff[k] = ' ';
-
-       /* build the hex and ascii data representations */
-       newflg = TRUE;
-       found = FALSE;
-       for (j = 0 ; j < last ; j++ ) {
-
-               /* find a local symbol, one per address */
-               for (np = locsym[sec] ; !found && np != (struct locname *)NULL ;
-                                                                       np = np->l_next) {
-                       if (ulj == np->l_value) {
-                               /* write out any outstanding data */
-                               if (j != 0) {
-                                       buff[75] = '\0';
-                                       fprintf(stdout, "%s\n", buff);
-                                       for (k = 8 ; k < 75 ; k++)
-                                               buff[k] = ' ';
-                               }
-                               /* write out the symbol name */
-                               for (k = 0 ; k < 8 ; k++)
-                                       label[k] = np->l_name[k];
-                               label[k] = '\0';
-                               fprintf(stdout, "%s\n", label);
-                               found = TRUE;
-                       }
-               }
-
-               /* find any global symbols, several per address */
-               while (!found && (index = find_osym(ulj, sec)) != -1) {
-                       /* for the first symbol, write out any outstanding data */
-                       if (newflg && j != 0) {
-                               buff[75] = '\0';
-                               fprintf(stdout, "%s\n", buff);
-                               for (k = 8 ; k < 75 ; k++)
-                                       buff[k] = ' ';
-                               newflg = FALSE;
-                       }
-                       /* write out the symbol name */
-                       lj = o_symtab[index].on_foff - (long)OFF_CHAR(o_hdrbuf);
-                       for (k = 0 ; k < 8 ; k++)
-                               label[k] = *(o_strtab + lj + k);
-                       label[k] = '\0';
-                       fprintf(stdout, "%s\n", label);
-               }
-
-               /* set up for the next pass */
-               newflg = TRUE;
-               found = FALSE;
-               ulj++;
-               /* hex digits */
-               buff[8 + (3 * j) + (j < 8 ? 0 : 2)] = hex[(data[j] >> 4) & 0x0f];
-               buff[9 + (3 * j) + (j < 8 ? 0 : 2)] = hex[data[j] & 0x0f];
-               /* ascii conversion */
-               if (data[j] < 32 || data[j] > 127)
-                       buff[59 + j] = '.';
-               else
-                       buff[59 + j] = data[j];
-               if (j == 8)
-                       buff[32] = '-';
-       }
-       buff[75] = '\0';
-
-       /* write out the result */
-       fprintf(stdout, "%s\n", buff);
-
-       if (quit) break;
-  }
-
-  return(status);
-}
-
-
-/*
- * d u m p _ o h d r
- *
- * Dump object file header data.
- *
- * Returns:    OK      Always
- */
-int dump_ohdr(struct outhead *ph)
-{
-  char buff[BUFF_LEN];
-
-  sprintf(buff, "Magic number:          0x%04.4x", ph->oh_magic);
-  if (ph->oh_magic == O_MAGIC) strcat(buff, " O_MAGIC");
-  else strcat(buff, " UNKNOWN");
-  fprintf(stdout, "%s\n", buff);
-
-  fprintf(stdout, "Version stamp:         0x%04.4x\n", ph->oh_stamp);
-
-  sprintf(buff, "Format flags:          0x%04.4x", ph->oh_flags);
-  if (ph->oh_flags & HF_LINK) strcat(buff, " HF_LINK");
-  if (ph->oh_flags & HF_8086) strcat(buff, " HF_8086");
-  if (ph->oh_flags & ~(HF_LINK | HF_8086)) strcat(buff, " UNKNOWN");
-  fprintf(stdout, "%s\n", buff);
-
-  fprintf(stdout, "Number of sections:    0x%04.4x\n", ph->oh_nsect);
-  fprintf(stdout, "Number of relocations: 0x%04.4x\n", ph->oh_nrelo);
-  fprintf(stdout, "Number of symbols:     0x%04.4x\n", ph->oh_nname);
-  fprintf(stdout, "Sum of section sizes:  0x%08.8x\n", ph->oh_nemit);
-  fprintf(stdout, "Size of string area:   0x%08.8x\n", ph->oh_nchar);
-
-  return(OK);
-}
-
-
-/*
- * d u m p _ o r e l
- *
- * Dump object file relocation data.
- *
- * Returns:    OK      Success
- *             FAILED  Invalid arguments
- *
- * The o_hdrbuf and o_sectab structures are read to determine section addresses.
- * The o_symtab and o_strtab structures are read to determine symbol values.
- */
-int dump_orel(FILE *fp, long start, long count)
-{
-  char buff[BUFF_LEN], data[S_BUFF_LEN];
-  int j;
-  unsigned int uj;
-  long int lj;
-  struct outrelo relbuf;
-
-  if (start < 0 || (start + count) > o_hdrbuf.oh_nrelo)
-       return(FAILED);
-
-  for (j = 0 ; j < count ; j++) {
-       (void) getstruct(fp, (char *)&relbuf, SF_RELO);
-       sprintf(buff, "%04d Type:", j + start);
-       if (relbuf.or_type & RELO1) strcat(buff, " RELO1");
-       if (relbuf.or_type & RELO2) strcat(buff, " RELO2");
-       if (relbuf.or_type & RELO4) strcat(buff, " RELO4");
-       if (relbuf.or_type & RELPC) strcat(buff, " RELPC");
-       else strcat(buff, "      ");
-       if (relbuf.or_type & RELBR) strcat(buff, " RELBR");
-       if (relbuf.or_type & RELWR) strcat(buff, " RELWR");
-       if (relbuf.or_type & ~(RELO1 | RELO2 | RELO4 | RELPC | RELBR | RELWR))
-               strcat(buff, "UNKNOWN");
-
-       strcat(buff, " Sect:");
-       uj = relbuf.or_sect & S_TYP;
-       if (uj >= S_MIN && uj <= S_MAX) {
-#if 1
-               /* use arbitrary names for Minix 386 */
-               sprintf(data, " %-5s", o_secnam[uj - S_MIN]);
-#else
-               sprintf(data, "  0x%02.2x", uj - S_MIN);
-#endif
-               strcat(buff, data);
-       }
-       /* S_UND is the empty S_TYP field */
-       if ((relbuf.or_sect & S_TYP) == S_UND) strcat(buff, " S_UND");
-       if ((relbuf.or_sect & S_TYP) == S_ABS) strcat(buff, " S_ABS");
-       if ((relbuf.or_sect & S_TYP) == S_CRS) strcat(buff, " S_CRS");
-
-       if ((relbuf.or_sect & S_EXT) == S_EXT) strcat(buff, " S_EXT");
-       else strcat(buff, "      ");
-
-       if (relbuf.or_sect & ~(S_TYP | S_EXT))
-               strcat(buff, " UNKNOWN");
-
-       strcat(buff, " Symb:");
-       if (relbuf.or_nami < o_hdrbuf.oh_nname) {
-               lj = o_symtab[relbuf.or_nami].on_foff - (long)OFF_CHAR(o_hdrbuf);
-               /* check that addressing isn't messed up */
-               assert(lj >= 0 && lj < o_hdrbuf.oh_nchar);
-               /* name size is defined by SZ_NAME */
-               sprintf(data, "%-13s", o_strtab + lj);
-       }
-       else
-               sprintf(data, " 0x%04.4x", relbuf.or_nami);
-       strcat(buff, data);
-       strcat(buff, " Addr:");
-       sprintf(data, " 0x%08.8x", relbuf.or_addr);
-       strcat(buff, data);
-       fprintf(stdout, "%s\n", buff);
-
-#if 0
-       printf("Type Section Symbol Address\n");
-       printf("0x%02.2x 0x%02.2x 0x%04.4x 0x%08.8x\n",
-               relbuf.or_type, relbuf.or_sect,
-               relbuf.or_nami, relbuf.or_addr);
-#endif
-  }
-
-  return(OK);
-}
-
-
-/*
- * d u m p _ o s e c
- *
- * Dump object file section.
- *
- * Returns:    OK      Success
- *             FAILED  Invalid arguments
- */
-int dump_osec(long addrfirst, long addrlast, int sec, int full)
-{
-  long int addrcount;
-
-  /* check that all offsets are valid */
-  addrcount = o_sectab[sec].os_flen;
-  if (addrfirst > o_sectab[sec].os_flen || addrlast > o_sectab[sec].os_flen) {
-       fprintf(stderr, "Invalid %s address range 0x%08.8lu to 0x%08.8lu\n",
-                                       o_secnam[sec], addrfirst, addrlast);
-       return(FAILED);
-  }
-  else {
-       if (opt_l)
-               addrcount = addrlast + 1;
-       addrcount = addrcount - addrfirst;
-       (void) fseek(objfp, o_sectab[sec].os_foff, SEEK_SET);
-       fprintf(stdout, "\n%s%s:\n", full ? "Disassembled " : "", o_secnam[sec]);
-       if (full)
-               (void) dump_odata(objfp, addrfirst, addrcount, sec);
-       else
-               (void) dump_hex(objfp, addrfirst, addrcount);
-       return(OK);
-  }
-  /* NOTREACHED */
-}
-
-
-/*
- * d u m p _ o s h d r
- *
- * Dump object file section headers.
- *
- * Returns:    OK      Always
- *
- * The o_secnam structure is read to determine section names.
- */
-int dump_oshdr(FILE *fp, long start, long count)
-{
-  int j;
-  struct outsect secbuf;
-
-  fprintf(stdout,
-       "Name          Index Core start Core size  File start File size  Alignment\n");
-  for (j = 0 ; j < count ; j++) {
-       (void) getstruct(fp, (char *)&secbuf, SF_SECT);
-       if (j >= start)
-               fprintf(stdout, "%-13s %4.4d  0x%08.8x 0x%08.8x 0x%08.8x 0x%08.8x 0x%08.8x\n",
-                       o_secnam[j], j, secbuf.os_base, secbuf.os_size, secbuf.os_foff,
-                       secbuf.os_flen, secbuf.os_lign);
-  }
-
-  return(OK);
-}
-
-
-/*
- * d u m p _ o s t r
- *
- * Dump object file string data.
- *
- * Returns:    OK      Success
- *             FAILED  File read failure, invalid arguments
- *
- * The o_hdrbuf structure is read to determine section addresses.
- */
-int dump_ostr(FILE *fp, long start, long count)
-{
-  int j, k;
-
-  if (start < 0 || count > o_hdrbuf.oh_nname)
-       return(FAILED);
-
-  /* we cannot precalculate the offset of a name record */
-  for (j = 0 ; j < count ; j++) {
-       fprintf(stdout, "%04d ", j + start);
-       do {
-               switch (k = fgetc(fp)) {
-               case EOF:
-                       return(FAILED);
-                       break;
-               case 0:
-                       fprintf(stdout, "\n");
-                       break;
-               default:
-                       fprintf(stdout, "%c", k);
-                       break;
-               }
-       } while (k);
-  }
-
-  return(OK);
-}
-
-
-/*
- * d u m p _ o s y m
- *
- * Dump object file symbol table data.
- *
- * Returns:    OK      Success
- *             FAILED  Invalid arguments
- *
- * The o_hdrbuf structure is read to determine section addresses.
- * The o_strtab and o_secnam structures are read to determine symbol values.
- */
-int dump_osym(FILE *fp, long start, long count)
-{
-  char buff[BUFF_LEN], data[S_BUFF_LEN];
-  int j;
-  unsigned int uj;
-  long lj;
-  struct outname nambuf;
-
-  if (start < 0 || (start + count) > o_hdrbuf.oh_nname)
-       return(FAILED);
-
-  for (j = 0 ; j < count ; j++) {
-       (void) getstruct(fp, (char *)&nambuf, SF_NAME);
-       sprintf(buff, "%4.4d", j + start);
-#if 1
-       lj = nambuf.on_foff - (long)OFF_CHAR(o_hdrbuf);
-       /* check that addressing isn't messed up */
-       assert(lj >= 0 && lj < o_hdrbuf.oh_nchar);
-       /* name size is defined by SZ_NAME */
-       sprintf(data, " %-13s", o_strtab + lj);
-       strcat(buff, data);
-#else
-       sprintf(data, " 0x%08.8x", nambuf.on_foff);
-       strcat(buff, data);
-#endif
-       strcat(buff, " Type:");
-       uj = nambuf.on_type & S_TYP;
-       if (uj >= S_MIN && uj <= S_MAX) {
-#if 1
-               /* use arbitrary names for Minix 386 */
-               sprintf(data, " %-5s", o_secnam[uj - S_MIN]);
-#else
-               sprintf(data, "  0x%02.2x", uj - S_MIN);
-#endif
-               strcat(buff, data);
-       }
-       /* S_UND is the empty S_TYP field */
-       if ((nambuf.on_type & S_TYP) == S_UND) strcat(buff, " S_UND");
-       if ((nambuf.on_type & S_TYP) == S_ABS) strcat(buff, " S_ABS");
-       if ((nambuf.on_type & S_TYP) == S_CRS) strcat(buff, " S_CRS");
-
-       if ((nambuf.on_type & S_EXT) == S_EXT) strcat(buff, " S_EXT");
-       else strcat(buff, "      ");
-
-       if ((nambuf.on_type & S_ETC) == S_SCT) strcat(buff, " S_SCT");
-       if ((nambuf.on_type & S_ETC) == S_LIN) strcat(buff, " S_LIN");
-       if ((nambuf.on_type & S_ETC) == S_FIL) strcat(buff, " S_FIL");
-       if ((nambuf.on_type & S_ETC) == S_MOD) strcat(buff, " S_MOD");
-       if ((nambuf.on_type & S_ETC) == S_COM) strcat(buff, " S_COM");
-       if ((nambuf.on_type & S_ETC) == 0) strcat(buff, "      ");
-
-       if (nambuf.on_type &
-               ~(S_TYP | S_EXT | S_SCT | S_LIN | S_FIL | S_MOD | S_COM))
-               strcat(buff, " UNKNOWN");
-
-#if 1
-       /* Desc is not used, so save space */
-       strcat(buff, " Desc: 0x00");
-#else
-       strcat(buff, " Desc:");
-       sprintf(data, " 0x%04.4x", nambuf.on_desc);
-       strcat(buff, data);
-#endif
-       strcat(buff, " Valu:");
-       sprintf(data, " 0x%08.8x", nambuf.on_valu);
-       strcat(buff, data);
-       fprintf(stdout, "%s\n", buff);
-  }
-#if 0
-  fprintf(stdout, "Name Type Debug Value\n");
-  fprintf(stdout, "0x%08.8x 0x%04.4x 0x%04.4x 0x%08.8x\n",
-               nambuf.on_u.on_off, nambuf.on_type,
-               nambuf.on_desc, nambuf.on_valu);
-#endif
-
-  return(OK);
-}
-
-
-/*
- * f i n d _ o s y m
- *
- * Find an object file symbol name in a unsorted list.
- *
- * Returns:    index   Found
- *             -1      Not found
- *
- * There may be several symbols with the same value:
- * return each of them on successive calls.
- *
- */
-int find_osym(long value, int sec)
-{
-  static int index = 0;
-  static long oldval = 0;
-  static int oldsec = 0;
-  int j;
-
-  /* check for a repeated search */
-  if (value != oldval || sec != oldsec) {
-       oldval = value;
-       oldsec = sec;
-       index = 0;
-  }
-  /* never happen */
-  else if (index == -1)
-       return(FAILED);
-
-  /* do a linear search for a symbol, as the symbol table is unsorted */
-  for (j = index ; j < o_hdrbuf.oh_nname ; j++) {
-       if (value == o_symtab[j].on_valu &&
-                       sec == ((o_symtab[j].on_type & S_TYP) - S_MIN))
-               break;
-  }
-
-  /* set up the index for the next pass */
-  if (j == o_hdrbuf.oh_nname)
-       index = 0;
-  else
-       index = j + 1;
-
- return(index - 1);
-}
-
-
-/*
- * g e n _ l o c s y m
- *
- * Generate local symbols.
- *
- * Returns:    OK      Success
- *             FAILED  Invalid arguments, malloc failure
- *
- * This works only for .data, .rom and .bss.  Text symbols need
- * a disassembly of the text section, and intelligent guesses as
- * to whether a local address refers to text or data.  In fact,
- * this routine can be usefully applied only to the .rom area.
- */
-int gen_locsym(FILE *fp, int sec)
-{
-  char data[20];
-  int j, txtflg, hdrflg;
-  long int addrcount;
-  struct locname *np, *current;
-
-  /* check that all offsets are valid - this routine won't work for text */
-  if (sec < ROM || sec > BSS) {
-       fprintf(stderr, "Invalid section %s\n", o_secnam[sec]);
-       return(FAILED);
-  }
-
-  /* initialise the label string */
-  strncpy(data, o_secnam[sec], 4);
-  data[4] = '\0';
-
-  /* initialise the in-memory local name table pointers */
-  current = (struct locname *)(NULL);
-
-  /* read the data area and load the symbols */
-  (void) fseek(fp, o_sectab[sec].os_foff, SEEK_SET);
-  addrcount = 0;
-  txtflg = hdrflg = FALSE;
-  while (addrcount < o_sectab[sec].os_flen) {
-       j = fgetc(fp);
-       if (j < 040 || j > 0177) {
-               txtflg = FALSE;
-               hdrflg = FALSE;
-       }
-       else
-               txtflg = TRUE;
-
-       /* ensure that the start of each apparent string has a related symbol */
-       if (txtflg && !hdrflg) {
-               if (find_osym(addrcount, sec) == -1) {
-                       /* if malloc fails, just collapse */
-                       if ((np = (struct locname *)malloc(sizeof(struct locname)))
-                                       == (struct locname *)NULL) {
-                               fprintf(stderr, "%s: malloc failed\n", progname);
-                               return(FAILED);
-                       }
-                       /* update the current record */
-                       sprintf(np->l_name, "%s%04x", data, addrcount & 0xffff);
-                       /* nb. must follow l_name update */
-                       if (sec == TEXT) np->l_sclass = S_TEXT & 0xff;
-                       else if (sec == ROM) np->l_sclass = S_DATA & 0xff;
-                       else if (sec == DATA) np->l_sclass = S_DATA & 0xff;
-                       else if (sec == BSS) np->l_sclass = S_BSS & 0xff;
-                       else sec = 0;
-                       np->l_value = addrcount;
-                       np->l_next = (struct locname *)NULL;
-                       /* and add it to the list */
-                       if (current == (struct locname *)NULL)
-                               locsym[sec] = np;
-                       else
-                               current->l_next = np;
-                       current = np;
-               }
-               hdrflg = TRUE;
-       }
-       addrcount++;
-  }
-
-  return(OK);
-}
-
-
-
-/*
- * g e t s t r u c t
- *
- * Returns:    0       Always
- *
- * Get 1, 2 and 4 byte values from the input file.
- *
- * Note that the bytes must be reordered and the
- * read pointer incremented correctly for each value;
- * hence the need for a structure format string.
- *
- * Called with:
- * a file destcriptor
- * a pointer to the output buffer
- * a structure format string
- */
-int getstruct(FILE *fp, char *bp, char *s)
-{
-  int j;
-  long lj;
-
-  while (TRUE) {
-       switch (*s++) {
-#if 0
-       /* not used */
-       case '0':
-               bp++;
-               continue;
-#endif
-       case '1':
-               *bp++ = (char) getc(fp);
-               continue;
-       case '2':
-               j = getc(fp);
-               j |= (getc(fp) << 8);
-               *((short *)bp) = (short) j;
-               bp += 2;
-               continue;
-       case '4':
-               lj = (long)getc(fp);
-               lj |= ((long)getc(fp) << 8);
-               lj |= ((long)getc(fp) << 16);
-               lj |= ((long)getc(fp) << 24);
-               *((long *)bp) = lj;
-               bp += 4;
-               continue;
-       default:
-               break;
-       }
-       break;
-  }
-
-  return(0);
-}
-
-
-/*
- * i n i t _ o b j f
- *
- * Initialise object file tables.
- *
- * Returns:    OK      Success
- *             FAILED  Otherwise
- */
-int init_objf(FILE *fp)
-{
-  char *cp;
-  int j;
-  unsigned int uj;
-  long int lj;
-
-  /* load the header into memory for fast access */
-  (void) getstruct(fp, (char *)&o_hdrbuf, SF_HEAD);
-  if (BADMAGIC(o_hdrbuf)) {
-       fprintf(stderr, "%s: bad magic number.\n", progname);
-       return(FAILED);
-  }
-  if (o_hdrbuf.oh_nsect == 0) {
-       fprintf(stderr, "%s: no sections present.\n", progname);
-       return(FAILED);
-  }
-
-  /* check that the whole file can be read */
-  if (fseek(fp, OFF_CHAR(o_hdrbuf) + o_hdrbuf.oh_nchar, SEEK_SET) != 0) {
-       fprintf(stderr, "%s: cannot seek to end of file.\n", progname);
-       return(FAILED);
-  }
-
-  /* load the section data into memory for fast access */
-  uj = o_hdrbuf.oh_nsect * sizeof(struct outsect);
-  if (fseek(fp, OFF_SECT(o_hdrbuf), SEEK_SET) != 0) {
-       fprintf(stderr, "%s: cannot seek to section area.\n", progname);
-       return(FAILED);
-  }
-  if (fread(o_sectab, sizeof(char), uj, fp) != uj) {
-       fprintf(stderr, "%s: cannot read section area.\n", progname);
-       return(FAILED);
-  }
-
-  /* load the relocation data into memory for fast access */
-  /* ### Should this be left on disk and only the indices loaded ? */
-  uj = o_hdrbuf.oh_nrelo * sizeof(struct outrelo);
-  if (fseek(fp, OFF_RELO(o_hdrbuf), SEEK_SET) != 0) {
-       fprintf(stderr, "%s: cannot seek to relocation area.\n", progname);
-       return(FAILED);
-  }
-  if ((cp = (char *)malloc(uj)) == (char *)NULL) {
-       fprintf(stderr, "%s: malloc failed\n", progname);
-       return(FAILED);
-  }
-  if (fread(cp, sizeof(char), uj, fp) != uj) {
-       fprintf(stderr, "%s: cannot read relocation area.\n", progname);
-       return(FAILED);
-  }
-  /* initialise the in-memory relocation table array pointers */
-  o_reltab = (struct outrelo *)cp;
-
-  /* ### needs to be optional for files without symbol tables */
-  /* load the symbol table into memory for fast access */
-  uj = o_hdrbuf.oh_nname * sizeof(struct outname);
-  if ((cp = (char *)malloc(uj)) == (char *)NULL) {
-       fprintf(stderr, "%s: malloc failed\n", progname);
-       return(FAILED);
-  }
-  if (fseek(fp, OFF_NAME(o_hdrbuf), SEEK_SET) != 0) {
-       fprintf(stderr, "%s: cannot seek to symbol area.\n", progname);
-       return(FAILED);
-  }
-  if (fread(cp, sizeof(char), uj, fp) != uj) {
-       fprintf(stderr, "%s: cannot read symbol area.\n", progname);
-       return(FAILED);
-  }
-  /* initialise the in-memory symbol table array pointers */
-  o_symtab = (struct outname *)cp;
-
-  /* load the string area into memory for fast access */
-  uj = (unsigned int)o_hdrbuf.oh_nchar;
-  if ((o_strtab = (char *)malloc(uj)) == (char *)NULL) {
-       fprintf(stderr, "%s: malloc failed\n", progname);
-       return(FAILED);
-  }
-  if (fseek(fp, OFF_CHAR(o_hdrbuf), SEEK_SET) != 0) {
-       fprintf(stderr, "%s: cannot seek to string area.\n", progname);
-       return(FAILED);
-  }
-  if (fread(o_strtab, sizeof(char), uj, fp) != uj) {
-       fprintf(stderr, "%s: cannot read string area.\n", progname);
-       return(FAILED);
-  }
-
-  /* build the section name table */
-  for (j = 0 ; j < o_hdrbuf.oh_nname ; j++) {
-       if ((o_symtab[j].on_type & S_ETC) == S_SCT) {
-               lj = o_symtab[j].on_foff - (long)OFF_CHAR(o_hdrbuf);
-               /* check that addressing isn't messed up */
-               assert(lj >= 0 && lj < o_hdrbuf.oh_nchar);
-               strncpy(o_secnam[(o_symtab[j].on_type & S_TYP) - S_MIN],
-                               o_strtab + lj, SZ_NAME + 1);
-       }
-  }
-
-  /* build the local symbol tables */
-  for (j = 0 ; j < MAXSECT ; j++)
-       locsym[j] = (struct locname *)NULL;
-
-  /* build the local .text symbol table */
-  /* ### full disassembly ? */
-
-  /* build the local .rom symbol table */
-  if (gen_locsym(fp, ROM) == FAILED)
-       return(FAILED);
-
-  /* there's no point in building the .data and .bss tables */
-
-  return(OK);
-}
-
-
-/*
- * m a i n
- *
- * Main routine of dis_o386.
- */
-int main(int argc, char *argv[])
-{
-  char *cp, objfile[BUFF_LEN], symbfile[BUFF_LEN];
-  char table[MAXSECT*(SZ_NAME+2)];
-  int j, errors;
-  unsigned long int addrfirst, addrlast, addrcount;
-  struct stat statbuff;
-
-  /* initial set up */
-  if ((cp = strrchr(argv[0], PSEP)) == (char *)NULL)
-       cp = argv[0];
-  else
-       cp++;
-  strncpy(progname, cp, BUFF_MAX);
-  strncpy(objfile, OBJF, BUFF_MAX);
-  addrfirst = addrlast = addrcount = 0;
-
-  /* clear the in-core name tables */
-  o_strtab = (char *)NULL;
-  for (j = 0 ; j < MAXSECT ; j++)
-       o_secnam[j] = table + j * (SZ_NAME + 2);        /* nb. leading '_' */
-  for (j = 0 ; j < sizeof(table) ; j++) table[j] = '\0';
-
-  /* check for an MSDOS-style option */
-  if (argc == 2 && argv[1][0] == '/') {
-       usage();
-       exit(0);
-  }
-
-  /* parse arguments */
-  errors = opterr = 0;
-  while ((j = getopt(argc, argv, "O:S:abdf:hl:mnrstx:")) != EOF) {
-       switch (j & 0177) {
-#if 0
-       case 'C':                       /* core file name */
-               opt_C = TRUE;
-               if (optarg != (char *)NULL)
-                       strncpy(binfile, optarg, BUFF_MAX);
-               else
-                       errors++;
-               break;
-       case 'E':                       /* executable file name */
-               opt_E = TRUE;
-               if (optarg != (char *)NULL)
-                       strncpy(binfile, optarg, BUFF_MAX);
-               else
-                       errors++;
-               break;
-#endif
-       case 'O':                       /* object file name */
-               opt_O = TRUE;
-               if (optarg != (char *)NULL)
-                       strncpy(objfile, optarg, BUFF_MAX);
-               else
-                       errors++;
-               break;
-       case 'S':                       /* symbol table name */
-               opt_S = TRUE;
-               if (optarg != (char *)NULL)
-                       strncpy(symbfile, optarg, BUFF_MAX);
-               else
-                       errors++;
-               break;
-       case 'a':                       /* dump tables and disassemble segments */
-               opt_a = TRUE;
-               break;
-       case 'b':                       /* dump straight binary */
-               opt_b = TRUE;
-               break;
-       case 'd':                       /* dump the data segment */
-               opt_d = TRUE;
-               break;
-       case 'f':                       /* first address of dump */
-               opt_f = TRUE;
-               if (optarg != (char *)NULL) {
-                       addrfirst = atoaddr(optarg);
-               }
-               else
-                       errors++;
-               break;
-       case 'h':                       /* dump the header */
-               opt_h = TRUE;
-               break;
-       case 'l':                       /* last address of dump */
-               opt_l = TRUE;
-               if (optarg != (char *)NULL) {
-                       addrlast = atoaddr(optarg);
-               }
-               else
-                       errors++;
-               break;
-       case 'm':                       /* dump the rom segment */
-               opt_m = TRUE;
-               break;
-       case 'n':                       /* dump the symbol names */
-               opt_n = TRUE;
-               break;
-       case 'r':                       /* dump the relocation structures */
-               opt_r = TRUE;
-               break;
-       case 's':                       /* dump the symbol table */
-               opt_s = TRUE;
-               break;
-       case 't':                       /* dump the text segment */
-               opt_t = TRUE;
-               break;
-#if 0
-       case 'u':                       /* dump the bss segment */
-               opt_u = TRUE;
-               break;
-#endif
-       case 'x':                       /* debugging flag */
-               opt_x = TRUE;
-               if (optarg != (char *)NULL)
-                       dbglvl = atoi(optarg);
-               break;
-       case '?':
-       default:
-               usage();
-               exit(1);
-               break;
-       }
-  }
-
-  /* check the flags */
-  if (errors > 0) {
-       usage();
-       exit(1);
-  }
-  if (opt_a && (opt_d || opt_h || opt_m || opt_n ||
-               opt_r || opt_s || opt_t)) {
-       usage();
-       exit(1);
-  }
-  if ((opt_f || opt_l) && (addrlast > 0  && addrfirst > addrlast)) {
-       usage();
-       exit(1);
-  }
-
-  /* check for a specific input file */
-  if (optind < argc)
-       strncpy(objfile, argv[optind], BUFF_MAX);
-
-  /* we must have a binary file of some sort */
-  if ((objfp = fopen(objfile, "rb")) == (FILE *)NULL ||
-               stat(objfile, &statbuff) == -1) {
-       perror(objfile);
-       exit(1);
-  }
-
-  /* initialise the object file data structures */
-  if (init_objf(objfp) == FAILED) {
-       perror(objfile);
-       exit(1);
-  }
-
-  /* show the output file name and date */
-  fprintf(stdout, "File name: %s\nFile date: %s",
-               objfile, ctime(&statbuff.st_ctime));
-
-  /* show the header and section data - default behaviour */
-  if (opt_a || opt_h || (!opt_d && !opt_m && !opt_n &&
-               !opt_r && !opt_s && !opt_t)) {
-       fprintf(stdout, "\nHeader data:\n");
-       (void) dump_ohdr(&o_hdrbuf);
-       fprintf(stdout, "\nSection data:\n");
-       (void) fseek(objfp, OFF_SECT(hdrbuf), SEEK_SET);
-       (void) dump_oshdr(objfp, 0, o_hdrbuf.oh_nsect);
-  }
-
-  /* The core start address is zero for every section.  What allowances
-   * should be made for the differences between file and core images?
-   */
-
-  /* dump or disassemble the rom section */
-  if (opt_a || opt_m) {
-       if (opt_b)
-               (void) dump_osec(addrfirst, addrlast, ROM, FALSE);
-       else
-               (void) dump_osec(addrfirst, addrlast, ROM, TRUE);
-  }
-
-  /* dump or disassemble the data section */
-  if (opt_a || opt_d) {
-       if (opt_b)
-               (void) dump_osec(addrfirst, addrlast, DATA, FALSE);
-       else
-               (void) dump_osec(addrfirst, addrlast, DATA, TRUE);
-  }
-
-  /* dump or disassemble the text section */
-  if (opt_a || opt_t) {
-       /* check that all offsets are valid */
-       if (addrfirst > o_sectab[TEXT].os_flen || addrlast > o_sectab[TEXT].os_flen) {
-               fprintf(stderr, "Invalid %s address range 0x%08.8lu to 0x%08.8lu\n",
-                                               "text", addrfirst, addrlast);
-       }
-       else {
-               if (opt_b)
-                       (void) dump_osec(addrfirst, addrlast, TEXT, FALSE);
-               else {
-                       addrcount = (addrlast == 0) ? o_sectab[TEXT].os_flen : addrlast;
-                       addrcount -= addrfirst;
-                       disfp = objfp;                  /* file to be disassembled */
-                       (void) fseek(disfp, o_sectab[TEXT].os_foff + addrfirst, SEEK_SET);
-                       fprintf(stdout, "\nDisassembled text:\n");
-                       (void) dasm(addrfirst, addrcount);
-               }
-       }
-  }
-
-  /* show the relocation data */
-  if (opt_a || opt_r) {
-       if (opt_b)
-               addrcount = o_hdrbuf.oh_nrelo * sizeof(struct outrelo);
-       else
-               addrcount = o_hdrbuf.oh_nrelo;
-       /* check that all offsets are valid */
-       if (addrfirst >= addrcount || addrlast >= addrcount) {
-               fprintf(stderr, "Invalid %s address range 0x%08.8lu to 0x%08.8lu\n",
-                               "relocation", addrfirst, addrlast);
-       }
-       else {
-               if (opt_l)
-                       addrcount = addrlast + 1;
-               addrcount = addrcount - addrfirst;
-               if (opt_b) {
-                       fprintf(stdout, "\nRelocation data dump:\n");
-                       (void) fseek(objfp, OFF_RELO(o_hdrbuf) + addrfirst, SEEK_SET);
-                       (void) dump_hex(objfp, addrfirst, addrcount);
-               }
-               else {
-                       fprintf(stdout, "\nRelocation data:\n");
-                       (void) fseek(objfp, OFF_RELO(o_hdrbuf) + addrfirst *
-                                       sizeof(struct outrelo), SEEK_SET);
-                       (void) dump_orel(objfp, addrfirst, addrcount);
-               }
-       }
-  }
-
-  /* show the symbol data */
-  if (opt_a || opt_s) {
-       if (opt_b)
-               addrcount = o_hdrbuf.oh_nname * sizeof(struct outname);
-       else
-               addrcount = o_hdrbuf.oh_nname;
-       /* check that all offsets are valid */
-       if (addrfirst >= addrcount || addrlast >= addrcount) {
-               fprintf(stderr, "Invalid %s address range 0x%08.8lu to 0x%08.8lu\n",
-                               "symbol", addrfirst, addrlast);
-       }
-       else {
-               if (opt_l)
-                       addrcount = addrlast + 1;
-               addrcount = addrcount - addrfirst;
-               if (opt_b) {
-                       fprintf(stdout, "\nSymbol data dump:\n");
-                       (void) fseek(objfp, OFF_NAME(o_hdrbuf) + addrfirst, SEEK_SET);
-                       (void) dump_hex(objfp, addrfirst, addrcount);
-               }
-               else {
-                       fprintf(stdout, "\nSymbol data:\n");
-                       (void) fseek(objfp, OFF_NAME(o_hdrbuf) + addrfirst *
-                                       sizeof(struct outname), SEEK_SET);
-                       (void) dump_osym(objfp, addrfirst, addrcount);
-               }
-       }
-  }
-
-  /* show the string data */
-  if (opt_a || opt_n) {
-       if (opt_b)
-               addrcount = o_hdrbuf.oh_nchar;
-       else
-               addrcount = o_hdrbuf.oh_nname;  /* assumes one name per symbol */
-       /* check that all offsets are valid */
-       if (addrfirst >= addrcount || addrlast >= addrcount) {
-               fprintf(stderr, "Invalid %s address range 0x%08.8lu to 0x%08.8lu\n",
-                               "symbol", addrfirst, addrlast);
-       }
-       else {
-               if (opt_l)
-                       addrcount = addrlast + 1;
-               addrcount = addrcount - addrfirst;
-               if (opt_b) {
-                       fprintf(stdout, "\nName data dump:\n");
-                       (void) fseek(objfp, OFF_CHAR(o_hdrbuf) + addrfirst, SEEK_SET);
-                       (void) dump_hex(objfp, addrfirst, addrcount);
-               }
-               else {
-                       fprintf(stdout, "\nName data:\n");
-                       (void) fseek(objfp, o_symtab[addrfirst].on_foff, SEEK_SET);
-                       (void) dump_ostr(objfp, addrfirst, addrcount);
-               }
-       }
-  }
-
-  /* wrap up */
-  fclose(objfp);
-
-  exit(0);
-}
-
-
-/*
- * u s a g e
- *
- * Usage message.
- *
- * Returns:    Nothing         Always
- */
-void usage()
-{
-  fprintf(stderr, "Usage: %s [-a|-dhmnrst] [-b] [-f #] [-l #] [-O objfile]\n",
-               progname);
-}
-
-
-/*
- * EOF
- */
-
diff --git a/commands/dis386/misc.c b/commands/dis386/misc.c
deleted file mode 100644 (file)
index 760d1cc..0000000
+++ /dev/null
@@ -1,937 +0,0 @@
-/*
- * misc.c: interface to Bruce Evan's dis86 package.
- *
- * $Id: misc.c,v 1.1 1997/10/20 12:00:00 cwr Exp cwr $
- *
- * Heavily modified by C W Rose.
- */
-
-/* Version settings */
-#define MINIX
-#undef OS2
-#undef TEST
-
-#include <sys/types.h>
-#ifdef MINIX
-#include <minix/config.h>
-#include <minix/const.h>
-#include <a.out.h>
-#endif
-#ifdef OS2
-typedef unsigned char u8_t;
-typedef unsigned int u16_t;
-typedef unsigned long u32_t;
-#include </local/minix/minix/config.h>
-#include </local/minix/minix/const.h>
-#include </local/minix/a.out.h>
-#endif
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "const.h"
-#include "type.h"
-#undef S_ABS                           /* clash with a.out.h */
-#include "out.h"                       /* ACK compiler output header */
-#include "var.h"                       /* db header */
-#include "dis386.h"                    /* dis386 package header */
-
-/* Standard defines */
-#define FAILED -1
-#define MAYBE 0
-#define OK 1
-
-/* Local defines */
-
-#ifndef lint
-static char *Version = "@(#) misc.c $Revision: 1.1 $ $Date: 1997/10/20 12:00:00 $";
-#endif
-
-/* Global variables */
-PRIVATE bool_t forceupper;
-PRIVATE bool_t someupper = TRUE;
-PRIVATE count_t stringcount = 0;
-PRIVATE char *string_ptr = (char *)0;  /* stringptr ambiguous at 8th char */
-PRIVATE char *stringstart = (char *)0;
-
-/* Externals */
-
-/* Forward declarations */
-#if 0
-PUBLIC void closestring(void);                         /* */
-PUBLIC u8_pt get8(void);                               /* */
-PUBLIC u16_t get16(void);                              /* */
-PUBLIC u32_t get32(void);                              /* */
-PUBLIC void openstring(char *string, int len);         /* */
-PUBLIC void outbyte(char_pt byte);                     /* */
-PUBLIC void outcolon(void);                            /* */
-PUBLIC void outcomma(void);                            /* */
-PUBLIC void outh4(u4_pt num);                          /* */
-PUBLIC void outh8(u8_pt num);                          /* */
-PUBLIC void outh16(u16_t num);                         /* */
-PUBLIC void outh32(u32_t num);                         /* */
-PUBLIC bool_pt outnl(void);                            /* */
-PUBLIC count_t outsegaddr(struct address_s *ap, offset_t addr);        /* */
-PUBLIC count_t outsegreg(offset_t num);                        /* */
-PUBLIC void outspace(void);                            /* */
-PUBLIC void outstr(char *s);                           /* */
-PUBLIC void outtab(void);                              /* */
-PUBLIC void outustr(char *s);                          /* */
-PUBLIC count_t stringpos(void);                                /* */
-PUBLIC count_t stringtab(void);                                /* */
-PUBLIC void outrel(struct nlist *sp, offset_t off);    /* */
-PUBLIC void outsym(struct nlist *sp, offset_t off);    /* */
-PUBLIC struct nlist *findrval(offset_t value, int where);/* */
-PUBLIC struct nlist *findsval(offset_t value, int where);/* */
-PUBLIC int dasm(offset_t addr, offset_t count);                /* */
-#endif
-
-PRIVATE u8_pt peek8(struct address_s *ap);                     /* */
-PRIVATE u16_t peek16(struct address_s *ap);                    /* */
-PRIVATE u32_t peek32(struct address_s *ap);                    /* */
-PRIVATE struct nlist *find_arval(offset_t value, int where);   /* */
-PRIVATE struct nlist *find_orval(offset_t value, int where);   /* */
-PRIVATE struct nlist *find_asval(offset_t value, int where);   /* */
-PRIVATE struct nlist *find_osval(offset_t value, int where);   /* */
-PRIVATE int dis_one(void);                                     /* */
-
-
-/*
- * Close string device.
- */
-PUBLIC void closestring()
-{
-  stringcount = 0;
-  stringstart = string_ptr = (char *)0;
-}
-
-
-/*
- * Get 8 bits from current instruction pointer and advance pointer.
- */
-PUBLIC u8_pt get8()
-{
-  u8_pt temp;
-
-  temp = peek8(&uptr);
-  ++uptr.off;
-  return temp;
-}
-
-
-/*
- * Get 16 bits from current instruction pointer and advance pointer.
- */
-PUBLIC u16_pt get16()
-{
-  u16_pt temp;
-
-  temp = peek16(&uptr);
-  uptr.off += 2;
-  return temp;
-}
-
-
-/*
- * Get 32 bits from current instruction pointer and advance pointer.
- */
-PUBLIC u32_t get32()
-{
-  u32_t temp;
-
-  temp = peek32(&uptr);
-  uptr.off += 4;
-  return temp;
-}
-
-
-/*
- * Open string device.
- */
-PUBLIC void openstring(string, len)
-char *string; int len;
-{
-  while (--len >= 0)
-       string[len] = '\0';
-  stringcount = 0;
-  stringstart = string_ptr = string;
-}
-
-
-/*
- * Print char to currently open output devices.
- */
-PUBLIC void outbyte(char_pt byte)
-{
-  /* convert to upper case if required */
-  if (forceupper && byte >= 'a' && byte <= 'z')
-       byte += 'A' - 'a';
-
-  /* increment the output line character count, allowing for tab stops */
-  if (string_ptr != NULL) {
-       if ((*string_ptr++ = byte) == '\t')
-               stringcount = 8 * (stringcount / 8 + 1);
-       else
-               ++stringcount;
-  }
-  else
-       (void) fputc(byte, stdout);
-}
-
-
-/*
- * Print colon.
- */
-PUBLIC void outcolon()
-{
-  outbyte(':');
-}
-
-
-/*
- * Print comma.
- */
-PUBLIC void outcomma()
-{
-  outbyte(',');
-}
-
-
-/*
- * Print 4 bits hex.
- */
-PUBLIC void outh4(u4_pt num)
-{
-  static char hexdigits[] = "0123456789abcdef";
-
-  forceupper = someupper;
-  outbyte(hexdigits[num % 16]);
-  forceupper = FALSE;
-}
-
-
-/*
- * Print 8 bits hex.
- */
-PUBLIC void outh8(u8_pt num)
-{
-  outh4(num / 16);
-  outh4(num);
-}
-
-
-/*
- * Print 16 bits hex.
- */
-PUBLIC void outh16(u16_pt num)
-{
-  outh8(num / 256);
-  outh8(num);
-}
-
-
-/*
- * Print 32 bits hex.
- */
-PUBLIC void outh32(u32_t num)
-{
-  outh16((u16_t) (num >> 16));
-  outh16((u16_t) num);
-}
-
-
-/*
- * Print newline.
- */
-PUBLIC bool_pt outnl()
-{
-  /* bool_pt avoids change in type.h */
-  outstr("\n");
-  return OK;
-}
-
-
-/*
- * Print segmented address.
- */
-PUBLIC count_t outsegaddr(struct address_s *ap, offset_t addr)
-{
-  count_t bytes_printed;
-
-  bytes_printed = 2;
-
-  if (ap->base == regs.csbase)
-       outustr("cs");
-  else if (ap->base == regs.dsbase)
-       outustr("ds");
-  else if (ap->base == regs.esbase)
-       outustr("es");
-  else if (processor >= 386 && ap->base == regs.fsbase)
-       outustr("fs");
-  else if (processor >= 386 && ap->base == regs.gsbase)
-       outustr("gs");
-  else if (ap->base == regs.ssbase)
-       outustr("ss");
-  else
-       bytes_printed = outsegreg(ap->base);
-
-  if (bytes_printed > 4)
-       outbyte('+');
-  else
-       outcolon();
-  bytes_printed++;
-
-  if (ap->off >= 0x10000) {
-       outh32(ap->off + addr);
-       return bytes_printed + 8;
-  }
-  else {
-       outh16((u16_pt) ap->off + addr);
-       return bytes_printed + 4;
-  }
-}
-
-
-/*
- * Print segment register.
- */
-PUBLIC count_t outsegreg(offset_t num)
-{
-  if ((num % HCLICK_SIZE) != 0 || num >= 0x100000) {
-       outh32(num);
-       return 8;
-  }
-  outh16((u16_pt) (num / HCLICK_SIZE));
-  return 4;
-}
-
-
-/*
- * Print space.
- */
-PUBLIC void outspace()
-{
-  outbyte(' ');
-}
-
-
-/*
- * Print string.
- */
-PUBLIC void outstr(char *s)
-{
-  while (*s)
-       outbyte(*s++);
-}
-
-/*
- * Print tab.
- */
-PUBLIC void outtab()
-{
-  outbyte('\t');
-}
-
-
-/*
- * Print string, perhaps converting case to upper.
- */
-PUBLIC void outustr(char *s)
-{
-  forceupper = someupper;
-  while (*s)
-       outbyte(*s++);
-  forceupper = FALSE;
-}
-
-
-/*
- * p e e k 8
- *
- * Get a byte from the process.
- *
- * Returns:    byte    Success
- *
- * Note: aborts on read error.
- */
-PRIVATE u8_pt peek8(struct address_s *ap)
-{
-  unsigned int uj;
-
-  /* with luck buffering should make this fairly quick */
-  if (fseek(disfp, (long)(ap->off), SEEK_CUR) != 0) {
-       fprintf(stderr, "Cannot seek forward in object file\n");
-       exit(1);
-  }
-  uj = fgetc(disfp) & 0377;
-  if (fseek(disfp, -(long)(ap->off + 1), SEEK_CUR) != 0) {
-       fprintf(stderr, "Cannot seek backward in object file\n");
-       exit(1);
-  }
-
-  return uj;
-}
-
-
-/*
- * p e e k 1 6
- *
- * Get a 16-bit short from the process.
- *
- * Returns:    2 bytes Success
- *
- * Note: aborts on read error.
- */
-PRIVATE u16_t peek16(struct address_s *ap)
-{
-  unsigned int uj;
-
-  /* with luck buffering should make this fairly quick */
-  if (fseek(disfp, (long)(ap->off), SEEK_CUR) != 0) {
-       fprintf(stderr, "Cannot seek forward in object file\n");
-       exit(1);
-  }
-  /* Intel has right to left byte ordering */
-#if 1
-  uj = fgetc(disfp) & 0377;
-  uj |= (fgetc(disfp) & 0377) << 8;
-#else
-  uj = fgetc(disfp) & 0377;
-  uj <<= 8;
-  uj |= fgetc(disfp) & 0377;
-#endif
-  if (fseek(disfp, -(long)(ap->off + 2), SEEK_CUR) != 0) {
-       fprintf(stderr, "Cannot seek backward in object file\n");
-       exit(1);
-  }
-
-  return uj;
-}
-
-
-/*
- * p e e k 3 2
- *
- * Get a 32-bit int from the process.
- *
- * Returns:    4 bytes Success
- *
- * Note: aborts on read error.
- */
-PRIVATE u32_t peek32(struct address_s *ap)
-{
-  unsigned int uj;
-
-  /* with luck buffering should make this fairly quick */
-  if (fseek(disfp, (long)(ap->off), SEEK_CUR) != 0) {
-       fprintf(stderr, "Cannot seek forward in object file\n");
-       exit(1);
-  }
-#if 1
-  /* Intel has right to left byte ordering */
-  uj = fgetc(disfp) & 0377;
-  uj |= (fgetc(disfp) & 0377) << 8;
-  uj |= (fgetc(disfp) & 0377) << 16;
-  uj |= (fgetc(disfp) & 0377) << 24;
-#else
-  uj = fgetc(disfp) & 0377;
-  uj <<= 8;
-  uj |= fgetc(disfp) & 0377;
-  uj <<= 8;
-  uj |= fgetc(disfp) & 0377;
-  uj <<= 8;
-  uj |= fgetc(disfp) & 0377;
-#endif
-  if (fseek(disfp, -(long)(ap->off + 4), SEEK_CUR) != 0) {
-       fprintf(stderr, "Cannot seek backward in object file\n");
-       exit(1);
-  }
-
-  return uj;
-}
-
-
-/*
- * Return current offset of string device.
- */
-PUBLIC count_t stringpos()
-{
-  return string_ptr - stringstart;
-}
-
-
-/*
- * Return current "tab" spot of string device.
- */
-PUBLIC count_t stringtab()
-{
-  return stringcount;
-}
-
-/******************** sym.c ***********************/
-
-/*
- * f i n d r v a l
- *
- * Check if an address refers to a relocation structure,
- * and if so return the table entry.
- *
- * Returns:    Pointer to struct nlist         Success
- *             Null pointer                    Failure
- *
- * Note that the nlist interface must be maintained for use by unasm().
- */
-PUBLIC struct nlist *findrval(offset_t value, int where)
-{
-  if (aoutfp != (FILE *)NULL)
-       return (find_arval(value, where));
-  else if (objfp != (FILE *)NULL)
-       return (find_orval(value, where));
-  else
-       return (struct nlist *)NULL;
-}
-
-
-/*
- * f i n d _ a r v a l
- *
- * Check if an address refers to an a.out file relocation structure,
- * and if so return the table entry.
- *
- * Returns:    Pointer to struct nlist         Success
- *             Null pointer                    Failure
- *
- * Note that the nlist interface must be maintained for use by unasm().
- * ### Do any available ACK compilers have this feature?
- */
-PRIVATE struct nlist *find_arval(offset_t value, int where)
-{
-  return (struct nlist *)NULL;
-}
-
-
-/*
- * f i n d _ o r v a l
- *
- * Check if an address refers to an object file relocation structure,
- * and if so return the table entry.
- *
- * Returns:    Pointer to struct nlist         Success
- *             Null pointer                    Failure
- *
- * Note that the nlist interface must be maintained for use by unasm().
- * The table entry is stored in a static buffer which is overwritten
- * on successive calls.
- */
-PRIVATE struct nlist *find_orval(offset_t value, int where)
-{
-  char data[20];
-  int j, k, status;
-  long int lj;
-  static struct nlist sym;
-
-  /* we need to have an object file */
-  if (objfp == (FILE *)NULL) return (struct nlist *)NULL;
-
-  /* Sections in an object file usually have the order text, rom, data, bss.
-   * The order is actually set out in the section data header.  Assume that
-   * the first user section is text, and all else is data.
-   */
-  if (where != CSEG && where != DSEG)
-       return(struct nlist *)NULL;
-
-  /* check for a relocation entry */
-  status = FAILED;
-  for (j = 0 ; j < o_hdrbuf.oh_nrelo ; j++) {
-       if (value == o_reltab[j].or_addr) {
-               /* abandon non-matching section entries */
-               if (where == CSEG && (o_reltab[j].or_sect & S_TYP) != S_MIN)
-                       continue;
-               if (where == DSEG && ((o_reltab[j].or_sect & S_TYP) <= S_MIN ||
-                               (o_reltab[j].or_sect & S_TYP) > (S_MIN + 3)))
-                       continue;
-               /* the address is an offset from the symbol or section base */
-               if (o_reltab[j].or_nami < o_hdrbuf.oh_nname) {
-                       lj = o_symtab[o_reltab[j].or_nami].on_foff -
-                                       (long)OFF_CHAR(o_hdrbuf);
-                       /* check that addressing isn't messed up */
-                       assert(lj >= 0 && lj < o_hdrbuf.oh_nchar);
-                       /* name size is defined by SZ_NAME */
-                       sprintf(data, "%-13s", o_strtab + lj);
-                       /* convert from rel table to executable symbol table format */
-                       for (k = 0 ; k < sizeof(sym.n_name) ; k++) {
-                               sym.n_name[k] = data[k];/* 8 characters */
-                       }
-                       sym.n_value = o_symtab[o_reltab[j].or_nami].on_valu;
-                                                       /* long */
-#if 1
-                       sym.n_sclass = (where == CSEG) ? N_TEXT : N_DATA;
-#else
-                       sym.n_sclass = (o_symtab[o_reltab[j].or_nami].on_type &
-                                       S_TYP) - S_MIN; /* unsigned char */
-#endif
-                       sym.n_numaux = 0;               /* unsigned char */
-                       sym.n_type = 0;                 /* unsigned short */
-                       status = OK;
-                       break;
-               }
-               /* the address is an absolute number relative to the pc */
-               else if (o_reltab[j].or_nami == o_hdrbuf.oh_nname) {
-                       strcpy(data, "Absolute");
-                       /* convert from relocation data to executable symbol table format */
-                       for (k = 0 ; k < sizeof(sym.n_name) ; k++) {
-                               sym.n_name[k] = data[k];
-                       }
-                       sym.n_value = 0;
-                       sym.n_sclass = (where == CSEG) ? N_TEXT : N_DATA;
-                       sym.n_numaux = 0;
-                       sym.n_type = 0;
-                       status = OK;
-                       break;
-               }
-       }
-  }
-  return (status == OK ? &sym : (struct nlist *)NULL);
-}
-
-
-/*
- * f i n d s v a l
- *
- * Check if an address refers to a symbol,
- * and if so return the table entry.
- *
- * Returns:    Pointer to struct nlist         Success
- *             Null pointer                    Failure
- *
- * Note that the nlist interface must be maintained for use by unasm().
- */
-PUBLIC struct nlist *findsval(offset_t value, int where)
-{
-  if (aoutfp != (FILE *)NULL)
-       return (find_asval(value, where));
-  else if (objfp != (FILE *)NULL)
-       return (find_osval(value, where));
-  else
-       return (struct nlist *)NULL;
-}
-
-
-/*
- * f i n d _ a s v a l
- *
- * Check if an address refers to an a.out file symbol,
- * and if so return the table entry.
- *
- * Returns:    Pointer to struct nlist         Success
- *             Null pointer                    Failure
- *
- * Note that the nlist interface must be maintained for use by unasm().
- * The table entry is stored in a static buffer which is overwritten
- * on successive calls.
- */
-PRIVATE struct nlist *find_asval(offset_t value, int where)
-{
-  int j, status;
-  static struct nlist sym;
-
-  /* Sections in an a.out file have the order text, data, bss
-   * but this function is called only with CSEG and DSEG.
-   */
-  if (where != CSEG && where != DSEG)
-       return(struct nlist *)NULL;
-
-  /* do a linear search for a symbol, as the symbol tables are unsorted */
-  status = FAILED;
-  for (j = 0 ; j < (a_hdrbuf.a_syms / sizeof(struct nlist)) ; j++) {
-       if (value == a_symtab[j].n_value &&
-                       ((where == CSEG && (a_symtab[j].n_sclass & N_SECT) == N_TEXT) ||
-                       (where == DSEG && ((a_symtab[j].n_sclass & N_SECT) == N_DATA ||
-                       (a_symtab[j].n_sclass & N_SECT) == N_BSS)))) {
-               (void) memcpy(&sym, &a_symtab[j], sizeof(struct nlist));
-               status = OK;
-               break;
-       }
-  }
-  return (status == OK) ? &sym : (struct nlist *)NULL;
-}
-
-
-/*
- * f i n d _ o s v a l
- *
- * Check if an address refers to an object file symbol,
- * and if so return the table entry.
- *
- * Returns:    Pointer to struct nlist         Success
- *             Null pointer                    Failure
- *
- * Note that the nlist interface must be maintained for use by unasm().
- * The table entry is stored in a static buffer which is overwritten
- * on successive calls.
- */
-PRIVATE struct nlist *find_osval(offset_t value, int where)
-{
-  int j, k, sec, status;
-  long int lj;
-  struct locname *np;
-  static struct nlist sym;
-
-  /* Sections in an object file usually have the order text, rom, data, bss.
-   * The order is actually set out in the section data header.  Assume that
-   * the first user section is text, and all else is data.
-   */
-  if (where != CSEG && where != DSEG)
-       return(struct nlist *)NULL;
-
-  /* do a linear search for a local symbol, as the tables are unsorted */
-  status = FAILED;
-  if (where == DSEG) {
-       /* nb. hardcoded assumption of section order */
-       for (sec = 1 ; status == FAILED && sec < 4 ; sec++) {
-               for (np = locsym[sec] ; status == FAILED && np !=
-                                       (struct locname *)NULL ; np = np->l_next) {
-                       if (np->l_value == value) {
-                               for (k = 0 ; k < sizeof(sym.n_name) ; k++) {
-                                       sym.n_name[k] = np->l_name[k];/* 8 characters */
-                               }
-                               sym.n_value = value;            /* long */
-                               sym.n_sclass = N_DATA;          /* unsigned char */
-                               sym.n_numaux = 0;               /* unsigned char */
-                               sym.n_type = 0;                 /* unsigned short */
-                               status = OK;
-                       }
-               }
-       }
-  }
-
-  /* do a linear search for a symbol, as the symbol tables are unsorted */
-  for (j = 0 ; status == FAILED && j < o_hdrbuf.oh_nname ; j++) {
-       if (value == o_symtab[j].on_valu) {
-               /* abandon non-matching section entries */
-               if (where == CSEG && (o_symtab[j].on_type & S_TYP) != S_MIN)
-                       continue;
-               if (where == DSEG && ((o_symtab[j].on_type & S_TYP) <= S_MIN ||
-                               (o_symtab[j].on_type & S_TYP) > (S_MIN + 3)))
-                       continue;
-#if 0
-                       ((where == CSEG && sect == (o_symtab[j].on_type & S_TYP)) ||
-                       (where == DSEG && sect <= (o_symtab[j].on_type & S_TYP)))) {
-#endif
-               /* find the name in the object file symbol table */
-               lj = o_symtab[j].on_foff - (long)OFF_CHAR(o_hdrbuf);
-               /* check that the offset addressing isn't messed up */
-               assert(lj >= 0 && lj < o_hdrbuf.oh_nchar);
-               /* convert from object to executable symbol table format */
-               for (k = 0 ; k < sizeof(sym.n_name) ; k++) {
-                       sym.n_name[k] = *(o_strtab + lj + k);
-                                                       /* 8 characters */
-               }
-               sym.n_value = o_symtab[j].on_valu;      /* long */
-               sym.n_sclass = (where == CSEG) ? N_TEXT : N_DATA;
-                                                       /* unsigned char */
-               sym.n_numaux = 0;                       /* unsigned char */
-               sym.n_type = 0;                         /* unsigned short */
-               status = OK;
-       }
-  }
-
-  return (status == OK ? &sym : (struct nlist *)NULL);
-}
-
-
-/*
- * o u t r e l
- *
- * Output a symbol name from an nlist structure.
- *
- * Returns:    Nothing         Always
- *
- * Note that the nlist interface must be maintained for use by unasm().
- * The label may be a segment name, in which case the address is relative
- * to that segment and must be dereferenced further.
- */
-PUBLIC void outrel(struct nlist *sp, offset_t off)
-{
-  char data[20];
-  int j, k;
-  struct nlist *spnew;
-
-  /* get a local copy of the label */
-  for (j = 0 ; j < 20 ; j++) {
-       data[j] = sp->n_name[j];
-       if (data[j] == ' ' || data[j] == '\0')
-               break;
-  }
-  data[j] = '\0';
-  data[8] = '\0';
-
-  /* see if we have a section name */
-  for (k = 0 ; k < 4 ; k++) {
-       if (strcmp(data, o_secnam[k]) == 0) {
-               /* look up the name in the appropriate section */
-               if ((spnew = findsval(off, (k ? DSEG : CSEG))) != (struct nlist *)NULL) {
-                       /* get a local copy of the label */
-                       for (j = 0 ; j < 20 ; j++) {
-                               data[j] = spnew->n_name[j];
-                               if (data[j] == '\0') break;
-                       }
-                       data[8] = '\0';
-               }
-       }
-  }
-
-  /* output the result */
-  for (j = 0 ; data[j] != 0 ; j++)
-       outbyte(data[j]);
-}
-
-
-/*
- * o u t s y m
- *
- * Output a symbol name from an nlist structure.
- *
- * Returns:    Nothing         Always
- *
- * Note that the nlist interface must be maintained for use by unasm().
- */
-PUBLIC void outsym(struct nlist *sp, offset_t off)
-{
-  char *s;
-  char *send;
-
-  /* output the symbol name */
-  for (s = sp->n_name, send = s + sizeof sp->n_name; *s != 0 && s < send; ++s)
-       outbyte(*s);
-
-  /* if the required address is offset from the name, output that too */
-  if ((off -= sp->n_value) != 0) {
-       outbyte('+');
-       if (off >= 0x10000)
-               outh32(off);
-       else if (off >= 0x100)
-               outh16((u16_pt) off);
-       else
-               outh8((u8_pt) off);
-  }
-}
-
-
-/*
- * d a s m
- *
- * Disassemble a stream of instructions.
- *
- * Returns:    OK      Success
- *             FAILED  Otherwise
- */
-PUBLIC int dasm(offset_t addr, offset_t count)
-{
-#if (_WORD_SIZE == 4)
-  bits32 = TRUE;               /* set mode */
-#else
-  bits32 = FALSE;
-#endif
-  processor = bits32 ? 386 : 0;
-  uptr.off = 0;
-  uptr.base = 0;
-
-  while (uptr.off < count) {
-       addrbase = addr;
-       /* assume that the object file text segment is first */
-       if (objfp != (FILE *)NULL && uptr.off >= o_sectab[0].os_flen)
-               return FAILED;
-       if (aoutfp != (FILE *)NULL && uptr.off >= (A_DATAPOS(a_hdrbuf) - 1))
-               return FAILED;
-       if (dis_one() == FAILED)
-               return FAILED;
-  }
-  return OK;
-}
-
-
-/*
- * d i s _ o n e
- *
- * Disassemble a single instruction.
- *
- * Returns:    OK              Always
- *
- * File read failures are handled at a low level by simply
- * baling out of the program; the startup checks on file
- * readability should make this a rare occurrence.  Hence
- * there are no error returns from this routine.
- * The output is written into a static line buffer, which
- * is overwritten on successive calls.
- */
-PRIVATE int dis_one()
-{
-  int idone, column, maxcol;
-  static char line[81];
-  struct address_s newuptr;
-  struct address_s olduptr;
-  struct nlist *sp;
-
-  do {
-       /* output a label */
-       if ((sp = findsval(uptr.off + addrbase, CSEG)) != NULL
-                       && sp->n_value == uptr.off + addrbase) {
-               outsym(sp, uptr.off + addrbase);
-               outbyte(':');
-               (void) outnl();
-       }
-
-       /* park the current address */
-       olduptr = uptr;
-
-       /* initialise the string input */
-       openstring(line, sizeof(line));
-
-       /* output an instruction */
-       idone = puti();
-
-       /* terminate the line buffer */
-       line[stringpos()] = 0;
-
-       /* deinitialise the string input */
-       closestring();
-
-       /* park the new address, set by puti() */
-       newuptr = uptr;
-
-       /* get back the current address */
-       uptr = olduptr;
-
-       /* output the segment data */
-       column = outsegaddr(&uptr, addrbase);
-       outspace();
-       outspace();
-       column += 2;
-
-       /* output the raw bytes of the current instruction */
-       while (uptr.off != newuptr.off) {
-           outh8(get8());
-           column += 2;
-       }
-
-       /* format the disassembled output */
-       maxcol = bits32 ? 24 : 16;
-       while (column < maxcol) {
-           outtab();
-           column += 8;
-       }
-       outtab();
-
-       /* display the collected buffer */
-       outstr(line);
-       (void) outnl();
-  } while (!idone);                    /* eat all prefixes */
-
-  return OK;
-}
-
-/*
- * EOF
- */
-
diff --git a/commands/dis386/out.h b/commands/dis386/out.h
deleted file mode 100644 (file)
index d68938a..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header: out.h,v 1.1 91/05/16 14:09:17 ceriel Exp $ */
-
-#ifndef __OUT_H_INCLUDED
-#define __OUT_H_INCLUDED
-/*
- * output format for ACK assemblers
- */
-#ifndef ushort
-#define ushort unsigned short
-#endif /* ushort */
-
-struct outhead {
-       ushort  oh_magic;       /* magic number */
-       ushort  oh_stamp;       /* version stamp */
-       ushort  oh_flags;       /* several format flags */
-       ushort  oh_nsect;       /* number of outsect structures */
-       ushort  oh_nrelo;       /* number of outrelo structures */
-       ushort  oh_nname;       /* number of outname structures */
-       long    oh_nemit;       /* sum of all os_flen */
-       long    oh_nchar;       /* size of string area */
-};
-
-#define O_MAGIC        0x0201          /* magic number of output file */
-#define        O_STAMP 0               /* version stamp */
-#define MAXSECT        64              /* Maximum number of sections */
-
-#define        HF_LINK 0x0004          /* unresolved references left */
-#define        HF_8086 0x0008          /* os_base specially encoded */
-
-struct outsect {
-       long    os_base;        /* startaddress in machine */
-       long    os_size;        /* section size in machine */
-       long    os_foff;        /* startaddress in file */
-       long    os_flen;        /* section size in file */
-       long    os_lign;        /* section alignment */
-};
-
-struct outrelo {
-       char    or_type;        /* type of reference */
-       char    or_sect;        /* referencing section */
-       ushort  or_nami;        /* referenced symbol index */
-       long    or_addr;        /* referencing address */
-};
-
-struct outname {
-       union {
-         char  *on_ptr;        /* symbol name (in core) */
-         long  on_off;         /* symbol name (in file) */
-       }       on_u;
-#define on_mptr        on_u.on_ptr
-#define on_foff        on_u.on_off
-       ushort  on_type;        /* symbol type */
-       ushort  on_desc;        /* debug info */
-       long    on_valu;        /* symbol value */
-};
-
-/*
- * relocation type bits
- */
-#define RELSZ  0x07            /* relocation length */
-#define RELO1     1            /* 1 byte */
-#define RELO2     2            /* 2 bytes */
-#define RELO4     4            /* 4 bytes */
-#define RELPC  0x08            /* pc relative */
-#define RELBR  0x10            /* High order byte lowest address. */
-#define RELWR  0x20            /* High order word lowest address. */
-
-/*
- * section type bits and fields
- */
-#define S_TYP  0x007F          /* undefined, absolute or relative */
-#define S_EXT  0x0080          /* external flag */
-#define S_ETC  0x7F00          /* for symbolic debug, bypassing 'as' */
-
-/*
- * S_TYP field values
- */
-#define S_UND  0x0000          /* undefined item */
-#define S_ABS  0x0001          /* absolute item */
-#define S_MIN  0x0002          /* first user section */
-#define S_MAX  (S_TYP-1)       /* last user section */
-#define S_CRS  S_TYP           /* on_valu is symbol index which contains value */
-
-/*
- * S_ETC field values
- */
-#define S_SCT  0x0100          /* section names */
-#define S_LIN  0x0200          /* hll source line item */
-#define S_FIL  0x0300          /* hll source file item */
-#define S_MOD  0x0400          /* ass source file item */
-#define S_COM  0x1000          /* Common name. */
-#define S_STB  0xe000          /* entries with any of these bits set are
-                                  reserved for debuggers
-                               */
-
-/*
- * structure format strings
- */
-#define SF_HEAD                "22222244"
-#define SF_SECT                "44444"
-#define SF_RELO                "1124"
-#define SF_NAME                "4224"
-
-/*
- * structure sizes (bytes in file; add digits in SF_*)
- */
-#define SZ_HEAD                20
-#define SZ_SECT                20
-#define SZ_RELO                8
-#define SZ_NAME                12
-
-/*
- * file access macros
- */
-#define BADMAGIC(x)    ((x).oh_magic!=O_MAGIC)
-#define OFF_SECT(x)    SZ_HEAD
-#define OFF_EMIT(x)    (OFF_SECT(x) + ((long)(x).oh_nsect * SZ_SECT))
-#define OFF_RELO(x)    (OFF_EMIT(x) + (x).oh_nemit)
-#define OFF_NAME(x)    (OFF_RELO(x) + ((long)(x).oh_nrelo * SZ_RELO))
-#define OFF_CHAR(x)    (OFF_NAME(x) + ((long)(x).oh_nname * SZ_NAME))
-
-#endif /* __OUT_H_INCLUDED */
-
diff --git a/commands/dis386/type.h b/commands/dis386/type.h
deleted file mode 100644 (file)
index cf27f83..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/* type.h - types for db.
- *
- * $Id: type.h,v 1.1 1997/10/20 12:00:00 cwr Exp cwr $
- */
-
-typedef unsigned long bigcount_t;
-typedef unsigned long flags_t;
-typedef int bool_pt;
-typedef char bool_t;
-typedef int char_pt;
-typedef int char16_t;          /* ASCII character possibly with scan code */
-typedef unsigned count_t;
-typedef unsigned long offset_t;
-typedef unsigned opcode_pt;    /* promote to unsigned and not int */
-typedef int (*pfi_t)();
-typedef void (*pfv_t)();
-typedef unsigned long physoff_t;
-typedef unsigned peekboff_t;
-typedef unsigned peekoff_t;
-typedef int peekseg_t;
-typedef unsigned port_t;
-typedef int reg_pt;
-typedef unsigned char reg_t;
-typedef unsigned segment_t;
-typedef long soffset_t;
-typedef int su8_pt;
-typedef int su16_t;
-typedef unsigned u4_pt;                /* promote to unsigned and not int */
-typedef unsigned u8_pt;
-typedef unsigned u16_pt;
-
-struct address_s
-{
-    offset_t off;
-    offset_t base;
-};
-
-struct desctableptr_s {
-  u16_t limit;
-  u32_t base;                  /* really u24_t + pad for 286 */
-};
-
-struct regs_s
-{
-    offset_t ax;
-    offset_t bx;
-    offset_t cx;
-    offset_t dx;
-    offset_t si;
-    offset_t di;
-    offset_t bp;
-    offset_t sp;
-    offset_t dsbase;
-    offset_t esbase;
-    offset_t fsbase;
-    offset_t gsbase;
-    offset_t ssbase;
-    offset_t csbase;
-    offset_t ip;
-    flags_t f;
-    offset_t ds;
-    offset_t es;
-    offset_t fs;
-    offset_t gs;
-    offset_t ss;
-    offset_t cs;
-};
-
-struct specregs_s
-{
-    u32_t cr0;                 /* control regs, cr0 is msw + pad for 286 */
-    u32_t cr2;
-    u32_t cr3;
-    u32_t dr0;                 /* debug regs */
-    u32_t dr1;
-    u32_t dr2;
-    u32_t dr3;
-    u32_t dr6;
-    u32_t dr7;
-    u32_t tr6;                 /* test regs */
-    u32_t tr7;
-    u16_t gdtlimit;
-    u32_t gdtbase;             /* depend on 16-bit compiler so no long align */
-    u16_t gdtpad;
-    u16_t idtlimit;
-    u32_t idtbase;
-    u16_t idtpad;
-    u16_t ldtlimit;
-    u32_t ldtbase;
-    u16_t ldt;
-    u16_t tr;                  /* task register */
-    u16_t trpad;
-};
-
-/* prototypes */
-
-#if __STDC__
-#define P(x)           x
-#else
-#define P(x)           ()
-#endif
-
-/* library, very few! */
-void *memcpy P((void *dst, const void *src, unsigned size));
-void *memmove P((void *dst, const void *src, unsigned size));
-unsigned strlen P((const char *s));
-char *strncpy P((char *dst, const char *src, unsigned size));
-
-/* db.c */
-void db_main P((void));
-void get_kbd_state P(());
-void get_scr_state P(());
-void info P((void));
-void reboot P((void));
-void reset_kbd_state P(());
-
-#ifndef __NBSD_LIBC
-/* getline.c */
-char *getline P((char *startline, unsigned maxlength, unsigned offset));
-#endif
-
-/* ihexload.c */
-void ihexload P((void));
-
-/* io.c */
-void can_itty P((void));
-void can_keyboard P((void));
-void can_otty P((void));
-void can_screen P((void));
-void closeio P((void));
-void closestring P((void));
-void enab_itty P((void));
-void enab_keyboard P((void));
-void enab_otty P((void));
-void enab_screen P((void));
-void flipcase P((void));
-u8_pt get8 P((void));
-u16_pt get16 P((void));
-u32_t get32 P((void));
-char16_t inchar P((void));
-char_pt mytolower P((char_pt ch));
-void openio P((void));
-void openstring P((char *string, int length));
-void outbyte P((char_pt byte));
-void outcomma P((void));
-void outh4 P((u4_pt num));
-void outh8 P((u8_pt num));
-void outh16 P((u16_pt num));
-void outh32 P((u32_t num));
-bool_pt outnl P((void));
-count_t outsegaddr P((struct address_s *ap, offset_t addr));
-count_t outsegreg P((offset_t num));
-void outspace P((void));
-void outstr P((char *s));
-void outtab P((void));
-void outustr P((char *s));
-void set_tty P((void));
-void show_db_screen P((void));
-void show_user_screen P((void));
-count_t stringpos P((void));
-count_t stringtab P((void));
-char_pt testchar P((void));
-
-/* lib88.s */
-int get_privilege P((void));
-unsigned get_processor P((void));
-unsigned in16portb P((port_t port));
-physoff_t linear2addr P((segment_t segment, u16_pt offset));
-void oportb P((port_t port, u8_pt value));
-u8_pt peek_byte P((physoff_t offset));
-u16_pt peek_word P((physoff_t offset));
-u32_t peek_dword P((physoff_t offset));
-void poke_byte P((physoff_t offset, u8_pt value));
-void poke_word P((physoff_t offset, u16_pt value));
-#ifdef N_TEXT
-void symswap P((struct nlist *left, struct nlist *right,
-                segment_t tableseg, unsigned length));
-#endif
-
-/* pcio.c */
-void kbdclose P((void));
-char_pt kbdin P((void));
-void kbdioctl P((int command));
-void kbdopen P((void));
-void kbdout P((int c));
-
-/* screen.s */
-void scrclose P((void));
-void scrioctl P((int command));
-char_pt scrin P((void));
-void scropen P((void));
-void scrout P((char_pt c));
-
-/* sym.c */
-#ifdef N_TEXT
-struct nlist *findsname P((char *name, int where, bool_pt allflag));
-struct nlist *findsval P((offset_t value, int where));
-struct nlist *findrval P((offset_t value, int where));
-void outsym P((struct nlist *sp, offset_t off));
-void outrel P((struct nlist *sp, offset_t off));
-#endif
-void setproc P((char_pt c, struct address_s *pdptr, struct address_s *pmptr));
-void syminit P((void));
-
-/* tty.s */
-void ttyclose P((void));
-void ttyioctl P((int command));
-char_pt ttyin P((void));
-void ttyopen P((void));
-void ttyout P((char_pt c));
-
-/* unasm.c */
-bool_pt puti P((void));
-
diff --git a/commands/dis386/unasm.c b/commands/dis386/unasm.c
deleted file mode 100644 (file)
index 6297621..0000000
+++ /dev/null
@@ -1,1418 +0,0 @@
-/*
- * unasm.c: Bruce Evan's dis86 package.
- *
- * $Id: unasm.c,v 1.1 1997/10/20 12:00:00 cwr Exp cwr $
- *
- * Minimal changes by C W Rose.
- */
-
-/* Version settings */
-#define MINIX
-#undef OS2
-#undef TEST
-
-#ifdef MINIX
-#include <sys/types.h>
-#include <a.out.h>
-#endif
-#ifdef OS2
-typedef unsigned char u8_t;
-typedef unsigned int u16_t;
-typedef unsigned long u32_t;
-#include </local/minix/a.out.h>
-#endif
-#include "const.h"
-#include "type.h"
-#undef EXTERN
-#define EXTERN
-#include "var.h"
-
-#define LINDIRECT      '['
-#define RINDIRECT      ']'
-
-#define BASE_MASK      0x07
-#define INDEX_MASK     0x38
-#define INDEX_SHIFT    3
-#define MOD_MASK       0xC0    /* mod reg r/m  is  mmrrrRRR */
-# define REG_MOD       0xC0
-# define MEM0_MOD      0x00
-# define MEM1_MOD      0x40
-# define MEM2_MOD      0x80
-#define REG_MASK       0x38
-#define REG_SHIFT      3
-#define RM_MASK                0x07
-#define RM_SHIFT       0
-#define SS_MASK                0xC0
-#define SS_SHIFT       6
-
-#define SIGNBIT                0x02    /* opcode bits xxxxxxsw for immediates */
-#define WORDBIT                0x01
-#define TOREGBIT       0x02    /* opcode bit for non-immediates */
-
-#define MAX_SIGNED_CHAR        0x7F    /* will assume 2's complement */
-#define MAX_UNSIGNED_CHAR      0xFF
-
-FORWARD void CL P((void));
-FORWARD void Eb P((void));
-FORWARD void Ev P((void));
-FORWARD void EvGv P((void));
-FORWARD void EvIb P((void));
-FORWARD void Ew P((void));
-FORWARD void EwRw P((void));
-FORWARD void Gv P((void));
-FORWARD void Gv1 P((void));
-FORWARD void GvEv P((void));
-FORWARD void GvEw P((void));
-FORWARD void GvM P((void));
-FORWARD void GvMa P((void));
-FORWARD void GvMp P((void));
-FORWARD void Ib P((void));
-FORWARD void Iw P((void));
-FORWARD void Iv P((void));
-FORWARD void Jb P((void));
-FORWARD void Jv P((void));
-FORWARD void Ms P((void));
-FORWARD void checkmemory P((void));
-FORWARD su8_pt get8s P((void));
-FORWARD void getmodregrm P((void));
-FORWARD void i_00_to_3f P((opcode_pt opc));
-FORWARD void i_40_to_5f P((opcode_pt opc));
-FORWARD void i_60_to_6f P((opcode_pt opc));
-FORWARD void i_70_to_7f P((opcode_pt opc));
-FORWARD void i_80 P((opcode_pt opc));
-FORWARD void i_88 P((opcode_pt opc));
-FORWARD void i_90 P((opcode_pt opc));
-FORWARD void i_98 P((opcode_pt opc));
-FORWARD void i_a0 P((opcode_pt opc));
-FORWARD void i_a8 P((opcode_pt opc));
-FORWARD void i_b0 P((opcode_pt opc));
-FORWARD void i_b8 P((opcode_pt opc));
-FORWARD void i_c0 P((opcode_pt opc));
-FORWARD void i_c8 P((opcode_pt opc));
-FORWARD void i_d0 P((opcode_pt opc));
-FORWARD void i_d8 P((opcode_pt opc));
-FORWARD void i_e0 P((opcode_pt opc));
-FORWARD void i_e8 P((opcode_pt opc));
-FORWARD void i_f0 P((opcode_pt opc));
-FORWARD void i_f8 P((opcode_pt opc));
-FORWARD void outad P((opcode_pt opc));
-FORWARD void outad1 P((opcode_pt opc));
-FORWARD void outalorx P((opcode_pt opc));
-FORWARD void outax P((void));
-FORWARD void outbptr P((void));
-FORWARD void outbwptr P((opcode_pt opc));
-FORWARD void outea P((opcode_pt wordflags));
-FORWARD void outf1 P((void));
-FORWARD void outfishy P((void));
-FORWARD void outgetaddr P((void));
-FORWARD void outimmed P((opcode_pt signwordflag));
-FORWARD void outpc P((offset_t pc, int f));
-FORWARD void outsegpc P((void));
-FORWARD void oututstr P((char *s));
-FORWARD void outword P((void));
-FORWARD void outwptr P((void));
-FORWARD void outwsize P((void));
-FORWARD void pagef P((void));
-FORWARD void shift P((opcode_pt opc));
-
-PRIVATE pfv_t optable[] =
-{
- i_00_to_3f,
- i_00_to_3f,
- i_00_to_3f,
- i_00_to_3f,
- i_00_to_3f,
- i_00_to_3f,
- i_00_to_3f,
- i_00_to_3f,
- i_40_to_5f,
- i_40_to_5f,
- i_40_to_5f,
- i_40_to_5f,
- i_60_to_6f,
- i_60_to_6f,
- i_70_to_7f,
- i_70_to_7f,
- i_80,
- i_88,
- i_90,
- i_98,
- i_a0,
- i_a8,
- i_b0,
- i_b8,
- i_c0,
- i_c8,
- i_d0,
- i_d8,
- i_e0,
- i_e8,
- i_f0,
- i_f8,
-};
-
-PRIVATE char fishy[] = "???";
-PRIVATE char movtab[] = "mov\t";
-
-PRIVATE char *genreg[] =
-{
- "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
- "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
- "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
-};
-PRIVATE char *segreg[] =
-{
- "es", "cs", "ss", "ds", "fs", "gs", "?s", "?s",
-};
-PRIVATE char *indreg[] =
-{
- "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx",
-};
-
-PRIVATE char *str_00_to_3f[] =
-{
- /* index by (opcode >> 3) & 7 */
- "add", "or", "adc", "sbb", "and", "sub", "xor", "cmp",
-};
-PRIVATE char *sstr_00_to_3f[] =
-{
- /* index ((opc>>2) & 0x0E) + (opc & 7) - 6 */
- "push\tes", "pop\tes", "push\tcs", "pop\tcs",
- "push\tss", "pop\tss", "push\tds", "pop\tds",
- "es:", "daa", "cs:", "das", "ss:", "aaa", "ds:", "aas",
-};
-PRIVATE char *sstr_0f[] =
-{
- "push\tfs", "pop\tfs", fishy, "bt\t", "shld\t", "shld\t", fishy, fishy,
- "push\tgs", "pop\tgs", fishy, "bts\t", "shrd\t", "shrd\t", fishy, "imul\t",
- fishy, fishy, "lss\t", "btr\t", "lfs\t", "lgs\t", "movzx\t", "movzx\t",
- fishy, fishy, "", "btc\t", "bsf\t", "bsr\t", "movsx\t", "movsx\t",
-};
-PRIVATE char *ssstr_0f[] =
-{
- "sldt\t", "str\t", "lldt\t", "ltr\t", "verr\t", "verw\t", fishy, fishy,
- "sgdt\t", "sidt\t", "lgdt\t", "lidt\t", "smsw\t", fishy, "lmsw\t", fishy,
- fishy, fishy, fishy, fishy, "bt\t", "bts\t", "btr\t", "btc\t",
-};
-PRIVATE char *str_40_to_5f[] =
-{
- /* index by (opcode >> 3) & 3 */
- "inc\t", "dec\t", "push\t", "pop\t",
-};
-PRIVATE char *str_60_to_6f[] =
-{
- "pusha", "popa", "bound\t", "arpl\t", "fs:", "gs:", "os:", "as:",
- "push\t", "imul\t", "push\t", "imul\t", "insb", "ins", "outsb", "outs",
-};
-PRIVATE char *str_flags[] =
-{
- /* opcodes 0x70 to 0x7F, and 0x0F80 to 0x0F9F */
- "o", "no", "b", "nb", "z", "nz", "be", "a",
- "s", "ns", "pe", "po", "l", "ge", "le", "g",
-};
-PRIVATE char *str_98[] =
-{
- "cbw", "cwd", "call\t", "wait", "pushf", "popf", "sahf", "lahf",
- "cwde", "cdq", "call\t", "wait", "pushfd", "popfd", "sahf", "lahf",
-};
-PRIVATE char *str_a0[] =
-{
- movtab, movtab, movtab, movtab, "movsb", "movs", "cmpsb", "cmps",
-};
-PRIVATE char *str_a8[] =
-{
- "test\t", "test\t", "stosb", "stos", "lodsb", "lods", "scasb", "scas",
-};
-PRIVATE char *str_c0[] =
-{
- "", "", "ret\t", "ret", "les\t", "lds\t", movtab, movtab,
-};
-PRIVATE char *str_c8[] =
-{
- "enter\t", "leave", "retf\t", "retf", "int\t3", "int\t", "into", "iret",
-};
-PRIVATE char *str_d0[] =
-{
- "aam", "aad", "db\td6", "xlat",
-};
-PRIVATE char *sstr_d0[] =
-{
- "rol", "ror", "rcl", "rcr", "shl", "shr", fishy, "sar",
-};
-PRIVATE char *str_d8[] =
-{
- "fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr",
- "fld", NULL, "fst", "fstp", "fldenv", "fldcw", "fstenv", "fstcw",
- "fiadd", "fimul", "ficom", "ficomp", "fisub", "fisubr", "fidiv", "fidivr",
- "fild", NULL, "fist", "fistp", NULL, "fld", NULL, "fstp",
- "fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr",
- "fld", NULL, "fst", "fstp", "frstor", NULL, "fsave", "fstsw",
- "fiadd", "fimul", "ficom", "ficomp", "fisub", "fisubr", "fidiv", "fidivr",
- "fild", NULL, "fist", "fistp", "fbld", "fild", "fbstp", "fistp",
-};
-PRIVATE char *str1_d8[] =
-{
- "fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr",
- "fld", "fxch", "\0\0", NULL, "\0\10", "\0\20", "\0\30", "\0\40",
- NULL, NULL, NULL, NULL, NULL, "\0\50", NULL, NULL,
- NULL, NULL, NULL, NULL, "\0\60", NULL, NULL, NULL,
- "fadd", "fmul", NULL, NULL, "fsubr", "fsub", "fdivr", "fdiv",
- "ffree", NULL, "fst", "fstp", "fucom", "fucomp", NULL, NULL,
- "faddp", "fmulp", NULL, "\0\70", "fsubrp", "fsubp", "fdivrp", "fdivp",
- NULL, NULL, NULL, NULL, "\0\100", NULL, NULL, NULL,
-};
-PRIVATE unsigned char size_d8[] =
-{
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 14-28, 2, 14-28, 2,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 0, 10, 0, 10,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 8, 8, 94-108, 0, 94-108, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 10, 8, 10, 8,
-};
-PRIVATE char *sstr_d8[] =
-{
- "fnop", NULL, NULL, NULL,                     /* D9D0 */
- NULL, NULL, NULL, NULL,
- "fchs", "fabs", NULL, NULL,                   /* D9E0 */
- "ftst", "fxam", NULL, NULL,
- "fld1", "fldl2t", "fldl2e", "fldpi",          /* D9E8 */
- "fldlg2", "fldln2", "fldz", NULL,
- "f2xm1", "fyl2x", "fptan", "fpatan",          /* D9F0 */
- "fxtract", "fprem1", "fdecstp", "fincstp",
- "fprem", "fyl2xp1", "fsqrt", "fsincos",       /* D9F8 */
- "frndint", "fscale", "fsin", "fcos",
- NULL, "fucompp", NULL, NULL,                  /* DAE8 */
- NULL, NULL, NULL, NULL,
- "feni", "fdisi", "fclex", "finit",            /* DBE0 */
- "fsetpm", NULL, NULL, NULL,
- NULL, "fcompp", NULL, NULL,                   /* DED8 */
- NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL,                       /* DFE0 */
- "fstsw\tax", NULL, NULL, NULL,
-};
-PRIVATE char *str_e0[] =
-{
- "loopnz\t", "loopz\t", "loop\t", "jcxz\t",
- "in\t", "in\t", "out\t", "out\t",
-};
-PRIVATE char *str_e8[] =
-{
- "call\t", "jmp\t", "jmp\t", "jmp\t",
- "in\t", "in\t", "out\t", "out\t",
-};
-PRIVATE char *str_f0[] =
-{
- "lock\t", "db\tf1", "repnz\t", "repz\t",
- "hlt", "cmc",
- /* other 2 from sstr_f0 */
-};
-PRIVATE char *sstr_f0[] =
-{
- "test\t", fishy, "not\t", "neg\t",
- "mul\t", "imul\t", "div\t", "idiv\t",
-};
-PRIVATE char *str_f8[] =
-{
- "clc", "stc", "cli", "sti",
- "cld", "std",
- /* other 2 from sstr_f8 */
-};
-PRIVATE char *sstr_f8[] =
-{
- "inc\t", "dec\t", "call\t", "call\tfar ",
- "jmp\t", "jmp\tfar ", "push\t", "???\t",
-};
-
-PRIVATE int nop_flg;           /* check for leading NOPs in opcodes */
-PRIVATE int data_seg;          /* data segment (munged name for asld) */
-PRIVATE count_t hasize;                /* half address size in bits */
-PRIVATE count_t hdefsize;
-PRIVATE count_t hosize;                /* half operand size in bits */
-                               /* for easy index into reg tables */
-PRIVATE opcode_pt mod;
-PRIVATE offset_t offtable[2];
-PRIVATE offset_t *offptr;
-PRIVATE offset_t *off1ptr;
-PRIVATE opcode_pt reg;
-PRIVATE opcode_pt rm;
-
-PRIVATE su8_pt get8s()
-{
-    u8_pt got;
-
-    if ((got = get8()) > MAX_SIGNED_CHAR)
-       got -= (MAX_UNSIGNED_CHAR + 1);
-    return got;
-}
-
-PRIVATE void getmodregrm()
-{
-    opcode_pt modregrm;
-
-    modregrm = get8();
-    mod = modregrm & MOD_MASK;
-    reg = (modregrm & REG_MASK) >> REG_SHIFT;
-    rm = (modregrm & RM_MASK) >> RM_SHIFT;
-}
-
-PRIVATE void i_00_to_3f(opc)
-opcode_pt opc;
-{
-    opcode_pt sub;
-    struct nlist *sp;
-
-    /* attempt to step over linker padding */
-    if (nop_flg && opc == 0
-               && (sp = findsval(uptr.off + addrbase, CSEG)) != NULL
-               && sp->n_value == uptr.off + addrbase) {
-       outustr("nop");
-       return;
-    }
-    if (opc == 15)
-       pagef();
-    else if ((sub = opc & 7) >= 6)
-    {
-       outustr((sstr_00_to_3f - 6)[((opc >> 2) & 0x0E) + sub]);
-       if (!(opc & 1))
-           data_seg = opc;
-    }
-    else
-    {
-       oututstr(str_00_to_3f[(opc >> 3) & 7]);
-       if (sub == 4)
-       {
-           outustr(genreg[0]);
-           outcomma();
-           Ib();
-       }
-       else if (sub == 5)
-       {
-           outax();
-           outcomma();
-           Iv();
-       }
-       else
-           outad(sub);
-    }
-}
-
-PRIVATE void i_40_to_5f(opc)
-opcode_pt opc;
-{
-    outustr(str_40_to_5f[(opc >> 3) & 3]);
-    outustr(genreg[hosize + (opc & 7)]);
-}
-
-PRIVATE void i_60_to_6f(opc)
-opcode_pt opc;
-{
-    /* most for 386, some for 286 */
-
-    outustr((str_60_to_6f - 0x60)[opc]);
-    switch (opc)
-    {
-    case 0x60:
-    case 0x61:
-       if (hosize == 16)
-           outwsize();
-       break;
-    case 0x62:
-       GvMa();
-       break;
-    case 0x63:
-       EwRw();
-       break;
-    case 0x64:
-    case 0x65:
-       data_seg = opc;
-       break;
-    case 0x66:
-       hosize = (16 + 8) - hdefsize;
-       break;
-    case 0x67:
-       hasize = (16 + 8) - hdefsize;
-       break;
-    case 0x68:
-       outword();
-       Iv();
-       break;
-    case 0x6A:
-       outword();
-       outimmed(SIGNBIT | WORDBIT);
-       break;
-    case 0x69:
-       GvEv();
-       outcomma();
-       Iv();
-       break;
-    case 0x6B:
-       GvEv();
-       outcomma();
-       outimmed(SIGNBIT | WORDBIT);
-       break;
-    case 0x6D:
-    case 0x6F:
-       outwsize();
-       break;
-    default:
-       break;
-    }
-}
-
-PRIVATE void i_70_to_7f(opc)
-opcode_pt opc;
-{
-    outustr("j");
-    oututstr((str_flags - 0x70)[opc]);
-    Jb();
-}
-
-PRIVATE void i_80(opc)
-opcode_pt opc;
-{
-    if (opc >= 4)
-    {
-       outustr(opc >= 6 ? "xchg\t" : "test\t");
-       outad(opc);
-    }
-    else
-    {
-       getmodregrm();
-       oututstr(str_00_to_3f[reg]);
-       outbwptr(opc);
-       outea(opc);
-       outcomma();
-       outimmed(opc);
-#ifdef SIGNED_LOGICALS
-       if (opc & SIGNBIT && (reg == 1 || reg == 4 || reg == 6))
-           /* and, or and xor with signe extension are not documented in some
-            * 8086 and 80286 manuals, but make sense and work
-            */
-           outfishy();
-#endif
-    }
-}
-
-PRIVATE void i_88(opc)
-opcode_pt opc;
-{
-    if (opc < 4)
-    {
-       outustr(movtab);
-       outad(opc);
-    }
-    else if (opc == 5)
-    {
-       oututstr("lea");
-       GvM();
-    }
-    else if (opc == 7)
-    {
-       oututstr("pop");
-       getmodregrm();
-       outwptr();
-       Ev();
-       if (reg != 0)
-           outfishy();
-    }
-    else
-    {
-       getmodregrm();
-       outustr(movtab);
-       if (!(opc & TOREGBIT))
-       {
-           Ev();
-           outcomma();
-       }
-       outustr(segreg[reg]);
-       if (opc & TOREGBIT)
-       {
-           outcomma();
-           Ev();
-       }
-    }
-}
-
-PRIVATE void i_90(opc)
-opcode_pt opc;
-{
-    if (opc == 0)
-       outustr("nop");
-    else
-    {
-       outustr("xchg\t");
-       outax();
-       outcomma();
-       outustr(genreg[hosize + opc]);
-    }
-}
-
-PRIVATE void i_98(opc)
-opcode_pt opc;
-{
-    outustr((str_98 - 8)[opc + hosize]);
-    if (opc == 2)
-       outsegpc();
-}
-
-PRIVATE void i_a0(opc)
-opcode_pt opc;
-{
-    outustr(str_a0[opc]);
-    if (opc < 4)
-    {
-       mod = MEM0_MOD;         /* fake */
-       reg = 0;                /* fake ax */
-       if (hasize == 16)
-           rm = 5;             /* fake [d16] */
-       else
-           rm = 6;             /* fake [d32] */
-       outad1(opc ^ TOREGBIT);
-    }
-    else if (opc & 1)
-       outwsize();
-}
-
-PRIVATE void i_a8(opc)
-opcode_pt opc;
-{
-    outustr(str_a8[opc]);
-    if (opc < 2)
-    {
-       outalorx(opc);
-       outcomma();
-       outimmed(opc);
-    }
-    else if (opc & 1)
-       outwsize();
-}
-
-PRIVATE void i_b0(opc)
-opcode_pt opc;
-{
-    outustr(movtab);
-    outustr(genreg[opc]);
-    outcomma();
-    Ib();
-}
-
-PRIVATE void i_b8(opc)
-opcode_pt opc;
-{
-    outustr(movtab);
-    outustr(genreg[hosize + opc]);
-    outcomma();
-    Iv();
-}
-
-PRIVATE void i_c0(opc)
-opcode_pt opc;
-{
-    outustr(str_c0[opc]);
-    if (opc >= 6)
-    {
-       getmodregrm();
-       outbwptr(opc);
-       outea(opc);
-       outcomma();
-       outimmed(opc & WORDBIT);
-       if (reg != 0)
-           /* not completely decoded (like DEBUG) */
-           outfishy();
-    }
-    else if (opc >= 4)
-       GvMp();
-    else if (opc == 2)
-       Iv();
-    else if (opc < 2)
-       shift(opc);
-}
-
-PRIVATE void i_c8(opc)
-opcode_pt opc;
-{
-    outustr(str_c8[opc]);
-    if (opc == 0)
-    {
-       Iw();
-       outcomma();
-       Ib();
-    }
-    if (opc == 2)
-       Iv();
-    else if (opc == 5)
-       Ib();
-    else if (opc == 7 && hosize == 16)
-       outwsize();
-}
-
-PRIVATE void i_d0(opc)
-opcode_pt opc;
-{
-    opcode_pt aabyte;
-
-    if (opc < 4)
-       shift(opc | 0xD0);
-    else
-    {
-       outustr((str_d0 - 4)[opc]);
-       if (opc < 6 && (aabyte = get8()) != 0x0A)
-       {
-           outtab();
-           outh8(aabyte);
-           outfishy();
-       }
-    }
-}
-
-PRIVATE void i_d8(opc)
-opcode_pt opc;
-{
-    opcode_pt esc;
-    char *str;
-
-    getmodregrm();
-    esc = (opc << 3) | reg;
-    if ((str = (mod == REG_MOD ? str1_d8 : str_d8)[esc]) == NULL)
-    {
-escape:
-       oututstr("esc");
-       outh8(esc);
-       outcomma();
-       outea(0);
-       return;
-    }
-    if (*str == 0)
-    {
-       str = sstr_d8[str[1] + rm];
-       if (str == NULL)
-           goto escape;
-       outustr(str);
-       return;
-    }
-    outustr(str);
-    outtab();
-    if (mod == REG_MOD)
-    {
-       if (opc == 0 && reg != 2 && reg != 3)
-           outustr("st,");
-       outf1();
-       if (opc == 4 || opc == 6)
-           outustr(",st");
-       return;
-    }
-    switch(size_d8[esc])
-    {
-    case 4:
-       outustr("d");
-       /* FALL THROUGH */
-    case 2:
-       outwptr();
-       break;
-    case 8:
-       outustr("q");
-       outwptr();
-       break;
-    case 10:
-       outustr("t");
-       outbptr();
-       break;
-    default:
-       break;
-    }
-    outea(opc);
-}
-
-PRIVATE void i_e0(opc)
-opcode_pt opc;
-{
-    outustr(str_e0[opc]);
-    if (opc < 4)
-       Jb();
-    else if (opc < 6)
-    {
-       outalorx(opc);
-       outcomma();
-       Ib();
-    }
-    else
-    {
-       Ib();
-       outcomma();
-       outalorx(opc);
-    }
-}
-
-PRIVATE void i_e8(opc)
-opcode_pt opc;
-{
-    outustr(str_e8[opc]);
-    if (opc < 2)
-       Jv();
-    else if (opc == 2)
-       outsegpc();
-    else if (opc == 3)
-       Jb();
-    else
-    {
-       if (opc & TOREGBIT)
-       {
-           outustr(genreg[10]);
-           outcomma();
-           outalorx(opc);
-       }
-       else
-       {
-           outalorx(opc);
-           outcomma();
-           outustr(genreg[10]);
-       }
-    }
-}
-
-PRIVATE void i_f0(opc)
-opcode_pt opc;
-{
-    if (opc < 6)
-       outustr(str_f0[opc]);
-    else
-    {
-       getmodregrm();
-       outustr(sstr_f0[reg]);
-       outbwptr(opc);
-       outea(opc);
-       if (reg == 0)
-       {
-           outcomma();
-           outimmed(opc & WORDBIT);
-       }
-    }
-}
-
-PRIVATE void i_f8(opc)
-opcode_pt opc;
-{
-    if (opc < 6)
-       outustr(str_f8[opc]);
-    else
-    {
-       getmodregrm();
-       if (opc == 6 && reg >= 2)
-           outustr("fishy\t");
-       else
-           outustr(sstr_f8[reg]);
-       outbwptr(opc);
-       outea(opc);
-    }
-}
-
-PRIVATE void outad(opc)
-opcode_pt opc;
-{
-    getmodregrm();
-    outad1(opc);
-}
-
-PRIVATE void outad1(opc)
-opcode_pt opc;
-{
-    if (!(opc & TOREGBIT))
-    {
-       outea(opc);
-       outcomma();
-    }
-    if (opc & WORDBIT)
-       Gv1();
-    else
-       outustr(genreg[reg]);
-    if (opc & TOREGBIT)
-    {
-       outcomma();
-       outea(opc);
-    }
-}
-
-PRIVATE void outalorx(opc)
-opcode_pt opc;
-{
-    if (opc & WORDBIT)
-       outax();
-    else
-       outustr(genreg[0]);
-}
-
-PRIVATE void outax()
-{
-    outustr(genreg[hosize]);
-}
-
-PRIVATE void outbptr()
-{
-    outustr("byte ptr ");
-}
-
-PRIVATE void outbwptr(opc)
-opcode_pt opc;
-{
-    if (mod != REG_MOD)
-    {
-       if (opc & WORDBIT)
-           outwptr();
-       else
-           outbptr();
-    }
-}
-
-PRIVATE void outea(wordflags)
-opcode_pt wordflags;
-{
-    reg_pt base = 0;
-    reg_pt index = 0;
-    opcode_pt ss = 0;
-    opcode_pt ssindexbase = 0;
-
-    if (mod == REG_MOD)
-       outustr(genreg[hosize * (wordflags & WORDBIT) + rm]);
-    else
-    {
-       outbyte(LINDIRECT);
-       if (hasize == 16)
-       {
-           if (rm == 4)
-           {
-               base = (ssindexbase = get8()) & BASE_MASK;
-               if (mod == MEM0_MOD && base == 5)
-                   outgetaddr();
-               else
-                   outustr((genreg + 16)[base]);
-               ss = (ssindexbase & SS_MASK) >> SS_SHIFT;
-               if ((index = (ssindexbase & INDEX_MASK) >> INDEX_SHIFT) != 4)
-               {
-                   outbyte('+');
-                   outustr((genreg + 16)[index]);
-                   outstr("\0\0\0*2\0*4\0*8\0" + (3 * ss));
-               }
-           }
-           else if (mod == MEM0_MOD && rm == 5)
-               outgetaddr();
-           else
-               outustr((genreg + 16)[rm]);
-       }
-       else if (mod == MEM0_MOD && rm == 6)
-           outgetaddr();
-       else
-           outustr(indreg[rm]);
-       if (mod == MEM1_MOD)
-           /* fake sign extension to get +- */
-           outimmed(SIGNBIT | WORDBIT);
-       else if (mod == MEM2_MOD)
-       {
-           outbyte('+');
-           outgetaddr();
-       }
-       outbyte(RINDIRECT);
-       if (hasize == 16 && rm == 4 && index == 4 && ss != 0)
-           outfishy();
-    }
-}
-
-PRIVATE void outf1()
-{
-    outustr("st(");
-    outbyte((int) (rm + '0'));
-    outbyte(')');
-}
-
-PRIVATE void outfishy()
-{
-    outustr("\t???");
-}
-
-PRIVATE void outgetaddr()
-{
-    offset_t off;
-    struct nlist *sp;
-
-    if (hasize == 16)
-       off = get32();
-    else
-       off = get16();
-
-    /* do we ever need to call finrval with DSEG ? */
-    if ((sp = findrval(uptr.off - (hasize / 4), CSEG)) != NULL)
-    {
-       outrel(sp, off);
-       *offptr++ = off;
-    }
-    else if ((sp = findsval(off, data_seg)) != NULL)
-    {
-       outsym(sp, off);
-       *offptr++ = off;
-    }
-    else if (hasize == 16)
-       outh32(off);
-    else
-       outh16((u16_pt) off);
-}
-
-PRIVATE void outimmed(signwordflag)
-opcode_pt signwordflag;
-{
-    su8_pt byte;
-
-    if (signwordflag & WORDBIT)
-    {
-       if (signwordflag & SIGNBIT)
-       {
-           if ((byte = get8s()) < 0)
-           {
-               outbyte('-');
-               byte = -byte;
-           }
-           else
-               outbyte('+');
-           outh8((u8_pt) byte);
-       }
-       else
-           Iv();
-    }
-    else
-       Ib();
-}
-
-PRIVATE void outpc(pc, f)
-offset_t pc;
-int f;
-{
-    struct nlist *sp;
-
-    if (hosize == 8)
-       pc = (u16_t) pc;
-    if ((sp = findrval(uptr.off - (hosize / 4), CSEG)) != NULL)
-    {
-       if (f == 1) pc -= uptr.off;
-       outrel(sp, pc);
-       *offptr++ = pc;
-    }
-    else if ((sp = findsval(pc, CSEG)) != NULL)
-    {
-       outsym(sp, pc);
-       *offptr++ = pc;
-    }
-    else if (hosize == 16)
-       outh32(pc);
-    else
-       outh16((u16_pt) pc);
-}
-
-PRIVATE void outsegpc()
-{
-    offset_t oldbase;
-    offset_t pc;
-
-    if (hosize == 16)
-       pc = get32();
-    else
-       pc = get16();
-    oldbase = uptr.base;
-    outh16((u16_t) (uptr.base = get16()));     /* fake seg for lookup of pc */
-                       /* TODO - convert to offset in protected mode */
-                       /* ### can this ever be a reloc structure ? */
-    outbyte(':');
-    outpc(pc, 0);
-    uptr.base = oldbase;
-}
-
-PRIVATE void oututstr(s)
-char *s;
-{
-    outustr(s);
-    outtab();
-}
-
-PRIVATE void outword()
-{
-    outustr("dword " + ((16 - hosize) >> 3));
-}
-
-PRIVATE void outwptr()
-{
-    outword();
-    outustr("ptr ");
-}
-
-PRIVATE void outwsize()
-{
-    if (hosize == 16)
-       outustr("d");
-    else
-       outustr("w");
-}
-
-PRIVATE void pagef()
-{
-    opcode_pt opc;
-    bool_t regbad;
-
-    if ((opc = get8()) <= 1 || opc == 0xBA)
-    {
-       if (opc == 0xBA)
-           opc = 16;
-       else
-           opc *= 8;
-       getmodregrm();
-       outustr(ssstr_0f[opc += reg]);
-       if (opc < 6 || opc == 12 || opc == 14)
-           Ew();
-       else if (opc >= 8 && opc < 13)
-           Ms();
-       else if (opc >= 20)
-       {
-           outbwptr(WORDBIT);
-           EvIb();
-       }
-    }
-    else if (opc < 4)
-    {
-       oututstr("lar\0lsl" + 4 * (opc - 2));
-       GvEw();
-    }
-    else if (opc == 5)
-    {
-       outustr("loadall");
-       outfishy();
-    }
-    else if (opc == 6)
-       outustr("clts");
-    else if (opc < 0x20)
-       outstr(fishy);
-    else if (opc < 0x27 && opc != 0x25)
-    {
-       outustr(movtab);
-       getmodregrm();
-       hosize = 16;
-       if (!(opc & TOREGBIT))
-       {
-           Ev();               /* Rd() since hosize is 16 */
-           outcomma();
-       }
-       regbad = FALSE;
-       if (opc & 1)
-       {
-           outustr("dr");
-           if (reg == 4 || reg == 5)
-               regbad = TRUE;
-       }
-       else if (opc < 0x24)
-       {
-           outustr("cr");
-           if (reg >= 4 || reg == 1)
-               regbad = TRUE;
-       }
-       else
-       {
-           outustr("tr");
-           if (reg < 6)
-               regbad = TRUE;
-       }
-       outbyte((int) (reg + '0'));
-       if (opc & TOREGBIT)
-       {
-           outcomma();
-           Ev();
-       }
-       if (regbad || mod != REG_MOD)
-           outfishy();
-    }
-    else if (opc < 0x80)
-       outstr(fishy);
-    else if (opc < 0x90)
-    {
-       outustr("j");
-       oututstr((str_flags - 0x80)[opc]);
-       Jv();
-    }
-    else if (opc < 0xA0)
-    {
-       outustr("set");
-       oututstr((str_flags - 0x90)[opc]);
-       getmodregrm();
-       outbwptr(0);
-       Eb();
-    }
-    else if (opc < 0xC0)
-    {
-       outustr((sstr_0f - 0xA0)[opc]);
-       switch (opc)
-       {
-       case 0xA3:
-       case 0xAB:
-       case 0xB3:
-       case 0xBB:
-           EvGv();
-           break;
-       case 0xA4:
-       case 0xAC:
-           EvGv();
-           outcomma();
-           Ib();
-           break;
-       case 0xA5:
-       case 0xAD:
-           EvGv();
-           outcomma();
-           CL();
-           break;
-       case 0xAF:
-       case 0xBC:
-       case 0xBD:
-           GvEv();
-           break;
-       case 0xB2:
-       case 0xB4:
-       case 0xB5:
-           GvMp();
-           break;
-       case 0xB6:
-       case 0xBE:
-           Gv();
-           outcomma();
-           outbwptr(opc);
-           Eb();
-           break;
-       case 0xB7:
-       case 0xBF:
-           Gv();
-           outcomma();
-           hosize = 8;         /* done in Ew(), but too late */
-           outbwptr(opc);
-           Ew();
-           break;
-       default:
-           break;
-       }
-    }
-    else
-       outstr(fishy);
-}
-
-PUBLIC bool_pt puti()
-{
-    static bool_t hadprefix = FALSE;
-    opcode_pt opcode;
-
-    nop_flg = TRUE;
-
-more:
-    offptr = offtable;
-    opcode = get8();
-    nop_flg = (nop_flg && (opcode == '\0'));
-    if (!hadprefix)
-    {
-       data_seg = DSEG;
-       hdefsize = 8;
-       if (bits32)
-           hdefsize = 16;
-       hosize = hasize = hdefsize;
-    }
-    (*optable[opcode >> 3])(opcode < 0x80 ? opcode : opcode & 7);
-    if (offptr > offtable)
-    {
-       if (stringtab() >= 31)
-       {
-           outspace();
-           outspace();
-       }
-       else
-           while (stringtab() < 32)
-               outtab();
-       outbyte(';');
-       for (off1ptr = offtable; off1ptr < offptr; ++off1ptr)
-       {
-           outspace();
-           if (*off1ptr < 0x10000)
-               outh16((u16_t) *off1ptr);
-           else
-               outh32(*off1ptr);
-       }
-       offptr = offtable;
-    }
-    if ((opcode & 0xE7) == 0x26 ||
-       opcode >= 0x64 && opcode < 0x68 ||
-       opcode == 0xF0 || opcode == 0xF2 || opcode == 0xF3)
-       /* not finished instruction for 0x26, 0x2E, 0x36, 0x3E seg overrides
-        * and 0x64, 0x65 386 seg overrides
-        * and 0x66, 0x67 386 size prefixes
-        * and 0xF0 lock, 0xF2 repne, 0xF3 rep
-        */
-    {
-       hadprefix = TRUE;
-       goto more;              /* TODO - print prefixes better */
-       return FALSE;
-    }
-    hadprefix = FALSE;
-    return TRUE;
-}
-
-PRIVATE void shift(opc)
-opcode_pt opc;
-{
-    getmodregrm();
-    oututstr(sstr_d0[reg]);
-    outbwptr(opc);
-    outea(opc);
-    outcomma();
-    if (opc < 0xD0)
-       Ib();
-    else if (opc & 2)
-       CL();
-    else
-       outbyte('1');
-}
-
-PRIVATE void checkmemory()
-{
-    if (mod == REG_MOD)
-       outfishy();
-}
-
-PRIVATE void CL()
-{
-    outustr(genreg[1]);
-}
-
-PRIVATE void Eb()
-{
-    outea(0);
-}
-
-PRIVATE void Ev()
-{
-    outea(WORDBIT);
-}
-
-PRIVATE void EvGv()
-{
-    getmodregrm();
-    Ev();
-    outcomma();
-    Gv1();
-}
-
-PRIVATE void EvIb()
-{
-    Ev();
-    outcomma();
-    Ib();
-}
-
-PRIVATE void Ew()
-{
-    hosize = 8;
-    Ev();
-}
-
-PRIVATE void EwRw()
-{
-    hosize = 8;
-    EvGv();
-}
-
-PRIVATE void Gv()
-{
-    getmodregrm();
-    Gv1();
-}
-
-PRIVATE void Gv1()
-{
-    outustr(genreg[hosize + reg]);
-}
-
-PRIVATE void GvEv()
-{
-    Gv();
-    outcomma();
-    Ev();
-}
-
-PRIVATE void GvEw()
-{
-    Gv();
-    outcomma();
-    Ew();
-}
-
-PRIVATE void GvM()
-{
-    GvEv();
-    checkmemory();
-}
-
-PRIVATE void GvMa()
-{
-    GvM();
-}
-
-PRIVATE void GvMp()
-{
-    GvM();
-}
-
-PRIVATE void Ib()
-{
-    outh8(get8());
-}
-
-PRIVATE void Iw()
-{
-    outh16(get16());
-}
-
-PRIVATE void Iv()
-{
-#if 1
-    offset_t pcjump;
-
-    if (hosize == 16)
-       pcjump = get32();
-    else
-       pcjump = (su16_t) get16();
-    outpc(pcjump, 0);
-#else
-    if (hosize == 16)
-       outh32(get32());
-    else
-       Iw();
-#endif
-}
-
-PRIVATE void Jb()
-{
-    /* jump can be in either direction */
-    int pcjump;
-
-    pcjump = get8s();
-    outpc(pcjump + uptr.off, 1);
-}
-
-PRIVATE void Jv()
-{
-    offset_t pcjump;
-
-    if (hosize == 16)
-       pcjump = get32();
-    else
-       pcjump = (su16_t) get16();
-    outpc((long)pcjump + uptr.off, 1);
-}
-
-PRIVATE void Ms()
-{
-    Ev();
-    checkmemory();
-}
-
-/*
- * EOF
- */
-
diff --git a/commands/dis386/var.h b/commands/dis386/var.h
deleted file mode 100644 (file)
index ea48439..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/* var.h - variables for db.
- *
- * $Id: var.h,v 1.1 1997/10/20 12:00:00 cwr Exp cwr $
- */
-
-EXTERN bool_t bits32;
-EXTERN unsigned processor;
-EXTERN char_pt prompt;
-EXTERN bool_t protected;
-EXTERN offset_t addrbase;
-EXTERN struct regs_s regs;
-EXTERN struct specregs_s specregs;
-EXTERN struct address_s uptr;
-
diff --git a/commands/dis88/Makefile b/commands/dis88/Makefile
deleted file mode 100644 (file)
index 5daec73..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# Makefile for dis
-
-# @(#) Makefile, Ver. 2.1 created 00:00:00 87/09/01
-# Makefile for 8088 symbolic disassembler
-
-# Copyright (C) 1987 G. M. Harding, all rights reserved.
-# Permission to copy and redistribute is hereby granted,
-# provided full source code, with all copyright notices,
-# accompanies any redistribution.
-
-# This Makefile  automates the process of compiling and linking
-# a symbolic  object-file  disassembler  program  for the Intel
-# 8088 CPU. Relatively machine-independent code is contained in
-# the file dismain.c; lookup tables and handler routines, which
-# are by their nature  machine-specific,  are  contained in two
-# files named distabs.c and dishand.c,  respectively.  (A third
-# machine-specific file, disfp.c, contains handler routines for
-# floating-point  coprocessor opcodes.)  A header file,  dis.h,
-# attempts to mediate between the machine-specific and machine-
-# independent portions of the code. An attempt has been made to
-# isolate machine  dependencies and to deal with them in fairly
-# straightforward ways. Thus, it should be possible to target a
-# different CPU by rewriting the handler  routines and changing
-# the initialization  data in the lookup tables.  It should not
-# be necessary to alter the formats of the tables.
-
-PROG=  dis88
-SRCS=  disrel.c dismain.c distabs.c dishand.c disfp.c
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/dis88/README b/commands/dis88/README
deleted file mode 100644 (file)
index a007634..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-                                     dis88
-                                  Beta Release
-                                    87/09/01
-                                      ---
-                                 G. M. HARDING
-                                    POB 4142
-                           Santa Clara CA  95054-0142
-
-
-             "Dis88" is a symbolic disassembler for the Intel 8088 CPU,
-        designed to run under the PC/IX  operating  system on an IBM XT
-        or fully-compatible clone.  Its output is in the format of, and
-        is completely compatible with, the PC/IX assembler,  "as".  The
-        program is copyrighted by its author, but may be copied and re-
-        distributed freely provided that complete source code, with all
-        copyright notices, accompanies any distribution. This provision
-        also applies to any  modifications you may make.  You are urged
-        to comment such changes,  giving,  as a miminum,  your name and
-        complete address.
-
-             This release of the program is a beta release, which means
-        that it has been  extensively,  but not  exhaustively,  tested.
-        User comments, recommendations, and bug fixes are welcome.  The
-        principal features of the current release are:
-
-             (a)  The ability to  disassemble  any file in PC/IX object
-        format, making full use of symbol and relocation information if
-        it is present,  regardless of whether the file is executable or
-        linkable,  and regardless of whether it has continuous or split
-        I/D space;
-
-             (b)  Automatic generation of synthetic labels when no sym-
-        bol table is available; and
-
-             (c)  Optional  output of address and object-code  informa-
-        tion as assembler comment text.
-
-             Limitations of the current release are:
-
-             (a)  Numeric co-processor  (i.e., 8087)  mnemonics are not
-        supported.  Instructions  for the co-processor are disassembled
-        as CPU escape  sequences,  or as  interrupts,  depending on how
-        they were assembled in the first place. This limitation will be
-        addressed in a future release.
-
-             (b)  Symbolic  references  within the object  file's  data
-        segment are not supported. Thus, for example, if a data segment
-        location is initialized to point to a text segment address,  no
-        reference to a text segment symbol will be detected. This limi-
-        tation is likely to remain in future  releases,  because object
-        code does not, in most cases, contain sufficient information to
-        allow meaningful interpretation of pure data.  (Note,  however,
-        that  symbolic  references  to the data segment from within the
-        text segment are always supported.)
-
-             As a final caveat,  be aware that the PC/IX assembler does
-        not recognize the  "esc"  mnemonic,  even though it refers to a
-        completely  valid CPU operation  which is documented in all the
-        Intel literature. Thus, the corresponding opcodes (0xd8 through
-        0xdf) are disassembled as .byte directives. For reference, how-
-        ever,  the syntactically-correct "esc" instruction is output as
-        a comment.
-
-             To build the disassembler program, transfer all the source
-        files,  together with the Makefile,  to a suitable  (preferably
-        empty) PC/IX directory. Then, simply type "make".
-
-             To use dis88,  place it in a  directory  which  appears in
-        your $PATH list.  It may then be invoked by name from  whatever
-        directory you happen to be in.  As a minimum,  the program must
-        be invoked with one command-line argument:  the name of the ob-
-        ject file to be disassembled.  (Dis88 will complain if the file
-        specified is not an object file.)  Optionally,  you may specify
-        an output file; stdout is the default.  One command-line switch
-        is available:  "-o",  which makes the program display addresses
-        and object code along with its mnemonic disassembly.
-
-             The "-o" option is useful primarily for verifying the cor-
-        rectness of the program's output. In particular, it may be used
-        to check the accuracy of local  relative  jump  opcodes.  These
-        jumps often  target  local  labels,  which are lost at assembly
-        time;  thus,  the disassembly may contain cryptic  instructions
-        like "jnz .+39".  As a user convenience,  all relative jump and
-        call  opcodes are output with a comment  which  identifies  the
-        physical target address.
-
-             By convention, the release level of the program as a whole
-        is the SID of the file disrel.c, and this SID string appears in
-        each disassembly.  Release 2.1 of the program is the first beta
-        release to be distributed on Usenet.
-
-
-.TH dis88 1 LOCAL
-.SH "NAME"
-dis88 \- 8088 symbolic disassembler
-.SH "SYNOPSIS"
-\fBdis88\fP [ -o ] ifile [ ofile ]
-.SH "DESCRIPTION"
-Dis88 reads ifile, which must be in PC/IX a.out format.
-It interprets the binary opcodes and data locations, and
-writes corresponding assembler source code to stdout, or
-to ofile if specified.  The program's output is in the
-format of, and fully compatible with, the PC/IX assembler,
-as(1).  If a symbol table is present in ifile, labels and
-references will be symbolic in the output.  If the input
-file lacks a symbol table, the fact will be noted, and the
-disassembly will proceed, with the disassembler generating
-synthetic labels as needed.  If the input file has split
-I/D space, or if it is executable, the disassembler will
-make all necessary adjustments in address-reference calculations.
-.PP
-If the "-o" option appears, object code will be included
-in comments during disassembly of the text segment.  This
-feature is used primarily for debugging the disassembler
-itself, but may provide information of passing interest
-to users.
-.PP
-The program always outputs the current machine address
-before disassembling an opcode.  If a symbol table is
-present, this address is output as an assembler comment;
-otherwise, it is incorporated into the synthetic label
-which is generated internally.  Since relative jumps,
-especially short ones, may target unlabelled locations,
-the program always outputs the physical target address
-as a comment, to assist the user in following the code.
-.PP
-The text segment of an object file is always padded to
-an even machine address.  In addition, if the file has
-split I/D space, the text segment will be padded to a
-paragraph boundary (i.e., an address divisible by 16).
-As a result of this padding, the disassembler may produce
-a few spurious, but harmless, instructions at the
-end of the text segment.
-.PP
-Disassembly of the data segment is a difficult matter.
-The information to which initialized data refers cannot
-be inferred from context, except in the special case
-of an external data or address reference, which will be
-reflected in the relocation table.  Internal data and
-address references will already be resolved in the object file,
-and cannot be recreated.  Therefore, the data
-segment is disassembled as a byte stream, with long
-stretches of null data represented by an appropriate
-".zerow" pseudo-op.  This limitation notwithstanding,
-labels (as opposed to symbolic references) are always
-output at appropriate points within the data segment.
-.PP
-If disassembly of the data segment is difficult, disassembly of the
-bss segment is quite easy, because uninitialized data is all
-zero by definition.  No data
-is output in the bss segment, but symbolic labels are
-output as appropriate.
-.PP
-For each opcode which takes an operand, a particular
-symbol type (text, data, or bss) is appropriate.  This
-tidy correspondence is complicated somewhat, however,
-by the existence of assembler symbolic constants and
-segment override opcodes.  Therefore, the disassembler's
-symbol lookup routine attempts to apply a certain amount
-of intelligence when it is asked to find a symbol.  If
-it cannot match on a symbol of the preferred type, it
-may return a symbol of some other type, depending on
-preassigned (and somewhat arbitrary) rankings within
-each type.  Finally, if all else fails, it returns a
-string containing the address sought as a hex constant;
-this behavior allows calling routines to use the output
-of the lookup function regardless of the success of its
-search.
-.PP
-It is worth noting, at this point, that the symbol lookup
-routine operates linearly, and has not been optimized in
-any way.  Execution time is thus likely to increase
-geometrically with input file size.  The disassembler is
-internally limited to 1500 symbol table entries and 1500
-relocation table entries; while these limits are generous
-(/unix, itself, has fewer than 800 symbols), they are not
-guaranteed to be adequate in all cases.  If the symbol
-table or the relocation table overflows, the disassembly
-aborts.
-.PP
-Finally, users should be aware of a bug in the assembler,
-which causes it not to parse the "esc" mnemonic, even
-though "esc" is a completely legitimate opcode which is
-documented in all the Intel literature.  To accommodate
-this deficiency, the disassembler translates opcodes of
-the "esc" family to .byte directives, but notes the
-correct mnemonic in a comment for reference.
-.PP
-In all cases, it should be possible to submit the output
-of the disassembler program to the assembler, and assemble
-it without error.  In most cases, the resulting object
-code will be identical to the original; in any event, it
-will be functionally equivalent.
-.SH "SEE ALSO"
-adb(1), as(1), cc(1), ld(1).
-.br
-"Assembler Reference Manual" in the PC/IX Programmer's
-Guide.
-.SH "DIAGNOSTICS"
-"can't access input file" if the input file cannot be
-found, opened, or read.
-.sp
-"can't open output file" if the output file cannot be
-created.
-.sp
-"warning: host/cpu clash" if the program is run on a
-machine with a different CPU.
-.sp
-"input file not in object format" if the magic number
-does not correspond to that of a PC/IX object file.
-.sp
-"not an 8086/8088 object file" if the CPU ID of the
-file header is incorrect.
-.sp
-"reloc table overflow" if there are more than 1500
-entries in the relocation table.
-.sp
-"symbol table overflow" if there are more than 1500
-entries in the symbol table.
-.sp
-"lseek error" if the input file is corrupted (should
-never happen).
-.sp
-"warning: no symbols" if the symbol table is missing.
-.sp
-"can't reopen input file" if the input file is removed
-or altered during program execution (should never happen).
-.SH "BUGS"
-Numeric co-processor (i.e., 8087) mnemonics are not currently supported.
-Instructions for the co-processor are
-disassembled as CPU escape sequences, or as interrupts,
-depending on how they were assembled in the first place.
-.sp
-Despite the program's best efforts, a symbol retrieved
-from the symbol table may sometimes be different from
-the symbol used in the original assembly.
-.sp
-The disassembler's internal tables are of fixed size,
-and the program aborts if they overflow.
diff --git a/commands/dis88/dis.h b/commands/dis88/dis.h
deleted file mode 100644 (file)
index 48e0089..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
- /*
- ** @(#) dis.h, Ver. 2.1 created 00:00:00 87/09/01
- */
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  *  Copyright (C) 1987 G. M. Harding, all rights reserved  *
-  *                                                         *
-  * Permission to copy and  redistribute is hereby granted, *
-  * provided full source code,  with all copyright notices, *
-  * accompanies any redistribution.                         *
-  *                                                         *
-  * This file contains declarations and definitions used by *
-  * the 8088 disassembler program. The program was designed *
-  * for execution on a machine of its own type (i.e., it is *
-  * not designed as a cross-disassembler);  consequently, A *
-  * SIXTEEN-BIT INTEGER SIZE HAS BEEN ASSUMED. This assump- *
-  * tion is not particularly important,  however, except in *
-  * the machine-specific  portions of the code  (i.e.,  the *
-  * handler  routines and the optab[] array).  It should be *
-  * possible to override this assumption,  for execution on *
-  * 32-bit machines,  by use of a  pre-processor  directive *
-  * (see below); however, this has not been tested.         *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#include <sys/types.h>
-#include <a.out.h>      /* Object file format definitions   */
-#include <fcntl.h>      /* System file-control definitions  */
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>      /* System standard I/O definitions  */
-
-#define MAXSYM 1500     /* Maximum entries in symbol table  */
-
-extern struct nlist     /* Array to hold the symbol table   */
-   symtab[MAXSYM];
-
-extern struct reloc     /* Array to hold relocation table   */
-   relo[MAXSYM];
-
-extern int symptr;      /* Index into the symtab[] array    */
-extern int relptr;      /* Index into the relo[] array      */
-
-struct opcode           /* Format for opcode data records   */
-{
-   char *text;          /* Pointer to mnemonic text   */
-   void (*func)();      /* Pointer to handler routine */
-   unsigned min;        /* Minimum # of object bytes  */
-   unsigned max;        /* Maximum # of object bytes  */
-};
-
-extern struct opcode    /* Array to hold the opcode table   */
-  optab[256];
-
-extern char *REGS[];    /* Table of register names          */
-extern char *REGS0[];   /* Mode 0 register name table       */
-extern char *REGS1[];   /* Mode 1 register name table       */
-
-#define AL REGS[0]      /* CPU register manifests           */
-#define CL REGS[1]
-#define DL REGS[2]
-#define BL REGS[3]
-#define AH REGS[4]
-#define CH REGS[5]
-#define DH REGS[6]
-#define BH REGS[7]
-#define AX REGS[8]
-#define CX REGS[9]
-#define DX REGS[10]
-#define BX REGS[11]
-#define SP REGS[12]
-#define BP REGS[13]
-#define SI REGS[14]
-#define DI REGS[15]
-#define ES REGS[16]
-#define CS REGS[17]
-#define SS REGS[18]
-#define DS REGS[19]
-#define BX_SI REGS0[0]
-#define BX_DI REGS0[1]
-#define BP_SI REGS0[2]
-#define BP_DI REGS0[3]
-
-extern int symrank[6][6];     /* Symbol type/rank matrix    */
-extern unsigned long PC;      /* Current program counter    */
-extern int segflg;      /* Flag: segment override in effect */
-extern int objflg;      /* Flag: output object as a comment */
-
-#define OBJMAX 8        /* Size of the object code buffer   */
-
-extern unsigned char    /* Internal buffer for object code  */
-   objbuf[OBJMAX];
-
-extern int objptr;      /* Index into the objbuf[] array    */
-
-extern char ADD[],      /* Opcode family mnemonic strings   */
-            OR[],
-            ADC[],
-            SBB[],
-            AND[],
-            SUB[],
-            XOR[],
-            CMP[],
-            NOT[],
-            NEG[],
-            MUL[],
-            DIV[],
-            MOV[],
-            ESC[],
-            TEST[],
-            AMBIG[];
-
-extern char *OPFAM[];   /* Indexed mnemonic family table    */
-extern struct exec HDR; /* Holds the object file's header   */
-
-#define LOOK_ABS 0      /* Arguments to lookup() function   */
-#define LOOK_REL 1
-#define LOOK_LNG 2
-
-#define TR_STD 0        /* Arguments to mtrans() function   */
-#define TR_SEG 8
-
-                        /* Macro for byte input primitive   */
-#define FETCH(p)  ++PC; p = getchar() & 0xff; objbuf[objptr++] = p
-
-
-/* disfp.c */
-_PROTOTYPE(void eshand, (int j ));
-_PROTOTYPE(void fphand, (int j ));
-_PROTOTYPE(void inhand, (int j ));
-
-/* dishand.c */
-_PROTOTYPE(void objini, (int j ));
-_PROTOTYPE(void objout, (void));
-_PROTOTYPE(void badseq, (int j, int k ));
-_PROTOTYPE(void dfhand, (int j ));
-_PROTOTYPE(void sbhand, (int j ));
-_PROTOTYPE(void aohand, (int j ));
-_PROTOTYPE(void sjhand, (int j ));
-_PROTOTYPE(void imhand, (int j ));
-_PROTOTYPE(void mvhand, (int j ));
-_PROTOTYPE(void mshand, (int j ));
-_PROTOTYPE(void pohand, (int j ));
-_PROTOTYPE(void cihand, (int j ));
-_PROTOTYPE(void mihand, (int j ));
-_PROTOTYPE(void mqhand, (int j ));
-_PROTOTYPE(void tqhand, (int j ));
-_PROTOTYPE(void rehand, (int j ));
-_PROTOTYPE(void mmhand, (int j ));
-_PROTOTYPE(void srhand, (int j ));
-_PROTOTYPE(void aahand, (int j ));
-_PROTOTYPE(void iohand, (int j ));
-_PROTOTYPE(void ljhand, (int j ));
-_PROTOTYPE(void mahand, (int j ));
-_PROTOTYPE(void mjhand, (int j ));
-
-/* dismain.c */
-_PROTOTYPE(int main, (int argc, char **argv ));
-
-/* distabs.c */
-_PROTOTYPE(char *getnam, (int k ));
-_PROTOTYPE(int lookext, (long off, long loc, char *buf ));
-_PROTOTYPE(char *lookup, (long addr, int type, int kind, long ext ));
-_PROTOTYPE(char *mtrans, (int c, int m, int type ));
-_PROTOTYPE(void mtrunc, (char *a ));
diff --git a/commands/dis88/disfp.c b/commands/dis88/disfp.c
deleted file mode 100644 (file)
index c6dc0da..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-static char *sccsid =
-   "@(#) disfp.c, Ver. 2.1 created 00:00:00 87/09/01";
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  *  Copyright (C) 1987 G. M. Harding, all rights reserved  *
-  *                                                         *
-  * Permission to copy and  redistribute is hereby granted, *
-  * provided full source code,  with all copyright notices, *
-  * accompanies any redistribution.                         *
-  *                                                         *
-  * This file contains handler routines for the numeric op- *
-  * codes of the 8087 co-processor,  as well as a few other *
-  * opcodes which are related to 8087 emulation.            *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#include "dis.h"              /* Disassembler declarations  */
-
-#define FPINT0 0xd8           /* Floating-point interrupts  */
-#define FPINT1 0xd9
-#define FPINT2 0xda
-#define FPINT3 0xdb
-#define FPINT4 0xdc
-#define FPINT5 0xdd
-#define FPINT6 0xde
-#define FPINT7 0xdf
-
-                              /* Test for floating opcodes  */
-#define ISFLOP(x) \
-   (((x) >= FPINT0) && ((x) <= FPINT7))
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the  handler for the escape  family of opcodes. *
-  * These opcodes place the contents of a specified  memory *
-  * location on the system bus,  for access by a peripheral *
-  * or by a co-processor such as the 8087. (The 8087 NDP is *
-  * accessed  only  via bus  escapes.)  Due to a bug in the *
-  * PC/IX assembler,  the "esc" mnemonic is not recognized; *
-  * consequently,  escape opcodes are disassembled as .byte *
-  * directives,  with the appropriate  mnemonic and operand *
-  * included as a comment.  FOR NOW, those escape sequences *
-  * corresponding  to 8087  opcodes  are  treated as simple *
-  * escapes.                                                *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-eshand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF eshand()  * * * * * * * * * */
-
-   register char *a;
-   register int k;
-
-   objini(j);
-
-   FETCH(k);
-
-   a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);
-
-   mtrunc(a);
-
-   printf("\t.byte\t0x%02.2x\t\t| esc\t%s\n",j,a);
-
-   for (k = 1; k < objptr; ++k)
-      printf("\t.byte\t0x%02.2x\n",objbuf[k]);
-
-}/* * * * * * * * * * * END OF eshand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler routine for floating-point opcodes. *
-  * Since PC/IX must  accommodate  systems with and without *
-  * 8087 co-processors, it allows floating-point operations *
-  * to be  initiated  in either of two ways:  by a software *
-  * interrput whose type is in the range 0xd8 through 0xdf, *
-  * or by a CPU escape sequence, which is invoked by an op- *
-  * code in the same range.  In either case, the subsequent *
-  * byte determines the actual numeric operation to be per- *
-  * formed.  However,  depending  on the  method of access, *
-  * either  one or two code bytes will  precede  that byte, *
-  * and the fphand()  routine has no way of knowing whether *
-  * it was invoked by  interrupt or by an escape  sequence. *
-  * Therefore, unlike all of the other handler routines ex- *
-  * cept dfhand(),  fphand() does not initialize the object *
-  * buffer, leaving that chore to the caller.               *
-  *                                                         *
-  * FOR NOW,  fphand()  does not disassemble floating-point *
-  * opcodes to floating  mnemonics,  but simply outputs the *
-  * object code as .byte directives.                        *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-fphand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF fphand()  * * * * * * * * * */
-
-   register int k;
-
-   segflg = 0;
-
-   FETCH(k);
-
-   printf("\t.byte\t0x%02.2x\t\t| 8087 code sequence\n",
-    objbuf[0]);
-
-   for (k = 1; k < objptr; ++k)
-      printf("\t.byte\t0x%02.2x\n",objbuf[k]);
-
-/* objout();                                       FOR NOW  */
-
-}/* * * * * * * * * * * END OF fphand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the  handler for  variable  software  interrupt *
-  * opcodes.  It is included in this file because PC/IX im- *
-  * plements its software floating-point emulation by means *
-  * of interrupts.  Any interrupt in the range 0xd8 through *
-  * 0xdf is an  NDP-emulation  interrupt,  and is specially *
-  * handled by the assembler.                               *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-inhand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF inhand()  * * * * * * * * * */
-
-   register int k;
-
-   objini(j);
-
-   FETCH(k);
-
-   if (ISFLOP(k))
-      {
-      fphand(k);
-      return;
-      }
-
-   printf("%s\t%d\n",optab[j].text,k);
-
-   objout();
-
-}/* * * * * * * * * * * END OF inhand() * * * * * * * * * * */
-\f
-
diff --git a/commands/dis88/dishand.c b/commands/dis88/dishand.c
deleted file mode 100644 (file)
index 56c6321..0000000
+++ /dev/null
@@ -1,1049 +0,0 @@
-static char *sccsid =
-   "@(#) dishand.c, Ver. 2.1 created 00:00:00 87/09/01";
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  *  Copyright (C) 1987 G. M. Harding, all rights reserved  *
-  *                                                         *
-  * Permission to copy and  redistribute is hereby granted, *
-  * provided full source code,  with all copyright notices, *
-  * accompanies any redistribution.                         *
-  *                                                         *
-  * This file contains the source code for most of the spe- *
-  * cialized handler routines of the disassembler  program. *
-  * (The file disfp.c contains handler routines specific to *
-  * the 8087 numeric  co-processor.)  Each handler  routine *
-  * interprets the opcode byte  (and subsequent data bytes, *
-  * if any)  of a particular family of opcodes,  and is re- *
-  * sponsible for generating appropriate output. All of the *
-  * code in this file is highly MACHINE-SPECIFIC, and would *
-  * have to be rewritten for a different  CPU.  The handler *
-  * routines are accessed  only via pointers in the optab[] *
-  * array, however, so machine dependencies are confined to *
-  * this file, its sister file "disfp.c", and the data file *
-  * "distabs.c".                                            *
-  *                                                         *
-  * All of the code in this file is based on the assumption *
-  * of sixteen-bit integers.                                *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#include "dis.h"              /* Disassembler declarations  */
-
-int segflg;                   /* Segment-override flag      */
-
-unsigned char objbuf[OBJMAX]; /* Buffer for object code     */
-
-int objptr;                   /* Index into objbuf[]        */
-
-unsigned long PC;             /* Current program counter    */
-\f
- /* * * * * *  MISCELLANEOUS SUPPORTING ROUTINES  * * * * * */
-
-
-void
-objini(j)                     /* Object code init routine   */
-
-   register int j;
-
-{
-   if ((segflg == 1) || (segflg == 2))
-      segflg *= 3;
-   else
-      segflg = 0;
-   objptr = 0;
-   objbuf[objptr++] = (unsigned char)(j);
-}
-
-
-void
-objout()                      /* Object-code output routine */
-
-{
-    register int k;
-
-   if ( ! objflg )
-      return;
-   else
-      {
-      printf("\t|");
-      if (symptr >= 0)
-         printf(" %05.5lx:",(PC + 1L - (long)(objptr)));
-      for (k = 0; k < objptr; ++k)
-         printf(" %02.2x",objbuf[k]);
-      putchar('\n');
-      }
-}
-
-
-void
-badseq(j,k)                   /* Invalid-sequence routine   */
-
-   register int j, k;
-
-{
-   printf("\t.byte\t0x%02.2x\t\t| invalid code sequence\n",j);
-   printf("\t.byte\t0x%02.2x\n",k);
-}
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This  routine  is the first of several  opcode-specific *
-  * handlers,  each of which is  dedicated  to a particular *
-  * opcode family.  A pointer to a handler  routine is con- *
-  * tained in the second field of each optab[]  entry.  The *
-  * dfhand()  routine is the default handler,  invoked when *
-  * no other handler is appropriate (generally, when an in- *
-  * valid opcode is encountered).                           *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-dfhand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF dfhand()  * * * * * * * * * */
-
-   segflg = 0;
-
-   printf("\t.byte\t0x%02.2x",j);
-
-   if (optab[j].min || optab[j].max)
-      putchar('\n');
-   else
-      printf("\t\t| unimplemented opcode\n");
-
-}/* * * * * * * * * * * END OF dfhand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the  single-byte  handler,  invoked  whenever a *
-  * one-byte opcode is encountered.                         *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-sbhand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF sbhand()  * * * * * * * * * */
-
-   objini(j);
-
-   if (j == 0x2e)                               /* seg cs   */
-      segflg = 1;
-
-   if ((j == 0x26)                              /* seg es   */
-    || (j == 0x36)                              /* seg ss   */
-    || (j == 0x3e))                             /* seg ds   */
-      segflg = 2;
-
-   printf("%s\n",optab[j].text);
-
-   objout();
-
-}/* * * * * * * * * * * END OF sbhand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for most of the processor's regular *
-  * arithmetic operations.                                  *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-aohand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF aohand()  * * * * * * * * * */
-
-   register int k;
-   int m, n;
-   char b[64];
-
-   objini(j);
-
-   switch (j & 7)
-      {
-      case 0 :
-      case 1 :
-      case 2 :
-      case 3 :
-         printf("%s\t",optab[j].text);
-         FETCH(k);
-         printf("%s\n",mtrans(j,k,TR_STD));
-         break;
-      case 4 :
-         FETCH(k);
-         printf("%s\tal,*0x%02.2x\n",optab[j].text,k);
-         break;
-      case 5 :
-         FETCH(m);
-         FETCH(n);
-         k = (n << 8) | m;
-         if (lookext((long)(k),(PC - 1),b))
-            printf("%s\tax,#%s\n",optab[j].text,b);
-         else
-            printf("%s\tax,#0x%04.4x\n",optab[j].text,k);
-         break;
-      default :
-         dfhand(j);
-         break;
-      }
-
-   objout();
-
-}/* * * * * * * * * * * END OF aohand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the  handler for opcodes  which  perform  short *
-  * (eight-bit) relative jumps.                             *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-sjhand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF sjhand()  * * * * * * * * * */
-
-   register int k;
-   int m;
-
-   objini(j);
-
-   FETCH(m);
-
-   if (m & 0x80)
-      k = 0xff00;
-   else
-      k = 0;
-
-   k |= m;
-
-   printf("%s\t%s\t\t| loc %05.5lx\n",optab[j].text,
-    lookup((PC + k + 1L),N_TEXT,LOOK_REL,-1L),
-    (PC + k + 1L));
-
-   objout();
-
-}/* * * * * * * * * * * END OF sjhand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the  handler for a  loosely-knit  family of op- *
-  * codes which perform  arithmetic and logical operations, *
-  * and which take immediate  data.  The routine's logic is *
-  * rather complex,  so,  in an effort to avoid  additional *
-  * complexity,  the search for external  references in the *
-  * relocation table has been dispensed with. Eager hackers *
-  * can try their hand at coding such a search.             *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-imhand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF imhand()  * * * * * * * * * */
-
-   unsigned long pc;
-   register int k;
-   int offset, oflag, immed, iflag, mod, opi, w, rm;
-   int m, n;
-   static char a[100], b[30];
-
-   objini(j);
-
-   FETCH(k);
-
-   pc = PC + 1;
-
-   offset = 0;
-   mod = (k & 0xc0) >> 6;
-   opi = (k & 0x38) >> 3;
-   w = j & 1;
-   rm = k & 7;
-
-   if ((j & 2)
-    && ((opi == 1)
-     || (opi == 4)
-     || (opi == 6)))
-      {
-      badseq(j,k);
-      return;
-      }
-
-   strcpy(a,OPFAM[opi]);
-
-   if ( ! w )
-      strcat(a,"b");
-
-   if ((oflag = mod) > 2)
-      oflag = 0;
-
-   if ((mod == 0) && (rm == 6))
-      {
-      FETCH(m);
-      FETCH(n);
-      offset = (n << 8) | m;
-      }
-   else if (oflag)
-      if (oflag == 2)
-         {
-         FETCH(m);
-         FETCH(n);
-         offset = (n << 8) | m;
-         }
-      else
-         {
-         FETCH(m);
-         if (m & 0x80)
-            n = 0xff00;
-         else
-            n = 0;
-         offset = n | m;
-         }
-
-   switch (j & 3)
-      {
-      case 0 :
-      case 2 :
-         FETCH(immed);
-         iflag = 0;
-         break;
-      case 1 :
-         FETCH(m);
-         FETCH(n);
-         immed = (n << 8) | m;
-         iflag = 1;
-         break;
-      case 3 :
-         FETCH(immed);
-         if (immed & 0x80)
-            immed &= 0xff00;
-         iflag = 0;
-         break;
-      }
-
-   strcat(a,"\t");
-
-   switch (mod)
-      {
-      case 0 :
-         if (rm == 6)
-            strcat(a,
-             lookup((long)(offset),N_DATA,LOOK_ABS,pc));
-         else
-            {
-            sprintf(b,"(%s)",REGS0[rm]);
-            strcat(a,b);
-            }
-         break;
-      case 1 :
-      case 2 :
-         if (mod == 1)
-            strcat(a,"*");
-         else
-            strcat(a,"#");
-         sprintf(b,"%d(",offset);
-         strcat(a,b);
-         strcat(a,REGS1[rm]);
-         strcat(a,")");
-         break;
-      case 3 :
-         strcat(a,REGS[(w << 3) | rm]);
-         break;
-      }
-
-   strcat(a,",");
-   if (iflag)
-      strcat(a,"#");
-   else
-      strcat(a,"*");
-   sprintf(b,"%d",immed);
-   strcat(a,b);
-
-   printf("%s\n",a);
-
-   objout();
-
-}/* * * * * * * * * * * END OF imhand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the  handler  for  various  "mov"-type  opcodes *
-  * which use the mod,  reg,  and r/m  fields of the second *
-  * code byte in a standard, straightforward way.           *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-mvhand(j)
-
-   int j;                     /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF mvhand()  * * * * * * * * * */
-
-   register int k, m = j;
-
-   objini(j);
-
-   FETCH(k);
-
-   if ((m == 0x84) || (m == 0x85)      /* Kind of kludgey   */
-    || (m == 0xc4) || (m == 0xc5)
-    || (m == 0x8d))
-      if (m & 0x40)
-         m |= 0x03;
-      else
-         m |= 0x02;
-
-   printf("%s\t%s\n",optab[j].text,mtrans(m,k,TR_STD));
-
-   objout();
-
-}/* * * * * * * * * * * END OF mvhand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for segment-register "mov" opcodes. *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-mshand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF mshand()  * * * * * * * * * */
-
-   register int k;
-
-   objini(j);
-
-   FETCH(k);
-
-   if (k & 0x20)
-      {
-      badseq(j,k);
-      return;
-      }
-
-   printf("%s\t%s\n",optab[j].text,mtrans(j,k,TR_SEG));
-
-   objout();
-
-}/* * * * * * * * * * * END OF mshand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the  handler for pops,  other than  single-byte *
-  * pops.  (The 8088 allows  popping into any register,  or *
-  * directly into memory,  accessed  either  immediately or *
-  * through a register and an index.)                       *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-pohand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF pohand()  * * * * * * * * * */
-
-   char *a;
-   register int k;
-
-   objini(j);
-
-   FETCH(k);
-
-   if (k & 0x38)
-      {
-      badseq(j,k);
-      return;
-      }
-
-   printf("%s\t",optab[j].text);
-
-   a = mtrans((j & 0xfd),k,TR_STD);
-
-   mtrunc(a);
-
-   printf("%s\n",a);
-
-   objout();
-
-}/* * * * * * * * * * * END OF pohand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler routine for intersegment  calls and *
-  * jumps.  Its output is never symbolic,  because the host *
-  * linker  does not allow  symbolic  intersegment  address *
-  * references except by means of symbolic  constants,  and *
-  * any such  constants in the symbol  table,  even if they *
-  * are of the  appropriate  value,  may be misleading.  In *
-  * compiled code,  intersegment  references  should not be *
-  * encountered,  and even in assembled  code,  they should *
-  * occur infrequently. If and when they do occur, however, *
-  * they will be disassembled in absolute form.             *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-cihand(j)
-
-   int j;                     /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF cihand()  * * * * * * * * * */
-
-   register int m, n;
-
-   objini(j);
-
-   printf("%s\t",optab[j].text);
-
-   FETCH(m);
-   FETCH(n);
-
-   printf("#0x%04.4x,",((n << 8) | m));
-
-   FETCH(m);
-   FETCH(n);
-
-   printf("#0x%04.4x\n",((n << 8) | m));
-
-   objout();
-
-}/* * * * * * * * * * * END OF cihand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for  "mov"  opcodes with  immediate *
-  * data.                                                   *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-mihand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF mihand()  * * * * * * * * * */
-
-   register int k;
-   int m, n;
-   char b[64];
-
-   objini(j);
-
-   printf("%s",optab[j].text);
-
-   if (j & 8)
-      {
-      FETCH(m);
-      FETCH(n);
-      k = ((n << 8) | m);
-      if (lookext((long)(k),(PC - 1),b))
-         printf("#%s\n",b);
-      else
-         printf("#%d\n",k);
-      }
-   else
-      {
-      FETCH(m);
-      printf("*%d\n",m);
-      }
-
-   objout();
-
-}/* * * * * * * * * * * END OF mihand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for a family of quick-move opcodes. *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-mqhand(j)
-
-   int j;                     /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF mqhand()  * * * * * * * * * */
-
-   unsigned long pc;
-   register int m, n;
-
-   objini(j);
-
-   pc = PC + 1;
-
-   FETCH(m);
-   FETCH(n);
-
-   m = (n << 8) | m;
-
-   printf("%s\t",optab[j].text);
-
-   if (j & 2)
-      printf("%s,%s\n",
-       lookup((long)(m),N_DATA,LOOK_ABS,pc),
-       REGS[(j & 1) << 3]);
-   else
-      printf("%s,%s\n",
-       REGS[(j & 1) << 3],
-       lookup((long)(m),N_DATA,LOOK_ABS,pc));
-
-   objout();
-
-}/* * * * * * * * * * * END OF mqhand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for a family of quick-test opcodes. *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-tqhand(j)
-
-   int j;                     /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF tqhand()  * * * * * * * * * */
-
-   register int m, n;
-   int k;
-   char b[64];
-
-   objini(j);
-
-   printf("%s\t%s,",optab[j].text,REGS[(j & 1) << 3]);
-
-   FETCH(m);
-
-   if (j & 1)
-      {
-      FETCH(n);
-      k = ((n << 8) | m);
-      if (lookext((long)(k),(PC - 1),b))
-         printf("#%s\n",b);
-      else
-         printf("#%d\n",k);
-      }
-   else
-      {
-      if (m & 80)
-         m |= 0xff00;
-      printf("*%d\n",m);
-      }
-
-   objout();
-
-}/* * * * * * * * * * * END OF tqhand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for multiple-byte "return" opcodes. *
-  * The 8088 allows returns to take an optional  16-bit ar- *
-  * gument,  which  reflects  the  amount to be added to SP *
-  * after  the pop of the  return  address.  The idea is to *
-  * facilitate  the use of local  parameters  on the stack. *
-  * After some  rumination,  it was decided to  disassemble *
-  * any such arguments as absolute quantities,  rather than *
-  * rummaging  through the symbol table for possible corre- *
-  * sponding constants.                                     *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-rehand(j)
-
-   int j;                     /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF rehand()  * * * * * * * * * */
-
-   register int m, n;
-
-   objini(j);
-
-   FETCH(m);
-   FETCH(n);
-
-   m = (n << 8) | m;
-
-   printf("%s\t#0x%04.4x\n",optab[j].text,m);
-
-   objout();
-
-}/* * * * * * * * * * * END OF rehand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for "mov"  opcodes involving memory *
-  * and immediate data.                                     *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-mmhand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF mmhand()  * * * * * * * * * */
-
-   char *a;
-   register int k;
-   char b[64];
-
-   objini(j);
-
-   FETCH(k);
-
-   if (k & 0x38)
-      {
-      badseq(j,k);
-      return;
-      }
-
-   printf("%s",optab[j].text);
-
-   if ( ! (j & 1) )
-      putchar('b');
-
-   a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);
-
-   mtrunc(a);
-
-   printf("\t%s,",a);
-
-   if (j & 1)
-      {
-      FETCH(j);
-      FETCH(k);
-      k = (k << 8) | j;
-      if (lookext((long)(k),(PC - 1),b))
-         printf("#%s\n",b);
-      else
-         printf("#%d\n",k);
-      }
-   else
-      {
-      FETCH(k);
-      printf("*%d\n",k);
-      }
-
-   objout();
-
-}/* * * * * * * * * * * END OF mmhand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the  handler  for the 8088  family of shift and *
-  * rotate instructions.                                    *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-srhand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF srhand()  * * * * * * * * * */
-
-   char *a;
-   register int k;
-
-   objini(j);
-
-   FETCH(k);
-
-   if ((k & 0x38) == 0x30)
-      {
-      badseq(j,k);
-      return;
-      }
-
-   printf("%s",OPFAM[((k & 0x38) >> 3) + 16]);
-
-   if ( ! (j & 1) )
-      putchar('b');
-
-   a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);
-
-   mtrunc(a);
-
-   printf("\t%s",a);
-
-   if (j & 2)
-      printf(",cl\n");
-   else
-      printf(",*1\n");
-
-   objout();
-
-}/* * * * * * * * * * * END OF srhand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for the ASCII-adjust opcodes.       *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-aahand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF aahand()  * * * * * * * * * */
-
-   register int k;
-
-   objini(j);
-
-   FETCH(k);
-
-   if (k != 0x0a)
-      {
-      badseq(j,k);
-      return;
-      }
-
-   printf("%s\n",optab[j].text);
-
-   objout();
-
-}/* * * * * * * * * * * END OF aahand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for port I/O opcodes  which specify *
-  * the port address as an immediate operand.               *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-iohand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF iohand()  * * * * * * * * * */
-
-   register int k;
-
-   objini(j);
-
-   FETCH(k);
-
-   printf("%s\t0x%02.2x\n",optab[j].text,k);
-
-   objout();
-
-}/* * * * * * * * * * * END OF iohand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the  handler  for opcodes  which  perform  long *
-  * (sixteen-bit) relative jumps and calls.                 *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-ljhand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF ljhand()  * * * * * * * * * */
-
-   register int k;
-   int m, n;
-
-   objini(j);
-
-   FETCH(m);
-   FETCH(n);
-
-   k = (n << 8) | m;
-
-   printf("%s\t%s\t\t| loc %05.5lx\n",optab[j].text,
-    lookup((PC + k + 1L),N_TEXT,LOOK_LNG,(PC - 1L)),
-    (PC + k + 1L));
-
-   objout();
-
-}/* * * * * * * * * * * END OF ljhand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for a pair of oddball opcodes (0xf6 *
-  * and 0xf7) which perform miscellaneous arithmetic opera- *
-  * tions not dealt with elsewhere.                         *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-mahand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF mahand()  * * * * * * * * * */
-
-   char *a;
-   register int k;
-   char b[64];
-
-   objini(j);
-
-   FETCH(k);
-
-   a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);
-
-   mtrunc(a);
-
-   switch (((k = objbuf[1]) & 0x38) >> 3)
-      {
-      case 0 :
-         printf("\ttest");
-         break;
-      case 1 :
-         badseq(j,k);
-         return;
-      case 2 :
-         printf("\tnot");
-         break;
-      case 3 :
-         printf("\tneg");
-         break;
-      case 4 :
-         printf("\tmul");
-         break;
-      case 5 :
-         printf("\timul");
-         break;
-      case 6 :
-         printf("\tdiv");
-         break;
-      case 7 :
-         printf("\tidiv");
-         break;
-      }
-
-   if ( ! (j & 1) )
-      putchar('b');
-
-   printf("\t%s",a);
-
-   if (k & 0x38)
-      putchar('\n');
-   else
-      if (j & 1)
-         {
-         FETCH(j);
-         FETCH(k);
-         k = (k << 8) | j;
-         if (lookext((long)(k),(PC - 1),b))
-            printf(",#%s\n",b);
-         else
-            printf(",#%d\n",k);
-         }
-      else
-         {
-         FETCH(k);
-         printf(",*%d\n",k);
-         }
-
-   objout();
-
-}/* * * * * * * * * * * END OF mahand() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the handler for miscellaneous jump, call, push, *
-  * and increment/decrement opcodes  (0xfe and 0xff)  which *
-  * are not dealt with elsewhere.                           *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-mjhand(j)
-
-   register int j;            /* Pointer to optab[] entry   */
-
-{/* * * * * * * * * *  START OF mjhand()  * * * * * * * * * */
-
-   char *a;
-   register int k;
-
-   objini(j);
-
-   FETCH(k);
-
-   a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);
-
-   mtrunc(a);
-
-   switch (((k = objbuf[1]) & 0x38) >> 3)
-      {
-      case 0 :
-         printf("\tinc");
-         if ( ! (j & 1) )
-            putchar('b');
-         putchar('\t');
-         break;
-      case 1 :
-         printf("\tdec");
-         if ( ! (j & 1) )
-            putchar('b');
-         putchar('\t');
-         break;
-      case 2 :
-         if (j & 1)
-            printf("\tcall\t@");
-         else
-            goto BAD;
-         break;
-      case 3 :
-         if (j & 1)
-            printf("\tcalli\t@");
-         else
-            goto BAD;
-         break;
-      case 4 :
-         if (j & 1)
-            printf("\tjmp\t@");
-         else
-            goto BAD;
-         break;
-      case 5 :
-         if (j & 1)
-            printf("\tjmpi\t@");
-         else
-            goto BAD;
-         break;
-      case 6 :
-         if (j & 1)
-            printf("\tpush\t");
-         else
-            goto BAD;
-         break;
-      case 7 :
- BAD :
-         badseq(j,k);
-         return;
-      }
-
-   printf("%s\n",a);
-
-   objout();
-
-}/* * * * * * * * * * * END OF mjhand() * * * * * * * * * * */
-\f
-
diff --git a/commands/dis88/dismain.c b/commands/dis88/dismain.c
deleted file mode 100644 (file)
index 7770dc8..0000000
+++ /dev/null
@@ -1,631 +0,0 @@
-static char *sccsid =  "@(#) dismain.c, Ver. 2.1 created 00:00:00 87/09/01";
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  *  Copyright (C) 1987 G. M. Harding, all rights reserved  *
-  *                                                         *
-  * Permission to copy and  redistribute is hereby granted, *
-  * provided full source code,  with all copyright notices, *
-  * accompanies any redistribution.                         *
-  *                                                         *
-  * This file  contains  the source  code for the  machine- *
-  * independent  portions of a disassembler  program to run *
-  * in a Unix (System III) environment.  It expects, as its *
-  * input, a file in standard a.out format, optionally con- *
-  * taining symbol table information.  If a symbol table is *
-  * present, it will be used in the disassembly; otherwise, *
-  * all address references will be literal (absolute).      *
-  *                                                         *
-  * The disassembler  program was originally written for an *
-  * Intel 8088 CPU.  However, all details of the actual CPU *
-  * architecture are hidden in three machine-specific files *
-  * named  distabs.c,  dishand.c,  and disfp.c  (the latter *
-  * file is specific to the 8087 numeric co-processor). The *
-  * code in this file is generic,  and should require mini- *
-  * mal revision if a different CPU is to be targeted. If a *
-  * different version of Unix is to be targeted, changes to *
-  * this file may be necessary, and if a completely differ- *
-  * ent OS is to be targeted, all bets are off.             *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#include "dis.h"              /* Disassembler declarations  */
-
-extern char *release;         /* Contains release string    */
-static char *IFILE = NULL;    /* Points to input file name  */
-static char *OFILE = NULL;    /* Points to output file name */
-static char *PRG;             /* Name of invoking program   */
-static unsigned long zcount;  /* Consecutive "0" byte count */
-int objflg = 0;               /* Flag: output object bytes  */
-
-#define unix 1
-#define i8086 1
-#define ibmpc 1
-
-#if unix && i8086 && ibmpc    /* Set the CPU identifier     */
-static int cpuid = 1;
-#else
-static int cpuid = 0;
-#endif
-
-_PROTOTYPE(static void usage, (char *s ));
-_PROTOTYPE(static void fatal, (char *s, char *t ));
-_PROTOTYPE(static void zdump, (unsigned long beg ));
-_PROTOTYPE(static void prolog, (void));
-_PROTOTYPE(static void distext, (void));
-_PROTOTYPE(static void disdata, (void));
-_PROTOTYPE(static void disbss, (void));
-
-_PROTOTYPE(static char *invoker, (char *s));
-_PROTOTYPE(static int objdump, (char *c));
-_PROTOTYPE(static char *getlab, (int type));
-_PROTOTYPE(static void prolog, (void));
-
- /* * * * * * * MISCELLANEOUS UTILITY FUNCTIONS * * * * * * */
-
-static void
-usage(s)
-   register char *s;
-{
-   fprintf(stderr,"Usage: %s [-o] ifile [ofile]\n",s);
-   exit(-1);
-}
-
-static void
-fatal(s,t)
-   register char *s, *t;
-{
-   fprintf(stderr,"\07%s: %s\n",s,t);
-   exit(-1);
-}
-
-static void
-zdump(beg)
-   unsigned long beg;
-{
-   beg = PC - beg;
-   if (beg > 1L)
-      printf("\t.zerow\t%ld\n",(beg >> 1));
-   if (beg & 1L)
-      printf("\t.byte\t0\n");
-}
-
-static char *
-invoker(s)
-   register char *s;
-{
-   register int k;
-
-   k = strlen(s);
-
-   while (k--)
-      if (s[k] == '/')
-         {
-         s += k;
-         ++s;
-         break;
-         }
-
-   return (s);
-}
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This rather tricky routine supports the disdata() func- *
-  * tion.  Its job is to output the code for a sequence  of *
-  * data bytes whenever the object buffer is full,  or when *
-  * a symbolic label is to be output. However, it must also *
-  * keep track of  consecutive  zero words so that  lengthy *
-  * stretches of null data can be  compressed by the use of *
-  * an  appropriate  assembler  pseudo-op.  It does this by *
-  * setting and testing a file-wide  flag which counts suc- *
-  * cessive full buffers of null data. The function returns *
-  * a logical  TRUE value if it outputs  anything,  logical *
-  * FALSE otherwise.  (This enables disdata()  to determine *
-  * whether to output a new  synthetic  label when there is *
-  * no symbol table.)                                       *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-static int
-objdump(c)
-
-   register char *c;
-
-{/* * * * * * * * * * START OF  objdump() * * * * * * * * * */
-
-   register int k;
-   int retval = 0;
-
-   if (objptr == OBJMAX)
-      {
-      for (k = 0; k < OBJMAX; ++k)
-         if (objbuf[k])
-            break;
-      if (k == OBJMAX)
-         {
-         zcount += k;
-         objptr = 0;
-         if (c == NULL)
-            return (retval);
-         }
-      }
-
-   if (zcount)
-      {
-      printf("\t.zerow\t%ld\n",(zcount >> 1));
-      ++retval;
-      zcount = 0L;
-      }
-
-   if (objptr)
-      {
-      printf("\t.byte\t");
-      ++retval;
-      }
-   else
-      return (retval);
-
-   for (k = 0; k < objptr; ++k)
-      {
-      printf("0x%02.2x",objbuf[k]);
-      if (k < (objptr - 1))
-         putchar(',');
-      else
-         putchar('\n');
-      }
-
-   objptr = 0;
-
-   return (retval);
-
-}/* * * * * * * * * *  END OF  objdump()  * * * * * * * * * */
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This  routine,  called  at the  beginning  of the input *
-  * cycle for each object byte,  and before any interpreta- *
-  * tion is  attempted,  searches  the symbol table for any *
-  * symbolic  name with a value  corresponding  to the cur- *
-  * rent PC and a type  corresponding  to the segment  type *
-  * (i.e.,  text, data, or bss) specified by the function's *
-  * argument. If any such name is found, a pointer to it is *
-  * returned; otherwise, a NULL pointer is returned.        *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-static char *
-getlab(type)
-register int type;
-{/* * * * * * * * * *  START OF getlab()  * * * * * * * * * */
-
-   register int k;
-   static char b[32], c[10];
-
-   if (symptr < 0)
-      if ((type == N_TEXT)
-       || ((type == N_DATA) && ( ! objptr ) && ( ! zcount )))
-         {
-         if (type == N_TEXT)
-            sprintf(b,"T%05.5lx:",PC);
-         else
-            sprintf(b,"D%05.5lx:",PC);
-         return (b);
-         }
-      else
-         return (NULL);
-
-   for (k = 0; k <= symptr; ++k)
-      if ((symtab[k].n_value == PC)
-       && ((symtab[k].n_sclass & N_SECT) == type))
-         {
-         sprintf(b,"%s:\n",getnam(k));
-         if (objflg && (type != N_TEXT))
-            sprintf(c,"| %05.5lx\n",PC);
-         strcat(b,c);
-         return (b);
-         }
-
-   return (NULL);
-
-}/* * * * * * * * * * * END OF getlab() * * * * * * * * * * */
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This routine  performs a preliminary scan of the symbol *
-  * table,  before disassembly begins, and outputs declara- *
-  * tions of globals and constants.                         *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-static void
-prolog()
-
-{/* * * * * * * * * *  START OF prolog()  * * * * * * * * * */
-
-   register int j, flag;
-
-   if (symptr < 0)
-      return;
-
-   for (j = flag = 0; j <= symptr; ++j)
-      if ((symtab[j].n_sclass & N_CLASS) == C_EXT)
-         if (((symtab[j].n_sclass & N_SECT) > N_UNDF)
-          && ((symtab[j].n_sclass & N_SECT) < N_COMM))
-            {
-            char *c = getnam(j);
-            printf("\t.globl\t%s",c);
-            if (++flag == 1)
-               {
-               putchar('\t');
-               if (strlen(c) < 8)
-                  putchar('\t');
-               printf("| Internal global\n");
-               }
-            else
-               putchar('\n');
-            }
-         else
-            if (symtab[j].n_value)
-               {
-               char *c = getnam(j);
-               printf("\t.comm\t%s,0x%08.8lx",c,
-                symtab[j].n_value);
-               if (++flag == 1)
-                  printf("\t| Internal global\n");
-               else
-                  putchar('\n');
-               }
-
-   if (flag)
-      putchar('\n');
-
-   for (j = flag = 0; j <= relptr; ++j)
-      if (relo[j].r_symndx < S_BSS)
-         {
-         char *c = getnam(relo[j].r_symndx);
-         ++flag;
-         printf("\t.globl\t%s",c);
-         putchar('\t');
-         if (strlen(c) < 8)
-            putchar('\t');
-         printf("| Undef: %05.5lx\n",relo[j].r_vaddr);
-         }
-
-   if (flag)
-      putchar('\n');
-
-   for (j = flag = 0; j <= symptr; ++j)
-      if ((symtab[j].n_sclass & N_SECT) == N_ABS)
-         {
-         char *c = getnam(j);
-         printf("%s=0x%08.8lx",c,symtab[j].n_value);
-         if (++flag == 1)
-            {
-            printf("\t\t");
-            if (strlen(c) < 5)
-               putchar('\t');
-            printf("| Literal\n");
-            }
-         else
-            putchar('\n');
-         }
-
-   if (flag)
-      putchar('\n');
-
-}/* * * * * * * * * * * END OF prolog() * * * * * * * * * * */
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This function is  responsible  for  disassembly  of the *
-  * object file's text segment.                             *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-static void
-distext()
-
-{/* * * * * * * * * * START OF  distext() * * * * * * * * * */
-
-   char *c;
-   register int j;
-   register void (*f)();
-
-   for (j = 0; j < (int)(HDR.a_hdrlen); ++j)
-      getchar();
-
-   printf("| %s, %s\n\n",PRG,release);
-
-   printf("| @(");
-
-   printf("#)\tDisassembly of %s",IFILE);
-
-   if (symptr < 0)
-      printf(" (no symbols)\n\n");
-   else
-      printf("\n\n");
-
-   if (HDR.a_flags & A_EXEC)
-      printf("| File is executable\n\n");
-
-   if (HDR.a_flags & A_SEP)
-      {
-      printf("| File has split I/D space, and may have\n");
-      printf("| extraneous instructions in text segment\n\n");
-      }
-
-   prolog();
-
-   printf("\t.text\t\t\t| loc = %05.5lx, size = %05.5lx\n\n",
-    PC,HDR.a_text);
-
-   segflg = 0;
-
-   for (PC = 0L; PC < HDR.a_text; ++PC)
-      {
-      j = getchar() & 0xff;
-      if ((j == 0) && ((PC + 1L) == HDR.a_text))
-         {
-         ++PC;
-         break;
-         }
-      if ((c = getlab(N_TEXT)) != NULL)
-         printf("%s",c);
-      f = optab[j].func;
-      (*f)(j);
-      }
-
-}/* * * * * * * * * *  END OF  distext()  * * * * * * * * * */
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This  function  handles the object file's data segment. *
-  * There is no good way to disassemble a data segment, be- *
-  * cause it is  impossible  to tell,  from the object code *
-  * alone,  what each data byte refers to.  If it refers to *
-  * an external symbol,  the reference can be resolved from *
-  * the relocation table, if there is one.  However,  if it *
-  * refers to a static symbol,  it cannot be  distinguished *
-  * from numeric, character, or other pointer data. In some *
-  * cases,  one might make a semi-educated  guess as to the *
-  * nature of the data,  but such  guesses  are  inherently *
-  * haphazard,  and they are  bound to be wrong a good por- *
-  * tion of the time.  Consequently,  the data  segment  is *
-  * disassembled  as a byte  stream,  which will satisfy no *
-  * one but which, at least, will never mislead anyone.     *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-static void
-disdata()
-
-{/* * * * * * * * * * START OF  disdata() * * * * * * * * * */
-
-   register char *c;
-   register int j;
-   unsigned long end;
-
-   putchar('\n');
-
-   if (HDR.a_flags & A_SEP)
-      {
-      PC = 0L;
-      end = HDR.a_data;
-      }
-   else
-      end = HDR.a_text + HDR.a_data;
-
-   printf("\t.data\t\t\t| loc = %05.5lx, size = %05.5lx\n\n",
-    PC,HDR.a_data);
-
-   segflg = 0;
-
-   for (objptr = 0, zcount = 0L; PC < end; ++PC)
-      {
-      if ((c = getlab(N_DATA)) != NULL)
-         {
-         objdump(c);
-         printf("%s",c);
-         }
-      if (objptr >= OBJMAX)
-         if (objdump(NULL) && (symptr < 0))
-            printf("D%05.5lx:",PC);
-      j = getchar() & 0xff;
-      objbuf[objptr++] = j;
-      }
-
-   objdump("");
-
-}/* * * * * * * * * *  END OF  disdata()  * * * * * * * * * */
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This  function  handles the object  file's bss segment. *
-  * Disassembly of the bss segment is easy,  because every- *
-  * thing in it is zero by definition.                      *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-static void disbss()
-
-{/* * * * * * * * * *  START OF disbss()  * * * * * * * * * */
-
-   register int j;
-   register char *c;
-   unsigned long beg, end;
-
-   putchar('\n');
-
-   if (HDR.a_flags & A_SEP)
-      end = HDR.a_data + HDR.a_bss;
-   else
-      end = HDR.a_text + HDR.a_data + HDR.a_bss;
-
-   printf("\t.bss\t\t\t| loc = %05.5lx, size = %05.5lx\n\n",
-    PC,HDR.a_bss);
-
-   segflg = 0;
-
-   for (beg = PC; PC < end; ++PC)
-      if ((c = getlab(N_BSS)) != NULL)
-         {
-         if (PC > beg)
-            {
-            zdump(beg);
-            beg = PC;
-            }
-         printf("%s",c);
-         }
-
-   if (PC > beg)
-      zdump(beg);
-
-}/* * * * * * * * * * * END OF disbss() * * * * * * * * * * */
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This is the program  entry  point.  The command line is *
-  * searched for an input file name, which must be present. *
-  * An optional output file name is also permitted; if none *
-  * is found, standard output is the default.  One command- *
-  * line option is available:  "-o",  which causes the pro- *
-  * gram to include  object code in comments along with its *
-  * mnemonic output.                                        *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-int
-main(argc,argv)
-
-   int argc;                  /* Command-line args from OS  */
-   char **argv;
-
-{/* * * * * * * * * * * START OF main() * * * * * * * * * * */
-
-   char a[1024];
-   register int fd;
-   long taboff, tabnum;
-   long reloff, relnum;
-
-   PRG = invoker(*argv);
-
-   while (*++argv != NULL)    /* Process command-line args  */
-      if (**argv == '-')
-         switch (*++*argv)
-            {
-            case 'o' :
-               if (*++*argv)
-                  usage(PRG);
-               else
-                  ++objflg;
-               break;
-            default :
-               usage(PRG);
-            }
-      else
-         if (IFILE == NULL)
-            IFILE = *argv;
-         else if (OFILE == NULL)
-            OFILE = *argv;
-         else
-            usage(PRG);
-
-   if (IFILE == NULL)
-      usage(PRG);
-   else
-      if ((fd = open(IFILE,0)) < 0)
-         {
-         sprintf(a,"can't access input file %s",IFILE);
-         fatal(PRG,a);
-         }
-
-   if (OFILE != NULL)
-      if (freopen(OFILE,"w",stdout) == NULL)
-         {
-         sprintf(a,"can't open output file %s",OFILE);
-         fatal(PRG,a);
-         }
-
-   if ( ! cpuid )
-      fprintf(stderr,"\07%s: warning: host/cpu clash\n",PRG);
-
-   read(fd, (char *) &HDR,sizeof(struct exec));
-
-   if (BADMAG(HDR))
-      {
-      sprintf(a,"input file %s not in object format",IFILE);
-      fatal(PRG,a);
-      }
-
-   if (HDR.a_cpu != A_I8086)
-      {
-      sprintf(a,"%s is not an 8086/8088 object file",IFILE);
-      fatal(PRG,a);
-      }
-
-   if (HDR.a_hdrlen <= A_MINHDR)
-      HDR.a_trsize = HDR.a_drsize = 0L;
-      HDR.a_tbase = HDR.a_dbase = 0L;
-/*   AST emergency patch
-      HDR.a_lnums = HDR.a_toffs = 0L;
-*/
-
-   reloff = HDR.a_text        /* Compute reloc data offset  */
-          + HDR.a_data
-          + (long)(HDR.a_hdrlen);
-
-   relnum =
-      (HDR.a_trsize + HDR.a_drsize) / sizeof(struct reloc);
-
-   taboff = reloff            /* Compute name table offset  */
-          + HDR.a_trsize
-          + HDR.a_drsize;
-
-   tabnum = HDR.a_syms / sizeof(struct nlist);
-
-   if (relnum > MAXSYM)
-      fatal(PRG,"reloc table overflow");
-
-   if (tabnum > MAXSYM)
-      fatal(PRG,"symbol table overflow");
-
-   if (relnum)                            /* Get reloc data */
-      if (lseek(fd,reloff,0) != reloff)
-         fatal(PRG,"lseek error");
-      else
-         {
-         for (relptr = 0; relptr < relnum; ++relptr)
-            read(fd, (char *) &relo[relptr],sizeof(struct reloc));
-         relptr--;
-         }
-
-   if (tabnum)                            /* Read in symtab */
-      if (lseek(fd,taboff,0) != taboff)
-         fatal(PRG,"lseek error");
-      else
-         {
-         for (symptr = 0; symptr < tabnum; ++symptr)
-            read(fd, (char *) &symtab[symptr],sizeof(struct nlist));
-         symptr--;
-         }
-   else
-      fprintf(stderr,"\07%s: warning: no symbols\n",PRG);
-
-   close(fd);
-
-   if (freopen(IFILE,"r",stdin) == NULL)
-      {
-      sprintf(a,"can't reopen input file %s",IFILE);
-      fatal(PRG,a);
-      }
-
-   distext();
-
-   disdata();
-
-   disbss();
-
-   exit(0);
-
-}/* * * * * * * * * * *  END OF main()  * * * * * * * * * * */
diff --git a/commands/dis88/disrel.c b/commands/dis88/disrel.c
deleted file mode 100644 (file)
index 37f3221..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-static char *copyright =
-   "@(#) Copyright (C) 1987 G. M. Harding, all rights reserved";
-
-static char *sccsid =
-   "@(#) disrel.c, Ver. 2.1 created 00:00:00 87/09/01";
-
-char *release =
-   "release 2.1 (MINIX)";
-
- /*
- **
- ** This file documents the major revisions to the 8088 sym-
- ** bolic disassembler. It also contains the release string
- ** which is output at the head of each disassembly, and the
- ** copyright string which must be incorporated in any code
- ** distribution.
- **
- ** Permission to copy and redistribute is hereby granted,
- ** provided full source code, with all copyright notices,
- ** accompanies any redistribution.
- **
- ** REVISION HISTORY:
- **
- ** SEP 87:
- **    After internal shakeout, released on Usenet.
- **
- ** JUN 88:
- **    Ported to MINIX
- */
-
diff --git a/commands/dis88/distabs.c b/commands/dis88/distabs.c
deleted file mode 100644 (file)
index 6390cec..0000000
+++ /dev/null
@@ -1,708 +0,0 @@
-static char *sccsid =
-   "@(#) distabs.c, Ver. 2.1 created 00:00:00 87/09/01";
-
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  *  Copyright (C) 1987 G. M. Harding, all rights reserved  *
-  *                                                         *
-  * Permission to copy and  redistribute is hereby granted, *
-  * provided full source code,  with all copyright notices, *
-  * accompanies any redistribution.                         *
-  *                                                         *
-  * This file  contains  the  lookup  tables and other data *
-  * structures for the Intel 8088 symbolic disassembler. It *
-  * also contains a few global  routines  which  facilitate *
-  * access to the tables,  for use primarily by the handler *
-  * functions.                                              *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-#include "dis.h"              /* Disassembler declarations  */
-
-struct exec HDR;              /* Used to hold header info   */
-
-struct nlist symtab[MAXSYM];  /* Array of symbol table info */
-
-struct reloc relo[MAXSYM];    /* Array of relocation info   */
-
-int symptr = -1,              /* Index into symtab[]        */
-    relptr = -1;              /* Index into relo[]          */
-
-char *REGS[] =                /* Table of register names    */
-   {
-   "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
-   "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
-   "es", "cs", "ss", "ds"
-   };
-
-char *REGS0[] =               /* Mode 0 register name table */
-   {
-   "bx_si", "bx_di", "bp_si", "bp_di", "si", "di", "", "bx"
-   };
-
-char *REGS1[] =               /* Mode 1 register name table */
-   {
-   "bx_si", "bx_di", "bp_si", "bp_di", "si", "di", "bp", "bx"
-   };
-
-int symrank[6][6] =           /* Symbol type/rank matrix    */
-   {
-              /* UND  ABS  TXT  DAT  BSS  COM */
-   /* UND */      5,   4,   1,   2,   3,   0,
-   /* ABS */      1,   5,   4,   3,   2,   0,
-   /* TXT */      4,   1,   5,   3,   2,   0,
-   /* DAT */      3,   1,   2,   5,   4,   0,
-   /* BSS */      3,   1,   2,   4,   5,   0,
-   /* COM */      2,   0,   1,   3,   4,   5
-   };
-\f
- /* * * * * * * * * * * * OPCODE DATA * * * * * * * * * * * */
-
-char ADD[]   = "\tadd",             /* Mnemonics by family  */
-     OR[]    = "\tor",
-     ADC[]   = "\tadc",
-     SBB[]   = "\tsbb",
-     AND[]   = "\tand",
-     SUB[]   = "\tsub",
-     XOR[]   = "\txor",
-     CMP[]   = "\tcmp",
-     NOT[]   = "\tnot",
-     NEG[]   = "\tneg",
-     MUL[]   = "\tmul",
-     DIV[]   = "\tdiv",
-     MOV[]   = "\tmov",
-     ESC[]   = "\tesc",
-     TEST[]  = "\ttest",
-     AMBIG[] = "",
-     ROL[]   = "\trol",
-     ROR[]   = "\tror",
-     RCL[]   = "\trcl",
-     RCR[]   = "\trcr",
-     SAL[]   = "\tsal",
-     SHR[]   = "\tshr",
-     SHL[]   = "\tshl",
-     SAR[]   = "\tsar";
-
-char *OPFAM[] =                     /* Family lookup table  */
-   {
-   ADD, OR, ADC, SBB, AND, SUB, XOR, CMP,
-   NOT, NEG, MUL, DIV, MOV, ESC, TEST, AMBIG,
-   ROL, ROR, RCL, RCR, SAL, SHR, SHL, SAR
-   };
-
-struct opcode optab[] =             /* Table of opcode data */
-   {
-   ADD,              aohand,  2,    4,             /* 0x00  */
-   ADD,              aohand,  2,    4,             /* 0x01  */
-   ADD,              aohand,  2,    4,             /* 0x02  */
-   ADD,              aohand,  2,    4,             /* 0x03  */
-   ADD,              aohand,  2,    2,             /* 0x04  */
-   ADD,              aohand,  3,    3,             /* 0x05  */
-   "\tpush\tes",     sbhand,  1,    1,             /* 0x06  */
-   "\tpop\tes",      sbhand,  1,    1,             /* 0x07  */
-   OR,               aohand,  2,    4,             /* 0x08  */
-   OR,               aohand,  2,    4,             /* 0x09  */
-   OR,               aohand,  2,    4,             /* 0x0a  */
-   OR,               aohand,  2,    4,             /* 0x0b  */
-   OR,               aohand,  2,    2,             /* 0x0c  */
-   OR,               aohand,  3,    3,             /* 0x0d  */
-   "\tpush\tcs",     sbhand,  1,    1,             /* 0x0e  */
-   NULL,             dfhand,  0,    0,             /* 0x0f  */
-   ADC,              aohand,  2,    4,             /* 0x10  */
-   ADC,              aohand,  2,    4,             /* 0x11  */
-   ADC,              aohand,  2,    4,             /* 0x12  */
-   ADC,              aohand,  2,    4,             /* 0x13  */
-   ADC,              aohand,  2,    2,             /* 0x14  */
-   ADC,              aohand,  3,    3,             /* 0x15  */
-   "\tpush\tss",     sbhand,  1,    1,             /* 0x16  */
-   "\tpop\tss",      sbhand,  1,    1,             /* 0x17  */
-   SBB,              aohand,  2,    4,             /* 0x18  */
-   SBB,              aohand,  2,    4,             /* 0x19  */
-   SBB,              aohand,  2,    4,             /* 0x1a  */
-   SBB,              aohand,  2,    4,             /* 0x1b  */
-   SBB,              aohand,  2,    2,             /* 0x1c  */
-   SBB,              aohand,  3,    3,             /* 0x1d  */
-   "\tpush\tds",     sbhand,  1,    1,             /* 0x1e  */
-   "\tpop\tds",      sbhand,  1,    1,             /* 0x1f  */
-   AND,              aohand,  2,    4,             /* 0x20  */
-   AND,              aohand,  2,    4,             /* 0x21  */
-   AND,              aohand,  2,    4,             /* 0x22  */
-   AND,              aohand,  2,    4,             /* 0x23  */
-   AND,              aohand,  2,    2,             /* 0x24  */
-   AND,              aohand,  3,    3,             /* 0x25  */
-   "\tseg\tes",      sbhand,  1,    1,             /* 0x26  */
-   "\tdaa",          sbhand,  1,    1,             /* 0x27  */
-   SUB,              aohand,  2,    4,             /* 0x28  */
-   SUB,              aohand,  2,    4,             /* 0x29  */
-   SUB,              aohand,  2,    4,             /* 0x2a  */
-   SUB,              aohand,  2,    4,             /* 0x2b  */
-   SUB,              aohand,  2,    2,             /* 0x2c  */
-   SUB,              aohand,  3,    3,             /* 0x2d  */
-   "\tseg\tcs",      sbhand,  1,    1,             /* 0x2e  */
-   "\tdas",          sbhand,  1,    1,             /* 0x2f  */
-   XOR,              aohand,  2,    4,             /* 0x30  */
-   XOR,              aohand,  2,    4,             /* 0x31  */
-   XOR,              aohand,  2,    4,             /* 0x32  */
-   XOR,              aohand,  2,    4,             /* 0x33  */
-   XOR,              aohand,  2,    2,             /* 0x34  */
-   XOR,              aohand,  3,    3,             /* 0x35  */
-   "\tseg\tss",      sbhand,  1,    1,             /* 0x36  */
-   "\taaa",          sbhand,  1,    1,             /* 0x37  */
-   CMP,              aohand,  2,    4,             /* 0x38  */
-   CMP,              aohand,  2,    4,             /* 0x39  */
-   CMP,              aohand,  2,    4,             /* 0x3a  */
-   CMP,              aohand,  2,    4,             /* 0x3b  */
-   CMP,              aohand,  2,    2,             /* 0x3c  */
-   CMP,              aohand,  3,    3,             /* 0x3d  */
-   "\tseg\tds",      sbhand,  1,    1,             /* 0x3e  */
-   "\taas",          sbhand,  1,    1,             /* 0x3f  */
-   "\tinc\tax",      sbhand,  1,    1,             /* 0x40  */
-   "\tinc\tcx",      sbhand,  1,    1,             /* 0x41  */
-   "\tinc\tdx",      sbhand,  1,    1,             /* 0x42  */
-   "\tinc\tbx",      sbhand,  1,    1,             /* 0x43  */
-   "\tinc\tsp",      sbhand,  1,    1,             /* 0x44  */
-   "\tinc\tbp",      sbhand,  1,    1,             /* 0x45  */
-   "\tinc\tsi",      sbhand,  1,    1,             /* 0x46  */
-   "\tinc\tdi",      sbhand,  1,    1,             /* 0x47  */
-   "\tdec\tax",      sbhand,  1,    1,             /* 0x48  */
-   "\tdec\tcx",      sbhand,  1,    1,             /* 0x49  */
-   "\tdec\tdx",      sbhand,  1,    1,             /* 0x4a  */
-   "\tdec\tbx",      sbhand,  1,    1,             /* 0x4b  */
-   "\tdec\tsp",      sbhand,  1,    1,             /* 0x4c  */
-   "\tdec\tbp",      sbhand,  1,    1,             /* 0x4d  */
-   "\tdec\tsi",      sbhand,  1,    1,             /* 0x4e  */
-   "\tdec\tdi",      sbhand,  1,    1,             /* 0x4f  */
-   "\tpush\tax",     sbhand,  1,    1,             /* 0x50  */
-   "\tpush\tcx",     sbhand,  1,    1,             /* 0x51  */
-   "\tpush\tdx",     sbhand,  1,    1,             /* 0x52  */
-   "\tpush\tbx",     sbhand,  1,    1,             /* 0x53  */
-   "\tpush\tsp",     sbhand,  1,    1,             /* 0x54  */
-   "\tpush\tbp",     sbhand,  1,    1,             /* 0x55  */
-   "\tpush\tsi",     sbhand,  1,    1,             /* 0x56  */
-   "\tpush\tdi",     sbhand,  1,    1,             /* 0x57  */
-   "\tpop\tax",      sbhand,  1,    1,             /* 0x58  */
-   "\tpop\tcx",      sbhand,  1,    1,             /* 0x59  */
-   "\tpop\tdx",      sbhand,  1,    1,             /* 0x5a  */
-   "\tpop\tbx",      sbhand,  1,    1,             /* 0x5b  */
-   "\tpop\tsp",      sbhand,  1,    1,             /* 0x5c  */
-   "\tpop\tbp",      sbhand,  1,    1,             /* 0x5d  */
-   "\tpop\tsi",      sbhand,  1,    1,             /* 0x5e  */
-   "\tpop\tdi",      sbhand,  1,    1,             /* 0x5f  */
-   NULL,             dfhand,  0,    0,             /* 0x60  */
-   NULL,             dfhand,  0,    0,             /* 0x61  */
-   NULL,             dfhand,  0,    0,             /* 0x62  */
-   NULL,             dfhand,  0,    0,             /* 0x63  */
-   NULL,             dfhand,  0,    0,             /* 0x64  */
-   NULL,             dfhand,  0,    0,             /* 0x65  */
-   NULL,             dfhand,  0,    0,             /* 0x66  */
-   NULL,             dfhand,  0,    0,             /* 0x67  */
-   NULL,             dfhand,  0,    0,             /* 0x68  */
-   NULL,             dfhand,  0,    0,             /* 0x69  */
-   NULL,             dfhand,  0,    0,             /* 0x6a  */
-   NULL,             dfhand,  0,    0,             /* 0x6b  */
-   NULL,             dfhand,  0,    0,             /* 0x6c  */
-   NULL,             dfhand,  0,    0,             /* 0x6d  */
-   NULL,             dfhand,  0,    0,             /* 0x6e  */
-   NULL,             dfhand,  0,    0,             /* 0x6f  */
-   "\tjo",           sjhand,  2,    2,             /* 0x70  */
-   "\tjno",          sjhand,  2,    2,             /* 0x71  */
-   "\tjc",           sjhand,  2,    2,             /* 0x72  */
-   "\tjnc",          sjhand,  2,    2,             /* 0x73  */
-   "\tjz",           sjhand,  2,    2,             /* 0x74  */
-   "\tjnz",          sjhand,  2,    2,             /* 0x75  */
-   "\tjna",          sjhand,  2,    2,             /* 0x76  */
-   "\tja",           sjhand,  2,    2,             /* 0x77  */
-   "\tjs",           sjhand,  2,    2,             /* 0x78  */
-   "\tjns",          sjhand,  2,    2,             /* 0x79  */
-   "\tjp",           sjhand,  2,    2,             /* 0x7a  */
-   "\tjnp",          sjhand,  2,    2,             /* 0x7b  */
-   "\tjl",           sjhand,  2,    2,             /* 0x7c  */
-   "\tjnl",          sjhand,  2,    2,             /* 0x7d  */
-   "\tjng",          sjhand,  2,    2,             /* 0x7e  */
-   "\tjg",           sjhand,  2,    2,             /* 0x7f  */
-   AMBIG,            imhand,  3,    5,             /* 0x80  */
-   AMBIG,            imhand,  4,    6,             /* 0x81  */
-   AMBIG,            imhand,  3,    5,             /* 0x82  */
-   AMBIG,            imhand,  3,    5,             /* 0x83  */
-   TEST,             mvhand,  2,    4,             /* 0x84  */
-   TEST,             mvhand,  2,    4,             /* 0x85  */
-   "\txchg",         mvhand,  2,    4,             /* 0x86  */
-   "\txchg",         mvhand,  2,    4,             /* 0x87  */
-   MOV,              mvhand,  2,    4,             /* 0x88  */
-   MOV,              mvhand,  2,    4,             /* 0x89  */
-   MOV,              mvhand,  2,    4,             /* 0x8a  */
-   MOV,              mvhand,  2,    4,             /* 0x8b  */
-   MOV,              mshand,  2,    4,             /* 0x8c  */
-   "\tlea",          mvhand,  2,    4,             /* 0x8d  */
-   MOV,              mshand,  2,    4,             /* 0x8e  */
-   "\tpop",          pohand,  2,    4,             /* 0x8f  */
-   "\tnop",          sbhand,  1,    1,             /* 0x90  */
-   "\txchg\tax,cx",  sbhand,  1,    1,             /* 0x91  */
-   "\txchg\tax,dx",  sbhand,  1,    1,             /* 0x92  */
-   "\txchg\tax,bx",  sbhand,  1,    1,             /* 0x93  */
-   "\txchg\tax,sp",  sbhand,  1,    1,             /* 0x94  */
-   "\txchg\tax,bp",  sbhand,  1,    1,             /* 0x95  */
-   "\txchg\tax,si",  sbhand,  1,    1,             /* 0x96  */
-   "\txchg\tax,di",  sbhand,  1,    1,             /* 0x97  */
-   "\tcbw",          sbhand,  1,    1,             /* 0x98  */
-   "\tcwd",          sbhand,  1,    1,             /* 0x99  */
-   "\tcalli",        cihand,  5,    5,             /* 0x9a  */
-   "\twait",         sbhand,  1,    1,             /* 0x9b  */
-   "\tpushf",        sbhand,  1,    1,             /* 0x9c  */
-   "\tpopf",         sbhand,  1,    1,             /* 0x9d  */
-   "\tsahf",         sbhand,  1,    1,             /* 0x9e  */
-   "\tlahf",         sbhand,  1,    1,             /* 0x9f  */
-   MOV,              mqhand,  3,    3,             /* 0xa0  */
-   MOV,              mqhand,  3,    3,             /* 0xa1  */
-   MOV,              mqhand,  3,    3,             /* 0xa2  */
-   MOV,              mqhand,  3,    3,             /* 0xa3  */
-   "\tmovb",         sbhand,  1,    1,             /* 0xa4  */
-   "\tmovw",         sbhand,  1,    1,             /* 0xa5  */
-   "\tcmpb",         sbhand,  1,    1,             /* 0xa6  */
-   "\tcmpw",         sbhand,  1,    1,             /* 0xa7  */
-   TEST,             tqhand,  2,    2,             /* 0xa8  */
-   TEST,             tqhand,  3,    3,             /* 0xa9  */
-   "\tstob",         sbhand,  1,    1,             /* 0xaa  */
-   "\tstow",         sbhand,  1,    1,             /* 0xab  */
-   "\tlodb",         sbhand,  1,    1,             /* 0xac  */
-   "\tlodw",         sbhand,  1,    1,             /* 0xad  */
-   "\tscab",         sbhand,  1,    1,             /* 0xae  */
-   "\tscaw",         sbhand,  1,    1,             /* 0xaf  */
-   "\tmov\tal,",     mihand,  2,    2,             /* 0xb0  */
-   "\tmov\tcl,",     mihand,  2,    2,             /* 0xb1  */
-   "\tmov\tdl,",     mihand,  2,    2,             /* 0xb2  */
-   "\tmov\tbl,",     mihand,  2,    2,             /* 0xb3  */
-   "\tmov\tah,",     mihand,  2,    2,             /* 0xb4  */
-   "\tmov\tch,",     mihand,  2,    2,             /* 0xb5  */
-   "\tmov\tdh,",     mihand,  2,    2,             /* 0xb6  */
-   "\tmov\tbh,",     mihand,  2,    2,             /* 0xb7  */
-   "\tmov\tax,",     mihand,  3,    3,             /* 0xb8  */
-   "\tmov\tcx,",     mihand,  3,    3,             /* 0xb9  */
-   "\tmov\tdx,",     mihand,  3,    3,             /* 0xba  */
-   "\tmov\tbx,",     mihand,  3,    3,             /* 0xbb  */
-   "\tmov\tsp,",     mihand,  3,    3,             /* 0xbc  */
-   "\tmov\tbp,",     mihand,  3,    3,             /* 0xbd  */
-   "\tmov\tsi,",     mihand,  3,    3,             /* 0xbe  */
-   "\tmov\tdi,",     mihand,  3,    3,             /* 0xbf  */
-   NULL,             dfhand,  0,    0,             /* 0xc0  */
-   NULL,             dfhand,  0,    0,             /* 0xc1  */
-   "\tret",          rehand,  3,    3,             /* 0xc2  */
-   "\tret",          sbhand,  1,    1,             /* 0xc3  */
-   "\tles",          mvhand,  2,    4,             /* 0xc4  */
-   "\tlds",          mvhand,  2,    4,             /* 0xc5  */
-   MOV,              mmhand,  3,    5,             /* 0xc6  */
-   MOV,              mmhand,  4,    6,             /* 0xc7  */
-   NULL,             dfhand,  0,    0,             /* 0xc8  */
-   NULL,             dfhand,  0,    0,             /* 0xc9  */
-   "\treti",         rehand,  3,    3,             /* 0xca  */
-   "\treti",         sbhand,  1,    1,             /* 0xcb  */
-   "\tint",          sbhand,  1,    1,             /* 0xcc  */
-   "\tint",          inhand,  2,    2,             /* 0xcd  */
-   "\tinto",         sbhand,  1,    1,             /* 0xce  */
-   "\tiret",         sbhand,  1,    1,             /* 0xcf  */
-   AMBIG,            srhand,  2,    4,             /* 0xd0  */
-   AMBIG,            srhand,  2,    4,             /* 0xd1  */
-   AMBIG,            srhand,  2,    4,             /* 0xd2  */
-   AMBIG,            srhand,  2,    4,             /* 0xd3  */
-   "\taam",          aahand,  2,    2,             /* 0xd4  */
-   "\taad",          aahand,  2,    2,             /* 0xd5  */
-   NULL,             dfhand,  0,    0,             /* 0xd6  */
-   "\txlat",         sbhand,  1,    1,             /* 0xd7  */
-   ESC,              eshand,  2,    2,             /* 0xd8  */
-   ESC,              eshand,  2,    2,             /* 0xd9  */
-   ESC,              eshand,  2,    2,             /* 0xda  */
-   ESC,              eshand,  2,    2,             /* 0xdb  */
-   ESC,              eshand,  2,    2,             /* 0xdc  */
-   ESC,              eshand,  2,    2,             /* 0xdd  */
-   ESC,              eshand,  2,    2,             /* 0xde  */
-   ESC,              eshand,  2,    2,             /* 0xdf  */
-   "\tloopne",       sjhand,  2,    2,             /* 0xe0  */
-   "\tloope",        sjhand,  2,    2,             /* 0xe1  */
-   "\tloop",         sjhand,  2,    2,             /* 0xe2  */
-   "\tjcxz",         sjhand,  2,    2,             /* 0xe3  */
-   "\tin",           iohand,  2,    2,             /* 0xe4  */
-   "\tinw",          iohand,  2,    2,             /* 0xe5  */
-   "\tout",          iohand,  2,    2,             /* 0xe6  */
-   "\toutw",         iohand,  2,    2,             /* 0xe7  */
-   "\tcall",         ljhand,  3,    3,             /* 0xe8  */
-   "\tjmp",          ljhand,  3,    3,             /* 0xe9  */
-   "\tjmpi",         cihand,  5,    5,             /* 0xea  */
-   "\tj",            sjhand,  2,    2,             /* 0xeb  */
-   "\tin",           sbhand,  1,    1,             /* 0xec  */
-   "\tinw",          sbhand,  1,    1,             /* 0xed  */
-   "\tout",          sbhand,  1,    1,             /* 0xee  */
-   "\toutw",         sbhand,  1,    1,             /* 0xef  */
-   "\tlock",         sbhand,  1,    1,             /* 0xf0  */
-   NULL,             dfhand,  0,    0,             /* 0xf1  */
-   "\trepnz",        sbhand,  1,    1,             /* 0xf2  */
-   "\trepz",         sbhand,  1,    1,             /* 0xf3  */
-   "\thlt",          sbhand,  1,    1,             /* 0xf4  */
-   "\tcmc",          sbhand,  1,    1,             /* 0xf5  */
-   AMBIG,            mahand,  2,    5,             /* 0xf6  */
-   AMBIG,            mahand,  2,    6,             /* 0xf7  */
-   "\tclc",          sbhand,  1,    1,             /* 0xf8  */
-   "\tstc",          sbhand,  1,    1,             /* 0xf9  */
-   "\tcli",          sbhand,  1,    1,             /* 0xfa  */
-   "\tsti",          sbhand,  1,    1,             /* 0xfb  */
-   "\tcld",          sbhand,  1,    1,             /* 0xfc  */
-   "\tstd",          sbhand,  1,    1,             /* 0xfd  */
-   AMBIG,            mjhand,  2,    4,             /* 0xfe  */
-   AMBIG,            mjhand,  2,    4              /* 0xff  */
-   };
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This simple routine  returns the name field of a symbol *
-  * table entry as a printable string.                      *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-char *
-getnam(k)
-
-   register int k;
-
-{/* * * * * * * * * *  START OF getnam()  * * * * * * * * * */
-
-   register int j;
-   static char a[9];
-
-   for (j = 0; j < 8; ++j)
-      if ( ! symtab[k].n_name[j] )
-         break;
-      else
-         a[j] = symtab[k].n_name[j];
-
-   a[j] = '\0';
-
-   return (a);
-
-}/* * * * * * * * * * * END OF getnam() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This function is  responsible  for mucking  through the *
-  * relocation  table in  search of  externally  referenced *
-  * symbols to be output as  operands.  It accepts two long *
-  * arguments: the code-segment location at which an extern *
-  * reference  is  expected,  and the offset value which is *
-  * embedded  in the  object  code and used at link time to *
-  * bias the external value.  In the most typical case, the *
-  * function will be called by lookup(), which always makes *
-  * a check for external names before  searching the symbol *
-  * table proper.  However,  it may also be called directly *
-  * by any function  (such as the  move-immediate  handler) *
-  * which wants to make an independent check for externals. *
-  * The caller is expected to supply, as the third argument *
-  * to the function,  a pointer to a character buffer large *
-  * enough to hold any possible  output  string.  Lookext() *
-  * will fill this  buffer and return a logical  TRUE if it *
-  * finds an extern reference;  otherwise, it will return a *
-  * logical FALSE, leaving the buffer undisturbed.          *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-int
-lookext(off,loc,buf)
-
-   long off, loc;
-   char *buf;
-
-{/* * * * * * * * * * START OF  lookext() * * * * * * * * * */
-
-   register int k;
-   char c[16];
-
-   if ((loc != -1L) && (relptr >= 0))
-      for (k = 0; k <= relptr; ++k)
-         if ((relo[k].r_vaddr == loc)
-          && (relo[k].r_symndx < S_BSS))
-            {
-            strcpy(buf,getnam(relo[k].r_symndx));
-            if (off)
-               {
-               if (off < 0)
-                  sprintf(c,"%ld",off);
-               else
-                  sprintf(c,"+%ld",off);
-               strcat(buf,c);
-               }
-            return (1);
-            }
-
-   return (0);
-
-}/* * * * * * * * * *  END OF  lookext()  * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This  function  finds an entry in the  symbol  table by *
-  * value.  Its input is a (long) machine address,  and its *
-  * output is a pointer to a string  containing  the corre- *
-  * sponding symbolic name. The function first searches the *
-  * relocation table for a possible external reference;  if *
-  * none is found,  a linear  search of the symbol table is *
-  * undertaken. If no matching symbol has been found at the *
-  * end of these searches,  the function  returns a pointer *
-  * to a string  containing the ASCII equivalent of the ad- *
-  * dress which was to be located,  so that,  regardless of *
-  * the success of the search,  the function's return value *
-  * is suitable for use as a memory-reference operand.  The *
-  * caller specifies the type of symbol to be found  (text, *
-  * data, bss, undefined,  absolute, or common) by means of *
-  * the function's  second  parameter.  The third parameter *
-  * specifies  the  format to be used in the event of a nu- *
-  * meric output:  zero for absolute format,  one for short *
-  * relative  format,  two for long  relative  format.  The *
-  * fourth  parameter is the address  which would appear in *
-  * the relocation table for the reference in question,  or *
-  * -1 if the relocation  table is not to be searched.  The *
-  * function attempts to apply a certain amount of intelli- *
-  * gence in its  selection  of symbols,  so it is possible *
-  * that,  in the absence of a type match,  a symbol of the *
-  * correct value but different type will be returned.      *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-char *
-lookup(addr,type,kind,ext)
-
-   long addr;              /* Machine address to be located */
-
-   int type,               /* Type of symbol to be matched  */
-       kind;               /* Addressing output mode to use */
-
-   long ext;               /* Value for extern ref, if any  */
-
-{/* * * * * * * * * *  START OF lookup()  * * * * * * * * * */
-
-   register int j, k;
-   static char b[64];
-
-   struct
-      {
-      int   i;
-      int   t;
-      }
-   best;
-
-   if (lookext(addr,ext,b))
-      return (b);
-
-   if (segflg)
-      if (segflg & 1)
-         type = N_TEXT;
-      else
-         type = N_DATA;
-
-   for (k = 0, best.i = -1; k <= symptr; ++k)
-      if (symtab[k].n_value == addr)
-         if ((j = symtab[k].n_sclass & N_SECT) == type)
-            {
-            best.t = j;
-            best.i = k;
-            break;
-            }
-         else if (segflg || (HDR.a_flags & A_SEP))
-            continue;
-         else if (best.i < 0)
-            best.t = j, best.i = k;
-         else if (symrank[type][j] > symrank[type][best.t])
-            best.t = j, best.i = k;
-
-   if (best.i >= 0)
-      return (getnam(best.i));
-
-   if (kind == LOOK_ABS)
-      sprintf(b,"0x%05.5x",addr);
-   else
-      {
-      long x = addr - (PC - kind);
-      if (x < 0)
-         sprintf(b,".%ld",x);
-      else
-         sprintf(b,".+%ld",x);
-      }
-
-   return (b);
-
-}/* * * * * * * * * * * END OF lookup() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This function  translates an 8088  addressing mode byte *
-  * to an equivalent assembler string,  returning a pointer *
-  * thereto.  If necessary,  it performs  successive inputs *
-  * of bytes from the object file in order to obtain offset *
-  * data,  adjusting PC  accordingly.  (The addressing mode *
-  * byte  appears in several  8088  opcodes;  it is used to *
-  * specify source and destination operand locations.)  The *
-  * third  argument to the function is zero if the standard *
-  * registers are to be used,  or eight if the segment reg- *
-  * isters are to be used; these constants are defined sym- *
-  * bolically in dis.h.  NOTE:  The mtrans()  function must *
-  * NEVER be called except  immediately  after fetching the *
-  * mode byte.  If any additional  object bytes are fetched *
-  * after  the fetch of the mode  byte,  mtrans()  will not *
-  * produce correct output!                                 *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-char *
-mtrans(c,m,type)
-
-   register int c;            /* Primary instruction byte   */
-   register int m;            /* Addressing mode byte       */
-
-   int type;                  /* Type code: standard or seg */
-
-{/* * * * * * * * * *  START OF mtrans()  * * * * * * * * * */
-
-   unsigned long pc;
-   int offset, oflag, dir, w, mod, reg, rm;
-   static char a[100];
-   static char b[30];
-
-   offset = 0;
-   dir = c & 2;
-   w = c & 1;
-   mod = (m & 0xc0) >> 6;
-   reg = (m & 0x38) >> 3;
-   rm = m & 7;
-   pc = PC + 1;
-
-   if (type)
-      w = 1;
-
-   if ((oflag = mod) > 2)
-      oflag = 0;
-
-   if (oflag)
-      {
-      int j, k;
-      if (oflag == 2)
-         {
-         FETCH(j);
-         FETCH(k);
-         offset = (k << 8) | j;
-         }
-      else
-         {
-         FETCH(j);
-         if (j & 0x80)
-            k = 0xff00;
-         else
-            k = 0;
-         offset = k | j;
-         }
-      }
-
-   if (dir)
-      {
-      strcpy(a,REGS[type + ((w << 3) | reg)]);
-      strcat(a,",");
-      switch (mod)
-         {
-         case 0 :
-            if (rm == 6)
-               {
-               int j, k;
-               FETCH(j);
-               FETCH(k);
-               offset = (k << 8) | j;
-               strcat(a,
-                lookup((long)(offset),N_DATA,LOOK_ABS,pc));
-               }
-            else
-               {
-               sprintf(b,"(%s)",REGS0[rm]);
-               strcat(a,b);
-               }
-            break;
-         case 1 :
-         case 2 :
-            if (mod == 1)
-               strcat(a,"*");
-            else
-               strcat(a,"#");
-            sprintf(b,"%d(",offset);
-            strcat(a,b);
-            strcat(a,REGS1[rm]);
-            strcat(a,")");
-            break;
-         case 3 :
-            strcat(a,REGS[(w << 3) | rm]);
-            break;
-         }
-      }
-   else
-      {
-      switch (mod)
-         {
-         case 0 :
-            if (rm == 6)
-               {
-               int j, k;
-               FETCH(j);
-               FETCH(k);
-               offset = (k << 8) | j;
-               strcpy(a,
-                lookup((long)(offset),N_DATA,LOOK_ABS,pc));
-               }
-            else
-               {
-               sprintf(b,"(%s)",REGS0[rm]);
-               strcpy(a,b);
-               }
-            break;
-         case 1 :
-         case 2 :
-            if (mod == 1)
-               strcpy(a,"*");
-            else
-               strcpy(a,"#");
-            sprintf(b,"%d(",offset);
-            strcat(a,b);
-            strcat(a,REGS1[rm]);
-            strcat(a,")");
-            break;
-         case 3 :
-            strcpy(a,REGS[(w << 3) | rm]);
-            break;
-         }
-      strcat(a,",");
-      strcat(a,REGS[type + ((w << 3) | reg)]);
-      }
-
-   return (a);
-
-}/* * * * * * * * * * * END OF mtrans() * * * * * * * * * * */
-\f
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-  *                                                         *
-  * This simple routine  truncates a string returned by the *
-  * mtrans() function, removing its source operand. This is *
-  * useful in handlers which ignore the "reg"  field of the *
-  * mode byte.                                              *
-  *                                                         *
-  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-void
-mtrunc(a)
-
-   register char *a;          /* Ptr. to string to truncate */
-
-{/* * * * * * * * * *  START OF mtrunc()  * * * * * * * * * */
-
-   register int k;
-
-   for (k = strlen(a) - 1; k >= 0; --k)
-      if (a[k] == ',')
-         {
-         a[k] = '\0';
-         break;
-         }
-
-}/* * * * * * * * * * * END OF mtrunc() * * * * * * * * * * */
-\f
-
diff --git a/commands/elf2aout/Makefile b/commands/elf2aout/Makefile
deleted file mode 100644 (file)
index 5ff81f7..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-PROG=  elf2aout
-
-.include <bsd.prog.mk>
diff --git a/commands/elf2aout/elf2aout.1 b/commands/elf2aout/elf2aout.1
deleted file mode 100644 (file)
index 7c1e951..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-.\"    $NetBSD: elf2aout.1,v 1.9 2003/02/25 10:35:40 wiz Exp $
-.\"
-.\" Copyright 1996 The Board of Trustees of The Leland Stanford
-.\" Junior University. All Rights Reserved.
-.\"
-.\" Author: Jonathan Stone
-.\"
-.\" Permission to use, copy, modify, and distribute this
-.\" software and its documentation for any purpose and without
-.\" fee is hereby granted, provided that the above copyright
-.\" notice and the above authorship notice appear in all copies.
-.\" Stanford University makes no representations about the suitability
-.\" of this software for any purpose.  It is provided "as is" without
-.\" express or implied warranty.
-.Dd September 30, 1996
-.Dt ELF2AOUT 1
-.Os
-.Sh NAME
-.Nm elf2aout
-.Nd convert a NetBSD ELF-format executable to NetBSD a.out format
-.Sh SYNOPSIS
-.Nm elf2aout
-.Ar elf-file
-.Ar aout-file
-.Sh DESCRIPTION
-Reads a fully-linked ELF executable (such as a  linked kernel)
-and produces an equivalent a.out format executable file.
-.Pp
-The
-.Nm
-utility is used to convert native
-.Nx
-ELF binaries
-to a.out format, for compatibility with bootblocks and kernel-reading
-utilities like
-.Xr kvm 3
-and
-.Xr kvm_mkdb 8 ,
-which currently expect an a.out format kernel.
-.\" .Sh DIAGNOSTICS
-.Sh SEE ALSO
-.Xr elf2ecoff 1 ,
-.Xr ld 1 ,
-.Xr kvm 3 ,
-.Xr a.out 5 ,
-.Xr elf 5 ,
-.Xr kvm_mkdb 8
-.Sh HISTORY
-.Nm
-was originally developed for
-.Nx Ns Tn /pmax
-by Ted Lemon
-and was first distributed with the pmax port of
-.Nx 1.1 .
-.Sh BUGS
-.Nm
-assumes there are no multiply-referenced symbols in the input ELF symbol
-section.
-It may be necessary to link with
-.Fl x
-to avoid such duplicate symbols.
-.Pp
-In some environments, the GNU binutils
-.Xr objcopy 1
-utility may be a better solution than
-.Nm .
diff --git a/commands/elf2aout/elf2aout.c b/commands/elf2aout/elf2aout.c
deleted file mode 100644 (file)
index 964b7a5..0000000
+++ /dev/null
@@ -1,531 +0,0 @@
-/*     $NetBSD: elf2aout.c,v 1.11 2004/04/23 02:55:11 simonb Exp $     */
-
-/*
- * Copyright (c) 1995
- *     Ted Lemon (hereinafter referred to as the author)
- *
- * 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. 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.
- */
-
-/* elf2aout.c
-
-   This program converts an elf executable to a NetBSD a.out executable.
-   The minimal symbol table is copied, but the debugging symbols and
-   other informational sections are not. */
-
-#include <sys/types.h>
-#include <a.out.h>
-#include "exec_elf.h"
-
-#include <a.out.h>
-#include <err.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-
-struct sect {
-       unsigned long vaddr;
-       unsigned long len;
-};
-
-void   combine __P((struct sect *, struct sect *, int));
-int    phcmp __P((const void *, const void *));
-char   *saveRead __P((int file, off_t offset, off_t len, char *name));
-void   copy __P((int, int, off_t, off_t));
-void   translate_syms __P((int, int, off_t, off_t, off_t, off_t));
-
-int    *symTypeTable;
-
-int
-main(int argc, char **argv)
-{
-       Elf32_Ehdr ex;
-       Elf32_Phdr *ph;
-       Elf32_Shdr *sh;
-       char   *shstrtab;
-       int     strtabix, symtabix;
-       int     i;
-       struct sect text, data, bss;
-       struct exec aex;
-       int     infile, outfile;
-       unsigned long cur_vma = ULONG_MAX;
-       int     symflag = 0;
-
-       strtabix = symtabix = -1;
-       text.len = data.len = bss.len = 0;
-       text.vaddr = data.vaddr = bss.vaddr = 0;
-
-       /* Check args... */
-       if (argc < 3 || argc > 4) {
-usage:
-               fprintf(stderr,
-                   "usage: elf2aout <elf executable> <a.out executable> [-s]\n");
-               exit(1);
-       }
-       if (argc == 4) {
-               if (strcmp(argv[3], "-s"))
-                       goto usage;
-               symflag = 1;
-       }
-       /* Try the input file... */
-       if ((infile = open(argv[1], O_RDONLY)) < 0) {
-               fprintf(stderr, "Can't open %s for read: %s\n",
-                   argv[1], strerror(errno));
-               exit(1);
-       }
-       /* Read the header, which is at the beginning of the file... */
-       i = read(infile, &ex, sizeof ex);
-       if (i != sizeof ex) {
-               fprintf(stderr, "ex: %s: %s.\n",
-                   argv[1], i ? strerror(errno) : "End of file reached");
-               exit(1);
-       }
-       /* Read the program headers... */
-       ph = (Elf32_Phdr *) saveRead(infile, ex.e_phoff,
-           ex.e_phnum * sizeof(Elf32_Phdr), "ph");
-       /* Read the section headers... */
-       sh = (Elf32_Shdr *) saveRead(infile, ex.e_shoff,
-           ex.e_shnum * sizeof(Elf32_Shdr), "sh");
-       /* Read in the section string table. */
-       shstrtab = saveRead(infile, sh[ex.e_shstrndx].sh_offset,
-           sh[ex.e_shstrndx].sh_size, "shstrtab");
-
-       /* Find space for a table matching ELF section indices to a.out symbol
-        * types. */
-       symTypeTable = (int *) malloc(ex.e_shnum * sizeof(int));
-       if (!symTypeTable) {
-               fprintf(stderr, "symTypeTable: can't allocate.\n");
-               exit(1);
-       }
-       memset(symTypeTable, 0, ex.e_shnum * sizeof(int));
-
-       /* Look for the symbol table and string table... Also map section
-        * indices to symbol types for a.out */
-       for (i = 0; i < ex.e_shnum; i++) {
-               char   *name = shstrtab + sh[i].sh_name;
-               if (!strcmp(name, ".symtab"))
-                       symtabix = i;
-               else
-                       if (!strcmp(name, ".strtab"))
-                               strtabix = i;
-                       else
-                               if (!strcmp(name, ".text") || !strcmp(name, ".rodata"))
-                                       symTypeTable[i] = N_TEXT;
-                               else
-                                       if (!strcmp(name, ".data") || !strcmp(name, ".sdata") ||
-                                           !strcmp(name, ".lit4") || !strcmp(name, ".lit8"))
-                                               symTypeTable[i] = N_DATA;
-                                       else
-                                               if (!strcmp(name, ".bss") || !strcmp(name, ".sbss"))
-                                                       symTypeTable[i] = N_BSS;
-       }
-
-       /* code assumes these will be found */
-       if(symtabix == -1 || strtabix == -1) {
-               fprintf(stderr, "no strings/symbols found\n");
-               exit(1);
-       }
-
-       /* Figure out if we can cram the program header into an a.out
-        * header... Basically, we can't handle anything but loadable
-        * segments, but we can ignore some kinds of segments.   We can't
-        * handle holes in the address space, and we handle start addresses
-        * other than 0x1000 by hoping that the loader will know where to load
-        * - a.out doesn't have an explicit load address.   Segments may be
-        * out of order, so we sort them first. */
-       qsort(ph, ex.e_phnum, sizeof(Elf32_Phdr), phcmp);
-       for (i = 0; i < ex.e_phnum; i++) {
-               /* Section types we can ignore... */
-               if (ph[i].p_type == PT_NULL || ph[i].p_type == PT_NOTE ||
-                   ph[i].p_type == PT_PHDR || ph[i].p_type == PT_MIPS_REGINFO
-                       || ph[i].p_type == PT_GNU_STACK)
-                       continue;
-               /* Section types we can't handle... */
-               else
-                       if (ph[i].p_type != PT_LOAD)
-                               errx(1, "Program header %d type %d can't be converted.", i, ph[i].p_type);
-               /* Writable (data) segment? */
-               if (ph[i].p_flags & PF_W) {
-                       struct sect ndata, nbss;
-
-                       ndata.vaddr = ph[i].p_vaddr;
-                       ndata.len = ph[i].p_filesz;
-                       nbss.vaddr = ph[i].p_vaddr + ph[i].p_filesz;
-                       nbss.len = ph[i].p_memsz - ph[i].p_filesz;
-
-                       combine(&data, &ndata, 0);
-                       combine(&bss, &nbss, 1);
-               } else {
-                       struct sect ntxt;
-
-                       ntxt.vaddr = ph[i].p_vaddr;
-                       ntxt.len = ph[i].p_filesz;
-
-                       combine(&text, &ntxt, 0);
-               }
-               /* Remember the lowest segment start address. */
-               if (ph[i].p_vaddr < cur_vma)
-                       cur_vma = ph[i].p_vaddr;
-       }
-
-       /* Sections must be in order to be converted... */
-       if (text.vaddr > data.vaddr || data.vaddr > bss.vaddr ||
-           text.vaddr + text.len > data.vaddr || data.vaddr + data.len > bss.vaddr) {
-               fprintf(stderr, "Sections ordering prevents a.out conversion.\n");
-               exit(1);
-       }
-       /* If there's a data section but no text section, then the loader
-        * combined everything into one section.   That needs to be the text
-        * section, so just make the data section zero length following text. */
-       if (data.len && !text.len) {
-               text = data;
-               data.vaddr = text.vaddr + text.len;
-               data.len = 0;
-       }
-       /* If there is a gap between text and data, we'll fill it when we copy
-        * the data, so update the length of the text segment as represented
-        * in a.out to reflect that, since a.out doesn't allow gaps in the
-        * program address space. */
-       if (text.vaddr + text.len < data.vaddr)
-               text.len = data.vaddr - text.vaddr;
-
-       /* We now have enough information to cons up an a.out header... */
-#ifndef __minix
-       aex.a_midmag = htonl((symflag << 26) | (MID_PMAX << 16) | OMAGIC);
-       if (ex.e_machine == EM_PPC)
-               aex.a_midmag = htonl((symflag << 26) | (MID_POWERPC << 16)
-                       | OMAGIC);
-#endif
-               
-       aex.a_text = text.len;
-       aex.a_data = data.len;
-       aex.a_bss = bss.len;
-#ifdef __minix
-       aex.a_hdrlen = sizeof(struct exec);
-       aex.a_magic[0] = A_MAGIC0;
-       aex.a_magic[1] = A_MAGIC1;
-       aex.a_cpu = A_I80386;
-       aex.a_flags = A_NSYM | A_EXEC;
-       aex.a_unused = 0;
-       aex.a_version = 0;
-       /* total adds an implicit stack limit */
-       aex.a_total = aex.a_text + aex.a_data + aex.a_bss + 20 * 1024 * 1024;
-#endif
-       aex.a_entry = ex.e_entry;
-       aex.a_syms = (sizeof(struct nlist) *
-           (symtabix != -1
-               ? sh[symtabix].sh_size / sizeof(Elf32_Sym) : 0));
-       aex.a_trsize = 0;
-       aex.a_drsize = 0;
-
-       /* Make the output file... */
-       if ((outfile = open(argv[2], O_WRONLY | O_CREAT, 0777)) < 0) {
-               fprintf(stderr, "Unable to create %s: %s\n", argv[2], strerror(errno));
-               exit(1);
-       }
-       /* Truncate file... */
-       if (ftruncate(outfile, 0)) {
-               warn("ftruncate %s", argv[2]);
-       }
-       /* Write the header... */
-       i = write(outfile, &aex, sizeof aex);
-       if (i != sizeof aex) {
-               perror("aex: write");
-               exit(1);
-       }
-       /* Copy the loadable sections.   Zero-fill any gaps less than 64k;
-        * complain about any zero-filling, and die if we're asked to
-        * zero-fill more than 64k. */
-       for (i = 0; i < ex.e_phnum; i++) {
-               /* Unprocessable sections were handled above, so just verify
-                * that the section can be loaded before copying. */
-               if (ph[i].p_type == PT_LOAD && ph[i].p_filesz) {
-                       if (cur_vma != ph[i].p_vaddr) {
-                               unsigned long gap = ph[i].p_vaddr - cur_vma;
-                               char    obuf[1024];
-                               if (gap > 65536)
-                                       errx(1,
-                       "Intersegment gap (%ld bytes) too large.", (long) gap);
-#ifdef DEBUG
-                               warnx("Warning: %ld byte intersegment gap.",
-                                   (long)gap);
-#endif
-                               memset(obuf, 0, sizeof obuf);
-                               while (gap) {
-                                       int     count = write(outfile, obuf, (gap > sizeof obuf
-                                               ? sizeof obuf : gap));
-                                       if (count < 0) {
-                                               fprintf(stderr, "Error writing gap: %s\n",
-                                                   strerror(errno));
-                                               exit(1);
-                                       }
-                                       gap -= count;
-                               }
-                       }
-                       copy(outfile, infile, ph[i].p_offset, ph[i].p_filesz);
-                       cur_vma = ph[i].p_vaddr + ph[i].p_filesz;
-               }
-       }
-
-       /* Copy and translate the symbol table... */
-       translate_syms(outfile, infile,
-           sh[symtabix].sh_offset, sh[symtabix].sh_size,
-           sh[strtabix].sh_offset, sh[strtabix].sh_size);
-
-       /* Looks like we won... */
-       exit(0);
-}
-
-/* translate_syms (out, in, offset, size)
-
-   Read the ELF symbol table from in at offset; translate it into a.out
-   nlist format and write it to out. */
-
-void
-translate_syms(out, in, symoff, symsize, stroff, strsize)
-       int     out, in;
-       off_t   symoff, symsize;
-       off_t   stroff, strsize;
-{
-#define SYMS_PER_PASS  64
-       Elf32_Sym inbuf[64];
-       struct nlist outbuf[64];
-       int     i, remaining, cur;
-       char   *oldstrings;
-       char   *newstrings, *nsp;
-       int     newstringsize, rem;
-
-       /* Zero the unused fields in the output buffer.. */
-       memset(outbuf, 0, sizeof outbuf);
-
-       /* Find number of symbols to process... */
-       remaining = symsize / sizeof(Elf32_Sym);
-
-       /* Suck in the old string table... */
-       oldstrings = saveRead(in, stroff, strsize, "string table");
-
-       /* Allocate space for the new one.   XXX We make the wild assumption
-        * that no two symbol table entries will point at the same place in
-        * the string table - if that assumption is bad, this could easily
-        * blow up. */
-       rem = newstringsize = strsize + remaining;
-       newstrings = (char *) malloc(newstringsize);
-       if (!newstrings) {
-               fprintf(stderr, "No memory for new string table!\n");
-               exit(1);
-       }
-       /* Initialize the table pointer... */
-       nsp = newstrings;
-
-       /* Go the start of the ELF symbol table... */
-       if (lseek(in, symoff, SEEK_SET) < 0) {
-               perror("translate_syms: lseek");
-               exit(1);
-       }
-       /* Translate and copy symbols... */
-       while (remaining) {
-               cur = remaining;
-               if (cur > SYMS_PER_PASS)
-                       cur = SYMS_PER_PASS;
-               remaining -= cur;
-               if ((i = read(in, inbuf, cur * sizeof(Elf32_Sym)))
-                   != cur * sizeof(Elf32_Sym)) {
-                       if (i < 0)
-                               perror("translate_syms");
-                       else
-                               fprintf(stderr, "translate_syms: premature end of file.\n");
-                       exit(1);
-               }
-               /* Do the translation... */
-               for (i = 0; i < cur; i++) {
-                       int     binding, type, m = sizeof(outbuf[i].n_name);
-                       int n;
-                       char *nn;
-
-                       /* Copy the symbol into the new table, but prepend an
-                        * underscore. */
-                       n = 1 + strlen(nsp+1);
-                       if(rem < n) {
-                               fprintf(stderr, "only %d remain.\n", rem);
-                               exit(1);
-                       }
-                       *nsp = '_';
-                       nn = nsp+1;
-                       strcpy(nsp + 1, oldstrings + inbuf[i].st_name);
-#ifndef __minix
-                       outbuf[i].n_un.n_strx = nsp - newstrings + 4;
-#else
-                       strncpy(outbuf[i].n_name, nn, m);
-                       outbuf[i].n_name[m-1] = '\0';
-#endif
-                       nsp += n;
-                       rem -= n;
-
-                       type = ELF32_ST_TYPE(inbuf[i].st_info);
-                       binding = ELF32_ST_BIND(inbuf[i].st_info);
-
-                       /* Convert ELF symbol type/section/etc info into a.out
-                        * type info. */
-                       if (type == STT_FILE)
-#ifdef N_FN
-                               outbuf[i].n_type = N_FN;
-#else
-                               outbuf[i].n_type = N_UNDF;
-#endif
-                       else
-                               if (inbuf[i].st_shndx == SHN_UNDEF)
-                                       outbuf[i].n_type = N_UNDF;
-                               else
-                                       if (inbuf[i].st_shndx == SHN_ABS)
-                                               outbuf[i].n_type = N_ABS;
-                                       else
-                                               if (inbuf[i].st_shndx == SHN_COMMON ||
-                                                   inbuf[i].st_shndx == SHN_MIPS_ACOMMON)
-                                                       outbuf[i].n_type = N_COMM;
-                                               else
-                                                       outbuf[i].n_type = symTypeTable[inbuf[i].st_shndx];
-#ifdef N_EXT
-                       if (binding == STB_GLOBAL)
-                               outbuf[i].n_type |= N_EXT;
-#endif
-                       /* Symbol values in executables should be compatible. */
-                       outbuf[i].n_value = inbuf[i].st_value;
-               }
-               /* Write out the symbols... */
-               if ((i = write(out, outbuf, cur * sizeof(struct nlist)))
-                   != cur * sizeof(struct nlist)) {
-                       fprintf(stderr, "translate_syms: write: %s\n", strerror(errno));
-                       exit(1);
-               }
-       }
-       /* Write out the string table length... */
-       if (write(out, &newstringsize, sizeof newstringsize)
-           != sizeof newstringsize) {
-               fprintf(stderr,
-                   "translate_syms: newstringsize: %s\n", strerror(errno));
-               exit(1);
-       }
-       /* Write out the string table... */
-       if (write(out, newstrings, newstringsize) != newstringsize) {
-               fprintf(stderr, "translate_syms: newstrings: %s\n", strerror(errno));
-               exit(1);
-       }
-}
-
-void
-copy(out, in, offset, size)
-       int     out, in;
-       off_t   offset, size;
-{
-       char    ibuf[4096];
-       int     remaining, cur, count;
-
-       /* Go to the start of the ELF symbol table... */
-       if (lseek(in, offset, SEEK_SET) < 0) {
-               perror("copy: lseek");
-               exit(1);
-       }
-       remaining = size;
-       while (remaining) {
-               cur = remaining;
-               if (cur > sizeof ibuf)
-                       cur = sizeof ibuf;
-               remaining -= cur;
-               if ((count = read(in, ibuf, cur)) != cur) {
-                       fprintf(stderr, "copy: read: %s\n",
-                           count ? strerror(errno) : "premature end of file");
-                       exit(1);
-               }
-               if ((count = write(out, ibuf, cur)) != cur) {
-                       perror("copy: write");
-                       exit(1);
-               }
-       }
-}
-/* Combine two segments, which must be contiguous.   If pad is true, it's
-   okay for there to be padding between. */
-void
-combine(base, new, pad)
-       struct sect *base, *new;
-       int     pad;
-{
-       if (!base->len)
-               *base = *new;
-       else
-               if (new->len) {
-                       if (base->vaddr + base->len != new->vaddr) {
-                               if (pad)
-                                       base->len = new->vaddr - base->vaddr;
-                               else {
-                                       fprintf(stderr,
-                                           "Non-contiguous data can't be converted.\n");
-                                       exit(1);
-                               }
-                       }
-                       base->len += new->len;
-               }
-}
-
-int
-phcmp(vh1, vh2)
-       const void *vh1, *vh2;
-{
-       Elf32_Phdr *h1, *h2;
-       h1 = (Elf32_Phdr *) vh1;
-       h2 = (Elf32_Phdr *) vh2;
-
-       if (h1->p_vaddr > h2->p_vaddr)
-               return 1;
-       else
-               if (h1->p_vaddr < h2->p_vaddr)
-                       return -1;
-               else
-                       return 0;
-}
-
-char   *
-saveRead(int file, off_t offset, off_t len, char *name)
-{
-       char   *tmp;
-       int     count;
-       off_t   off;
-       if ((off = lseek(file, offset, SEEK_SET)) < 0) {
-               fprintf(stderr, "%s: fseek: %s\n", name, strerror(errno));
-               exit(1);
-       }
-       if (!(tmp = (char *) malloc(len)))
-               errx(1, "%s: Can't allocate %ld bytes.", name, (long)len);
-       count = read(file, tmp, len);
-       if (count != len) {
-               fprintf(stderr, "%s: read: %s.\n",
-                   name, count ? strerror(errno) : "End of file reached");
-               exit(1);
-       }
-       return tmp;
-}
diff --git a/commands/elf2aout/elf_machdep.h b/commands/elf2aout/elf_machdep.h
deleted file mode 100644 (file)
index e346efb..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*     $NetBSD: elf_machdep.h,v 1.9 2001/12/09 23:05:57 thorpej Exp $  */
-
-#define        ELF32_MACHDEP_ENDIANNESS        ELFDATA2LSB
-#define        ELF32_MACHDEP_ID_CASES                                          \
-               case EM_386:                                            \
-               case EM_486:                                            \
-                       break;
-
-#define        ELF64_MACHDEP_ENDIANNESS        XXX     /* break compilation */
-#define        ELF64_MACHDEP_ID_CASES                                          \
-               /* no 64-bit ELF machine types supported */
-
-#define        ELF32_MACHDEP_ID                EM_386
-
-#define ARCH_ELFSIZE           32      /* MD native binary size */
-
-/* i386 relocations */
-#define        R_386_NONE      0
-#define        R_386_32        1
-#define        R_386_PC32      2
-#define        R_386_GOT32     3
-#define        R_386_PLT32     4
-#define        R_386_COPY      5
-#define        R_386_GLOB_DAT  6
-#define        R_386_JMP_SLOT  7
-#define        R_386_RELATIVE  8
-#define        R_386_GOTOFF    9
-#define        R_386_GOTPC     10
-/* The following relocations are GNU extensions. */
-#define        R_386_16        20
-#define        R_386_PC16      21
-#define        R_386_8         22
-#define        R_386_PC8       23
-
-#define        R_TYPE(name)    __CONCAT(R_386_,name)
diff --git a/commands/elf2aout/exec_elf.h b/commands/elf2aout/exec_elf.h
deleted file mode 100644 (file)
index 9c6c655..0000000
+++ /dev/null
@@ -1,948 +0,0 @@
-/*     $NetBSD: exec_elf.h,v 1.95 2008/04/28 20:24:10 martin Exp $     */
-
-/*-
- * Copyright (c) 1994 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _SYS_EXEC_ELF_H_
-#define        _SYS_EXEC_ELF_H_
-
-/*
- * The current ELF ABI specification is available at:
- *     http://www.sco.com/developers/gabi/
- *
- * Current header definitions are in:
- *     http://www.sco.com/developers/gabi/latest/ch4.eheader.html
- */
-
-#if defined(_KERNEL) || defined(_STANDALONE)
-#include <sys/types.h>
-#else
-#include <inttypes.h>
-#endif /* _KERNEL || _STANDALONE */
-
-#if defined(ELFSIZE)
-#define        CONCAT(x,y)     __CONCAT(x,y)
-#define        ELFNAME(x)      CONCAT(elf,CONCAT(ELFSIZE,CONCAT(_,x)))
-#define        ELFNAME2(x,y)   CONCAT(x,CONCAT(_elf,CONCAT(ELFSIZE,CONCAT(_,y))))
-#define        ELFNAMEEND(x)   CONCAT(x,CONCAT(_elf,ELFSIZE))
-#define        ELFDEFNNAME(x)  CONCAT(ELF,CONCAT(ELFSIZE,CONCAT(_,x)))
-#endif
-
-#if HAVE_NBTOOL_CONFIG_H
-#include <nbinclude/machine/elf_machdep.h>
-#else
-#include "elf_machdep.h"
-#endif
-
-typedef        uint8_t         Elf_Byte;
-
-typedef        uint32_t        Elf32_Addr;
-#define        ELF32_FSZ_ADDR  4
-typedef        uint32_t        Elf32_Off;
-#define        ELF32_FSZ_OFF   4
-typedef        int32_t         Elf32_Sword;
-#define        ELF32_FSZ_SWORD 4
-typedef        uint32_t        Elf32_Word;
-#define        ELF32_FSZ_WORD  4
-typedef        uint16_t        Elf32_Half;
-#define        ELF32_FSZ_HALF  2
-
-typedef        uint64_t        Elf64_Addr;
-#define        ELF64_FSZ_ADDR  8
-typedef        uint64_t        Elf64_Off;
-#define        ELF64_FSZ_OFF   8
-typedef        int32_t         Elf64_Shalf;
-#define        ELF64_FSZ_SHALF 4
-
-#ifndef ELF64_FSZ_SWORD
-typedef        int32_t         Elf64_Sword;
-#define        ELF64_FSZ_SWORD 4
-#endif /* ELF64_FSZ_SWORD */
-#ifndef ELF64_FSZ_WORD
-typedef        uint32_t        Elf64_Word;
-#define        ELF64_FSZ_WORD  4
-#endif /* ELF64_FSZ_WORD */
-
-typedef        int64_t         Elf64_Sxword;
-#define        ELF64_FSZ_XWORD 8
-typedef        uint64_t        Elf64_Xword;
-#define        ELF64_FSZ_XWORD 8
-typedef        uint32_t        Elf64_Half;
-#define        ELF64_FSZ_HALF  4
-typedef        uint16_t        Elf64_Quarter;
-#define        ELF64_FSZ_QUARTER 2
-
-/*
- * ELF Header
- */
-#define        ELF_NIDENT      16
-
-typedef struct {
-       unsigned char   e_ident[ELF_NIDENT];    /* Id bytes */
-       Elf32_Half      e_type;                 /* file type */
-       Elf32_Half      e_machine;              /* machine type */
-       Elf32_Word      e_version;              /* version number */
-       Elf32_Addr      e_entry;                /* entry point */
-       Elf32_Off       e_phoff;                /* Program hdr offset */
-       Elf32_Off       e_shoff;                /* Section hdr offset */
-       Elf32_Word      e_flags;                /* Processor flags */
-       Elf32_Half      e_ehsize;               /* sizeof ehdr */
-       Elf32_Half      e_phentsize;            /* Program header entry size */
-       Elf32_Half      e_phnum;                /* Number of program headers */
-       Elf32_Half      e_shentsize;            /* Section header entry size */
-       Elf32_Half      e_shnum;                /* Number of section headers */
-       Elf32_Half      e_shstrndx;             /* String table index */
-} Elf32_Ehdr;
-
-typedef struct {
-       unsigned char   e_ident[ELF_NIDENT];    /* Id bytes */
-       Elf64_Quarter   e_type;                 /* file type */
-       Elf64_Quarter   e_machine;              /* machine type */
-       Elf64_Half      e_version;              /* version number */
-       Elf64_Addr      e_entry;                /* entry point */
-       Elf64_Off       e_phoff;                /* Program hdr offset */
-       Elf64_Off       e_shoff;                /* Section hdr offset */
-       Elf64_Half      e_flags;                /* Processor flags */
-       Elf64_Quarter   e_ehsize;               /* sizeof ehdr */
-       Elf64_Quarter   e_phentsize;            /* Program header entry size */
-       Elf64_Quarter   e_phnum;                /* Number of program headers */
-       Elf64_Quarter   e_shentsize;            /* Section header entry size */
-       Elf64_Quarter   e_shnum;                /* Number of section headers */
-       Elf64_Quarter   e_shstrndx;             /* String table index */
-} Elf64_Ehdr;
-
-/* e_ident offsets */
-#define        EI_MAG0         0       /* '\177' */
-#define        EI_MAG1         1       /* 'E'    */
-#define        EI_MAG2         2       /* 'L'    */
-#define        EI_MAG3         3       /* 'F'    */
-#define        EI_CLASS        4       /* File class */
-#define        EI_DATA         5       /* Data encoding */
-#define        EI_VERSION      6       /* File version */
-#define        EI_OSABI        7       /* Operating system/ABI identification */
-#define        EI_ABIVERSION   8       /* ABI version */
-#define        EI_PAD          9       /* Start of padding bytes up to EI_NIDENT*/
-#define        EI_NIDENT       16      /* First non-ident header byte */
-
-/* e_ident[EI_MAG0,EI_MAG3] */
-#define        ELFMAG0         0x7f
-#define        ELFMAG1         'E'
-#define        ELFMAG2         'L'
-#define        ELFMAG3         'F'
-#define        ELFMAG          "\177ELF"
-#define        SELFMAG         4
-
-/* e_ident[EI_CLASS] */
-#define        ELFCLASSNONE    0       /* Invalid class */
-#define        ELFCLASS32      1       /* 32-bit objects */
-#define        ELFCLASS64      2       /* 64-bit objects */
-#define        ELFCLASSNUM     3
-
-/* e_ident[EI_DATA] */
-#define        ELFDATANONE     0       /* Invalid data encoding */
-#define        ELFDATA2LSB     1       /* 2's complement values, LSB first */
-#define        ELFDATA2MSB     2       /* 2's complement values, MSB first */
-
-/* e_ident[EI_VERSION] */
-#define        EV_NONE         0       /* Invalid version */
-#define        EV_CURRENT      1       /* Current version */
-#define        EV_NUM          2
-
-/* e_ident[EI_OSABI] */
-#define        ELFOSABI_SYSV           0       /* UNIX System V ABI */
-#define        ELFOSABI_HPUX           1       /* HP-UX operating system */
-#define ELFOSABI_NETBSD                2       /* NetBSD */
-#define ELFOSABI_LINUX         3       /* GNU/Linux */
-#define ELFOSABI_HURD          4       /* GNU/Hurd */
-#define ELFOSABI_86OPEN                5       /* 86Open */
-#define ELFOSABI_SOLARIS       6       /* Solaris */
-#define ELFOSABI_MONTEREY      7       /* Monterey */
-#define ELFOSABI_IRIX          8       /* IRIX */
-#define ELFOSABI_FREEBSD       9       /* FreeBSD */
-#define ELFOSABI_TRU64         10      /* TRU64 UNIX */
-#define ELFOSABI_MODESTO       11      /* Novell Modesto */
-#define ELFOSABI_OPENBSD       12      /* OpenBSD */
-/* Unofficial OSABIs follow */
-#define ELFOSABI_ARM           97      /* ARM */
-#define        ELFOSABI_STANDALONE     255     /* Standalone (embedded) application */
-
-/* e_type */
-#define        ET_NONE         0       /* No file type */
-#define        ET_REL          1       /* Relocatable file */
-#define        ET_EXEC         2       /* Executable file */
-#define        ET_DYN          3       /* Shared object file */
-#define        ET_CORE         4       /* Core file */
-#define        ET_NUM          5
-
-#define        ET_LOOS         0xfe00  /* Operating system specific range */
-#define        ET_HIOS         0xfeff
-#define        ET_LOPROC       0xff00  /* Processor-specific range */
-#define        ET_HIPROC       0xffff
-
-/* e_machine */
-#define        EM_NONE         0       /* No machine */
-#define        EM_M32          1       /* AT&T WE 32100 */
-#define        EM_SPARC        2       /* SPARC */
-#define        EM_386          3       /* Intel 80386 */
-#define        EM_68K          4       /* Motorola 68000 */
-#define        EM_88K          5       /* Motorola 88000 */
-#define        EM_486          6       /* Intel 80486 */
-#define        EM_860          7       /* Intel 80860 */
-#define        EM_MIPS         8       /* MIPS I Architecture */
-#define        EM_S370         9       /* Amdahl UTS on System/370 */
-#define        EM_MIPS_RS3_LE  10      /* MIPS RS3000 Little-endian */
-                       /* 11-14 - Reserved */
-#define        EM_RS6000       11      /* IBM RS/6000 XXX reserved */
-#define        EM_PARISC       15      /* Hewlett-Packard PA-RISC */
-#define        EM_NCUBE        16      /* NCube XXX reserved */
-#define        EM_VPP500       17      /* Fujitsu VPP500 */
-#define        EM_SPARC32PLUS  18      /* Enhanced instruction set SPARC */
-#define        EM_960          19      /* Intel 80960 */
-#define        EM_PPC          20      /* PowerPC */
-#define        EM_PPC64        21      /* 64-bit PowerPC */
-                       /* 22-35 - Reserved */
-#define        EM_V800         36      /* NEC V800 */
-#define        EM_FR20         37      /* Fujitsu FR20 */
-#define        EM_RH32         38      /* TRW RH-32 */
-#define        EM_RCE          39      /* Motorola RCE */
-#define        EM_ARM          40      /* Advanced RISC Machines ARM */
-#define        EM_ALPHA        41      /* DIGITAL Alpha */
-#define        EM_SH           42      /* Hitachi Super-H */
-#define        EM_SPARCV9      43      /* SPARC Version 9 */
-#define        EM_TRICORE      44      /* Siemens Tricore */
-#define        EM_ARC          45      /* Argonaut RISC Core */
-#define        EM_H8_300       46      /* Hitachi H8/300 */
-#define        EM_H8_300H      47      /* Hitachi H8/300H */
-#define        EM_H8S          48      /* Hitachi H8S */
-#define        EM_H8_500       49      /* Hitachi H8/500 */
-#define        EM_IA_64        50      /* Intel Merced Processor */
-#define        EM_MIPS_X       51      /* Stanford MIPS-X */
-#define        EM_COLDFIRE     52      /* Motorola Coldfire */
-#define        EM_68HC12       53      /* Motorola MC68HC12 */
-#define        EM_MMA          54      /* Fujitsu MMA Multimedia Accelerator */
-#define        EM_PCP          55      /* Siemens PCP */
-#define        EM_NCPU         56      /* Sony nCPU embedded RISC processor */
-#define        EM_NDR1         57      /* Denso NDR1 microprocessor */
-#define        EM_STARCORE     58      /* Motorola Star*Core processor */
-#define        EM_ME16         59      /* Toyota ME16 processor */
-#define        EM_ST100        60      /* STMicroelectronics ST100 processor */
-#define        EM_TINYJ        61      /* Advanced Logic Corp. TinyJ embedded family processor */
-#define        EM_X86_64       62      /* AMD x86-64 architecture */
-#define        EM_PDSP         63      /* Sony DSP Processor */
-#define        EM_PDP10        64      /* Digital Equipment Corp. PDP-10 */
-#define        EM_PDP11        65      /* Digital Equipment Corp. PDP-11 */
-#define        EM_FX66         66      /* Siemens FX66 microcontroller */
-#define        EM_ST9PLUS      67      /* STMicroelectronics ST9+ 8/16 bit microcontroller */
-#define        EM_ST7          68      /* STMicroelectronics ST7 8-bit microcontroller */
-#define        EM_68HC16       69      /* Motorola MC68HC16 Microcontroller */
-#define        EM_68HC11       70      /* Motorola MC68HC11 Microcontroller */
-#define        EM_68HC08       71      /* Motorola MC68HC08 Microcontroller */
-#define        EM_68HC05       72      /* Motorola MC68HC05 Microcontroller */
-#define        EM_SVX          73      /* Silicon Graphics SVx */
-#define        EM_ST19         74      /* STMicroelectronics ST19 8-bit CPU */
-#define        EM_VAX          75      /* Digital VAX */
-#define        EM_CRIS         76      /* Axis Communications 32-bit embedded processor */
-#define        EM_JAVELIN      77      /* Infineon Technologies 32-bit embedded CPU */
-#define        EM_FIREPATH     78      /* Element 14 64-bit DSP processor */
-#define        EM_ZSP          79      /* LSI Logic's 16-bit DSP processor */
-#define        EM_MMIX         80      /* Donald Knuth's educational 64-bit processor */
-#define        EM_HUANY        81      /* Harvard's machine-independent format */
-#define        EM_PRISM        82      /* SiTera Prism */
-#define        EM_AVR          83      /* Atmel AVR 8-bit microcontroller */
-#define        EM_FR30         84      /* Fujitsu FR30 */
-#define        EM_D10V         85      /* Mitsubishi D10V */
-#define        EM_D30V         86      /* Mitsubishi D30V */
-#define        EM_V850         87      /* NEC v850 */
-#define        EM_M32R         88      /* Mitsubishi M32R */
-#define        EM_MN10300      89      /* Matsushita MN10300 */
-#define        EM_MN10200      90      /* Matsushita MN10200 */
-#define        EM_PJ           91      /* picoJava */
-#define        EM_OPENRISC     92      /* OpenRISC 32-bit embedded processor */
-#define        EM_ARC_A5       93      /* ARC Cores Tangent-A5 */
-#define        EM_XTENSA       94      /* Tensilica Xtensa Architecture */
-#define        EM_NS32K        97      /* National Semiconductor 32000 series */
-
-/* Unofficial machine types follow */
-#define        EM_AVR32        6317    /* used by NetBSD/avr32 */
-#define        EM_ALPHA_EXP    36902   /* used by NetBSD/alpha; obsolete */
-#define        EM_NUM          36903
-
-/*
- * Program Header
- */
-typedef struct {
-       Elf32_Word      p_type;         /* entry type */
-       Elf32_Off       p_offset;       /* offset */
-       Elf32_Addr      p_vaddr;        /* virtual address */
-       Elf32_Addr      p_paddr;        /* physical address */
-       Elf32_Word      p_filesz;       /* file size */
-       Elf32_Word      p_memsz;        /* memory size */
-       Elf32_Word      p_flags;        /* flags */
-       Elf32_Word      p_align;        /* memory & file alignment */
-} Elf32_Phdr;
-
-typedef struct {
-       Elf64_Half      p_type;         /* entry type */
-       Elf64_Half      p_flags;        /* flags */
-       Elf64_Off       p_offset;       /* offset */
-       Elf64_Addr      p_vaddr;        /* virtual address */
-       Elf64_Addr      p_paddr;        /* physical address */
-       Elf64_Xword     p_filesz;       /* file size */
-       Elf64_Xword     p_memsz;        /* memory size */
-       Elf64_Xword     p_align;        /* memory & file alignment */
-} Elf64_Phdr;
-
-/* p_type */
-#define        PT_NULL         0               /* Program header table entry unused */
-#define        PT_LOAD         1               /* Loadable program segment */
-#define        PT_DYNAMIC      2               /* Dynamic linking information */
-#define        PT_INTERP       3               /* Program interpreter */
-#define        PT_NOTE         4               /* Auxiliary information */
-#define        PT_SHLIB        5               /* Reserved, unspecified semantics */
-#define        PT_PHDR         6               /* Entry for header table itself */
-#define        PT_NUM          7
-
-#define        PT_LOOS         0x60000000      /* OS-specific range */
-#define        PT_HIOS         0x6fffffff
-#define        PT_LOPROC       0x70000000      /* Processor-specific range */
-#define        PT_HIPROC       0x7fffffff
-
-#define        PT_MIPS_REGINFO 0x70000000
-#define PT_GNU_STACK 0x6474e551
-
-/* p_flags */
-#define        PF_R            0x4     /* Segment is readable */
-#define        PF_W            0x2     /* Segment is writable */
-#define        PF_X            0x1     /* Segment is executable */
-
-#define        PF_MASKOS       0x0ff00000      /* Operating system specific values */
-#define        PF_MASKPROC     0xf0000000      /* Processor-specific values */
-
-/*
- * Section Headers
- */
-typedef struct {
-       Elf32_Word      sh_name;        /* section name (.shstrtab index) */
-       Elf32_Word      sh_type;        /* section type */
-       Elf32_Word      sh_flags;       /* section flags */
-       Elf32_Addr      sh_addr;        /* virtual address */
-       Elf32_Off       sh_offset;      /* file offset */
-       Elf32_Word      sh_size;        /* section size */
-       Elf32_Word      sh_link;        /* link to another */
-       Elf32_Word      sh_info;        /* misc info */
-       Elf32_Word      sh_addralign;   /* memory alignment */
-       Elf32_Word      sh_entsize;     /* table entry size */
-} Elf32_Shdr;
-
-typedef struct {
-       Elf64_Half      sh_name;        /* section name (.shstrtab index) */
-       Elf64_Half      sh_type;        /* section type */
-       Elf64_Xword     sh_flags;       /* section flags */
-       Elf64_Addr      sh_addr;        /* virtual address */
-       Elf64_Off       sh_offset;      /* file offset */
-       Elf64_Xword     sh_size;        /* section size */
-       Elf64_Half      sh_link;        /* link to another */
-       Elf64_Half      sh_info;        /* misc info */
-       Elf64_Xword     sh_addralign;   /* memory alignment */
-       Elf64_Xword     sh_entsize;     /* table entry size */
-} Elf64_Shdr;
-
-/* sh_type */
-#define        SHT_NULL        0               /* Section header table entry unused */
-#define        SHT_PROGBITS    1               /* Program information */
-#define        SHT_SYMTAB      2               /* Symbol table */
-#define        SHT_STRTAB      3               /* String table */
-#define        SHT_RELA        4               /* Relocation information w/ addend */
-#define        SHT_HASH        5               /* Symbol hash table */
-#define        SHT_DYNAMIC     6               /* Dynamic linking information */
-#define        SHT_NOTE        7               /* Auxiliary information */
-#define        SHT_NOBITS      8               /* No space allocated in file image */
-#define        SHT_REL         9               /* Relocation information w/o addend */
-#define        SHT_SHLIB       10              /* Reserved, unspecified semantics */
-#define        SHT_DYNSYM      11              /* Symbol table for dynamic linker */
-#define        SHT_NUM         12
-
-#define        SHT_LOOS        0x60000000      /* Operating system specific range */
-#define SHT_SUNW_VERDEF        0x6ffffffd      /* Versions defined by file */
-#define SHT_SUNW_VERNEED 0x6ffffffe    /* Versions needed by file */
-#define SHT_SUNW_VERSYM        0x6fffffff      /* Symbol versions */
-#define        SHT_HIOS        0x6fffffff
-#define        SHT_LOPROC      0x70000000      /* Processor-specific range */
-#define        SHT_HIPROC      0x7fffffff
-#define        SHT_LOUSER      0x80000000      /* Application-specific range */
-#define        SHT_HIUSER      0xffffffff
-
-/* sh_flags */
-#define        SHF_WRITE       0x1             /* Section contains writable data */
-#define        SHF_ALLOC       0x2             /* Section occupies memory */
-#define        SHF_EXECINSTR   0x4             /* Section contains executable insns */
-
-#define        SHF_MASKOS      0x0f000000      /* Operating system specific values */
-#define        SHF_MASKPROC    0xf0000000      /* Processor-specific values */
-
-/*
- * Symbol Table
- */
-typedef struct {
-       Elf32_Word      st_name;        /* Symbol name (.symtab index) */
-       Elf32_Word      st_value;       /* value of symbol */
-       Elf32_Word      st_size;        /* size of symbol */
-       Elf_Byte        st_info;        /* type / binding attrs */
-       Elf_Byte        st_other;       /* unused */
-       Elf32_Half      st_shndx;       /* section index of symbol */
-} Elf32_Sym;
-
-typedef struct {
-       Elf64_Half      st_name;        /* Symbol name (.symtab index) */
-       Elf_Byte        st_info;        /* type / binding attrs */
-       Elf_Byte        st_other;       /* unused */
-       Elf64_Quarter   st_shndx;       /* section index of symbol */
-       Elf64_Addr      st_value;       /* value of symbol */
-       Elf64_Xword     st_size;        /* size of symbol */
-} Elf64_Sym;
-
-/* Symbol Table index of the undefined symbol */
-#define        ELF_SYM_UNDEFINED       0
-
-#define STN_UNDEF              0       /* undefined index */
-
-/* st_info: Symbol Bindings */
-#define        STB_LOCAL               0       /* local symbol */
-#define        STB_GLOBAL              1       /* global symbol */
-#define        STB_WEAK                2       /* weakly defined global symbol */
-#define        STB_NUM                 3
-
-#define        STB_LOOS                10      /* Operating system specific range */
-#define        STB_HIOS                12
-#define        STB_LOPROC              13      /* Processor-specific range */
-#define        STB_HIPROC              15
-
-/* st_info: Symbol Types */
-#define        STT_NOTYPE              0       /* Type not specified */
-#define        STT_OBJECT              1       /* Associated with a data object */
-#define        STT_FUNC                2       /* Associated with a function */
-#define        STT_SECTION             3       /* Associated with a section */
-#define        STT_FILE                4       /* Associated with a file name */
-#define        STT_NUM                 5
-
-#define        STT_LOOS                10      /* Operating system specific range */
-#define        STT_HIOS                12
-#define        STT_LOPROC              13      /* Processor-specific range */
-#define        STT_HIPROC              15
-
-/* st_other: Visibility Types */
-#define        STV_DEFAULT             0       /* use binding type */
-#define        STV_INTERNAL            1       /* not referenced from outside */
-#define        STV_HIDDEN              2       /* not visible, may be used via ptr */
-#define        STV_PROTECTED           3       /* visible, not preemptible */
-
-/* st_info/st_other utility macros */
-#define        ELF_ST_BIND(info)               ((uint32_t)(info) >> 4)
-#define        ELF_ST_TYPE(info)               ((uint32_t)(info) & 0xf)
-#define        ELF_ST_INFO(bind,type)          ((Elf_Byte)(((bind) << 4) | \
-                                        ((type) & 0xf)))
-#define        ELF_ST_VISIBILITY(other)        ((uint32_t)(other) & 3)
-
-/*
- * Special section indexes
- */
-#define        SHN_UNDEF       0               /* Undefined section */
-
-#define        SHN_LORESERVE   0xff00          /* Reserved range */
-#define        SHN_ABS         0xfff1          /*  Absolute symbols */
-#define        SHN_COMMON      0xfff2          /*  Common symbols */
-#define        SHN_HIRESERVE   0xffff
-
-#define        SHN_LOPROC      0xff00          /* Processor-specific range */
-#define        SHN_HIPROC      0xff1f
-#define        SHN_LOOS        0xff20          /* Operating system specific range */
-#define        SHN_HIOS        0xff3f
-
-#define        SHN_MIPS_ACOMMON 0xff00
-#define        SHN_MIPS_TEXT   0xff01
-#define        SHN_MIPS_DATA   0xff02
-#define        SHN_MIPS_SCOMMON 0xff03
-
-/*
- * Relocation Entries
- */
-typedef struct {
-       Elf32_Word      r_offset;       /* where to do it */
-       Elf32_Word      r_info;         /* index & type of relocation */
-} Elf32_Rel;
-
-typedef struct {
-       Elf32_Word      r_offset;       /* where to do it */
-       Elf32_Word      r_info;         /* index & type of relocation */
-       Elf32_Sword     r_addend;       /* adjustment value */
-} Elf32_Rela;
-
-/* r_info utility macros */
-#define        ELF32_R_SYM(info)       ((info) >> 8)
-#define        ELF32_R_TYPE(info)      ((info) & 0xff)
-#define        ELF32_R_INFO(sym, type) (((sym) << 8) + (unsigned char)(type))
-
-typedef struct {
-       Elf64_Addr      r_offset;       /* where to do it */
-       Elf64_Xword     r_info;         /* index & type of relocation */
-} Elf64_Rel;
-
-typedef struct {
-       Elf64_Addr      r_offset;       /* where to do it */
-       Elf64_Xword     r_info;         /* index & type of relocation */
-       Elf64_Sxword    r_addend;       /* adjustment value */
-} Elf64_Rela;
-
-/* r_info utility macros */
-#define        ELF64_R_SYM(info)       ((info) >> 32)
-#define        ELF64_R_TYPE(info)      ((info) & 0xffffffff)
-#define        ELF64_R_INFO(sym,type)  (((sym) << 32) + (type))
-
-/*
- * Dynamic Section structure array
- */
-typedef struct {
-       Elf32_Word      d_tag;          /* entry tag value */
-       union {
-           Elf32_Addr  d_ptr;
-           Elf32_Word  d_val;
-       } d_un;
-} Elf32_Dyn;
-
-typedef struct {
-       Elf64_Xword     d_tag;          /* entry tag value */
-       union {
-           Elf64_Addr  d_ptr;
-           Elf64_Xword d_val;
-       } d_un;
-} Elf64_Dyn;
-
-/* d_tag */
-#define        DT_NULL         0       /* Marks end of dynamic array */
-#define        DT_NEEDED       1       /* Name of needed library (DT_STRTAB offset) */
-#define        DT_PLTRELSZ     2       /* Size, in bytes, of relocations in PLT */
-#define        DT_PLTGOT       3       /* Address of PLT and/or GOT */
-#define        DT_HASH         4       /* Address of symbol hash table */
-#define        DT_STRTAB       5       /* Address of string table */
-#define        DT_SYMTAB       6       /* Address of symbol table */
-#define        DT_RELA         7       /* Address of Rela relocation table */
-#define        DT_RELASZ       8       /* Size, in bytes, of DT_RELA table */
-#define        DT_RELAENT      9       /* Size, in bytes, of one DT_RELA entry */
-#define        DT_STRSZ        10      /* Size, in bytes, of DT_STRTAB table */
-#define        DT_SYMENT       11      /* Size, in bytes, of one DT_SYMTAB entry */
-#define        DT_INIT         12      /* Address of initialization function */
-#define        DT_FINI         13      /* Address of termination function */
-#define        DT_SONAME       14      /* Shared object name (DT_STRTAB offset) */
-#define        DT_RPATH        15      /* Library search path (DT_STRTAB offset) */
-#define        DT_SYMBOLIC     16      /* Start symbol search within local object */
-#define        DT_REL          17      /* Address of Rel relocation table */
-#define        DT_RELSZ        18      /* Size, in bytes, of DT_REL table */
-#define        DT_RELENT       19      /* Size, in bytes, of one DT_REL entry */
-#define        DT_PLTREL       20      /* Type of PLT relocation entries */
-#define        DT_DEBUG        21      /* Used for debugging; unspecified */
-#define        DT_TEXTREL      22      /* Relocations might modify non-writable seg */
-#define        DT_JMPREL       23      /* Address of relocations associated with PLT */
-#define        DT_BIND_NOW     24      /* Process all relocations at load-time */
-#define        DT_INIT_ARRAY   25      /* Address of initialization function array */
-#define        DT_FINI_ARRAY   26      /* Size, in bytes, of DT_INIT_ARRAY array */
-#define        DT_INIT_ARRAYSZ 27      /* Address of termination function array */
-#define        DT_FINI_ARRAYSZ 28      /* Size, in bytes, of DT_FINI_ARRAY array*/
-#define        DT_NUM          29
-
-#define        DT_LOOS         0x60000000      /* Operating system specific range */
-#define DT_VERSYM      0x6ffffff0      /* Symbol versions */
-#define        DT_FLAGS_1      0x6ffffffb      /* ELF dynamic flags */
-#define DT_VERDEF      0x6ffffffc      /* Versions defined by file */
-#define DT_VERDEFNUM   0x6ffffffd      /* Number of versions defined by file */
-#define DT_VERNEED     0x6ffffffe      /* Versions needed by file */
-#define DT_VERNEEDNUM  0x6fffffff      /* Number of versions needed by file */
-#define        DT_HIOS         0x6fffffff
-#define        DT_LOPROC       0x70000000      /* Processor-specific range */
-#define        DT_HIPROC       0x7fffffff
-
-/* Flag values for DT_FLAGS_1 (incomplete) */
-#define        DF_1_INITFIRST  0x00000020      /* Object's init/fini take priority */
-
-/*
- * Auxiliary Vectors
- */
-typedef struct {
-       Elf32_Word      a_type;                         /* 32-bit id */
-       Elf32_Word      a_v;                            /* 32-bit id */
-} Aux32Info;
-
-typedef struct {
-       Elf64_Half      a_type;                         /* 32-bit id */
-       Elf64_Xword     a_v;                            /* 64-bit id */
-} Aux64Info;
-
-/* a_type */
-#define        AT_NULL         0       /* Marks end of array */
-#define        AT_IGNORE       1       /* No meaning, a_un is undefined */
-#define        AT_EXECFD       2       /* Open file descriptor of object file */
-#define        AT_PHDR         3       /* &phdr[0] */
-#define        AT_PHENT        4       /* sizeof(phdr[0]) */
-#define        AT_PHNUM        5       /* # phdr entries */
-#define        AT_PAGESZ       6       /* PAGESIZE */
-#define        AT_BASE         7       /* Interpreter base addr */
-#define        AT_FLAGS        8       /* Processor flags */
-#define        AT_ENTRY        9       /* Entry address of executable */
-#define        AT_DCACHEBSIZE  10      /* Data cache block size */
-#define        AT_ICACHEBSIZE  11      /* Instruction cache block size */
-#define        AT_UCACHEBSIZE  12      /* Unified cache block size */
-
-       /* Vendor specific */
-#define        AT_MIPS_NOTELF  10      /* XXX a_val != 0 -> MIPS XCOFF executable */
-
-#define        AT_EUID         2000    /* euid (solaris compatible numbers) */
-#define        AT_RUID         2001    /* ruid (solaris compatible numbers) */
-#define        AT_EGID         2002    /* egid (solaris compatible numbers) */
-#define        AT_RGID         2003    /* rgid (solaris compatible numbers) */
-
-       /* Solaris kernel specific */
-#define        AT_SUN_LDELF    2004    /* dynamic linker's ELF header */
-#define        AT_SUN_LDSHDR   2005    /* dynamic linker's section header */
-#define        AT_SUN_LDNAME   2006    /* dynamic linker's name */
-#define        AT_SUN_LPGSIZE  2007    /* large pagesize */
-
-       /* Other information */
-#define        AT_SUN_PLATFORM 2008    /* sysinfo(SI_PLATFORM) */
-#define        AT_SUN_HWCAP    2009    /* process hardware capabilities */
-#define        AT_SUN_IFLUSH   2010    /* do we need to flush the instruction cache? */
-#define        AT_SUN_CPU      2011    /* CPU name */
-       /* ibcs2 emulation band aid */
-#define        AT_SUN_EMUL_ENTRY 2012  /* coff entry point */
-#define        AT_SUN_EMUL_EXECFD 2013 /* coff file descriptor */
-       /* Executable's fully resolved name */
-#define        AT_SUN_EXECNAME 2014
-
-/*
- * Note Headers
- */
-typedef struct {
-       Elf32_Word n_namesz;
-       Elf32_Word n_descsz;
-       Elf32_Word n_type;
-} Elf32_Nhdr;
-
-typedef struct {
-       Elf64_Half n_namesz;
-       Elf64_Half n_descsz;
-       Elf64_Half n_type;
-} Elf64_Nhdr;
-
-#define        ELF_NOTE_TYPE_ABI_TAG           1
-
-/* GNU-specific note name and description sizes */
-#define        ELF_NOTE_ABI_NAMESZ             4
-#define        ELF_NOTE_ABI_DESCSZ             16
-/* GNU-specific note name */
-#define        ELF_NOTE_ABI_NAME               "GNU\0"
-
-/* GNU-specific OS/version value stuff */
-#define        ELF_NOTE_ABI_OS_LINUX           0
-#define        ELF_NOTE_ABI_OS_HURD            1
-#define        ELF_NOTE_ABI_OS_SOLARIS         2
-
-/* NetBSD-specific note type: Emulation name.  desc is emul name string. */
-#define        ELF_NOTE_TYPE_NETBSD_TAG        1
-/* NetBSD-specific note name and description sizes */
-#define        ELF_NOTE_NETBSD_NAMESZ          7
-#define        ELF_NOTE_NETBSD_DESCSZ          4
-/* NetBSD-specific note name */
-#define        ELF_NOTE_NETBSD_NAME            "NetBSD\0\0"
-
-/* NetBSD-specific note type: Checksum.  There should be 1 NOTE per PT_LOAD
-   section.  desc is a tuple of <phnum>(16),<chk-type>(16),<chk-value>. */
-#define        ELF_NOTE_TYPE_CHECKSUM_TAG      2
-#define        ELF_NOTE_CHECKSUM_CRC32         1
-#define        ELF_NOTE_CHECKSUM_MD5           2
-#define        ELF_NOTE_CHECKSUM_SHA1          3
-#define        ELF_NOTE_CHECKSUM_SHA256        4
-
-/* NetBSD-specific note type: PaX.  There should be 1 NOTE per executable.
-   section.  desc is a 32 bit bitmask */
-#define ELF_NOTE_TYPE_PAX_TAG          3
-#define        ELF_NOTE_PAX_MPROTECT           0x01    /* Force enable Mprotect */
-#define        ELF_NOTE_PAX_NOMPROTECT         0x02    /* Force disable Mprotect */
-#define        ELF_NOTE_PAX_GUARD              0x04    /* Force enable Segvguard */
-#define        ELF_NOTE_PAX_NOGUARD            0x08    /* Force disable Servguard */
-#define        ELF_NOTE_PAX_ASLR               0x10    /* Force enable ASLR */
-#define        ELF_NOTE_PAX_NOASLR             0x20    /* Force disable ASLR */
-#define ELF_NOTE_PAX_NAMESZ            4
-#define ELF_NOTE_PAX_NAME              "PaX\0"
-#define ELF_NOTE_PAX_DESCSZ            4
-
-/*
- * NetBSD-specific core file information.
- *
- * NetBSD ELF core files use notes to provide information about
- * the process's state.  The note name is "NetBSD-CORE" for
- * information that is global to the process, and "NetBSD-CORE@nn",
- * where "nn" is the lwpid of the LWP that the information belongs
- * to (such as register state).
- *
- * We use the following note identifiers:
- *
- *     ELF_NOTE_NETBSD_CORE_PROCINFO
- *             Note is a "netbsd_elfcore_procinfo" structure.
- *
- * We also use ptrace(2) request numbers (the ones that exist in
- * machine-dependent space) to identify register info notes.  The
- * info in such notes is in the same format that ptrace(2) would
- * export that information.
- *
- * Please try to keep the members of this structure nicely aligned,
- * and if you add elements, add them to the end and bump the version.
- */
-
-#define        ELF_NOTE_NETBSD_CORE_NAME       "NetBSD-CORE"
-
-#define        ELF_NOTE_NETBSD_CORE_PROCINFO   1
-
-#define        NETBSD_ELFCORE_PROCINFO_VERSION 1
-
-struct netbsd_elfcore_procinfo {
-       /* Version 1 fields start here. */
-       uint32_t        cpi_version;    /* netbsd_elfcore_procinfo version */
-       uint32_t        cpi_cpisize;    /* sizeof(netbsd_elfcore_procinfo) */
-       uint32_t        cpi_signo;      /* killing signal */
-       uint32_t        cpi_sigcode;    /* signal code */
-       uint32_t        cpi_sigpend[4]; /* pending signals */
-       uint32_t        cpi_sigmask[4]; /* blocked signals */
-       uint32_t        cpi_sigignore[4];/* blocked signals */
-       uint32_t        cpi_sigcatch[4];/* blocked signals */
-       int32_t         cpi_pid;        /* process ID */
-       int32_t         cpi_ppid;       /* parent process ID */
-       int32_t         cpi_pgrp;       /* process group ID */
-       int32_t         cpi_sid;        /* session ID */
-       uint32_t        cpi_ruid;       /* real user ID */
-       uint32_t        cpi_euid;       /* effective user ID */
-       uint32_t        cpi_svuid;      /* saved user ID */
-       uint32_t        cpi_rgid;       /* real group ID */
-       uint32_t        cpi_egid;       /* effective group ID */
-       uint32_t        cpi_svgid;      /* saved group ID */
-       uint32_t        cpi_nlwps;      /* number of LWPs */
-       int8_t          cpi_name[32];   /* copy of p->p_comm */
-       /* Add version 2 fields below here. */
-       int32_t         cpi_siglwp;     /* LWP target of killing signal */
-};
-
-#if defined(ELFSIZE) && (ELFSIZE == 32)
-#define        Elf_Ehdr        Elf32_Ehdr
-#define        Elf_Phdr        Elf32_Phdr
-#define        Elf_Shdr        Elf32_Shdr
-#define        Elf_Sym         Elf32_Sym
-#define        Elf_Rel         Elf32_Rel
-#define        Elf_Rela        Elf32_Rela
-#define        Elf_Dyn         Elf32_Dyn
-#define        Elf_Word        Elf32_Word
-#define        Elf_Sword       Elf32_Sword
-#define        Elf_Addr        Elf32_Addr
-#define        Elf_Off         Elf32_Off
-#define        Elf_Nhdr        Elf32_Nhdr
-
-#define        ELF_R_SYM       ELF32_R_SYM
-#define        ELF_R_TYPE      ELF32_R_TYPE
-#define        ELFCLASS        ELFCLASS32
-
-#define        AuxInfo         Aux32Info
-#elif defined(ELFSIZE) && (ELFSIZE == 64)
-#define        Elf_Ehdr        Elf64_Ehdr
-#define        Elf_Phdr        Elf64_Phdr
-#define        Elf_Shdr        Elf64_Shdr
-#define        Elf_Sym         Elf64_Sym
-#define        Elf_Rel         Elf64_Rel
-#define        Elf_Rela        Elf64_Rela
-#define        Elf_Dyn         Elf64_Dyn
-#define        Elf_Word        Elf64_Word
-#define        Elf_Sword       Elf64_Sword
-#define        Elf_Addr        Elf64_Addr
-#define        Elf_Off         Elf64_Off
-#define        Elf_Nhdr        Elf64_Nhdr
-
-#define        ELF_R_SYM       ELF64_R_SYM
-#define        ELF_R_TYPE      ELF64_R_TYPE
-#define        ELFCLASS        ELFCLASS64
-
-#define        AuxInfo         Aux64Info
-#endif
-
-#define        ELF32_ST_BIND(info)             ELF_ST_BIND(info)
-#define        ELF32_ST_TYPE(info)             ELF_ST_TYPE(info)
-#define        ELF32_ST_INFO(bind,type)        ELF_ST_INFO(bind,type)
-#define        ELF32_ST_VISIBILITY(other)      ELF_ST_VISIBILITY(other)
-
-#define        ELF64_ST_BIND(info)             ELF_ST_BIND(info)
-#define        ELF64_ST_TYPE(info)             ELF_ST_TYPE(info)
-#define        ELF64_ST_INFO(bind,type)        ELF_ST_INFO(bind,type)
-#define        ELF64_ST_VISIBILITY(other)      ELF_ST_VISIBILITY(other)
-
-#ifdef _KERNEL
-
-#define ELF_AUX_ENTRIES        14      /* Max size of aux array passed to loader */
-#define ELF32_NO_ADDR  (~(Elf32_Addr)0) /* Indicates addr. not yet filled in */
-#define ELF32_LINK_ADDR        ((Elf32_Addr)-2) /* advises to use link address */
-#define ELF64_NO_ADDR  (~(Elf64_Addr)0) /* Indicates addr. not yet filled in */
-#define ELF64_LINK_ADDR        ((Elf64_Addr)-2) /* advises to use link address */
-
-#if defined(ELFSIZE) && (ELFSIZE == 64)
-#define ELF_NO_ADDR    ELF64_NO_ADDR
-#define ELF_LINK_ADDR  ELF64_LINK_ADDR
-#elif defined(ELFSIZE) && (ELFSIZE == 32)
-#define ELF_NO_ADDR    ELF32_NO_ADDR
-#define ELF_LINK_ADDR  ELF32_LINK_ADDR
-#endif
-
-#ifndef ELF32_EHDR_FLAGS_OK
-#define        ELF32_EHDR_FLAGS_OK(eh) 1
-#endif
-
-#ifndef ELF64_EHDR_FLAGS_OK
-#define        ELF64_EHDR_FLAGS_OK(eh) 1
-#endif
-
-#if defined(ELFSIZE) && (ELFSIZE == 64)
-#define        ELF_EHDR_FLAGS_OK(eh)   ELF64_EHDR_FLAGS_OK(eh)
-#else
-#define        ELF_EHDR_FLAGS_OK(eh)   ELF32_EHDR_FLAGS_OK(eh)
-#endif
-
-#if defined(ELFSIZE)
-struct elf_args {
-        Elf_Addr  arg_entry;      /* program entry point */
-        Elf_Addr  arg_interp;     /* Interpreter load address */
-        Elf_Addr  arg_phaddr;     /* program header address */
-        Elf_Addr  arg_phentsize;  /* Size of program header */
-        Elf_Addr  arg_phnum;      /* Number of program headers */
-};
-#endif
-
-/*
- * These constants are used for Elf32_Verdef struct's version number.  
- */
-#define VER_DEF_NONE           0
-#define        VER_DEF_CURRENT         1
-
-/*
- * These constants are used for Elf32_Verdef struct's vd_flags.  
- */
-#define VER_FLG_BASE           0x1
-#define        VER_FLG_WEAK            0x2
-
-/*
- * These are used in an Elf32_Versym field.
- */
-#define        VER_NDX_LOCAL           0
-#define        VER_NDX_GLOBAL          1
-
-/*
- * These constants are used for Elf32_Verneed struct's version number.  
- */
-#define        VER_NEED_NONE           0
-#define        VER_NEED_CURRENT        1
-
-/*
- * GNU Extension hidding symb
- */
-#define        VERSYM_HIDDEN           0x8000
-#define        VERSYM_VERSION          0x7fff
-
-#define        ELF_VER_CHR             '@'
-
-/*
- * These are current size independent.
- */
-
-typedef struct {
-       Elf32_Half      vd_version;     /* version number of structure */
-       Elf32_Half      vd_flags;       /* flags (VER_FLG_*) */
-       Elf32_Half      vd_ndx;         /* version index */
-       Elf32_Half      vd_cnt;         /* number of verdaux entries */
-       Elf32_Word      vd_hash;        /* hash of name */
-       Elf32_Word      vd_aux;         /* offset to verdaux entries */
-       Elf32_Word      vd_next;        /* offset to next verdef */
-} Elf32_Verdef;
-
-typedef struct {
-       Elf32_Word      vda_name;       /* string table offset of name */
-       Elf32_Word      vda_next;       /* offset to verdaux */
-} Elf32_Verdaux;
-
-typedef struct {
-       Elf32_Half      vn_version;     /* version number of structure */
-       Elf32_Half      vn_cnt;         /* number of vernaux entries */
-       Elf32_Word      vn_file;        /* string table offset of library name*/
-       Elf32_Word      vn_aux;         /* offset to vernaux entries */
-       Elf32_Word      vn_next;        /* offset to next verneed */
-} Elf32_Verneed;
-
-typedef struct {
-       Elf32_Word      vna_hash;       /* Hash of dependency name */
-       Elf32_Half      vna_flags;      /* flags (VER_FLG_*) */
-       Elf32_Half      vna_other;      /* unused */
-       Elf32_Word      vna_name;       /* string table offset to version name*/
-       Elf32_Word      vna_next;       /* offset to next vernaux */
-} Elf32_Vernaux;
-
-typedef struct {
-       Elf32_Half      vs_vers;
-} Elf32_Versym;
-
-#ifndef _LKM
-#include "opt_execfmt.h"
-#endif
-
-#ifdef EXEC_ELF32
-int    exec_elf32_makecmds(struct lwp *, struct exec_package *);
-int    elf32_copyargs(struct lwp *, struct exec_package *,
-           struct ps_strings *, char **, void *);
-
-int    coredump_elf32(struct lwp *, void *);
-int    coredump_writenote_elf32(struct proc *, void *, Elf32_Nhdr *,
-           const char *, void *);
-
-int    elf32_check_header(Elf32_Ehdr *, int);
-#endif
-
-#ifdef EXEC_ELF64
-int    exec_elf64_makecmds(struct lwp *, struct exec_package *);
-int    elf64_copyargs(struct lwp *, struct exec_package *,
-           struct ps_strings *, char **, void *);
-
-int    coredump_elf64(struct lwp *, void *);
-int    coredump_writenote_elf64(struct proc *, void *, Elf64_Nhdr *,
-           const char *, void *);
-
-int    elf64_check_header(Elf64_Ehdr *, int);
-#endif
-
-#endif /* _KERNEL */
-
-#endif /* !_SYS_EXEC_ELF_H_ */
index 977d15c8ff32887e867690423e3f517f7d32d612..8ea80e69c6d42b083114079b686cfeec8af3c707 100644 (file)
@@ -6,12 +6,7 @@
 PROG=  find
 SRCS=  find.c function.c ls.c main.c misc.c operator.c option.c
 
-.if ${COMPILER_TYPE} != "gnu"
-LDADD+=-lminixutil
-DPADD+=${LIBMINIXUTIL}
-.else
 LDADD+=        -lutil
 DPADD+=        ${LIBUTIL}
-.endif
 
 .include <bsd.prog.mk>
diff --git a/commands/gas2ack/Makefile b/commands/gas2ack/Makefile
deleted file mode 100644 (file)
index a56eec5..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# Makefile for gas2ack.
-
-PROG=  gas2ack
-SRCS=  asm86.c gas2ack.c globals.c parse_gnu.c \
-       tokenize.c emit_ack.c
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/gas2ack/asm86.c b/commands/gas2ack/asm86.c
deleted file mode 100644 (file)
index adde7c5..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*     asm86.c - 80X86 assembly intermediate           Author: Kees J. Bot
- *                                                             24 Dec 1993
- */
-#define nil 0
-#include <stddef.h>
-#include <string.h>
-#include <assert.h>
-#include "asm86.h"
-#include "asmconv.h"
-#include "token.h"
-
-expression_t *new_expr(void)
-/* Make a new cell to build an expression. */
-{
-       expression_t *e;
-
-       e= allocate(nil, sizeof(*e));
-       e->operator= -1;
-       e->left= e->middle= e->right= nil;
-       e->name= nil;
-       e->magic= 31624;
-       return e;
-}
-
-void del_expr(expression_t *e)
-/* Delete an expression tree. */
-{
-       if (e != nil) {
-               assert(e->magic == 31624);
-               e->magic= 0;
-               deallocate(e->name);
-               del_expr(e->left);
-               del_expr(e->middle);
-               del_expr(e->right);
-               deallocate(e);
-       }
-}
-
-asm86_t *new_asm86(void)
-/* Make a new cell to hold an 80X86 instruction. */
-{
-       asm86_t *a;
-
-       a= allocate(nil, sizeof(*a));
-       a->opcode= -1;
-       get_file(&a->file, &a->line);
-       a->optype= NONE;
-       a->oaz= 0;
-       a->rep= ONCE;
-       a->seg= DEFSEG;
-       a->args= nil;
-       a->magic= 37937;
-       a->raw_string = NULL;
-       return a;
-}
-
-void del_asm86(asm86_t *a)
-/* Delete an 80X86 instruction. */
-{
-       assert(a != nil);
-       assert(a->magic == 37937);
-       a->magic= 0;
-       del_expr(a->args);
-       deallocate(a->raw_string);
-       a->raw_string = NULL;
-       deallocate(a);
-}
-
-int isregister(const char *name)
-/* True if the string is a register name.  Return its size. */
-{
-       static char *regs[] = {
-               "al", "bl", "cl", "dl", "ah", "bh", "ch", "dh",
-               "ax", "bx", "cx", "dx", "si", "di", "bp", "sp",
-               "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "esp",
-               "cs", "ds", "es", "fs", "gs", "ss",
-               "cr0", "cr1", "cr2", "cr3", "cr4",
-               "dr0", "dr1", "dr2", "dr3", "dr6", "dr7",
-               "st",
-       };
-       int reg;
-
-       for (reg= 0; reg < arraysize(regs); reg++) {
-               if (strcmp(name, regs[reg]) == 0)
-                       return reg+1;
-       }
-       return 0;
-}
diff --git a/commands/gas2ack/asm86.h b/commands/gas2ack/asm86.h
deleted file mode 100644 (file)
index a7cea6a..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-/*     asm86.h - 80X86 assembly intermediate           Author: Kees J. Bot
- *                                                             27 Jun 1993
- */
-
-typedef enum opcode {  /* 80486 opcodes, from the i486 reference manual.
-                        * Synonyms left out, some new words invented.
-                        */
-       DOT_ALIGN,
-       DOT_ASCII,      DOT_ASCIZ,
-       DOT_ASSERT,                     /* Pseudo's invented */
-       DOT_BASE,
-       DOT_COMM,       DOT_LCOMM,
-       DOT_CODE16,
-       DOT_DATA1,
-       DOT_DATA2,
-       DOT_DATA4,
-       DOT_DEFINE,     DOT_EXTERN,
-       DOT_EQU,
-       DOT_FILE,       DOT_LINE,
-       DOT_LABEL,
-       DOT_LIST,       DOT_NOLIST,
-       DOT_SPACE,
-       DOT_SYMB,
-       DOT_TEXT,       DOT_ROM,        DOT_DATA,       DOT_BSS,        DOT_END,
-       DOT_USE16,      DOT_USE32,
-       AAA,
-       AAD,
-       AAM,
-       AAS,
-       ADC,
-       ADD,
-       AND,
-       ARPL,
-       BOUND,
-       BSF,
-       BSR,
-       BSWAP,
-       BT,
-       BTC,
-       BTR,
-       BTS,
-       CALL,   CALLF,                  /* CALLF added */
-       CBW,
-       CLC,
-       CLD,
-       CLI,
-       CLTS,
-       CMC,
-       CMP,
-       CMPS,
-       CMPXCHG,
-       CPUID,
-       CWD,
-       DAA,
-       DAS,
-       DEC,
-       DIV,
-       ENTER,
-       F2XM1,
-       FABS,
-       FADD,   FADDD,  FADDS,  FADDP,  FIADDL, FIADDS,
-       FBLD,
-       FBSTP,
-       FCHS,
-       FCLEX,
-       FCOMD,  FCOMS,  FCOMPD, FCOMPS, FCOMPP,
-       FCOS,
-       FDECSTP,
-       FDIVD,  FDIVS,  FDIVP,  FIDIVL, FIDIVS,
-       FDIVRD, FDIVRS, FDIVRP, FIDIVRL,        FIDIVRS,
-       FFREE,
-       FICOM,  FICOMP,
-       FILDQ,  FILDL,  FILDS,
-       FINCSTP,
-       FINIT,
-       FISTL,  FISTS,  FISTP,
-       FLDX,   FLDD,   FLDS,
-       FLD1,   FLDL2T, FLDL2E, FLDPI,  FLDLG2, FLDLN2, FLDZ,
-       FLDCW,
-       FLDENV,
-       FMULD,  FMULS,  FMULP,  FIMULL, FIMULS,
-       FNINIT,
-       FNOP,
-       FNSAVE,
-       FNSTCW,
-       FNSTSW,
-       FPATAN,
-       FPREM,
-       FPREM1,
-       FPTAN,
-       FRNDINT,
-       FRSTOR,
-       FSAVE,
-       FWAIT,
-       FXRSTOR,
-       FXSAVE,
-       FSCALE,
-       FSIN,
-       FSINCOS,
-       FSQRT,
-       FSTD,   FSTS,   FSTP,   FSTPX,  FSTPD,  FSTPS,
-       FSTCW,
-       FSTENV,
-       FSTSW,
-       FSUBD,  FSUBS,  FSUBP,  FISUBL, FISUBS,
-       FSUBRD, FSUBRS, FSUBPR, FISUBRL, FISUBRS,
-       FTST,
-       FUCOM,  FUCOMP, FUCOMPP,
-       FXAM,
-       FXCH,
-       FXTRACT,
-       FYL2X,
-       FYL2XP1,
-       HLT,
-       IDIV,
-       IMUL,
-       IN,
-       INC,
-       INS,
-       INT,    INTO,
-       INVD,
-       INVLPG,
-       IRET,   IRETD,
-       JA,     JAE,    JB,     JBE,    JCXZ,   JE,     JG,     JGE,    JL,
-       JLE,    JNE,    JNO,    JNP,    JNS,    JO,     JP,     JS,
-       JMP,    JMPF,                   /* JMPF added */
-       LAHF,
-       LAR,
-       LEA,
-       LEAVE,
-       LGDT,   LIDT,
-       LGS,    LSS,    LDS,    LES,    LFS,
-       LLDT,
-       LMSW,
-       LOCK,
-       LODS,
-       LOOP,   LOOPE,  LOOPNE,
-       LSL,
-       LTR,
-       MFENCE,
-       MOV,
-       MOVS,
-       MOVSX,
-       MOVSXB,
-       MOVZX,
-       MOVZXB,
-       MUL,
-       NEG,
-       NOP,
-       NOT,
-       OR,
-       OUT,
-       OUTS,
-       PAUSE,
-       POP,
-       POPA,
-       POPAD,
-       POPF,
-       PUSH,
-       PUSHA,
-       PUSHAD,
-       PUSHF,
-       RCL,    RCR,    ROL,    ROR,
-       RDMSR,
-       RDPMC,
-       RDTSC,
-       RET,    RETF,                   /* RETF added */
-       SAHF,
-       SAL,    SAR,    SHL,    SHR,
-       SBB,
-       SCAS,
-       SETA,   SETAE,  SETB,   SETBE,  SETE,   SETG,   SETGE,  SETL,
-       SETLE,  SETNE,  SETNO,  SETNP,  SETNS,  SETO,   SETP,   SETS,
-       SGDT,   SIDT,
-       SHLD,
-       SHRD,
-       SLDT,
-       SMSW,
-       STC,
-       STD,
-       STI,
-       STOS,
-       STR,
-       SUB,
-       TEST,
-       VERR,   VERW,
-       WAIT,
-       WBINVD,
-       WRMSR,
-       XADD,
-       XCHG,
-       XLAT,
-       XOR,
-       COMMENT,
-       C_PREPROCESSOR,
-       UNKNOWN
-} opcode_t;
-
-#define is_pseudo(o)   ((o) <= DOT_USE32)
-#define N_OPCODES      ((int) XOR + 1)
-
-#define OPZ    0x01            /* Operand size prefix. */
-#define ADZ    0x02            /* Address size prefix. */
-
-typedef enum optype {
-       NONE, PSEUDO,   JUMP,   JUMP16, BYTE,   WORD,   OWORD   /* Ordered list! */
-} optype_t;
-
-typedef enum repeat {
-       ONCE,   REP,    REPE,   REPNE
-} repeat_t;
-
-typedef enum segment {
-       DEFSEG, CSEG,   DSEG,   ESEG,   FSEG,   GSEG,   SSEG
-} segment_t;
-
-typedef struct expression {
-       int             operator;
-       struct expression *left, *middle, *right;
-       char            *name;
-       size_t          len;
-       unsigned        magic;
-} expression_t;
-
-typedef struct asm86 {
-       opcode_t        opcode;         /* DOT_TEXT, MOV, ... */
-       char            *file;          /* Name of the file it is found in. */
-       long            line;           /* Line number. */
-       optype_t        optype;         /* Type of operands: byte, word... */
-       int             oaz;            /* Operand/address size prefix? */
-       repeat_t        rep;            /* Repeat prefix used on this instr. */
-       segment_t       seg;            /* Segment override. */
-       expression_t    *args;          /* Arguments in ACK order. */
-       unsigned        magic;
-       char *          raw_string;     /* each instruction can have a comment.
-                                          Instruction can be empty if the
-                                          comment is the only thing on the
-                                          line. Or the instruction can be a
-                                          preprocessor macro. It may span
-                                          multiple lines and does not contain
-                                          any instruction
-                                        */
-} asm86_t;
-
-expression_t *new_expr(void);
-void del_expr(expression_t *a);
-asm86_t *new_asm86(void);
-void del_asm86(asm86_t *a);
-
-int isregister(const char *name);
-
-#define IS_REG8(n)     ((n) >= 1 && (n) <=8)
-#define IS_REG16(n)    ((n) >= 9 && (n) <=16)
-#define IS_REG32(n)    ((n) >= 17 && (n) <=24)
-#define IS_REGSEG(n)   ((n) >= 25 && (n) <=30)
-#define IS_REGCR(n)    ((n) >= 31 && (n) <=35)
-#define segreg2seg(reg)        ((segment_t)(reg - 25 + 1))
-
-/*
- * Format of the arguments of the asm86_t structure:
- *
- *
- * ACK assembly operands       expression_t cell:
- * or part of operand:         {operator, left, middle, right, name, len}
- *
- * [expr]                      {'[', nil, expr, nil}
- * word                                {'W', nil, nil, nil, word}
- * "string"                    {'S', nil, nil, nil, "string", strlen("string")}
- * label = expr                        {'=', nil, expr, nil, label}
- * expr * expr                 {'*', expr, nil, expr}
- * - expr                      {'-', nil, expr, nil}
- * (memory)                    {'(', nil, memory, nil}
- * offset(base)(index*n)       {'O', offset, base, index*n}
- * base                                {'B', nil, nil, nil, base}
- * index*4                     {'4', nil, nil, nil, index}
- * operand, oplist             {',', operand, nil, oplist}
- * label :                     {':', nil, nil, nil, label}
- *
- * The precedence of operators is ignored.  The expression is simply copied
- * as is, including parentheses.  Problems like missing operators in the
- * target language will have to be handled by rewriting the source language.
- * 16-bit or 32-bit registers must be used where they are required by the
- * target assembler even though ACK makes no difference between 'ax' and
- * 'eax'.  Asmconv is smart enough to transform compiler output.  Human made
- * assembly can be fixed up to be transformable.
- */
diff --git a/commands/gas2ack/asmconv.h b/commands/gas2ack/asmconv.h
deleted file mode 100644 (file)
index 061551e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*     asmconv.h - shared functions                    Author: Kees J. Bot
- *                                                             19 Dec 1993
- */
-
-#define arraysize(a)   (sizeof(a)/sizeof((a)[0]))
-#define arraylimit(a)  ((a) + arraysize(a))
-#define between(a, c, z)       \
-                       ((unsigned)((c) - (a)) <= (unsigned)((z) - (a)))
-
-void *allocate(void *mem, size_t size);
-void deallocate(void *mem);
-void fatal(char *label);
-char *copystr(const char *s);
-int isanumber(const char *s);
-
-extern int asm_mode32; /* In 32 bit mode if true. */
-extern int prepend_underscores; /* Prepend underscores to symbols */
-
-#define use16()                (!asm_mode32)
-#define use32()                ((int) asm_mode32)
-#define set_use16()    ((void) (asm_mode32= 0))
-#define set_use32()    ((void) (asm_mode32= 1))
-
-#define underscore_mode() (prepend_underscores)
-#define enable_underscore_mode() ((void)(prepend_underscores= 1))
-
-extern int err_code;   /* Exit code. */
-#define set_error()    ((void) (err_code= EXIT_FAILURE))
diff --git a/commands/gas2ack/emit_ack.c b/commands/gas2ack/emit_ack.c
deleted file mode 100644 (file)
index c9d297d..0000000
+++ /dev/null
@@ -1,767 +0,0 @@
-/*     emit_ack.c - emit ACK assembly                  Author: Kees J. Bot
- *                  emit NCC assembly                          27 Dec 1993
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-#include "globals.h"
-
-typedef struct mnemonic {      /* ACK as86 mnemonics translation table. */
-       opcode_t        opcode;
-       char            *name;
-} mnemonic_t;
-
-static mnemonic_t mnemtab[] = {
-       { AAA,          "aaa"           },
-       { AAD,          "aad"           },
-       { AAM,          "aam"           },
-       { AAS,          "aas"           },
-       { ADC,          "adc%"          },
-       { ADD,          "add%"          },
-       { AND,          "and%"          },
-       { ARPL,         "arpl"          },
-       { BOUND,        "bound"         },
-       { BSF,          "bsf"           },
-       { BSR,          "bsr"           },
-       { BSWAP,        "bswap"         },
-       { BT,           "bt"            },
-       { BTC,          "btc"           },
-       { BTR,          "btr"           },
-       { BTS,          "bts"           },
-       { CALL,         "call"          },
-       { CALLF,        "callf"         },
-       { CBW,          "cbw"           },
-       { CLC,          "clc"           },
-       { CLD,          "cld"           },
-       { CLI,          "cli"           },
-       { CLTS,         "clts"          },
-       { CMC,          "cmc"           },
-       { CMP,          "cmp%"          },
-       { CMPS,         "cmps%"         },
-       { CMPXCHG,      "cmpxchg"       },
-       { CWD,          "cwd"           },
-       { DAA,          "daa"           },
-       { DAS,          "das"           },
-       { DEC,          "dec%"          },
-       { DIV,          "div%"          },
-       { DOT_ALIGN,    ".align"        },
-       { DOT_ASCII,    ".ascii"        },
-       { DOT_ASCIZ,    ".asciz"        },
-       { DOT_ASSERT,   ".assert"       },
-       { DOT_BASE,     ".base"         },
-       { DOT_BSS,      ".sect .bss"    },
-       { DOT_COMM,     ".comm"         },
-       { DOT_DATA,     ".sect .data"   },
-       { DOT_DATA1,    ".data1"        },
-       { DOT_DATA2,    ".data2"        },
-       { DOT_DATA4,    ".data4"        },
-       { DOT_DEFINE,   ".define"       },
-       { DOT_END,      ".sect .end"    },
-       { DOT_EXTERN,   ".extern"       },
-       { DOT_FILE,     ".file"         },
-       { DOT_LCOMM,    ".comm"         },
-       { DOT_LINE,     ".line"         },
-       { DOT_LIST,     ".list"         },
-       { DOT_NOLIST,   ".nolist"       },
-       { DOT_ROM,      ".sect .rom"    },
-       { DOT_SPACE,    ".space"        },
-       { DOT_SYMB,     ".symb"         },
-       { DOT_TEXT,     ".sect .text"   },
-       { DOT_USE16,    ".use16"        },
-       { DOT_USE32,    ".use32"        },
-       { ENTER,        "enter"         },
-       { F2XM1,        "f2xm1"         },
-       { FABS,         "fabs"          },
-       { FADD,         "fadd"          },
-       { FADDD,        "faddd"         },
-       { FADDP,        "faddp"         },
-       { FADDS,        "fadds"         },
-       { FBLD,         "fbld"          },
-       { FBSTP,        "fbstp"         },
-       { FCHS,         "fchs"          },
-       { FCLEX,        "fclex"         },
-       { FCOMD,        "fcomd"         },
-       { FCOMPD,       "fcompd"        },
-       { FCOMPP,       "fcompp"        },
-       { FCOMPS,       "fcomps"        },
-       { FCOMS,        "fcoms"         },
-       { FCOS,         "fcos"          },
-       { FDECSTP,      "fdecstp"       },
-       { FDIVD,        "fdivd"         },
-       { FDIVP,        "fdivp"         },
-       { FDIVRD,       "fdivrd"        },
-       { FDIVRP,       "fdivrp"        },
-       { FDIVRS,       "fdivrs"        },
-       { FDIVS,        "fdivs"         },
-       { FFREE,        "ffree"         },
-       { FIADDL,       "fiaddl"        },
-       { FIADDS,       "fiadds"        },
-       { FICOM,        "ficom"         },
-       { FICOMP,       "ficomp"        },
-       { FIDIVL,       "fidivl"        },
-       { FIDIVRL,      "fidivrl"       },
-       { FIDIVRS,      "fidivrs"       },
-       { FIDIVS,       "fidivs"        },
-       { FILDL,        "fildl"         },
-       { FILDQ,        "fildq"         },
-       { FILDS,        "filds"         },
-       { FIMULL,       "fimull"        },
-       { FIMULS,       "fimuls"        },
-       { FINCSTP,      "fincstp"       },
-       { FINIT,        "finit"         },
-       { FISTL,        "fistl"         },
-       { FISTP,        "fistp"         },
-       { FISTS,        "fists"         },
-       { FISUBL,       "fisubl"        },
-       { FISUBRL,      "fisubrl"       },
-       { FISUBRS,      "fisubrs"       },
-       { FISUBS,       "fisubs"        },
-       { FLD1,         "fld1"          },
-       { FLDCW,        "fldcw"         },
-       { FLDD,         "fldd"          },
-       { FLDENV,       "fldenv"        },
-       { FLDL2E,       "fldl2e"        },
-       { FLDL2T,       "fldl2t"        },
-       { FLDLG2,       "fldlg2"        },
-       { FLDLN2,       "fldln2"        },
-       { FLDPI,        "fldpi"         },
-       { FLDS,         "flds"          },
-       { FLDX,         "fldx"          },
-       { FLDZ,         "fldz"          },
-       { FMULD,        "fmuld"         },
-       { FMULP,        "fmulp"         },
-       { FMULS,        "fmuls"         },
-       { FNINIT,       "fninit"        },
-       { FNOP,         "fnop"          },
-       { FNSAVE,       "fnsave"        },
-       { FNSTCW,       "fnstcw"        },
-       { FNSTSW,       "fnstsw"        },
-       { FPATAN,       "fpatan"        },
-       { FPREM,        "fprem"         },
-       { FPREM1,       "fprem1"        },
-       { FPTAN,        "fptan"         },
-       { FRNDINT,      "frndint"       },
-       { FRSTOR,       "frstor"        },
-       { FSAVE,        "fsave"         },
-       { FWAIT,        "fwait"         },
-       { FXRSTOR,      "fxrstor"       },
-       { FXSAVE,       "fxsave"        },
-       { FSCALE,       "fscale"        },
-       { FSIN,         "fsin"          },
-       { FSINCOS,      "fsincos"       },
-       { FSQRT,        "fsqrt"         },
-       { FSTCW,        "fstcw"         },
-       { FSTD,         "fstd"          },
-       { FSTENV,       "fstenv"        },
-       { FSTP,         "fstp"          },
-       { FSTPD,        "fstpd"         },
-       { FSTPS,        "fstps"         },
-       { FSTPX,        "fstpx"         },
-       { FSTS,         "fsts"          },
-       { FSTSW,        "fstsw"         },
-       { FSUBD,        "fsubd"         },
-       { FSUBP,        "fsubp"         },
-       { FSUBPR,       "fsubpr"        },
-       { FSUBRD,       "fsubrd"        },
-       { FSUBRS,       "fsubrs"        },
-       { FSUBS,        "fsubs"         },
-       { FTST,         "ftst"          },
-       { FUCOM,        "fucom"         },
-       { FUCOMP,       "fucomp"        },
-       { FUCOMPP,      "fucompp"       },
-       { FXAM,         "fxam"          },
-       { FXCH,         "fxch"          },
-       { FXTRACT,      "fxtract"       },
-       { FYL2X,        "fyl2x"         },
-       { FYL2XP1,      "fyl2xp1"       },
-       { HLT,          "hlt"           },
-       { IDIV,         "idiv%"         },
-       { IMUL,         "imul%"         },
-       { IN,           "in%"           },
-       { INC,          "inc%"          },
-       { INS,          "ins%"          },
-       { INT,          "int"           },
-       { INTO,         "into"          },
-       { INVD,         "invd"          },
-       { INVLPG,       "invlpg"        },
-       { IRET,         "iret"          },
-       { IRETD,        "iretd"         },
-       { JA,           "ja"            },
-       { JAE,          "jae"           },
-       { JB,           "jb"            },
-       { JBE,          "jbe"           },
-       { JCXZ,         "jcxz"          },
-       { JE,           "je"            },
-       { JG,           "jg"            },
-       { JGE,          "jge"           },
-       { JL,           "jl"            },
-       { JLE,          "jle"           },
-       { JMP,          "jmp"           },
-       { JMPF,         "jmpf"          },
-       { JNE,          "jne"           },
-       { JNO,          "jno"           },
-       { JNP,          "jnp"           },
-       { JNS,          "jns"           },
-       { JO,           "jo"            },
-       { JP,           "jp"            },
-       { JS,           "js"            },
-       { LAHF,         "lahf"          },
-       { LAR,          "lar"           },
-       { LDS,          "lds"           },
-       { LEA,          "lea"           },
-       { LEAVE,        "leave"         },
-       { LES,          "les"           },
-       { LFS,          "lfs"           },
-       { LGDT,         "lgdt"          },
-       { LGS,          "lgs"           },
-       { LIDT,         "lidt"          },
-       { LLDT,         "lldt"          },
-       { LMSW,         "lmsw"          },
-       { LOCK,         "lock"          },
-       { LODS,         "lods%"         },
-       { LOOP,         "loop"          },
-       { LOOPE,        "loope"         },
-       { LOOPNE,       "loopne"        },
-       { LSL,          "lsl"           },
-       { LSS,          "lss"           },
-       { LTR,          "ltr"           },
-       { MFENCE,       ".data1 0x0f, 0xae, 0x0f"},
-       { MOV,          "mov%"          },
-       { MOVS,         "movs%"         },
-       { MOVSX,        "movsx"         },
-       { MOVSXB,       "movsxb"        },
-       { MOVZX,        "movzx"         },
-       { MOVZXB,       "movzxb"        },
-       { MUL,          "mul%"          },
-       { NEG,          "neg%"          },
-       { NOP,          "nop"           },
-       { NOT,          "not%"          },
-       { OR,           "or%"           },
-       { OUT,          "out%"          },
-       { OUTS,         "outs%"         },
-       { PAUSE,        ".data1 0xf3, 0x90"},
-       { POP,          "pop"           },
-       { POPA,         "popa"          },
-       { POPAD,        "popad"         },
-       { POPF,         "popf"          },
-       { PUSH,         "push"          },
-       { PUSHA,        "pusha"         },
-       { PUSHAD,       "pushad"        },
-       { PUSHF,        "pushf"         },
-       { RCL,          "rcl%"          },
-       { RCR,          "rcr%"          },
-       { RET,          "ret"           },
-       { RETF,         "retf"          },
-       { RDMSR,        ".data1 0x0f, 0x32"},
-       { RDPMC,        ".data1 0x0f, 0x33"},
-       { RDTSC,        ".data1 0x0f, 0x31"},
-       { ROL,          "rol%"          },
-       { ROR,          "ror%"          },
-       { SAHF,         "sahf"          },
-       { SAL,          "sal%"          },
-       { SAR,          "sar%"          },
-       { SBB,          "sbb%"          },
-       { SCAS,         "scas%"         },
-       { SETA,         "seta"          },
-       { SETAE,        "setae"         },
-       { SETB,         "setb"          },
-       { SETBE,        "setbe"         },
-       { SETE,         "sete"          },
-       { SETG,         "setg"          },
-       { SETGE,        "setge"         },
-       { SETL,         "setl"          },
-       { SETLE,        "setle"         },
-       { SETNE,        "setne"         },
-       { SETNO,        "setno"         },
-       { SETNP,        "setnp"         },
-       { SETNS,        "setns"         },
-       { SETO,         "seto"          },
-       { SETP,         "setp"          },
-       { SETS,         "sets"          },
-       { SGDT,         "sgdt"          },
-       { SHL,          "shl%"          },
-       { SHLD,         "shld"          },
-       { SHR,          "shr%"          },
-       { SHRD,         "shrd"          },
-       { SIDT,         "sidt"          },
-       { SLDT,         "sldt"          },
-       { SMSW,         "smsw"          },
-       { STC,          "stc"           },
-       { STD,          "std"           },
-       { STI,          "sti"           },
-       { STOS,         "stos%"         },
-       { STR,          "str"           },
-       { SUB,          "sub%"          },
-       { TEST,         "test%"         },
-       { VERR,         "verr"          },
-       { VERW,         "verw"          },
-       { WAIT,         "wait"          },
-       { WBINVD,       "wbinvd"        },
-       { WRMSR,        ".data1 0x0f, 0x30"},
-       { XADD,         "xadd"          },
-       { XCHG,         "xchg%"         },
-       { XLAT,         "xlat"          },
-       { XOR,          "xor%"          },
-};
-
-#define farjmp(o)      ((o) == JMPF || (o) == CALLF)
-#define data_op(o) ((o) == DOT_DATA1 || (o) == DOT_DATA2 || (o) == DOT_DATA4)
-#define define_op(o) ((o) == DOT_DEFINE)
-
-static FILE *ef;
-static long eline= 1;
-static char *efile;
-static char *orig_efile;
-static char *opcode2name_tab[N_OPCODES];
-static enum dialect { ACK, NCC } dialect= ACK;
-
-static void ack_putchar(int c)
-/* LOOK, this programmer checks the return code of putc!  What an idiot, noone
- * does that!
- */
-{
-       if (putc(c, ef) == EOF) fatal(orig_efile);
-}
-
-static void ack_printf(const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       if (vfprintf(ef, fmt, ap) == EOF) fatal(orig_efile);
-       va_end(ap);
-}
-
-void ack_emit_init(char *file, const char *banner)
-/* Prepare producing an ACK assembly file. */
-{
-       mnemonic_t *mp;
-
-       if (file == nil) {
-               file= "stdout";
-               ef= stdout;
-       } else {
-               if ((ef= fopen(file, "w")) == nil) fatal(file);
-       }
-       orig_efile= file;
-       efile= file;
-       ack_printf("! %s", banner);
-       if (dialect == ACK) {
-               /* Declare the four sections used under Minix. */
-               ack_printf(
-       "\n.sect .text; .sect .rom; .sect .data; .sect .bss\n.sect .text");
-       }
-
-       /* Initialize the opcode to mnemonic translation table. */
-       for (mp= mnemtab; mp < arraylimit(mnemtab); mp++) {
-               assert(opcode2name_tab[mp->opcode] == nil);
-               opcode2name_tab[mp->opcode]= mp->name;
-       }
-}
-
-#define opcode2name(op)                (opcode2name_tab[op] + 0)
-
-static void ack_put_string(const char *s, size_t n)
-/* Emit a string with weird characters quoted. */
-{
-       while (n > 0) {
-               int c= *s;
-
-               if (c < ' ' || c > 0177) {
-                       ack_printf("\\%03o", c & 0xFF);
-               } else
-               if (c == '"' || c == '\\') {
-                       ack_printf("\\%c", c);
-               } else {
-                       ack_putchar(c);
-               }
-               s++;
-               n--;
-       }
-}
-
-static void ack_put_expression(asm86_t *a, expression_t *e, int deref)
-/* Send an expression, i.e. instruction operands, to the output file.  Deref
- * is true when the rewrite for the ncc dialect may be made.
- */
-{
-       int isglob;
-
-       assert(e != nil);
-
-   if (underscore_mode())
-      isglob = syms_is_global(e->name);
-   else
-      isglob = 0;
-
-       switch (e->operator) {
-       case ',':
-      if (data_op(a->opcode) || define_op(a->opcode)
-                 || (dialect == NCC && farjmp(a->opcode))) {
-                       /* ACK jmpf seg:off  ->  NCC jmpf off,seg */
-                       ack_put_expression(a, e->right, deref);
-                       ack_printf(", ");
-                       ack_put_expression(a, e->left, deref);
-               } else {
-                       ack_put_expression(a, e->left, deref);
-                       ack_printf(farjmp(a->opcode) ? ":" : ", ");
-                       ack_put_expression(a, e->right, deref);
-               }
-               break;
-       case 'O':
-               if (deref && a->optype == JUMP) ack_putchar('@');
-               if (e->left != nil) ack_put_expression(a, e->left, 0);
-               if (e->middle != nil) ack_put_expression(a, e->middle, 0);
-               if (e->right != nil) ack_put_expression(a, e->right, 0);
-               break;
-       case '(':
-               if (deref && a->optype == JUMP) ack_putchar('@');
-               if (!deref) ack_putchar('(');
-               ack_put_expression(a, e->middle, 0);
-               if (!deref) ack_putchar(')');
-               break;
-       case 'B':
-               ack_printf("(%s%s)", isglob ? "_" : "", e->name);
-               break;
-       case '1':
-       case '2':
-       case '4':
-       case '8':
-               ack_printf((use16() && e->operator == '1')
-                               ? "(%s%s)" : "(%s%s*%c)", isglob ? "_" : "",
-                               e->name, e->operator);
-               break;
-       case '+':
-       case '-':
-       case '~':
-               if (e->middle != nil) {
-                       if (deref && a->optype != JUMP) ack_putchar('#');
-                       ack_putchar(e->operator);
-                       ack_put_expression(a, e->middle, 0);
-                       break;
-               }
-               /*FALL THROUGH*/
-       case '*':
-       case '/':
-       case '%':
-       case '&':
-       case '|':
-       case '^':
-       case S_LEFTSHIFT:
-       case S_RIGHTSHIFT:
-               if (deref && a->optype != JUMP) ack_putchar('#');
-               ack_put_expression(a, e->left, 0);
-               if (e->operator == S_LEFTSHIFT) {
-                       ack_printf("<<");
-               } else
-               if (e->operator == S_RIGHTSHIFT) {
-                       ack_printf(">>");
-               } else {
-                       ack_putchar(e->operator);
-               }
-               ack_put_expression(a, e->right, 0);
-               break;
-       case '[':
-               if (deref && a->optype != JUMP) ack_putchar('#');
-               ack_putchar('[');
-               ack_put_expression(a, e->middle, 0);
-               ack_putchar(']');
-               break;
-       case 'W':
-               if (deref && a->optype == JUMP && isregister(e->name))
-               {
-                       ack_printf("(%s)", e->name);
-                       break;
-               }
-               if (deref && a->optype != JUMP && !isregister(e->name)) {
-                       ack_putchar('#');
-               }
-               ack_printf("%s%s", isglob ? "_" : "",  e->name);
-               break;
-       case 'S':
-               ack_putchar('"');
-               ack_put_string(e->name, e->len);
-               ack_putchar('"');
-               break;
-       default:
-               fprintf(stderr,
-               "asmconv: internal error, unknown expression operator '%d'\n",
-                       e->operator);
-               exit(EXIT_FAILURE);
-       }
-}
-
-void ack_emit_instruction(asm86_t *a)
-/* Output one instruction and its operands. */
-{
-       int same= 0;
-       char *p;
-       static int high_seg;
-       int deref;
-       static int prevop;
-
-       if (a == nil) {
-               /* Last call */
-               ack_putchar('\n');
-               return;
-       }
-
-       /* Make sure the line number of the line to be emitted is ok. */
-       if ((a->file != efile && strcmp(a->file, efile) != 0)
-                               || a->line < eline || a->line > eline+10) {
-               ack_putchar('\n');
-               ack_printf("! %ld \"%s\"\n", a->line, a->file);
-               efile= a->file;
-               eline= a->line;
-       } else {
-               if (a->line == eline) {
-                       if (prevop == DOT_LABEL) {
-                               ack_printf("\n");
-                               same = 0;
-                       }
-                       else {
-                               ack_printf("; ");
-                               same= 1;
-                       }
-               }
-               while (eline < a->line) {
-                       ack_putchar('\n');
-                       eline++;
-               }
-       }
-       
-       if (a->opcode == DOT_LABEL)
-               prevop = DOT_LABEL;
-       else
-               prevop = 0;
-
-       if (a->opcode == COMMENT || 
-                       a->opcode == C_PREPROCESSOR ||
-                       a->opcode == UNKNOWN) {
-               if (a->opcode == COMMENT)
-                       if (a->raw_string[0] != '/')
-                               a->raw_string[0] = '!';
-               ack_printf("%s", a->raw_string);
-               return;
-       } else
-       if (a->opcode == DOT_LABEL) {
-               assert(a->args->operator == ':');
-               if (underscore_mode() && syms_is_global(a->args->name))
-                       ack_printf("_%s:", a->args->name);
-               else
-                       ack_printf("%s:", a->args->name);
-       } else
-       if (a->opcode == DOT_EQU) {
-               assert(a->args->operator == '=');
-               ack_printf("\t%s = ", a->args->name);
-               ack_put_expression(a, a->args->middle, 0);
-       } else if (a->opcode == DOT_CODE16) {
-               /* nothing to be done, makefiles handle this */
-       } else
-       if ((p= opcode2name(a->opcode)) != nil) {
-               char *sep= dialect == ACK ? "" : ";";
-
-               if (!is_pseudo(a->opcode) && !same) ack_putchar('\t');
-
-               switch (a->rep) {
-               case ONCE:      break;
-               case REP:       ack_printf("rep");      break;
-               case REPE:      ack_printf("repe");     break;
-               case REPNE:     ack_printf("repne");    break;
-               default:        assert(0);
-               }
-               if (a->rep != ONCE) {
-                       ack_printf(dialect == ACK ? " " : "; ");
-               }
-               switch (a->seg) {
-               case DEFSEG:    break;
-               case CSEG:      ack_printf("cseg");     break;
-               case DSEG:      ack_printf("dseg");     break;
-               case ESEG:      ack_printf("eseg");     break;
-               case FSEG:      ack_printf("fseg");     break;
-               case GSEG:      ack_printf("gseg");     break;
-               case SSEG:      ack_printf("sseg");     break;
-               default:        assert(0);
-               }
-               if (a->seg != DEFSEG) {
-                       ack_printf(dialect == ACK ? " " : "; ");
-               }
-               if (a->oaz & OPZ) ack_printf(use16() ? "o32 " : "o16 ");
-               if (a->oaz & ADZ) ack_printf(use16() ? "a32 " : "a16 ");
-
-               if (a->opcode == CBW) {
-                       p= !(a->oaz & OPZ) == use16() ? "cbw" : "cwde";
-               }
-
-               if (a->opcode == CWD) {
-                       p= !(a->oaz & OPZ) == use16() ? "cwd" : "cdq";
-               }
-
-               if (a->opcode == DOT_COMM && a->args != nil
-                       && a->args->operator == ','
-                       && a->args->left->operator == 'W'
-               ) {
-                       if (underscore_mode() && syms_is_global(a->args->left->name))
-                               ack_printf(".define\t_%s; ", a->args->left->name);
-                       else
-                               ack_printf(".define\t%s; ", a->args->left->name);
-               }
-#define IS_OP_CR4(r)   ((r) && (r)->name && strcmp((r)->name, "cr4") == 0)
-               /* unsupported mov to/from cr4 */
-               if (a->opcode == MOV && a->args->operator == ',') {
-                       if (IS_OP_CR4(a->args->left)) {
-                               /* read cr4 */
-                               ack_printf(".data1  0x0f, 0x20, 0xe0\n");
-                               return;
-                       }
-                       if (IS_OP_CR4(a->args->right)) {
-                               /* write cr4 */
-                               ack_printf(".data1  0x0f, 0x22, 0xe0\n");
-                               return;
-                       }
-               }
-               if (a->opcode == RDMSR) {
-                       ack_printf(".data1 0x0f, 0x32\n");
-                       return;
-               }
-               if (a->opcode == WRMSR) {
-                       ack_printf(".data1 0x0f, 0x30\n");
-               }
-               /* unsupported fninit */
-               if (a->opcode == FNINIT) {
-                       ack_printf(".data1 0xDB, 0xE3\n"); /* FNINIT */
-                       return;
-               }
-               /* unsupported fnsave */
-               if (a->opcode == FNSAVE) {
-                       ack_printf(".data1 0xDD, 0x30\n"); /* FNSAVE [eax] */
-                       return;
-               }
-               /* unsupported fnstcw */
-               if (a->opcode == FNSTCW) {
-                       ack_printf(".data1 0xD9, 0x38\n"); /* FNSTCW [eax] */
-                       return;
-               }
-               /* unsupported fnstsw */
-               if (a->opcode == FNSTSW) {
-                       ack_printf(".data1 0xDF, 0xE0\n"); /* FNSTSW [eax] */
-                       return;
-               }
-               /* unsupported frstor */
-               if (a->opcode == FRSTOR) {
-                       ack_printf(".data1 0xDD, 0x20\n"); /* FRSTOR [eax] */
-                       return;
-               }
-               /* unsupported fwait */
-               if (a->opcode == FWAIT) {
-                       ack_printf(".data1 0x9B\n"); /* FWAIT */
-                       return;
-               }
-               /* unsupported fxrstor */
-               if (a->opcode == FXRSTOR) {
-                       ack_printf(".data1 0x0F, 0xAE, 0x08\n"); /* FXRSTOR [eax] */
-                       return;
-               }
-               /* unsupported fxsave */
-               if (a->opcode == FXSAVE) {
-                       ack_printf(".data1 0x0F, 0xAE, 0x00\n"); /* FXSAVE [eax] */
-                       return;
-               }
-               /* we are translating from GNU */
-               if (a->args && a->args->operator == ','
-                               /* don't swap ljmp prefixed with segment */
-                               && a->opcode != JMPF
-                               && !data_op(a->opcode)
-                               && !define_op(a->opcode)) {
-                       expression_t * tmp;
-
-                       tmp = a->args->right;
-                       a->args->right = a->args->left;
-                       a->args->left = tmp;
-               }
-               while (*p != 0) {
-                       if (*p == '%') {
-                               if (a->optype == BYTE) ack_putchar('b');
-                       } else {
-                               ack_putchar(*p);
-                       }
-                       p++;
-               }
-               /* 
-                * gnu assembly expresses the ES segment in the long instruction
-                * format. Not neccessary in ack
-                */
-               if (a->opcode == MOVS)
-                       return;
-               if (a->args != nil) {
-                       ack_putchar('\t');
-                       switch (a->opcode) {
-                       case IN:
-                       case OUT:
-                       case INT:
-                               deref= 0;
-                               break;
-                       default:
-                               deref= (dialect == NCC && a->optype != PSEUDO);
-                       }
-                       ack_put_expression(a, a->args, deref);
-               }
-               if (a->opcode == DOT_USE16) set_use16();
-               if (a->opcode == DOT_USE32) set_use32();
-       } else {
-               fprintf(stderr,
-                       "asmconv: internal error, unknown opcode '%d'\n",
-                       a->opcode);
-               exit(EXIT_FAILURE);
-       }
-       
-       /* 
-        * comment on the same line as an instruction. Cannot be definition of a
-        * macro
-        * */
-       if (a->raw_string) {
-               if (a->raw_string[0] != '/')
-                       a->raw_string[0] = '!';
-               ack_printf("\t%s", a->raw_string);
-       }
-}
-
-/* A few ncc mnemonics are different. */
-static mnemonic_t ncc_mnemtab[] = {
-       { DOT_BSS,      ".bss"          },
-       { DOT_DATA,     ".data"         },
-       { DOT_END,      ".end"          },
-       { DOT_ROM,      ".rom"          },
-       { DOT_TEXT,     ".text"         },
-};
-
-void ncc_emit_init(char *file, const char *banner)
-/* The assembly produced by the Minix ACK ANSI C compiler for the 8086 is
- * different from the normal ACK assembly, and different from the old K&R
- * assembler.  This brings us endless joy.  (It was supposed to make
- * translation of the assembly used by the old K&R assembler easier by
- * not deviating too much from that dialect.)
- */
-{
-       mnemonic_t *mp;
-
-       dialect= NCC;
-       ack_emit_init(file, banner);
-
-       /* Replace a few mnemonics. */
-       for (mp= ncc_mnemtab; mp < arraylimit(ncc_mnemtab); mp++) {
-               opcode2name_tab[mp->opcode]= mp->name;
-       }
-}
-
-void ncc_emit_instruction(asm86_t *a)
-{
-       ack_emit_instruction(a);
-}
diff --git a/commands/gas2ack/gas2ack.c b/commands/gas2ack/gas2ack.c
deleted file mode 100644 (file)
index f1dfc2c..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*     asmconv 1.12 - convert 80X86 assembly           Author: Kees J. Bot
- *                                                             24 Dec 1993
- */
-static char version[] = "1.12";
-
-#define nil 0
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <getopt.h>
-#include "asmconv.h"
-#include "asm86.h"
-#include "languages.h"
-
-void fatal(char *label)
-{
-       fprintf(stderr, "asmconv: %s: %s\n", label, strerror(errno));
-       exit(EXIT_FAILURE);
-}
-
-void *allocate(void *mem, size_t size)
-/* A checked malloc/realloc().  Yes, I know ISO C allows realloc(NULL, size). */
-{
-       mem= mem == nil ? malloc(size) : realloc(mem, size);
-       if (mem == nil) fatal("malloc()");
-       return mem;
-}
-
-void deallocate(void *mem)
-/* Free a malloc()d cell.  (Yes I know ISO C allows free(NULL) */
-{
-       if (mem != nil) free(mem);
-}
-
-char *copystr(const char *s)
-{
-       char *c;
-
-       c= allocate(nil, (strlen(s) + 1) * sizeof(s[0]));
-       strcpy(c, s);
-       return c;
-}
-
-int isanumber(const char *s)
-/* True if s can be turned into a number. */
-{
-       char *end;
-
-       (void) strtol(s, &end, 0);
-       return end != s && *end == 0;
-}
-
-/* "Invisible" globals. */
-int asm_mode32= (sizeof(int) == 4);
-int err_code= EXIT_SUCCESS;
-/* Prepend underscores to symbols */
-int prepend_underscores = 0;
-
-int main(int argc, char **argv)
-{
-       void (*parse_init)(char *file);
-       asm86_t *(*get_instruction)(void);
-       void (*emit_init)(char *file, const char *banner);
-       void (*emit_instruction)(asm86_t *instr);
-       char *lang_parse, *lang_emit, *input_file, *output_file;
-       asm86_t *instr;
-       char banner[80];
-       char c;
-       opterr = 0;
-
-   while ((c = getopt (argc, argv, "m:u")) != -1)
-      switch (c)
-      {
-      case 'm':
-         if (strcmp(optarg, "i86") == 0) {
-            set_use16();
-         } else
-         if (strcmp(optarg, "i386") == 0) {
-            set_use32();
-         }
-         else {
-            fprintf(stderr, "asmconv: '%s': unknown machine\n",
-                    optarg);
-            exit(EXIT_FAILURE);
-         }
-         break;
-      case 'u':
-         enable_underscore_mode();
-         break;
-      default:
-         fprintf(stderr, "Usage: gas2ack [input-file [output-file]]\n");
-         exit(EXIT_FAILURE);
-      }
-
-       if ((argc - optind < 1) || (argc - optind  > 2)) {
-               fprintf(stderr, "Usage: gas2ack [input-file [output-file]]\n");
-               exit(EXIT_FAILURE);
-       }
-
-       input_file= (argc - optind) < 1 ? nil : argv[optind];
-       output_file= (argc - optind) < 2 ? nil : argv[optind+1];
-
-       parse_init= gnu_parse_init;
-       get_instruction= gnu_get_instruction;
-
-       emit_init= ack_emit_init;
-       emit_instruction= ack_emit_instruction;
-
-       sprintf(banner, "Translated from GNU to ACK by gas2ack");
-
-       /* get localy defined labels first */
-       (*parse_init)(input_file);
-       for (;;) {
-               instr= (*get_instruction)();
-               if (instr == nil) break;
-               del_asm86(instr);
-       }
-
-       (*parse_init)(input_file);
-       (*emit_init)(output_file, banner);
-       for (;;) {
-               instr= (*get_instruction)();
-               (*emit_instruction)(instr);
-               if (instr == nil) break;
-               del_asm86(instr);
-       }
-       exit(err_code);
-}
diff --git a/commands/gas2ack/globals.c b/commands/gas2ack/globals.c
deleted file mode 100644 (file)
index 80f105f..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/* 
- * Table of all global definitions. Since the ack convention is to prepend
- * syms with '_' for C interfacing, we need to know about them and add/remove
- * teh '_' as neccessary
- */
-
-#include <errno.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-
-#include "asm86.h"
-
-/* this should be fine for common minix assembly files */
-#define SYM_MAX                1024
-#define SYM_MAX_LEN    64
-
-struct sym {
-       char    name[SYM_MAX_LEN];
-       int     gl;
-};
-
-static struct sym syms[SYM_MAX];
-
-static int syms_num = 0;
-
-static struct sym * sym_exists(const char * n)
-{
-       int i;
-
-       for (i = 0; i < syms_num; i++) {
-               if (strcmp(syms[i].name, n) == 0)
-                       return &syms[i];
-       }
-
-       return NULL;
-}
-
-static int is_local_label_ref(const char *n)
-{
-       int i;
-       int l = strlen(n);
-
-       for(i = 0; i < l - 1; i++)
-               if (!isdigit(n[i]))
-                       return 0;
-       if (n[l-1] != 'b' && n[l-1] != 'f')
-               return 0;
-
-       return 1;
-}
-
-static int is_hex(const char *n)
-{
-       int i;
-       for(i = 0; n[i]; i++)
-               if (!isxdigit(n[i]))
-                       return 0;
-       return 1;
-}
-
-static int is_dec(const char *n)
-{
-       int i;
-       for(i = 0; n[i]; i++)
-               if (!isdigit(n[i]))
-                       return 0;
-       return 1;
-}
-
-static int is_number(const char * n)
-{
-       if (n[0] == '0' && n[1] == 'x')
-               return is_hex(n + 2);
-       else
-               return is_dec(n);
-}
-
-int syms_is_global(const char * n)
-{
-       struct sym *s;
-
-       if (!n || is_number(n) || is_local_label_ref(n) || isregister(n))
-               return 0;
-       
-       /* if not found, it must be extern -> global */
-       if (!(s = sym_exists(n)))
-               return 1;
-
-       return s->gl;
-}
-
-static int add(const char * n, int isgl)
-{
-       if (syms_num >= SYM_MAX)
-               return -ENOMEM;
-       if (!n || strlen(n) >= SYM_MAX_LEN)
-               return -EINVAL;
-
-       /* ignore numbers */
-       if (is_number(n))
-               return 0;
-
-       strcpy(syms[syms_num].name, n);
-       syms[syms_num].gl = isgl;
-       syms_num++;
-
-       return 0;
-}
-
-int syms_add(const char *n)
-{
-       return add(n, 0);
-}
-
-int syms_add_global(const char *n)
-{
-       return add(n, 1);
-}
-
-void syms_add_global_csl(expression_t * exp)
-{
-       if (!exp)
-               return;
-
-       if (exp->operator == ',') {
-               syms_add_global_csl(exp->left);
-               syms_add_global_csl(exp->right);
-       }
-       else {
-               syms_add_global(exp->name);
-       }
-}
-
diff --git a/commands/gas2ack/globals.h b/commands/gas2ack/globals.h
deleted file mode 100644 (file)
index e3e8d6e..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __GLOBALS_H__
-#define __GLOBALS_H__
-
-int syms_is_global(const char * gl);
-int syms_add(const char * gl);
-int syms_add_global(const char * gl);
-void syms_add_global_csl(expression_t * exp);
-
-#endif
diff --git a/commands/gas2ack/languages.h b/commands/gas2ack/languages.h
deleted file mode 100644 (file)
index a34ec9f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*     languages.h - functions that parse or emit assembly
- *                                                     Author: Kees J. Bot
- *                                                             27 Dec 1993
- */
-
-void ack_parse_init(char *file);
-asm86_t *ack_get_instruction(void);
-
-void ncc_parse_init(char *file);
-asm86_t *ncc_get_instruction(void);
-
-void gnu_parse_init(char *file);
-asm86_t *gnu_get_instruction(void);
-
-void bas_parse_init(char *file);
-asm86_t *bas_get_instruction(void);
-
-void ack_emit_init(char *file, const char *banner);
-void ack_emit_instruction(asm86_t *instr);
-
-void ncc_emit_init(char *file, const char *banner);
-void ncc_emit_instruction(asm86_t *instr);
-
-void gnu_emit_init(char *file, const char *banner);
-void gnu_emit_instruction(asm86_t *instr);
diff --git a/commands/gas2ack/parse_gnu.c b/commands/gas2ack/parse_gnu.c
deleted file mode 100644 (file)
index b137e60..0000000
+++ /dev/null
@@ -1,1002 +0,0 @@
-/*     parse_ack.c - parse GNU assembly                Author: R.S. Veldema
- *                                                      <rveldema@cs.vu.nl>
- *                                                             26 Aug 1996
- */
-#define nil 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-#include "asm86.h"
-#include "languages.h"
-#include "globals.h"
-
-typedef struct mnemonic {      /* GNU as86 mnemonics translation table. */
-       char            *name;
-       opcode_t        opcode;
-       optype_t        optype;
-} mnemonic_t;
-
-/***************************************************************
-  *                                                            *
-  * NOTE: You MUST keep this array sorted by the first column. *
-  *                                                            *
-  **************************************************************/
-static mnemonic_t mnemtab[] = {
-       { ".ascii",     DOT_ASCII,      PSEUDO },
-       { ".asciz",     DOT_ASCIZ,      PSEUDO },
-       { ".assert",    DOT_ASSERT,     PSEUDO },
-       { ".balign",    DOT_ALIGN,      PSEUDO },
-       { ".base",      DOT_BASE,       PSEUDO },
-       { ".bss",       DOT_BSS,        PSEUDO },
-       { ".byte",      DOT_DATA1,      PSEUDO },
-       { ".code16",    DOT_CODE16,     PSEUDO },
-       { ".comm",      DOT_COMM,       PSEUDO },
-       { ".data",      DOT_DATA,       PSEUDO },
-       { ".end",       DOT_END,        PSEUDO },
-       { ".extern",    DOT_EXTERN,     PSEUDO },
-       { ".file",      DOT_FILE,       PSEUDO },
-       { ".global",    DOT_DEFINE,     PSEUDO },
-       { ".globl",     DOT_DEFINE,     PSEUDO },
-       { ".lcomm",     DOT_LCOMM,      PSEUDO },
-       { ".line",      DOT_LINE,       PSEUDO },
-       { ".list",      DOT_LIST,       PSEUDO },
-       { ".long",      DOT_DATA4,      PSEUDO },
-       { ".nolist",    DOT_NOLIST,     PSEUDO },
-       { ".rom",       DOT_ROM,        PSEUDO },
-       { ".short",     DOT_DATA2,      PSEUDO },
-       { ".space",     DOT_SPACE,      PSEUDO },
-       { ".symb",      DOT_SYMB,       PSEUDO },
-       { ".text",      DOT_TEXT,       PSEUDO },
-       { ".word",      DOT_DATA2,      PSEUDO },
-       { "aaa",        AAA,            WORD },
-       { "aad",        AAD,            WORD },
-       { "aam",        AAM,            WORD },
-       { "aas",        AAS,            WORD },
-       { "adcb",       ADC,            BYTE },
-       { "adcl",       ADC,            WORD },
-       { "adcw",       ADC,            OWORD },
-       { "addb",       ADD,            BYTE },
-       { "addl",       ADD,            WORD },
-       { "addw",       ADD,            OWORD },
-       { "andb",       AND,            BYTE },
-       { "andl",       AND,            WORD },
-       { "andw",       AND,            OWORD },
-       { "arpl",       ARPL,           WORD },
-       { "bound",      BOUND,          WORD },
-       { "bsf",        BSF,            WORD },
-       { "bsr",        BSR,            WORD },
-       { "bswap",      BSWAP,          WORD },
-       { "btc",        BTC,            WORD },
-       { "btl",        BT,             WORD },
-       { "btr",        BTR,            WORD },
-       { "bts",        BTS,            WORD },
-       { "btw",        BT,             OWORD },
-       { "call",       CALL,           JUMP },
-       { "callf",      CALLF,          JUMP },
-       { "cbtw",       CBW,            OWORD },
-       { "cbw",        CBW,            WORD },
-       { "cdq",        CWD,            WORD },
-       { "clc",        CLC,            WORD },
-       { "cld",        CLD,            WORD },
-       { "cli",        CLI,            WORD },
-       { "cltd",       CWD,            WORD },
-       { "clts",       CLTS,           WORD },
-       { "cmc",        CMC,            WORD },
-       { "cmpb",       CMP,            BYTE },
-       { "cmpl",       CMP,            WORD },
-       { "cmpsb",      CMPS,           BYTE },
-       { "cmpsl",      CMPS,           WORD },
-       { "cmpsw",      CMPS,           OWORD },
-       { "cmpw",       CMP,            OWORD },
-       { "cmpxchg",    CMPXCHG,        WORD },
-       { "cpuid",      CPUID,          WORD },
-       { "cwd",        CWD,            WORD },
-       { "cwde",       CBW,            WORD },
-       { "cwtd",       CWD,            OWORD },
-       { "cwtl",       CBW,            WORD },
-       { "daa",        DAA,            WORD },
-       { "das",        DAS,            WORD },
-       { "decb",       DEC,            BYTE },
-       { "decl",       DEC,            WORD },
-       { "decw",       DEC,            OWORD },
-       { "divb",       DIV,            BYTE },
-       { "divl",       DIV,            WORD },
-       { "divw",       DIV,            OWORD },
-       { "enter",      ENTER,          WORD },
-       { "f2xm1",      F2XM1,          WORD },
-       { "fabs",       FABS,           WORD },
-       { "fadd",       FADD,           WORD },
-       { "faddd",      FADDD,          WORD },
-       { "faddp",      FADDP,          WORD },
-       { "fadds",      FADDS,          WORD },
-       { "fbld",       FBLD,           WORD },
-       { "fbstp",      FBSTP,          WORD },
-       { "fchs",       FCHS,           WORD },
-       { "fcomd",      FCOMD,          WORD },
-       { "fcompd",     FCOMPD,         WORD },
-       { "fcompp",     FCOMPP,         WORD },
-       { "fcomps",     FCOMPS,         WORD },
-       { "fcoms",      FCOMS,          WORD },
-       { "fcos",       FCOS,           WORD },
-       { "fdecstp",    FDECSTP,        WORD },
-       { "fdivd",      FDIVD,          WORD },
-       { "fdivp",      FDIVP,          WORD },
-       { "fdivrd",     FDIVRD,         WORD },
-       { "fdivrp",     FDIVRP,         WORD },
-       { "fdivrs",     FDIVRS,         WORD },
-       { "fdivs",      FDIVS,          WORD },
-       { "ffree",      FFREE,          WORD },
-       { "fiaddl",     FIADDL,         WORD },
-       { "fiadds",     FIADDS,         WORD },
-       { "ficom",      FICOM,          WORD },
-       { "ficomp",     FICOMP,         WORD },
-       { "fidivl",     FIDIVL,         WORD },
-       { "fidivrl",    FIDIVRL,        WORD },
-       { "fidivrs",    FIDIVRS,        WORD },
-       { "fidivs",     FIDIVS,         WORD },
-       { "fildl",      FILDL,          WORD },
-       { "fildq",      FILDQ,          WORD },
-       { "filds",      FILDS,          WORD },
-       { "fimull",     FIMULL,         WORD },
-       { "fimuls",     FIMULS,         WORD },
-       { "fincstp",    FINCSTP,        WORD },
-       { "finit",      FINIT,          WORD },
-       { "fistl",      FISTL,          WORD },
-       { "fistp",      FISTP,          WORD },
-       { "fists",      FISTS,          WORD },
-       { "fisubl",     FISUBL,         WORD },
-       { "fisubrl",    FISUBRL,        WORD },
-       { "fisubrs",    FISUBRS,        WORD },
-       { "fisubs",     FISUBS,         WORD },
-       { "fld1",       FLD1,           WORD },
-       { "fldcw",      FLDCW,          WORD },
-       { "fldenv",     FLDENV,         WORD },
-       { "fldl",       FLDD,           WORD },
-       { "fldl2e",     FLDL2E,         WORD },
-       { "fldl2t",     FLDL2T,         WORD },
-       { "fldlg2",     FLDLG2,         WORD },
-       { "fldln2",     FLDLN2,         WORD },
-       { "fldpi",      FLDPI,          WORD },
-       { "flds",       FLDS,           WORD },
-       { "fldx",       FLDX,           WORD },
-       { "fldz",       FLDZ,           WORD },
-       { "fmuld",      FMULD,          WORD },
-       { "fmulp",      FMULP,          WORD },
-       { "fmuls",      FMULS,          WORD },
-       { "fnclex",     FCLEX,          WORD },
-       { "fninit",     FNINIT,         NONE },
-       { "fnop",       FNOP,           WORD },
-       { "fnsave",     FNSAVE,         WORD },
-       { "fnstcw",     FNSTCW,         WORD },
-       { "fnstenv",    FSTENV,         WORD },
-       { "fnstsw",     FNSTSW,         WORD },
-       { "fpatan",     FPATAN,         WORD },
-       { "fprem",      FPREM,          WORD },
-       { "fprem1",     FPREM1,         WORD },
-       { "fptan",      FPTAN,          WORD },
-       { "frndint",    FRNDINT,        WORD },
-       { "frstor",     FRSTOR,         WORD },
-       { "fsave",      FSAVE,          WORD },
-       { "fscale",     FSCALE,         WORD },
-       { "fsin",       FSIN,           WORD },
-       { "fsincos",    FSINCOS,        WORD },
-       { "fsqrt",      FSQRT,          WORD },
-       { "fstcw",      FSTCW,          WORD },
-       { "fstd",       FSTD,           WORD },
-       { "fstp",       FSTP,           WORD },
-       { "fstpl",      FSTPD,          WORD },
-       { "fstps",      FSTPS,          WORD },
-       { "fstpx",      FSTPX,          WORD },
-       { "fsts",       FSTS,           WORD },
-       { "fstsw",      FSTSW,          WORD },
-       { "fsubd",      FSUBD,          WORD },
-       { "fsubp",      FSUBP,          WORD },
-       { "fsubpr",     FSUBPR,         WORD },
-       { "fsubrd",     FSUBRD,         WORD },
-       { "fsubrs",     FSUBRS,         WORD },
-       { "fsubs",      FSUBS,          WORD },
-       { "ftst",       FTST,           WORD },
-       { "fucom",      FUCOM,          WORD },
-       { "fucomp",     FUCOMP,         WORD },
-       { "fucompp",    FUCOMPP,        WORD },
-       { "fwait",      FWAIT,          NONE },
-       { "fxam",       FXAM,           WORD },
-       { "fxch",       FXCH,           WORD },
-       { "fxrstor",    FXRSTOR,        WORD },
-       { "fxsave",     FXSAVE,         WORD },
-       { "fxtract",    FXTRACT,        WORD },
-       { "fyl2x",      FYL2X,          WORD },
-       { "fyl2xp1",    FYL2XP1,        WORD },
-       { "hlt",        HLT,            WORD },
-       { "idivb",      IDIV,           BYTE },
-       { "idivl",      IDIV,           WORD },
-       { "idivw",      IDIV,           OWORD },
-       { "imulb",      IMUL,           BYTE },
-       { "imull",      IMUL,           WORD },
-       { "imulw",      IMUL,           OWORD },
-       { "inb",        IN,             BYTE },
-       { "incb",       INC,            BYTE },
-       { "incl",       INC,            WORD },
-       { "incw",       INC,            OWORD },
-       { "inl",        IN,             WORD },
-       { "insb",       INS,            BYTE },
-       { "insl",       INS,            WORD },
-       { "insw",       INS,            OWORD },
-       { "int",        INT,            WORD },
-       { "into",       INTO,           JUMP },
-       { "invd",       INVD,           WORD },
-       { "invlpg",     INVLPG,         WORD },
-       { "inw",        IN,             OWORD },
-       { "iret",       IRET,           JUMP },
-       { "iretd",      IRETD,          JUMP },
-       { "ja",         JA,             JUMP },
-       { "jae",        JAE,            JUMP },
-       { "jb",         JB,             JUMP },
-       { "jbe",        JBE,            JUMP },
-       { "jc",         JB,             JUMP },
-       { "jcxz",       JCXZ,           JUMP },
-       { "je",         JE,             JUMP },
-       { "jecxz",      JCXZ,           JUMP },
-       { "jg",         JG,             JUMP },
-       { "jge",        JGE,            JUMP },
-       { "jl",         JL,             JUMP },
-       { "jle",        JLE,            JUMP },
-       { "jmp",        JMP,            JUMP },
-       { "jmpf",       JMPF,           JUMP },
-       { "jna",        JBE,            JUMP },
-       { "jnae",       JB,             JUMP },
-       { "jnb",        JAE,            JUMP },
-       { "jnbe",       JA,             JUMP },
-       { "jnc",        JAE,            JUMP },
-       { "jne",        JNE,            JUMP },
-       { "jng",        JLE,            JUMP },
-       { "jnge",       JL,             JUMP },
-       { "jnl",        JGE,            JUMP },
-       { "jnle",       JG,             JUMP },
-       { "jno",        JNO,            JUMP },
-       { "jnp",        JNP,            JUMP },
-       { "jns",        JNS,            JUMP },
-       { "jnz",        JNE,            JUMP },
-       { "jo",         JO,             JUMP },
-       { "jp",         JP,             JUMP },
-       { "js",         JS,             JUMP },
-       { "jz",         JE,             JUMP },
-       { "lahf",       LAHF,           WORD },
-       { "lar",        LAR,            WORD },
-       { "lds",        LDS,            WORD },
-       { "leal",       LEA,            WORD },
-       { "leave",      LEAVE,          WORD },
-       { "leaw",       LEA,            OWORD },
-       { "les",        LES,            WORD },
-       { "lfs",        LFS,            WORD },
-       { "lgdt",       LGDT,           WORD },
-       { "lgs",        LGS,            WORD },
-       { "lidt",       LIDT,           WORD },
-       { "ljmp",       JMPF,           JUMP },
-       { "ljmpw",      JMPF,           JUMP16 },
-       { "lldt",       LLDT,           WORD },
-       { "lmsw",       LMSW,           WORD },
-       { "lock",       LOCK,           WORD },
-       { "lodsb",      LODS,           BYTE },
-       { "lodsl",      LODS,           WORD },
-       { "lodsw",      LODS,           OWORD },
-       { "loop",       LOOP,           JUMP },
-       { "loope",      LOOPE,          JUMP },
-       { "loopne",     LOOPNE,         JUMP },
-       { "loopnz",     LOOPNE,         JUMP },
-       { "loopz",      LOOPE,          JUMP },
-       { "lretw",      RETF,           JUMP16 },
-       { "lsl",        LSL,            WORD },
-       { "lss",        LSS,            WORD },
-       { "ltr",        LTR,            WORD },
-       { "mfence",     MFENCE,         WORD },
-       { "movb",       MOV,            BYTE },
-       { "movl",       MOV,            WORD },
-       { "movsb",      MOVS,           BYTE },
-       { "movsbl",     MOVSXB,         WORD },
-       { "movsbw",     MOVSXB,         OWORD },
-       { "movsl",      MOVS,           WORD },
-       { "movsw",      MOVS,           OWORD },
-       { "movswl",     MOVSX,          WORD },
-       { "movw",       MOV,            OWORD },
-       { "movzbl",     MOVZXB,         WORD },
-       { "movzbw",     MOVZXB,         OWORD },
-       { "movzwl",     MOVZX,          WORD },
-       { "mulb",       MUL,            BYTE },
-       { "mull",       MUL,            WORD },
-       { "mulw",       MUL,            OWORD },
-       { "negb",       NEG,            BYTE },
-       { "negl",       NEG,            WORD },
-       { "negw",       NEG,            OWORD },
-       { "nop",        NOP,            WORD },
-       { "notb",       NOT,            BYTE },
-       { "notl",       NOT,            WORD },
-       { "notw",       NOT,            OWORD },
-       { "orb",        OR,             BYTE },
-       { "orl",        OR,             WORD },
-       { "orw",        OR,             OWORD },
-       { "outb",       OUT,            BYTE },
-       { "outl",       OUT,            WORD },
-       { "outsb",      OUTS,           BYTE },
-       { "outsl",      OUTS,           WORD },
-       { "outsw",      OUTS,           OWORD },
-       { "outw",       OUT,            OWORD },
-       { "pause",      PAUSE,          WORD },
-       { "pop",        POP,            WORD },
-       { "popa",       POPA,           WORD },
-       { "popal",      POPAD,          WORD },
-       { "popf",       POPF,           WORD },
-       { "popfl",      POPF,           WORD },
-       { "popl",       POP,            WORD },
-       { "popw",       POP,            OWORD },
-       { "push",       PUSH,           WORD },
-       { "pusha",      PUSHA,          WORD },
-       { "pushal",     PUSHAD,         WORD },
-       { "pushf",      PUSHF,          WORD },
-       { "pushl",      PUSH,           WORD },
-       { "pushw",      PUSH,           OWORD },
-       { "rclb",       RCL,            BYTE },
-       { "rcll",       RCL,            WORD },
-       { "rclw",       RCL,            OWORD },
-       { "rcrb",       RCR,            BYTE },
-       { "rcrl",       RCR,            WORD },
-       { "rcrw",       RCR,            OWORD },
-       { "rdmsr",      RDMSR,          WORD },
-       { "rdpmc",      RDPMC,          WORD },
-       { "rdtsc",      RDTSC,          WORD },
-       { "ret",        RET,            JUMP },
-       { "retf",       RETF,           JUMP },
-       { "rolb",       ROL,            BYTE },
-       { "roll",       ROL,            WORD },
-       { "rolw",       ROL,            OWORD },
-       { "rorb",       ROR,            BYTE },
-       { "rorl",       ROR,            WORD },
-       { "rorw",       ROR,            OWORD },
-       { "sahf",       SAHF,           WORD },
-       { "salb",       SAL,            BYTE },
-       { "sall",       SAL,            WORD },
-       { "salw",       SAL,            OWORD },
-       { "sarb",       SAR,            BYTE },
-       { "sarl",       SAR,            WORD },
-       { "sarw",       SAR,            OWORD },
-       { "sbbb",       SBB,            BYTE },
-       { "sbbl",       SBB,            WORD },
-       { "sbbw",       SBB,            OWORD },
-       { "scasb",      SCAS,           BYTE },
-       { "scasl",      SCAS,           WORD },
-       { "scasw",      SCAS,           OWORD },
-       { "seta",       SETA,           BYTE },
-       { "setae",      SETAE,          BYTE },
-       { "setb",       SETB,           BYTE },
-       { "setbe",      SETBE,          BYTE },
-       { "sete",       SETE,           BYTE },
-       { "setg",       SETG,           BYTE },
-       { "setge",      SETGE,          BYTE },
-       { "setl",       SETL,           BYTE },
-       { "setna",      SETBE,          BYTE },
-       { "setnae",     SETB,           BYTE },
-       { "setnb",      SETAE,          BYTE },
-       { "setnbe",     SETA,           BYTE },
-       { "setne",      SETNE,          BYTE },
-       { "setng",      SETLE,          BYTE },
-       { "setnge",     SETL,           BYTE },
-       { "setnl",      SETGE,          BYTE },
-       { "setnle",     SETG,           BYTE },
-       { "setno",      SETNO,          BYTE },
-       { "setnp",      SETNP,          BYTE },
-       { "setns",      SETNS,          BYTE },
-       { "seto",       SETO,           BYTE },
-       { "setp",       SETP,           BYTE },
-       { "sets",       SETS,           BYTE },
-       { "setz",       SETE,           BYTE },
-       { "sgdt",       SGDT,           WORD },
-       { "shlb",       SHL,            BYTE },
-       { "shldl",      SHLD,           WORD },
-       { "shll",       SHL,            WORD },
-       { "shlw",       SHL,            OWORD },
-       { "shrb",       SHR,            BYTE },
-       { "shrdl",      SHRD,           WORD },
-       { "shrl",       SHR,            WORD },
-       { "shrw",       SHR,            OWORD },
-       { "sidt",       SIDT,           WORD },
-       { "sldt",       SLDT,           WORD },
-       { "smsw",       SMSW,           WORD },
-       { "stc",        STC,            WORD },
-       { "std",        STD,            WORD },
-       { "sti",        STI,            WORD },
-       { "stosb",      STOS,           BYTE },
-       { "stosl",      STOS,           WORD },
-       { "stosw",      STOS,           OWORD },
-       { "str",        STR,            WORD },
-       { "subb",       SUB,            BYTE },
-       { "subl",       SUB,            WORD },
-       { "subw",       SUB,            OWORD },
-       { "testb",      TEST,           BYTE },
-       { "testl",      TEST,           WORD },
-       { "testw",      TEST,           OWORD },
-       { "verr",       VERR,           WORD },
-       { "verw",       VERW,           WORD },
-       { "wait",       WAIT,           WORD },
-       { "wbinvd",     WBINVD,         WORD },
-       { "wrmsr",      WRMSR,          WORD },
-       { "xadd",       XADD,           WORD },
-       { "xchgb",      XCHG,           BYTE },
-       { "xchgl",      XCHG,           WORD },
-       { "xchgw",      XCHG,           OWORD },
-       { "xlat",       XLAT,           WORD },
-       { "xorb",       XOR,            BYTE },
-       { "xorl",       XOR,            WORD },
-       { "xorw",       XOR,            OWORD },
-};
-
-void gnu_parse_init(char *file)
-/* Prepare parsing of an GNU assembly file. */
-{
-       tok_init(file, '#');
-}
-
-static void zap(void)
-/* An error, zap the rest of the line. */
-{
-       token_t *t;
-
-       while ((t= get_token(0))->type != T_EOF && t->symbol != ';'
-                       && t->type != T_COMMENT)
-               skip_token(1);
-}
-
-static mnemonic_t *search_mnem(char *name)
-/* Binary search for a mnemonic.  (That's why the table is sorted.) */
-{
-       int low, mid, high;
-       int cmp;
-       mnemonic_t *m;
-       char name_buf[64];
-       int brk = 0;
-
-try_long:
-       low= 0;
-       high= arraysize(mnemtab)-1;
-       while (low <= high) {
-               mid= (low + high) / 2;
-               m= &mnemtab[mid];
-
-               if ((cmp= strcmp(name, m->name)) == 0) return m;
-
-               if (cmp < 0) high= mid-1; else low= mid+1;
-       }
-
-       /*
-        * in gnu the modifier 'l' is usually omitted, however we need the
-        * information about the arguments length. Therefore we try if we know
-        * such instruction. It covers most of the cases of unknown instructions
-        */
-       if (!brk) {
-               int len = strlen(name);
-               strcpy(name_buf, name);
-               name_buf[len] = 'l';
-               name_buf[len + 1] = '\0';
-               name = name_buf;
-               brk = 1;
-               goto try_long;
-       }
-
-       printf("not found '%s'\n", name);
-       return nil;
-}
-
-static expression_t *gnu_get_C_expression(int *pn)
-/* Read a "C-like" expression.  Note that we don't worry about precedence,
- * the expression is printed later like it is read.  If the target language
- * does not have all the operators (like ~) then this has to be repaired by
- * changing the source file.  (No problem, you still have one source file
- * to maintain, not two.)
- */
-{
-       expression_t *e, *a1, *a2;
-       token_t *t;
-
-       if ((t= get_token(*pn))->symbol == '(') {
-               /* ( expr ): grouping. */
-               (*pn)++;
-               if ((a1= gnu_get_C_expression(pn)) == nil) return nil;
-               if (get_token(*pn)->symbol != ')') {
-                       parse_err(1, t, "missing )\n");
-                       del_expr(a1);
-                       return nil;
-               }
-               (*pn)++;
-               e= new_expr();
-               e->operator= '[';
-               e->middle= a1;
-       } else
-       if (t->type == T_WORD || t->type == T_STRING) {
-               /* Label, number, or string. */
-               e= new_expr();
-               e->operator= t->type == T_WORD ? 'W' : 'S';
-               e->name= allocate(nil, (t->len+1) * sizeof(e->name[0]));
-               memcpy(e->name, t->name , t->len+1);
-               e->len= t->len;
-               (*pn)++;
-       } else
-       if (t->symbol == '+' || t->symbol == '-' || t->symbol == '~') {
-               /* Unary operator. */
-               (*pn)++;
-               if ((a1= gnu_get_C_expression(pn)) == nil) return nil;
-               e= new_expr();
-               e->operator= t->symbol;
-               e->middle= a1;
-       } else {
-               parse_err(1, t, "expression syntax error\n");
-               return nil;
-       }
-
-       switch ((t= get_token(*pn))->symbol) {
-       case '%': 
-       case '+':
-       case '-':
-       case '*':
-       case '/':
-       case '&':
-       case '|':
-       case '^':
-       case S_LEFTSHIFT:
-       case S_RIGHTSHIFT:
-               (*pn)++;
-               a1= e;
-               if ((a2= gnu_get_C_expression(pn)) == nil) {
-                       del_expr(a1);
-                       return nil;
-               }
-               e= new_expr();
-               e->operator= t->symbol;
-               e->left= a1;
-               e->right= a2;
-       }
-       return e;
-}
-
-static expression_t *gnu_get_operand(asm86_t * a, int *pn, int deref)
-/* Get something like: $immed, memory, offset(%base,%index,scale), or simpler. */
-{
-       expression_t *e, *offset, *base, *index;
-       token_t *t;
-       int c;
-
-       if (get_token(*pn)->symbol == '$') {
-               /* An immediate value. */
-               (*pn)++;
-               return gnu_get_C_expression(pn);
-       }
-
-       if (get_token(*pn)->symbol == '*') {
-               (*pn)++;
-               deref = 1;
-#if 0
-               if ((offset= gnu_get_operand(a, pn, deref)) == nil) return nil;
-#if 0
-               e= new_expr();
-               e->operator= '(';
-               e->middle= offset;
-               return e;
-#endif
-               return offset;
-#endif
-       }
-
-       if ((get_token(*pn)->symbol == '%')
-               && (t= get_token(*pn + 1))->type == T_WORD
-               && isregister(t->name)
-       ) {
-               /* A register operand. */
-               (*pn)+= 2;
-               e= new_expr();
-               e->operator= 'W';
-               e->name= copystr(t->name);
-               return e;
-       }
-
-       /* Offset? */
-       if (get_token(*pn)->symbol != '('
-                               || get_token(*pn + 1)->symbol != '%') {
-               /* There is an offset. */
-               if ((offset= gnu_get_C_expression(pn)) == nil) return nil;
-       } else {
-               /* No offset. */
-               offset= nil;
-       }
-
-       /* (%base,%index,scale) ? */
-       base= index= nil;
-       if (get_token(*pn)->symbol == '(') {
-               (*pn)++;
-
-               /* %base ? */
-               if (get_token(*pn)->symbol == '%'
-                       && (t= get_token(*pn + 1))->type == T_WORD
-                       && isregister(t->name)
-               ) {
-                       /* A base register expression. */
-                       base= new_expr();
-                       base->operator= 'B';
-                       base->name= copystr(t->name);
-                       (*pn)+= 2;
-               }
-
-               if (get_token(*pn)->symbol == ',') (*pn)++;
-
-               /* %index ? */
-               if (get_token(*pn)->symbol == '%'
-                       && (t= get_token(*pn + 1))->type == T_WORD
-                       && isregister(t->name)
-               ) {
-                       /* A index register expression. */
-                       index= new_expr();
-                       index->operator= '1';           /* for now */
-                       index->name= copystr(t->name);
-                       (*pn)+= 2;
-               }
-
-               if (get_token(*pn)->symbol == ',') (*pn)++;
-
-               /* scale ? */
-               if ((base != nil || index != nil)
-                       && (t= get_token(*pn))->type == T_WORD
-                       && strchr("1248", t->name[0]) != nil
-                       && t->name[1] == 0
-               ) {             
-                       if (index == nil) {
-                               /* Base is really an index register. */
-                               index= base;
-                               base= nil;
-                       }
-                       index->operator= t->name[0];
-                       (*pn)++;
-               }
-
-               if (get_token(*pn)->symbol == ')') {
-                       /* Ending paren. */
-                       (*pn)++;
-               } else {
-                       /* Alas. */
-                       parse_err(1, t, "operand syntax error\n");
-                       del_expr(offset);
-                       del_expr(base);
-                       del_expr(index);
-                       return nil;
-               }
-       }
-
-       if (base == nil && index == nil) {
-               if (deref) {
-                       /* Return a lone offset as (offset). */
-                       e= new_expr();
-                       e->operator= '(';
-                       e->middle= offset;
-               } else {
-                       /* Return a lone offset as is. */
-                       e= offset;
-               }
-       } else {
-               e= new_expr();
-               e->operator= 'O';
-               e->left= offset;
-
-               e->middle= base;
-               e->right= index;
-       }
-       return e;
-}
-
-static expression_t *gnu_get_oplist(asm86_t * a, int *pn, int deref)
-/* Get a comma (or colon for jmpf and callf) separated list of instruction
- * operands.
- */
-{
-       expression_t *e, *o1, *o2;
-       token_t *t;
-       int sreg;
-
-
-       if ((e= gnu_get_operand(a, pn, deref)) == nil) return nil;
-
-       t = get_token(*pn);
-
-       if (t->symbol == ':' && IS_REGSEG(sreg = isregister(e->name))
-                                               && a->seg == DEFSEG) {
-               a->seg = segreg2seg(sreg);
-               del_expr(e);
-               (*pn)++;
-               e = gnu_get_oplist(a, pn, deref);
-       }
-       else if (t->symbol == ',' || t->symbol == ':') {
-               o1= e;
-               (*pn)++;
-               if ((o2= gnu_get_oplist(a, pn, deref)) == nil) {
-                       del_expr(o1);
-                       return nil;
-               }
-               e= new_expr();
-               e->operator= ',';
-               e->left= o2;
-               e->right= o1;
-       }
-       return e;
-}
-
-
-static asm86_t *gnu_get_statement(void)
-/* Get a pseudo op or machine instruction with arguments. */
-{
-       token_t *t= get_token(0);
-       token_t *tn;
-       asm86_t *a;
-       mnemonic_t *m;
-       int n;
-       int prefix_seen;
-       int deref;
-
-       assert(t->type == T_WORD);
-
-       a= new_asm86();
-
-       /* Process instruction prefixes. */
-       for (prefix_seen= 0;; prefix_seen= 1) {
-               if (strcmp(t->name, "rep") == 0
-                       || strcmp(t->name, "repe") == 0
-                       || strcmp(t->name, "repne") == 0
-                       || strcmp(t->name, "repz") == 0
-                       || strcmp(t->name, "repnz") == 0
-               ) {
-                       if (a->rep != ONCE) {
-                               parse_err(1, t,
-                                       "can't have more than one rep\n");
-                       }
-                       switch (t->name[3]) {
-                       case 0:         a->rep= REP;    break;
-                       case 'e':
-                       case 'z':       a->rep= REPE;   break;
-                       case 'n':       a->rep= REPNE;  break;
-                       }
-               } else
-               if (!prefix_seen) {
-                       /* No prefix here, get out! */
-                       break;
-               } else {
-                       /* No more prefixes, next must be an instruction. */
-                       if (t->type != T_WORD
-                               || (m= search_mnem(t->name)) == nil
-                               || m->optype == PSEUDO
-                       ) {
-                               parse_err(1, t,
-               "machine instruction expected after instruction prefix\n");
-                               del_asm86(a);
-                               return nil;
-                       }
-                       break;
-               }
-
-               /* Skip the prefix and extra newlines. */
-               do {
-                       skip_token(1);
-               } while ((t= get_token(0))->symbol == ';');
-       }
-
-       /* All the readahead being done upsets the line counter. */
-       a->line= t->line;
-
-       /* Read a machine instruction or pseudo op. */
-       if ((m= search_mnem(t->name)) == nil) {
-               parse_err(1, t, "unknown instruction '%s'\n", t->name);
-               del_asm86(a);
-               return nil;
-       }
-       a->opcode= m->opcode;
-       a->optype= m->optype;
-       a->oaz= 0;
-       if (a->optype == OWORD) {
-               a->oaz|= OPZ;
-               a->optype= WORD;
-       }
-       else if (a->optype == JUMP16) {
-               a->oaz|= OPZ;
-               a->optype= JUMP;
-       }
-
-       switch (a->opcode) {
-       case IN:
-       case OUT:
-       case INT:
-               deref= 0;
-               break;
-       default:
-               deref= (a->optype >= BYTE);
-       }
-       n= 1;
-       if (get_token(1)->type != T_COMMENT && get_token(1)->symbol != ';'
-                       && (a->args= gnu_get_oplist(a, &n, deref)) == nil) {
-               del_asm86(a);
-               return nil;
-       }
-       tn = get_token(n);
-       if (tn->type == T_COMMENT) {
-               a->raw_string = malloc(tn->len + 1);
-               if (!a->raw_string)
-                       return NULL;
-
-               strcpy(a->raw_string, tn->name);
-       } else
-       if (get_token(n)->symbol != ';') {
-               parse_err(1, t, "garbage at end of instruction\n");
-               del_asm86(a);
-               return nil;
-       }
-       if (!is_pseudo(a->opcode)) {
-               /* GNU operand order is the other way around. */
-               expression_t *e, *t;
-
-               e= a->args;
-               while (e != nil && e->operator == ',') {
-                       t= e->right; e->right= e->left; e->left= t;
-                       e= e->left;
-               }
-       }
-       switch (a->opcode) {
-       case DOT_ALIGN:
-               /* Delete two argument .align, because ACK can't do it.
-                */
-               if (a->args == nil || a->args->operator != 'W') {       
-                       del_asm86(a);
-                       return nil;
-               }
-               if (a->args != nil && a->args->operator == 'W'
-                       && isanumber(a->args->name)
-               ) {     
-                       unsigned n;
-                       char num[sizeof(int) * CHAR_BIT / 3 + 1];
-
-                       n= strtoul(a->args->name, nil, 0);
-                       sprintf(num, "%u", n);
-                       deallocate(a->args->name);
-                       a->args->name= copystr(num);
-               }
-               break;
-       case DOT_DEFINE:
-       case DOT_EXTERN:
-      if (underscore_mode())
-         syms_add_global_csl(a->args);
-               break;
-       case DOT_COMM:
-      if (underscore_mode())
-          syms_add_global(a->args->left->name);
-               break;
-       case DOT_LCOMM:
-      if(underscore_mode())
-         syms_add(a->args->left->name);
-               break;
-       case JMPF:
-       case CALLF:
-               /*FALL THROUGH*/
-       case JMP:
-       case CALL:
-               break;
-       case DOT_CODE16:
-               break;
-       default:;
-       }
-       skip_token(n+1);
-       return a;
-}
-
-
-asm86_t *gnu_get_instruction(void)
-{
-       asm86_t *a= nil;
-       expression_t *e;
-       token_t *t;
-
-       while ((t= get_token(0))->symbol == ';' || t->symbol == '/') {
-               zap();          /* if a comment started by a '/' */
-               skip_token(1);
-       }
-
-       if (t->type == T_EOF) return nil;
-
-       if (t->type == T_COMMENT || t->type == T_C_PREPROCESSOR) {
-
-               a = new_asm86();
-               if (t->type == T_COMMENT)
-                       a->opcode = COMMENT;
-               else
-                       a->opcode = C_PREPROCESSOR;
-
-               a->raw_string = malloc(t->len + 1);
-               if (!a->raw_string)
-                       return NULL;
-
-               strcpy(a->raw_string, t->name);
-               skip_token(1);
-               return a;
-       }
-
-       if (t->symbol == '#') {
-               /* Preprocessor line and file change. */
-
-               if ((t= get_token(1))->type != T_WORD || !isanumber(t->name)
-                       || get_token(2)->type != T_STRING
-               ) {
-                       parse_err(1, t, "file not preprocessed?\n");
-                       zap();
-               } else {
-                       set_file(get_token(2)->name,
-                               strtol(get_token(1)->name, nil, 0) - 1);
-
-                       /* GNU CPP adds extra cruft, simply zap the line. */
-                       zap();
-               }
-               a= gnu_get_instruction();
-       } else
-       if (t->type == T_WORD && get_token(1)->symbol == ':') {
-               /* A label definition. */
-
-               a= new_asm86();
-               a->line= t->line;
-               a->opcode= DOT_LABEL;
-               a->optype= PSEUDO;
-               a->args= e= new_expr();
-               e->operator= ':';
-               e->name= copystr(t->name);
-      if (underscore_mode())
-         syms_add(t->name);
-               skip_token(2);
-       } else
-       if (t->type == T_WORD && get_token(1)->symbol == '=') {
-               int n= 2;
-
-               if ((e= gnu_get_C_expression(&n)) == nil) {
-                       zap();
-                       a= gnu_get_instruction();
-               } else
-               if (get_token(n)->type != T_COMMENT && get_token(n)->symbol != ';') {
-                       parse_err(1, t, "garbage after assignment\n");
-                       zap();
-                       a= gnu_get_instruction();
-               } else {
-                       a= new_asm86();
-                       if (get_token(n)->type == T_COMMENT) {
-                               token_t *c = get_token(n);
-
-                               a->raw_string = malloc(c->len + 1);
-                               if (!a->raw_string)
-                                       return NULL;
-
-                               strcpy(a->raw_string, c->name);
-                       }
-                       a->line= t->line;
-                       a->opcode= DOT_EQU;
-                       a->optype= PSEUDO;
-                       a->args= new_expr();
-                       a->args->operator= '=';
-                       a->args->name= copystr(t->name);
-         if (underscore_mode())
-            syms_add(t->name);
-                       a->args->middle= e;
-                       skip_token(n+1);
-               }
-       } else
-       if (t->type == T_WORD) {
-               if ((a= gnu_get_statement()) == nil) {
-                       zap();
-                       a= gnu_get_instruction();
-               }
-       } else {
-               parse_err(1, t, "syntax error\n");
-               zap();
-               a= gnu_get_instruction();
-       }
-       return a;
-}
diff --git a/commands/gas2ack/token.h b/commands/gas2ack/token.h
deleted file mode 100644 (file)
index fbf8ae6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*     token.h - token definition                      Author: Kees J. Bot
- *                                                             13 Dec 1993
- */
-
-typedef enum toktype {
-       T_EOF,
-       T_CHAR,
-       T_WORD,
-       T_STRING,
-       T_COMMENT,
-       T_C_PREPROCESSOR
-} toktype_t;
-
-typedef struct token {
-       struct token    *next;
-       long            line;
-       toktype_t       type;
-       int             symbol;         /* Single character symbol. */
-       char            *name;          /* Word, number, etc. */
-       size_t          len;            /* Length of string. */
-} token_t;
-
-#define S_LEFTSHIFT    0x100           /* << */
-#define S_RIGHTSHIFT   0x101           /* >> */
-
-void set_file(char *file, long line);
-void get_file(char **file, long *line);
-void parse_err(int err, token_t *where, const char *fmt, ...);
-void parse_warn(int err, token_t *t, const char *fmt, ...);
-void tok_init(char *file, int comment);
-token_t *get_token(int n);
-void skip_token(int n);
diff --git a/commands/gas2ack/tokenize.c b/commands/gas2ack/tokenize.c
deleted file mode 100644 (file)
index 51edbdf..0000000
+++ /dev/null
@@ -1,410 +0,0 @@
-/*     tokenize.c - split input into tokens            Author: Kees J. Bot
- *                                                             13 Dec 1993
- */
-#define nil 0
-#include <stdio.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include "asmconv.h"
-#include "token.h"
-
-static FILE *tf;
-static char *tfile;
-static char *orig_tfile;
-static int tcomment;
-static int tc;
-static long tline;
-static token_t *tq;
-static int nl, prevnl;
-
-static int old_n= 0;           /* To speed up n, n+1, n+2, ... accesses. */
-static token_t **old_ptq= &tq;
-
-static void tok_reset(void)
-{
-       nl = prevnl = 0;
-       tline = 0;
-       if (tf)
-               fclose(tf); /* ignore error */
-       tf = NULL;
-       old_n = 0;
-       old_ptq = &tq;
-       tq = NULL;
-}
-
-static void readtc(void)
-/* Read one character from the input file and put it in the global 'tc'. */
-{
-       if (nl) tline++;
-       if ((tc= getc(tf)) == EOF && ferror(tf)) fatal(orig_tfile);
-       prevnl = nl;
-       nl= (tc == '\n');
-}
-
-static void unreadtc(int tc)
-{
-       if (tc == '\n')
-               tline--;
-       nl = prevnl;
-       ungetc(tc, tf);
-}
-
-void set_file(char *file, long line)
-/* Set file name and line number, changed by a preprocessor trick. */
-{
-       deallocate(tfile);
-       tfile= allocate(nil, (strlen(file) + 1) * sizeof(tfile[0]));
-       strcpy(tfile, file);
-       tline= line;
-}
-
-void get_file(char **file, long *line)
-/* Get file name and line number. */
-{
-       *file= tfile;
-       *line= tline;
-}
-
-void parse_err(int err, token_t *t, const char *fmt, ...)
-/* Report a parsing error. */
-{
-       va_list ap;
-
-       fprintf(stderr, "* error : \"%s\", line %ld: ", tfile,
-                                               t == nil ? tline : t->line);
-       va_start(ap, fmt);
-       vfprintf(stderr, fmt, ap);
-       va_end(ap);
-       if (err) set_error();
-}
-
-void parse_warn(int err, token_t *t, const char *fmt, ...)
-/* Report a parsing error. */
-{
-       va_list ap;
-
-       fprintf(stderr, "warning : \"%s\", line %ld: ", tfile,
-                                               t == nil ? tline : t->line);
-       va_start(ap, fmt);
-       vfprintf(stderr, fmt, ap);
-       va_end(ap);
-}
-
-void tok_init(char *file, int comment)
-/* Open the file to tokenize and initialize the tokenizer. */
-{
-       tok_reset();
-
-       if (file == nil) {
-               file= "stdin";
-               tf= stdin;
-       } else {
-               if ((tf= fopen(file, "r")) == nil) fatal(file);
-       }
-       orig_tfile= file;
-       set_file(file, 1);
-       readtc();
-       tcomment= comment;
-}
-
-static int isspace(int c)
-{
-       return between('\0', c, ' ') && c != '\n';
-}
-
-#define iscomment(c)   ((c) == tcomment)
-
-static int isidentchar(int c)
-{
-       return between('a', c, 'z')
-               || between('A', c, 'Z')
-               || between('0', c, '9')
-               || c == '.'
-               || c == '_'
-               ;
-}
-
-static token_t *new_token(void)
-{
-       token_t *new;
-
-       new= allocate(nil, sizeof(*new));
-       new->next= nil;
-       new->line= tline;
-       new->name= nil;
-       new->symbol= -1;
-       return new;
-}
-
-static token_t *get_word(void)
-/* Read one word, an identifier, a number, a label, or a mnemonic. */
-{
-       token_t *w;
-       char *name;
-       size_t i, len;
-
-       i= 0;
-       len= 16;
-       name= allocate(nil, len * sizeof(name[0]));
-
-       while (isidentchar(tc)) {
-               name[i++]= tc;
-               readtc();
-               if (i == len) name= allocate(name, (len*= 2) * sizeof(name[0]));
-       }
-       name[i]= 0;
-       name= allocate(name, (i+1) * sizeof(name[0]));
-       w= new_token();
-       w->type= T_WORD;
-       w->name= name;
-       w->len= i;
-       return w;
-}
-
-static token_t *get_string(void)
-/* Read a single or double quotes delimited string. */
-{
-       token_t *s;
-       int quote;
-       char *str;
-       size_t i, len;
-       int n, j;
-       int seen;
-
-       quote= tc;
-       readtc();
-
-       i= 0;
-       len= 16;
-       str= allocate(nil, len * sizeof(str[0]));
-
-       while (tc != quote && tc != '\n' && tc != EOF) {
-               seen= -1;
-               if (tc == '\\') {
-                       readtc();
-                       if (tc == '\n' || tc == EOF) break;
-
-                       switch (tc) {
-                       case 'a':       tc= '\a'; break;
-                       case 'b':       tc= '\b'; break;
-                       case 'f':       tc= '\f'; break;
-                       case 'n':       tc= '\n'; break;
-                       case 'r':       tc= '\r'; break;
-                       case 't':       tc= '\t'; break;
-                       case 'v':       tc= '\v'; break;
-                       case 'x':
-                               n= 0;
-                               for (j= 0; j < 3; j++) {
-                                       readtc();
-                                       if (between('0', tc, '9'))
-                                               tc-= '0' + 0x0;
-                                       else
-                                       if (between('A', tc, 'A'))
-                                               tc-= 'A' + 0xA;
-                                       else
-                                       if (between('a', tc, 'a'))
-                                               tc-= 'a' + 0xa;
-                                       else {
-                                               seen= tc;
-                                               break;
-                                       }
-                                       n= n*0x10 + tc;
-                               }
-                               tc= n;
-                               break;
-                       default:
-                               if (!between('0', tc, '9')) break;
-                               n= 0;
-                               for (j= 0; j < 3; j++) {
-                                       if (between('0', tc, '9'))
-                                               tc-= '0';
-                                       else {
-                                               seen= tc;
-                                               break;
-                                       }
-                                       n= n*010 + tc;
-                                       readtc();
-                               }
-                               tc= n;
-                       }
-               }
-               str[i++]= tc;
-               if (i == len) str= allocate(str, (len*= 2) * sizeof(str[0]));
-
-               if (seen < 0) readtc(); else tc= seen;
-       }
-
-       if (tc == quote) {
-               readtc();
-       } else {
-               parse_err(1, nil, "string contains newline\n");
-       }
-       str[i]= 0;
-       str= allocate(str, (i+1) * sizeof(str[0]));
-       s= new_token();
-       s->type= T_STRING;
-       s->name= str;
-       s->len= i;
-       return s;
-}
-
-#define MAX_TOKEN_STR_SIZE     4096
-static char token_str[MAX_TOKEN_STR_SIZE];
-static unsigned token_sz;
-
-token_t *get_token(int n)
-/* Return the n-th token on the input queue. */
-{
-       token_t *t, **ptq;
-
-       assert(n >= 0);
-
-       if (0 && n >= old_n) {
-               /* Go forward from the previous point. */
-               n-= old_n;
-               old_n+= n;
-               ptq= old_ptq;
-       } else {
-               /* Restart from the head of the queue. */
-               old_n= n;
-               ptq= &tq;
-       }
-
-       for (;;) {
-               if ((t= *ptq) == nil) {
-                       /* consume white spaces */
-                       while (isspace(tc))
-                               readtc();
-                       /* read long C comments */
-                       if (tc == '/') {
-                               readtc();
-                               if (tc != '*') {
-                                       unreadtc(tc);
-                                       tc = '/';
-                               }
-                               else {
-                                       token_sz = 2;
-                                       t = new_token();
-                                       t->type = T_COMMENT;
-                                       token_str[0] = '/';
-                                       token_str[1] = '*';
-                                       readtc();
-                                       for(;;) {
-                                               while (tc != EOF && tc != '/') {
-                                                       token_str[token_sz++] = (char)tc;
-                                                       readtc();
-                                               }
-                                               if (tc == '/') {
-                                                       if (token_str[token_sz - 1] == '*') {
-                                                               token_str[token_sz++] = (char)tc;
-                                                               readtc();
-                                                               break;
-                                                       }
-                                                       token_str[token_sz++] = (char)tc;
-                                                       readtc();
-                                               }
-                                               else if (tc == EOF)
-                                                       break;
-                                       }
-                                       token_str[token_sz] = 0;
-                                       t->name= malloc(token_sz + 1);
-                                       if (t->name == NULL) {
-                                               fprintf(stderr, "malloc() failed\n");
-                                               exit(-1);
-                                       }
-                                       strcpy(t->name, token_str);
-                                       t->len = token_sz;
-                                       goto token_found;
-                               }
-                       }
-                       if (iscomment(tc) || tc == '#') {
-                               t = new_token();
-                               if (iscomment(tc))
-                                       t->type = T_COMMENT;
-                               else
-                                       t->type = T_C_PREPROCESSOR;
-                               token_sz = 0;
-                               for(;;) {
-                                       while (tc != '\n' && tc != EOF) {
-                                               token_str[token_sz++] = (char)tc;
-                                               readtc();
-                                       }
-                                       if (t->type == T_C_PREPROCESSOR &&
-                                                       token_str[token_sz - 1] == '\\') {
-                                               token_str[token_sz++] = '\n';
-                                               tline++;
-                                               readtc();
-                                       }
-                                       else
-                                               break;
-                               }
-                               token_str[token_sz] = 0;
-                               t->name= malloc(token_sz + 1);
-                               if (t->name == NULL) {
-                                       fprintf(stderr, "malloc() failed\n");
-                                       exit(-1);
-                               }
-                               strcpy(t->name, token_str);
-                               t->len = token_sz;
-                               goto token_found;
-                       }
-
-                       if (tc == EOF) {
-                               t= new_token();
-                               t->type= T_EOF;
-                       } else
-                       if (isidentchar(tc)) {
-                               t= get_word();
-                       } else
-                       if (tc == '\'' || tc == '"') {
-                               t= get_string();
-                       } else {
-                               if (tc == '\n') tc= ';';
-                               t= new_token();
-                               t->type= T_CHAR;
-                               t->symbol= tc;
-                               readtc();
-                               if (t->symbol == '<' && tc == '<') {
-                                       t->symbol= S_LEFTSHIFT;
-                                       readtc();
-                               } else
-                               if (t->symbol == '>' && tc == '>') {
-                                       t->symbol= S_RIGHTSHIFT;
-                                       readtc();
-                               }
-                       }
-token_found:
-                       *ptq= t;
-               }
-               if (n == 0) break;
-               n--;
-               ptq= &t->next;
-       }
-       old_ptq= ptq;
-       return t;
-}
-
-void skip_token(int n)
-/* Remove n tokens from the input queue.  One is not allowed to skip unread
- * tokens.
- */
-{
-       token_t *junk;
-
-       assert(n >= 0);
-
-       while (n > 0) {
-               assert(tq != nil);
-
-               junk= tq;
-               tq= tq->next;
-               deallocate(junk->name);
-               deallocate(junk);
-               n--;
-       }
-       /* Reset the old reference. */
-       old_n= 0;
-       old_ptq= &tq;
-}
index 47ca3ec59e184e7c1fd3dd616377fda2592d7c57..db64ccd7711c037d026da4782183666331688d8d 100644 (file)
@@ -18,12 +18,6 @@ MLINKS= grep.1 egrep.1 \
 LDADD=  -lz
 DPADD=  ${LIBZ}
 
-.if ${COMPILER_TYPE} == "gnu"
 CFLAGS+= -Wall
-.endif
 
-.if ${OPSYS} == "Minix"
 .include <bsd.prog.mk>
-.else
-.include <bsd.prog.mk>
-.endif
index 7272f157d54a3fe3f9c885da1ff13ce87633e026..ed82a362253cdc0cd0a0817758b09254245184f4 100644 (file)
@@ -7,13 +7,8 @@ MAN=   hexdump.1 #od.1
 
 .ifndef HOSTPROG
 
-.if ${COMPILER_TYPE} != "gnu"
-LDADD+=-lminixutil
-DPADD+=${LIBMINIXUTIL}
-.else
 LDADD+=        -lutil
 DPADD+=        ${LIBUTIL}
-.endif
 
 #LINKS=        ${BINDIR}/hexdump ${BINDIR}/od
 .endif
index 37f07bca20901735f1298942fb4660ac7ad945e1..6dd5f37a3c97eff6ce1d73318b2282ae451bc526 100644 (file)
@@ -1,5 +1,3 @@
-.include <minix.newlibc.mk>
-
 PROG=  login
 MAN=
 .if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no")
index bb9142692f81e696cdfffd78b893b3d4446c85ca..d3d12a065aee4b5b6ff1ef52769b6adee0ce4fe7 100644 (file)
@@ -1,6 +1,5 @@
 PROG=  ls
 BINDIR=        /bin
 MAN=
-NEED_NBSDLIBC=yes
 
 .include <bsd.prog.mk>
diff --git a/commands/padtext/Makefile b/commands/padtext/Makefile
deleted file mode 100644 (file)
index e2ca2e6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-PROG=  padtext
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/padtext/padtext.c b/commands/padtext/padtext.c
deleted file mode 100644 (file)
index 580b25e..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-/* padtext: pad out the text segment of a separate I&D a.out binary to a 
- * multiple of CLICK_SIZE, used for mult-boot
- *
- * author: Erik van der Kouwe, vdkouwe@cs.vu.nl, June 9th 2010
- */
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#ifdef __NBSD_LIBC
-#include <a.out.h>
-#else
-#include <minix/a.out.h>
-#endif
-#include <minix/config.h>
-#include <minix/const.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-/* padding: x86 opcode int 3 (breakpoint) to ensure a trap if the padding area 
- * accidentally gets executed
- */
-#define PADDING_CHAR ((unsigned char) 0xcc)
-
-static const char *argv0, *pathin, *pathout;
-static int fdin, fdout;
-
-static int readfixed(void *buffer, size_t count)
-{
-       ssize_t r;
-
-       while (count > 0) {
-               /* read as many bytes as possible */
-               r = read(fdin, buffer, count);
-               if (r <= 0) {
-                       if (r < 0) {
-                               fprintf(stderr, 
-                                       "%s: %s: error while reading: %s\n", 
-                                       argv0, pathin, strerror(errno));
-                       } else {
-                               fprintf(stderr, 
-                                       "%s: %s: premature end of file, "
-                                       "expected %u more bytes\n", 
-                                       argv0, pathin, count);
-                       }
-                       return -1;
-               }
-
-               /* maybe we need to read another block */
-               buffer = (char *) buffer + r;
-               count -= r;
-       }
-
-       return 0;
-}
-
-static int writefixed(const void *buffer, size_t count)
-{
-       ssize_t r;
-
-       while (count > 0) {
-               /* read as many bytes as possible */
-               r = write(fdout, buffer, count);
-               if (r <= 0) {
-                       if (r < 0) {
-                               fprintf(stderr, 
-                                       "%s: %s: error while writing: %s\n", 
-                                       argv0, pathout, strerror(errno));
-                       } else {
-                               fprintf(stderr, 
-                                       "%s: %s: premature end of file\n", 
-                                       argv0, pathout);
-                       }
-                       return -1;
-               }
-
-               /* maybe we need to read another block */
-               buffer = (const char *) buffer + r;
-               count -= r;
-       }
-
-       return 0;
-}
-
-static int writepadding(size_t padsize)
-{
-       char buffer[CLICK_SIZE];
-
-       /* we never write more than a single click */
-       assert(padsize <= sizeof(buffer));
-       memset(buffer, PADDING_CHAR, padsize);
-       return writefixed(buffer, padsize);
-}
-
-static int copyfixed(size_t count)
-{
-       char buffer[4096];
-       size_t countnow;
-
-       while (count > 0) {
-               /* copying a fixed number of bytes, we expect everything to 
-                * succeed 
-                */ 
-               countnow = (count < sizeof(buffer)) ? count : sizeof(buffer);
-               if (readfixed(buffer, countnow) < 0 ||
-                       writefixed(buffer, countnow) < 0) {
-                       return -1;
-               }
-               count -= countnow;
-       }
-
-       return 0;
-}
-
-static int copyall(void)
-{
-       char buffer[4096];
-       ssize_t r;
-
-       for (; ; ) {
-               /* copy everything until EOF */ 
-               r = read(fdin, buffer, sizeof(buffer));
-               if (r <= 0) {
-                       if (r < 0) {
-                               fprintf(stderr,
-                                       "%s: %s: error while reading: %s\n", 
-                                       argv0, pathin, strerror(errno));
-                               return -1;
-                       } else {
-                               /* EOF, stop copying */
-                               break;
-                       }
-               }
-
-               if (writefixed(buffer, r) < 0) {
-                       return -1;
-               }
-       }
-
-       return 0;
-}
-
-static int padtext(void)
-{
-       struct exec headerin, headerout;
-       long padsize;
-
-       /* read header */
-       assert(A_MINHDR <= sizeof(headerin));
-       if (readfixed(&headerin, A_MINHDR) < 0) {
-               return -1;
-       }
-
-       /* check header sanity */
-       if (BADMAG(headerin) ||
-               headerin.a_hdrlen < A_MINHDR ||
-               (headerin.a_flags & ~(A_NSYM | A_EXEC | A_SEP)) != 0 ||
-               headerin.a_text < 0 ||
-               headerin.a_data < 0 ||
-               headerin.a_bss < 0 ||
-               headerin.a_entry != 0 ||
-               headerin.a_total < 0 ||
-               headerin.a_syms < 0) {
-               fprintf(stderr, "%s: %s: invalid a.out header\n", 
-                       argv0, pathin);
-               return -1;
-       }
-
-       if (headerin.a_cpu != A_I80386) {
-               fprintf(stderr, "%s: %s: not an i386 executable\n", 
-                       argv0, pathin);
-               return -1;
-       }
-
-       if ((headerin.a_flags & A_SEP) != A_SEP) {
-               fprintf(stderr, 
-                       "%s: %s: combined I&D, padding text is impossible\n", 
-                       argv0, pathin);
-               return -1;
-       }
-
-       /* adjust header */
-       headerout = headerin;
-       padsize = CLICK_SIZE - headerout.a_text % CLICK_SIZE;
-       if (padsize == CLICK_SIZE) padsize = 0;
-       printf("%s: %s: adding %ld bytes of padding\n", pathin, argv0, padsize);
-       headerout.a_text += padsize;
-
-       /* write header and copy text segment */
-       if (writefixed(&headerout, A_MINHDR) < 0 ||
-               copyfixed(headerin.a_hdrlen - A_MINHDR + headerin.a_text) < 0 ||
-               writepadding(padsize) < 0 ||
-               copyall() < 0) {
-               return -1;              
-       }
-
-       return 0;
-}
-
-int main(int argc, char **argv)
-{
-       /* check parameters */
-       argv0 = argv[0];
-       if (argc > 3) {
-               printf("usage:\n");
-               printf("  %s [infile [outfile]]\n", argv0);
-               return 1;
-       }
-
-       if (argc >= 2) {
-               /* open specified input file */
-               pathin = argv[1];
-               fdin = open(pathin, O_RDONLY);
-               if (fdin < 0) {
-                       fprintf(stderr, 
-                               "%s: cannot open input file \"%s\" "
-                               "for reading: %s\n",
-                               argv0, pathin, strerror(errno));
-                       return -1;
-               }
-       } else {
-               /* input from stdin */
-               pathin = "-";
-               fdin = STDIN_FILENO;
-       }
-               
-       if (argc >= 3) {
-               /* open specified output file */
-               pathout = argv[2];
-               fdout = creat(pathout, 0644);
-               if (fdout < 0) {
-                       fprintf(stderr, 
-                               "%s: cannot open output file \"%s\" "
-                               "for writing: %s\n",
-                               argv0, pathout, strerror(errno));
-                       return -1;
-               }
-       } else {
-               /* output to stdout */
-               pathout = "-";
-               fdout = STDOUT_FILENO;
-       }
-
-       /* now do the job using the file handles */
-       if (padtext() < 0) {
-               return -1;
-       }
-
-       return 0;
-}
diff --git a/commands/postmort/Makefile b/commands/postmort/Makefile
deleted file mode 100644 (file)
index 00b74f5..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-PROG=  postmort
-CPPFLAGS+= -I${MINIXSRCDIR} -I${MINIXSRCDIR}/servers
-MAN=
-
-.include <bsd.prog.mk>
diff --git a/commands/postmort/postmort.c b/commands/postmort/postmort.c
deleted file mode 100644 (file)
index 96a3fef..0000000
+++ /dev/null
@@ -1,656 +0,0 @@
-/* postmort - post mortem dump         Author: C. W. Rose */
-
-/* Postmort: perform post-mortem on PC Minix 1.7 core files.
- *
- */
-
- /* The 1.5 core file structure is a struct mem_map, the segment memory map,
-  * followed by a struct proc, the process table, followed by a dump of the
-  * text, data, and stack segments.
-  * 
-  * This is the 8086/Intel version; 386 and 68K will differ.  It defaults to
-  * using the name 'core' for the core file, and 'a.out' for the symbol file.
-  * If there is no 'a.out', it will try and read the symbol table from
-  * 'symbol.out', then give up.  A non-existant symbol table is not a fatal
-  * error unless the -s option was used.
-  * 
-  * The PC 1.5 kernel dump routines are odd - they dump the memory maps twice,
-  * the second time as part of the kernel process table, and the kernel
-  * process table size must be a multiple of 4.  Should a core file have a
-  * header with a magic number in future?
-  * 
-  * The kernel include file paths need to be edited for each machine. */
-
-#include <sys/types.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <minix/type.h>
-#include <minix/ipc.h>
-#include <limits.h>
-#include <timers.h>
-#include <signal.h>
-#include <stdlib.h>
-
-#undef EXTERN                  /* <minix/const.h> defined this */
-#define EXTERN                 /* so we get proc & mproc */
-#include <machine/archtypes.h>
-#include "kernel/const.h"
-#include "kernel/type.h"
-#include "kernel/proc.h"
-#undef printf                  /* kernel's const.h defined this */
-#include "pm/mproc.h"
-
-#include <a.out.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#define FALSE          0
-#undef TRUE
-#define TRUE           ~FALSE
-#define OK             1
-#define FAILED         -1
-
-#define CORE           "core"
-#define AOUT           "a.out"
-#define SYMB           "symbol.out"
-#define LINE_LEN       16
-#define MAXSYM         200
-#define SYMLEN         8
-
-/* Global variables */
-int opt_c = FALSE;             /* name of core file */
-int opt_d = FALSE;             /* dump raw data and stack segments */
-int opt_p = FALSE;             /* dump the kernel process table */
-int opt_s = FALSE;             /* name of symbol file */
-int opt_t = FALSE;             /* trace back the stack */
-int opt_x = FALSE;             /* debugging flag */
-
-char progname[20];             /* program name */
-char *segment_name[] = {       /* array of segment names */
-  "Text",
-  "Data",
-  "Stack"
-};
-
-int dbglvl = 0;                        /* debugging level */
-int maxsym;                    /* maximum symbol number */
-unsigned int baseptr;          /* reference copy of stack base pointer */
-unsigned int stackptr;         /* reference copy of stack pointer */
-long int lengths[NR_LOCAL_SEGS];       /* segment lengths */
-long int bases[NR_LOCAL_SEGS]; /* segment base addresses */
-
-struct sym {                   /* symbol table addresses and labels */
-  unsigned int addr;
-  char label[SYMLEN + 1];
-} symtab[MAXSYM];
-
-/* Used by getopt(3) package */
-extern int optind, opterr, optopt;
-extern char *optarg;
-
-_PROTOTYPE(int binary, (int uc, char *sp));
-_PROTOTYPE(void dump_all_segs, (int fd));
-_PROTOTYPE(void dump_maps, (struct mem_map * mp));
-_PROTOTYPE(void dump_one_seg, (int fd, int segindex));
-_PROTOTYPE(void dump_proc_table, (struct proc * pt));
-_PROTOTYPE(void dump_registers, (struct proc * pt));
-_PROTOTYPE(void dump_sym_tab, (struct sym *st));
-_PROTOTYPE(void dump_stack, (struct stackframe_s * sp));
-_PROTOTYPE(int main, (int argc, char *argv[]));
-_PROTOTYPE(int parse_line, (char *ps));
-_PROTOTYPE(int read_symbol, (int fd));
-_PROTOTYPE(void stack_trace, (int fd));
-_PROTOTYPE(void usage, (void));
-
-
-/* B i n a r y
- *
- * Produce a binary representation of an 8-bit number.
- */
-int binary(ucc, sp)
-int ucc;
-char *sp;
-{
-  int j;
-  unsigned char k, uc;
-
-  uc = (unsigned char) ucc;
-  for (k = 0x80, j = 0; j < 8; j++) {
-       if ((uc & k) == 0)
-               *sp++ = '0';
-       else
-               *sp++ = '1';
-       if (j == 3) *sp++ = '$';
-       k >>= 1;
-  }
-  *sp = '\0';
-
-  return(0);
-}
-
-
-/* D u m p _ a l l _ s e g s
- *
- * Dump all the segments except for text
- */
-void dump_all_segs(fd)
-int fd;
-{
-  int j;
-  long int start;
-
-  start = (long) (NR_LOCAL_SEGS * sizeof(struct mem_map)) + sizeof(struct proc);
-  for (j = 1; j < NR_LOCAL_SEGS; j++) {
-       start += lengths[j - 1];
-       (void) lseek(fd, start, 0);
-       printf("\n");
-       dump_one_seg(fd, j);
-  }
-}
-
-
-/* D u m p _ m a p s
- *
- * Dump the memory maps
- */
-void dump_maps(mp)
-struct mem_map *mp;
-{
-  int j;
-  long int vir, phy, len;
-
-  printf("\t  Virtual\t  Physical\tLength\n");
-  printf("\t  address\t  address\n");
-  for (j = 0; j < NR_LOCAL_SEGS; j++) {
-       vir = (long) mp[j].mem_vir << CLICK_SHIFT;
-       phy = (long) mp[j].mem_phys << CLICK_SHIFT;
-       len = (long) mp[j].mem_len << CLICK_SHIFT;
-       printf("%s:\t0x%08.8lx\t0x%08.8lx\t%8ld (0x%08.8lx)\n",
-              segment_name[j], vir, phy, len, len);
-       lengths[j] = len;
-       bases[j] = vir;
-  }
-}
-
-
-/* D u m p _ o n e _ s e g
- *
- * Dump a single segment
- */
-void dump_one_seg(fd, segindex)
-int fd, segindex;
-{
-  unsigned char dlen[LINE_LEN];
-  int i, amt, amt_read;
-  long int len, offset;
-
-  printf("%s segment\n\n", segment_name[segindex]);
-  len = lengths[segindex];
-  amt = LINE_LEN;
-  for (offset = 0; offset < len; offset += amt) {
-       if ((len - offset) < LINE_LEN) amt = (int) (len - offset);
-       if (dbglvl > 0)
-               printf("Length %ld, offset %ld, amt %d\n", len, offset, amt);
-       if ((amt_read = read(fd, (char *) dlen, (unsigned int) amt)) == -1) {
-               printf("Unexpected end of file\n");
-               exit(1);
-       }
-       printf("%08.8lx: ", bases[segindex] + offset);
-       for (i = 0; i < amt_read; i++) {
-               if (i == LINE_LEN / 2) printf("- ");
-               printf("%02.2x ", dlen[i]);
-       }
-       printf("  ");
-       for (i = 0; i < amt_read; i++) {
-               if (isprint(dlen[i]))
-                       (void) putchar((char) dlen[i]);
-               else
-                       (void) putchar('.');
-       }
-       (void) putchar('\n');
-       if (dbglvl > 0 && amt_read != amt)
-               printf("wanted = %d, got = %d, offset = %ld\n",
-                      amt, amt_read, offset);
-  }
-}
-
-
-/* D u m p _ p r o c _ t a b l e
- *
- * Dump the entire kernel proc table
- */
-void dump_proc_table(pt)
-struct proc *pt;
-{
-  printf("Kernel process table entries:\n\n");
-#if 0
-  printf("Process' registers:                  0x%04.4x\n", pt->p_reg);        /* struct stackframe_s */
-  printf("Selector in gdt:                     0x%04.4x\n", pt->p_ldt_sel);    /* reg_t */
-  printf("Descriptors for code and data:       0x%04.4x\n", pt->p_ldt[2]);     /* struct segdesc_s */
-#endif
-  printf("Number of this process:                      0x%04.4x\n", pt->p_nr); /* int */
-#if 0
-  printf("Nonzero if blocked by busy task:     0x%04.4x\n", pt->p_ntf_blocked);        /* int */
-  printf("Nonzero if held by busy syscall:     0x%04.4x\n", pt->p_ntf_held);   /* int */
-  printf("Next in chain of held-up processes:  0x%04.4x\n", pt->p_ntf_nextheld);       /* struct proc * */
-#endif
-  printf("SENDING, RECEIVING, etc.:            0x%04.4x\n", pt->p_rts_flags);  /* int */
-#if 0
-  printf("Memory map:                          0x%04.4x\n", pt->p_map[NR_LOCAL_SEGS]); /* struct mem_map */
-#endif
-#if DEAD_CODE
-  printf("Process id passed in from PM:                0x%04.4x\n", pt->p_pid);        /* int */
-#endif
-#if 0
-  printf("User time in ticks:                  %ld\n", pt->user_time); /* time_t */
-  printf("Sys time in ticks:                   %ld\n", pt->sys_time);  /* time_t */
-  printf("Cumulative user time of children:    %ld\n", pt->child_utime);       /* time_t */
-  printf("Cumulative sys time of children:     %ld\n", pt->child_stime);       /* time_t */
-  printf("Ticks used in current quantum:       %d\n", pt->quantum_time);       /* int */
-  printf("Ticks used in last quantum:          %d\n", pt->quantum_last);       /* int */
-  printf("Current priority of the process:     %d\n", pt->curr_prio);  /* int */
-  printf("Base priority of the process:                %d\n", pt->base_prio);  /* int */
-  printf("Scale for profiling, 0 = none:       %u\n", pt->p_pscale);   /* unsigned */
-  printf("Profiling pc lower boundary:         %d\n", pt->p_plow);     /* vir_bytes */
-  printf("Profiling pc upper boundary:         %d\n", pt->p_phigh);    /* vir_bytes */
-  printf("Profiling buffer:                    %d\n", pt->p_pbuf);     /* vir_bytes */
-  printf("Profiling buffer size:               %d\n", pt->p_psiz);     /* vir_bytes */
-#endif
-#if 0
-  printf("First proc wishing to send:          0x%04.4x\n", pt->p_callerq);    /* struct proc * */
-  printf("Link to next proc wishing to send:   0x%04.4x\n", pt->p_sendlink);   /* struct proc * */
-  printf("Pointer to message buffer:           0x%04.4x\n", pt->p_messbuf);    /* message * */
-#endif
-  printf("Expecting message from:                      0x%04.4x\n", pt->p_getfrom_e);  /* int */
-#if 0
-  printf("Pointer to next ready process:       0x%04.4x\n", pt->p_nextready);  /* struct proc * */
-#endif
-  printf("Bit map for pending signals 1-16:    0x%04.4x\n", pt->p_pending);    /* int */
-#if 0
-  printf("Count of pending/unfinished signals: 0x%04.4x\n", pt->p_pendcount);  /* unsigned */
-#endif
-}
-
-
-/* D u m p _ r e g i s t e r s
- *
- * Dump the registers from the proc table
- */
-void dump_registers(pt)
-struct proc *pt;
-{
-  char buff[32];
-  unsigned char uc;
-
-  /* Print the registers */
-  dump_stack(&pt->p_reg);
-
-  /* Build up a binary representation of the signal flags */
-  uc = (pt->p_pending >> 8) & 0xff;
-  (void) binary((int) uc, buff);
-  buff[9] = '$';
-  uc = pt->p_pending & 0xff;
-  (void) binary((int) uc, buff + 10);
-  printf("Pending signals = %s\n", buff);
-}
-
-
-/* D u m p _ s y m _ t a b
- *
- * Dump the symbol table
- */
-void dump_sym_tab(st)
-struct sym *st;
-{
-  int j;
-
-  printf("Symbol table entries (text):\n\n");
-  for (j = 0; j < maxsym; j++) 
-       printf("0x%08.8x T %s\n", symtab[j].addr, symtab[j].label);
-}
-
-
-/* D u m p _ s t a c k
- *
- * Dump the stack frame
- */
-void dump_stack(sp)
-struct stackframe_s *sp;
-{
-  char buff[32];
-  unsigned char uc;
-
-  /* Build up the binary PSW representation */
-  uc = (sp->psw >> 8) & 0xff;
-  (void) binary((int) uc, buff);
-  uc = sp->psw & 0xff;
-  buff[9] = '$';
-  (void) binary((int) uc, buff + 10);
-
-  /* Print all the information */
-  printf("Stack Frame:\tPC = %04.4x\t\t   PSW = %s\n",
-         sp->pc, buff);
-  printf("\t\t\t\t\tStatus = ____ ODIT SZ_A _P_C\n");
-
-  printf("  ax bx      cx      dx      di      si\n");
-  printf("  %04.4x\t%04.4x\t%04.4x\t%04.4x\t%04.4x\t%04.4x\n",
-         sp->retreg, sp->bx, sp->cx, sp->dx, sp->di, sp->si);
-  printf("  sp bp      ss\n");
-  printf("  %04.4x\t%04.4x\t%04.4x\n",
-         sp->sp, sp->fp, sp->ss);
-  printf("  cs ds      es\n");
-  printf("  %04.4x\t%04.4x\t%04.4x\n",
-         sp->cs, sp->ds, sp->es);
-
-  /* Store for future reference */
-  stackptr = sp->sp;
-  baseptr = sp->fp;
-  if (dbglvl > 0)
-       printf("\nStack pointer 0x%x, Base pointer 0x%x\n", stackptr, baseptr);
-}
-
-
-/* M a i n
- *
- * Main program
- */
-main(argc, argv)
-int argc;
-char *argv[];
-{
-  int j, fdc, fds;
-  char *cp, corefile[132], symbfile[132];
-  struct proc proc_entry;
-  struct mem_map mp_segs[NR_LOCAL_SEGS];
-
-  /* Initial set up */
-  if ((cp = strrchr(argv[0], '/')) == (char *) NULL)
-       cp = argv[0];
-  else
-       cp++;
-  strncpy(progname, cp, 19);
-  strncpy(corefile, CORE, 131);
-  strncpy(symbfile, AOUT, 131);
-
-  /* Parse arguments */
-  opterr = 0;
-  while ((j = getopt(argc, argv, "c:dps:tx:")) != EOF) {
-       switch (j & 0177) {
-           case 'c':
-               opt_c = TRUE;
-               strncpy(corefile, optarg, 131);
-               break;
-           case 'd':   opt_d = TRUE;   break;
-           case 'p':   opt_p = TRUE;   break;
-           case 's':
-               opt_s = TRUE;
-               strncpy(symbfile, optarg, 131);
-               break;
-           case 't':   opt_t = TRUE;   break;
-           case 'x':
-               dbglvl = atoi(optarg);
-               opt_x = TRUE;
-               break;
-           case '?':
-           default:
-               usage();
-               exit(1);
-               break;
-       }
-  }
-
-  /* We must have a core file */
-  if ((fdc = open(corefile, O_RDONLY)) == -1) {
-       fprintf(stderr, "Cannot open %s\n", corefile);
-       exit(1);
-  }
-
-  /* We'd like an a.out file or a symbol table */
-  if ((fds = open(symbfile, O_RDONLY)) == -1) {
-       if (opt_s)
-               j = FAILED;
-       else {
-               strncpy(symbfile, AOUT, 131);
-               if ((fds = open(symbfile, O_RDONLY)) == -1)
-                       j = FAILED;
-               else
-                       j = read_symbol(fds);
-       }
-  } else
-       j = read_symbol(fds);
-
-  /* Only fatal if we insisted */
-  if (opt_s && j == FAILED) {
-       fprintf(stderr, "Cannot find symbols in %s\n", symbfile);
-       exit(1);
-  }
-
-  /* Read the process table */
-  if (dbglvl > 0) {
-       printf("\n");
-       printf("Size of mproc entry %d\n", NR_LOCAL_SEGS * sizeof(struct mem_map));
-       printf("Size of process table %d\n", sizeof(proc_entry));
-  }
-  if (read(fdc, (char *) mp_segs, sizeof(mp_segs)) != sizeof(mp_segs) ||
-      read(fdc, (char *) &proc_entry,
-        sizeof(struct proc)) != sizeof(struct proc)) {
-       fprintf(stderr, "Cannot open %s\n", corefile);
-       exit(1);
-  }
-
-  /* Do the work */
-#if 0
-  dump_maps(mp_segs);          /* duplicated in the kernel */
-  printf("\n");
-       /* XXX broken */
-  dump_maps(proc_entry.p_map);
-#endif
-  printf("\n");
-  dump_registers(&proc_entry);
-  if (opt_t) {
-       printf("\n");
-       stack_trace(fdc);
-  }
-  if (opt_p) {
-       printf("\n");
-       dump_proc_table(&proc_entry);
-  }
-  if (opt_d) {
-       printf("\n");
-       dump_sym_tab(symtab);
-       dump_all_segs(fdc);
-  }
-
-  /* Wrap up */
-  (void) close(fdc);
-  if (fds != -1) (void) close(fds);
-
-  exit(0);
-  /* NOTREACHED */
-}
-
-
-/* P a r s e _ l i n e
- *
- * Parse a line of the symbol table
- */
-int parse_line(ps)
-char *ps;
-{
-  char c, s[80];
-  int j, k;
-  unsigned int u;
-
-  /* We must have space in the table */
-  if (maxsym == MAXSYM) return(FAILED);
-
-  /* Lines must be a minimum length to contain information */
-  if (strlen(ps) < 8) return(FAILED);
-
-  /* Lines must have a definite structure */
-  if (ps[1] != ' ' || ps[6] != ' ') return(FAILED);
-  for (j = 2; j < 6; j++)
-       if (!isxdigit(ps[j])) return(FAILED);
-  if (sscanf(ps, "%c %x %s", &c, &u, s) != 3) return (FAILED);
-
-  if (dbglvl > 0) printf("Address 0x%04.4x, label %s\n", u, s);
-
-  /* Load the symbol table in sorted order */
-  for (j = 0; j < maxsym; j++) {
-       if (u < symtab[j].addr) {
-               for (k = maxsym; k > j; k--) symtab[k] = symtab[k - 1];
-               break;
-       }
-  }
-  symtab[j].addr = u;
-  strncpy(symtab[j].label, s, SYMLEN);
-  maxsym++;
-
-  return(OK);
-}
-
-
-/* R e a d _ s y m b o l
- *
- * Read the symbol table
- */
-int read_symbol(fd)
-int fd;
-{
-  char sym[80], buff[BUFSIZ];
-  int j, k, m;
-  long int offset;
-  struct exec *ep;
-  struct nlist *np;
-
-  /* We collect only text symbols, since that's all that's needed here */
-
-  /* Initialise the buffer */
-  if ((j = read(fd, buff, BUFSIZ)) == 0 || j == -1) return(FAILED);
-
-  k = maxsym = 0;
-
-  /* Find out what we've got */
-  ep = (struct exec *) buff;
-  np = (struct nlist *) buff;
-  if (BADMAG(*ep)) {
-       /* Must be a separate symbol table */
-       while (TRUE) {
-               if (buff[k] == 'T') {
-                       for (m = 0; m < 78; m++) {
-                               sym[m] = buff[k];
-                               if (++k == j) {
-                                       if ((j = read(fd, buff, BUFSIZ)) == 0 || j == -1)
-                                               break;
-                                       k = 0;
-                               }
-                               if (buff[k] == '\n') break;
-                       }
-                       sym[m + 1] = '\0';
-                       (void) parse_line(sym);
-               }
-               if (++k == j) {
-                       if ((j = read(fd, buff, BUFSIZ)) == 0 || j == -1)
-                               break;
-                       k = 0;
-               }
-       }
-  } else if (ep->a_syms != 0L) {
-       /* There's symbols in them thar hills */
-       offset = 8 * sizeof(long) + ep->a_text + ep->a_data;
-       if (lseek(fd, offset, 0) == -1L) return(FAILED);
-       /* Symbols are in an unsorted list */
-       while (read(fd, buff, sizeof(struct nlist)) == sizeof(struct nlist)) {
-               if (np->n_sclass == (N_TEXT + C_EXT)) { /* external text symbols */
-                       for (j = 0; j < maxsym; j++) {
-                               if (np->n_value < symtab[j].addr) {
-                                       for (k = maxsym; k > j; k--)
-                                               symtab[k] = symtab[k - 1];
-                                       break;
-                               }
-                       }
-                       symtab[j].addr = np->n_value;
-                       strncpy(symtab[j].label, np->n_name, SYMLEN);
-                       if (maxsym++ == MAXSYM) break;
-               }
-       }
-  } else if (opt_s)
-       return(FAILED);
-
-  if (dbglvl > 0) {
-       for (m = 0; m < maxsym; m++) printf("Addr 0x%04.4x, label %s\n",
-                      symtab[m].addr, symtab[m].label);
-       printf("Maxsym %d\n", maxsym);
-  }
-  return(OK);
-}
-
-
-/* S t a c k _ t r a c e
- *
- * Trace back down the stack frames.
- *
- * WARNING: very, very, non-portable code
- */
-void stack_trace(fd)
-int fd;
-{
-  int j;
-  unsigned int framepointer, lastpointer, returnvalue, end;
-  long int offset, bp;
-
-  /* Bp actually gives the offset from the base of the data segment */
-  bp = (long) (NR_LOCAL_SEGS * sizeof(struct mem_map)) + sizeof(struct proc)
-       + lengths[0] + lengths[1] - bases[2];
-  if ((offset = lseek(fd, bp + (long int) baseptr, 0)) == -1L) return;
-  end = (bases[2] + lengths[2] - 1) & 0xffff;
-
-  if (dbglvl > 0)
-       printf("Baseptr %x, End %x, Bp %ld, Offset %ld\n", baseptr, end, bp, offset);
-
-  /* Print the header, then try to backtrace  */
-  printf("Stack back trace:\n\n");
-  printf("Frame address.  Contents.  Return address.");
-  if (maxsym != 0) printf("  Previous label.");
-  printf("\n");
-
-  lastpointer = baseptr;
-  while (TRUE) {
-       /* Read the frame pointer and return address values */
-       if (read(fd, (char *) &framepointer, sizeof(int)) == -1 ||
-           read(fd, (char *) &returnvalue, sizeof(int)) == -1)
-               break;
-
-       /* Look up the return address - ignored if maxsym == 0 */
-       for (j = 0; j < maxsym; j++) {
-               if (symtab[j].addr >= returnvalue) break;
-       }
-       if (j > 0) j--;
-       printf("    0x%04.4x        0x%04.4x      0x%04.4x          %s\n",
-              lastpointer, framepointer, returnvalue,
-              (maxsym == 0) ? "" : symtab[j].label);
-
-       /* If the result is clearly invalid, quit */
-       if (framepointer == 0 || framepointer >= end || framepointer <= lastpointer)
-               break;
-
-       /* Otherwise try to move to the next frame base */
-       lastpointer = framepointer;
-       if ((offset = lseek(fd, bp + (long int) framepointer, 0)) == -1L || offset == 0L)
-               break;
-  }
-}
-
-
-/* U s a g e
- *
- * Usage message
- */
-void usage()
-{
-  fprintf(stderr, "Usage: %s [-dpt] [-c corefile] [-s symbfile]\n", progname);
-}
index c420b7ac18936470ca4e98accf1ff7e41f4ffe1d..48adab6256b35dcec8c95f335b6d5a9e555468c2 100644 (file)
@@ -2,7 +2,6 @@ PROG=   pwdauth
 BINDIR=        /usr/lib
 BINMODE= 4755
 MAN=
-NEED_NBSDLIBC=y
 
 LDADD+=-lcrypt
 
index ab82601a197d31347f6c9279ad8d971fabd5bf03..23c4e66269addc35d3af9bc8be0b674afd6e5ee0 100644 (file)
@@ -454,19 +454,8 @@ fi
 
 blocksizebytes="`expr $blocksize '*' 1024`"
 
-usenewboot=1
 bootsectors=$BOOTXXSECTS
-echo ""
-echo " --- Step 7: Select a boot scheme --------------------------------------"
-echo ""
 
-echo -n "Do you want to use new boot? [Y] "
-read ok
-if [ "$ok" != Y -a "$ok" != y -a "$ok" != "" ]
-then
-       usenewboot=0
-       bootsectors=1
-else
        # check for potential problems with old mbr.
        # space for bootxx has been checked earlier.
        minix_primaries=`echo -n "" | fdisk /dev/$primary | grep "MINIX" | wc -l`
@@ -490,7 +479,6 @@ else
                fi
                rm temp_mbr_netbsd
        fi
-fi
 
 echo "
 You have selected to (re)install MINIX 3 in the partition /dev/$primary.
@@ -503,10 +491,6 @@ The following subpartitions are now being created on /dev/$primary:
                                        # Secondary master bootstrap.
 # New boot doesn't require mbr on pN (bootxx will be there)
 # When necessarily mbr is installed on dN by partition.
-if [ "$usenewboot" = 0 ]
-then
-       installboot_minix -m /dev/$primary /usr/mdec/masterboot >/dev/null || exit
-fi
                                        # Partition the primary.
 partition /dev/$primary $bootsectors 81:${ROOTSECTS}* 81:$homesize 81:0+ > /dev/null || exit
 
@@ -569,8 +553,6 @@ $fshome"
 test -n "$keymap" && cp -p "/usr/lib/keymaps/$keymap.map" /mnt/etc/keymap
 
 # Make bootable.
-if [ "$usenewboot" = 1 ]
-then
        # XXX we have to use "-f" here, because installboot worries about BPB, which
        # we don't have...
        installboot_nbsd -f /dev/$primary /usr/mdec/bootxx_minixfs3 >/dev/null || exit
@@ -583,13 +565,6 @@ timeout=5
 default=2
 END_BOOT_CFG
 umount /dev/$root >/dev/null || exit   # Unmount the new root.
-
-else
-       umount /dev/$root >/dev/null || exit    # Unmount the new root.
-       installboot_minix -d /dev/$root /usr/mdec/bootblock /boot/boot >/dev/null || exit
-       edparams /dev/$root "rootdev=$root; ramimagedev=$root; minix(1,Start MINIX 3) { image=/boot/image_big; boot; }; newminix(2,Start Custom MINIX 3) { unset image; boot }; main() { echo By default, MINIX 3 will automatically load in 3 seconds.; echo Press ESC to enter the monitor for special configuration.; trap 3000 boot; menu; }; save" || exit
-fi
-
 mount /dev/$usr /mnt >/dev/null || exit
 
 pfile="/mnt/src/tools/fdbootparams"
index 634e1bfe86a27e03352bf340582eeafd29badb44..7b28851934ad60379c361d5819cbdbf70acf458f 100644 (file)
@@ -1,7 +1,6 @@
 PROG=  su
 BINMODE= 4755
 MAN=
-NEED_NBSDLIBC=y
 LDADD+=        -lcrypt
 
 
index 0cd1aebcda410247d0420a19acdb852a682e27b1..8f5735212328e9ad52c5646c66fdc7f0b65813ee 100644 (file)
@@ -1,5 +1,3 @@
-NEED_NBSDLIBC= yes
-
 .include <bsd.own.mk>
 
 PROG=  bsdtar
index 73d1566eb48784073d2b7afee8dd2f1eed66a65d..34f79b86393e41d4656376f4b0ef99b6697e055f 100644 (file)
@@ -1,5 +1,4 @@
 PROG=  time
 MAN=
-NEED_NBSDLIBC= yes
 
 .include <bsd.prog.mk>
index 831b767e572f4c201defb27c114d51e6662dd31e..4ec2470bcdee4b304b11fdaa2d90ee1be1509a4b 100644 (file)
@@ -6,6 +6,6 @@ TZDIR=  /usr/share/zoneinfo
 CPPFLAGS+= -DHAVE_ADJTIME=0 -DTZDIR=\"$(TZDIR)\"
 MAN=   zdump.8
 
-.PATH: ${MINIXSRCDIR}/lib/libc/stdtime
+.PATH: ${MINIXSRCDIR}/lib/libc/time
 
 .include <bsd.prog.mk>
index 195edad462de743868e4190236638fe6b48bd9e8..4567846cbae86d40b1c0f196f307302be4dff9fa 100644 (file)
@@ -1,3 +1,27 @@
+20120214:
+       Full switch to clang/ELF. ack is no longer supported.
+
+       clang is the ELF-generating compiler in the base system, gcc is
+       available as a package.
+
+       To boot ELF-format images, either reinstall your whole system,
+       thereby getting the netbsd-based boot loader, or use the boot
+       monitor as documented at
+               http://wiki.minix3.org/en/UsersGuide/BootMonitor
+
+       Single copies of ELF boot files are also stored in /boot on
+       make hdboot as a boot monitor compatability measure. In short,
+       to boot the ELF image in /boot using the boot monitor,
+       do "mb=1" and "kernel=/boot/kernel", then "boot" in the boot
+       monitor.
+
+       Workaround for header file timestamps causing perpetual recompiles:
+       # find /usr/pkg -name '*.h' | xargs touch
+
+       Now that CC is clang instead of ack (cc), the depend files will
+       be out of date, so to make world, do:
+       # make cleandepend clean world
+
 20120213
        Replace VFS with AVFS
 
index 5862b1bcad82a5d28da936923a92fefecfbab9f0..ef189d63e16cebe0ab63ac3307201ee0104556e1 100644 (file)
@@ -1,8 +1,4 @@
-.if ${COMPILER_TYPE} == "gnu"
 CPPFLAGS+= -D_MINIX -D_NETBSD_SOURCE
 LDADD+= -lminlib -lcompat_minix
 DPADD+= ${LIBMINLIB} ${LIBCOMPAT_MINIX}
-.else
-CPPFLAGS+= -D_MINIX -D_POSIX_SOURCE
-.endif
 BINDIR?=/usr/sbin
index e6edd0b2b9eea4097fd6bad0fb76c4811b1e9f97..9f8a7e4317b10e7d81c4c6d0541d8031d2590dab 100644 (file)
@@ -1,9 +1,4 @@
 # The ACPI driver is compilable only with a "gnu" type compiler
-.if ${COMPILER_TYPE} != "gnu"
-CC:=clang
-COMPILER_TYPE:=gnu
-.endif
-
 PROG=  acpi
 
 SRCS= \
index 3484b5b3e9a11092de4ecc18822dbc03dc744d33..d3d9cd8677d41eed077326c1cc087e5a1f64a4f4 100644 (file)
@@ -5,9 +5,7 @@ SRCS=   ahci.c
 DPADD+=        ${LIBBLOCKDRIVER} ${LIBSYS} ${LIBTIMERS} ${LIBMTHREAD}
 LDADD+=        -lblockdriver -lsys -ltimers -lmthread
 
-.if ${COMPILER_TYPE} == "gnu"
 LDADD+=        -lc
-.endif
 
 MAN=
 
index 8ec71301efd2a1903c9ffac4e85b27d989d58ec4..bd8715cfb2a2236010ba9311dd32ba7391016b72 100644 (file)
@@ -10,11 +10,6 @@ LDADD+=      -lblockdriver -lsys -lc
 CPPFLAGS+=     -DDEBUG=0
 
 # The FBD driver requires NetBSD libc.
-.if ${COMPILER_TYPE} != "gnu"
-CC:=clang
-COMPILER_TYPE:=gnu
-.endif
-
 MAN=
 
 BINDIR?= /usr/sbin
index 248848883fe393535585fe3dd5e6453c9342431c..c92c485b96294d905c9051aa55711dae77e33667 100644 (file)
@@ -11,6 +11,6 @@ BINDIR?= /usr/sbin
 INSTALLFLAGS+= -S 8k
 
 CPPFLAGS.memory.c+=    -I${MINIXSRCDIR}
-CPPFLAGS.imgrd.c+=     -I${.CURDIR}/../ramdisk -T /usr/tmp
+CPPFLAGS.imgrd.c+=     -I${.CURDIR}/../ramdisk 
 
 .include <minix.bootprog.mk>
index 016107477266b8d75ae0e76697fce5cb2a052b6c..8585da39648b13e6c8ef280556dd82e00b32a8b6 100644 (file)
@@ -20,10 +20,6 @@ PROTO= proto
 PROTO= proto.small
 .endif
 
-.if ${OBJECT_FMT} == "a.out"
-STRIPFLAG+= -s
-.endif
-
 EXTRA=system.conf master.passwd passwd pwd.db spwd.db rs.single
 
 CPPFLAGS+= -I${MINIXSRCDIR}/servers -I${MINIXSRCDIR}
index c84aacecf52f036ddbd1d0c0cc169ae6d313a2f7..5a00318b07a3bfa56a97d70b839f602414f357e8 100644 (file)
@@ -6,9 +6,6 @@ SRCS=   main.c random.c rijndael_api.c rijndael_alg.c
 
 DPADD+=        ${LIBCHARDRIVER} ${LIBSYS} ${LIBMINIXUTIL}
 LDADD+=        -lchardriver -lsys 
-.if ${COMPILER_TYPE} != "gnu"
-LDADD+= -lminixutil
-.endif
 
 MAN=
 
index 7d488fa0bb489a5293f9bd271933990fd7025b7d..adad27129faefd8ddfc0a6f18ed97e637139593c 100644 (file)
@@ -34,9 +34,6 @@ install:: installpw   # installpw needed to bootstrap pw db
        for u in /usr/ast ~root; do cp ast/.[aepv]* $$u ; done
        @echo "Installing fonts.."
        install -m 644 -o root -g operator fonts/*.fnt /usr/lib/fonts/
-       @echo "Installing /usr/lib/descr.."
-       install -m 644 -o root -g operator descr /usr/lib/
-
 
 installforce:: $(ETC)/rc $(ETC)/rs.inet $(ETC)/rs.single $(ETC)/system.conf $(ETC)/rc.subr.minix $(USRETC)/rc $(USR)/Makefile installpw
 
diff --git a/etc/descr b/etc/descr
deleted file mode 100644 (file)
index cc06757..0000000
--- a/etc/descr
+++ /dev/null
@@ -1,438 +0,0 @@
-# ACD pass description for the ACK compilers.
-#
-# Pre-set variables.
-#   PROGRAM            - Name the compiler driver is called with.
-#   ARCH               - Default target architecture.
-
-# Library directories search path.
-L =    /lib /usr/lib
-
-# ACK Compilers support search path.
-A =    $L $L/ack
-
-# ARCH must be defined.
-ifndef ARCH
-       error "\$ARCH is not predefined"
-
-# Get ARCH from the environment if set.
-import ARCH
-
-# Compiler passes.
-ACK_CPP =      $A/cpp.ansi -I $CPP_F $PREDEF $NOLINENO -I/usr/include.ack
-ACK_CEM =      $A/em_cemcom.ansi -I -L $CPP_F $PREDEF \
-                   -Vw${W}.${W}i${W}.${W}p${P}.${W}f4.${W}s2.2l4.${W}d8.${W}
-ACK_M2 =       $A/em_m2 -I$MOD_INCL -WR \
-                   -Vw${W}.${W}i${W}.${W}p${P}.${W}l4.${W}f4.${W}d8.${W}
-ACK_PC =       $A/em_pc \
-                   -Vw${W}.${W}i${W}.${W}l4.${W}p${P}.${W}f8.${W}S${W}.${W}
-MOD_INCL =     $A/m2 +
-ACK_DECODE =   $A/em_decode
-ACK_ENCODE =   $A/em_encode
-ACK_OPT =      $A/em_opt
-ACK_EGO =      $A/em_ego -P $A/ego -M$EGO_DESCR
-EGO_DESCR =    $A/ego/${ARCH}descr +
-ACK_OPT2 =     $A/em_opt2
-ACK_CG =       $A/$ARCH/cg
-ACK_AS =       $A/$ARCH/as \-
-ACK_LED =      $A/em_led -a0:$W -a1:$W -a2:$W -a3:$W
-ACK_CV =       $A/cv
-ASMCONV =      /usr/bin/asmconv
-AAL =          /usr/bin/aal
-
-# Minix predefined symbols.
-CPP_F =                -D__minix -D__minix3 -D__$ARCH
-
-# Library path.
-LIBPATH = $USERLIBPATH $A/$ARCH
-
-# Default output "model".
-MODEL = -sep
-
-# Floating point is done in software.
-LIBS = -fsoft
-
-# Default optimization level.
-OPT_LEVEL = 1
-
-# Call names.
-if $PROGRAM = acc
-       PROGRAM = cc
-if $PROGRAM = apc
-       PROGRAM = pc
-if $PROGRAM = am2
-       PROGRAM = m2
-if $PROGRAM = kcc
-       PROGRAM = cc
-
-# Default transformation target.
-stop .out
-
-# Select the runtime environment by option or program name.
-arg -.c
-if $PROGRAM = cc
-       ifndef RTSO
-               RTSO = -.c
-       LIBS = $LIBS + -.c
-
-# Omit the runtime startoff, but keep the libraries.
-arg -.o
-       RTSO =
-
-arg -.$any
-       error ".$any: unknown language"
-
-# Select the target architecture.
-arg -m$arch
-       ARCH = $arch
-
-# Preprocessor directives.
-arg -D$name
-arg -D $name
-       CPP_F = $CPP_F -D$name
-arg -U$name
-arg -U $name
-       CPP_F = $CPP_F -U$name
-arg -I$dir
-arg -I $dir
-       CPP_F = $CPP_F -I$dir
-       ACK_M2 = $ACK_M2 -I$dir
-
-# Debugging.
-arg -g                         # Add debugging info.
-       ACK_CEM = $ACK_CEM -g
-       ACK_CG = $ACK_CG -gdb
-
-arg -n                         # Suppress line numbers.
-       ACK_M2 = $ACK_M2 -L
-       ACK_PC = $ACK_PC -L
-arg -a                         # Enable assertions.
-arg -A                         # Enable array bound checks.
-       ACK_M2 = $ACK_M2 $*
-       ACK_PC = $ACK_PC $*
-
-# Language checking.
-arg -w                         # No warnings.
-       ACK_CEM = $ACK_CEM $*
-       ACK_M2 = $ACK_M2 $*
-       ACK_PC = $ACK_PC $*
-
-arg -ws                                # No strict warnings.
-       ACK_CEM = $ACK_CEM -s
-       ACK_M2 = $ACK_M2 -wR
-
-arg -wa                                # No warnings and no strict warnings.
-       ACK_CEM = $ACK_CEM -a
-       ACK_M2 = $ACK_M2 -wR
-
-arg -wo                                # No warnings about old style C.
-       ACK_CPP = $ACK_CPP -o
-       ACK_CEM = $ACK_CEM -o
-       ACK_M2 = $ACK_M2 -wO
-
-arg -3                         # Only accept 3rd generation Modula-2.
-       ACK_M2 = $ACK_M2 $*
-
-arg -_                         # Allow underscores in identifiers.
-       ACK_M2 = $ACK_M2 -U
-       ACK_PC = $ACK_PC -U
-
-arg -w$any
-arg -F
-arg -m
-       # Ignore strange -w flags, and past and present i86 compiler flags.
-
-# Stop suffix.
-arg -c
-       stop .o
-
-arg -c.$stop
-       stop .$stop
-
-arg -E
-       stop .E
-
-arg -P
-       CPP_F = $CPP_F -P
-       stop .i
-
-arg -S
-       stop .s
-
-# Optimization.
-arg -O
-       OPT_LEVEL = 1
-
-arg -OS                                # Optimize for size.
-       ACK_EGO = $ACK_EGO -S
-arg -OT                                # Optimize for time.
-       ACK_EGO = $ACK_EGO -T
-
-arg -O$n
-       numeric $n
-       OPT_LEVEL = $n
-
-# Library search path.
-arg -L$dir
-arg -L $dir
-       USERLIBPATH = $USERLIBPATH $dir/$ARCH $dir
-
-# -llib must be searched in $LIBPATH later.
-arg -l$lib
-arg -l $lib
-       $> = $LIBPATH/lib$lib.a
-
-# Software floating point, hardware floating point, or no floating point.
-arg -f
-arg -fp
-arg -fsoft
-       LIBS = $LIBS + -fsoft
-
-arg -fhard
-       LIBS = $LIBS - -fsoft
-
-arg -fnone
-       LIBS = $LIBS + -fnone
-
-# Output model.
-arg -com
-       MODEL =                 # Common I&D.
-
-arg -sep
-arg -i                         # Separate I&D.
-       MODEL = -sep
-
-arg -r                         # Relocatable object (combined .o)
-       MODEL = -r
-
-# Strip executable.
-arg -s
-       ACK_LED = $ACK_LED -s
-
-# Size of heap+stack.
-arg -stack $size
-       ACK_CV = $ACK_CV -S $size
-
-# Change output file.
-arg -o$out
-arg -o $out
-       OUT = $out
-
-# Complain about just -D, -U, -I, ...
-arg -D; arg -U; arg -I; arg -L; arg -l; arg -o; arg -stack
-       error "argument expected after '$*'"
-
-arg -R$pass-$flag              # The ACK way of passing options to passes.
-arg -Wack-R$pass-$flag         # The ACD way.
-       if $pass = cpp
-               ACK_CPP = $ACK_CPP -$flag
-       if $pass = cem
-               ACK_CEM = $ACK_CEM -$flag
-       if $pass = m2
-               ACK_M2 = $ACK_M2 -$flag
-       if $pass = pc
-               ACK_PC = $ACK_PC -$flag
-       if $pass = opt
-               ACK_OPT = $ACK_OPT -$flag
-       if $pass = ego
-               ACK_EGO = $ACK_EGO -$flag
-       if $pass = opt2
-               ACK_OPT2 = $ACK_OPT2 -$flag
-       if $pass = cg
-               ACK_CG = $ACK_CG -$flag
-       if $pass = as
-               ACK_AS = $ACK_AS -$flag
-       if $pass = led
-               ACK_LED = $ACK_LED -$flag
-
-arg -Was-$dialect              # Default assembly dialect.
-       ASDIALECT = $dialect
-
-arg -W$any
-       # Ignore any other -W options.
-
-# Complain about unknown options, don't give them to the loader.
-arg -$any
-       error "$*: unknown option"
-
-# Do the scanning phase early, we need to know the architecture.
-scan
-
-# The word and pointer sizes of the target.
-if $ARCH = i86
-       W = 2; P = 2
-if $ARCH = i386
-       W = 4; P = 4
-
-ifndef W
-       error "$ARCH: unsupported architecture"
-
-# Optimize -O2 or higher?
-if (0 1 - $OPT_LEVEL) = (0 1)
-       ACK_EGO = $ACK_EGO -O$OPT_LEVEL
-       ACK_OPT = $ACK_OPT -m0  # Leave multiplication optimization to opt2.
-       prefer .m .gk
-
-# Tell cem to reverse bitfields on the i386 to be compatible with gcc.
-if $ARCH = i386
-       ACK_CEM = $ACK_CEM -Vr
-
-# Predefined preprocessor flags.
-PREDEF = -D_EM_WSIZE=$W -D_EM_PSIZE=$P -D_EM_SSIZE=2 -D_EM_LSIZE=4 \
-        -D_EM_FSIZE=4 -D_EM_DSIZE=8 -D__ACK__ -D_ACK
-
-# Preprocess C source.
-transform .c .i
-       $ACK_CPP $* > $>
-
-# Preprocess any type of file and send it to standard output or $OUT.
-transform "" .E
-       if $* = "-"
-               file =          # Standard input.
-       else
-               file = $*
-       ifndef OUT
-               $ACK_CPP $file
-       else
-               $ACK_CPP $file > $OUT
-
-# Compile C source to EM-code.
-transform .c .k
-transform .i .k
-       $ACK_CEM -I/usr/include.ack $* $>
-       ifndef RTSO
-               RTSO = -.c
-       LIBS = $LIBS + -.c
-
-# Compact EM to readable EM.
-transform .k .e
-transform .m .e
-transform .gk .e
-transform .g .e
-       $ACK_DECODE $* > $>
-
-# Readable EM to compact EM.
-transform .e .k
-       ifhash $*
-               NOLINENO = -P   # Encode chokes on cpp line directives.
-               apply .c .i
-               unset NOLINENO
-       $ACK_ENCODE $* > $>
-
-# Peephole optimization.
-transform .k .m
-       $ACK_OPT $* > $>
-
-# Global optimization.
-transform .m .gk
-       $ACK_EGO $* > $>
-
-# Second peephole optimization after global optimization.
-transform .gk .g
-       $ACK_OPT2 $* > $>
-
-# EM-code to target machine assembly.
-transform .m .ack.s
-transform .g .ack.s
-transform .m .s
-transform .g .s
-       if $ARCH = i386
-               $ACK_CG -F__fp_hook $* > $>
-       else
-               $ACK_CG $* > $>
-
-# How to treat plain .s?
-ifndef ASDIALECT
-       transform .s .ack.s
-               $> = $*
-
-# Assembly to object file.
-transform .ack.s .o
-       ifhash $*
-               apply .c .i
-       if $> = $<.o
-               ifdef OUT
-                       $> = $OUT
-       $ACK_AS -o $> $*
-
-# Combine object files and libraries to an executable.
-combine (.o .a) .out
-       if $MODEL = ()
-               model = -b0:0
-       if $MODEL = (-sep)
-               model = -b0:0 -b1:0
-       rtso =
-       if $RTSO = -.c
-               rtso = $A/$ARCH/crtso.o
-       libd = ; libc = ; libfp =
-       if (-.c - $LIBS) = ()
-               libd = $A/$ARCH/libd.a
-               libc = $A/$ARCH/libc.a
-       if (-fsoft - $LIBS) = ()
-               libfp = $A/$ARCH/libfp.a
-       libs = $libd $libc $libfp $A/$ARCH/libe.a
-       ifndef OUT
-               OUT = a.out
-       if (-r - $MODEL) = ()
-               # Combine to an object file.
-               $ACK_LED -r -o $OUT $*
-       else
-               # Combine to an executable.
-               mktemp EXE
-               $ACK_LED $model -o $EXE $rtso $* $libs $A/$ARCH/libend.a
-               $ACK_CV -x -m$ARCH $EXE $OUT
-
-# Add object files to a library.
-combine (.o) .a
-       if $> = $<.a
-               ifdef OUT
-                       $> = $OUT
-       $AAL cr $> $*
-
-# Assembly conversions.
-
-# ACK assembly to ACK Xenix assembly.
-transform .ack.s .ncc.s
-       ifhash $*
-               apply .c .i
-       $ASMCONV -m$ARCH ack ncc $* $>
-
-# ACK assembly to GNU assembly.
-transform .ack.s .gnu.s
-       ifhash $*
-               apply .c .i
-       $ASMCONV -m$ARCH ack gnu $* $>
-
-# ACK Xenix assembly to ACK assembly.
-transform .ncc.s .ack.s
-       ifhash $*
-               apply .c .i
-       $ASMCONV -m$ARCH ncc ack $* $>
-
-# ACK Xenix assembly to GNU assembly.
-transform .ncc.s .gnu.s
-       ifhash $*
-               apply .c .i
-       $ASMCONV -m$ARCH ncc gnu $* $>
-
-# BCC assembly to ACK assembly.
-transform .bas.s .ack.s
-       ifhash $*
-               apply .c .i
-       $ASMCONV -m$ARCH bas ack $* $>
-
-# BCC assembly to ACK Xenix assembly.
-transform .bas.s .ncc.s
-       ifhash $*
-               apply .c .i
-       $ASMCONV -m$ARCH bas ncc $* $>
-
-# BCC assembly to GNU assembly.
-transform .bas.s .gnu.s
-       ifhash $*
-               apply .c .i
-       $ASMCONV -m$ARCH bas gnu $* $>
-
-#ifdef ASDIALECT
-       # Treat plain .s as being in the given dialect.
-       transform .s .$ASDIALECT.s
-               $> = $*
index 03653b63a8047b0e9ded35409114c3cdafc56080..15feb4c7802acecacd45d6c7a58fa49fe5062333 100644 (file)
@@ -7,7 +7,6 @@
 755 root    operator /etc/defaults
 755 root    operator /etc/system.conf.d
 755 root    operator /boot
-755 root    operator /boot/image
 755 root    operator /boot/minix
 555 root    operator /mnt
 555 root    operator /proc
 755 root    operator /usr/pkg/etc
 755 root    operator /usr/pkg/etc/rc.d
 755 root    operator /home
-755 root    operator /usr/include.ack
-755 root    operator /usr/include.ack/i386
-755 root    operator /usr/include.ack/arpa
-755 root    operator /usr/include.ack/minix
-755 root    operator /usr/include.ack/net
-755 root    operator /usr/include.ack/net/gen
-755 root    operator /usr/include.ack/netinet
-755 root    operator /usr/include.ack/sys
-755 root    operator /usr/include.ack/ddekit
-755 root    operator /usr/include.ack/ddekit/minix
 755 root    operator /usr/lib
 755 root    operator /usr/lib/advent
 755 root    operator /usr/lib/cawf
 755 root    operator /usr/lib/dict
-755 root    operator /usr/lib/ego
 755 root    operator /usr/lib/flex
 755 root    operator /usr/lib/fonts
-755 root    operator /usr/lib/i86
 755 root    operator /usr/lib/keymaps
-755 root    operator /usr/lib/m2
 755 root    operator /usr/libexec
 755 root    operator /usr/sbin
 755  root    operator  /usr/man
index e562cf40dfa838322f3fe2e5ac59e6b9b88f9f78..e95fdcda45a1d68cff2d9908e52443e3c3886d24 100644 (file)
@@ -1,32 +1,98 @@
+#      $NetBSD: Makefile,v 1.133 2010/07/31 21:47:53 joerg Exp $
+#      @(#)Makefile    8.2 (Berkeley) 1/4/94
+
 # Doing a make includes builds /usr/include
 
-INCS=  alloca.h a.out.h ar.h assert.h configfile.h ctype.h \
-       dirent.h env.h err.h errno.h fcntl.h fenv.h \
-       float.h fnmatch.h fts.h getopt.h glob.h grp.h ifaddrs.h \
-       inttypes.h libgen.h libutil.h limits.h locale.h \
-       mathconst.h math.h midiparser.h netdb.h pwd.h regex.h \
-       regexp.h setjmp.h sgtty.h signal.h stdarg.h stddef.h \
-       stdint.h stdbool.h stdio.h stdlib.h string.h strings.h sysexits.h \
-       syslog.h tar.h termcap.h time.h timers.h tools.h \
-       ttyent.h ucontext.h unistd.h utime.h utmp.h wchar.h wctype.h \
-       tzfile.h util.h fetch.h mpool.h ndbm.h db.h poll.h resolv.h \
-       memory.h paths.h complex.h
-INCS+= arpa/inet.h arpa/nameser.h
-INCS+= minix/a.out.h minix/cdrom.h minix/compiler-ack.h minix/dirent.h \
-       minix/dl_eth.h minix/md5.h minix/sha1.h minix/sha2.h minix/types.h
-       
-INCS+= net/hton.h net/if.h net/ioctl.h net/netlib.h
-INCS+= net/gen/netdb.h net/gen/resolv.h net/gen/nameser.h
-INCS+= netinet/if_ether.h netinet/in.h netinet/tcp.h
+NOOBJ=         # defined
+
+# Missing: mp.h
+
+.if defined(__MINIX)
+# Avoid installing: kvm.h lwp.h sa.h (latter not installed anyway)
+INCS=  a.out.h aio.h ar.h assert.h atomic.h \
+       bitstring.h bm.h cdbr.h cdbw.h complex.h cpio.h ctype.h \
+       db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \
+       fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \
+       inttypes.h iso646.h langinfo.h libgen.h \
+       limits.h link.h link_aout.h link_elf.h locale.h \
+       login_cap.h malloc.h math.h md2.h \
+       memory.h mntopts.h monetary.h mpool.h mqueue.h \
+       ndbm.h netconfig.h netdb.h netgroup.h nlist.h nl_types.h nsswitch.h \
+       paths.h pwd.h randomid.h ranlib.h re_comp.h regex.h regexp.h \
+       resolv.h res_update.h rmt.h sched.h search.h semaphore.h setjmp.h \
+       sgtty.h signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \
+       strings.h stringlist.h struct.h sysexits.h tar.h time.h \
+       ttyent.h tzfile.h ucontext.h ulimit.h unistd.h util.h utime.h utmp.h \
+       utmpx.h uuid.h varargs.h vis.h wchar.h wctype.h wordexp.h
+
+INCS +=        ufs/chfs/chfs.h ufs/chfs/chfs_args.h ufs/chfs/chfs_inode.h \
+       ufs/chfs/chfs_pool.h ufs/chfs/debug.h ufs/chfs/ebh.h \
+       ufs/chfs/ebh_media.h ufs/chfs/ebh_misc.h ufs/chfs/media.h \
+       ufs/ext2fs/ext2fs.h ufs/ext2fs/ext2fs_dinode.h \
+       ufs/ext2fs/ext2fs_dir.h ufs/ext2fs/ext2fs_extern.h \
+       ufs/ffs/ffs_extern.h ufs/ffs/fs.h ufs/lfs/lfs.h \
+       ufs/lfs/lfs_extern.h ufs/mfs/mfs_extern.h ufs/mfs/mfsnode.h \
+       ufs/ufs/dinode.h ufs/ufs/dir.h ufs/ufs/dirhash.h \
+       ufs/ufs/extattr.h ufs/ufs/inode.h ufs/ufs/quota.h \
+       ufs/ufs/quota1.h ufs/ufs/quota2.h ufs/ufs/ufs_bswap.h \
+       ufs/ufs/ufs_extern.h ufs/ufs/ufs_quota.h ufs/ufs/ufs_wapbl.h \
+       ufs/ufs/ufsmount.h \
+
+.else
+INCS=  a.out.h aio.h ar.h assert.h atomic.h \
+       bitstring.h bm.h cdbr.h cdbw.h complex.h cpio.h ctype.h \
+       db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \
+       fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \
+       inttypes.h iso646.h kvm.h langinfo.h libgen.h \
+       limits.h link.h link_aout.h link_elf.h locale.h \
+       login_cap.h lwp.h malloc.h math.h md2.h \
+       memory.h mntopts.h monetary.h mpool.h mqueue.h \
+       ndbm.h netconfig.h netdb.h netgroup.h nlist.h nl_types.h nsswitch.h \
+       paths.h pwd.h randomid.h ranlib.h re_comp.h regex.h regexp.h \
+       resolv.h res_update.h rmt.h sched.h search.h semaphore.h setjmp.h \
+       sgtty.h signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \
+       strings.h stringlist.h struct.h sysexits.h tar.h time.h \
+       ttyent.h tzfile.h ucontext.h ulimit.h unistd.h util.h utime.h utmp.h \
+       utmpx.h uuid.h varargs.h vis.h wchar.h wctype.h wordexp.h
+.endif
+INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \
+       arpa/telnet.h arpa/tftp.h
+INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \
+       protocols/talkd.h protocols/timed.h
+
+INCS+= hesiod.h
+
+INCS+= rpcsvc/yp_prot.h rpcsvc/ypclnt.h
+
+INCS+=  ssp/ssp.h ssp/stdio.h ssp/string.h ssp/strings.h ssp/unistd.h
+
+.if (${MACHINE_ARCH} != "vax")
+INCS+= ieeefp.h
+.endif
 
 .include <bsd.own.mk>
 
-INCSDIR=        /usr/include.ack
 
-.include "${MINIXSRCDIR}/common/include/Makefile.inc"
-.include "${MINIXSRCDIR}/common/include/Makefile.termios.inc"
+INCSDIR=       /usr/include
+
+.if defined(__MINIX)
+# RPC is not compiled in the libc. This include also needs
+# rpcgen, which can be compiled if needed.
+.else
+SUBDIR=                rpc
+.endif
+.if defined(__MINIX)
+SUBDIR+=       prop
+.else
+SUBDIR+=       ../common/include/prop
+.endif
 
-SUBDIR=                sys arch
+.if defined(__MINIX)
+.include "Makefile.minix.inc"
+SUBDIR+=       arch/${MACHINE}
+SUBDIR+=       arch sys minix
+SUBDIR+=       net netinet netinet6
+.endif
 
 .include <bsd.prog.mk>
 .include <bsd.subdir.mk>
similarity index 98%
rename from common/include/Makefile.inc
rename to include/Makefile.minix.inc
index abb013e9321c07297b9952926c1faf5636ab91ef..a9bd5d6e4225571ae52ce5844fece008f785ff65 100644 (file)
@@ -1,7 +1,5 @@
 .include <bsd.own.mk>
 
-.PATH: ${MINIXSRCDIR}/common/include
-
 INCS+=  env.h fetch.h lib.h libutil.h timers.h
 
 INCS+=         minix/acpi.h minix/ansi.h minix/audio_fw.h minix/bitmap.h \
index b9b8c82aba24110a506e3012a6b2b206189d6e2a..912cc3d9fbcab087d4fac917d83679d596d8f83d 100644 (file)
@@ -1,11 +1,73 @@
-/*
- * this files resolves conflicts between the file of the host system and
- * the minix specific one. This file is included directly only on Minix
- * and it is an error to do so on any other system
+/*     $NetBSD: a.out.h,v 1.20 2009/08/16 17:12:47 pgoyette Exp $      */
+
+/*-
+ * Copyright (c) 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. 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.
+ *
+ *     @(#)a.out.h     8.1 (Berkeley) 6/2/93
+ */
+
+/*-
+ * Copyright (c) 1993 Theo de Raadt.  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.
+ *
+ * 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, PROUREMENT 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.
+ *
+ *     @(#)a.out.h     8.1 (Berkeley) 6/2/93
  */
 
-#if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
-#error "Including Minix specific file in program targeted for other system"
-#else
-#include <minix/a.out.h>
-#endif
+#ifndef        _AOUT_H_
+#define        _AOUT_H_
+
+#ifdef __minix
+#include <compat/a.out.h>
+#else /* !__minix */
+
+#include <sys/exec_aout.h>
+
+#define        _AOUT_INCLUDE_
+#include <nlist.h>
+
+#endif /* !__minix */
+#endif /* !_AOUT_H_ */
similarity index 100%
rename from nbsd_include/aio.h
rename to include/aio.h
diff --git a/include/alloca.h b/include/alloca.h
deleted file mode 100644 (file)
index 9583b85..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*     alloca.h - The dreaded alloca() function.
- */
-
-#ifndef _ALLOCA_H
-#define _ALLOCA_H
-
-#ifndef _TYPES_H
-#include <minix/types.h>
-#endif
-
-#if __GNUC__
-
-/* The compiler recognizes this special keyword, and inlines the code. */
-#define alloca(size)   __builtin_alloca(size)
-
-#endif /* __GCC__ */
-
-#if __ACK__ || __CCC__
-
-_PROTOTYPE(void *alloca, (size_t _size)                                        );
-
-#endif /* __ACK__ || __CCC__ */
-
-#endif /* _ALLOCA_H */
index 9d108587f5ff4fd22d154f7a8d1d2d88ac60feda..d9989a0b87358a65d7c64ea93a8915edb6d856b9 100644 (file)
@@ -1,7 +1,62 @@
+#      $NetBSD: Makefile,v 1.40 2009/12/13 05:01:33 nakayama Exp $
+
+# For now, we install the machine and arch includes, and symlink 'machine'
+# to the location of the machine includes (usually).
+#
+# Eventually, we should install everything.
+
 .include <bsd.own.mk>
 
-SUBDIR= ${ARCH}
+SUBDIR=        ${MACHINE}
+ARCHSUBDIR= ${MACHINE_CPU}
+
+.if ${ARCHSUBDIR} == "mips64"
+ARCHSUBDIR= mips
+.endif
+.if ${ARCHSUBDIR} == "powerpc64"
+ARCHSUBDIR= powerpc
+.endif
+
+.if ${MACHINE} != ${ARCHSUBDIR}
+.if exists(${ARCHSUBDIR})
+SUBDIR+= ${ARCHSUBDIR}
+.endif
+.endif
+.if ${MACHINE} == sparc
+SUBDIR+= sparc64
+.endif
+.if (${MACHINE} == hpcmips || ${MACHINE} == hpcsh)
+SUBDIR+= hpc
+.endif
+.if (${MACHINE} == sun2 || ${MACHINE} == sun3)
+SUBDIR+= sun68k
+.endif
+.if defined(XEN_BUILD)
+SUBDIR+= xen
+.endif
+
+#SUBDIR=acorn26 acorn32 algor alpha amiga amigappc arm arc atari \
+#      bebox \
+#      cats cesfic cobalt \
+#      dreamcast \
+#      evbarm evbmips evbppc evbsh3 ews4800mips\
+#      hp300 hpc hpcarm hpcmips hpcsh \
+#      i386 iyonix \
+#      luna68k \
+#      m68k mac68k macppc mips mipsco mmeye mvme68k \
+#      netwinder news68k newsmips next68k \
+#      ofppc \
+#      pmax powerpc prep \
+#      sandpoint sbmips sgimips sh3 shark sparc sparc64 sun2 sun3 sun68k \
+#      rs6000 \
+#      vax \
+#      x68k x86_64 xen \
+#      zaurus
+
+INCSYMLINKS= ${MACHINE} /usr/include/machine
+
+INCSYMLINKS+= machine/float.h /usr/include/float.h \
+       machine/stdarg.h /usr/include/stdarg.h
 
-INCSYMLINKS= ${MACHINE} /usr/include.ack/machine
 
-.include <bsd.kinc.mk>
+.include <bsd.inc.mk>
index 14128f73d4c7264a2bda01639a4d5567fce01164..4aa9208bf18f504a2ad68da41600fd136b577771 100644 (file)
@@ -1,7 +1,6 @@
-INCSDIR= /usr/include.ack/i386
+#      $NetBSD: Makefile,v 1.38 2009/08/30 02:00:56 dyoung Exp $
 
-INCS+= _align.h asm.h mcontext.h multiboot.h param.h
 
-.include "../../../common/include/arch/i386/Makefile.inc"
+SUBDIR=        include ../x86/include
 
-.include <bsd.kinc.mk>
+.include <bsd.subdir.mk>
diff --git a/include/arch/i386/_align.h b/include/arch/i386/_align.h
deleted file mode 100644 (file)
index 20df0b8..0000000
+++ /dev/null
@@ -1,47 +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.
- * 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: @(#)param.h       5.8 (Berkeley) 6/28/91
- * $FreeBSD$
- */
-
-#ifndef _I386_INCLUDE__ALIGN_H_
-#define        _I386_INCLUDE__ALIGN_H_
-
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...).   The result is unsigned int
- * and must be cast to any desired pointer type.
- */
-#define _ALIGNBYTES    (sizeof(int) - 1)
-#define _ALIGN(p)      (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
-
-#endif /* !_I386_INCLUDE__ALIGN_H_ */
diff --git a/include/arch/i386/asm.h b/include/arch/i386/asm.h
deleted file mode 100644 (file)
index ade9580..0000000
+++ /dev/null
@@ -1,73 +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. 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.
- *
- *     @(#)asm.h       5.5 (Berkeley) 5/7/91
- */
-
-#ifndef _I386_ASM_H_
-#define _I386_ASM_H_
-
-#ifdef __ELF__
-# define _C_LABEL(x)    x
-#else
-# ifdef __STDC__
-#  define _C_LABEL(x)   _ ## x
-# else
-#  define _C_LABEL(x)   _/**/x
-# endif
-#endif
-#define _ASM_LABEL(x)   x
-
-/* allow overriding entrypoint alignment */
-#if !defined(_ALIGN_TEXT)
-# define _ALIGN_TEXT .balign  16
-#endif
-
-#ifdef __ACK__
-#define _ENTRY(x) \
-       .text; _ALIGN_TEXT; .globl x; x:
-#else
-#define _ENTRY(x) \
-       .text; _ALIGN_TEXT; .globl x; .type x,@function; x:
-#endif
-#define _LABEL(x) \
-       .globl x; x:
-
-#define        ENTRY(y)        _ENTRY(_C_LABEL(y))
-#define        NENTRY(y)       _ENTRY(_C_LABEL(y))
-#define        ASENTRY(y)      _ENTRY(_ASM_LABEL(y))
-#define        LABEL(y)        _LABEL(_C_LABEL(y))
-#define        END(y)          .size y, . - y
-
-#define IMPORT(sym)               \
-        .extern _C_LABEL(sym)
-
-#endif /* !_I386_ASM_H_ */
diff --git a/include/arch/i386/mcontext.h b/include/arch/i386/mcontext.h
deleted file mode 100644 (file)
index 312308d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef _MACHINE_MCONTEXT_H
-#define _MACHINE_MCONTEXT_H 1
-
-#include <machine/fpu.h>
-#include <machine/stackframe.h>
-
-#define MCF_MAGIC 0xc0ffee
-
-/* Context to describe processor state */
-typedef struct __mcontext {
-  int mc_magic;  
-  struct stackframe_s mc_p_reg;
-#if (_MINIX_CHIP == _CHIP_INTEL)
-  union fpu_state_u mc_fpu_state;
-#endif
-  short mc_fpu_flags;
-} mcontext_t;
-
-_PROTOTYPE( int setmcontext, (const mcontext_t *mcp)                   );
-_PROTOTYPE( int getmcontext, (mcontext_t *mcp)                         );
-
-#endif /* _MACHINE_MCONTEXT_H */
-
diff --git a/include/arch/i386/param.h b/include/arch/i386/param.h
deleted file mode 100644 (file)
index 7db9727..0000000
+++ /dev/null
@@ -1,110 +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.
- * 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: @(#)param.h       5.8 (Berkeley) 6/28/91
- * $FreeBSD$
- */
-
-#include <machine/_align.h>
-
-#ifndef _I386_INCLUDE_PARAM_H_
-#define        _I386_INCLUDE_PARAM_H_
-
-/*
- * Machine dependent constants for Intel 386.
- */
-
-/*
- * Round p (pointer or byte index) up to a correctly-aligned value
- * for all data types (int, long, ...).   The result is unsigned int
- * and must be cast to any desired pointer type.
- */
-#ifndef _ALIGNBYTES
-#define _ALIGNBYTES    (sizeof(int) - 1)
-#endif
-#ifndef _ALIGN
-#define _ALIGN(p)      (((unsigned)(p) + _ALIGNBYTES) & ~_ALIGNBYTES)
-#endif
-
-#define ALIGNBYTES     _ALIGNBYTES
-#define ALIGN(p)       _ALIGN(p)
-/*
- * ALIGNED_POINTER is a boolean macro that checks whether an address
- * is valid to fetch data elements of type t from on this architecture.
- * This does not reflect the optimal alignment, just the possibility
- * (within reasonable limits).
- */
-#define        ALIGNED_POINTER(p, t)   1
-
-#define PAGE_SHIFT     12              /* LOG2(PAGE_SIZE) */
-#define PAGE_SIZE      (1<<PAGE_SHIFT) /* bytes/page */
-#define PAGE_MASK      (PAGE_SIZE-1)
-#define NPTEPG         (PAGE_SIZE/(sizeof (pt_entry_t)))
-
-#ifdef PAE
-#define NPGPTD         4
-#define PDRSHIFT       21              /* LOG2(NBPDR) */
-#define NPGPTD_SHIFT   9
-#else
-#define NPGPTD         1
-#define PDRSHIFT       22              /* LOG2(NBPDR) */
-#define NPGPTD_SHIFT   10
-#endif
-
-#define NBPTD          (NPGPTD<<PAGE_SHIFT)
-#define NPDEPTD                (NBPTD/(sizeof (pd_entry_t)))
-#define NPDEPG         (PAGE_SIZE/(sizeof (pd_entry_t)))
-#define NBPDR          (1<<PDRSHIFT)   /* bytes/page dir */
-#define PDRMASK                (NBPDR-1)
-
-#define        MAXPAGESIZES    2       /* maximum number of supported page sizes */
-
-/*
- * Mach derived conversion macros
- */
-#define trunc_page(x)          ((x) & ~PAGE_MASK)
-#define round_page(x)          (((x) + PAGE_MASK) & ~PAGE_MASK)
-#define trunc_4mpage(x)                ((x) & ~PDRMASK)
-#define round_4mpage(x)                ((((x)) + PDRMASK) & ~PDRMASK)
-
-#define atop(x)                        ((x) >> PAGE_SHIFT)
-#define ptoa(x)                        ((x) << PAGE_SHIFT)
-
-#define i386_btop(x)           ((x) >> PAGE_SHIFT)
-#define i386_ptob(x)           ((x) << PAGE_SHIFT)
-
-#define        pgtok(x)                ((x) * (PAGE_SIZE / 1024))
-
-#define trunc_page_ps(va, ps)  ((va) & ~(ps - 1))
-#define round_page_ps(va, ps)  (((va) + (ps - 1)) & ~(ps - 1))
-#define _minix_aligned(a, t)   (trunc_page_ps((u_long)(a), sizeof(t)) == (u_long)(a))
-
-#endif /* !_I386_INCLUDE_PARAM_H_ */
similarity index 100%
rename from nbsd_include/arpa/ftp.h
rename to include/arpa/ftp.h
index 21c64f341c83e360e4b6c7b2af3bdc50ea496870..0f2e9f2b1d3d4ed276cde57814af6360c0370864 100644 (file)
+/*     $NetBSD: inet.h,v 1.24 2008/06/21 20:12:49 christos Exp $       */
+
 /*
-arpa/inet.h
-*/
+ * ++Copyright++ 1983, 1993
+ * -
+ * 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. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ * 
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * -
+ * --Copyright--
+ */
 
-#ifndef _ARPA__INET_H
-#define _ARPA__INET_H
+/*%
+ *     @(#)inet.h      8.1 (Berkeley) 6/2/93
+ *     Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp
+ */
 
-#include <stdint.h>
+#ifndef _ARPA_INET_H_
+#define        _ARPA_INET_H_
 
-/* Open Group Base Specifications Issue 6 (not complete): */
+/* External definitions for functions in inet(3) */
 
-#ifndef _IN_ADDR_T
-#define _IN_ADDR_T
-/* Has to match corresponding declaration in <netinet/in.h> */
-typedef uint32_t       in_addr_t;
-#endif /* _IN_ADDR_T */
+#include <sys/ansi.h>
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
 
-#ifndef _STRUCT_IN_ADDR
-#define _STRUCT_IN_ADDR
-/* Has to match corresponding declaration in <netinet/in.h> */
-struct in_addr
-{
-       in_addr_t       s_addr;
-};
-#endif
+#include <netinet/in.h>
 
-_PROTOTYPE( uint32_t htonl, (uint32_t _hostval)                                );
-_PROTOTYPE( uint16_t htons, (uint16_t _hostval)                                );
-_PROTOTYPE( char *inet_ntoa, (struct in_addr _in)                      );
-_PROTOTYPE( uint32_t ntohl, (uint32_t _netval)                         );
-_PROTOTYPE( uint16_t ntohs, (uint16_t _netval)                         );
-_PROTOTYPE( char *inet_ntop, (int af, const void *src, char *dst, 
-                                                       uint32_t size)  );
-_PROTOTYPE( int inet_pton, (int af, const char *src, void *dst)                );
-
-#ifdef _MINIX
-/* Additional functions */
-_PROTOTYPE( int inet_aton, (const char *_cp, struct in_addr *_pin)     );
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+#ifndef socklen_t
+typedef __socklen_t    socklen_t;
+#define socklen_t      __socklen_t
 #endif
+#endif /* _POSIX_C_SOURCE >= 200112 || XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */
 
-#ifdef _POSIX_SOURCE
-in_addr_t inet_addr(const char *cp);
+__BEGIN_DECLS
+in_addr_t       inet_addr(const char *);
+in_addr_t       inet_lnaof(struct in_addr);
+struct in_addr  inet_makeaddr(in_addr_t, in_addr_t);
+in_addr_t       inet_netof(struct in_addr);
+in_addr_t       inet_network(const char *);
+char           *inet_ntoa(struct in_addr);
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+const char     *inet_ntop(int, const void * __restrict,
+                               char * __restrict, socklen_t);
+int             inet_pton(int, const char * __restrict,
+                               void * __restrict);
 #endif
+#if defined(_NETBSD_SOURCE)
+int             inet_aton(const char *, struct in_addr *);
+char *          inet_neta(u_long, char *, size_t);
+char           *inet_net_ntop(int, const void *, int, char *, size_t);
+int             inet_net_pton(int, const char *, void *, size_t);
+char           *inet_cidr_ntop(int, const void *, int, char *, size_t);
+int             inet_cidr_pton(int, const char *, void *, int *);
+u_int           inet_nsap_addr(const char *, u_char *, int);
+char           *inet_nsap_ntoa(int, const u_char *, char *);
+#endif
+__END_DECLS
 
-#endif /* _ARPA__INET_H */
-
+#endif /* _ARPA_INET_H_ */
index c71792e660bf592d00d362e3805f0e505e534f58..1fcdbb9379b1ee8f9d7e9292c7810256ef0e273f 100644 (file)
@@ -1 +1,681 @@
-#include <net/gen/nameser.h>
+/*     $NetBSD: nameser.h,v 1.25 2009/04/12 17:07:34 christos Exp $    */
+
+/*
+ * Portions Copyright (C) 2004, 2005, 2008, 2009  Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (C) 1996-2003  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 1983, 1989, 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. 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: nameser.h,v 1.16 2009/03/03 01:52:48 each Exp
+ */
+
+#ifndef _ARPA_NAMESER_H_
+#define _ARPA_NAMESER_H_
+
+#define BIND_4_COMPAT
+
+#include <sys/param.h>
+#if (!defined(BSD)) || (BSD < 199306)
+# include <sys/bitypes.h>
+#else
+# include <sys/types.h>
+#endif
+#include <sys/cdefs.h>
+
+/*%
+ * Revision information.  This is the release date in YYYYMMDD format.
+ * It can change every day so the right thing to do with it is use it
+ * in preprocessor commands such as "#if (__NAMESER > 19931104)".  Do not
+ * compare for equality; rather, use it to determine whether your libbind.a
+ * contains a new enough lib/nameser/ to support the feature you need.
+ */
+
+#define __NAMESER      20090302        /*%< New interface version stamp. */
+/*
+ * Define constants based on RFC0883, RFC1034, RFC 1035
+ */
+#define NS_PACKETSZ    512     /*%< default UDP packet size */
+#define NS_MAXDNAME    1025    /*%< maximum domain name (presentation format)*/
+#define NS_MAXMSG      65535   /*%< maximum message size */
+#define NS_MAXCDNAME   255     /*%< maximum compressed domain name */
+#define NS_MAXLABEL    63      /*%< maximum length of domain label */
+#define NS_MAXLABELS   128     /*%< theoretical max #/labels per domain name */
+#define NS_MAXNNAME    256     /*%< maximum uncompressed (binary) domain name*/
+#define        NS_MAXPADDR     (sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
+#define NS_HFIXEDSZ    12      /*%< #/bytes of fixed data in header */
+#define NS_QFIXEDSZ    4       /*%< #/bytes of fixed data in query */
+#define NS_RRFIXEDSZ   10      /*%< #/bytes of fixed data in r record */
+#define NS_INT32SZ     4       /*%< #/bytes of data in a uint32_t */
+#define NS_INT16SZ     2       /*%< #/bytes of data in a uint16_t */
+#define NS_INT8SZ      1       /*%< #/bytes of data in a u_int8_t */
+#define NS_INADDRSZ    4       /*%< IPv4 T_A */
+#define NS_IN6ADDRSZ   16      /*%< IPv6 T_AAAA */
+#define NS_CMPRSFLGS   0xc0    /*%< Flag bits indicating name compression. */
+#define NS_DEFAULTPORT 53      /*%< For both TCP and UDP. */
+
+/*
+ * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
+ * in synch with it.
+ */
+typedef enum __ns_sect {
+       ns_s_qd = 0,            /*%< Query: Question. */
+       ns_s_zn = 0,            /*%< Update: Zone. */
+       ns_s_an = 1,            /*%< Query: Answer. */
+       ns_s_pr = 1,            /*%< Update: Prerequisites. */
+       ns_s_ns = 2,            /*%< Query: Name servers. */
+       ns_s_ud = 2,            /*%< Update: Update. */
+       ns_s_ar = 3,            /*%< Query|Update: Additional records. */
+       ns_s_max = 4
+} ns_sect;
+
+/*%
+ * Network name (compressed or not) type.  Equivilent to a pointer when used
+ * in a function prototype.  Can be const'd.
+ */
+typedef u_char ns_nname[NS_MAXNNAME];
+typedef const u_char *ns_nname_ct;
+typedef u_char *ns_nname_t;
+
+struct ns_namemap { ns_nname_ct base; int len; };
+typedef struct ns_namemap *ns_namemap_t;
+typedef const struct ns_namemap *ns_namemap_ct;
+
+/*%
+ * This is a message handle.  It is caller allocated and has no dynamic data.
+ * This structure is intended to be opaque to all but ns_parse.c, thus the
+ * leading _'s on the member names.  Use the accessor functions, not the _'s.
+ */
+typedef struct __ns_msg {
+       const u_char    *_msg, *_eom;
+       uint16_t        _id, _flags, _counts[ns_s_max];
+       const u_char    *_sections[ns_s_max];
+       ns_sect         _sect;
+       int             _rrnum;
+       const u_char    *_msg_ptr;
+} ns_msg;
+
+/*
+ * This is a newmsg handle, used when constructing new messages with
+ * ns_newmsg_init, et al.
+ */
+struct ns_newmsg {
+       ns_msg          msg;
+       const u_char    *dnptrs[25];
+       const u_char    **lastdnptr;
+};
+typedef struct ns_newmsg ns_newmsg;
+
+/* Private data structure - do not use from outside library. */
+struct _ns_flagdata {  int mask, shift;  };
+extern struct _ns_flagdata _ns_flagdata[];
+
+/* Accessor macros - this is part of the public interface. */
+
+#define ns_msg_id(handle) ((handle)._id + 0)
+#define ns_msg_base(handle) ((handle)._msg + 0)
+#define ns_msg_end(handle) ((handle)._eom + 0)
+#define ns_msg_size(handle) ((size_t)((handle)._eom - (handle)._msg))
+#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
+
+/*%
+ * This is a parsed record.  It is caller allocated and has no dynamic data.
+ */
+typedef        struct __ns_rr {
+       char            name[NS_MAXDNAME];
+       uint16_t        type;
+       uint16_t        rr_class;
+       uint32_t        ttl;
+       uint16_t        rdlength;
+       const u_char *  rdata;
+} ns_rr;
+
+/*
+ * Same thing, but using uncompressed network binary names, and real C types.
+ */
+typedef        struct __ns_rr2 {
+       ns_nname        nname;
+       size_t          nnamel;
+       int             type;
+       int             rr_class;
+       u_int           ttl;
+       int             rdlength;
+       const u_char *  rdata;
+} ns_rr2;
+
+/* Accessor macros - this is part of the public interface. */
+#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".")
+#define ns_rr_nname(rr)        ((const ns_nname_t)(rr).nname)
+#define ns_rr_nnamel(rr) ((rr).nnamel + 0)
+#define ns_rr_type(rr) ((ns_type)((rr).type + 0))
+#define ns_rr_class(rr)        ((ns_class)((rr).rr_class + 0))
+#define ns_rr_ttl(rr)  ((u_long)(rr).ttl + 0)
+#define ns_rr_rdlen(rr)        ((size_t)(rr).rdlength + 0)
+#define ns_rr_rdata(rr)        ((rr).rdata + 0)
+
+/*%
+ * These don't have to be in the same order as in the packet flags word,
+ * and they can even overlap in some cases, but they will need to be kept
+ * in synch with ns_parse.c:ns_flagdata[].
+ */
+typedef enum __ns_flag {
+       ns_f_qr,                /*%< Question/Response. */
+       ns_f_opcode,            /*%< Operation code. */
+       ns_f_aa,                /*%< Authoritative Answer. */
+       ns_f_tc,                /*%< Truncation occurred. */
+       ns_f_rd,                /*%< Recursion Desired. */
+       ns_f_ra,                /*%< Recursion Available. */
+       ns_f_z,                 /*%< MBZ. */
+       ns_f_ad,                /*%< Authentic Data (DNSSEC). */
+       ns_f_cd,                /*%< Checking Disabled (DNSSEC). */
+       ns_f_rcode,             /*%< Response code. */
+       ns_f_max
+} ns_flag;
+
+/*%
+ * Currently defined opcodes.
+ */
+typedef enum __ns_opcode {
+       ns_o_query = 0,         /*%< Standard query. */
+       ns_o_iquery = 1,        /*%< Inverse query (deprecated/unsupported). */
+       ns_o_status = 2,        /*%< Name server status query (unsupported). */
+                               /* Opcode 3 is undefined/reserved. */
+       ns_o_notify = 4,        /*%< Zone change notification. */
+       ns_o_update = 5,        /*%< Zone update message. */
+       ns_o_max = 6
+} ns_opcode;
+
+/*%
+ * Currently defined response codes.
+ */
+typedef        enum __ns_rcode {
+       ns_r_noerror = 0,       /*%< No error occurred. */
+       ns_r_formerr = 1,       /*%< Format error. */
+       ns_r_servfail = 2,      /*%< Server failure. */
+       ns_r_nxdomain = 3,      /*%< Name error. */
+       ns_r_notimpl = 4,       /*%< Unimplemented. */
+       ns_r_refused = 5,       /*%< Operation refused. */
+       /* these are for BIND_UPDATE */
+       ns_r_yxdomain = 6,      /*%< Name exists */
+       ns_r_yxrrset = 7,       /*%< RRset exists */
+       ns_r_nxrrset = 8,       /*%< RRset does not exist */
+       ns_r_notauth = 9,       /*%< Not authoritative for zone */
+       ns_r_notzone = 10,      /*%< Zone of record different from zone section */
+       ns_r_max = 11,
+       /* The following are EDNS extended rcodes */
+       ns_r_badvers = 16,
+       /* The following are TSIG errors */
+       ns_r_badsig = 16,
+       ns_r_badkey = 17,
+       ns_r_badtime = 18
+} ns_rcode;
+
+/* BIND_UPDATE */
+typedef enum __ns_update_operation {
+       ns_uop_delete = 0,
+       ns_uop_add = 1,
+       ns_uop_max = 2
+} ns_update_operation;
+
+/*%
+ * This structure is used for TSIG authenticated messages
+ */
+struct ns_tsig_key {
+       char name[NS_MAXDNAME], alg[NS_MAXDNAME];
+       unsigned char *data;
+       int len;
+};
+typedef struct ns_tsig_key ns_tsig_key;
+
+/*%
+ * This structure is used for TSIG authenticated TCP messages
+ */
+struct ns_tcp_tsig_state {
+       int counter;
+       struct dst_key *key;
+       void *ctx;
+       unsigned char sig[NS_PACKETSZ];
+       int siglen;
+};
+typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
+
+#define NS_TSIG_FUDGE 300
+#define NS_TSIG_TCP_COUNT 100
+#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
+
+#define NS_TSIG_ERROR_NO_TSIG -10
+#define NS_TSIG_ERROR_NO_SPACE -11
+#define NS_TSIG_ERROR_FORMERR -12
+
+/*%
+ * Currently defined type values for resources and queries.
+ */
+typedef enum __ns_type {
+       ns_t_invalid = 0,       /*%< Cookie. */
+       ns_t_a = 1,             /*%< Host address. */
+       ns_t_ns = 2,            /*%< Authoritative server. */
+       ns_t_md = 3,            /*%< Mail destination. */
+       ns_t_mf = 4,            /*%< Mail forwarder. */
+       ns_t_cname = 5,         /*%< Canonical name. */
+       ns_t_soa = 6,           /*%< Start of authority zone. */
+       ns_t_mb = 7,            /*%< Mailbox domain name. */
+       ns_t_mg = 8,            /*%< Mail group member. */
+       ns_t_mr = 9,            /*%< Mail rename name. */
+       ns_t_null = 10,         /*%< Null resource record. */
+       ns_t_wks = 11,          /*%< Well known service. */
+       ns_t_ptr = 12,          /*%< Domain name pointer. */
+       ns_t_hinfo = 13,        /*%< Host information. */
+       ns_t_minfo = 14,        /*%< Mailbox information. */
+       ns_t_mx = 15,           /*%< Mail routing information. */
+       ns_t_txt = 16,          /*%< Text strings. */
+       ns_t_rp = 17,           /*%< Responsible person. */
+       ns_t_afsdb = 18,        /*%< AFS cell database. */
+       ns_t_x25 = 19,          /*%< X_25 calling address. */
+       ns_t_isdn = 20,         /*%< ISDN calling address. */
+       ns_t_rt = 21,           /*%< Router. */
+       ns_t_nsap = 22,         /*%< NSAP address. */
+       ns_t_nsap_ptr = 23,     /*%< Reverse NSAP lookup (deprecated). */
+       ns_t_sig = 24,          /*%< Security signature. */
+       ns_t_key = 25,          /*%< Security key. */
+       ns_t_px = 26,           /*%< X.400 mail mapping. */
+       ns_t_gpos = 27,         /*%< Geographical position (withdrawn). */
+       ns_t_aaaa = 28,         /*%< IPv6 Address. */
+       ns_t_loc = 29,          /*%< Location Information. */
+       ns_t_nxt = 30,          /*%< Next domain (security). */
+       ns_t_eid = 31,          /*%< Endpoint identifier. */
+       ns_t_nimloc = 32,       /*%< Nimrod Locator. */
+       ns_t_srv = 33,          /*%< Server Selection. */
+       ns_t_atma = 34,         /*%< ATM Address */
+       ns_t_naptr = 35,        /*%< Naming Authority PoinTeR */
+       ns_t_kx = 36,           /*%< Key Exchange */
+       ns_t_cert = 37,         /*%< Certification record */
+       ns_t_a6 = 38,           /*%< IPv6 address (experimental) */
+       ns_t_dname = 39,        /*%< Non-terminal DNAME */
+       ns_t_sink = 40,         /*%< Kitchen sink (experimentatl) */
+       ns_t_opt = 41,          /*%< EDNS0 option (meta-RR) */
+       ns_t_apl = 42,          /*%< Address prefix list (RFC3123) */
+       ns_t_ds = 43,           /*%< Delegation Signer */
+       ns_t_sshfp = 44,        /*%< SSH Fingerprint */
+       ns_t_ipseckey = 45,     /*%< IPSEC Key */
+       ns_t_rrsig = 46,        /*%< RRset Signature */
+       ns_t_nsec = 47,         /*%< Negative security */
+       ns_t_dnskey = 48,       /*%< DNS Key */
+       ns_t_dhcid = 49,        /*%< Dynamic host configuratin identifier */
+       ns_t_nsec3 = 50,        /*%< Negative security type 3 */
+       ns_t_nsec3param = 51,   /*%< Negative security type 3 parameters */
+       ns_t_hip = 55,          /*%< Host Identity Protocol */
+       ns_t_spf = 99,          /*%< Sender Policy Framework */
+       ns_t_tkey = 249,        /*%< Transaction key */
+       ns_t_tsig = 250,        /*%< Transaction signature. */
+       ns_t_ixfr = 251,        /*%< Incremental zone transfer. */
+       ns_t_axfr = 252,        /*%< Transfer zone of authority. */
+       ns_t_mailb = 253,       /*%< Transfer mailbox records. */
+       ns_t_maila = 254,       /*%< Transfer mail agent records. */
+       ns_t_any = 255,         /*%< Wildcard match. */
+       ns_t_zxfr = 256,        /*%< BIND-specific, nonstandard. */
+       ns_t_dlv = 32769,       /*%< DNSSEC look-aside validatation. */
+       ns_t_max = 65536
+} ns_type;
+
+/* Exclusively a QTYPE? (not also an RTYPE) */
+#define        ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
+                     (t) == ns_t_mailb || (t) == ns_t_maila)
+/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */
+#define        ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
+/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */
+#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
+#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
+#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
+                      (t) == ns_t_zxfr)
+
+/*%
+ * Values for class field
+ */
+typedef enum __ns_class {
+       ns_c_invalid = 0,       /*%< Cookie. */
+       ns_c_in = 1,            /*%< Internet. */
+       ns_c_2 = 2,             /*%< unallocated/unsupported. */
+       ns_c_chaos = 3,         /*%< MIT Chaos-net. */
+       ns_c_hs = 4,            /*%< MIT Hesiod. */
+       /* Query class values which do not appear in resource records */
+       ns_c_none = 254,        /*%< for prereq. sections in update requests */
+       ns_c_any = 255,         /*%< Wildcard match. */
+       ns_c_max = 65536
+} ns_class;
+
+/* DNSSEC constants. */
+
+typedef enum __ns_key_types {
+       ns_kt_rsa = 1,          /*%< key type RSA/MD5 */
+       ns_kt_dh  = 2,          /*%< Diffie Hellman */
+       ns_kt_dsa = 3,          /*%< Digital Signature Standard (MANDATORY) */
+       ns_kt_private = 254     /*%< Private key type starts with OID */
+} ns_key_types;
+
+typedef enum __ns_cert_types {
+       cert_t_pkix = 1,        /*%< PKIX (X.509v3) */
+       cert_t_spki = 2,        /*%< SPKI */
+       cert_t_pgp  = 3,        /*%< PGP */
+       cert_t_url  = 253,      /*%< URL private type */
+       cert_t_oid  = 254       /*%< OID private type */
+} ns_cert_types;
+
+/* Flags field of the KEY RR rdata. */
+#define        NS_KEY_TYPEMASK         0xC000  /*%< Mask for "type" bits */
+#define        NS_KEY_TYPE_AUTH_CONF   0x0000  /*%< Key usable for both */
+#define        NS_KEY_TYPE_CONF_ONLY   0x8000  /*%< Key usable for confidentiality */
+#define        NS_KEY_TYPE_AUTH_ONLY   0x4000  /*%< Key usable for authentication */
+#define        NS_KEY_TYPE_NO_KEY      0xC000  /*%< No key usable for either; no key */
+/* The type bits can also be interpreted independently, as single bits: */
+#define        NS_KEY_NO_AUTH          0x8000  /*%< Key unusable for authentication */
+#define        NS_KEY_NO_CONF          0x4000  /*%< Key unusable for confidentiality */
+#define        NS_KEY_RESERVED2        0x2000  /* Security is *mandatory* if bit=0 */
+#define        NS_KEY_EXTENDED_FLAGS   0x1000  /*%< reserved - must be zero */
+#define        NS_KEY_RESERVED4        0x0800  /*%< reserved - must be zero */
+#define        NS_KEY_RESERVED5        0x0400  /*%< reserved - must be zero */
+#define        NS_KEY_NAME_TYPE        0x0300  /*%< these bits determine the type */
+#define        NS_KEY_NAME_USER        0x0000  /*%< key is assoc. with user */
+#define        NS_KEY_NAME_ENTITY      0x0200  /*%< key is assoc. with entity eg host */
+#define        NS_KEY_NAME_ZONE        0x0100  /*%< key is zone key */
+#define        NS_KEY_NAME_RESERVED    0x0300  /*%< reserved meaning */
+#define        NS_KEY_RESERVED8        0x0080  /*%< reserved - must be zero */
+#define        NS_KEY_RESERVED9        0x0040  /*%< reserved - must be zero */
+#define        NS_KEY_RESERVED10       0x0020  /*%< reserved - must be zero */
+#define        NS_KEY_RESERVED11       0x0010  /*%< reserved - must be zero */
+#define        NS_KEY_SIGNATORYMASK    0x000F  /*%< key can sign RR's of same name */
+#define        NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
+                                 NS_KEY_RESERVED4 | \
+                                 NS_KEY_RESERVED5 | \
+                                 NS_KEY_RESERVED8 | \
+                                 NS_KEY_RESERVED9 | \
+                                 NS_KEY_RESERVED10 | \
+                                 NS_KEY_RESERVED11 )
+#define NS_KEY_RESERVED_BITMASK2 0xFFFF /*%< no bits defined here */
+
+/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
+#define        NS_ALG_MD5RSA           1       /*%< MD5 with RSA */
+#define        NS_ALG_DH               2       /*%< Diffie Hellman KEY */
+#define        NS_ALG_DSA              3       /*%< DSA KEY */
+#define        NS_ALG_DSS              NS_ALG_DSA
+#define        NS_ALG_EXPIRE_ONLY      253     /*%< No alg, no security */
+#define        NS_ALG_PRIVATE_OID      254     /*%< Key begins with OID giving alg */
+
+/* Protocol values  */
+/* value 0 is reserved */
+#define NS_KEY_PROT_TLS         1
+#define NS_KEY_PROT_EMAIL       2
+#define NS_KEY_PROT_DNSSEC      3
+#define NS_KEY_PROT_IPSEC       4
+#define NS_KEY_PROT_ANY                255
+
+/* Signatures */
+#define        NS_MD5RSA_MIN_BITS       512    /*%< Size of a mod or exp in bits */
+#define        NS_MD5RSA_MAX_BITS      4096
+       /* Total of binary mod and exp */
+#define        NS_MD5RSA_MAX_BYTES     ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
+       /* Max length of text sig block */
+#define        NS_MD5RSA_MAX_BASE64    (((NS_MD5RSA_MAX_BYTES+2)/3)*4)
+#define NS_MD5RSA_MIN_SIZE     ((NS_MD5RSA_MIN_BITS+7)/8)
+#define NS_MD5RSA_MAX_SIZE     ((NS_MD5RSA_MAX_BITS+7)/8)
+
+#define NS_DSA_SIG_SIZE         41
+#define NS_DSA_MIN_SIZE         213
+#define NS_DSA_MAX_BYTES        405
+
+/* Offsets into SIG record rdata to find various values */
+#define        NS_SIG_TYPE     0       /*%< Type flags */
+#define        NS_SIG_ALG      2       /*%< Algorithm */
+#define        NS_SIG_LABELS   3       /*%< How many labels in name */
+#define        NS_SIG_OTTL     4       /*%< Original TTL */
+#define        NS_SIG_EXPIR    8       /*%< Expiration time */
+#define        NS_SIG_SIGNED   12      /*%< Signature time */
+#define        NS_SIG_FOOT     16      /*%< Key footprint */
+#define        NS_SIG_SIGNER   18      /*%< Domain name of who signed it */
+
+/* How RR types are represented as bit-flags in NXT records */
+#define        NS_NXT_BITS 8
+#define        NS_NXT_BIT_SET(  n,p) (p[(n)/NS_NXT_BITS] |=  (0x80>>((n)%NS_NXT_BITS)))
+#define        NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
+#define        NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] &   (0x80>>((n)%NS_NXT_BITS)))
+#define NS_NXT_MAX 127
+
+/*%
+ * EDNS0 extended flags and option codes, host order.
+ */
+#define NS_OPT_DNSSEC_OK       0x8000U
+#define NS_OPT_NSID             3
+
+/*%
+ * Inline versions of get/put short/long.  Pointer is advanced.
+ */
+#define NS_GET16(s, cp) do { \
+       const u_char *t_cp = (const u_char *)(cp); \
+       (s) = ((uint16_t)t_cp[0] << 8) \
+           | ((uint16_t)t_cp[1]) \
+           ; \
+       (cp) += NS_INT16SZ; \
+} while (/*CONSTCOND*/0)
+
+#define NS_GET32(l, cp) do { \
+       const u_char *t_cp = (const u_char *)(cp); \
+       (l) = ((uint32_t)t_cp[0] << 24) \
+           | ((uint32_t)t_cp[1] << 16) \
+           | ((uint32_t)t_cp[2] << 8) \
+           | ((uint32_t)t_cp[3]) \
+           ; \
+       (cp) += NS_INT32SZ; \
+} while (/*CONSTCOND*/0)
+
+#define NS_PUT16(s, cp) do { \
+       uint32_t t_s = (uint32_t)(s); \
+       u_char *t_cp = (u_char *)(cp); \
+       *t_cp++ = t_s >> 8; \
+       *t_cp   = t_s; \
+       (cp) += NS_INT16SZ; \
+} while (/*CONSTCOND*/0)
+
+#define NS_PUT32(l, cp) do { \
+       uint32_t t_l = (uint32_t)(l); \
+       u_char *t_cp = (u_char *)(cp); \
+       *t_cp++ = t_l >> 24; \
+       *t_cp++ = t_l >> 16; \
+       *t_cp++ = t_l >> 8; \
+       *t_cp   = t_l; \
+       (cp) += NS_INT32SZ; \
+} while (/*CONSTCOND*/0)
+
+/*%
+ * ANSI C identifier hiding for bind's lib/nameser.
+ */
+#define        ns_msg_getflag          __ns_msg_getflag
+#define ns_get16               __ns_get16
+#define ns_get32               __ns_get32
+#define ns_put16               __ns_put16
+#define ns_put32               __ns_put32
+#define ns_initparse           __ns_initparse
+#define ns_skiprr              __ns_skiprr
+#define ns_parserr             __ns_parserr
+#define ns_parserr2            __ns_parserr2
+#define        ns_sprintrr             __ns_sprintrr
+#define        ns_sprintrrf            __ns_sprintrrf
+#define        ns_format_ttl           __ns_format_ttl
+#define        ns_parse_ttl            __ns_parse_ttl
+#define ns_datetosecs          __ns_datetosecs
+#define        ns_name_ntol            __ns_name_ntol
+#define        ns_name_ntop            __ns_name_ntop
+#define        ns_name_pton            __ns_name_pton
+#define        ns_name_pton2           __ns_name_pton2
+#define        ns_name_unpack          __ns_name_unpack
+#define        ns_name_unpack2         __ns_name_unpack2
+#define        ns_name_pack            __ns_name_pack
+#define        ns_name_compress        __ns_name_compress
+#define        ns_name_uncompress      __ns_name_uncompress
+#define        ns_name_skip            __ns_name_skip
+#define        ns_name_rollback        __ns_name_rollback
+#define        ns_name_length          __ns_name_length
+#define        ns_name_eq              __ns_name_eq
+#define        ns_name_owned           __ns_name_owned
+#define        ns_name_map             __ns_name_map
+#define        ns_name_labels          __ns_name_labels
+#define        ns_sign                 __ns_sign
+#define        ns_sign2                __ns_sign2
+#define        ns_sign_tcp             __ns_sign_tcp
+#define        ns_sign_tcp2            __ns_sign_tcp2
+#define        ns_sign_tcp_init        __ns_sign_tcp_init
+#define ns_find_tsig           __ns_find_tsig
+#define        ns_verify               __ns_verify
+#define        ns_verify_tcp           __ns_verify_tcp
+#define        ns_verify_tcp_init      __ns_verify_tcp_init
+#define        ns_samedomain           __ns_samedomain
+#define        ns_subdomain            __ns_subdomain
+#define        ns_makecanon            __ns_makecanon
+#define        ns_samename             __ns_samename
+#define        ns_newmsg_init          __ns_newmsg_init
+#define        ns_newmsg_copy          __ns_newmsg_copy
+#define        ns_newmsg_id            __ns_newmsg_id
+#define        ns_newmsg_flag          __ns_newmsg_flag
+#define        ns_newmsg_q             __ns_newmsg_q
+#define        ns_newmsg_rr            __ns_newmsg_rr
+#define        ns_newmsg_done          __ns_newmsg_done
+#define        ns_rdata_unpack         __ns_rdata_unpack
+#define        ns_rdata_equal          __ns_rdata_equal
+#define        ns_rdata_refers         __ns_rdata_refers
+
+__BEGIN_DECLS
+int            ns_msg_getflag(ns_msg, int);
+uint16_t       ns_get16(const u_char *);
+uint32_t       ns_get32(const u_char *);
+void           ns_put16(uint16_t, u_char *);
+void           ns_put32(uint32_t, u_char *);
+int            ns_initparse(const u_char *, int, ns_msg *);
+int            ns_skiprr(const u_char *, const u_char *, ns_sect, int);
+int            ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
+int            ns_parserr2(ns_msg *, ns_sect, int, ns_rr2 *);
+int            ns_sprintrr(const ns_msg *, const ns_rr *,
+                                const char *, const char *, char *, size_t);
+int            ns_sprintrrf(const u_char *, size_t, const char *,
+                                 ns_class, ns_type, u_long, const u_char *,
+                                 size_t, const char *, const char *,
+                                 char *, size_t);
+int            ns_format_ttl(u_long, char *, size_t);
+int            ns_parse_ttl(const char *, u_long *);
+uint32_t       ns_datetosecs(const char *cp, int *errp);
+int            ns_name_ntol(const u_char *, u_char *, size_t);
+int            ns_name_ntop(const u_char *, char *, size_t);
+int            ns_name_pton(const char *, u_char *, size_t);
+int            ns_name_pton2(const char *, u_char *, size_t, size_t *);
+int            ns_name_unpack(const u_char *, const u_char *,
+                                   const u_char *, u_char *, size_t);
+int            ns_name_unpack2(const u_char *, const u_char *,
+                                    const u_char *, u_char *, size_t,
+                                    size_t *);
+int            ns_name_pack(const u_char *, u_char *, int,
+                                 const u_char **, const u_char **);
+int            ns_name_uncompress(const u_char *, const u_char *,
+                                       const u_char *, char *, size_t);
+int            ns_name_compress(const char *, u_char *, size_t,
+                                     const u_char **, const u_char **);
+int            ns_name_skip(const u_char **, const u_char *);
+void           ns_name_rollback(const u_char *, const u_char **,
+                                     const u_char **);
+#ifndef __LIBC12_SOURCE__
+int            ns_sign(u_char *, int *, int, int, void *,
+                            const u_char *, int, u_char *, int *, time_t)
+    __RENAME(__ns_sign50);
+int            ns_sign2(u_char *, int *, int, int, void *,
+                             const u_char *, int, u_char *, int *, time_t,
+                             u_char **, u_char **)
+    __RENAME(__ns_sign250);
+#endif
+ssize_t                ns_name_length(ns_nname_ct, size_t);
+int            ns_name_eq(ns_nname_ct, size_t, ns_nname_ct, size_t);
+int            ns_name_owned(ns_namemap_ct, int, ns_namemap_ct, int);
+int            ns_name_map(ns_nname_ct, size_t, ns_namemap_t, int);
+int            ns_name_labels(ns_nname_ct, size_t);
+int            ns_sign_tcp(u_char *, int *, int, int,
+                                ns_tcp_tsig_state *, int);
+int            ns_sign_tcp2(u_char *, int *, int, int,
+                                 ns_tcp_tsig_state *, int,
+                                 u_char **, u_char **);
+int            ns_sign_tcp_init(void *, const u_char *, int,
+                                       ns_tcp_tsig_state *);
+u_char         *ns_find_tsig(u_char *, u_char *);
+#ifndef __LIBC12_SOURCE__
+int            ns_verify(u_char *, int *, void *,
+                              const u_char *, int, u_char *, int *,
+                              time_t *, int)
+    __RENAME(__ns_verify50);
+#endif
+int            ns_verify_tcp(u_char *, int *, ns_tcp_tsig_state *, int);
+int            ns_verify_tcp_init(void *, const u_char *, int,
+                                       ns_tcp_tsig_state *);
+int            ns_samedomain(const char *, const char *);
+int            ns_subdomain(const char *, const char *);
+int            ns_makecanon(const char *, char *, size_t);
+int            ns_samename(const char *, const char *);
+int            ns_newmsg_init(u_char *buffer, size_t bufsiz, ns_newmsg *);
+int            ns_newmsg_copy(ns_newmsg *, ns_msg *);
+void           ns_newmsg_id(ns_newmsg *handle, uint16_t id);
+void           ns_newmsg_flag(ns_newmsg *handle, ns_flag flag, u_int value);
+int            ns_newmsg_q(ns_newmsg *handle, ns_nname_ct qname,
+                           ns_type qtype, ns_class qclass);
+int            ns_newmsg_rr(ns_newmsg *handle, ns_sect sect,
+                            ns_nname_ct name, ns_type type,
+                            ns_class rr_class, uint32_t ttl,
+                            uint16_t rdlen, const u_char *rdata);
+size_t         ns_newmsg_done(ns_newmsg *handle);
+ssize_t                ns_rdata_unpack(const u_char *, const u_char *, ns_type,
+                               const u_char *, size_t, u_char *, size_t);
+int            ns_rdata_equal(ns_type,
+                              const u_char *, size_t,
+                              const u_char *, size_t);
+int            ns_rdata_refers(ns_type,
+                               const u_char *, size_t,
+                               const u_char *);
+__END_DECLS
+
+#ifdef BIND_4_COMPAT
+#include <arpa/nameser_compat.h>
+#endif
+
+#endif /* !_ARPA_NAMESER_H_ */
similarity index 100%
rename from nbsd_include/arpa/tftp.h
rename to include/arpa/tftp.h
index 20445669121d04f424b653d79664051671e7d341..95d30348e829289c2408985dd1ca45d1db29f606 100644 (file)
-/* The <assert.h> header contains a macro called "assert" that allows 
- * programmers to put assertions in the code.  These assertions can be verified
- * at run time.  If an assertion fails, an error message is printed and the
- * program aborts.
- * Assertion checking can be disabled by adding the statement
- *
- *     #define NDEBUG
+/*     $NetBSD: assert.h,v 1.20 2008/11/02 14:27:44 christos Exp $     */
+
+/*-
+ * Copyright (c) 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
  *
- * to the program before the 
+ * 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. 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.
  *
- *     #include <assert.h>
+ * 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.
  *
- * statement.
+ *     @(#)assert.h    8.2 (Berkeley) 1/21/94
  */
 
-#undef assert
+/*
+ * Unlike other ANSI header files, <assert.h> may usefully be included
+ * multiple times, with and without NDEBUG defined.
+ */
 
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/null.h>
 
-#if TIME_ASSERTS
-#define _ASSERT_EVALUATE(st) do { TIME_BLOCK(st); } while(0)
-#else
-#define _ASSERT_EVALUATE(st) do { st } while(0)
-#endif
+#undef assert
 
 #ifdef NDEBUG
-/* Debugging disabled -- do not evaluate assertions. */
-#define assert(expr)  ((void) 0)
-#else
-/* Debugging enabled -- verify assertions at run time. */
-#ifdef _ANSI
-#define        __makestr(x)    # x
-#define        __xstr(x)       __makestr(x)
-
-_PROTOTYPE( void __bad_assertion, (const char *_mess) );
-#define        assert(expr)    do { int _av;   \
-                       _ASSERT_EVALUATE(_av = !!(expr););      \
-                       if(!_av) {      \
-                               __bad_assertion("Assertion \"" #expr "\" failed, file " __xstr(__FILE__) ", line " __xstr(__LINE__) "\n"); \
-                   } } while(0)
+# ifndef __lint__
+#  define assert(e)    (__static_cast(void,0))
+# else /* !__lint__ */
+#  define assert(e)
+# endif /* __lint__ */
+#else /* !NDEBUG */
+# if __STDC__
+#  define assert(e)                                                    \
+       ((e) ? __static_cast(void,0) : __assert13(__FILE__, __LINE__,   \
+                                                 __assert_function__, #e))
+# else /* PCC */
+#  define assert(e)                                                    \
+       ((e) ? __static_cast(void,0) : __assert13(__FILE__, __LINE__,   \
+                                                 __assert_function__, "e"))
+# endif /* !__STDC__ */
+#endif /* NDEBUG */
+
+#undef _DIAGASSERT
+#if !defined(_DIAGNOSTIC)
+# if !defined(__lint__)
+#  define _DIAGASSERT(e) (__static_cast(void,0))
+# else /* !__lint__ */
+#  define _DIAGASSERT(e)
+# endif /* __lint__ */
+#else /* _DIAGNOSTIC */
+# if __STDC__
+#  define _DIAGASSERT(e)                                               \
+       ((e) ? __static_cast(void,0) : __diagassert13(__FILE__, __LINE__, \
+                                                     __assert_function__, #e))
+# else /* !__STDC__ */
+#  define _DIAGASSERT(e)                                               \
+       ((e) ? __static_cast(void,0) : __diagassert13(__FILE__, __LINE__, \
+                                                     __assert_function__, "e"))
+# endif
+#endif /* _DIAGNOSTIC */
+
+
+#if defined(__lint__)
+#define        __assert_function__     (__static_cast(const void *,0))
+#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define        __assert_function__     __func__
+#elif __GNUC_PREREQ__(2, 6)
+#define        __assert_function__     __PRETTY_FUNCTION__
 #else
-#define assert(expr) ((void) ((expr) ? 0 : __assert( __FILE__,  __LINE__)))
-#endif /* _ANSI */
+#define        __assert_function__     (__static_cast(const void *,0))
 #endif
+
+#ifndef __ASSERT_DECLARED
+#define __ASSERT_DECLARED
+__BEGIN_DECLS
+void __assert(const char *, int, const char *);
+void __assert13(const char *, int, const char *, const char *);
+void __diagassert(const char *, int, const char *);
+void __diagassert13(const char *, int, const char *, const char *);
+__END_DECLS
+#endif /* __ASSERT_DECLARED */
similarity index 100%
rename from nbsd_include/atomic.h
rename to include/atomic.h
similarity index 100%
rename from nbsd_include/bitstring.h
rename to include/bitstring.h
similarity index 100%
rename from nbsd_include/bm.h
rename to include/bm.h
similarity index 100%
rename from nbsd_include/cdbr.h
rename to include/cdbr.h
similarity index 100%
rename from nbsd_include/cdbw.h
rename to include/cdbw.h
index a393115e582b6e884cd95d3464058ccb886f7150..332be6f80ac0c724e9165147e96451ceb9b47163 100644 (file)
@@ -1,6 +1,12 @@
-/* $NetBSD: complex.h,v 1.1 2007/08/20 16:01:29 drochner Exp $ */
+/* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */
 
-#if __STDC_VERSION__ >= 199901L
+/*
+ * Written by Matthias Drochner.
+ * Public domain.
+ */
+
+#ifndef        _COMPLEX_H
+#define        _COMPLEX_H
 
 #define complex _Complex
 #define _Complex_I 1.0fi
 
 __BEGIN_DECLS
 
-double creal(double complex);
-double cimag(double complex);
-double complex conj(double complex);
-float crealf(float complex);
-float cimagf(float complex);
-float complex conjf(float complex);
+/* 7.3.5 Trigonometric functions */
+/* 7.3.5.1 The cacos functions */
+double complex cacos(double complex);
+float complex cacosf(float complex);
 
-#ifndef __minix
-#ifndef __LIBM0_SOURCE__
-/* avoid conflict with historical cabs(struct complex) */
-double cabs(double complex) __RENAME(__c99_cabs);
-float cabsf(float complex) __RENAME(__c99_cabsf);
-#endif
-#endif
-double carg(double complex);
-float cargf(float complex);
+/* 7.3.5.2 The casin functions */
+double complex casin(double complex);
+float complex casinf(float complex);
 
-double complex csqrt(double complex);
-double complex cexp(double complex);
-double complex clog(double complex);
-double complex cpow(double complex, double complex);
+/* 7.3.5.1 The catan functions */
+double complex catan(double complex);
+float complex catanf(float complex);
 
-double complex csin(double complex);
+/* 7.3.5.1 The ccos functions */
 double complex ccos(double complex);
+float complex ccosf(float complex);
+
+/* 7.3.5.1 The csin functions */
+double complex csin(double complex);
+float complex csinf(float complex);
+
+/* 7.3.5.1 The ctan functions */
 double complex ctan(double complex);
-double complex csinh(double complex);
-double complex ccosh(double complex);
-double complex ctanh(double complex);
+float complex ctanf(float complex);
 
-double complex casin(double complex);
-double complex cacos(double complex);
-double complex catan(double complex);
-double complex casinh(double complex);
+/* 7.3.6 Hyperbolic functions */
+/* 7.3.6.1 The cacosh functions */
 double complex cacosh(double complex);
+float complex cacoshf(float complex);
+
+/* 7.3.6.2 The casinh functions */
+double complex casinh(double complex);
+float complex casinhf(float complex);
+
+/* 7.3.6.3 The catanh functions */
 double complex catanh(double complex);
+float complex catanhf(float complex);
 
-float complex csqrtf(float complex);
+/* 7.3.6.4 The ccosh functions */
+double complex ccosh(double complex);
+float complex ccoshf(float complex);
+
+/* 7.3.6.5 The csinh functions */
+double complex csinh(double complex);
+float complex csinhf(float complex);
+
+/* 7.3.6.6 The ctanh functions */
+double complex ctanh(double complex);
+float complex ctanhf(float complex);
+
+/* 7.3.7 Exponential and logarithmic functions */
+/* 7.3.7.1 The cexp functions */
+double complex cexp(double complex);
 float complex cexpf(float complex);
+
+/* 7.3.7.2 The clog functions */
+double complex clog(double complex);
 float complex clogf(float complex);
+
+/* 7.3.8 Power and absolute-value functions */
+/* 7.3.8.1 The cabs functions */
+#ifndef __LIBM0_SOURCE__
+/* avoid conflict with historical cabs(struct complex) */
+double cabs(double complex) __RENAME(__c99_cabs);
+float cabsf(float complex) __RENAME(__c99_cabsf);
+#endif
+
+/* 7.3.8.2 The cpow functions */
+double complex cpow(double complex, double complex);
 float complex cpowf(float complex, float complex);
 
-float complex csinf(float complex);
-float complex ccosf(float complex);
-float complex ctanf(float complex);
-float complex csinhf(float complex);
-float complex ccoshf(float complex);
-float complex ctanhf(float complex);
+/* 7.3.8.3 The csqrt functions */
+double complex csqrt(double complex);
+float complex csqrtf(float complex);
 
-float complex casinf(float complex);
-float complex cacosf(float complex);
-float complex catanf(float complex);
-float complex casinhf(float complex);
-float complex cacoshf(float complex);
-float complex catanhf(float complex);
+/* 7.3.9 Manipulation functions */
+/* 7.3.9.1 The carg functions */ 
+double carg(double complex);
+float cargf(float complex);
+
+/* 7.3.9.2 The cimag functions */
+double cimag(double complex);
+float cimagf(float complex);
+long double cimagl(long double complex);
+
+/* 7.3.9.3 The conj functions */
+double complex conj(double complex);
+float complex conjf(float complex);
+long double complex conjl(long double complex);
+
+/* 7.3.9.4 The cproj functions */
+double complex cproj(double complex);
+float complex cprojf(float complex);
+long double complex cprojl(long double complex);
+
+/* 7.3.9.5 The creal functions */
+double creal(double complex);
+float crealf(float complex);
+long double creall(long double complex);
 
 __END_DECLS
-#endif
+
+#endif /* ! _COMPLEX_H */
similarity index 100%
rename from nbsd_include/cpio.h
rename to include/cpio.h
index 7ec581ca722a5e99d50d4e335d4d42a5c2a74ddb..daef1b88f2095e6fb749f45b4cf4324ae8a07a25 100644 (file)
@@ -1,57 +1,77 @@
-/* The <ctype.h> header file defines some macros used to identify characters.
- * It works by using a table stored in chartab.c. When a character is presented
- * to one of these macros, the character is used as an index into the table
- * (__ctype) to retrieve a byte.  The relevant bit is then extracted.
+/*     $NetBSD: ctype.h,v 1.31 2010/06/01 13:52:08 tnozaki Exp $       */
+
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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. 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.
+ *
+ *     @(#)ctype.h     5.3 (Berkeley) 4/3/91
  */
 
-#ifndef _CTYPE_H
-#define _CTYPE_H
-
-#include <minix/ansi.h>
-
-extern char    __ctype[];      /* property array defined in chartab.c */
-
-#define _U             0x01    /* this bit is for upper-case letters [A-Z] */
-#define _L             0x02    /* this bit is for lower-case letters [a-z] */
-#define _N             0x04    /* this bit is for numbers [0-9] */
-#define _S             0x08    /* this bit is for white space \t \n \f etc */
-#define _P             0x10    /* this bit is for punctuation characters */
-#define _C             0x20    /* this bit is for control characters */
-#define _X             0x40    /* this bit is for hex digits [a-f] and [A-F]*/
-
-/* Function Prototypes (have to go before the macros). */
-_PROTOTYPE( int isalnum, (int  _c)  ); /* alphanumeric [a-z], [A-Z], [0-9] */
-_PROTOTYPE( int isalpha, (int  _c)  ); /* alphabetic */
-_PROTOTYPE( int isblank, (int  _c)  ); /* blank space */
-_PROTOTYPE( int iscntrl, (int  _c)  ); /* control characters */
-_PROTOTYPE( int isdigit, (int  _c)  ); /* digit [0-9] */
-_PROTOTYPE( int isgraph, (int  _c)  ); /* graphic character */
-_PROTOTYPE( int islower, (int  _c)  ); /* lower-case letter [a-z] */
-_PROTOTYPE( int isprint, (int  _c)  ); /* printable character */
-_PROTOTYPE( int ispunct, (int  _c)  ); /* punctuation mark */
-_PROTOTYPE( int isspace, (int  _c)  ); /* white space sp, \f, \n, \r, \t, \v*/
-_PROTOTYPE( int isupper, (int  _c)  ); /* upper-case letter [A-Z] */
-_PROTOTYPE( int isxdigit,(int  _c)  ); /* hex digit [0-9], [a-f], [A-F] */
-_PROTOTYPE( int tolower, (int  _c)  ); /* convert to lower-case */
-_PROTOTYPE( int toupper, (int  _c)  ); /* convert to upper-case */
-_PROTOTYPE( int toascii, (int  _c)  ); /* convert to 7-bit ASCII */
-
-/* Macros for identifying character classes. */
-#define isalnum(c)     ((__ctype+1)[(unsigned char)(c)]&(_U|_L|_N))
-#define isalpha(c)     ((__ctype+1)[(unsigned char)(c)]&(_U|_L))
-#define iscntrl(c)     ((__ctype+1)[(unsigned char)(c)]&_C)
-#define isgraph(c)     ((__ctype+1)[(unsigned char)(c)]&(_P|_U|_L|_N))
-#define ispunct(c)     ((__ctype+1)[(unsigned char)(c)]&_P)
-#define isspace(c)     ((__ctype+1)[(unsigned char)(c)]&_S)
-#define isxdigit(c)    ((__ctype+1)[(unsigned char)(c)]&(_N|_X))
-
-#define isdigit(c)     ((unsigned) ((c)-'0') < 10)
-#define islower(c)     ((unsigned) ((c)-'a') < 26)
-#define isupper(c)     ((unsigned) ((c)-'A') < 26)
-#define isprint(c)     ((unsigned) ((c)-' ') < 95)
-#define isascii(c)     ((unsigned) (c) < 128)
-#define isblank(c)     ((c) == ' ' || (c) == '\t')
-
-#define toascii(c)     ((c) & 0x7f)
-
-#endif /* _CTYPE_H */
+#ifndef _CTYPE_H_
+#define _CTYPE_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+__BEGIN_DECLS
+int    isalnum(int);
+int    isalpha(int);
+int    iscntrl(int);
+int    isdigit(int);
+int    isgraph(int);
+int    islower(int);
+int    isprint(int);
+int    ispunct(int);
+int    isspace(int);
+int    isupper(int);
+int    isxdigit(int);
+int    tolower(int);
+int    toupper(int);
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+int    isascii(int);
+int    toascii(int);
+int    _tolower(int);
+int    _toupper(int);
+#endif
+
+#if defined(_ISOC99_SOURCE) || (_POSIX_C_SOURCE - 0) > 200112L || \
+    (_XOPEN_SOURCE - 0) > 600 || defined(_NETBSD_SOURCE)
+int    isblank(int);
+#endif
+__END_DECLS
+
+#if defined(_NETBSD_SOURCE) && !defined(_CTYPE_NOINLINE)
+#include <sys/ctype_inline.h>
+#endif
+
+#endif /* !_CTYPE_H_ */
index 7fbc788369f225ab4f7b699dfa0e750b048e6f6d..6e2fb7da316f9229c2ccef691c045df4cef3ec88 100644 (file)
 
 #include <sys/types.h>
 #include <sys/cdefs.h>
-#include <assert.h>
 
 #include <limits.h>
 
-#include <stdint.h>
-
 #define        RET_ERROR       -1              /* Return values. */
 #define        RET_SUCCESS      0
 #define        RET_SPECIAL      1
@@ -217,20 +214,8 @@ DB *dbopen(const char *, int, mode_t, DBTYPE, const void *);
 
 #ifdef __DBINTERFACE_PRIVATE
 
-#ifndef __minix
 #define _DBMASK(a) (~((1ULL << (sizeof(a) * NBBY)) - 1))
-#define _DBFIT(a, t) assert(((a) & _DBMASK(t)) == 0)
-#else
-#define NBBY 8
-#define _DBMASK(a) (~((1UL << (sizeof(a) * NBBY)) - 1))
-/* When compiled with ack, 1 << 32 does not evalute to 0.
- * So we need a seperate check for the case when sizeof(t)
- * is 4. 
- */
-#define _DBMASK32 0xffffffff
-#define _DBFIT(a, t) \
-       assert((sizeof(t) == 4) ||((sizeof(t) < 4) && (((a) & _DBMASK(t)) == 0)))
-#endif
+#define _DBFIT(a, t) _DIAGASSERT(((a) & _DBMASK(t)) == 0)
 
 DB     *__bt_open(const char *, int, mode_t, const BTREEINFO *, int);
 DB     *__hash_open(const char *, int, mode_t, const HASHINFO *, int);
index 6bec9d7fa847ecc8ccd9f72bd78dd9ba0fd3cbab..f1c2ae3251d6c6f2998e403374c5fbddf1374ac1 100644 (file)
+/*     $NetBSD: dirent.h,v 1.34 2010/09/26 02:26:59 yamt Exp $ */
+
+/*-
+ * Copyright (c) 1989, 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. 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.
+ *
+ *     @(#)dirent.h    8.2 (Berkeley) 7/28/94
+ */
+
+#ifndef _DIRENT_H_
+#define _DIRENT_H_
+
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
 /*
- * this files resolves conflicts between the file of the host system and
- * the minix specific one. This file is included directly only on Minix
- * and it is an error to do so on any other system
+ * The kernel defines the format of directory entries returned by 
+ * the getdents(2) system call.
  */
+#include <sys/dirent.h>
 
-#if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
-#error "Including Minix specific file in program targeted for other system"
-#else
-#include <minix/dirent.h>
+#ifndef __minix
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define        d_ino           d_fileno        /* backward compatibility */
 #endif
+#endif /* !__minix */
+
+typedef struct _dirdesc DIR;
+
+#if defined(_NETBSD_SOURCE)
+
+/* definitions for library routines operating on directories. */
+#define        DIRBLKSIZ       1024
+
+/* structure describing an open directory. */
+struct _dirdesc {
+       int     dd_fd;          /* file descriptor associated with directory */
+       long    dd_loc;         /* offset in current buffer */
+       long    dd_size;        /* amount of data returned by getdents */
+       char    *dd_buf;        /* data buffer */
+       int     dd_len;         /* size of data buffer */
+       off_t   dd_seek;        /* magic cookie returned by getdents */
+       void    *dd_internal;   /* state for seekdir/telldir */
+       int     dd_flags;       /* flags for readdir */
+       void    *dd_lock;       /* lock for concurrent access */
+};
+
+#define        dirfd(dirp)     ((dirp)->dd_fd)
+
+/* flags for __opendir2() */
+#define DTF_HIDEW      0x0001  /* hide whiteout entries */
+#define DTF_NODUP      0x0002  /* don't return duplicate names */
+#define DTF_REWIND     0x0004  /* rewind after reading union stack */
+#define __DTF_READALL  0x0008  /* everything has been read */
+#define __DTF_RETRY_ON_BADCOOKIE 0x0001        /* retry on EINVAL
+                                       (only valid with __DTF_READALL) */
+
+#include <sys/null.h>
+
+#endif
+
+#ifndef _KERNEL
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int closedir(DIR *);
+void rewinddir(DIR *);
+#ifndef __LIBC12_SOURCE__
+DIR *opendir(const char *) __RENAME(__opendir30);
+struct dirent *readdir(DIR *) __RENAME(__readdir30);
+int readdir_r(DIR * __restrict, struct dirent * __restrict,
+    struct dirent ** __restrict) __RENAME(__readdir_r30);
+#endif
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+void seekdir(DIR *, long);
+long telldir(DIR *);
+#endif /* defined(_NETBSD_SOURCE) || defined(_XOPEN_SOURCE) */
+#if defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+DIR *fdopendir(int);
+DIR *__opendir2(const char *, int) __RENAME(__opendir230);
+int scandir(const char *, struct dirent ***,
+    int (*)(const struct dirent *), int (*)(const void *, const void *))
+    __RENAME(__scandir30);
+int getdents(int, char *, size_t) __RENAME(__getdents30);
+int alphasort(const void *, const void *) __RENAME(__alphasort30);
+#endif
+#endif /* defined(_NETBSD_SOURCE) */
+__END_DECLS
+
+#endif /* !_KERNEL */
+
+#endif /* !_DIRENT_H_ */
similarity index 100%
rename from nbsd_include/disktab.h
rename to include/disktab.h
similarity index 100%
rename from nbsd_include/dlfcn.h
rename to include/dlfcn.h
similarity index 100%
rename from common/include/env.h
rename to include/env.h
index 3e7a44e6db95f130e2e9b4e11fb7c77234048fee..b29a9713d3c044414bb6f437eb8cab52e7413e35 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: err.h,v 1.14 2005/02/03 04:39:32 perry Exp $   */
+/*     $NetBSD: err.h,v 1.15 2010/02/25 18:37:12 joerg Exp $   */
 
 /*-
  * Copyright (c) 1993
  * for utilities to have to include one of them to include err.h, so we get
  * _BSD_VA_LIST_ from <machine/ansi.h> and use it.
  */
-#ifdef __minix
-#include <minix/ansi.h>
-#else
 #include <machine/ansi.h>
-#endif
 #include <sys/cdefs.h>
 
 __BEGIN_DECLS
 __dead void    err(int, const char *, ...)
-                   __attribute__((__noreturn__, __format__(__printf__, 2, 3)));
+                    __printflike(2, 3) __dead;
 __dead void    verr(int, const char *, _BSD_VA_LIST_)
-                   __attribute__((__noreturn__, __format__(__printf__, 2, 0)));
+                   __printflike(2, 0) __dead;
 __dead void    errx(int, const char *, ...)
-                   __attribute__((__noreturn__, __format__(__printf__, 2, 3)));
+                    __printflike(2, 3) __dead;
 __dead void    verrx(int, const char *, _BSD_VA_LIST_)
-                   __attribute__((__noreturn__, __format__(__printf__, 2, 0)));
+                   __printflike(2, 0) __dead;
 void           warn(const char *, ...)
-                   __attribute__((__format__(__printf__, 1, 2)));
+                   __printflike(1, 2);
 void           vwarn(const char *, _BSD_VA_LIST_)
-                   __attribute__((__format__(__printf__, 1, 0)));
+                   __printflike(1, 0);
 void           warnx(const char *, ...)
-                   __attribute__((__format__(__printf__, 1, 2)));
+                   __printflike(1, 2);
 void           vwarnx(const char *, _BSD_VA_LIST_)
-                   __attribute__((__format__(__printf__, 1, 0)));
+                   __printflike(1, 0);
 __END_DECLS
 
 #endif /* !_ERR_H_ */
index 4985335ec6d6e7f2840246c1e219e0d8b20817d2..d343d636d95454df3dfbecfb5925349d03746493 100644 (file)
-/* The <errno.h> header defines the numbers of the various errors that can
- * occur during program execution.  They are visible to user programs and 
- * should be small positive integers.  However, they are also used within 
- * MINIX, where they must be negative.  For example, the READ system call is 
- * executed internally by calling do_read().  This function returns either a 
- * (negative) error number or a (positive) number of bytes actually read.
+/*     $NetBSD: errno.h,v 1.11 2008/03/03 06:57:48 dholland Exp $      */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
  *
- * To solve the problem of having the error numbers be negative inside the
- * the system and positive outside, the following mechanism is used.  All the
- * definitions are are the form:
+ * 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. 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.
  *
- *     #define EPERM           (_SIGN 1)
+ * 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.
  *
- * If the macro _SYSTEM is defined, then  _SIGN is set to "-", otherwise it is
- * set to "".  Thus when compiling the operating system, the  macro _SYSTEM
- * will be defined, setting EPERM to (- 1), whereas when when this
- * file is included in an ordinary user program, EPERM has the value ( 1).
+ *     from: @(#)errno.h       8.5 (Berkeley) 1/21/94
  */
 
-#ifndef _ERRNO_H               /* check if <errno.h> is already included */
-#define _ERRNO_H               /* it is not included; note that fact */
-
-/* Now define _SIGN as "" or "-" depending on _SYSTEM. */
-#ifdef _SYSTEM
-#   define _SIGN         -
-#   define OK            0
-#else
-#   define _SIGN         
-#endif
-
-extern int errno;                /* place where the error numbers go */
-
-/* Here are the numerical values of the error numbers. */
-#define _NERROR               70  /* number of errors */  
+#ifndef _ERRNO_H_
+#define _ERRNO_H_
 
-#define EGENERIC      (_SIGN 99)  /* generic error */
-#define EPERM         (_SIGN  1)  /* operation not permitted */
-#define ENOENT        (_SIGN  2)  /* no such file or directory */
-#define ESRCH         (_SIGN  3)  /* no such process */
-#define EINTR         (_SIGN  4)  /* interrupted function call */
-#define EIO           (_SIGN  5)  /* input/output error */
-#define ENXIO         (_SIGN  6)  /* no such device or address */
-#define E2BIG         (_SIGN  7)  /* arg list too long */
-#define ENOEXEC       (_SIGN  8)  /* exec format error */
-#define EBADF         (_SIGN  9)  /* bad file descriptor */
-#define ECHILD        (_SIGN 10)  /* no child process */
-#define EAGAIN        (_SIGN 11)  /* resource temporarily unavailable */
-#define ENOMEM        (_SIGN 12)  /* not enough space */
-#define EACCES        (_SIGN 13)  /* permission denied */
-#define EFAULT        (_SIGN 14)  /* bad address */
-#define ENOTBLK       (_SIGN 15)  /* Extension: not a block special file */
-#define EBUSY         (_SIGN 16)  /* resource busy */
-#define EEXIST        (_SIGN 17)  /* file exists */
-#define EXDEV         (_SIGN 18)  /* improper link */
-#define ENODEV        (_SIGN 19)  /* no such device */
-#define ENOTDIR       (_SIGN 20)  /* not a directory */
-#define EISDIR        (_SIGN 21)  /* is a directory */
-#define EINVAL        (_SIGN 22)  /* invalid argument */
-#define ENFILE        (_SIGN 23)  /* too many open files in system */
-#define EMFILE        (_SIGN 24)  /* too many open files */
-#define ENOTTY        (_SIGN 25)  /* inappropriate I/O control operation */
-#define ETXTBSY       (_SIGN 26)  /* no longer used */
-#define EFBIG         (_SIGN 27)  /* file too large */
-#define ENOSPC        (_SIGN 28)  /* no space left on device */
-#define ESPIPE        (_SIGN 29)  /* invalid seek */
-#define EROFS         (_SIGN 30)  /* read-only file system */
-#define EMLINK        (_SIGN 31)  /* too many links */
-#define EPIPE         (_SIGN 32)  /* broken pipe */
-#define EDOM          (_SIGN 33)  /* domain error      (from ANSI C std) */
-#define ERANGE        (_SIGN 34)  /* result too large  (from ANSI C std) */
-#define EDEADLK       (_SIGN 35)  /* resource deadlock avoided */
-#define ENAMETOOLONG  (_SIGN 36)  /* file name too long */
-#define ENOLCK        (_SIGN 37)  /* no locks available */
-#define ENOSYS        (_SIGN 38)  /* function not implemented */
-#define ENOTEMPTY     (_SIGN 39)  /* directory not empty */
-#define ELOOP         (_SIGN 40)  /* too many levels of symlinks detected */
-#define ERESTART      (_SIGN 41)  /* service restarted */
-#define EIDRM         (_SIGN 43)  /* Identifier removed */
-#define EILSEQ        (_SIGN 44)  /* illegal byte sequence */
-#define EFTYPE        (_SIGN 45)  /* wrong file format or type */
-#define EOVERFLOW     (_SIGN 46)  /* value too large to store in data type */
+#include <sys/cdefs.h>
+#include <sys/errno.h>
+#include <sys/featuretest.h>
 
-/* The following errors relate to networking. */
-#define EPACKSIZE     (_SIGN 50)  /* invalid packet size for some protocol */
-#define ENOBUFS       (_SIGN 51)  /* not enough buffers left */
-#define EBADIOCTL     (_SIGN 52)  /* illegal ioctl for device */
-#define EBADMODE      (_SIGN 53)  /* badmode in ioctl */
-#define EWOULDBLOCK   (_SIGN 54)  /* call would block on nonblocking socket */
-#define ENETUNREACH   (_SIGN 55)  /* network unreachable */
-#define EHOSTUNREACH  (_SIGN 56)  /* host unreachable */
-#define EISCONN              (_SIGN 57)  /* already connected */
-#define EADDRINUSE    (_SIGN 58)  /* address in use */
-#define ECONNREFUSED  (_SIGN 59)  /* connection refused */
-#define ECONNRESET    (_SIGN 60)  /* connection reset */
-#define ETIMEDOUT     (_SIGN 61)  /* connection timed out */
-#define EURG         (_SIGN 62)  /* urgent data present */
-#define ENOURG       (_SIGN 63)  /* no urgent data present */
-#define ENOTCONN      (_SIGN 64)  /* no connection (yet or anymore) */
-#define ESHUTDOWN     (_SIGN 65)  /* a write call to a shutdown connection */
-#define ENOCONN       (_SIGN 66)  /* no such connection */
-#define EAFNOSUPPORT  (_SIGN 67)  /* address family not supported */
-#define EPROTONOSUPPORT (_SIGN 68) /* protocol not supported by AF */
-#define EPROTOTYPE    (_SIGN 69)  /* Protocol wrong type for socket */
-#define EINPROGRESS   (_SIGN 70)  /* Operation now in progress */
-#define EADDRNOTAVAIL (_SIGN 71)  /* Can't assign requested address */
-#define EALREADY      (_SIGN 72)  /* Connection already in progress */
-#define EMSGSIZE      (_SIGN 73)  /* Message too long */
-#define ENOTSOCK      (_SIGN 74)  /* Socket operation on non-socket */
-#define ENOPROTOOPT   (_SIGN 75)  /* Protocol not available */
-#define EOPNOTSUPP    (_SIGN 76)  /* Operation not supported */
-#define ENOTSUP       EOPNOTSUPP  /* Not supported */
-#define ENETDOWN      (_SIGN 77)  /* network is down */
-#define EPFNOSUPPORT  (_SIGN 78)  /* Protocol family not supported */
-#define EDESTADDRREQ  (_SIGN 79)  /* Destination address required */
-#define EHOSTDOWN     (_SIGN 80)  /* Host down */
+__BEGIN_DECLS
 
-/* The following are not POSIX errors, but they can still happen. 
- * All of these are generated by the kernel and relate to message passing.
- */
-#define ELOCKED      (_SIGN 101)  /* can't send message due to deadlock */
-#define EBADCALL     (_SIGN 102)  /* illegal system call number */
-#define ECALLDENIED  (_SIGN 104)  /* no permission for system call */
-#define EDEADSRCDST  (_SIGN 105)  /* source or destination is not alive */
-#define ENOTREADY    (_SIGN 106)  /* source or destination is not ready */
-#define EBADREQUEST  (_SIGN 107)  /* destination cannot handle request */
-#define ETRAPDENIED  (_SIGN 110)  /* IPC trap not allowed */
-#define EDONTREPLY   (_SIGN 201)  /* pseudo-code: don't send a reply */
+/* note: this appears in both errno.h and signal.h */
+#ifndef __errno
+int *__errno(void);
+#define __errno __errno
+#endif
 
-/* The following are non-POSIX server responses */
-#define EBADEPT      (_SIGN 301)  /* specified endpoint is bad */
-#define EDEADEPT     (_SIGN 302)  /* specified endpoint is not alive */
+#ifndef errno
+#define errno (*__errno())
+#endif
 
-#define EBADCPU                (_SIGN 1000) /* requested CPU does not work */
+#if defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+extern const int sys_nerr __RENAME(__sys_nerr14);
+extern const char *const *sys_errlist __RENAME(__sys_errlist14);
+#endif
+#endif
+__END_DECLS
 
-#endif /* _ERRNO_H */
+#endif /* !_ERRNO_H_ */
diff --git a/include/fcntl.h b/include/fcntl.h
deleted file mode 100644 (file)
index b9e3ef2..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/* The <fcntl.h> header is needed by the open() and fcntl() system calls,
- * which  have a variety of parameters and flags.  They are described here.  
- * The formats of the calls to each of these are:
- *
- *     open(path, oflag [,mode])       open a file
- *     fcntl(fd, cmd [,arg])           get or set file attributes
- * 
- */
-
-#ifndef _FCNTL_H
-#define _FCNTL_H
-
-#ifndef _TYPES_H
-#include <minix/types.h>
-#endif
-
-/* These values are used for cmd in fcntl().  POSIX Table 6-1.  */
-#define F_DUPFD            0   /* duplicate file descriptor */
-#define F_GETFD                   1    /* get file descriptor flags */
-#define F_SETFD            2   /* set file descriptor flags */
-#define F_GETFL            3   /* get file status flags */
-#define F_SETFL            4   /* set file status flags */
-#define F_GETLK            5   /* get record locking information */
-#define F_SETLK            6   /* set record locking information */
-#define F_SETLKW           7   /* set record locking info; wait if blocked */
-#define F_FREESP           8   /* free a section of a regular file */
-
-/* File descriptor flags used for fcntl().  POSIX Table 6-2. */
-#define FD_CLOEXEC         1   /* close on exec flag for third arg of fcntl */
-
-/* L_type values for record locking with fcntl().  POSIX Table 6-3. */
-#define F_RDLCK            1   /* shared or read lock */
-#define F_WRLCK            2   /* exclusive or write lock */
-#define F_UNLCK            3   /* unlock */
-
-/* Oflag values for open().  POSIX Table 6-4. */
-#define O_CREAT        00100   /* creat file if it doesn't exist */
-#define O_EXCL         00200   /* exclusive use flag */
-#define O_NOCTTY       00400   /* do not assign a controlling terminal */
-#define O_TRUNC        01000   /* truncate flag */
-
-/* File status flags for open() and fcntl().  POSIX Table 6-5. */
-#define O_APPEND       02000   /* set append mode */
-#define O_NONBLOCK     04000   /* no delay */
-#define O_REOPEN      010000   /* automatically re-open device after driver
-                                * restart
-                                */
-
-/* File access modes for open() and fcntl().  POSIX Table 6-6. */
-#define O_RDONLY           0   /* open(name, O_RDONLY) opens read only */
-#define O_WRONLY           1   /* open(name, O_WRONLY) opens write only */
-#define O_RDWR             2   /* open(name, O_RDWR) opens read/write */
-
-/* Mask for use with file access modes.  POSIX Table 6-7. */
-#define O_ACCMODE         03   /* mask for file access modes */
-
-/* Struct used for locking.  POSIX Table 6-8. */
-struct flock {
-  short l_type;                        /* type: F_RDLCK, F_WRLCK, or F_UNLCK */
-  short l_whence;              /* flag for starting offset */
-  off_t l_start;               /* relative offset in bytes */
-  off_t l_len;                 /* size; if 0, then until EOF */
-  pid_t l_pid;                 /* process id of the locks' owner */
-};
-
-/* Function Prototypes. */
-_PROTOTYPE( int creat, (const char *_path, mode_t _mode)               );
-_PROTOTYPE( int fcntl, (int _filedes, int _cmd, ...)                   );
-_PROTOTYPE( int open,  (const char *_path, int _oflag, ...)            );
-
-/* For locking files. */
-#define LOCK_SH                F_RDLCK         /* Shared lock */
-#define LOCK_EX                F_WRLCK         /* Exclusive lock */
-#define LOCK_NB                0x0080          /* Do not block when locking */
-#define LOCK_UN                F_UNLCK         /* Unlock */
-
-_PROTOTYPE(  int flock, (int fd, int mode)                             );
-
-#endif /* _FCNTL_H */
index 34a8ded405c4cd63f7382598817df96297b2cae3..dcae51e01af19d63ffab2918686a2ca2b0db3e68 100644 (file)
@@ -1,21 +1,62 @@
-#ifndef _FENV_H
-#define _FENV_H
+/*     $NetBSD: fenv.h,v 1.2 2010/08/02 17:49:04 joerg Exp $   */
+/*
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <stdint.h>
+#if !defined(__i386__) && !defined(__amd64__)
+#error "fenv.h is currently not supported for this architecture"
+#endif
 
-#define FE_TONEAREST  1
-#define FE_DOWNWARD   2
-#define FE_UPWARD     3
-#define FE_TOWARDZERO 4
+#ifndef _FENV_H_
+#define _FENV_H_
 
-typedef struct 
-{
-       u16_t cw;
-       u16_t sw;
-} fenv_t;
+#include <machine/fenv.h>
 
-int feholdexcept(fenv_t *envp);
-int fegetround(void);
-int fesetround(int round);
+__BEGIN_DECLS
 
-#endif
+/* Function prototypes */
+int    feclearexcept(int);
+int    fegetexceptflag(fexcept_t *, int);
+int    feraiseexcept(int);
+int    fesetexceptflag(const fexcept_t *, int);
+int    fetestexcept(int);
+int    fegetround(void);
+int    fesetround(int);
+int    fegetenv(fenv_t *);
+int    feholdexcept(fenv_t *);
+int    fesetenv(const fenv_t *);
+int    feupdateenv(const fenv_t *);
+
+#if defined(_NETBSD_SOURCE) || defined(_GNU_SOURCE)
+
+int    feenableexcept(int mask);
+int    fedisableexcept(int mask);
+int    fegetexcept(void);
+
+#endif /* _NETBDS_SOURCE || _GNU_SOURCE */
+
+__END_DECLS
+
+#endif /* ! _FENV_H_ */
similarity index 100%
rename from common/include/fetch.h
rename to include/fetch.h
diff --git a/include/float.h b/include/float.h
deleted file mode 100644 (file)
index a9aa92a..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* The <float.h> header defines some implementation limits for (IEEE) floating
- * point. Application programs can use it to find out how big and small 
- * floating-point numbers can be, what epsilon to use for iteration, etc.
- */
-
-#ifndef _FLOAT_H
-#define _FLOAT_H
-
-#define FLT_DIG                        6
-#define FLT_EPSILON            1.19209290e-07F
-#define FLT_MANT_DIG           24
-#define FLT_MAX                        3.40282347e+38F
-#define FLT_MAX_10_EXP         38
-#define FLT_MAX_EXP            128
-#define FLT_MIN                        1.17549435e-38F
-#define FLT_MIN_10_EXP         -37
-#define FLT_MIN_EXP            -125
-
-#define DBL_DIG                        15
-#define DBL_EPSILON            2.2204460492503131e-16
-#define DBL_MANT_DIG           53
-#define DBL_MAX                        1.7976931348623157e+308
-#define DBL_MAX_10_EXP         308
-#define DBL_MAX_EXP            1024
-#define DBL_MIN                        2.2250738585072014e-308
-#define DBL_MIN_10_EXP         -307
-#define DBL_MIN_EXP            -1021
-
-#define LDBL_DIG               15
-#define LDBL_EPSILON           2.2204460492503131e-16L
-#define LDBL_MANT_DIG          53
-#define LDBL_MAX               1.7976931348623157e+308L
-#define LDBL_MAX_10_EXP                308
-#define LDBL_MAX_EXP           1024
-#define LDBL_MIN               2.2250738585072014e-308L
-#define LDBL_MIN_10_EXP                -307
-#define LDBL_MIN_EXP           -1021
-
-#define FLT_ROUNDS             1
-#define FLT_RADIX              2
-
-#endif /* _FLOAT_H */
similarity index 100%
rename from nbsd_include/fmtmsg.h
rename to include/fmtmsg.h
index fd2131347097944a6686148e0c92b0f1e221fe36..b7533d54938c46d570acf065195beb79b473411e 100644 (file)
@@ -1,5 +1,4 @@
-/*     $OpenBSD: fnmatch.h,v 1.8 2005/12/13 00:35:22 millert Exp $     */
-/*     $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $  */
+/*     $NetBSD: fnmatch.h,v 1.12 2005/02/03 04:39:32 perry Exp $       */
 
 /*-
  * Copyright (c) 1992, 1993
 #ifndef        _FNMATCH_H_
 #define        _FNMATCH_H_
 
+#include <sys/featuretest.h>
+
 #define        FNM_NOMATCH     1       /* Match failed. */
-#define        FNM_NOSYS       2       /* Function not supported (unused). */
+#define        FNM_NOSYS       2       /* Function not implemented. */
 
 #define        FNM_NOESCAPE    0x01    /* Disable backslash escaping. */
 #define        FNM_PATHNAME    0x02    /* Slash must be matched by slash. */
 #define        FNM_PERIOD      0x04    /* Period must be matched by period. */
+#if defined(_NETBSD_SOURCE)
+#define        FNM_CASEFOLD    0x08    /* Pattern is matched case-insensitive */
+#define        FNM_LEADING_DIR 0x10    /* Ignore /<tail> after Imatch. */
+#endif
 
-#define        FNM_LEADING_DIR 0x08    /* Ignore /<tail> after Imatch. */
-#define        FNM_CASEFOLD    0x10    /* Case insensitive search. */
-#define        FNM_IGNORECASE  FNM_CASEFOLD
-#define        FNM_FILE_NAME   FNM_PATHNAME
-
+#include <sys/cdefs.h>
 
+__BEGIN_DECLS
 int     fnmatch(const char *, const char *, int);
+__END_DECLS
 
 #endif /* !_FNMATCH_H_ */
similarity index 100%
rename from nbsd_include/fstab.h
rename to include/fstab.h
index d7316eec04d2e152c12b07ba9600abae7f08a303..36301b4e176c045cea0d17798d73d794771f5d7f 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: fts.h,v 1.19 2009/08/16 19:33:38 christos Exp $        */
+
 /*
  * Copyright (c) 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
  * 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
+ * 3. 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.
  *
  * SUCH DAMAGE.
  *
  *     @(#)fts.h       8.3 (Berkeley) 8/14/94
- * $FreeBSD: src/include/fts.h,v 1.11 2005/01/07 00:06:20 pjd Exp $
  */
 
 #ifndef        _FTS_H_
 #define        _FTS_H_
 
+#ifndef        __fts_stat_t
+#define        __fts_stat_t    struct stat
+#endif
+#ifndef        __fts_nlink_t
+#define        __fts_nlink_t   nlink_t
+#endif
+#ifndef        __fts_ino_t
+#define        __fts_ino_t     ino_t
+#endif
+#ifndef        __fts_length_t
+#define        __fts_length_t  unsigned int
+#endif
+#ifndef        __fts_number_t
+#define        __fts_number_t  int64_t
+#endif
+#ifndef        __fts_dev_t
+#define        __fts_dev_t     dev_t
+#endif
+#ifndef        __fts_level_t
+#define        __fts_level_t   int
+#endif
+
 typedef struct {
        struct _ftsent *fts_cur;        /* current node */
        struct _ftsent *fts_child;      /* linked list of children */
@@ -44,10 +63,10 @@ typedef struct {
        dev_t fts_dev;                  /* starting device # */
        char *fts_path;                 /* path for this descent */
        int fts_rfd;                    /* fd for root */
-       int fts_pathlen;                /* sizeof(path) */
-       int fts_nitems;                 /* elements in the sort array */
+       unsigned int fts_pathlen;       /* sizeof(path) */
+       unsigned int fts_nitems;        /* elements in the sort array */
        int (*fts_compar)               /* compare function */
-           (const struct _ftsent * const *, const struct _ftsent * const *);
+               (const struct _ftsent **, const struct _ftsent **);
 
 #define        FTS_COMFOLLOW   0x001           /* follow command line symlinks */
 #define        FTS_LOGICAL     0x002           /* logical walk */
@@ -56,44 +75,36 @@ typedef struct {
 #define        FTS_PHYSICAL    0x010           /* physical walk */
 #define        FTS_SEEDOT      0x020           /* return dot and dot-dot */
 #define        FTS_XDEV        0x040           /* don't cross devices */
+#ifndef __minix
+#define        FTS_WHITEOUT    0x080           /* return whiteout information */
+#endif 
 #define        FTS_OPTIONMASK  0x0ff           /* valid user option mask */
 
 #define        FTS_NAMEONLY    0x100           /* (private) child names only */
 #define        FTS_STOP        0x200           /* (private) unrecoverable error */
        int fts_options;                /* fts_open options, global flags */
-       void *fts_clientptr;            /* thunk for sort function */
 } FTS;
 
 typedef struct _ftsent {
        struct _ftsent *fts_cycle;      /* cycle node */
        struct _ftsent *fts_parent;     /* parent directory */
        struct _ftsent *fts_link;       /* next file in directory */
-       union {
-               struct {
-                       long __fts_number;      /* local numeric value */
-                       void *__fts_pointer;    /* local address value */
-               } __struct_ftsent;
-#if 0
-               int64_t __fts_bignum;
-#endif
-       } __union_ftsent;
-#define        fts_number      __union_ftsent.__struct_ftsent.__fts_number
-#define        fts_pointer     __union_ftsent.__struct_ftsent.__fts_pointer
-#define        fts_bignum      __union_ftsent.__fts_bignum
+       __fts_number_t fts_number;      /* local numeric value */
+       void *fts_pointer;              /* local address value */
        char *fts_accpath;              /* access path */
        char *fts_path;                 /* root path */
        int fts_errno;                  /* errno for this node */
        int fts_symfd;                  /* fd for symlink */
-       u_short fts_pathlen;            /* strlen(fts_path) */
-       u_short fts_namelen;            /* strlen(fts_name) */
+       __fts_length_t fts_pathlen;     /* strlen(fts_path) */
+       __fts_length_t fts_namelen;     /* strlen(fts_name) */
 
-       ino_t fts_ino;                  /* inode */
-       dev_t fts_dev;                  /* device */
-       nlink_t fts_nlink;              /* link count */
+       __fts_ino_t fts_ino;            /* inode */
+       __fts_dev_t fts_dev;            /* device */
+       __fts_nlink_t fts_nlink;        /* link count */
 
 #define        FTS_ROOTPARENTLEVEL     -1
 #define        FTS_ROOTLEVEL            0
-       short fts_level;                /* depth (-1 to N) */
+       __fts_level_t fts_level;                /* depth (-1 to N) */
 
 #define        FTS_D            1              /* preorder directory */
 #define        FTS_DC           2              /* directory that causes cycles */
@@ -109,34 +120,34 @@ typedef struct _ftsent {
 #define        FTS_SL          12              /* symbolic link */
 #define        FTS_SLNONE      13              /* symbolic link without target */
 #define        FTS_W           14              /* whiteout object */
-       u_short fts_info;               /* user flags for FTSENT structure */
+       unsigned short fts_info;        /* user flags for FTSENT structure */
 
 #define        FTS_DONTCHDIR    0x01           /* don't chdir .. to the parent */
 #define        FTS_SYMFOLLOW    0x02           /* followed a symlink to get here */
 #define        FTS_ISW          0x04           /* this is a whiteout object */
-       u_short fts_flags;              /* private flags for FTSENT structure */
+       unsigned short fts_flags;       /* private flags for FTSENT structure */
 
 #define        FTS_AGAIN        1              /* read node again */
 #define        FTS_FOLLOW       2              /* follow symbolic link */
 #define        FTS_NOINSTR      3              /* no instructions */
 #define        FTS_SKIP         4              /* discard node */
-       u_short fts_instr;              /* fts_set() instructions */
+       unsigned short fts_instr;       /* fts_set() instructions */
 
-       struct stat *fts_statp;         /* stat(2) information */
-       char *fts_name;                 /* file name */
-       FTS *fts_fts;                   /* back pointer to main FTS */
+       __fts_stat_t *fts_statp;        /* stat(2) information */
+       char fts_name[1];               /* file name */
 } FTSENT;
 
-FTSENT *fts_children(FTS *, int);
-int     fts_close(FTS *);
-void   *fts_get_clientptr(FTS *);
-#define         fts_get_clientptr(fts) ((fts)->fts_clientptr)
-FTS    *fts_get_stream(FTSENT *);
-#define         fts_get_stream(ftsent) ((ftsent)->fts_fts)
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#ifndef        __LIBC12_SOURCE__
+FTSENT *fts_children(FTS *, int)               __RENAME(__fts_children60);
+int     fts_close(FTS *)                       __RENAME(__fts_close60);
 FTS    *fts_open(char * const *, int,
-           int (*)(const FTSENT * const *, const FTSENT * const *));
-FTSENT *fts_read(FTS *);
-int     fts_set(FTS *, FTSENT *, int);
-void    fts_set_clientptr(FTS *, void *);
+    int (*)(const FTSENT **, const FTSENT **)) __RENAME(__fts_open60);
+FTSENT *fts_read(FTS *)                        __RENAME(__fts_read60);
+int     fts_set(FTS *, FTSENT *, int)          __RENAME(__fts_set60);
+#endif
+__END_DECLS
 
 #endif /* !_FTS_H_ */
similarity index 100%
rename from nbsd_include/ftw.h
rename to include/ftw.h
index f967c05ddcdd479b0196504ba3228ef671975cf7..1111a1cc8ab457c41ec8441a2271ed1e65f2f07e 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: glob.h,v 1.26 2010/09/06 14:38:56 christos Exp $       */
+
 /*
  * Copyright (c) 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
 #ifndef _GLOB_H_
 #define        _GLOB_H_
 
-struct stat;
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#ifndef __gl_size_t
+#define __gl_size_t    size_t
+#endif
+#ifndef __gl_stat_t
+#define __gl_stat_t    struct stat
+#endif
+
 typedef struct {
-       int gl_pathc;           /* Count of total paths so far. */
-       int gl_matchc;          /* Count of paths matching pattern. */
-       int gl_offs;            /* Reserved at beginning of gl_pathv. */
+       __gl_size_t gl_pathc;   /* Count of total paths so far. */
+       __gl_size_t gl_matchc;  /* Count of paths matching pattern. */
+       __gl_size_t gl_offs;    /* Reserved at beginning of gl_pathv. */
        int gl_flags;           /* Copy of flags parameter to glob. */
        char **gl_pathv;        /* List of paths matching pattern. */
                                /* Copy of errfunc parameter to glob. */
@@ -53,8 +66,8 @@ typedef struct {
        void (*gl_closedir)(void *);
        struct dirent *(*gl_readdir)(void *);   
        void *(*gl_opendir)(const char *);
-       int (*gl_lstat)(const char *, struct stat *);
-       int (*gl_stat)(const char *, struct stat *);
+       int (*gl_lstat)(const char *, __gl_stat_t *);
+       int (*gl_stat)(const char *, __gl_stat_t *);
 } glob_t;
 
 #define        GLOB_APPEND     0x0001  /* Append to output from previous call. */
@@ -67,23 +80,34 @@ typedef struct {
 
 #define        GLOB_NOSPACE    (-1)    /* Malloc call failed. */
 #define        GLOB_ABORTED    (-2)    /* Unignored error. */
-#define        GLOB_NOMATCH    (-3)    /* No match and GLOB_NOCHECK not set. */
-#define        GLOB_NOSYS      (-4)    /* Function not supported. */
-
+#define        GLOB_NOMATCH    (-3)    /* No match, and GLOB_NOCHECK was not set. */
+#define        GLOB_NOSYS      (-4)    /* Implementation does not support function. */
 
+#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
 #define        GLOB_ALTDIRFUNC 0x0040  /* Use alternately specified directory funcs. */
 #define        GLOB_BRACE      0x0080  /* Expand braces ala csh. */
 #define        GLOB_MAGCHAR    0x0100  /* Pattern had globbing characters. */
 #define        GLOB_NOMAGIC    0x0200  /* GLOB_NOCHECK without magic chars (csh). */
-#define        GLOB_QUOTE      0x0400  /* Quote special chars with \. */
+#define        GLOB_LIMIT      0x0400  /* Limit memory used by matches to ARG_MAX */
 #define        GLOB_TILDE      0x0800  /* Expand tilde names from the passwd file. */
-#define GLOB_LIMIT     0x2000  /* Limit pattern match output to ARG_MAX */
-#define GLOB_ABEND     GLOB_ABORTED /* backward compatibility */
-
-
+/*     GLOB_NOESCAPE   0x1000  above */
+#define        GLOB_PERIOD     0x2000  /* Allow metachars to match leading periods. */
+#define        GLOB_NO_DOTDIRS 0x4000  /* Make . and .. vanish from wildcards. */
+#define        GLOB_STAR       0x8000  /* Use glob ** to recurse directories */
+#define        GLOB_QUOTE      0       /* source compatibility */
 
-int    glob(const char *, int, int (*)(const char *, int), glob_t *);
-void   globfree(glob_t *);
+#define        GLOB_ABEND      GLOB_ABORTED    /* source compatibility */
+#endif
 
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+int    glob(const char * __restrict, int,
+    int (*)(const char *, int), glob_t * __restrict)    __RENAME(__glob30);
+void   globfree(glob_t *)                               __RENAME(__globfree30);
+#endif
+#ifdef _NETBSD_SOURCE
+int    glob_pattern_p(const char *, int);
+#endif
+__END_DECLS
 
 #endif /* !_GLOB_H_ */
index 45f8afa0792686ade81cb7003697c31049d03fff..9c747844fc324e8b2b0204e91e94f41a97043137 100644 (file)
@@ -1,29 +1,84 @@
-/* The <grp.h> header is used for the getgrid() and getgrnam() calls. */
+/*     $NetBSD: grp.h,v 1.24 2007/10/19 15:58:52 christos Exp $        */
 
-#ifndef _GRP_H
-#define _GRP_H
+/*-
+ * Copyright (c) 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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. 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.
+ *
+ *     @(#)grp.h       8.2 (Berkeley) 1/21/94
+ */
 
-#ifndef _TYPES_H
-#include <minix/types.h>
+#ifndef _GRP_H_
+#define        _GRP_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+#if defined(_NETBSD_SOURCE)
+#define        _PATH_GROUP             "/etc/group"
 #endif
 
-struct group { 
-  char *gr_name;               /* the name of the group */
-  char *gr_passwd;             /* the group passwd */
-  gid_t gr_gid;                        /* the numerical group ID */
-  char **gr_mem;               /* a vector of pointers to the members */
+struct group {
+       __aconst char *gr_name;                 /* group name */
+       __aconst char *gr_passwd;               /* group password */
+       gid_t   gr_gid;                         /* group id */
+       __aconst char *__aconst *gr_mem;        /* group members */
 };
 
-/* Function Prototypes. */
-_PROTOTYPE( struct group *getgrgid, (gid_t _gid)                       );
-_PROTOTYPE( struct group *getgrnam, (const char *_name)                        );
-
-#ifdef _MINIX
-_PROTOTYPE( void endgrent, (void)                                      );
-_PROTOTYPE( struct group *getgrent, (void)                             );
-_PROTOTYPE( int setgrent, (void)                                       );
-_PROTOTYPE( void setgrfile, (const char *_file)                                );
-_PROTOTYPE( const char *group_from_gid, (gid_t, int)                    );
+__BEGIN_DECLS
+struct group   *getgrgid(gid_t);
+struct group   *getgrnam(const char *);
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+int             getgrgid_r(gid_t, struct group *, char *, size_t,
+                               struct group **);
+int             getgrnam_r(const char *, struct group *, char *, size_t,
+                               struct group **);
+#endif
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+struct group   *getgrent(void);
+void            setgrent(void);
+void            endgrent(void);
+#endif
+#if defined(_NETBSD_SOURCE)
+void            setgrfile(const char *);
+int             setgroupent(int);
+int             getgrent_r(struct group *, char *, size_t, struct group **);
+const char     *group_from_gid(gid_t, int);
+int             gid_from_group(const char *, gid_t *);
+int             pwcache_groupdb(int (*)(int), void (*)(void),
+                                   struct group * (*)(const char *),
+                                   struct group * (*)(gid_t));
 #endif
+__END_DECLS
 
-#endif /* _GRP_H */
+#endif /* !_GRP_H_ */
similarity index 100%
rename from nbsd_include/hesiod.h
rename to include/hesiod.h
similarity index 100%
rename from nbsd_include/iconv.h
rename to include/iconv.h
similarity index 100%
rename from nbsd_include/ieeefp.h
rename to include/ieeefp.h
index 4f8e5bf54b86902b2ed160c3f08e749cb1517195..d9ac7332938a1dc4af4ad743486e6d38bb6e0be8 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: ifaddrs.h,v 1.5 2005/02/03 04:39:32 perry Exp $        */
+
 /*
  * Copyright (c) 1995, 1999
  *     Berkeley Software Design, Inc.  All rights reserved.
@@ -44,18 +46,11 @@ struct ifaddrs {
 #define        ifa_broadaddr   ifa_dstaddr     /* broadcast address interface */
 #endif
 
-struct ifmaddrs {
-       struct ifmaddrs *ifma_next;
-       struct sockaddr *ifma_name;
-       struct sockaddr *ifma_addr;
-       struct sockaddr *ifma_lladdr;
-};
-
-extern int getifaddrs(struct ifaddrs **);
-extern void freeifaddrs(struct ifaddrs *);
-extern int getifmaddrs(struct ifmaddrs **);
-extern void freeifmaddrs(struct ifmaddrs *);
+#include <sys/cdefs.h>
 
-#define IFF_UP 1       /* Interface is up. */
+__BEGIN_DECLS
+int getifaddrs(struct ifaddrs **);
+void freeifaddrs(struct ifaddrs *);
+__END_DECLS
 
-#endif
+#endif /* !_IFADDRS_H_ */
index 31f4ec005bbdae41053a7f3c56b87f337a4d0dfc..8c08a403e9d04ac1a723eb40c578e321119cd8ed 100644 (file)
-/*     inttypes.h - Format conversions of integer types.
- *                                                     Author: Kees J. Bot
- *                                                             4 Oct 2003
- * Assumptions and bugs the same as for <stdint.h>
- * Bug: Wide character integer conversion functions missing.
+/*     $NetBSD: inttypes.h,v 1.7 2009/11/15 22:21:03 christos Exp $    */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
  */
 
-#ifndef _INTTYPES_H
-#define _INTTYPES_H
+#ifndef _INTTYPES_H_
+#define _INTTYPES_H_
 
-#ifndef _STDINT_H
-#include <stdint.h>
-#endif
-
-#if !__cplusplus || defined(__STDC_FORMAT_MACROS)
+#include <sys/cdefs.h>
+#include <sys/inttypes.h>
+#include <machine/ansi.h>
 
-/* Macros to print integers defined in <stdint.h>.  The first group should
- * not be used in code, they're merely here to build the second group.
- * (The standard really went overboard here, only the first group is needed.)
- */
-#define PRI8           ""
-#define PRILEAST8      ""
-#define PRIFAST8       ""
-#define PRI16          ""
-#define PRILEAST16     ""
-#define PRIFAST16      ""
-
-#if __SIZEOF_LONG__ > 4
-#define PRI32          ""
-#else
-#define PRI32          "l"
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
+typedef        _BSD_WCHAR_T_   wchar_t;
+#undef _BSD_WCHAR_T_
 #endif
-#define PRILEAST32     PRI32
-#define PRIFAST32      PRI32
 
-#if defined(__LONG_LONG_SUPPORTED)
-#define PRI64          "ll"
-#elif _WORD_SIZE > 2 && __L64
-#define PRI64          "l"
-#endif
+__BEGIN_DECLS
+intmax_t       strtoimax(const char * __restrict,
+                   char ** __restrict, int);
+uintmax_t      strtoumax(const char * __restrict,
+                   char ** __restrict, int);
+intmax_t       wcstoimax(const wchar_t * __restrict,
+                   wchar_t ** __restrict, int);
+uintmax_t      wcstoumax(const wchar_t * __restrict,
+                   wchar_t ** __restrict, int);
 
-#ifdef PRI64
-#define PRILEAST64     PRI64
-#define PRIFAST64      PRI64
-#define PRIMAX         PRI64
-#else
-#define PRIMAX         PRI32
-#endif
-
-#if _PTR_SIZE == _WORD_SIZE
-#define PRIPTR         ""
-#elif _PTR_SIZE == 2*_WORD_SIZE
-#define PRIPTR         "l"
-#endif
+intmax_t       imaxabs(intmax_t);
 
-/* Macros for fprintf, the ones defined by the standard. */
-#define PRId8          PRI8"d"
-#define PRIdLEAST8     PRILEAST8"d"
-#define PRIdFAST8      PRIFAST8"d"
-#define PRId16         PRI16"d"
-#define PRIdLEAST16    PRILEAST16"d"
-#define PRIdFAST16     PRIFAST16"d"
-#define PRId32         PRI32"d"
-#define PRIdLEAST32    PRILEAST32"d"
-#define PRIdFAST32     PRIFAST32"d"
-#ifdef PRI64
-#define PRId64         PRI64"d"
-#define PRIdLEAST64    PRILEAST64"d"
-#define PRIdFAST64     PRIFAST64"d"
-#endif
-#define PRIdMAX                PRIMAX"d"
-#define PRIdPTR                PRIPTR"d"
-
-#define PRIi8          PRI8"i"
-#define PRIiLEAST8     PRILEAST8"i"
-#define PRIiFAST8      PRIFAST8"i"
-#define PRIi16         PRI16"i"
-#define PRIiLEAST16    PRILEAST16"i"
-#define PRIiFAST16     PRIFAST16"i"
-#define PRIi32         PRI32"i"
-#define PRIiLEAST32    PRILEAST32"i"
-#define PRIiFAST32     PRIFAST32"i"
-#ifdef PRI64
-#define PRIi64         PRI64"i"
-#define PRIiLEAST64    PRILEAST64"i"
-#define PRIiFAST64     PRIFAST64"i"
-#endif
-#define PRIiMAX                PRIMAX"i"
-#define PRIiPTR                PRIPTR"i"
-
-#define PRIo8          PRI8"o"
-#define PRIoLEAST8     PRILEAST8"o"
-#define PRIoFAST8      PRIFAST8"o"
-#define PRIo16         PRI16"o"
-#define PRIoLEAST16    PRILEAST16"o"
-#define PRIoFAST16     PRIFAST16"o"
-#define PRIo32         PRI32"o"
-#define PRIoLEAST32    PRILEAST32"o"
-#define PRIoFAST32     PRIFAST32"o"
-#ifdef PRI64
-#define PRIo64         PRI64"o"
-#define PRIoLEAST64    PRILEAST64"o"
-#define PRIoFAST64     PRIFAST64"o"
-#endif
-#define PRIoMAX                PRIMAX"o"
-#define PRIoPTR                PRIPTR"o"
-
-#define PRIu8          PRI8"u"
-#define PRIuLEAST8     PRILEAST8"u"
-#define PRIuFAST8      PRIFAST8"u"
-#define PRIu16         PRI16"u"
-#define PRIuLEAST16    PRILEAST16"u"
-#define PRIuFAST16     PRIFAST16"u"
-#define PRIu32         PRI32"u"
-#define PRIuLEAST32    PRILEAST32"u"
-#define PRIuFAST32     PRIFAST32"u"
-#ifdef PRI64
-#define PRIu64         PRI64"u"
-#define PRIuLEAST64    PRILEAST64"u"
-#define PRIuFAST64     PRIFAST64"u"
-#endif
-#define PRIuMAX                PRIMAX"u"
-#define PRIuPTR                PRIPTR"u"
-
-#define PRIx8          PRI8"x"
-#define PRIxLEAST8     PRILEAST8"x"
-#define PRIxFAST8      PRIFAST8"x"
-#define PRIx16         PRI16"x"
-#define PRIxLEAST16    PRILEAST16"x"
-#define PRIxFAST16     PRIFAST16"x"
-#define PRIx32         PRI32"x"
-#define PRIxLEAST32    PRILEAST32"x"
-#define PRIxFAST32     PRIFAST32"x"
-#ifdef PRI64
-#define PRIx64         PRI64"x"
-#define PRIxLEAST64    PRILEAST64"x"
-#define PRIxFAST64     PRIFAST64"x"
-#endif
-#define PRIxMAX                PRIMAX"x"
-#define PRIxPTR                PRIPTR"x"
+typedef struct {
+       intmax_t quot;
+       intmax_t rem;
+} imaxdiv_t;
 
-#define PRIX8          PRI8"X"
-#define PRIXLEAST8     PRILEAST8"X"
-#define PRIXFAST8      PRIFAST8"X"
-#define PRIX16         PRI16"X"
-#define PRIXLEAST16    PRILEAST16"X"
-#define PRIXFAST16     PRIFAST16"X"
-#define PRIX32         PRI32"X"
-#define PRIXLEAST32    PRILEAST32"X"
-#define PRIXFAST32     PRIFAST32"X"
-#ifdef PRI64
-#define PRIX64         PRI64"X"
-#define PRIXLEAST64    PRILEAST64"X"
-#define PRIXFAST64     PRIFAST64"X"
-#endif
-#define PRIXMAX                PRIMAX"X"
-#define PRIXPTR                PRIPTR"X"
-
-/* Macros to scan integers with fscanf(), nonstandard first group. */
-#define SCN8           "hh"
-#define SCNLEAST8      "hh"
-#define SCNFAST8       ""
-#define SCN16          "h"
-#define SCNLEAST16     "h"
-#define SCNFAST16      ""
-#if _WORD_SIZE == 2
-#define SCN32          "l"
-#define SCNLEAST32     "l"
-#define SCNFAST32      "l"
-#else
-#define SCN32          ""
-#define SCNLEAST32     ""
-#define SCNFAST32      ""
-#endif
-#if _WORD_SIZE > 2 && __L64
-#define SCN64          "l"
-#define SCNLEAST64     "l"
-#define SCNFAST64      "l"
-#endif
-
-/* Macros for fscanf, the ones defined by the standard. */
-#define SCNd8          SCN8"d"
-#define SCNdLEAST8     SCNLEAST8"d"
-#define SCNdFAST8      SCNFAST8"d"
-#define SCNd16         SCN16"d"
-#define SCNdLEAST16    SCNLEAST16"d"
-#define SCNdFAST16     SCNFAST16"d"
-#define SCNd32         SCN32"d"
-#define SCNdLEAST32    SCNLEAST32"d"
-#define SCNdFAST32     SCNFAST32"d"
-#if _WORD_SIZE > 2 && __L64
-#define SCNd64         SCN64"d"
-#define SCNdLEAST64    SCNLEAST64"d"
-#define SCNdFAST64     SCNFAST64"d"
-#endif
-
-#define SCNi8          SCN8"i"
-#define SCNiLEAST8     SCNLEAST8"i"
-#define SCNiFAST8      SCNFAST8"i"
-#define SCNi16         SCN16"i"
-#define SCNiLEAST16    SCNLEAST16"i"
-#define SCNiFAST16     SCNFAST16"i"
-#define SCNi32         SCN32"i"
-#define SCNiLEAST32    SCNLEAST32"i"
-#define SCNiFAST32     SCNFAST32"i"
-#if _WORD_SIZE > 2 && __L64
-#define SCNi64         SCN64"i"
-#define SCNiLEAST64    SCNLEAST64"i"
-#define SCNiFAST64     SCNFAST64"i"
-#endif
-
-#define SCNo8          SCN8"o"
-#define SCNoLEAST8     SCNLEAST8"o"
-#define SCNoFAST8      SCNFAST8"o"
-#define SCNo16         SCN16"o"
-#define SCNoLEAST16    SCNLEAST16"o"
-#define SCNoFAST16     SCNFAST16"o"
-#define SCNo32         SCN32"o"
-#define SCNoLEAST32    SCNLEAST32"o"
-#define SCNoFAST32     SCNFAST32"o"
-#if _WORD_SIZE > 2 && __L64
-#define SCNo64         SCN64"o"
-#define SCNoLEAST64    SCNLEAST64"o"
-#define SCNoFAST64     SCNFAST64"o"
-#endif
-
-#define SCNu8          SCN8"u"
-#define SCNuLEAST8     SCNLEAST8"u"
-#define SCNuFAST8      SCNFAST8"u"
-#define SCNu16         SCN16"u"
-#define SCNuLEAST16    SCNLEAST16"u"
-#define SCNuFAST16     SCNFAST16"u"
-#define SCNu32         SCN32"u"
-#define SCNuLEAST32    SCNLEAST32"u"
-#define SCNuFAST32     SCNFAST32"u"
-#if _WORD_SIZE > 2 && __L64
-#define SCNu64         SCN64"u"
-#define SCNuLEAST64    SCNLEAST64"u"
-#define SCNuFAST64     SCNFAST64"u"
-#endif
-
-#define SCNx8          SCN8"x"
-#define SCNxLEAST8     SCNLEAST8"x"
-#define SCNxFAST8      SCNFAST8"x"
-#define SCNx16         SCN16"x"
-#define SCNxLEAST16    SCNLEAST16"x"
-#define SCNxFAST16     SCNFAST16"x"
-#define SCNx32         SCN32"x"
-#define SCNxLEAST32    SCNLEAST32"x"
-#define SCNxFAST32     SCNFAST32"x"
-#if _WORD_SIZE > 2 && __L64
-#define SCNx64         SCN64"x"
-#define SCNxLEAST64    SCNLEAST64"x"
-#define SCNxFAST64     SCNFAST64"x"
-#endif
-#endif /* !__cplusplus || __STDC_FORMAT_MACROS */
-
-/* Integer conversion functions for [u]intmax_t. */
-#ifdef __LONG_LONG_SUPPORTED
-#define stroimax(nptr, endptr, base)   strtoll(nptr, endptr, base)
-#define stroumax(nptr, endptr, base)   strtoull(nptr, endptr, base)
-#else
-#define stroimax(nptr, endptr, base)   strtol(nptr, endptr, base)
-#define stroumax(nptr, endptr, base)   strtoul(nptr, endptr, base)
-#endif
+imaxdiv_t      imaxdiv(intmax_t, intmax_t);
+__END_DECLS
 
-#endif /* _INTTYPES_H */
+#endif /* !_INTTYPES_H_ */
similarity index 100%
rename from nbsd_include/iso646.h
rename to include/iso646.h
similarity index 100%
rename from nbsd_include/kvm.h
rename to include/kvm.h
similarity index 100%
rename from nbsd_include/langinfo.h
rename to include/langinfo.h
similarity index 100%
rename from common/include/lib.h
rename to include/lib.h
index 8998923b1a9bf077280100c05d7d40719db0af78..7a4985e575980df0bbbc61514c4941fd33d88b60 100644 (file)
@@ -1,10 +1,42 @@
-/*
-libgen.h
-*/
+/*     $NetBSD: libgen.h,v 1.5 2008/05/10 22:37:42 christos Exp $      */
 
-#include <minix/ansi.h>
+/*-
+ * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
 
-/* Open Group Base Specifications Issue 6 (not complete) */
-_PROTOTYPE( char *basename, (char *_path)                              );
-_PROTOTYPE( char *dirname, (char *_path)                               );
+#ifndef _LIBGEN_H_
+#define _LIBGEN_H_
 
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+char   *basename(char *);
+char   *dirname(char *);
+__END_DECLS
+
+#endif /* !_LIBGEN_H_ */
similarity index 100%
rename from common/include/libutil.h
rename to include/libutil.h
index 23b1c35867b212cb700bbd6bb357c2bb39a2ddb5..447fa8acc516ae450747589540ac864bc783cffe 100644 (file)
-/* The <limits.h> header defines some basic sizes, both of the language types 
- * (e.g., the number of bits in an integer), and of the operating system (e.g.
- * the number of characters in a file name.
+/*     $NetBSD: limits.h,v 1.29 2010/06/07 13:52:29 tnozaki Exp $      */
+
+/*
+ * 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. 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.
+ *
+ *     @(#)limits.h    8.2 (Berkeley) 1/4/94
  */
 
-#ifndef _LIMITS_H
-#define _LIMITS_H
-
-#include <minix/limits.h>
-
-/* Definitions about chars (8 bits in MINIX, and signed). */
-#define CHAR_BIT           8   /* # bits in a char */
-#define CHAR_MIN        -128   /* minimum value of a char */
-#define CHAR_MAX         127   /* maximum value of a char */
-#define SCHAR_MIN       -128   /* minimum value of a signed char */
-#define SCHAR_MAX        127   /* maximum value of a signed char */
-#define UCHAR_MAX        255   /* maximum value of an unsigned char */
-#define MB_LEN_MAX         1   /* maximum length of a multibyte char */
-
-/* Definitions about shorts (16 bits in MINIX). */
-#define SHRT_MIN  (-32767-1)   /* minimum value of a short */
-#define SHRT_MAX       32767   /* maximum value of a short */
-#define USHRT_MAX     0xFFFF   /* maximum value of unsigned short */
-
-/* _EM_WSIZE is a compiler-generated symbol giving the word size in bytes. */
-#if _EM_WSIZE == 2
-#define INT_MIN   (-32767-1)   /* minimum value of a 16-bit int */
-#define INT_MAX        32767   /* maximum value of a 16-bit int */
-#define UINT_MAX      0xFFFF   /* maximum value of an unsigned 16-bit int */
-#endif
-
-#if _EM_WSIZE == 4
-#define INT_MIN (-2147483647-1)        /* minimum value of a 32-bit int */
-#define INT_MAX   2147483647   /* maximum value of a 32-bit int */
-#define UINT_MAX  0xFFFFFFFF   /* maximum value of an unsigned 32-bit int */
-#endif
-
-/*Definitions about longs (32 bits in MINIX). */
-#define LONG_MIN (-2147483647L-1)/* minimum value of a long */
-#define LONG_MAX  2147483647L  /* maximum value of a long */
-#define ULONG_MAX 0xFFFFFFFFL  /* maximum value of an unsigned long */
-
-/*Definitions about long longs (64 bits, may not be supported). */
-#ifdef __LONG_LONG_SUPPORTED
-#define LLONG_MIN  (-0x7FFFFFFFFFFFFFFFLL-1)   /* minimum value of a 
-                                                * long long 
-                                                */
-#define LLONG_MAX  0x7FFFFFFFFFFFFFFFLL                /* maximum value of a 
-                                                * long long 
-                                                */
-#define ULLONG_MAX 0xFFFFFFFFFFFFFFFFULL       /* maximum value of an
-                                                * unsigned long long
-                                                */
+#ifndef _LIMITS_H_
+#define        _LIMITS_H_
+
+#include <sys/featuretest.h>
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define        _POSIX_AIO_LISTIO_MAX   2
+#define        _POSIX_AIO_MAX          1
+#define        _POSIX_ARG_MAX          4096
+#define        _POSIX_CHILD_MAX        25
+#define        _POSIX_HOST_NAME_MAX    255
+#define        _POSIX_LINK_MAX         8
+#define        _POSIX_LOGIN_NAME_MAX   9
+#define        _POSIX_MAX_CANON        255
+#define        _POSIX_MAX_INPUT        255
+#define        _POSIX_MQ_OPEN_MAX      8
+#define        _POSIX_MQ_PRIO_MAX      32
+#define        _POSIX_NAME_MAX         14
+#define        _POSIX_NGROUPS_MAX      8
+#define        _POSIX_OPEN_MAX         20
+#define        _POSIX_PATH_MAX         256
+#define        _POSIX_PIPE_BUF         512
+#define        _POSIX_RE_DUP_MAX       255
+#define        _POSIX_SSIZE_MAX        32767
+#define        _POSIX_STREAM_MAX       8
+#define        _POSIX_SYMLINK_MAX      255
+#define        _POSIX_SYMLOOP_MAX      8
+#define        _POSIX_THREAD_DESTRUCTOR_ITERATIONS     4
+#define        _POSIX_THREAD_KEYS_MAX  128
+#define        _POSIX_THREAD_THREADS_MAX               64
+#define        _POSIX_TIMER_MAX        32
+#define        _POSIX_TTY_NAME_MAX     9
+#define        _POSIX_TZNAME_MAX       6
+
+#define        _POSIX2_BC_BASE_MAX     99
+#define        _POSIX2_BC_DIM_MAX      2048
+#define        _POSIX2_BC_SCALE_MAX    99
+#define        _POSIX2_BC_STRING_MAX   1000
+#define        _POSIX2_CHARCLASS_NAME_MAX      14
+#define        _POSIX2_COLL_WEIGHTS_MAX        2
+#define        _POSIX2_EXPR_NEST_MAX   32
+#define        _POSIX2_LINE_MAX        2048
+#define        _POSIX2_RE_DUP_MAX      255
+
+/*
+ * X/Open CAE Specifications,
+ * adopted in IEEE Std 1003.1-2001 XSI.
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define        _XOPEN_IOV_MAX          16
+#define        _XOPEN_NAME_MAX         256
+#define        _XOPEN_PATH_MAX         1024
+
+#define PASS_MAX               128             /* Legacy */
+
+#define CHARCLASS_NAME_MAX     14
+#define NL_ARGMAX              9
+#define NL_LANGMAX             14
+#define NL_MSGMAX              32767
+#define NL_NMAX                        1
+#define NL_SETMAX              255
+#define NL_TEXTMAX             2048
+
+       /* IEEE Std 1003.1-2001 TSF */
+#define        _GETGR_R_SIZE_MAX       1024
+#define        _GETPW_R_SIZE_MAX       1024
+
+/* Always ensure that this is consistent with <stdio.h> */
+#ifndef TMP_MAX
+#define TMP_MAX                        308915776       /* Legacy */
 #endif
+#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */
 
-/* Minimum sizes required by the POSIX P1003.1 standard (Table 2-3). */
-#ifdef _POSIX_SOURCE           /* these are only visible for POSIX */
-#define _POSIX_ARG_MAX    4096 /* exec() may have 4K worth of args */
-#define _POSIX_CHILD_MAX     6 /* a process may have 6 children */
-#define _POSIX_LINK_MAX      8 /* a file may have 8 links */
-#define _POSIX_MAX_CANON   255 /* size of the canonical input queue */
-#define _POSIX_MAX_INPUT   255 /* you can type 255 chars ahead */
-#define _POSIX_NAME_MAX NAME_MAX /* max. file name length */
-#define _POSIX_NGROUPS_MAX   8 /* max. number of supplemental groups */
-
-/* a process may have this many files open */
-#define _POSIX_OPEN_MAX  __MINIX_OPEN_MAX
-
-/* a pathname may contain at most this many chars */
-#define _POSIX_PATH_MAX    __MINIX_PATH_MAX
+#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
 
-#define _POSIX_PIPE_BUF    512 /* pipes writes of 512 bytes must be atomic */
-#define _POSIX_STREAM_MAX    8 /* at least 8 FILEs can be open at once */
-#define _POSIX_TZNAME_MAX    3 /* time zone names can be at least 3 chars */
-#define _POSIX_SSIZE_MAX 32767 /* read() must support 32767 byte reads */
-#define _POSIX_SYMLOOP_MAX   8 /* The number of symbolic links that can be
-                                * traversed in the resolution of a pathname
-                                * in the absence of a loop.
-                                */
-#define _POSIX_SYMLINK_MAX 255 /* The number of bytes in a symbolic link */
+#define MB_LEN_MAX             32      /* Allow ISO/IEC 2022 */
 
-/* Values actually implemented by MINIX (Tables 2-4, 2-5, 2-6, and 2-7). */
-/* Some of these old names had better be defined when not POSIX. */
-#define _NO_LIMIT          100 /* arbitrary number; limit not enforced */
+#include <machine/limits.h>
+#include <sys/syslimits.h>
 
-#if _EM_WSIZE > 2
-#define ARG_MAX          262144 /* # bytes of args + environ for exec() */
-#else
-#define ARG_MAX           4096 /* args + environ on small machines */
+#ifdef __minix
+#define SYMLOOP_MAX            16
+#define SYMLINK_MAX            1024
 #endif
-#define CHILD_MAX    _NO_LIMIT /* MINIX does not limit children */
-#define OPEN_MAX  __MINIX_OPEN_MAX     /* # open files a process may have */
-#if 0                  /* V1 file system */
-#define LINK_MAX      CHAR_MAX /* # links a file may have */
-#else                  /* V2 or better file system */
-#define LINK_MAX      SHRT_MAX /* # links a file may have */
-#endif
-#define MAX_CANON          255 /* size of the canonical input queue */
-#define MAX_INPUT          255 /* size of the type-ahead buffer */
-#define NAME_MAX                  255  /* system-wide filename limit (up to fs) */
-#define PATH_MAX  __MINIX_PATH_MAX     /* # chars in a path name */
-#define PIPE_BUF         32768 /* # bytes in atomic write to a pipe */
-#define STREAM_MAX          20 /* must be the same as FOPEN_MAX in stdio.h */
-#define TZNAME_MAX           3 /* maximum bytes in a time zone name is 3 */
-#define SSIZE_MAX     INT_MAX /* max defined byte count for read() */
-#define SIZE_MAX      UINT_MAX
-#define SYMLINK_MAX       1024         /* # bytes in a symbolic link */ 
-#define SYMLOOP_MAX        16  /* maximum number of symbolic links that can
-                                * be reliably traversed in the resolution of
-                                * a pathname in the absence of a loop.
-                                */
-#define IOV_MAX        INT_MAX  /* maximum number of buffers for readv/writev */
-#endif /* _POSIX_SOURCE */
-
-#define NGROUPS_MAX          8 /* max. number of supplemental groups */
-
-#define GID_MAX                USHRT_MAX
-#define UID_MAX                USHRT_MAX
 
-#endif /* _LIMITS_H */
+#endif /* !_LIMITS_H_ */
similarity index 100%
rename from nbsd_include/link.h
rename to include/link.h
similarity index 100%
rename from nbsd_include/link_aout.h
rename to include/link_aout.h
similarity index 100%
rename from nbsd_include/link_elf.h
rename to include/link_elf.h
index 8c06e5e0038fa3bef5bbff26a3897a76d37dc7b6..59c68792adcf1f518e4faf9633cf2ac83d3640be 100644 (file)
@@ -1,48 +1,91 @@
-/* The <locale.h> header is used to custom tailor currency symbols, decimal 
- * points, and other items to the local style.  It is ANSI's attempt at 
- * avoiding cultural imperialism.  The locale given below is for C.
- */
+/*     $NetBSD: locale.h,v 1.17 2010/06/07 13:52:29 tnozaki Exp $      */
 
-#ifndef _LOCALE_H
-#define _LOCALE_H
+/*
+ * Copyright (c) 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. 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.
+ *
+ *     @(#)locale.h    8.1 (Berkeley) 6/2/93
+ */
 
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
+#ifndef _LOCALE_H_
+#define _LOCALE_H_
 
 struct lconv {
-  char *decimal_point;         /* "." */
-  char *thousands_sep;         /* ""  */
-  char *grouping;              /* ""  */
-  char *int_curr_symbol;       /* ""  */
-  char *currency_symbol;       /* ""  */
-  char *mon_decimal_point;     /* ""  */
-  char *mon_thousands_sep;     /* ""  */
-  char *mon_grouping;          /* ""  */
-  char *positive_sign;         /* ""  */
-  char *negative_sign;         /* ""  */
-  char int_frac_digits;                /* CHAR_MAX */
-  char frac_digits;            /* CHAR_MAX */
-  char p_cs_precedes;          /* CHAR_MAX */
-  char p_sep_by_space;         /* CHAR_MAX */
-  char n_cs_precedes;          /* CHAR_MAX */
-  char n_sep_by_space;         /* CHAR_MAX */
-  char p_sign_posn;            /* CHAR_MAX */
-  char n_sign_posn;            /* CHAR_MAX */
+       char    *decimal_point;
+       char    *thousands_sep;
+       char    *grouping;
+       char    *int_curr_symbol;
+       char    *currency_symbol;
+       char    *mon_decimal_point;
+       char    *mon_thousands_sep;
+       char    *mon_grouping;
+       char    *positive_sign;
+       char    *negative_sign;
+       char    int_frac_digits;
+       char    frac_digits;
+       char    p_cs_precedes;
+       char    p_sep_by_space;
+       char    n_cs_precedes;
+       char    n_sep_by_space;
+       char    p_sign_posn;
+       char    n_sign_posn;
+       char    int_p_cs_precedes;
+       char    int_n_cs_precedes;
+       char    int_p_sep_by_space;
+       char    int_n_sep_by_space;
+       char    int_p_sign_posn;
+       char    int_n_sign_posn;
 };
 
 #include <sys/null.h>
 
-#define LC_ALL             1
-#define LC_COLLATE         2
-#define LC_CTYPE           3
-#define LC_MONETARY        4
-#define LC_NUMERIC         5
-#define LC_TIME            6
-#define LC_MESSAGES        7
+#define        LC_ALL          0
+#define        LC_COLLATE      1
+#define        LC_CTYPE        2
+#define        LC_MONETARY     3
+#define        LC_NUMERIC      4
+#define        LC_TIME         5
+#define LC_MESSAGES    6
+
+#define        _LC_LAST        7               /* marks end */
+
+#include <sys/cdefs.h>
+
+#ifdef __SETLOCALE_SOURCE__
+
+typedef struct _locale_impl_t          *_locale_t;
+
+#define _LC_GLOBAL_LOCALE              ((_locale_t)-1)
+
+#endif
 
-/* Function Prototypes. */
-_PROTOTYPE( char *setlocale, (int _category, const char *_locale)      );
-_PROTOTYPE( struct lconv *localeconv, (void)                           );
+__BEGIN_DECLS
+struct lconv *localeconv(void);
+char *setlocale(int, const char *) __RENAME(__setlocale50);
+__END_DECLS
 
-#endif /* _LOCALE_H */
+#endif /* _LOCALE_H_ */
similarity index 100%
rename from nbsd_include/login_cap.h
rename to include/login_cap.h
similarity index 100%
rename from nbsd_include/lwp.h
rename to include/lwp.h
similarity index 100%
rename from nbsd_include/malloc.h
rename to include/malloc.h
index 680ce3dee7ac225ada0b811a505e687bd9800c92..fe0251c970f94c051a286d9f49ac3016382cca98 100644 (file)
-/* The <math.h> header contains prototypes for mathematical functions. */
+/*     $NetBSD: math.h,v 1.53 2010/09/15 16:11:30 christos Exp $       */
 
-#ifndef _MATH_H
-#define _MATH_H
+/*
+ * ====================================================
+ * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+ *
+ * Developed at SunPro, a Sun Microsystems, Inc. business.
+ * Permission to use, copy, modify, and distribute this
+ * software is freely granted, provided that this notice
+ * is preserved.
+ * ====================================================
+ */
+
+/*
+ * @(#)fdlibm.h 5.1 93/09/24
+ */
+
+#ifndef _MATH_H_
+#define _MATH_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+union __float_u {
+       unsigned char __dummy[sizeof(float)];
+       float __val;
+};
+
+union __double_u {
+       unsigned char __dummy[sizeof(double)];
+       double __val;
+};
+
+union __long_double_u {
+       unsigned char __dummy[sizeof(long double)];
+       long double __val;
+};
+
+#include <machine/math.h>              /* may use __float_u, __double_u,
+                                          or __long_double_u */
+
+#ifdef __HAVE_LONG_DOUBLE
+#define        __fpmacro_unary_floating(__name, __arg0)                        \
+       /* LINTED */                                                    \
+       ((sizeof (__arg0) == sizeof (float))                            \
+       ?       __ ## __name ## f (__arg0)                              \
+       : (sizeof (__arg0) == sizeof (double))                          \
+       ?       __ ## __name ## d (__arg0)                              \
+       :       __ ## __name ## l (__arg0))
+#else
+#define        __fpmacro_unary_floating(__name, __arg0)                        \
+       /* LINTED */                                                    \
+       ((sizeof (__arg0) == sizeof (float))                            \
+       ?       __ ## __name ## f (__arg0)                              \
+       :       __ ## __name ## d (__arg0))
+#endif /* __HAVE_LONG_DOUBLE */
+
+/*
+ * ANSI/POSIX
+ */
+/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
+#if __GNUC_PREREQ__(3, 3)
+#define HUGE_VAL       __builtin_huge_val()
+#else
+extern const union __double_u __infinity;
+#define HUGE_VAL       __infinity.__val
+#endif
+
+/*
+ * ISO C99
+ */
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+    !defined(_XOPEN_SOURCE) || \
+    ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    ((_XOPEN_SOURCE  - 0) >= 600) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
+#if __GNUC_PREREQ__(3, 3)
+#define        HUGE_VALF       __builtin_huge_valf()
+#define        HUGE_VALL       __builtin_huge_vall()
+#else
+extern const union __float_u __infinityf;
+#define        HUGE_VALF       __infinityf.__val
 
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
+extern const union __long_double_u __infinityl;
+#define        HUGE_VALL       __infinityl.__val
 #endif
 
-#define INFINITY       (__infinity())
-#define NAN            (__qnan())
-#define HUGE_VAL       INFINITY
-
-/* Function Prototypes. */
-_PROTOTYPE( double __infinity, (void)                                  );
-_PROTOTYPE( double __qnan,     (void)                                  );
-
-_PROTOTYPE( double acos,  (double _x)                                  );
-_PROTOTYPE( double asin,  (double _x)                                  );
-_PROTOTYPE( double atan,  (double _x)                                  );
-_PROTOTYPE( double atan2, (double _y, double _x)                       );
-_PROTOTYPE( double ceil,  (double _x)                                  );
-_PROTOTYPE( double cos,   (double _x)                                  );
-_PROTOTYPE( double cosh,  (double _x)                                  );
-_PROTOTYPE( double exp,   (double _x)                                  );
-_PROTOTYPE( double fabs,  (double _x)                                  );
-_PROTOTYPE( float fabsf, (float _x)                                    );
-_PROTOTYPE( double floor, (double _x)                                  );
-_PROTOTYPE( double fmod,  (double _x, double _y)                       );
-_PROTOTYPE( double frexp, (double _x, int *_exp)                       );
-_PROTOTYPE( double ldexp, (double _x, int _exp)                                );
-_PROTOTYPE( double log,   (double _x)                                  );
-_PROTOTYPE( double log10, (double _x)                                  );
-_PROTOTYPE( double modf,  (double _x, double *_iptr)                   );
-_PROTOTYPE( double pow,   (double _x, double _y)                       );
-_PROTOTYPE( double rint,  (double _x)                                  );
-_PROTOTYPE( double scalbn, (double _x, int _exp)                       );
-_PROTOTYPE( float scalbnf, (float _x, int _exp)                                );
-_PROTOTYPE( double scalbln, (double _x, long _exp)                     );
-_PROTOTYPE( float scalblnf, (float _x, long _exp)                      );
-_PROTOTYPE( double sin,   (double _x)                                  );
-_PROTOTYPE( double sinh,  (double _x)                                  );
-_PROTOTYPE( double sqrt,  (double _x)                                  );
-_PROTOTYPE( double tan,   (double _x)                                  );
-_PROTOTYPE( double tanh,  (double _x)                                  );
-_PROTOTYPE( double hypot, (double _x, double _y)                       );
-
-#ifdef _POSIX_SOURCE   /* STD-C? */
-#include <mathconst.h>
-
-#define FP_INFINITE  1
-#define FP_NAN       2
-#define FP_NORMAL    3
-#define FP_SUBNORMAL 4
-#define FP_ZERO      5
-
-_PROTOTYPE( int fpclassify,     (double x)                             );
-_PROTOTYPE( int isfinite,       (double x)                             );
-_PROTOTYPE( int isinf,          (double x)                             );
-_PROTOTYPE( int isnan,          (double x)                             );
-_PROTOTYPE( int isnormal,       (double x)                             );
-_PROTOTYPE( int signbit,        (double x)                             );
-_PROTOTYPE( int isgreater,      (double x, double y)   );
-_PROTOTYPE( int isgreaterequal, (double x, double y)   );
-_PROTOTYPE( int isless,         (double x, double y)   );
-_PROTOTYPE( int islessequal,    (double x, double y)   );
-_PROTOTYPE( int islessgreater,  (double x, double y)   );
-_PROTOTYPE( int isunordered,    (double x, double y)   );
-_PROTOTYPE( double nearbyint,   (double x)             );
-_PROTOTYPE( double remainder,   (double x, double y)   );
-_PROTOTYPE( double trunc,       (double x)             );
+/* 7.12#4 INFINITY */
+#if __GNUC_PREREQ__(3, 3)
+#define        INFINITY        __builtin_inff()
+#elif defined(__INFINITY)
+#define        INFINITY        __INFINITY      /* float constant which overflows */
+#else
+#define        INFINITY        HUGE_VALF       /* positive infinity */
+#endif /* __INFINITY */
+
+/* 7.12#5 NAN: a quiet NaN, if supported */
+#ifdef __HAVE_NANF
+#if __GNUC_PREREQ__(3,3)
+#define        NAN     __builtin_nanf("")
+#else
+extern const union __float_u __nanf;
+#define        NAN             __nanf.__val
 #endif
+#endif /* __HAVE_NANF */
+
+/* 7.12#6 number classification macros */
+#define        FP_INFINITE     0x00
+#define        FP_NAN          0x01
+#define        FP_NORMAL       0x02
+#define        FP_SUBNORMAL    0x03
+#define        FP_ZERO         0x04
+/* NetBSD extensions */
+#define        _FP_LOMD        0x80            /* range for machine-specific classes */
+#define        _FP_HIMD        0xff
+
+#endif /* !_ANSI_SOURCE && ... */
 
-/* The following definitions are not implemented in the ACK math lib.
- * We allow them in the GNU compiler because they are builtins there.
+/*
+ * XOPEN/SVID
  */
-#ifdef __GNUC__
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define        M_E             2.7182818284590452354   /* e */
+#define        M_LOG2E         1.4426950408889634074   /* log 2e */
+#define        M_LOG10E        0.43429448190325182765  /* log 10e */
+#define        M_LN2           0.69314718055994530942  /* log e2 */
+#define        M_LN10          2.30258509299404568402  /* log e10 */
+#define        M_PI            3.14159265358979323846  /* pi */
+#define        M_PI_2          1.57079632679489661923  /* pi/2 */
+#define        M_PI_4          0.78539816339744830962  /* pi/4 */
+#define        M_1_PI          0.31830988618379067154  /* 1/pi */
+#define        M_2_PI          0.63661977236758134308  /* 2/pi */
+#define        M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
+#define        M_SQRT2         1.41421356237309504880  /* sqrt(2) */
+#define        M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
+
+#define        MAXFLOAT        ((float)3.40282346638528860e+38)
+extern int signgam;
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE)
+enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
+
+#define _LIB_VERSION_TYPE enum fdversion
+#define _LIB_VERSION _fdlib_version
+
+/* if global variable _LIB_VERSION is not desirable, one may
+ * change the following to be a constant by:
+ *     #define _LIB_VERSION_TYPE const enum version
+ * In that case, after one initializes the value _LIB_VERSION (see
+ * s_lib_version.c) during compile time, it cannot be modified
+ * in the middle of a program
+ */
+extern  _LIB_VERSION_TYPE  _LIB_VERSION;
+
+#define _IEEE_  fdlibm_ieee
+#define _SVID_  fdlibm_svid
+#define _XOPEN_ fdlibm_xopen
+#define _POSIX_ fdlibm_posix
+
 #ifndef __cplusplus
-_PROTOTYPE( float powf,                (float, float)          );
-_PROTOTYPE( float fmodf,       (float, float)          );
-_PROTOTYPE( double erf,                (double)                );
-_PROTOTYPE( double erfc,       (double)                );
-_PROTOTYPE( double gamma,      (double)                );
-_PROTOTYPE( double j0,         (double)                );
-_PROTOTYPE( double j1,         (double)                );
-_PROTOTYPE( double jn,         (int, double)           );
-_PROTOTYPE( double lgamma,     (double)                );
-_PROTOTYPE( double y0,         (double)                );
-_PROTOTYPE( double y1,         (double)                );
-_PROTOTYPE( double yn,         (int, double)           );
-_PROTOTYPE( double acosh,      (double)                );
-_PROTOTYPE( double asinh,      (double)                );
-_PROTOTYPE( double atanh,      (double)                );
-_PROTOTYPE( double cbrt,       (double)                );
-_PROTOTYPE( double expm1,      (double)                );
-_PROTOTYPE( int    ilogb,      (double)                );
-_PROTOTYPE( double log1p,      (double)                );
-_PROTOTYPE( double logb,       (double)                );
-_PROTOTYPE( double nextafter,  (double, double)        );
-_PROTOTYPE( double scalb,      (double, double)        );
+struct exception {
+       int type;
+       const char *name;
+       double arg1;
+       double arg2;
+       double retval;
+};
 #endif
+
+#define        HUGE            MAXFLOAT
+
+/*
+ * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
+ * (one may replace the following line by "#include <values.h>")
+ */
+
+#define X_TLOSS                1.41484755040568800000e+16
+
+#define        DOMAIN          1
+#define        SING            2
+#define        OVERFLOW        3
+#define        UNDERFLOW       4
+#define        TLOSS           5
+#define        PLOSS           6
+
+#endif /* _NETBSD_SOURCE */
+
+__BEGIN_DECLS
+/*
+ * ANSI/POSIX
+ */
+double acos(double);
+double asin(double);
+double atan(double);
+double atan2(double, double);
+double cos(double);
+double sin(double);
+double tan(double);
+
+double cosh(double);
+double sinh(double);
+double tanh(double);
+
+double exp(double);
+double exp2(double);
+double frexp(double, int *);
+double ldexp(double, int);
+double log(double);
+double log2(double);
+double log10(double);
+double modf(double, double *);
+
+double pow(double, double);
+double sqrt(double);
+
+double ceil(double);
+double fabs(double);
+double floor(double);
+double fmod(double, double);
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+double erf(double);
+double erfc(double);
+double gamma(double);
+double hypot(double, double);
+int    finite(double);
+double j0(double);
+double j1(double);
+double jn(int, double);
+double lgamma(double);
+double y0(double);
+double y1(double);
+double yn(int, double);
+
+#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+double acosh(double);
+double asinh(double);
+double atanh(double);
+double cbrt(double);
+double expm1(double);
+int    ilogb(double);
+double log1p(double);
+double logb(double);
+double nextafter(double, double);
+double remainder(double, double);
+double rint(double);
+double scalb(double, double);
+#endif /* (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)*/
+#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+/*
+ * ISO C99
+ */
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+    !defined(_XOPEN_SOURCE) || \
+    ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    ((_XOPEN_SOURCE  - 0) >= 600) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+/* 7.12.3.1 int fpclassify(real-floating x) */
+#define        fpclassify(__x) __fpmacro_unary_floating(fpclassify, __x)
+
+/* 7.12.3.2 int isfinite(real-floating x) */
+#define        isfinite(__x)   __fpmacro_unary_floating(isfinite, __x)
+
+/* 7.12.3.5 int isnormal(real-floating x) */
+#define        isnormal(__x)   (fpclassify(__x) == FP_NORMAL)
+
+/* 7.12.3.6 int signbit(real-floating x) */
+#define        signbit(__x)    __fpmacro_unary_floating(signbit, __x)
+
+/* 7.12.4 trigonometric */
+
+float  acosf(float);
+float  asinf(float);
+float  atanf(float);
+float  atan2f(float, float);
+float  cosf(float);
+float  sinf(float);
+float  tanf(float);
+
+/* 7.12.5 hyperbolic */
+
+float  acoshf(float);
+float  asinhf(float);
+float  atanhf(float);
+float  coshf(float);
+float  sinhf(float);
+float  tanhf(float);
+
+/* 7.12.6 exp / log */
+
+float  expf(float);
+float  exp2f(float);
+float  expm1f(float);
+float  frexpf(float, int *);
+int    ilogbf(float);
+float  ldexpf(float, int);
+float  logf(float);
+float  log2f(float);
+float  log10f(float);
+float  log1pf(float);
+float  logbf(float);
+float  modff(float, float *);
+float  scalbnf(float, int);
+
+/* 7.12.7 power / absolute */
+
+float  cbrtf(float);
+float  fabsf(float);
+long double    fabsl(long double);
+float  hypotf(float, float);
+float  powf(float, float);
+float  sqrtf(float);
+
+/* 7.12.8 error / gamma */
+
+float  erff(float);
+float  erfcf(float);
+float  lgammaf(float);
+
+/* 7.12.9 nearest integer */
+
+float  ceilf(float);
+float  floorf(float);
+float  rintf(float);
+double round(double);
+float  roundf(float);
+double trunc(double);
+float  truncf(float);
+long int       lrint(double);
+long int       lrintf(float);
+/* LONGLONG */
+long long int  llrint(double);
+/* LONGLONG */
+long long int  llrintf(float);
+long int       lround(double);
+long int       lroundf(float);
+/* LONGLONG */
+long long int  llround(double);
+/* LONGLONG */
+long long int  llroundf(float);
+
+/* 7.12.10 remainder */
+
+float  fmodf(float, float);
+float  remainderf(float, float);
+
+/* 7.12.11 manipulation */
+
+float  copysignf(float, float);
+long double    copysignl(long double, long double);
+double nan(const char *);
+float  nanf(const char *);
+long double    nanl(const char *);
+float  nextafterf(float, float);
+long double     nextafterl(long double, long double);
+double nexttoward(double, long double);
+
+/* 7.12.14 comparison */
+
+#define isunordered(x, y)      (isnan(x) || isnan(y))
+#define isgreater(x, y)                (!isunordered((x), (y)) && (x) > (y))
+#define isgreaterequal(x, y)   (!isunordered((x), (y)) && (x) >= (y))
+#define isless(x, y)           (!isunordered((x), (y)) && (x) < (y))
+#define islessequal(x, y)      (!isunordered((x), (y)) && (x) <= (y))
+#define islessgreater(x, y)    (!isunordered((x), (y)) && \
+                                ((x) > (y) || (y) > (x)))
+double fdim(double, double);
+double fmax(double, double);
+double fmin(double, double);
+float  fdimf(float, float);
+float  fmaxf(float, float);
+float  fminf(float, float);
+long double fdiml(long double, long double);
+long double fmaxl(long double, long double);
+long double fminl(long double, long double);
+
+#endif /* !_ANSI_SOURCE && ... */
+
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) || \
+    !defined(_XOPEN_SOURCE) || \
+    ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+/* 7.12.3.3 int isinf(real-floating x) */
+#ifdef __isinf
+#define        isinf(__x)      __isinf(__x)
+#else
+#define        isinf(__x)      __fpmacro_unary_floating(isinf, __x)
+#endif
+
+/* 7.12.3.4 int isnan(real-floating x) */
+#ifdef __isnan
+#define        isnan(__x)      __isnan(__x)
+#else
+#define        isnan(__x)      __fpmacro_unary_floating(isnan, __x)
+#endif
+#endif /* !_ANSI_SOURCE && ... */
+
+#if defined(_NETBSD_SOURCE)
+#ifndef __cplusplus
+int    matherr(struct exception *);
+#endif
+
+/*
+ * IEEE Test Vector
+ */
+double significand(double);
+
+/*
+ * Functions callable from C, intended to support IEEE arithmetic.
+ */
+double copysign(double, double);
+double scalbn(double, int);
+
+/*
+ * BSD math library entry points
+ */
+double drem(double, double);
+
+#endif /* _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)
+/*
+ * Reentrant version of gamma & lgamma; passes signgam back by reference
+ * as the second argument; user must allocate space for signgam.
+ */
+double gamma_r(double, int *);
+double lgamma_r(double, int *);
+#endif /* _NETBSD_SOURCE || _REENTRANT */
+
+
+#if defined(_NETBSD_SOURCE)
+
+/* float versions of ANSI/POSIX functions */
+
+float  gammaf(float);
+int    isinff(float);
+int    isnanf(float);
+int    finitef(float);
+float  j0f(float);
+float  j1f(float);
+float  jnf(int, float);
+float  y0f(float);
+float  y1f(float);
+float  ynf(int, float);
+
+float  scalbf(float, float);
+
+/*
+ * float version of IEEE Test Vector
+ */
+float  significandf(float);
+
+/*
+ * float versions of BSD math library entry points
+ */
+float  dremf(float, float);
+#endif /* _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)
+/*
+ * Float versions of reentrant version of gamma & lgamma; passes
+ * signgam back by reference as the second argument; user must
+ * allocate space for signgam.
+ */
+float  gammaf_r(float, int *);
+float  lgammaf_r(float, int *);
+#endif /* !... || _REENTRANT */
+
+/*
+ * Library implementation
+ */
+int    __fpclassifyf(float);
+int    __fpclassifyd(double);
+int    __isfinitef(float);
+int    __isfinited(double);
+int    __isinff(float);
+int    __isinfd(double);
+int    __isnanf(float);
+int    __isnand(double);
+int    __signbitf(float);
+int    __signbitd(double);
+
+#ifdef __HAVE_LONG_DOUBLE
+int    __fpclassifyl(long double);
+int    __isfinitel(long double);
+int    __isinfl(long double);
+int    __isnanl(long double);
+int    __signbitl(long double);
 #endif
+__END_DECLS
 
-#endif /* _MATH_H */
+#endif /* _MATH_H_ */
diff --git a/include/mathconst.h b/include/mathconst.h
deleted file mode 100644 (file)
index 56fef8c..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * mathconst.h - mathematic constants
- */
-/* $Header$ */
-
-#ifndef _MATHCONST_H
-#define        _MATHCONST_H
-
-/* Some constants (Hart & Cheney) */
-#define        M_PI            3.14159265358979323846264338327950288
-#define        M_2PI           6.28318530717958647692528676655900576
-#define        M_3PI_4         2.35619449019234492884698253745962716
-#define        M_PI_2          1.57079632679489661923132169163975144
-#define        M_3PI_8         1.17809724509617246442349126872981358
-#define        M_PI_4          0.78539816339744830961566084581987572
-#define        M_PI_8          0.39269908169872415480783042290993786
-#define        M_1_PI          0.31830988618379067153776752674502872
-#define        M_2_PI          0.63661977236758134307553505349005744
-#define        M_4_PI          1.27323954473516268615107010698011488
-#define        M_E             2.71828182845904523536028747135266250
-#define        M_LOG2E         1.44269504088896340735992468100189213
-#define        M_LOG10E        0.43429448190325182765112891891660508
-#define        M_LN2           0.69314718055994530941723212145817657
-#define        M_LN10          2.30258509299404568401799145468436421
-#define        M_SQRT2         1.41421356237309504880168872420969808
-#define        M_1_SQRT2       0.70710678118654752440084436210484904
-#define        M_EULER         0.57721566490153286060651209008240243
-#define        M_SQRT1_2       0.70710678118654752440084436210484904
-
-#endif /* _MATHCONST_H */
similarity index 100%
rename from nbsd_include/md2.h
rename to include/md2.h
index 7e81ef05111646538a4925715f918b9638321209..a4c1b0c32a56afab3bf8a16ff0501c4ebc9b7e5f 100644 (file)
@@ -1,6 +1,34 @@
-#ifndef _MEMORY_H
-#define _MEMORY_H
+/*     $NetBSD: memory.h,v 1.5 2003/08/07 09:44:10 agc Exp $   */
 
-#include <string.h>
+/*
+ * 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. 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.
+ *
+ *     @(#)memory.h    8.1 (Berkeley) 6/2/93
+ */
 
-#endif /* _MEMORY_H */
+#include <string.h>
diff --git a/include/midiparser.h b/include/midiparser.h
deleted file mode 100644 (file)
index e797682..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Purpose: Definitions for the MIDI message parser
- */
-/*
- * This file is part of Open Sound System
- *
- * Copyright (C) 4Front Technologies 1996-2008.
- *
- * This software is released under the BSD license.
- * See the COPYING file included in the main directory of this source
- * distribution for the license terms and conditions
- */
-
-
-typedef struct midiparser_common midiparser_common_t, *midiparser_common_p;
-
-#define CAT_VOICE      0
-#define CAT_MTC                1
-#define CAT_SYSEX      2
-#define CAT_CHN                3
-#define CAT_REALTIME   4
-
-typedef void (*midiparser_callback_t) (void *context, int category,
-                                      unsigned char msg, unsigned char ch,
-                                      unsigned char *parms, int len);
-typedef void (*midiparser_mtc_callback_t) (void *context,
-                                          oss_mtc_data_t * mtc);
-
-extern midiparser_common_p midiparser_create (midiparser_callback_t callback,
-                                             void *comntext);
-extern void midiparser_unalloc (midiparser_common_p common);
-extern void midiparser_mtc_callback (midiparser_common_p common,
-                                    midiparser_mtc_callback_t callback);
-
-extern void midiparser_input (midiparser_common_p common, unsigned char data);
-extern void midiparser_input_buf (midiparser_common_p common,
-                                 unsigned char *data, int len);
diff --git a/include/minix/cdrom.h b/include/minix/cdrom.h
deleted file mode 100644 (file)
index 3508688..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* This file contains some structures used by the Mitsumi cdrom driver.
- *
- *  Feb 13 1995                        Author: Michel R. Prevenier 
- */
-
-/* Index into the mss arrays */
-#define MINUTES        0
-#define SECONDS        1
-#define SECTOR 2
-
-struct cd_play_mss
-{
-       u8_t    begin_mss[3];
-       u8_t    end_mss[3];
-};
-
-struct cd_play_track
-{
-       u8_t    begin_track;
-       u8_t    end_track;
-};
-
-struct cd_disk_info
-{
-       u8_t    first_track;
-       u8_t    last_track;
-       u8_t    disk_length_mss[3];
-       u8_t    first_track_mss[3];
-};
-
-struct cd_toc_entry
-{
-       u8_t    control_address;
-       u8_t    track_nr;
-       u8_t    index_nr;
-       u8_t    track_time_mss[3];
-        u8_t   reserved;
-       u8_t    position_mss[3];
-};
diff --git a/include/minix/compiler-ack.h b/include/minix/compiler-ack.h
deleted file mode 100644 (file)
index cb6e035..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Definitions for ACK-specific features. */
-
-#ifndef _MINIX_COMPILER_ACK_H
-#define _MINIX_COMPILER_ACK_H
-
-/* ACK expects the caller to pop the hidden pointer on struct return. */
-#define BYTES_TO_POP_ON_STRUCT_RETURN
-
-/* 
- * ACK doesn't move the last argument of a variadic arguments function
- * anywhere, once it's on the stack as a function parameter. Thus, it is
- * possible to make strong assumption on the immutability of the stack
- * layout and use the address of that argument as the start of an array.
- * 
- * If you're curious, just look at lib/libc/posix/_execl*.c ;-)
- */
-
-#define FUNC_ARGS_ARRAY 1
-
-#endif /* _MINIX_COMPILER_ACK_H */
index 44ff02ffb7f4840796e7507b3ce42b06d074d266..06cbdc00dd4ae0c64a27a4176713b582740fb821 100644 (file)
@@ -11,9 +11,7 @@
 #ifndef _DIRENT_H
 #define _DIRENT_H
 
-#ifndef _TYPES_H
-#include <minix/types.h>
-#endif
+#include <sys/cdefs.h>
 
        /* Name of length len needs _EXTENT(len) extra slots. */
 #define _EXTENT(len)   (((len) + 5) >> 3)
 /* This is the block size for the fixed versions of the filesystem (V1/V2) */
 #define _STATIC_BLOCK_SIZE     1024
 
-/* Definitions for the directory(3) routines: */
-typedef struct {
-       int             _fd;    /* Filedescriptor of open directory */
-       unsigned        _count; /* This many bytes in _buf */
-       unsigned        _pos;   /* Position in _buf */
-       char             _buf[_MAX_BLOCK_SIZE]; /* The size does not really
-                                                * matter as long as the
-                                                * buffer is big enough
-                                                * to contain at least one
-                                                * entry.
-                                                */
-} DIR;
-
-struct dirent {                /* Largest entry (8 slots) */
-       ino_t           d_ino;          /* I-node number */
-       off_t           d_off;          /* Offset in directory */
-       unsigned short  d_reclen;       /* Length of this record */
-       char            d_name[1];      /* Null terminated name */
-};
-
-/* Function Prototypes. */
-_PROTOTYPE( int closedir, (DIR *_dirp)                                 );
-_PROTOTYPE( DIR *opendir, (const char *_dirname)                       );
-_PROTOTYPE( struct dirent *readdir, (DIR *_dirp)                       );
-_PROTOTYPE( void rewinddir, (DIR *_dirp)                               );
-
-#ifdef _MINIX
-_PROTOTYPE( int seekdir, (DIR *_dirp, off_t _loc)                      );
-_PROTOTYPE( off_t telldir, (DIR *_dirp)                                        );
-
-#define   dirfd(dirp)     ((dirp)->_fd)
-
-_PROTOTYPE( int getdents, (int _fildes, struct dirent *_buf,
-                                                       size_t _nbyte)  );
-
-#endif
-
 #endif /* _DIRENT_H */
diff --git a/include/minix/dl_eth.h b/include/minix/dl_eth.h
deleted file mode 100644 (file)
index 91a174b..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/* The eth_stat struct is used in a DL_GETSTAT request the the ehw_task. */
-
-#ifndef _ETH_HW_H
-#define _ETH_HW_H
-
-typedef struct eth_stat
-{
-  unsigned long ets_recvErr,   /* # receive errors */
-       ets_sendErr,            /* # send error */
-       ets_OVW,                /* # buffer overwrite warnings */
-       ets_CRCerr,             /* # crc errors of read */
-       ets_frameAll,           /* # frames not alligned (# bits % 8 != 0) */
-       ets_missedP,            /* # packets missed due to slow processing */
-       ets_packetR,            /* # packets received */
-       ets_packetT,            /* # packets transmitted */
-       ets_transDef,           /* # transmission defered (Tx was busy) */
-       ets_collision,          /* # collissions */
-       ets_transAb,            /* # Tx aborted due to excess collisions */
-       ets_carrSense,          /* # carrier sense lost */
-       ets_fifoUnder,          /* # FIFO underruns (processor too busy) */
-       ets_fifoOver,           /* # FIFO overruns (processor too busy) */
-       ets_CDheartbeat,        /* # times unable to transmit collision sig*/
-       ets_OWC;                /* # times out of window collision */
-} eth_stat_t;
-
-#endif /* _ETH_HW_H */
similarity index 100%
rename from common/include/minix/ds.h
rename to include/minix/ds.h
diff --git a/include/minix/md5.h b/include/minix/md5.h
deleted file mode 100644 (file)
index 20ee914..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*     $NetBSD: md5.h,v 1.5 2008/10/08 14:28:14 joerg Exp $    */
-
-/*
- * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.ORG>
- * for portability and formatting.
- */
-
-/*
- * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- * rights reserved.
- *
- * License to copy and use this software is granted provided that it
- * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm" in all material mentioning or referencing this software
- * or this function.
- * 
- * License is also granted to make and use derivative works provided
- * that such works are identified as "derived from the RSA Data
- * Security, Inc. MD5 Message-Digest Algorithm" in all material
- * mentioning or referencing the derived work.
- * 
- * RSA Data Security, Inc. makes no representations concerning either
- * the merchantability of this software or the suitability of this
- * software for any particular purpose. It is provided "as is"
- * without express or implied warranty of any kind.
- * 
- * These notices must be retained in any copies of any part of this
- * documentation and/or software.
- */
-
-#ifndef _NBCOMPAT_SYS_MD5_H_
-#define _NBCOMPAT_SYS_MD5_H_
-
-#include <stdint.h>
-
-#define MD5_DIGEST_LENGTH              16
-#define MD5_DIGEST_STRING_LENGTH       33
-
-/* MD5 context. */
-typedef struct MD5Context {
-       uint32_t state[4];      /* state (ABCD) */
-       uint32_t count[2];      /* number of bits, modulo 2^64 (lsb first) */
-       unsigned char buffer[64]; /* input buffer */
-} MD5_CTX;
-
-void   MD5Init(MD5_CTX *);
-void   MD5Update(MD5_CTX *, const unsigned char *, unsigned int);
-void   MD5Final(unsigned char[16], MD5_CTX *);
-char   *MD5End(MD5_CTX *, char *);
-char   *MD5File(const char *, char *);
-char   *MD5Data(const unsigned char *, unsigned int, char *);
-
-#endif /* !_NBCOMPAT_SYS_MD5_H_ */
similarity index 100%
rename from common/include/minix/rs.h
rename to include/minix/rs.h
diff --git a/include/minix/sha1.h b/include/minix/sha1.h
deleted file mode 100644 (file)
index e56234c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*     $NetBSD: sha1.h,v 1.6 2008/10/08 14:28:14 joerg Exp $   */
-
-/*
- * SHA-1 in C
- * By Steve Reid <steve@edmweb.com>
- * 100% Public Domain
- */
-
-#ifndef _NBCOMPAT_SYS_SHA1_H_
-#define        _NBCOMPAT_SYS_SHA1_H_
-
-#include <stdint.h>
-
-#define SHA1_DIGEST_LENGTH             20
-#define SHA1_DIGEST_STRING_LENGTH      41
-
-typedef struct {
-       uint32_t state[5];
-       uint32_t count[2];  
-       unsigned char buffer[64];
-} SHA1_CTX;
-  
-void   SHA1Transform(uint32_t state[5], const unsigned char buffer[64]);
-void   SHA1Init(SHA1_CTX *context);
-void   SHA1Update(SHA1_CTX *context, const unsigned char *data, unsigned int len);
-void   SHA1Final(unsigned char digest[20], SHA1_CTX *context);
-char   *SHA1End(SHA1_CTX *, char *);
-char   *SHA1File(char *, char *);
-char   *SHA1Data(const unsigned char *, size_t, char *);
-
-#endif /* _NBCOMPAT_SYS_SHA1_H_ */
diff --git a/include/minix/sha2.h b/include/minix/sha2.h
deleted file mode 100644 (file)
index b571098..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*     $FreeBSD: src/sys/crypto/sha2/sha2.h,v 1.1.2.1 2001/07/03 11:01:36 ume Exp $    */
-/*     $KAME: sha2.h,v 1.3 2001/03/12 08:27:48 itojun Exp $    */
-
-/*
- * sha2.h
- *
- * Version 1.0.0beta1
- *
- * Written by Aaron D. Gifford <me@aarongifford.com>
- *
- * Copyright 2000 Aaron D. Gifford.  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. Neither the name of the copyright holder nor the names of contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``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(S) OR CONTRIBUTOR(S) 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 __SHA2_H__
-#define __SHA2_H__
-
-#define SHA2_BYTE_ORDER                0x04030201
-#define SHA2_LITTLE_ENDIAN     0x04030201
-#define SHA2_BIG_ENDIAN                0x01020204
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*** SHA-256/384/512 Various Length Definitions ***********************/
-#define SHA256_BLOCK_LENGTH            64
-#define SHA256_DIGEST_LENGTH           32
-#define SHA256_DIGEST_STRING_LENGTH    (SHA256_DIGEST_LENGTH * 2 + 1)
-#define SHA384_BLOCK_LENGTH            128
-#define SHA384_DIGEST_LENGTH           48
-#define SHA384_DIGEST_STRING_LENGTH    (SHA384_DIGEST_LENGTH * 2 + 1)
-#define SHA512_BLOCK_LENGTH            128
-#define SHA512_DIGEST_LENGTH           64
-#define SHA512_DIGEST_STRING_LENGTH    (SHA512_DIGEST_LENGTH * 2 + 1)
-
-#ifdef __minix
-#include <assert.h>
-#include <string.h>
-#include <sys/types.h>
-#include <minix/u64.h>
-
-typedef u8_t u_int8_t; /* 1-byte  (8-bits)  */
-typedef u32_t u_int32_t;       /* 4-bytes (32-bits) */
-typedef u64_t u_int64_t;       /* 8-bytes (64-bits) */
-
-#if !defined(__LONG_LONG_SUPPORTED)
-#define MINIX_64BIT    1
-#endif
-
-#define SHA2_BYTE_ORDER                0x04030201
-#define SHA2_LITTLE_ENDIAN     0x04030201
-#define SHA2_BIG_ENDIAN                0x01020204
-#endif
-
-/*** SHA-256/384/512 Context Structures *******************************/
-typedef struct _SHA256_CTX {
-       u_int32_t       state[8];
-       u_int64_t       bitcount;
-       u_int8_t        buffer[SHA256_BLOCK_LENGTH];
-} SHA256_CTX;
-typedef struct _SHA512_CTX {
-       u_int64_t       state[8];
-       u_int64_t       bitcount[2];
-       u_int8_t        buffer[SHA512_BLOCK_LENGTH];
-} SHA512_CTX;
-
-typedef SHA512_CTX SHA384_CTX;
-
-/*** SHA-256/384/512 Function Prototypes ******************************/
-void SHA256_Init(SHA256_CTX *);
-void SHA256_Update(SHA256_CTX*, const u_int8_t*, size_t);
-void SHA256_Final(u_int8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
-char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]);
-char* SHA256_Data(const u_int8_t*, size_t, u_int8_t *);
-char *SHA256_File(char *, char *);
-
-void SHA384_Init(SHA384_CTX*);
-void SHA384_Update(SHA384_CTX*, const u_int8_t*, size_t);
-void SHA384_Final(u_int8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
-char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
-char* SHA384_Data(const u_int8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
-char *SHA384_File(char *, char *);
-
-void SHA512_Init(SHA512_CTX*);
-void SHA512_Update(SHA512_CTX*, const u_int8_t*, size_t);
-void SHA512_Final(u_int8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
-char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
-char* SHA512_Data(const u_int8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
-char *SHA512_File(char *, char *);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __SHA2_H__ */
-
-
-
-/*
- * $PchId: sha2.h,v 1.1 2005/06/28 14:29:33 philip Exp $
- */
index 1c7ba40be4f34317c4f63bfa557699379f4da778..68c6b67886c08bc29939015f1477d1838d7324d0 100644 (file)
@@ -1,159 +1,9 @@
-/* The <sys/types.h> header contains important data type definitions.
- * It is considered good programming practice to use these definitions,
- * instead of the underlying base type.  By convention, all type names end
- * with _t.
- */
+#ifndef _MINIX_TYPES_H_
+#define _MINIX_TYPES_H_
 
-#ifndef _TYPES_H
-#define _TYPES_H
-
-#ifndef _MINIX_ANSI_H
+/* Dummy file used in legacy (and shared) minix includes. */
 #include <minix/ansi.h>
-#endif
-
-typedef unsigned char   u8_t;     /* 8 bit type */
-typedef unsigned short u16_t;     /* 16 bit type */
-typedef signed char     i8_t;      /* 8 bit signed type */
-typedef short          i16_t;      /* 16 bit signed type */
-
-#if __SIZEOF_LONG__ > 4
-/* compiling with gcc on some (e.g. x86-64) platforms */
-typedef unsigned int  u32_t;      /* 32 bit type */
-typedef int           i32_t;      /* 32 bit signed type */
-#else
-/* default for ACK or gcc on 32 bit platforms */
-typedef unsigned long  u32_t;     /* 32 bit type */
-typedef long           i32_t;      /* 32 bit signed type */
-#endif
-
-#if !defined(__LONG_LONG_SUPPORTED)
-typedef struct {
-       u32_t lo;
-       u32_t hi;
-} u64_t;
-#else
-#if __SIZEOF_LONG__ > 4
-typedef unsigned long u64_t;
-#else
-typedef unsigned long long u64_t;
-#endif
-#endif
-
-/* some Minix specific types that do not conflict with posix */
-typedef u32_t zone_t;     /* zone number */
-typedef u32_t block_t;    /* block number */
-typedef u32_t bit_t;      /* bit number in a bit map */
-typedef u16_t zone1_t;    /* zone number for V1 file systems */
-typedef u32_t bitchunk_t; /* collection of bits in a bitmap */
-
-/* ANSI C makes writing down the promotion of unsigned types very messy.  When
- * sizeof(short) == sizeof(int), there is no promotion, so the type stays
- * unsigned.  When the compiler is not ANSI, there is usually no loss of
- * unsignedness, and there are usually no prototypes so the promoted type
- * doesn't matter.  The use of types like Ino_t is an attempt to use ints
- * (which are not promoted) while providing information to the reader.
- */
-
-typedef unsigned long  Ino_t;
-
-#if defined(_MINIX) || defined(__minix)
-
-/* The type size_t holds all results of the sizeof operator.  At first glance,
- * it seems obvious that it should be an unsigned int, but this is not always
- * the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit
- * integers. When one asks for the size of a 70K struct or array, the result
- * requires 17 bits to express, so size_t must be a long type.  The type
- * ssize_t is the signed version of size_t.
- */
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef unsigned int size_t;
-#endif
-
-#ifndef _SSIZE_T
-#define _SSIZE_T
-typedef int ssize_t;
-#endif
-
-#ifndef _TIME_T
-#define _TIME_T
-typedef long time_t;              /* time in sec since 1 Jan 1970 0000 GMT */
-#endif
-
-#ifndef _CLOCK_T
-#define _CLOCK_T
-typedef long clock_t;             /* unit for system accounting */
-#endif
-
-#ifndef _SIGSET_T
-#define _SIGSET_T
-typedef unsigned long sigset_t;
-#endif
+#include <sys/types.h>
+#include <sys/sigtypes.h>
 
-#ifndef _KEY_T
-#define _KEY_T
-typedef long key_t;
 #endif
-
-/* Open Group Base Specifications Issue 6 (not complete) */
-typedef long useconds_t;       /* Time in microseconds */
-
-typedef u32_t          dev_t;     /* holds (major|minor) device pair */
-typedef u32_t          big_dev_t;
-
-/* Types used in disk, inode, etc. data structures.
- * Some u64_t should be i64_t, but anyway with old libc we use .lo only.
- */
-typedef u32_t          gid_t;     /* group id */
-typedef u32_t          big_gid_t;  /* group id */
-typedef unsigned long  ino_t;     /* i-node number (V3 filesystem) */
-typedef u64_t          big_ino_t;  /* i-node number (V3 filesystem) */
-typedef unsigned short mode_t;    /* file type and permissions bits */
-typedef u32_t          big_mode_t; /* file type and permissions bits */
-typedef short          nlink_t;           /* number of links to a file */
-typedef u32_t          big_nlink_t;/* number of links to a file */
-typedef long          off_t;      /* offset within a file */
-typedef u64_t          big_off_t;  /* offset within a file */
-typedef int            pid_t;     /* process id (must be signed) */
-typedef u32_t          uid_t;     /* user id */
-typedef u32_t          big_uid_t;  /* user id */
-typedef unsigned long  fsblkcnt_t; /* File system block count */
-typedef unsigned long  fsfilcnt_t; /* File system file count */
-typedef u32_t          blkcnt_t;   /* File system block count */
-typedef unsigned long  blksize_t;  /* File system block size */
-
-/* Signal handler type, e.g. SIG_IGN */
-typedef void _PROTOTYPE( (*sighandler_t), (int) );
-typedef sighandler_t sig_t;
-
-/* Compatibility with other systems */
-typedef unsigned char  u_char;
-typedef unsigned short u_short;
-typedef unsigned int   u_int;
-typedef unsigned long  u_long;
-typedef char           *caddr_t;
-
-/* Devices. */
-#define MAJOR              8    /* major device = (dev>>MAJOR) & 0377 */
-#define MINOR              0    /* minor device = (dev>>MINOR) & 0377 */
-
-#ifndef minor
-#define minor(dev)      (((dev) >> MINOR) & 0xff)
-#endif
-
-#ifndef major
-#define major(dev)      (((dev) >> MAJOR) & 0xff)
-#endif
-
-#ifndef makedev
-#define makedev(major, minor)   \
-                        ((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
-#endif
-
-#endif /* _MINIX || __minix */
-
-#if defined(_MINIX)
-typedef unsigned int    uint;           /* Sys V compatibility */
-#endif
-
-#endif /* _TYPES_H */
similarity index 100%
rename from common/include/minix/vm.h
rename to include/minix/vm.h
similarity index 100%
rename from nbsd_include/mntopts.h
rename to include/mntopts.h
similarity index 100%
rename from nbsd_include/monetary.h
rename to include/monetary.h
similarity index 100%
rename from nbsd_include/mqueue.h
rename to include/mqueue.h
index 06e2c756d2b6849eaef6c4630bb05d62021e67b0..23b993d9816dc4624a663afebf8402912e2d313d 100644 (file)
@@ -38,9 +38,7 @@
 #define        _NDBM_H_
 
 #include <sys/cdefs.h>
-#ifndef __minix
 #include <sys/featuretest.h>
-#endif
 #include <stdint.h>
 #include <db.h>
 
@@ -53,7 +51,7 @@
 #define DBM_INSERT      0
 #define DBM_REPLACE     1
 
-#if defined(_NETBSD_SOURCE) || defined(_MINIX)
+#if defined(_NETBSD_SOURCE)
 /*
  * The db(3) support for ndbm(3) always appends this suffix to the
  * file name to avoid overwriting the user's original database.
@@ -67,32 +65,25 @@ typedef struct {
 } datum;
 
 typedef DB DBM;
-#if defined(_NETBSD_SOURCE) || defined(_MINIX)
+#if defined(_NETBSD_SOURCE)
 #define        dbm_pagfno(a)   DBM_PAGFNO_NOT_AVAILABLE
 #endif
 
-/* __BEGIN_DECLS */
+__BEGIN_DECLS
 void    dbm_close(DBM *);
 DBM    *dbm_open(const char *, int, mode_t);
 int     dbm_error(DBM *);
 int     dbm_clearerr(DBM *);
-#if defined(_NETBSD_SOURCE) || defined(_MINIX)
+#if defined(_NETBSD_SOURCE)
 int     dbm_dirfno(DBM *);
 #endif
-#if !defined(__LIBC12_SOURCE__) && !defined(__minix)
+#ifndef __LIBC12_SOURCE__
 int     dbm_delete(DBM *, datum)               __RENAME(__dbm_delete13);
 datum   dbm_fetch(DBM *, datum)                __RENAME(__dbm_fetch13);
 datum   dbm_firstkey(DBM *)                    __RENAME(__dbm_firstkey13);
 datum   dbm_nextkey(DBM *)                     __RENAME(__dbm_nextkey13);
 int     dbm_store(DBM *, datum, datum, int)    __RENAME(__dbm_store13);
 #endif
-#if defined(__minix)
-int     dbm_delete(DBM *, datum);
-datum   dbm_fetch(DBM *, datum);
-datum   dbm_firstkey(DBM *);
-datum   dbm_nextkey(DBM *);
-int     dbm_store(DBM *, datum, datum, int);
-#endif
-/* __END_DECLS */
+__END_DECLS
 
 #endif /* !_NDBM_H_ */
diff --git a/include/net/gen/nameser.h b/include/net/gen/nameser.h
deleted file mode 100644 (file)
index 1f7f608..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 1983, 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- *     @(#)nameser.h   5.24 (Berkeley) 6/1/90
- */
-
-/*
-server/ip/gen/nameser.h
-
-Created Sept 18, 1991 by Philip Homburg
-*/
-
-#ifndef __SERVER__IP__GEN__NAEMSER_H__
-#define __SERVER__IP__GEN__NAEMSER_H__
-
-typedef struct dns_hdr
-{
-       u16_t dh_id;
-       u8_t dh_flag1;
-       u8_t dh_flag2;
-       u16_t dh_qdcount;
-       u16_t dh_ancount;
-       u16_t dh_nscount;
-       u16_t dh_arcount;
-} dns_hdr_t;
-
-typedef dns_hdr_t HEADER;
-
-#define DHF_QR         0x80
-#define DHF_OPCODE     0x78
-#define DHF_AA         0x04
-#define DHF_TC         0x02
-#define DHF_RD         0x01
-
-#define DHF_RA         0x80
-#define DHF_PR         0x40
-#define DHF_UNUSED     0x30
-#define DHF_RCODE      0x0F
-
-/*
-Define constants based on rfc883
-*/
-#define PACKETSZ       512             /* maximum packet size */
-#define MAXDNAME       256             /* maximum domain name */
-#define MAXCDNAME      255             /* maximum compressed domain name */
-#define MAXLABEL       63              /* maximum length of domain label */
-       /* Number of bytes of fixed size data in query structure */
-#define QFIXEDSZ       4
-       /* number of bytes of fixed size data in resource record */
-#define RRFIXEDSZ      10
-#define INDIR_MASK     0xc0
-                       /* Defines for handling compressed domain names */
-
-/*
-Opcodes for DNS
-*/
-
-#define QUERY          0x0                     /* standard query */
-#define IQUERY         0x1                     /* inverse query */
-
-/*
-Error codes
-*/
-#define NOERROR                0                       /* no error */
-#define FORMERR                1                       /* format error */
-#define SERVFAIL       2                       /* server failure */
-#define NXDOMAIN       3                       /* non existent domain */
-#define NOTIMP         4                       /* not implemented */
-#define REFUSED                5                       /* query refused */
-       /* non standard */
-#define NOCHANGE       0xf                     /* update failed to change db */
-
-/* Valid types */
-
-#define T_A            1               /* host address */
-#define T_NS           2               /* authoritative server */
-#define T_MD           3               /* mail destination */
-#define T_MF           4               /* mail forwarder */
-#define T_CNAME                5               /* connonical name */
-#define T_SOA          6               /* start of authority zone */
-#define T_MB           7               /* mailbox domain name */
-#define T_MG           8               /* mail group member */
-#define T_MR           9               /* mail rename name */
-#define T_NULL         10              /* null resource record */
-#define T_WKS          11              /* well known service */
-#define T_PTR          12              /* domain name pointer */
-#define T_HINFO                13              /* host information */
-#define T_MINFO                14              /* mailbox information */
-#define T_MX           15              /* mail routing information */
-#define T_TXT          16              /* text strings */
-       /* non standard */
-#define T_UINFO                100             /* user (finger) information */
-#define T_UID          101             /* user ID */
-#define T_GID          102             /* group ID */
-#define T_UNSPEC       103             /* Unspecified format (binary data) */
-       /* Query type values which do not appear in resource records */
-#define T_AXFR         252             /* transfer zone of authority */
-#define T_MAILB                253             /* transfer mailbox records */
-#define T_MAILA                254             /* transfer mail agent records */
-#define T_ANY          255             /* wildcard match */
-
-/* Valid classes */
-
-#define C_IN           1                       /* the internet */
-#define C_CHAOS                3                       /* for chaos net (MIT) */
-#define C_HS           4               /* for Hesiod name server at MIT */
-
-#define C_ANY          255                     /* wildcard */
-
-#endif /* __SERVER__IP__GEN__NAEMSER_H__ */
diff --git a/include/net/gen/netdb.h b/include/net/gen/netdb.h
deleted file mode 100644 (file)
index 35850f0..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-/*-
- * Copyright (c) 1980, 1983, 1988 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.
- *
- *     @(#)netdb.h     5.15 (Berkeley) 4/3/91
- */
-
-#ifndef _NETDB_H_
-#define _NETDB_H_
-
-#define        _PATH_HEQUIV    "/etc/hosts.equiv"
-#define        _PATH_HOSTS     "/etc/hosts"
-#define        _PATH_NETWORKS  "/etc/networks"
-#define        _PATH_PROTOCOLS "/etc/protocols"
-#define        _PATH_SERVICES  "/etc/services"
-#define        _PATH_SERVACCES "/etc/serv.access"
-
-/*
- * Structures returned by network data base library.  All addresses are
- * supplied in host order, and returned in network order (suitable for
- * use in system calls).
- */
-struct hostent {
-       char    *h_name;        /* official name of host */
-       char    **h_aliases;    /* alias list */
-       int     h_addrtype;     /* host address type */
-       int     h_length;       /* length of address */
-       char    **h_addr_list;  /* list of addresses from name server */
-#define        h_addr  h_addr_list[0]  /* address, for backward compatiblity */
-};
-
-/*
- * Assumption here is that a network number
- * fits in 32 bits -- probably a poor one.
- */
-struct netent {
-       char            *n_name;        /* official name of net */
-       char            **n_aliases;    /* alias list */
-       int             n_addrtype;     /* net address type */
-       unsigned long   n_net;          /* network # */
-};
-
-struct servent {
-       char    *s_name;        /* official service name */
-       char    **s_aliases;    /* alias list */
-       int     s_port;         /* port # */
-       char    *s_proto;       /* protocol to use */
-};
-
-struct protoent {
-       char    *p_name;        /* official protocol name */
-       char    **p_aliases;    /* alias list */
-       int     p_proto;        /* protocol # */
-};
-
-/*
- * Error return codes from gethostbyname() and gethostbyaddr()
- * (left in extern int h_errno).
- */
-extern int h_errno;
-
-#define        HOST_NOT_FOUND  1 /* Authoritative Answer Host not found */
-#define        TRY_AGAIN       2 /* Non-Authoritive Host not found, or SERVERFAIL */
-#define        NO_RECOVERY     3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
-#define        NO_DATA         4 /* Valid name, no data record of requested type */
-#define        NO_ADDRESS      NO_DATA         /* no address, look for MX record */
-
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
-
-void           endhostent _ARGS((void));
-void           endnetent _ARGS((void));
-void           endprotoent _ARGS((void));
-void           endservent _ARGS((void));
-struct hostent *gethostbyaddr _ARGS((const char *, int, int));
-struct hostent *gethostbyname _ARGS((const char *));
-struct hostent *gethostent _ARGS((void));
-struct netent  *getnetbyaddr _ARGS((long, int)); /* u_long? */
-struct netent  *getnetbyname _ARGS((const char *));
-struct netent  *getnetent _ARGS((void));
-struct protoent        *getprotobyname _ARGS((const char *));
-struct protoent        *getprotobynumber _ARGS((int));
-struct protoent        *getprotoent _ARGS((void));
-struct servent *getservbyname _ARGS((const char *, const char *));
-struct servent *getservbyport _ARGS((int, const char *));
-struct servent *getservent _ARGS((void));
-void           herror _ARGS((const char *));
-void           sethostent _ARGS((int));
-/* void                sethostfile _ARGS((const char *)); */
-void           setnetent _ARGS((int));
-void           setprotoent _ARGS((int));
-void           setservent _ARGS((int));
-#ifdef _MINIX
-int            servxcheck _ARGS((unsigned long _peer, const char *_service,
-                       void (*_logf) _ARGS((int _pass, const char *_name))));
-char           *servxfile _ARGS((const char *_file));
-#endif
-
-/*  
- * The definitions below are based on 
- * http://www.opengroup.org/onlinepubs/009695399/basedefs/netdb.h.html
- */
-
-#ifdef _POSIX_SOURCE
-
-/* headers exposed by netdb.h */
-#include <inttypes.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-
-/* struct for use with getaddrinfo() */
-struct addrinfo
-{
-       int              ai_flags;     /* Input flags */
-       int              ai_family;    /* Address family of socket */
-       int              ai_socktype;  /* Socket type */
-       int              ai_protocol;  /* Protocol of socket */
-       socklen_t        ai_addrlen;   /* Length of socket address */
-       struct sockaddr *ai_addr;      /* Socket address of socket */
-       char            *ai_canonname; /* Canonical name of service location */
-       struct addrinfo *ai_next;      /* Pointer to next in list */
-};
-
-/* values for struct addrinfo.ai_flags */
-#define AI_PASSIVE     0x00000001
-#define AI_CANONNAME   0x00000002
-#define AI_NUMERICHOST 0x00000004
-#define AI_NUMERICSERV 0x00000008
-/* 
-#define AI_V4MAPPED    0x00000010
-#define AI_ALL         0x00000020
-#define AI_ADDRCONFIG  0x00000040
-*/
-
-/* flags for getnameinfo() */
-/* #define NI_NOFQDN   0x00000001 */
-#define NI_NUMERICHOST 0x00000002
-#define NI_NAMEREQD    0x00000004
-#define NI_NUMERICSERV 0x00000008
-/* #define NI_NUMERICSCOPE     0x00000010 */
-#define NI_DGRAM       0x00000020
-
-/* error values for getaddrinfo() and getnameinfo() */
-#define EAI_AGAIN      1
-#define EAI_BADFLAGS   2
-#define EAI_FAIL       3
-#define EAI_FAMILY     4
-#define EAI_MEMORY     5
-#define EAI_NONAME     6
-#define EAI_SERVICE    7
-#define EAI_SOCKTYPE   8
-#define EAI_SYSTEM     9
-#define EAI_OVERFLOW   10
-
-/* getaddrinfo() and friends */
-void freeaddrinfo(struct addrinfo *ai);
-int getaddrinfo(const char *nodename,
-       const char *servname,
-       const struct addrinfo *hints,
-       struct addrinfo **res);
-int getnameinfo(const struct sockaddr *sa, socklen_t salen,
-       char *node, socklen_t nodelen, char *service,
-       socklen_t servicelen, int flags);
-const char *gai_strerror(int ecode);
-
-#endif
-
-#endif /* !_NETDB_H_ */
-
diff --git a/include/net/gen/resolv.h b/include/net/gen/resolv.h
deleted file mode 100644 (file)
index 6477930..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 1983, 1987, 1989 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- *
- *     @(#)resolv.h    5.10 (Berkeley) 6/1/90
- */
-#ifndef _NET__GEN__RESOLV_H
-#define _NET__GEN__RESOLV_H
-
-/*
- * Resolver configuration file.
- * Normally not present, but may contain the address of the
- * inital name server(s) to query and the domain search list.
- */
-
-#ifndef _PATH_RESCONF
-#define _PATH_RESCONF        "/etc/resolv.conf"
-#endif
-
-/*
- * Global defines and variables for resolver stub.
- */
-#define        MAXNS           3               /* max # name servers we'll track */
-#define        MAXDFLSRCH      3               /* # default domain levels to try */
-#define        MAXDNSRCH       6               /* max # domains in search path */
-#define        LOCALDOMAINPARTS 2              /* min levels in name that is "local" */
-
-#define        RES_TIMEOUT     5               /* min. seconds between retries */
-
-#define NAMESERVER_PORT        53
-
-struct state {
-       int     retrans;                /* retransmition time interval */
-       int     retry;                  /* number of times to retransmit */
-       long    options;                /* option flags - see below. */
-       int     nscount;                /* number of name servers */
-       ipaddr_t nsaddr_list[MAXNS];    /* address of name server */
-#define        nsaddr  nsaddr_list[0]          /* for backward compatibility */
-       u16_t   nsport_list[MAXNS];     /* port of name server */
-       u16_t   id;                     /* current packet id */
-       char    defdname[MAXDNAME];     /* default domain */
-       char    *dnsrch[MAXDNSRCH+1];   /* components of domain to search */
-};
-
-/*
- * Resolver options
- */
-#define RES_INIT       0x0001          /* address initialized */
-#define RES_DEBUG      0x0002          /* print debug messages */
-#define RES_AAONLY     0x0004          /* authoritative answers only */
-#define RES_USEVC      0x0008          /* use virtual circuit */
-#define RES_PRIMARY    0x0010          /* query primary server only */
-#define RES_IGNTC      0x0020          /* ignore trucation errors */
-#define RES_RECURSE    0x0040          /* recursion desired */
-#define RES_DEFNAMES   0x0080          /* use default domain name */
-#define RES_STAYOPEN   0x0100          /* Keep TCP socket open */
-#define RES_DNSRCH     0x0200          /* search up local domain tree */
-
-#define RES_DEFAULT    (RES_RECURSE | RES_DEFNAMES | RES_DNSRCH )
-
-extern struct state _res;
-
-struct rrec;
-
-int res_init _ARGS(( void ));
-int res_mkquery _ARGS(( int op, const char *dname, int cls, int type,
-       const char *data, int datalen, const struct rrec *newrr,
-       char *buf, int buflen ));
-int res_query _ARGS(( char *name, int cls, int type, u8_t *answer, 
-       int anslen ));
-int res_querydomain _ARGS(( char *name, char *domain, int cls, int type, 
-       u8_t *answer, int anslen ));
-int res_search _ARGS(( char *name, int cls, int type, u8_t *answer, 
-       int anslen ));
-int res_send _ARGS(( const char *buf, int buflen, char *answer, int anslen ));
-void _res_close _ARGS(( void ));
-
-int dn_comp _ARGS(( const u8_t *exp_dn, u8_t *comp_dn, int length, 
-       u8_t **dnptrs, u8_t **lastdnptr ));
-int dn_expand  _ARGS(( const u8_t *msg, const u8_t *eomorig,
-       const u8_t *comp_dn, u8_t *exp_dn, int length ));
-int dn_skipname _ARGS(( const u8_t *comp_dn, const u8_t *eom ));
-
-char *__hostalias _ARGS(( const char *name ));
-
-u16_t _getshort _ARGS(( const u8_t *msgp ));
-u32_t _getlong _ARGS(( const u8_t *msgp ));
-void __putshort _ARGS(( u16_t s, u8_t *msgp ));
-void __putlong _ARGS(( u32_t l, u8_t *msgp ));
-
-void p_query _ARGS(( char *msg ));
-
-#endif /* _NET__GEN__RESOLV_H */
index 64faead63b5de55d9e398a45c2d73c9e3a75b566..bc036016e45e73e8b9987572267f7b6a03accfae 100644 (file)
@@ -1,82 +1,5 @@
 /*
-The following macro definitions convert to and from the network standard byte
-order. The macros with their name in lower case guarantee to evaluate their
-argument exactly once. The function of the macros is encoded in their names;
-htons means convert a (unsigned) short in host byte order to network byte order.
-*/
-
-#ifndef _NET__HTON_H
-#define _NET__HTON_H
-
-#include <minix/sys_config.h>
-
-extern u16_t _tmp;
-extern u32_t _tmp_l;
-
-/* Find out about the byte order. */
-
-/* assume <minix/config.h> is included, let's check */
-#if (_MINIX_CHIP == 0)
-#include "_MINIX_CHIP macro not set, include <minix/config.h>"
-#endif
-
-#if (_MINIX_CHIP == _CHIP_INTEL)
-#define LITTLE_ENDIAN  1
-#endif
-
-#if (_MINIX_CHIP == _CHIP_M68000 || _MINIX_CHIP == _CHIP_SPARC)
-#define BIG_ENDIAN     1
-#endif
-
-#if (LITTLE_ENDIAN) && (BIG_ENDIAN)
-#include "both LITTLE_ENDIAN and BIG_ENDIAN are defined"
-                       /* LITTLE_ENDIAN and BIG_ENDIAN are both defined */
-#endif
-
-#if !(LITTLE_ENDIAN) && !(BIG_ENDIAN)
-#include "neither LITTLE_ENDIAN nor BIG_ENDIAN is defined"
-                       /* LITTLE_ENDIAN and BIG_ENDIAN are both NOT defined */
-#endif
-
-#if LITTLE_ENDIAN
-#define HTONS(x) ( ( (((unsigned short)(x)) >>8) & 0xff) | \
-               ((((unsigned short)(x)) & 0xff)<<8) )
-#define NTOHS(x) ( ( (((unsigned short)(x)) >>8) & 0xff) | \
-               ((((unsigned short)(x)) & 0xff)<<8) )
-#define HTONL(x) ((((x)>>24) & 0xffL) | (((x)>>8) & 0xff00L) | \
-               (((x)<<8) & 0xff0000L) | (((x)<<24) & 0xff000000L))
-#define NTOHL(x) ((((x)>>24) & 0xffL) | (((x)>>8) & 0xff00L) | \
-               (((x)<<8) & 0xff0000L) | (((x)<<24) & 0xff000000L))
-
-#if _WORD_SIZE > 2
-#define htons(x) (_tmp=(x), ((_tmp>>8) & 0xff) | ((_tmp<<8) & 0xff00))
-#define ntohs(x) (_tmp=(x), ((_tmp>>8) & 0xff) | ((_tmp<<8) & 0xff00))
-#define htonl(x) (_tmp_l=(x), ((_tmp_l>>24) & 0xffL) | \
-               ((_tmp_l>>8) & 0xff00L) | \
-               ((_tmp_l<<8) & 0xff0000L) | ((_tmp_l<<24) & 0xff000000L))
-#define ntohl(x) (_tmp_l=(x), ((_tmp_l>>24) & 0xffL) \
-               | ((_tmp_l>>8) & 0xff00L) | \
-               ((_tmp_l<<8) & 0xff0000L) | ((_tmp_l<<24) & 0xff000000L))
-
-#else /* _WORD_SIZE == 2 */
-/* The above macros are too unwieldy for a 16-bit machine. */
-u16_t htons(u16_t x);
-u16_t ntohs(u16_t x);
-u32_t htonl(u32_t x);
-u32_t ntohl(u32_t x);
-#endif /* _WORD_SIZE == 2 */
-
-#endif /* LITTLE_ENDIAN */
-
-#if BIG_ENDIAN
-#define htons(x) (x)
-#define HTONS(x) (x)
-#define ntohs(x) (x)
-#define NTOHS(x) (x)
-#define htonl(x) (x)
-#define HTONL(x) (x)
-#define ntohl(x) (x)
-#define NTOHL(x) (x)
-#endif /* BIG_ENDIAN */
-
-#endif /* _NET__HTON_H */
+ * Dummy file for Minix old includes compatibility.
+ */
+#include <sys/cdefs.h>
+#include <sys/endian.h>
index e49449acf57db51023076ec9c1d33e27aabfbabb..39446f23f2dc1f77396c51588ea43d035c385906 100644 (file)
@@ -1,3 +1,6 @@
-/*
-net/if.h
-*/
+#ifndef _NET_IF_H_
+#define _NET_IF_H_
+
+#define        IFF_UP          0x0001          /* interface is up */
+
+#endif /* _NET_IF_H_ */
diff --git a/include/net/ioctl.h b/include/net/ioctl.h
deleted file mode 100644 (file)
index 9efb13a..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*     net/ioctl.h - Network ioctl() command codes.    Author: Kees J. Bot
- *                                                             23 Nov 2002
- *
- */
-
-#ifndef _NET__IOCTL_H
-#define _NET__IOCTL_H
-
-#include <minix/ioctl.h>
-#include <sys/un.h>
-
-#ifndef _SOCKLEN_T
-#define _SOCKLEN_T
-typedef int32_t socklen_t;
-#endif /* _SOCKLEN_T */
-
-#define MSG_CONTROL_MAX (1024 - sizeof(socklen_t))
-struct msg_control
-{
-       char            msg_control[MSG_CONTROL_MAX];
-       socklen_t       msg_controllen;
-};
-
-
-/* Network ioctls. */
-#define NWIOSETHOPT    _IOW('n', 16, struct nwio_ethopt)
-#define NWIOGETHOPT    _IOR('n', 17, struct nwio_ethopt)
-#define NWIOGETHSTAT   _IOR('n', 18, struct nwio_ethstat)
-
-#define NWIOARPGIP     _IORW('n',20, struct nwio_arp)
-#define NWIOARPGNEXT   _IORW('n',21, struct nwio_arp)
-#define NWIOARPSIP     _IOW ('n',22, struct nwio_arp)
-#define NWIOARPDIP     _IOW ('n',23, struct nwio_arp)
-
-#define NWIOSIPCONF2   _IOW('n', 32, struct nwio_ipconf2)
-#define NWIOSIPCONF    _IOW('n', 32, struct nwio_ipconf)
-#define NWIOGIPCONF2   _IOR('n', 33, struct nwio_ipconf2)
-#define NWIOGIPCONF    _IOR('n', 33, struct nwio_ipconf)
-#define NWIOSIPOPT     _IOW('n', 34, struct nwio_ipopt)
-#define NWIOGIPOPT     _IOR('n', 35, struct nwio_ipopt)
-
-#define NWIOGIPOROUTE  _IORW('n', 40, struct nwio_route)
-#define NWIOSIPOROUTE  _IOW ('n', 41, struct nwio_route)
-#define NWIODIPOROUTE  _IOW ('n', 42, struct nwio_route)
-#define NWIOGIPIROUTE  _IORW('n', 43, struct nwio_route)
-#define NWIOSIPIROUTE  _IOW ('n', 44, struct nwio_route)
-#define NWIODIPIROUTE  _IOW ('n', 45, struct nwio_route)
-
-#define NWIOSTCPCONF   _IOW('n', 48, struct nwio_tcpconf)
-#define NWIOGTCPCONF   _IOR('n', 49, struct nwio_tcpconf)
-#define NWIOTCPCONN    _IOW('n', 50, struct nwio_tcpcl)
-#define NWIOTCPLISTEN  _IOW('n', 51, struct nwio_tcpcl)
-#define NWIOTCPATTACH  _IOW('n', 52, struct nwio_tcpatt)
-#define NWIOTCPSHUTDOWN        _IO ('n', 53)
-#define NWIOSTCPOPT    _IOW('n', 54, struct nwio_tcpopt)
-#define NWIOGTCPOPT    _IOR('n', 55, struct nwio_tcpopt)
-#define NWIOTCPPUSH    _IO ('n', 56)
-#define NWIOTCPLISTENQ _IOW('n', 57, int)
-#define NWIOGTCPCOOKIE _IOR('n', 58, struct tcp_cookie)
-#define NWIOTCPACCEPTTO        _IOW('n', 59, struct tcp_cookie)
-#define NWIOTCPGERROR  _IOR('n', 60, int)
-
-#define NWIOSUDPOPT    _IOW('n', 64, struct nwio_udpopt)
-#define NWIOGUDPOPT    _IOR('n', 65, struct nwio_udpopt)
-#define NWIOUDPPEEK    _IOR('n', 66, struct udp_io_hdr)
-
-#define NWIOGUDSFADDR   _IOR ('n', 67, struct sockaddr_un) /* recvfrom() */
-#define NWIOSUDSTADDR  _IOW ('n', 68, struct sockaddr_un) /* sendto() */
-#define NWIOSUDSADDR   _IOW ('n', 69, struct sockaddr_un) /* bind() */
-#define NWIOGUDSADDR   _IOR ('n', 70, struct sockaddr_un) /* getsockname() */
-#define NWIOGUDSPADDR  _IOR ('n', 71, struct sockaddr_un) /* getpeername() */
-#define NWIOSUDSTYPE   _IOW ('n', 72, int)                /* socket() */
-#define NWIOSUDSBLOG   _IOW ('n', 73, int)                /* listen() */
-#define NWIOSUDSCONN   _IOW ('n', 74, struct sockaddr_un) /* connect() */
-#define NWIOSUDSSHUT    _IOW ('n', 75, int)              /* shutdown() */
-#define NWIOSUDSPAIROLD        _IOW ('n', 76, short)             /* socketpair() */
-#define NWIOSUDSPAIR   _IOW ('n', 76, dev_t)             /* socketpair() */
-#define NWIOSUDSACCEPT _IOW ('n', 77, struct sockaddr_un) /* accept() */
-#define NWIOSUDSCTRL   _IOW ('n', 78, struct msg_control) /* sendmsg() */
-#define NWIOGUDSCTRL   _IORW('n', 79, struct msg_control) /* recvmsg() */
-
-#define NWIOSPSIPOPT   _IOW('n', 80, struct nwio_psipopt)
-#define NWIOGPSIPOPT   _IOR('n', 81, struct nwio_psipopt)
-
-/* setsockopt/setsockopt for unix domain sockets */
-#define NWIOGUDSSOTYPE  _IOR('n', 90, int)               /* SO_TYPE */
-#define NWIOGUDSPEERCREDOLD _IOR('n', 91, struct ucred_old)  /* SO_PEERCRED */
-#define NWIOGUDSPEERCRED _IOR('n', 91, struct ucred)     /* SO_PEERCRED */
-#define NWIOGUDSSNDBUF  _IOR('n', 92, size_t)            /* SO_SNDBUF */
-#define NWIOSUDSSNDBUF  _IOW('n', 93, size_t)            /* SO_SNDBUF */
-#define NWIOGUDSRCVBUF  _IOR('n', 94, size_t)            /* SO_RCVBUF */
-#define NWIOSUDSRCVBUF  _IOW('n', 95, size_t)            /* SO_RCVBUF */
-
-#endif /* _NET__IOCTL_H */
-
-/*
- * $PchId: ioctl.h,v 1.2 2003/07/25 14:34:03 philip Exp $
- */
index 447c943a8240e3b45d372f0983956081df3f39f7..6477cde03b7def14802decf41929563f3f0ed8ea 100644 (file)
@@ -5,15 +5,6 @@ net/netlib.h
 #ifndef _NET__NETLIB_H_
 #define _NET__NETLIB_H_
 
-#ifndef _ANSI
-#include <minix/ansi.h>
-#endif
-
-_PROTOTYPE (int iruserok, (unsigned long raddr, int superuser,
-               const char *ruser, const char *luser) );
-_PROTOTYPE (int rcmd, (char **ahost, int rport, const char *locuser, 
-               const char *remuser, const char *cmd, int *fd2p) );
-
 #define IPSTAT_DEVICE  "/dev/ipstat"
 #define ETH_DEVICE     "/dev/eth"
 #define IP_DEVICE      "/dev/ip"
similarity index 100%
rename from nbsd_include/netconfig.h
rename to include/netconfig.h
index 1b7423935a04defccdf32433e2192c0e1d5a4313..98a150d856659eb329fb76689fff008f2e9dec18 100644 (file)
@@ -1,6 +1,358 @@
+/*     $NetBSD: netdb.h,v 1.64 2010/05/05 17:12:29 christos Exp $      */
+
+/*
+ * ++Copyright++ 1980, 1983, 1988, 1993
+ * -
+ * Copyright (c) 1980, 1983, 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. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * -
+ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Digital Equipment Corporation not be used in advertising or
+ * publicity pertaining to distribution of the document or software without
+ * specific, written prior permission.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
+ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * -
+ * Portions Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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 WIDE Project and
+ *    its contributors.
+ * 4. Neither the name of the project 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 PROJECT 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 PROJECT 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.
+ * -
+ * --Copyright--
+ */
+
+/*
+ *      @(#)netdb.h    8.1 (Berkeley) 6/2/93
+ *     Id: netdb.h,v 1.22 2008/02/28 05:34:17 marka Exp
+ */
+
+#ifndef _NETDB_H_
+#define        _NETDB_H_
+
+#include <machine/ansi.h>
+#include <machine/endian_machdep.h>
+#include <sys/ansi.h>
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <inttypes.h>
+/*
+ * Data types
+ */
+#ifndef socklen_t
+typedef __socklen_t    socklen_t;
+#define        socklen_t       __socklen_t
+#endif
+
+#ifdef  _BSD_SIZE_T_
+typedef _BSD_SIZE_T_   size_t;
+#undef  _BSD_SIZE_T_
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#ifndef _PATH_HEQUIV
+#define        _PATH_HEQUIV    "/etc/hosts.equiv"
+#endif
+#ifndef _PATH_HOSTS
+#define        _PATH_HOSTS     "/etc/hosts"
+#endif
+#ifndef _PATH_NETWORKS
+#define        _PATH_NETWORKS  "/etc/networks"
+#endif
+#ifndef _PATH_PROTOCOLS
+#define        _PATH_PROTOCOLS "/etc/protocols"
+#endif
+#ifndef _PATH_SERVICES
+#define        _PATH_SERVICES  "/etc/services"
+#endif
+#ifndef _PATH_SERVICES_CDB
+#define        _PATH_SERVICES_CDB "/var/db/services.cdb"
+#endif
+#ifndef _PATH_SERVICES_DB
+#define        _PATH_SERVICES_DB "/var/db/services.db"
+#endif
+#ifdef __minix
+#define        _PATH_SERVACCES "/etc/serv.access"
+#endif
+#endif
+
+__BEGIN_DECLS
+extern int h_errno;
+extern int * __h_errno(void);
+#ifdef _REENTRANT
+#define        h_errno (*__h_errno())
+#endif
+__END_DECLS
+
+/*%
+ * Structures returned by network data base library.  All addresses are
+ * supplied in host order, and returned in network order (suitable for
+ * use in system calls).
+ */
+struct hostent {
+       char    *h_name;        /*%< official name of host */
+       char    **h_aliases;    /*%< alias list */
+       int     h_addrtype;     /*%< host address type */
+       int     h_length;       /*%< length of address */
+       char    **h_addr_list;  /*%< list of addresses from name server */
+#define        h_addr  h_addr_list[0]  /*%< address, for backward compatiblity */
+};
+
+/*%
+ * Assumption here is that a network number
+ * fits in an unsigned long -- probably a poor one.
+ */
+struct netent {
+       char            *n_name;        /*%< official name of net */
+       char            **n_aliases;    /*%< alias list */
+       int             n_addrtype;     /*%< net address type */
+#if (defined(__sparc__) && defined(_LP64)) || \
+    (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _BIG_ENDIAN))
+       int             __n_pad0;       /* ABI compatibility */
+#endif
+       uint32_t        n_net;          /*%< network # */
+#if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) || \
+    (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _LITTLE_ENDIAN))
+       int             __n_pad0;       /* ABI compatibility */
+#endif
+};
+
+struct servent {
+       char    *s_name;        /*%< official service name */
+       char    **s_aliases;    /*%< alias list */
+       int     s_port;         /*%< port # */
+       char    *s_proto;       /*%< protocol to use */
+};
+
+struct protoent {
+       char    *p_name;        /*%< official protocol name */
+       char    **p_aliases;    /*%< alias list */
+       int     p_proto;        /*%< protocol # */
+};
+
+/*
+ * Note: ai_addrlen used to be a size_t, per RFC 2553.
+ * In XNS5.2, and subsequently in POSIX-2001 and
+ * draft-ietf-ipngwg-rfc2553bis-02.txt it was changed to a socklen_t.
+ * To accommodate for this while preserving binary compatibility with the
+ * old interface, we prepend or append 32 bits of padding, depending on
+ * the (LP64) architecture's endianness.
+ *
+ * This should be deleted the next time the libc major number is
+ * incremented.
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+struct addrinfo {
+       int             ai_flags;       /*%< AI_PASSIVE, AI_CANONNAME */
+       int             ai_family;      /*%< PF_xxx */
+       int             ai_socktype;    /*%< SOCK_xxx */
+       int             ai_protocol;    /*%< 0 or IPPROTO_xxx for IPv4 and IPv6 */
+#if defined(__sparc__) && defined(_LP64)
+       int             __ai_pad0;      /* ABI compatibility */
+#endif
+       socklen_t        ai_addrlen;    /*%< length of ai_addr */
+#if defined(__alpha__) || (defined(__i386__) && defined(_LP64))
+       int             __ai_pad0;      /* ABI compatibility */
+#endif
+       char            *ai_canonname;  /*%< canonical name for hostname */
+       struct sockaddr *ai_addr;       /*%< binary address */
+       struct addrinfo *ai_next;       /*%< next structure in linked list */
+};
+#endif
+
+/*%
+ * Error return codes from gethostbyname() and gethostbyaddr()
+ * (left in extern int h_errno).
+ */
+
+#if defined(_NETBSD_SOURCE)
+#define        NETDB_INTERNAL  -1      /*%< see errno */
+#define        NETDB_SUCCESS   0       /*%< no problem */
+#endif
+#define        NO_ADDRESS      NO_DATA         /* no address, look for MX record */
+#define        HOST_NOT_FOUND  1 /*%< Authoritative Answer Host not found */
+#define        TRY_AGAIN       2 /*%< Non-Authoritive Host not found, or SERVERFAIL */
+#define        NO_RECOVERY     3 /*%< Non recoverable errors, FORMERR, REFUSED, NOTIMP */
+#define        NO_DATA         4 /*%< Valid name, no data record of requested type */
+#if defined(_NETBSD_SOURCE)
+#define        NO_ADDRESS      NO_DATA         /*%< no address, look for MX record */
+#endif
+
 /*
-netdb.h
-*/
+ * Error return codes from getaddrinfo()
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+#define        EAI_ADDRFAMILY   1      /*%< address family for hostname not supported */
+#define        EAI_AGAIN        2      /*%< temporary failure in name resolution */
+#define        EAI_BADFLAGS     3      /*%< invalid value for ai_flags */
+#define        EAI_FAIL         4      /*%< non-recoverable failure in name resolution */
+#define        EAI_FAMILY       5      /*%< ai_family not supported */
+#define        EAI_MEMORY       6      /*%< memory allocation failure */
+#define        EAI_NODATA       7      /*%< no address associated with hostname */
+#define        EAI_NONAME       8      /*%< hostname nor servname provided, or not known */
+#define        EAI_SERVICE      9      /*%< servname not supported for ai_socktype */
+#define        EAI_SOCKTYPE    10      /*%< ai_socktype not supported */
+#define        EAI_SYSTEM      11      /*%< system error returned in errno */
+#define        EAI_BADHINTS    12      /* invalid value for hints */
+#define        EAI_PROTOCOL    13      /* resolved protocol is unknown */
+#define        EAI_OVERFLOW    14      /* argument buffer overflow */
+#define        EAI_MAX         15
+#endif /* _POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */
+
+/*%
+ * Flag values for getaddrinfo()
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+#define        AI_PASSIVE      0x00000001 /* get address to use bind() */
+#define        AI_CANONNAME    0x00000002 /* fill ai_canonname */
+#define        AI_NUMERICHOST  0x00000004 /* prevent host name resolution */
+#define        AI_NUMERICSERV  0x00000008 /* prevent service name resolution */
+/* valid flags for addrinfo (not a standard def, apps should not use it) */
+#define        AI_MASK \
+    (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV)
+#endif
+
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+/*%
+ * Constants for getnameinfo()
+ */
+#if defined(_NETBSD_SOURCE)
+#define        NI_MAXHOST      1025
+#define        NI_MAXSERV      32
+#endif
+
+/*%
+ * Flag values for getnameinfo()
+ */
+#define        NI_NOFQDN       0x00000001
+#define        NI_NUMERICHOST  0x00000002
+#define        NI_NAMEREQD     0x00000004
+#define        NI_NUMERICSERV  0x00000008
+#define        NI_DGRAM        0x00000010
+#define        NI_WITHSCOPEID  0x00000020
+#define        NI_NUMERICSCOPE 0x00000040
+
+/*%
+ * Scope delimit character
+ */
+#if defined(_NETBSD_SOURCE)
+#define        SCOPE_DELIMITER '%'
+#endif
+#endif /* (_POSIX_C_SOURCE - 0) >= 200112L || ... */
+
+__BEGIN_DECLS
+void           endhostent(void);
+void           endnetent(void);
+void           endprotoent(void);
+void           endservent(void);
+#if (_XOPEN_SOURCE - 0) >= 520 && (_XOPEN_SOURCE - 0) < 600 || \
+    defined(_NETBSD_SOURCE)
+#if 0 /* we do not ship this */
+void           freehostent(struct hostent *);
+#endif
+#endif
+struct hostent *gethostbyaddr(const char *, socklen_t, int);
+struct hostent *gethostbyname(const char *);
+#if defined(_NETBSD_SOURCE)
+struct hostent *gethostbyname2(const char *, int);
+#endif
+struct hostent *gethostent(void);
+struct netent  *getnetbyaddr(uint32_t, int);
+struct netent  *getnetbyname(const char *);
+struct netent  *getnetent(void);
+struct protoent        *getprotobyname(const char *);
+struct protoent        *getprotobynumber(int);
+struct protoent        *getprotoent(void);
+struct servent *getservbyname(const char *, const char *);
+struct servent *getservbyport(int, const char *);
+struct servent *getservent(void);
+#if defined(_NETBSD_SOURCE)
+void           herror(const char *);
+const char     *hstrerror(int);
+#endif
+void           sethostent(int);
+#if defined(_NETBSD_SOURCE)
+/* void                sethostfile(const char *); */
+#endif
+void           setnetent(int);
+void           setprotoent(int);
+void           setservent(int);
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
+    defined(_NETBSD_SOURCE)
+int            getaddrinfo(const char * __restrict, const char * __restrict,
+                                const struct addrinfo * __restrict,
+                                struct addrinfo ** __restrict);
+int            getnameinfo(const struct sockaddr * __restrict, socklen_t,
+                                char * __restrict, socklen_t,
+                                char * __restrict, socklen_t, int);
+struct addrinfo *allocaddrinfo(socklen_t);
+void           freeaddrinfo(struct addrinfo *);
+const char     *gai_strerror(int);
+#endif
+__END_DECLS
 
-/* Open Group Base Specifications Issue 6 (not complete) */
-#include <net/gen/netdb.h>
+#endif /* !_NETDB_H_ */
similarity index 100%
rename from nbsd_include/netgroup.h
rename to include/netgroup.h
diff --git a/include/netinet/if_ether.h b/include/netinet/if_ether.h
deleted file mode 100644 (file)
index e69de29..0000000
index 973088fbddb73fbba5566636873edd1f78710bb7..ba9d45c4d078449914ae4e3d74e41adc4b6a7e46 100644 (file)
-/*
-netinet/in.h
-*/
+/*     $NetBSD: in.h,v 1.86 2009/09/14 10:36:50 degroote Exp $ */
 
-#ifndef _NETINET__IN_H
-#define _NETINET__IN_H
+/*
+ * Copyright (c) 1982, 1986, 1990, 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. 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.
+ *
+ *     @(#)in.h        8.3 (Berkeley) 1/3/94
+ */
 
-/* Can we include <stdint.h> here or do we need an additional header that is
- * safe to include?
+/*
+ * Constants and structures defined by the internet system,
+ * Per RFC 790, September 1981, and numerous additions.
  */
-#include <stdint.h>
 
-/* Open Group Base Specifications Issue 6 (not complete) */
-#define    INADDR_ANY              (uint32_t)0x00000000
-#define    INADDR_BROADCAST        (uint32_t)0xFFFFFFFF
-#define    INADDR_LOOPBACK         (uint32_t)0x7F000001
+#ifndef _NETINET_IN_H_
+#define        _NETINET_IN_H_
 
-#define    IN_LOOPBACKNET          127
+#include <machine/int_types.h>
 
-#define       IPPORT_RESERVED         1024
+#ifndef uint8_t
+typedef __uint8_t      uint8_t;
+#define        uint8_t         __uint8_t
+#endif
 
-typedef uint16_t       in_port_t;
+#ifndef uint32_t
+typedef __uint32_t     uint32_t;
+#define        uint32_t        __uint32_t
+#endif
 
-#ifndef _IN_ADDR_T
-#define _IN_ADDR_T
-typedef uint32_t       in_addr_t;
-#endif /* _IN_ADDR_T */
+#include <sys/ansi.h>
 
-#ifndef _SA_FAMILY_T
-#define _SA_FAMILY_T
-/* Should match corresponding typedef in <sys/socket.h> */
-typedef uint8_t                sa_family_t;
-#endif /* _SA_FAMILY_T */
+#ifndef in_addr_t
+typedef __in_addr_t    in_addr_t;
+#define        in_addr_t       __in_addr_t
+#endif
 
-/* Protocols */
-#define IPPROTO_IP     0       /* Dummy protocol */
-#define IPPROTO_ICMP   1       /* ICMP */
-#define IPPROTO_TCP    6       /* TCP */
-#define IPPROTO_EGP    8       /* exterior gateway protocol */
-#define IPPROTO_UDP    17      /* UDP */
+#ifndef in_port_t
+typedef __in_port_t    in_port_t;
+#define        in_port_t       __in_port_t
+#endif
 
-/* setsockopt options at IP level */
-#define IP_ADD_MEMBERSHIP      12
-#define IP_DROP_MEMBERSHIP     13
+#ifndef sa_family_t
+typedef __sa_family_t  sa_family_t;
+#define        sa_family_t     __sa_family_t
+#endif
 
-#ifndef _STRUCT_IN_ADDR
-#define _STRUCT_IN_ADDR
-struct in_addr
-{
-       in_addr_t       s_addr;
-};
+/*
+ * Protocols
+ */
+#define        IPPROTO_IP              0               /* dummy for IP */
+#define        IPPROTO_HOPOPTS         0               /* IP6 hop-by-hop options */
+#define        IPPROTO_ICMP            1               /* control message protocol */
+#define        IPPROTO_IGMP            2               /* group mgmt protocol */
+#define        IPPROTO_GGP             3               /* gateway^2 (deprecated) */
+#define        IPPROTO_IPV4            4               /* IP header */
+#define        IPPROTO_IPIP            4               /* IP inside IP */
+#define        IPPROTO_TCP             6               /* tcp */
+#define        IPPROTO_EGP             8               /* exterior gateway protocol */
+#define        IPPROTO_PUP             12              /* pup */
+#define        IPPROTO_UDP             17              /* user datagram protocol */
+#define        IPPROTO_IDP             22              /* xns idp */
+#define        IPPROTO_TP              29              /* tp-4 w/ class negotiation */
+#define        IPPROTO_IPV6            41              /* IP6 header */
+#define        IPPROTO_ROUTING         43              /* IP6 routing header */
+#define        IPPROTO_FRAGMENT        44              /* IP6 fragmentation header */
+#define        IPPROTO_RSVP            46              /* resource reservation */
+#define        IPPROTO_GRE             47              /* GRE encaps RFC 1701 */
+#define        IPPROTO_ESP             50              /* encap. security payload */
+#define        IPPROTO_AH              51              /* authentication header */
+#define        IPPROTO_MOBILE          55              /* IP Mobility RFC 2004 */
+#define        IPPROTO_IPV6_ICMP       58              /* IPv6 ICMP */
+#define        IPPROTO_ICMPV6          58              /* ICMP6 */
+#define        IPPROTO_NONE            59              /* IP6 no next header */
+#define        IPPROTO_DSTOPTS         60              /* IP6 destination option */
+#define        IPPROTO_EON             80              /* ISO cnlp */
+#define        IPPROTO_ETHERIP         97              /* Ethernet-in-IP */
+#define        IPPROTO_ENCAP           98              /* encapsulation header */
+#define        IPPROTO_PIM             103             /* Protocol indep. multicast */
+#define        IPPROTO_IPCOMP          108             /* IP Payload Comp. Protocol */
+#define        IPPROTO_VRRP            112             /* VRRP RFC 2338 */
+#define        IPPROTO_CARP            112             /* Common Address Resolution Protocol */
+#define IPPROTO_PFSYNC      240     /* PFSYNC */
+#define        IPPROTO_RAW             255             /* raw IP packet */
+#define        IPPROTO_MAX             256
+
+/* last return value of *_input(), meaning "all job for this pkt is done".  */
+#define        IPPROTO_DONE            257
+
+/* sysctl placeholder for (FAST_)IPSEC */
+#define CTL_IPPROTO_IPSEC      258
+
+
+/*
+ * Local port number conventions:
+ *
+ * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
+ * unless a kernel is compiled with IPNOPRIVPORTS defined.
+ *
+ * When a user does a bind(2) or connect(2) with a port number of zero,
+ * a non-conflicting local port address is chosen.
+ *
+ * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
+ * that is settable by sysctl(3); net.inet.ip.anonportmin and
+ * net.inet.ip.anonportmax respectively.
+ *
+ * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
+ * default assignment range.
+ *
+ * The value IP_PORTRANGE_DEFAULT causes the default behavior.
+ *
+ * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
+ * and exists only for FreeBSD compatibility purposes.
+ *
+ * The value IP_PORTRANGE_LOW changes the range to the "low" are
+ * that is (by convention) restricted to privileged processes.
+ * This convention is based on "vouchsafe" principles only.
+ * It is only secure if you trust the remote host to restrict these ports.
+ * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
+ */
+
+#define        IPPORT_RESERVED         1024
+#define        IPPORT_ANONMIN          49152
+#define        IPPORT_ANONMAX          65535
+#define        IPPORT_RESERVEDMIN      600
+#define        IPPORT_RESERVEDMAX      (IPPORT_RESERVED-1)
+
+/*
+ * Internet address (a structure for historical reasons)
+ */
+struct in_addr {
+       in_addr_t s_addr;
+} __packed;
+
+/*
+ * Definitions of bits in internet address integers.
+ * On subnets, the decomposition of addresses to host and net parts
+ * is done according to subnet mask, not the masks here.
+ *
+ * By byte-swapping the constants, we avoid ever having to byte-swap IP
+ * addresses inside the kernel.  Unfortunately, user-level programs rely
+ * on these macros not doing byte-swapping.
+ */
+#ifdef _KERNEL
+#define        __IPADDR(x)     ((uint32_t) htonl((uint32_t)(x)))
+#else
+#define        __IPADDR(x)     ((uint32_t)(x))
 #endif
 
+#define        IN_CLASSA(i)            (((uint32_t)(i) & __IPADDR(0x80000000)) == \
+                                __IPADDR(0x00000000))
+#define        IN_CLASSA_NET           __IPADDR(0xff000000)
+#define        IN_CLASSA_NSHIFT        24
+#define        IN_CLASSA_HOST          __IPADDR(0x00ffffff)
+#define        IN_CLASSA_MAX           128
+
+#define        IN_CLASSB(i)            (((uint32_t)(i) & __IPADDR(0xc0000000)) == \
+                                __IPADDR(0x80000000))
+#define        IN_CLASSB_NET           __IPADDR(0xffff0000)
+#define        IN_CLASSB_NSHIFT        16
+#define        IN_CLASSB_HOST          __IPADDR(0x0000ffff)
+#define        IN_CLASSB_MAX           65536
+
+#define        IN_CLASSC(i)            (((uint32_t)(i) & __IPADDR(0xe0000000)) == \
+                                __IPADDR(0xc0000000))
+#define        IN_CLASSC_NET           __IPADDR(0xffffff00)
+#define        IN_CLASSC_NSHIFT        8
+#define        IN_CLASSC_HOST          __IPADDR(0x000000ff)
+
+#define        IN_CLASSD(i)            (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
+                                __IPADDR(0xe0000000))
+/* These ones aren't really net and host fields, but routing needn't know. */
+#define        IN_CLASSD_NET           __IPADDR(0xf0000000)
+#define        IN_CLASSD_NSHIFT        28
+#define        IN_CLASSD_HOST          __IPADDR(0x0fffffff)
+#define        IN_MULTICAST(i)         IN_CLASSD(i)
+
+#define        IN_EXPERIMENTAL(i)      (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
+                                __IPADDR(0xf0000000))
+#define        IN_BADCLASS(i)          (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
+                                __IPADDR(0xf0000000))
+
+#define IN_LINKLOCAL(i)        (((uint32_t)(i) & __IPADDR(0xffff0000)) == \
+                        __IPADDR(0xa9fe0000))
+
+#define        IN_PRIVATE(i)   ((((uint32_t)(i) & __IPADDR(0xff000000)) ==     \
+                         __IPADDR(0x0a000000)) ||                      \
+                        (((uint32_t)(i) & __IPADDR(0xfff00000)) ==     \
+                         __IPADDR(0xac100000)) ||                      \
+                        (((uint32_t)(i) & __IPADDR(0xffff0000)) ==     \
+                         __IPADDR(0xc0a80000)))
+
+#define        IN_LOCAL_GROUP(i)       (((uint32_t)(i) & __IPADDR(0xffffff00)) == \
+                                __IPADDR(0xe0000000))
+
+#define        IN_ANY_LOCAL(i)         (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
+
+#define        INADDR_ANY              __IPADDR(0x00000000)
+#define        INADDR_LOOPBACK         __IPADDR(0x7f000001)
+#define        INADDR_BROADCAST        __IPADDR(0xffffffff)    /* must be masked */
+#define        INADDR_NONE             __IPADDR(0xffffffff)    /* -1 return */
+
+#define        INADDR_UNSPEC_GROUP     __IPADDR(0xe0000000)    /* 224.0.0.0 */
+#define        INADDR_ALLHOSTS_GROUP   __IPADDR(0xe0000001)    /* 224.0.0.1 */
+#define        INADDR_ALLRTRS_GROUP    __IPADDR(0xe0000002)    /* 224.0.0.2 */
+#define        INADDR_CARP_GROUP       __IPADDR(0xe0000012)    /* 224.0.0.18 */
+#define        INADDR_MAX_LOCAL_GROUP  __IPADDR(0xe00000ff)    /* 224.0.0.255 */
+
+#define        IN_LOOPBACKNET          127                     /* official! */
+
+/*
+ * Socket address, internet style.
+ */
+#ifdef __minix
 struct sockaddr_in
 {
        sa_family_t     sin_family;
        in_port_t       sin_port;
        struct in_addr  sin_addr;
 };
-
-struct ip_mreq
-{
-       struct  in_addr imr_multiaddr;
-       struct  in_addr imr_interface;
+#else /* !__minix */
+struct sockaddr_in {
+       uint8_t         sin_len;
+       sa_family_t     sin_family;
+       in_port_t       sin_port;
+       struct in_addr  sin_addr;
+       __int8_t        sin_zero[8];
 };
+#endif /* !__minix */
 
-/* 
- * IPv6 is not supported, but some programs need these declarations 
- * nevertheless; these declarations are based on
- * http://www.opengroup.org/onlinepubs/000095399/basedefs/netinet/in.h.html
+#define        INET_ADDRSTRLEN                 16
+
+#ifndef __minix
+/*
+ * Structure used to describe IP options.
+ * Used to store options internally, to pass them to a process,
+ * or to restore options retrieved earlier.
+ * The ip_dst is used for the first-hop gateway when using a source route
+ * (this gets put into the header proper).
  */
-struct in6_addr
-{
-       uint8_t s6_addr[16];
+struct ip_opts {
+       struct in_addr  ip_dst;         /* first hop, 0 w/o src rt */
+#if defined(__cplusplus)
+       __int8_t        Ip_opts[40];    /* actually variable in size */
+#else
+       __int8_t        ip_opts[40];    /* actually variable in size */
+#endif
 };
+#endif /* __minix */
 
-struct sockaddr_in6
-{
-       sa_family_t     sin6_family;
-       in_port_t       sin6_port;
-       uint32_t        sin6_flowinfo;
-       struct in6_addr sin6_addr;
-       uint32_t        sin6_scope_id;
+/*
+ * Options for use with [gs]etsockopt at the IP level.
+ * First word of comment is data type; bool is stored in int.
+ */
+#ifndef __minix
+#define        IP_OPTIONS              1    /* buf/ip_opts; set/get IP options */
+#define        IP_HDRINCL              2    /* int; header is included with data */
+#define        IP_TOS                  3    /* int; IP type of service and preced. */
+#define        IP_TTL                  4    /* int; IP time to live */
+#define        IP_RECVOPTS             5    /* bool; receive all IP opts w/dgram */
+#define        IP_RECVRETOPTS          6    /* bool; receive IP opts for response */
+#define        IP_RECVDSTADDR          7    /* bool; receive IP dst addr w/dgram */
+#define        IP_RETOPTS              8    /* ip_opts; set/get IP options */
+#define        IP_MULTICAST_IF         9    /* in_addr; set/get IP multicast i/f  */
+#define        IP_MULTICAST_TTL        10   /* u_char; set/get IP multicast ttl */
+#define        IP_MULTICAST_LOOP       11   /* u_char; set/get IP multicast loopback */
+#endif /* !__minix */
+#define        IP_ADD_MEMBERSHIP       12   /* ip_mreq; add an IP group membership */
+#define        IP_DROP_MEMBERSHIP      13   /* ip_mreq; drop an IP group membership */
+#ifndef __minix
+#define        IP_PORTRANGE            19   /* int; range to use for ephemeral port */
+#define        IP_RECVIF               20   /* bool; receive reception if w/dgram */
+#define        IP_ERRORMTU             21   /* int; get MTU of last xmit = EMSGSIZE */
+#if 1 /*IPSEC*/
+#define        IP_IPSEC_POLICY         22 /* struct; get/set security policy */
+#endif
+#define        IP_RECVTTL              23   /* bool; receive IP TTL w/dgram */
+#define        IP_MINTTL               24   /* minimum TTL for packet or drop */
+#endif /* !__minix */
+
+#ifndef __minix
+/*
+ * Defaults and limits for options
+ */
+#define        IP_DEFAULT_MULTICAST_TTL  1     /* normally limit m'casts to 1 hop  */
+#define        IP_DEFAULT_MULTICAST_LOOP 1     /* normally hear sends if a member  */
+#define        IP_MAX_MEMBERSHIPS      20      /* per socket; must fit in one mbuf */
+#endif /* !__minix */
+
+/*
+ * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
+ */
+struct ip_mreq {
+       struct  in_addr imr_multiaddr;  /* IP multicast address of group */
+       struct  in_addr imr_interface;  /* local IP address of interface */
 };
 
-#define        INET6_ADDRSTRLEN        46
+#ifndef __minix
+/*
+ * Argument for IP_PORTRANGE:
+ * - which range to search when port is unspecified at bind() or connect()
+ */
+#define        IP_PORTRANGE_DEFAULT    0       /* default range */
+#define        IP_PORTRANGE_HIGH       1       /* same as DEFAULT (FreeBSD compat) */
+#define        IP_PORTRANGE_LOW        2       /* use privileged range */
+
+#if defined(_NETBSD_SOURCE)
+/*
+ * Definitions for inet sysctl operations.
+ *
+ * Third level is protocol number.
+ * Fourth level is desired variable within that protocol.
+ */
+#define        IPPROTO_MAXID   (IPPROTO_AH + 1)        /* don't list to IPPROTO_MAX */
 
-/* Definitions that are not part of the Open Group Base Specifications */
-#define IN_CLASSA(i)   (((uint32_t)(i) & 0x80000000) == 0)
-#define IN_CLASSA_NET  0xff000000
-#define IN_CLASSA_NSHIFT 24
+#define        CTL_IPPROTO_NAMES { \
+       { "ip", CTLTYPE_NODE }, \
+       { "icmp", CTLTYPE_NODE }, \
+       { "igmp", CTLTYPE_NODE }, \
+       { "ggp", CTLTYPE_NODE }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { "tcp", CTLTYPE_NODE }, \
+       { 0, 0 }, \
+       { "egp", CTLTYPE_NODE }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { "pup", CTLTYPE_NODE }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { "udp", CTLTYPE_NODE }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { "idp", CTLTYPE_NODE }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { "ipsec", CTLTYPE_NODE }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { 0, 0 }, \
+       { "pim", CTLTYPE_NODE }, \
+}
 
-#define IN_CLASSB(i)   (((uint32_t)(i) & 0xc0000000) == 0x80000000)
-#define IN_CLASSB_NET  0xffff0000
-#define IN_CLASSB_NSHIFT 16
+/*
+ * Names for IP sysctl objects
+ */
+#define        IPCTL_FORWARDING        1       /* act as router */
+#define        IPCTL_SENDREDIRECTS     2       /* may send redirects when forwarding */
+#define        IPCTL_DEFTTL            3       /* default TTL */
+#ifdef notyet
+#define        IPCTL_DEFMTU            4       /* default MTU */
+#endif
+#define        IPCTL_FORWSRCRT         5       /* forward source-routed packets */
+#define        IPCTL_DIRECTEDBCAST     6       /* default broadcast behavior */
+#define        IPCTL_ALLOWSRCRT        7       /* allow/drop all source-routed pkts */
+#define        IPCTL_SUBNETSARELOCAL   8       /* treat subnets as local addresses */
+#define        IPCTL_MTUDISC           9       /* allow path MTU discovery */
+#define        IPCTL_ANONPORTMIN      10       /* minimum ephemeral port */
+#define        IPCTL_ANONPORTMAX      11       /* maximum ephemeral port */
+#define        IPCTL_MTUDISCTIMEOUT   12       /* allow path MTU discovery */
+#define        IPCTL_MAXFLOWS         13       /* maximum ip flows allowed */
+#define        IPCTL_HOSTZEROBROADCAST 14      /* is host zero a broadcast addr? */
+#define        IPCTL_GIF_TTL          15       /* default TTL for gif encap packet */
+#define        IPCTL_LOWPORTMIN       16       /* minimum reserved port */
+#define        IPCTL_LOWPORTMAX       17       /* maximum reserved port */
+#define        IPCTL_MAXFRAGPACKETS   18       /* max packets reassembly queue */
+#define        IPCTL_GRE_TTL          19       /* default TTL for gre encap packet */
+#define        IPCTL_CHECKINTERFACE   20       /* drop pkts in from 'wrong' iface */
+#define        IPCTL_IFQ              21       /* ipintrq node */
+#define        IPCTL_RANDOMID         22       /* use random IP ids (if configured) */
+#define        IPCTL_LOOPBACKCKSUM    23       /* do IP checksum on loopback */
+#define        IPCTL_STATS             24      /* IP statistics */
+#define        IPCTL_MAXID            25
 
-#define IN_CLASSC(i)   (((uint32_t)(i) & 0xe0000000) == 0xc0000000)
-#define IN_CLASSC_NET  0xffffff00
-#define IN_CLASSC_NSHIFT 8
+#define        IPCTL_NAMES { \
+       { 0, 0 }, \
+       { "forwarding", CTLTYPE_INT }, \
+       { "redirect", CTLTYPE_INT }, \
+       { "ttl", CTLTYPE_INT }, \
+       { "mtu", CTLTYPE_INT }, \
+       { "forwsrcrt", CTLTYPE_INT }, \
+       { "directed-broadcast", CTLTYPE_INT }, \
+       { "allowsrcrt", CTLTYPE_INT }, \
+       { "subnetsarelocal", CTLTYPE_INT }, \
+       { "mtudisc", CTLTYPE_INT }, \
+       { "anonportmin", CTLTYPE_INT }, \
+       { "anonportmax", CTLTYPE_INT }, \
+       { "mtudisctimeout", CTLTYPE_INT }, \
+       { "maxflows", CTLTYPE_INT }, \
+       { "hostzerobroadcast", CTLTYPE_INT }, \
+       { "gifttl", CTLTYPE_INT }, \
+       { "lowportmin", CTLTYPE_INT }, \
+       { "lowportmax", CTLTYPE_INT }, \
+       { "maxfragpackets", CTLTYPE_INT }, \
+       { "grettl", CTLTYPE_INT }, \
+       { "checkinterface", CTLTYPE_INT }, \
+       { "ifq", CTLTYPE_NODE }, \
+       { "random_id", CTLTYPE_INT }, \
+       { "do_loopback_cksum", CTLTYPE_INT }, \
+       { "stats", CTLTYPE_STRUCT }, \
+}
+#endif /* _NETBSD_SOURCE */
+#endif /* __minix */
 
-#define IN_CLASSD(i)   (((uint32_t)(i) & 0xf0000000) == 0xe0000000)
-#define IN_CLASSD_NET  0xf0000000
-#define IN_CLASSD_NSHIFT 28
+/* INET6 stuff */
+#define        __KAME_NETINET_IN_H_INCLUDED_
+#include <netinet6/in6.h>
+#undef __KAME_NETINET_IN_H_INCLUDED_
 
-#endif /* _NETINET__IN_H */
+#endif /* !_NETINET_IN_H_ */
index 2e44510fb004631c758b26c3e2b9b79794caf340..17a0540d3d05923271afd86e5008fb140e33177a 100644 (file)
@@ -1,5 +1,119 @@
+/*     $NetBSD: tcp.h,v 1.28 2007/12/25 18:33:47 perry Exp $   */
+
+/*
+ * Copyright (c) 1982, 1986, 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. 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.
+ *
+ *     @(#)tcp.h       8.1 (Berkeley) 6/10/93
+ */
+
+#ifndef _NETINET_TCP_H_
+#define _NETINET_TCP_H_
+
+#include <sys/featuretest.h>
+
+#if defined(_NETBSD_SOURCE)
+
+typedef u_int32_t tcp_seq;
+/*
+ * TCP header.
+ * Per RFC 793, September, 1981.
+ * Updated by RFC 3168, September, 2001.
+ */
+struct tcphdr {
+       u_int16_t th_sport;             /* source port */
+       u_int16_t th_dport;             /* destination port */
+       tcp_seq   th_seq;               /* sequence number */
+       tcp_seq   th_ack;               /* acknowledgement number */
+#if BYTE_ORDER == LITTLE_ENDIAN
+       /*LINTED non-portable bitfields*/
+       u_int8_t  th_x2:4,              /* (unused) */
+                 th_off:4;             /* data offset */
+#endif
+#if BYTE_ORDER == BIG_ENDIAN
+       /*LINTED non-portable bitfields*/
+       u_int8_t  th_off:4,             /* data offset */
+                 th_x2:4;              /* (unused) */
+#endif
+       u_int8_t  th_flags;
+#define        TH_FIN    0x01
+#define        TH_SYN    0x02
+#define        TH_RST    0x04
+#define        TH_PUSH   0x08
+#define        TH_ACK    0x10
+#define        TH_URG    0x20
+#define        TH_ECE    0x40
+#define        TH_CWR    0x80
+       u_int16_t th_win;                       /* window */
+       u_int16_t th_sum;                       /* checksum */
+       u_int16_t th_urp;                       /* urgent pointer */
+} __packed;
+
+#define        TCPOPT_EOL              0
+#define        TCPOPT_NOP              1
+#define        TCPOPT_MAXSEG           2
+#define           TCPOLEN_MAXSEG               4
+#define        TCPOPT_WINDOW           3
+#define           TCPOLEN_WINDOW               3
+#define        TCPOPT_SACK_PERMITTED   4               /* Experimental */
+#define           TCPOLEN_SACK_PERMITTED       2
+#define        TCPOPT_SACK             5               /* Experimental */
+#define        TCPOPT_TIMESTAMP        8
+#define           TCPOLEN_TIMESTAMP            10
+#define           TCPOLEN_TSTAMP_APPA          (TCPOLEN_TIMESTAMP+2) /* appendix A */
+
+#define TCPOPT_TSTAMP_HDR      \
+    (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
+
+#define        TCPOPT_SIGNATURE        19              /* Keyed MD5: RFC 2385 */
+#define           TCPOLEN_SIGNATURE            18
+#define    TCPOLEN_SIGLEN              (TCPOLEN_SIGNATURE+2) /* padding */
+
+#define MAX_TCPOPTLEN  40      /* max # bytes that go in options */
+
+/*
+ * Default maximum segment size for TCP.
+ * This is defined by RFC 1112 Sec 4.2.2.6.
+ */
+#define        TCP_MSS         536
+
+#define        TCP_MINMSS      216
+
+#define        TCP_MAXWIN      65535   /* largest value for (unscaled) window */
+
+#define        TCP_MAX_WINSHIFT        14      /* maximum window shift */
+
+#define        TCP_MAXBURST    4       /* maximum segments in a burst */
+
+#endif /* _NETBSD_SOURCE */
+
 /*
-netinet/tcp.h
-*/
+ * User-settable options (used with setsockopt).
+ */
+#define        TCP_NODELAY     1       /* don't delay send to coalesce packets */
 
-#define TCP_NODELAY    0x01    /* Avoid coalescing of small segments */
+#endif /* !_NETINET_TCP_H_ */
similarity index 100%
rename from nbsd_include/nl_types.h
rename to include/nl_types.h
similarity index 100%
rename from nbsd_include/nlist.h
rename to include/nlist.h
similarity index 100%
rename from nbsd_include/nsswitch.h
rename to include/nsswitch.h
index 16985c9a67eb0b3bb850ac759cb7d968516fdc36..410f92092bc166262aa0b6a484e18998d7da516e 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: paths.h,v 1.39 2010/12/29 15:53:57 pooka Exp $ */
+
 /*
  * Copyright (c) 1989, 1993
  *     The Regents of the University of California.  All rights reserved.
  *     @(#)paths.h     8.1 (Berkeley) 6/2/93
  */
 
-#ifndef _PATHS_H
-#define _PATHS_H
+#ifndef _PATHS_H_
+#define        _PATHS_H_
 
-/* Default search path. */
+/*
+ * Default user search path.
+ * Set by login(1), rshd(8), rexecd(8)
+ * Used by execvp(3) absent PATH from the environ(7)
+ */
+#ifdef RESCUEDIR
+#define        _PATH_DEFPATH   RESCUEDIR ":/usr/bin:/bin:/usr/pkg/bin:/usr/local/bin"
+#else
 #define        _PATH_DEFPATH   "/usr/bin:/bin:/usr/pkg/bin:/usr/local/bin"
-/* All standard utilities path. */
+#endif
+
+/*
+ * All standard utilities path.
+ * Set by init(8) for system programs & scripts (e.g. /etc/rc)
+ * Used by ttyaction(3), whereis(1)
+ */
 #define        _PATH_STDPATH \
        "/usr/bin:/bin:/usr/sbin:/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin"
 
-#define _PATH_DHCPCONF "/etc/dhcp.conf"
-#define _PATH_DHCPPID  "/usr/run/dhcpd.pid"
-#define _PATH_DHCPCACHE        "/usr/adm/dhcp.cache"
-#define _PATH_DHCPPOOL "/usr/adm/dhcp.pool"
+#define        _PATH_AUDIO     "/dev/audio"
+#define        _PATH_AUDIO0    "/dev/audio0"
+#define        _PATH_AUDIOCTL  "/dev/audioctl"
+#define        _PATH_AUDIOCTL0 "/dev/audioctl0"
+#define        _PATH_BPF       "/dev/bpf"
+#define        _PATH_CLOCKCTL  "/dev/clockctl"
+#define        _PATH_CONSOLE   "/dev/console"
+#define        _PATH_CONSTTY   "/dev/constty"
+#define        _PATH_CSMAPPER  "/usr/share/i18n/csmapper"
+#define        _PATH_DEFTAPE   "/dev/nrst0"
+#define        _PATH_DEVDB     "/var/run/dev.db"
+#define        _PATH_DEVNULL   "/dev/null"
+#define        _PATH_DRUM      "/dev/drum"
+#define        _PATH_ESDB      "/usr/share/i18n/esdb"
+#define        _PATH_FTPUSERS  "/etc/ftpusers"
+#define        _PATH_GETTYTAB  "/etc/gettytab"
+#define        _PATH_I18NMODULE "/usr/lib/i18n"
+#define        _PATH_ICONV     "/usr/share/i18n/iconv"
+#define        _PATH_KMEM      "/dev/kmem"
+#define        _PATH_KSYMS     "/dev/ksyms"
+#define        _PATH_KVMDB     "/var/db/kvm.db"
+#define        _PATH_LOCALE    "/usr/share/locale"
+#define        _PATH_MAILDIR   "/var/mail"
+#define        _PATH_MAN       "/usr/share/man"
+#define        _PATH_MEM       "/dev/mem"
+#define        _PATH_MIXER     "/dev/mixer"
+#define        _PATH_MIXER0    "/dev/mixer0"
+#define        _PATH_NOLOGIN   "/etc/nologin"
+#define _PATH_POWER    "/dev/power"
+#define        _PATH_PRINTCAP  "/etc/printcap"
+#define        _PATH_PUD       "/dev/pud"
+#define        _PATH_PUFFS     "/dev/puffs"
+#define        _PATH_RANDOM    "/dev/random"
+#define        _PATH_SENDMAIL  "/usr/sbin/sendmail"
+#define        _PATH_SHELLS    "/etc/shells"
+#define        _PATH_SKEYKEYS  "/etc/skeykeys"
+#define        _PATH_SOUND     "/dev/sound"
+#define        _PATH_SOUND0    "/dev/sound0"
+#define        _PATH_SYSMON    "/dev/sysmon"
+#define        _PATH_TTY       "/dev/tty"
+#define        _PATH_UNIX      "/netbsd"
+#define        _PATH_URANDOM   "/dev/urandom"
+#define        _PATH_VIDEO     "/dev/video"
+#define        _PATH_VIDEO0    "/dev/video0"
 
-#define _PATH_WTMP     "/usr/adm/wtmp"
-#define _PATH_UTMP     "/etc/utmp"
-#define _PATH_LASTLOG  "/usr/adm/lastlog"
-#define _PATH_MOTD     "/etc/motd"
-#define _PATH_HOSTS    "/etc/hosts"
+/*
+ * Provide trailing slash, since mostly used for building pathnames.
+ * See the __CONCAT() macro from <sys/cdefs.h> for cpp examples.
+ */
+#define        _PATH_DEV       "/dev/"
+#define        _PATH_DEV_PTS   "/dev/pts/"
+#define        _PATH_EMUL_AOUT "/emul/aout/"
+#define        _PATH_TMP       "/tmp/"
+#define        _PATH_VARDB     "/var/db/"
+#define        _PATH_VARRUN    "/var/run/"
+#define        _PATH_VARTMP    "/var/tmp/"
 
-#define    _PATH_DEFTAPE   "/dev/sa0"
-#define    _PATH_RAMDISK   "/dev/ram"
-#define    _PATH_TTY       "/dev/tty"
-#define    _PATH_DEVNULL   "/dev/null"
-#define    _PATH_CONSOLE   "/dev/console"
-#define    _PATH_KMEM      "/dev/kmem"
-#define    _PATH_MEM       "/dev/mem"
-#define    _PATH_RANDOM    "/dev/random"
-#define    _PATH_URANDOM   "/dev/urandom"
+/*
+ * Paths that may change if RESCUEDIR is defined.
+ * Used by tools in /rescue.
+ */
+#ifdef RESCUEDIR
+#define        _PATH_BSHELL    RESCUEDIR "/sh"
+#define        _PATH_CSHELL    RESCUEDIR "/csh"
+#define        _PATH_VI        RESCUEDIR "/vi"
+#else
+#define        _PATH_BSHELL    "/bin/sh"
+#define        _PATH_CSHELL    "/bin/csh"
+#define        _PATH_VI        "/usr/bin/vi"
+#endif
 
-#define _PATH_BSHELL   "/bin/sh"
-#define _PATH_SERVICE  "/bin/service"
-#define _PATH_SYSTEM_CONF      "/etc/system.conf"
-#define _PATH_SYSTEM_CONF_DIR  "/etc/system.conf.d"
-#define _PATH_SYSTEM_CONF_PKG_DIR      "/usr/pkg/etc/system.conf.d"
+#ifdef __minix
+#include <minix/paths.h>
+#endif /* !__minix */
 
-/* Provide trailing slash, since mostly used for building pathnames. */
-#define _PATH_DEV      "/dev/"
-#define _PATH_TMP      "/tmp/"
-#define _PATH_PROC     "/proc/"
+#endif /* !_PATHS_H_ */
 
-#endif
diff --git a/include/poll.h b/include/poll.h
deleted file mode 100644 (file)
index 06fb41a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <sys/poll.h>
index a5349759810cbe299a7f4a56f4ae1960c9190f15..4a471f027488cb0eb2192acb396f0828bac63fa2 100644 (file)
-/* The <pwd.h> header defines the items in the password file. */
+/*     $NetBSD: pwd.h,v 1.42 2009/01/11 03:04:12 christos Exp $        */
 
-#ifndef _PWD_H
-#define _PWD_H
+/*-
+ * Copyright (c) 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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. 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.
+ *
+ *     @(#)pwd.h       8.2 (Berkeley) 1/21/94
+ */
 
-#ifndef _TYPES_H
-#include <minix/types.h>
+/*-
+ * Portions Copyright(C) 1995, Jason Downs.  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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) 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 _PWD_H_
+#define        _PWD_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+
+#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
+#define        _PATH_PASSWD            "/etc/passwd"
+#define        _PATH_MASTERPASSWD      "/etc/master.passwd"
+#define        _PATH_MASTERPASSWD_LOCK "/etc/ptmp"
+
+#define        _PATH_PASSWD_CONF       "/etc/passwd.conf"
+#define        _PATH_PASSWDCONF        _PATH_PASSWD_CONF       /* XXX: compat */
+#define        _PATH_USERMGMT_CONF     "/etc/usermgmt.conf"
+
+#define        _PATH_MP_DB             "/etc/pwd.db"
+#define        _PATH_SMP_DB            "/etc/spwd.db"
+
+#define        _PATH_PWD_MKDB          "/usr/sbin/pwd_mkdb"
+
+#define        _PW_KEYBYNAME           '1'     /* stored by name */
+#define        _PW_KEYBYNUM            '2'     /* stored by entry in the "file" */
+#define        _PW_KEYBYUID            '3'     /* stored by uid */
+
+#define        _PASSWORD_EFMT1         '_'     /* extended DES encryption format */
+#define        _PASSWORD_NONDES        '$'     /* non-DES encryption formats */
+
+#define        _PASSWORD_LEN           128     /* max length, not counting NUL */
+
+#define _PASSWORD_NOUID                0x01    /* flag for no specified uid. */
+#define _PASSWORD_NOGID                0x02    /* flag for no specified gid. */
+#define _PASSWORD_NOCHG                0x04    /* flag for no specified change. */
+#define _PASSWORD_NOEXP                0x08    /* flag for no specified expire. */
+
+#define _PASSWORD_OLDFMT       0x10    /* flag to expect an old style entry */
+#define _PASSWORD_NOWARN       0x20    /* no warnings for bad entries */
+
+#define _PASSWORD_WARNDAYS     14      /* days to warn about expiry */
+#define _PASSWORD_CHGNOW       -1      /* special day to force password
+                                        * change at next login */
 #endif
 
 struct passwd {
-  char *pw_name;               /* login name */
-  uid_t pw_uid;                        /* uid corresponding to the name */
-  gid_t pw_gid;                        /* gid corresponding to the name */
-  char *pw_dir;                        /* user's home directory */
-  char *pw_shell;              /* name of the user's shell */
-
-  /* The following members are not defined by POSIX. */
-  char *pw_passwd;             /* password information */
-  char *pw_gecos;              /* just in case you have a GE 645 around */
+       __aconst char *pw_name;         /* user name */
+       __aconst char *pw_passwd;       /* encrypted password */
+       uid_t          pw_uid;          /* user uid */
+       gid_t          pw_gid;          /* user gid */
+       time_t         pw_change;       /* password change time */
+       __aconst char *pw_class;        /* user login class */
+       __aconst char *pw_gecos;        /* general information */
+       __aconst char *pw_dir;          /* home directory */
+       __aconst char *pw_shell;        /* default shell */
+       time_t         pw_expire;       /* account expiration */
 };
 
-/* Function Prototypes. */
-_PROTOTYPE( struct passwd *getpwnam, (const char *_name)               );
-_PROTOTYPE( struct passwd *getpwuid, (uid_t _uid)                      );
-
-#ifdef _MINIX
-_PROTOTYPE( void endpwent, (void)                                      );
-_PROTOTYPE( struct passwd *getpwent, (void)                            );
-_PROTOTYPE( int setpwent, (void)                                       );
-_PROTOTYPE( void setpwfile, (const char *_file)                                );
-_PROTOTYPE( const char *user_from_uid, (uid_t, int)                    );
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+struct passwd  *getpwuid(uid_t) __RENAME(__getpwuid50);
+struct passwd  *getpwnam(const char *) __RENAME(__getpwnam50);
+#endif
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+int             getpwnam_r(const char *, struct passwd *, char *, size_t,
+    struct passwd **) __RENAME(__getpwnam_r50);
+int             getpwuid_r(uid_t, struct passwd *, char *, size_t,
+    struct passwd **) __RENAME(__getpwuid_r50);
+#endif
+#endif
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+struct passwd  *getpwent(void) __RENAME(__getpwent50);
+#endif
+void            setpwent(void);
+void            endpwent(void);
+#endif
+#if defined(_NETBSD_SOURCE)
+int             pw_gensalt(char *, size_t, const char *, const char *);
+#ifndef __LIBC12_SOURCE__
+int             pw_scan(char *, struct passwd *, int *) __RENAME(__pw_scan50);
+int             getpwent_r(struct passwd *, char *, size_t, struct passwd **)
+    __RENAME(__getpwent_r50);
+#endif
+int             setpassent(int);
+const char     *user_from_uid(uid_t, int);
+int             uid_from_user(const char *, uid_t *);
+#ifndef __LIBC12_SOURCE__
+int             pwcache_userdb(int (*)(int), void (*)(void),
+    struct passwd * (*)(const char *), struct passwd * (*)(uid_t))
+    __RENAME(__pwcache_userdb50);
+#endif
 #endif
+__END_DECLS
 
-#endif /* _PWD_H */
+#endif /* !_PWD_H_ */
similarity index 100%
rename from nbsd_include/randomid.h
rename to include/randomid.h
similarity index 100%
rename from nbsd_include/ranlib.h
rename to include/ranlib.h
similarity index 100%
rename from nbsd_include/re_comp.h
rename to include/re_comp.h
index 4b1c4b5798c57e3eb1a5d3759c655da07f69d193..b02a82ef1a0908722d3843e0b28bcddfe9b87f07 100644 (file)
@@ -1,5 +1,6 @@
+/*     $NetBSD: regex.h,v 1.13 2005/09/13 01:44:32 christos Exp $      */
+
 /*-
- * Copyright (c) 1992 Henry Spencer.
  * Copyright (c) 1992, 1993
  *     The Regents of the University of California.  All rights reserved.
  *
  * 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. 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.
+ *
+ *     @(#)regex.h     8.2 (Berkeley) 1/3/94
+ */
+
+/*-
+ * Copyright (c) 1992 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer of the University of Toronto.
+ *
+ * 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
@@ -40,9 +74,8 @@
 #ifndef _REGEX_H_
 #define        _REGEX_H_
 
-#ifndef _TYPES_H
-#include <minix/types.h>
-#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
 
 /* types */
 typedef off_t regoff_t;
@@ -86,6 +119,7 @@ typedef struct {
 #define        REG_EMPTY       14
 #define        REG_ASSERT      15
 #define        REG_INVARG      16
+#define        REG_ENOSYS      17
 #define        REG_ATOI        255     /* convert name to number (!) */
 #define        REG_ITOA        0400    /* convert number to name (!) */
 
@@ -97,9 +131,12 @@ typedef struct {
 #define        REG_LARGE       01000   /* force large representation */
 #define        REG_BACKR       02000   /* force use of backref code */
 
-int regcomp(regex_t *, const char *, int);
-size_t regerror(int, const regex_t *, char *, size_t);
-int regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
-void regfree(regex_t *);
+__BEGIN_DECLS
+int    regcomp(regex_t * __restrict, const char * __restrict, int);
+size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t);
+int    regexec(const regex_t * __restrict,
+           const char * __restrict, size_t, regmatch_t [], int);
+void   regfree(regex_t *);
+__END_DECLS
 
 #endif /* !_REGEX_H_ */
index c94d6306a28b6c18774d20838ab8d09c9aaa44fd..b79955c9777f2eb7525617d8e6617caadac000cf 100644 (file)
@@ -1,18 +1,89 @@
-/* The <regexp.h> header is used by the (V8-compatible) regexp(3) routines. */
-/* NOTE: Obsoleted by the POSIX regex(3) library. */
+/*     $NetBSD: regexp.h,v 1.7 2005/02/03 04:39:32 perry Exp $ */
 
-#ifndef _REGEXP_H
-#define _REGEXP_H
+/*
+ * Copyright (c) 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley
+ * by Henry Spencer.
+ *
+ * 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. 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.
+ *
+ *     @(#)regexp.h    8.1 (Berkeley) 6/2/93
+ */
 
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
+/*
+ * Copyright (c) 1986 by University of Toronto.
+ *
+ * This code is derived from software contributed to Berkeley
+ * by Henry Spencer.
+ *
+ * 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.
+ *
+ *     @(#)regexp.h    8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef        _REGEXP_H_
+#define        _REGEXP_H_
 
-#define CHARBITS 0377
+/*
+ * Definitions etc. for regexp(3) routines.
+ *
+ * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
+ * not the System V one.
+ */
 #define NSUBEXP  10
 typedef struct regexp {
-       const char *startp[NSUBEXP];
-       const char *endp[NSUBEXP];
+       char *startp[NSUBEXP];
+       char *endp[NSUBEXP];
        char regstart;          /* Internal use only. */
        char reganch;           /* Internal use only. */
        char *regmust;          /* Internal use only. */
@@ -20,20 +91,19 @@ typedef struct regexp {
        char program[1];        /* Unwarranted chumminess with compiler. */
 } regexp;
 
-/* Keep these functions away from the POSIX versions. */
-#define regcomp _v8_regcomp
-#define regexec _v8_regexec
-#define regsub _v8_regsub
-#define regerror _v8_regerror
-
-/* Function Prototypes. */
-regexp *regcomp(const char *_exp);
-int regexec(regexp *_prog, const char *_string, int _bolflag);
-void regsub(regexp *_prog, char *_source, char *_dest);
-void regerror(const char *_message) ;
+#include <sys/cdefs.h>
 
-#endif /* _REGEXP_H */
+__BEGIN_DECLS
+#ifdef __LIBCOMPAT_SOURCE__
+regexp *__compat_regcomp(const char *);
+int __compat_regexec(const  regexp *, const char *);
+void __compat_regsub(const  regexp *, const char *, char *);
+void __compat_regerror(const char *);
+#endif
+regexp *regcomp(const char *) __RENAME(__compat_regcomp);
+int regexec(const  regexp *, const char *) __RENAME(__compat_regexec);
+void regsub(const  regexp *, const char *, char *) __RENAME(__compat_regsub);
+void regerror(const char *) __RENAME(__compat_regerror);
+__END_DECLS
 
-/*
- * $PchId: regexp.h,v 1.4 1996/04/10 21:43:17 philip Exp $
- */
+#endif /* !_REGEXP_H_ */
index 7a3b3b645edb4896d8e30386514ac1b65c530e24..c5325f8d9f0fed5acaff1b617720f6ff905078bc 100644 (file)
@@ -1 +1,509 @@
-#include <net/gen/resolv.h>
+/*     $NetBSD: resolv.h,v 1.38 2009/10/24 17:23:34 christos Exp $     */
+
+/*
+ * Portions Copyright (C) 2004, 2005, 2008, 2009  Internet Systems Consortium, Inc. ("ISC")
+ * Portions Copyright (C) 1995-2003  Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * Copyright (c) 1983, 1987, 1989
+ *    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. 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.
+ */
+
+/*%
+ *     @(#)resolv.h    8.1 (Berkeley) 6/2/93
+ *     Id: resolv.h,v 1.30 2009/03/03 01:52:48 each Exp
+ */
+
+#ifndef _RESOLV_H_
+#define        _RESOLV_H_
+
+#include <sys/param.h>
+#if (!defined(BSD)) || (BSD < 199306)
+# include <sys/bitypes.h>
+#else
+#include <sys/types.h>
+#endif
+#include <sys/cdefs.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <arpa/nameser.h>
+
+/*%
+ * Revision information.  This is the release date in YYYYMMDD format.
+ * It can change every day so the right thing to do with it is use it
+ * in preprocessor commands such as "#if (__RES > 19931104)".  Do not
+ * compare for equality; rather, use it to determine whether your resolver
+ * is new enough to contain a certain feature.
+ */
+
+#define        __RES   20090302
+
+/*%
+ * This used to be defined in res_query.c, now it's in herror.c.
+ * [XXX no it's not.  It's in irs/irs_data.c]
+ * It was
+ * never extern'd by any *.h file before it was placed here.  For thread
+ * aware programs, the last h_errno value set is stored in res->h_errno.
+ *
+ * XXX:        There doesn't seem to be a good reason for exposing RES_SET_H_ERRNO
+ *     (and __h_errno_set) to the public via <resolv.h>.
+ * XXX:        __h_errno_set is really part of IRS, not part of the resolver.
+ *     If somebody wants to build and use a resolver that doesn't use IRS,
+ *     what do they do?  Perhaps something like
+ *             #ifdef WANT_IRS
+ *             # define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
+ *             #else
+ *             # define RES_SET_H_ERRNO(r,x) (h_errno = (r)->res_h_errno = (x))
+ *             #endif
+ */
+
+#define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
+struct __res_state; /*%< forward */
+__BEGIN_DECLS
+void __h_errno_set(struct __res_state *, int);
+__END_DECLS
+
+/*%
+ * Resolver configuration file.
+ * Normally not present, but may contain the address of the
+ * initial name server(s) to query and the domain search list.
+ */
+
+#ifndef _PATH_RESCONF
+#define _PATH_RESCONF        "/etc/resolv.conf"
+#endif
+
+typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
+       res_sendhookact;
+
+typedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *,
+                                             const u_char **, int *,
+                                             u_char *, int, int *);
+
+typedef res_sendhookact (*res_send_rhook)(const struct sockaddr *,
+                                             const u_char *, int, u_char *,
+                                             int, int *);
+
+struct res_sym {
+       int             number;    /*%< Identifying number, like T_MX */
+       const char *    name;      /*%< Its symbolic name, like "MX" */
+       const char *    humanname; /*%< Its fun name, like "mail exchanger" */
+};
+
+/*%
+ * Global defines and variables for resolver stub.
+ */
+#define        MAXNS                   3       /*%< max # name servers we'll track */
+#define        MAXDFLSRCH              3       /*%< # default domain levels to try */
+#define        MAXDNSRCH               6       /*%< max # domains in search path */
+#define        LOCALDOMAINPARTS        2       /*%< min levels in name that is "local" */
+#define        RES_TIMEOUT             5       /*%< min. seconds between retries */
+#define        MAXRESOLVSORT           10      /*%< number of net to sort on */
+#define        RES_MAXNDOTS            15      /*%< should reflect bit field size */
+#define        RES_MAXRETRANS          30      /*%< only for resolv.conf/RES_OPTIONS */
+#define        RES_MAXRETRY            5       /*%< only for resolv.conf/RES_OPTIONS */
+#define        RES_DFLRETRY            2       /*%< Default #/tries. */
+#define        RES_MAXTIME             65535   /*%< Infinity, in milliseconds. */
+
+struct __res_state_ext;
+
+struct __res_state {
+       int     retrans;                /*%< retransmission time interval */
+       int     retry;                  /*%< number of times to retransmit */
+#ifdef sun
+       u_int   options;                /*%< option flags - see below. */
+#else
+       u_long  options;                /*%< option flags - see below. */
+#endif
+       int     nscount;                /*%< number of name servers */
+       struct sockaddr_in
+               nsaddr_list[MAXNS];     /*%< address of name server */
+#define        nsaddr  nsaddr_list[0]          /*%< for backward compatibility */
+       u_short id;                     /*%< current message id */
+       char    *dnsrch[MAXDNSRCH+1];   /*%< components of domain to search */
+       char    defdname[256];          /*%< default domain (deprecated) */
+#ifdef sun
+       u_int   pfcode;                 /*%< RES_PRF_ flags - see below. */
+#else
+       u_long  pfcode;                 /*%< RES_PRF_ flags - see below. */
+#endif
+       unsigned ndots:4;               /*%< threshold for initial abs. query */
+       unsigned nsort:4;               /*%< number of elements in sort_list[] */
+       char    unused[3];
+       struct {
+               struct in_addr  addr;
+               uint32_t        mask;
+       } sort_list[MAXRESOLVSORT];
+#ifdef __OLD_RES_STATE
+       char lookups[4];
+#else
+       res_send_qhook qhook;           /*%< query hook */
+       res_send_rhook rhook;           /*%< response hook */
+       int     res_h_errno;            /*%< last one set for this context */
+       int     _vcsock;                /*%< PRIVATE: for res_send VC i/o */
+       u_int   _flags;                 /*%< PRIVATE: see below */
+       u_int   _pad;                   /*%< make _u 64 bit aligned */
+       union {
+               /* On an 32-bit arch this means 512b total. */
+               char    pad[56 - 4*sizeof (int) - 3*sizeof (void *)];
+               struct {
+                       uint16_t                nscount;
+                       uint16_t                nstimes[MAXNS]; /*%< ms. */
+                       int                     nssocks[MAXNS];
+                       struct __res_state_ext *ext;    /*%< extention for IPv6 */
+               } _ext;
+       } _u;
+       u_char  *_rnd;                  /*%< PRIVATE: random state */
+#endif
+};
+
+typedef struct __res_state *res_state;
+
+union res_sockaddr_union {
+       struct sockaddr_in      sin;
+#ifdef IN6ADDR_ANY_INIT
+       struct sockaddr_in6     sin6;
+#endif
+#ifdef ISC_ALIGN64
+       int64_t                 __align64;      /*%< 64bit alignment */
+#else
+       int32_t                 __align32;      /*%< 32bit alignment */
+#endif
+       char                    __space[128];   /* max size */
+};
+
+/*%
+ * Resolver flags (used to be discrete per-module statics ints).
+ */
+#define        RES_F_VC        0x00000001      /*%< socket is TCP */
+#define        RES_F_CONN      0x00000002      /*%< socket is connected */
+#define        RES_F_EDNS0ERR  0x00000004      /*%< EDNS0 caused errors */
+#define        RES_F__UNUSED   0x00000008      /*%< (unused) */
+#define        RES_F_LASTMASK  0x000000F0      /*%< ordinal server of last res_nsend */
+#define        RES_F_LASTSHIFT 4               /*%< bit position of LASTMASK "flag" */
+#define        RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT)
+
+/* res_findzonecut2() options */
+#define        RES_EXHAUSTIVE  0x00000001      /*%< always do all queries */
+#define        RES_IPV4ONLY    0x00000002      /*%< IPv4 only */
+#define        RES_IPV6ONLY    0x00000004      /*%< IPv6 only */
+
+/*%
+ * Resolver options (keep these in synch with res_debug.c, please)
+ */
+#define RES_INIT       0x00000001      /*%< address initialized */
+#define RES_DEBUG      0x00000002      /*%< print debug messages */
+#define RES_AAONLY     0x00000004      /*%< authoritative answers only (!IMPL)*/
+#define RES_USEVC      0x00000008      /*%< use virtual circuit */
+#define RES_PRIMARY    0x00000010      /*%< query primary server only (!IMPL) */
+#define RES_IGNTC      0x00000020      /*%< ignore trucation errors */
+#define RES_RECURSE    0x00000040      /*%< recursion desired */
+#define RES_DEFNAMES   0x00000080      /*%< use default domain name */
+#define RES_STAYOPEN   0x00000100      /*%< Keep TCP socket open */
+#define RES_DNSRCH     0x00000200      /*%< search up local domain tree */
+#define        RES_INSECURE1   0x00000400      /*%< type 1 security disabled */
+#define        RES_INSECURE2   0x00000800      /*%< type 2 security disabled */
+#define        RES_NOALIASES   0x00001000      /*%< shuts off HOSTALIASES feature */
+#define        RES_USE_INET6   0x00002000      /*%< use/map IPv6 in gethostbyname() */
+#define RES_ROTATE     0x00004000      /*%< rotate ns list after each query */
+#define        RES_NOCHECKNAME 0x00008000      /*%< do not check names for sanity. */
+#define        RES_KEEPTSIG    0x00010000      /*%< do not strip TSIG records */
+#define        RES_BLAST       0x00020000      /*%< blast all recursive servers */
+#define RES_NSID       0x00040000      /*%< request name server ID */
+#define RES_NOTLDQUERY 0x00100000      /*%< don't unqualified name as a tld */
+#define RES_USE_DNSSEC 0x00200000      /*%< use DNSSEC using OK bit in OPT */
+/* #define RES_DEBUG2  0x00400000 */   /* nslookup internal */
+/* KAME extensions: use higher bit to avoid conflict with ISC use */
+#define RES_USE_DNAME  0x10000000      /*%< use DNAME */
+#define RES_USE_EDNS0  0x40000000      /*%< use EDNS0 if configured */
+#define RES_NO_NIBBLE2 0x80000000      /*%< disable alternate nibble lookup */
+
+#define RES_DEFAULT    (RES_RECURSE | RES_DEFNAMES | \
+                        RES_DNSRCH | RES_NO_NIBBLE2)
+
+/*%
+ * Resolver "pfcode" values.  Used by dig.
+ */
+#define RES_PRF_STATS  0x00000001
+#define RES_PRF_UPDATE 0x00000002
+#define RES_PRF_CLASS   0x00000004
+#define RES_PRF_CMD    0x00000008
+#define RES_PRF_QUES   0x00000010
+#define RES_PRF_ANS    0x00000020
+#define RES_PRF_AUTH   0x00000040
+#define RES_PRF_ADD    0x00000080
+#define RES_PRF_HEAD1  0x00000100
+#define RES_PRF_HEAD2  0x00000200
+#define RES_PRF_TTLID  0x00000400
+#define RES_PRF_HEADX  0x00000800
+#define RES_PRF_QUERY  0x00001000
+#define RES_PRF_REPLY  0x00002000
+#define RES_PRF_INIT   0x00004000
+#define RES_PRF_TRUNC  0x00008000
+/*                     0x00010000      */
+
+/* Things involving an internal (static) resolver context. */
+__BEGIN_DECLS
+extern struct __res_state *__res_get_state(void);
+extern void __res_put_state(struct __res_state *);
+
+/*
+ * Source and Binary compatibility; _res will not work properly
+ * with multi-threaded programs.
+ */
+extern struct __res_state *__res_state(void);
+#define _res (*__res_state())
+
+__END_DECLS
+
+#ifndef __BIND_NOSTATIC
+#define fp_nquery              __fp_nquery
+#define fp_query               __fp_query
+#define hostalias              __hostalias
+#define p_query                        __p_query
+#define res_close              __res_close
+#define res_isourserver                __res_isourserver
+#define        res_opt                 __res_opt
+#define        res_querydomain         __res_querydomain
+#define res_send               __res_send
+#define res_sendsigned         __res_sendsigned
+
+#ifdef notdef
+/* NetBSD protects these via weak symbols. */
+#define        res_init                __res_init
+#define        res_query               __res_query
+#define        res_mkquery             __res_mkquery
+#define        dn_expand               __dn_expand
+#define        res_search              __res_search
+#endif
+
+__BEGIN_DECLS
+void           fp_nquery(const u_char *, int, FILE *);
+void           fp_query(const u_char *, FILE *);
+const char *   hostalias(const char *);
+void           p_query(const u_char *);
+void           res_close(void);
+int            res_init(void);
+int            res_opt(int, u_char *, int, int);
+int            res_isourserver(const struct sockaddr_in *);
+int            res_mkquery(int, const char *, int, int, const u_char *,
+                                int, const u_char *, u_char *, int);
+int            res_query(const char *, int, int, u_char *, int);
+int            res_querydomain(const char *, const char *, int, int,
+                                    u_char *, int);
+int            res_search(const char *, int, int, u_char *, int);
+int            res_send(const u_char *, int, u_char *, int);
+int            res_sendsigned(const u_char *, int, ns_tsig_key *,
+                                   u_char *, int);
+__END_DECLS
+#endif
+
+#if !defined(SHARED_LIBBIND) || defined(LIB)
+/*
+ * If libbind is a shared object (well, DLL anyway)
+ * these externs break the linker when resolv.h is
+ * included by a lib client (like named)
+ * Make them go away if a client is including this
+ *
+ */
+extern const struct res_sym __p_key_syms[];
+extern const struct res_sym __p_cert_syms[];
+extern const struct res_sym __p_class_syms[];
+extern const struct res_sym __p_type_syms[];
+extern const struct res_sym __p_rcode_syms[];
+#endif /* SHARED_LIBBIND */
+
+#define b64_ntop               __b64_ntop
+#define b64_pton               __b64_pton
+#define dn_comp                        __dn_comp
+#define dn_count_labels                __dn_count_labels
+#define dn_skipname            __dn_skipname
+#define fp_resstat             __fp_resstat
+#define loc_aton               __loc_aton
+#define loc_ntoa               __loc_ntoa
+#define p_cdname               __p_cdname
+#define p_cdnname              __p_cdnname
+#define p_class                        __p_class
+#define p_fqname               __p_fqname
+#define p_fqnname              __p_fqnname
+#define p_option               __p_option
+#define p_secstodate           __p_secstodate
+#define p_section              __p_section
+#define p_time                 __p_time
+#define p_type                 __p_type
+#define p_rcode                        __p_rcode
+#define p_sockun               __p_sockun
+#define putlong                        __putlong
+#define putshort               __putshort
+#define        res_check               __res_check
+#define res_dnok               __res_dnok
+#define res_findzonecut                __res_findzonecut
+#define res_findzonecut2       __res_findzonecut2
+#define res_hnok               __res_hnok
+#define res_hostalias          __res_hostalias
+#define res_mailok             __res_mailok
+#define res_nameinquery                __res_nameinquery
+#define res_nclose             __res_nclose
+#define res_ninit              __res_ninit
+#define res_nmkquery           __res_nmkquery
+#define res_pquery             __res_pquery
+#define res_nquery             __res_nquery
+#define res_nquerydomain       __res_nquerydomain
+#define res_nsearch            __res_nsearch
+#define res_nsend              __res_nsend
+#define res_nsendsigned                __res_nsendsigned
+#define res_nisourserver       __res_nisourserver
+#define res_ownok              __res_ownok
+#define res_queriesmatch       __res_queriesmatch
+#define res_rndinit            __res_rndinit
+#define res_randomid           __res_randomid
+#define res_nrandomid          __res_nrandomid
+#define sym_ntop               __sym_ntop
+#define sym_ntos               __sym_ntos
+#define sym_ston               __sym_ston
+#define res_nopt               __res_nopt
+#define res_nopt_rdata         __res_nopt_rdata
+#define res_ndestroy           __res_ndestroy
+#define        res_nametoclass         __res_nametoclass
+#define        res_nametotype          __res_nametotype
+#define        res_setservers          __res_setservers
+#define        res_getservers          __res_getservers
+#define        res_buildprotolist      __res_buildprotolist
+#define        res_destroyprotolist    __res_destroyprotolist
+#define        res_destroyservicelist  __res_destroyservicelist
+#define        res_get_nibblesuffix    __res_get_nibblesuffix
+#define        res_get_nibblesuffix2   __res_get_nibblesuffix2
+#define        res_ourserver_p         __res_ourserver_p
+#define        res_protocolname        __res_protocolname
+#define        res_protocolnumber      __res_protocolnumber
+#define        res_send_setqhook       __res_send_setqhook
+#define        res_send_setrhook       __res_send_setrhook
+#define        res_servicename         __res_servicename
+#define        res_servicenumber       __res_servicenumber
+__BEGIN_DECLS
+int            res_hnok(const char *);
+int            res_ownok(const char *);
+int            res_mailok(const char *);
+struct timespec;
+int            res_check(res_state, struct timespec *);
+int            res_dnok(const char *);
+int            sym_ston(const struct res_sym *, const char *, int *);
+const char *   sym_ntos(const struct res_sym *, int, int *);
+const char *   sym_ntop(const struct res_sym *, int, int *);
+int            b64_ntop(u_char const *, size_t, char *, size_t);
+int            b64_pton(char const *, u_char *, size_t);
+int            loc_aton(const char *, u_char *);
+const char *   loc_ntoa(const u_char *, char *);
+int            dn_skipname(const u_char *, const u_char *);
+void           putlong(uint32_t, u_char *);
+void           putshort(uint16_t, u_char *);
+#ifndef __ultrix__
+uint16_t       _getshort(const u_char *);
+uint32_t       _getlong(const u_char *);
+#endif
+const char *   p_class(int);
+const char *   p_time(uint32_t);
+const char *   p_type(int);
+const char *   p_rcode(int);
+const char *   p_sockun(union res_sockaddr_union, char *, size_t);
+const u_char * p_cdnname(const u_char *, const u_char *, int, FILE *);
+const u_char * p_cdname(const u_char *, const u_char *, FILE *);
+const u_char * p_fqnname(const u_char *, const u_char *,
+                              int, char *, int);
+const u_char * p_fqname(const u_char *, const u_char *, FILE *);
+const char *   p_option(u_long);
+char *         p_secstodate(u_long);
+int            dn_count_labels(const char *);
+int            dn_comp(const char *, u_char *, int, u_char **, u_char **);
+int            dn_expand(const u_char *, const u_char *, const u_char *,
+                              char *, int);
+void           res_rndinit(res_state);
+u_int          res_randomid(void);
+u_int          res_nrandomid(res_state);
+int            res_nameinquery(const char *, int, int, const u_char *,
+                                    const u_char *);
+int            res_queriesmatch(const u_char *, const u_char *,
+                                     const u_char *, const u_char *);
+const char *   p_section(int, int);
+/* Things involving a resolver context. */
+int            res_ninit(res_state);
+int            res_nisourserver(const res_state, const struct sockaddr_in *);
+void           fp_resstat(const res_state, FILE *);
+void           res_pquery(const res_state, const u_char *, int, FILE *);
+const char *   res_hostalias(const res_state, const char *, char *, size_t);
+int            res_nquery(res_state, const char *, int, int, u_char *, int);
+int            res_nsearch(res_state, const char *, int, int, u_char *, int);
+int            res_nquerydomain(res_state, const char *, const char *,
+                                     int, int, u_char *, int);
+int            res_nmkquery(res_state, int, const char *, int, int,
+                                 const u_char *, int, const u_char *,
+                                 u_char *, int);
+int            res_nsend(res_state, const u_char *, int, u_char *, int);
+int            res_nsendsigned(res_state, const u_char *, int,
+                                    ns_tsig_key *, u_char *, int);
+int            res_findzonecut(res_state, const char *, ns_class, int,
+                                    char *, size_t, struct in_addr *, int);
+int            res_findzonecut2(res_state, const char *, ns_class, int,
+                                     char *, size_t,
+                                     union res_sockaddr_union *, int);
+void           res_nclose(res_state);
+int            res_nopt(res_state, int, u_char *, int, int);
+int            res_nopt_rdata(res_state, int, u_char *, int, u_char *,
+                                   u_short, u_short, u_char *);
+void           res_send_setqhook(res_send_qhook);
+void           res_send_setrhook(res_send_rhook);
+int            __res_vinit(res_state, int);
+void           res_destroyservicelist(void);
+const char *   res_servicename(uint16_t, const char *);
+const char *   res_protocolname(int);
+void           res_destroyprotolist(void);
+void           res_buildprotolist(void);
+const char *   res_get_nibblesuffix(res_state);
+const char *   res_get_nibblesuffix2(res_state);
+void           res_ndestroy(res_state);
+uint16_t       res_nametoclass(const char *, int *);
+uint16_t       res_nametotype(const char *, int *);
+void           res_setservers(res_state,
+                                   const union res_sockaddr_union *, int);
+int            res_getservers(res_state,
+                                   union res_sockaddr_union *, int);
+__END_DECLS
+
+#endif /* !_RESOLV_H_ */
similarity index 100%
rename from nbsd_include/rmt.h
rename to include/rmt.h
similarity index 100%
rename from nbsd_include/rpc/auth.h
rename to include/rpc/auth.h
similarity index 100%
rename from nbsd_include/rpc/clnt.h
rename to include/rpc/clnt.h
similarity index 100%
rename from nbsd_include/rpc/raw.h
rename to include/rpc/raw.h
similarity index 100%
rename from nbsd_include/rpc/rpc.h
rename to include/rpc/rpc.h
similarity index 100%
rename from nbsd_include/rpc/svc.h
rename to include/rpc/svc.h
similarity index 100%
rename from nbsd_include/rpc/types.h
rename to include/rpc/types.h
similarity index 100%
rename from nbsd_include/rpc/xdr.h
rename to include/rpc/xdr.h
similarity index 100%
rename from nbsd_include/sa.h
rename to include/sa.h
similarity index 100%
rename from nbsd_include/sched.h
rename to include/sched.h
similarity index 100%
rename from nbsd_include/search.h
rename to include/search.h
similarity index 100%
rename from nbsd_include/semaphore.h
rename to include/semaphore.h
index f1a9285320f48f1ecc73c8b2a57b15298206f9b0..b951235542514a5ab75a1f471803ea86fdb366d3 100644 (file)
@@ -1,88 +1,85 @@
-/* The <setjmp.h> header relates to the C phenomenon known as setjmp/longjmp.
- * It is used to escape out of the current situation into a previous one.
- *
- * The actual implementations of all these functions and, by extension, parts
- * of this header, are both compiler- and architecture-dependent. Currently
- * two compilers are supported: ACK and GCC. Each of these has their own
- * implementation of the functions in their runtime system library code.
- * As it is impossible to predict the requirements for any other compilers,
- * this header may not be compatible with such other compilers either.
- *
- * The ACK compiler will not enregister any variables inside a function
- * containing a setjmp call, even if those variables are explicitly declared
- * as register variables. Thus for ACK, of all the registers, only the
- * program counter, stack pointer and frame pointer have to be saved into the
- * jmp_buf structure. This makes the jmp_buf structure very small, and
- * moreover, the implementation of the setjmp/longjmp calls (written in EM)
- * architecture-independent and thus very portable. The ACK compiler
- * recognizes only the symbol __setjmp as being such a setjmp call.
- *
- * The GCC compiler recognizes all of the setjmp/_setjmp/__setjmp name
- * variants as calls to setjmp functions, and treats them as special
- * accordingly, but does require that the setjmp implementation save and
- * restore most of the registers. It has no portable setjmp and longjmp
- * functions like ACK, and therefore has to have enough space in the jmp_buf
- * structure to store the registers on any architecture it's ported to.
- *
- * Taking the common denominator of both compilers, the function definitions
- * in this header rely on the presence of merely two functions: __setjmp and
- * longjmp. On the other hand, the size of jmp_buf depends on the compiler
- * used: for ACK, jmp_buf is exactly big enough to store the three mentioned
- * registers; for GCC and any other compiler, the size is chosen in such a
- * way that it's likely to offer enough room to store registers for any
- * architecture. The POSIX sigjmp_buf is identical to jmp_buf in all cases.
- *
- * As far as porting is concerned --
+/*     $NetBSD: setjmp.h,v 1.25 2009/08/12 04:57:36 matt Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
  *
- * All code writers/porters that have to deal with the actual contents of the
- * jmp_buf structure in one way or another, should look at  <sys/jmp_buf.h>.
+ * 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. 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.
  *
- * Porters of a new compiler to Minix have to make sure the compiler
- * recognizes at least __setjmp as a setjmp call (if applicable) and provide
- * library implementations of __setjmp and longjmp conforming to their
- * declarations below; if this is not possible, compiler-specific code will
- * have to be added to this header.
+ * 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.
  *
- * Porters of Minix+GCC to other architectures have to make sure that the
- * __regs array of the jmp_buf structure is large enough to hold all the
- * registers the __setjmp implementation for that architecture has to save.
+ *     @(#)setjmp.h    8.2 (Berkeley) 1/21/94
  */
 
-#ifndef _SETJMP_H
-#define _SETJMP_H
+#ifndef _SETJMP_H_
+#define _SETJMP_H_
 
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
+#include <sys/featuretest.h>
 
-typedef struct {
-#if defined(__ACK__)
-  _PROTOTYPE(void (*__pc),(void));     /* program counter */
-  void *__sp;                  /* stack pointer */
-  void *__lb;                  /* local base (ACKspeak for frame pointer) */
-  long __mask;                 /* must have size >= sizeof(sigset_t) */
-  int __flags;
-#else /* GCC */
-  int __flags;                 /* XXX - long might give better alignment */
-  long __mask;                 /* must have size >= sizeof(sigset_t) */
-  void *__regs[16];            /* actual use is architecture dependent */
+#include <machine/setjmp.h>
+
+#ifndef _JB_ATTRIBUTES
+#define _JB_ATTRIBUTES /**/
+#else
+#endif
+#ifndef _BSD_JBSLOT_T_
+#define        _BSD_JBSLOT_T_  long
 #endif
-} jmp_buf[1];
 
-_PROTOTYPE( int __setjmp, (jmp_buf _env, int _savemask)                        );
-_PROTOTYPE( void longjmp, (jmp_buf _env, int _val)                     );
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+typedef _BSD_JBSLOT_T_ sigjmp_buf[_JBLEN + 1] _JB_ATTRIBUTES;
+#endif /* not ANSI */
+
+typedef _BSD_JBSLOT_T_ jmp_buf[_JBLEN] _JB_ATTRIBUTES;
 
-#define setjmp(env)    __setjmp((env), 1)
+#include <sys/cdefs.h>
 
-#ifdef _MINIX
-#define _setjmp(env)   __setjmp((env), 0)
-#define _longjmp(env, val)     longjmp((env), (val))
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+int    setjmp(jmp_buf)                  __RENAME(__setjmp14);
+void   longjmp(jmp_buf, int)            __RENAME(__longjmp14) __dead;
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+int    sigsetjmp(sigjmp_buf, int)      __RENAME(__sigsetjmp14);
+void   siglongjmp(sigjmp_buf, int)      __RENAME(__siglongjmp14) __dead;
+#endif /* not ANSI */
+#endif /* __LIBC12_SOURCE__ */
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+int    _setjmp(jmp_buf);
+void   _longjmp(jmp_buf, int) __dead;
 #endif
 
-#ifdef _POSIX_SOURCE
-typedef jmp_buf sigjmp_buf;
-#define sigsetjmp(env, savemask) __setjmp((env), (savemask))
-#define siglongjmp(env, val)   longjmp((env), (val))
-#endif /* _POSIX_SOURCE */
+#if defined(_NETBSD_SOURCE)
+void   longjmperror(void);
+#endif
+__END_DECLS
 
-#endif /* _SETJMP_H */
+#endif /* !_SETJMP_H_ */
index 0e9ac1e266e40cbddff27ce002a03596595cdfd3..1ac310069743f856264b30fca731a285ccf95b73 100644 (file)
@@ -1,92 +1,48 @@
-/* The <sgtty.h> header contains data structures for ioctl(). */
-
-#ifndef _SGTTY_H
-#define _SGTTY_H
-
-/* Should not be used, nor extended. Termios.h is the replacement for
- * sgtty.h for tty functions, and ioctl replaced code should be moved to
- * sys/ioctl.h and specific header files in the sys, or minix directory.
+/*     $NetBSD: sgtty.h,v 1.8 2005/02/03 04:39:32 perry Exp $  */
+
+/*
+ * Copyright (c) 1985, 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. 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.
+ *
+ *     @(#)sgtty.h     8.1 (Berkeley) 6/2/93
  */
-#include <sys/ioctl.h>         /* Ouch. */
-
-struct sgttyb {
-  char sg_ispeed;              /* input speed */
-  char sg_ospeed;              /* output speed */
-  char sg_erase;               /* erase character */
-  char sg_kill;                        /* kill character */
-  int  sg_flags;               /* mode flags */
-};
-
-struct tchars {
-  char t_intrc;                        /* SIGINT char */
-  char t_quitc;                        /* SIGQUIT char */
-  char t_startc;               /* start output (initially CTRL-Q) */
-  char t_stopc;                        /* stop output  (initially CTRL-S) */
-  char t_eofc;                 /* EOF (initially CTRL-D) */
-  char t_brkc;                 /* input delimiter (like nl) */
-};
-
-#if !_SYSTEM                   /* the kernel doesn't want to see the rest */
-
-/* Field names */
-#define XTABS       0006000    /* do tab expansion */
-#define BITS8        0001400   /* 8 bits/char */
-#define BITS7        0001000   /* 7 bits/char */
-#define BITS6        0000400   /* 6 bits/char */
-#define BITS5        0000000   /* 5 bits/char */
-#define EVENP        0000200   /* even parity */
-#define ODDP         0000100   /* odd parity */
-#define RAW         0000040    /* enable raw mode */
-#define CRMOD       0000020    /* map lf to cr + lf */
-#define ECHO        0000010    /* echo input */
-#define CBREAK      0000002    /* enable cbreak mode */
-#define COOKED       0000000   /* neither CBREAK nor RAW */
-
-#define DCD          0100000   /* Data Carrier Detect */
 
-/* Line speeds */
-#define B0                0    /* code for line-hangup */
-#define B110              1
-#define B300              3
-#define B1200            12
-#define B2400            24
-#define B4800            48
-#define B9600            96
-#define B19200          192
-#define B38400          195
-#define B57600          194
-#define B115200                 193
+#ifndef _SGTTY_H_
+#define _SGTTY_H_
 
-/* Things Minix supports but not properly */
-/* the divide-by-100 encoding ain't too hot */
-#define ANYP         0000300
-#define B50                0
-#define B75                0
-#define B134               0
-#define B150               0
-#define B200               2
-#define B600               6
-#define B1800             18
-#define B3600             36
-#define B7200             72
-#define EXTA             192
-#define EXTB               0
+#ifndef USE_OLD_TTY
+#define        USE_OLD_TTY
+#endif
+#include <sys/ioctl.h>
+#include <sys/cdefs.h>
 
-/* Things Minix doesn't support but are fairly harmless if used */
-#define NLDELAY      0001400
-#define TBDELAY      0006000
-#define CRDELAY      0030000
-#define VTDELAY      0040000
-#define BSDELAY      0100000
-#define ALLDELAY     0177400
+__BEGIN_DECLS
+int gtty(int, struct sgttyb *);
+int stty(int, struct sgttyb *);
+__END_DECLS
 
-/* Copied from termios.h: */
-struct winsize
-{
-       unsigned short  ws_row;         /* rows, in characters */
-       unsigned short  ws_col;         /* columns, in characters */
-       unsigned short  ws_xpixel;      /* horizontal size, pixels */
-       unsigned short  ws_ypixel;      /* vertical size, pixels */
-};
-#endif /* !_SYSTEM */
-#endif /* _SGTTY_H */
+#endif /* _SGTTY_H_ */
index 218be8caed86887073bfcd78bea524480c21b957..3d225cb75aebbdb81ea944140f786d253dd06e8d 100644 (file)
-/* The <signal.h> header defines all the ANSI and POSIX signals.
- * MINIX supports all the signals required by POSIX. They are defined below.
- * Some additional signals are also supported.
+/*     $NetBSD: signal.h,v 1.54 2010/08/27 08:40:38 christos Exp $     */
+
+/*-
+ * Copyright (c) 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. 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.
+ *
+ *     @(#)signal.h    8.3 (Berkeley) 3/30/94
  */
 
-#ifndef _SIGNAL_H
-#define _SIGNAL_H
+#ifndef _SIGNAL_H_
+#define _SIGNAL_H_
 
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
-#ifdef _POSIX_SOURCE
-#ifndef _TYPES_H
-#include <minix/types.h>
-#endif
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#include <sys/types.h>
 #endif
 
-/* Here are types that are closely associated with signal handling. */
-typedef int sig_atomic_t;
+#include <sys/signal.h>
 
-#ifdef _POSIX_SOURCE
-#ifndef _SIGSET_T
-#define _SIGSET_T
-typedef unsigned long sigset_t;
+#if defined(_NETBSD_SOURCE)
+extern const char *const *sys_signame __RENAME(__sys_signame14);
+#ifndef __SYS_SIGLIST_DECLARED
+#define __SYS_SIGLIST_DECLARED
+/* also in unistd.h */
+extern const char *const *sys_siglist __RENAME(__sys_siglist14);
+#endif /* __SYS_SIGLIST_DECLARED */
+extern const int sys_nsig __RENAME(__sys_nsig14);
 #endif
+
+__BEGIN_DECLS
+int    raise(int);
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+int    kill(pid_t, int);
+int    __libc_sigaction14(int, const struct sigaction * __restrict,
+           struct sigaction * __restrict);
+
+#ifndef __minix
+#if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+int    pthread_sigmask(int, const sigset_t * __restrict,
+           sigset_t * __restrict);
+int    pthread_kill(pthread_t, int);
+int    __libc_thr_sigsetmask(int, const sigset_t * __restrict,
+           sigset_t * __restrict);
+#ifndef __LIBPTHREAD_SOURCE__
+#define        pthread_sigmask         __libc_thr_sigsetmask
+#endif /* __LIBPTHREAD_SOURCE__ */
+#endif
+#endif /* __minix */
+
+#ifndef __LIBC12_SOURCE__
+int    sigaction(int, const struct sigaction * __restrict,
+    struct sigaction * __restrict) __RENAME(__sigaction14);
+#if defined(__minix) && defined(_SYSTEM)
+#define sigaddset(set, sig)    __sigaddset((set), (sig))
+#define sigdelset(set, sig)    __sigdelset((set), (sig))
+#define sigemptyset(set)       __sigemptyset((set))
+#define sigfillset(set)                __sigfillset((set))
+#define sigismember(set, sig)  __sigismember((set), (sig))
+#else
+int    sigaddset(sigset_t *, int) __RENAME(__sigaddset14);
+int    sigdelset(sigset_t *, int) __RENAME(__sigdelset14);
+int    sigemptyset(sigset_t *) __RENAME(__sigemptyset14);
+int    sigfillset(sigset_t *) __RENAME(__sigfillset14);
+int    sigismember(const sigset_t *, int) __RENAME(__sigismember14);
 #endif
+int    sigpending(sigset_t *) __RENAME(__sigpending14);
+int    sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict)
+    __RENAME(__sigprocmask14);
+int    sigsuspend(const sigset_t *) __RENAME(__sigsuspend14);
 
-/* Regular signals. */
-#define SIGHUP             1   /* hangup */
-#define SIGINT             2   /* interrupt (DEL) */
-#define SIGQUIT            3   /* quit (ASCII FS) */
-#define SIGILL             4   /* illegal instruction */
-#define SIGTRAP            5   /* trace trap (not reset when caught) */
-#define SIGABRT            6   /* IOT instruction */
-#define SIGBUS             7   /* bus error */
-#define SIGFPE             8   /* floating point exception */
-#define SIGKILL            9   /* kill (cannot be caught or ignored) */
-#define SIGUSR1           10   /* user defined signal # 1 */
-#define SIGSEGV           11   /* segmentation violation */
-#define SIGUSR2           12   /* user defined signal # 2 */
-#define SIGPIPE           13   /* write on a pipe with no one to read it */
-#define SIGALRM           14   /* alarm clock */
-#define SIGTERM           15   /* software termination signal from kill */
-#define SIGEMT           16    /* EMT instruction */
-#define SIGCHLD           17   /* child process terminated or stopped */
-#define SIGWINCH         21    /* window size has changed */
-#define SIGVTALRM         24   /* virtual alarm */
-#define SIGPROF           25   /* profiler alarm */
-
-/* POSIX requires the following signals to be defined, even if they are
- * not supported.  Here are the definitions, but they are not supported.
- */
-#define SIGCONT           18   /* continue if stopped */
-#define SIGSTOP           19   /* stop signal */
-#define SIGTSTP           20   /* interactive stop signal */
-#define SIGTTIN           22   /* background process wants to read */
-#define SIGTTOU           23   /* background process wants to write */
-
-#define _NSIG             26   /* highest signal number plus one */
-#define NSIG             _NSIG
-
-#ifdef _MINIX
-#define SIGIOT             SIGABRT /* for people who speak PDP-11 */
-
-/* MINIX specific signals. These signals are not used by user proceses, 
- * but meant to inform system processes, like the PM, about system events.
- * The order here determines the order signals are processed by system
- * processes in user-space. Higher-priority signals should be first.
- */
-/* Signals delivered by a signal manager. */
-#define SIGSNDELAY       26    /* end of delay for signal delivery */
-
-#define SIGS_FIRST       SIGHUP      /* first system signal */
-#define SIGS_LAST        SIGSNDELAY   /* last system signal */
-#define IS_SIGS(signo)    (signo>=SIGS_FIRST && signo<=SIGS_LAST)
-
-/* Signals delivered by the kernel. */
-#define SIGKMEM                  27    /* kernel memory request pending */
-#define SIGKMESS         28    /* new kernel message */
-#define SIGKSIGSM        29    /* kernel signal pending for signal manager */
-#define SIGKSIG          30    /* kernel signal pending */
-
-#define SIGK_FIRST       SIGKMEM      /* first kernel signal */
-#define SIGK_LAST        SIGKSIG     /* last kernel signal */
-#define IS_SIGK(signo)    (signo>=SIGK_FIRST && signo<=SIGK_LAST)
-
-/* Termination signals for Minix system processes. */
-#define SIGS_IS_LETHAL(sig) \
-    (sig == SIGILL || sig == SIGBUS || sig == SIGFPE || sig == SIGSEGV \
-    || sig == SIGEMT || sig == SIGABRT)
-#define SIGS_IS_TERMINATION(sig) (SIGS_IS_LETHAL(sig) \
-    || (sig == SIGKILL || sig == SIGPIPE))
-#define SIGS_IS_STACKTRACE(sig) (SIGS_IS_LETHAL(sig) && sig != SIGABRT)
+#if defined(__c99inline) || defined(__SIGSETOPS_BODY)
 
+#if defined(__SIGSETOPS_BODY)
+#undef __c99inline
+#define        __c99inline
 #endif
 
-/* The sighandler_t type is not allowed unless _POSIX_SOURCE is defined. */
-typedef void _PROTOTYPE( (*__sighandler_t), (int) );
-
-/* Macros used as function pointers. */
-#define SIG_ERR    ((__sighandler_t) -1)       /* error return */
-#define SIG_DFL           ((__sighandler_t)  0)        /* default signal handling */
-#define SIG_IGN           ((__sighandler_t)  1)        /* ignore signal */
-#define SIG_HOLD   ((__sighandler_t)  2)       /* block signal */
-#define SIG_CATCH  ((__sighandler_t)  3)       /* catch signal */
-
-#ifdef _POSIX_SOURCE
-struct sigaction {
-  __sighandler_t sa_handler;   /* SIG_DFL, SIG_IGN, or pointer to function */
-  sigset_t sa_mask;            /* signals to be blocked during handler */
-  int sa_flags;                        /* special flags */
-};
-
-/* Fields for sa_flags. */
-#define SA_ONSTACK   0x0001    /* deliver signal on alternate stack */
-#define SA_RESETHAND 0x0002    /* reset signal handler when signal caught */
-#define SA_NODEFER   0x0004    /* don't block signal while catching it */
-#define SA_RESTART   0x0008    /* automatic system call restart */
-#define SA_SIGINFO   0x0010    /* extended signal handling */
-#define SA_NOCLDWAIT 0x0020    /* don't create zombies */
-#define SA_NOCLDSTOP 0x0040    /* don't receive SIGCHLD when child stops */
-
-/* POSIX requires these values for use with sigprocmask(2). */
-#define SIG_BLOCK          0   /* for blocking signals */
-#define SIG_UNBLOCK        1   /* for unblocking signals */
-#define SIG_SETMASK        2   /* for setting the signal mask */
-#define SIG_INQUIRE        4   /* for internal use only */
-
-/* codes for SIGFPE */
-#define FPE_INTOVF      1      /* integer divide by zero */
-#define FPE_INTDIV      2      /* integer overflow */
-#define FPE_FLTDIV      3      /* floating-point divide by zero */
-#define FPE_FLTOVF      4      /* floating-point overflow */
-#define FPE_FLTUND      5      /* floating-point underflow */
-#define FPE_FLTRES      6      /* floating-point inexact result */
-#define FPE_FLTINV      7      /* floating-point invalid operation */
-#define FPE_FLTSUB      8      /* subscript out of range */
-
-typedef struct sigaltstack {
-  void *ss_sp;
-  int ss_flags;
-  size_t ss_size;
-} stack_t;
-
-#define MINSIGSTKSZ    2048    /* Minimal stack size is 2k */
-
-/* Fields for ss_flags */
-#define SS_ONSTACK      1      /* Process is executing on an alternate stack */
-#define SS_DISABLE      2      /* Alternate stack is disabled */
-
-
-#endif /* _POSIX_SOURCE */
-
-/* POSIX and ANSI function prototypes. */
-_PROTOTYPE( int raise, (int _sig)                                      );
-_PROTOTYPE( __sighandler_t signal, (int _sig, __sighandler_t _func)    );
-
-#ifdef _POSIX_SOURCE
-_PROTOTYPE( int kill, (pid_t _pid, int _sig)                           );
-_PROTOTYPE( int killpg, (pid_t _pgrp, int _sig)                                );
-_PROTOTYPE( int sigaction,
-    (int _sig, const struct sigaction *_act, struct sigaction *_oact)  );
-_PROTOTYPE( int sigpending, (sigset_t *_set)                           );
-_PROTOTYPE( int sigprocmask,
-           (int _how, const sigset_t *_set, sigset_t *_oset)           );
-_PROTOTYPE( int sigsuspend, (const sigset_t *_sigmask)                 );
-
-/* For the sigset functions, only use the library version with error
- * checking from user programs. System programs need to be able to use
- * nonstanard signals.
- */
-#ifndef _SYSTEM
-_PROTOTYPE( int sigaddset, (sigset_t *_set, int _sig)                  );
-_PROTOTYPE( int sigdelset, (sigset_t *_set, int _sig)                  );
-_PROTOTYPE( int sigemptyset, (sigset_t *_set)                          );
-_PROTOTYPE( int sigfillset, (sigset_t *_set)                           );
-_PROTOTYPE( int sigismember, (const sigset_t *_set, int _sig)          );
-#else
-#define sigaddset(set, sig)    ((int) ((*(set) |= (1 << (sig))) && 0))
-#define sigdelset(set, sig)    ((int) ((*(set) &= ~(1 << (sig))) && 0))
-#define sigemptyset(set)       ((int) (*(set) = 0))
-#define sigfillset(set)                ((int) ((*(set) = ~0) && 0))
-#define sigismember(set, sig)  ((*(set) & (1 << (sig))) ? 1 : 0)
+/* note: this appears in both errno.h and signal.h */
+#ifndef __errno
+int *__errno(void);
+#define __errno __errno
 #endif
 
+/* the same as "errno" - but signal.h is not allowed to define that */
+#ifndef ___errno
+#define ___errno (*__errno())
 #endif
 
-#endif /* _SIGNAL_H */
+#if !defined(__minix) || !defined(_SYSTEM)
+__c99inline int
+sigaddset(sigset_t *set, int signo)
+{
+       if (signo <= 0 || signo >= _NSIG) {
+               ___errno = 22;                  /* EINVAL */
+               return (-1);
+       }
+       __sigaddset(set, signo);
+       return (0);
+}
+
+__c99inline int
+sigdelset(sigset_t *set, int signo)
+{
+       if (signo <= 0 || signo >= _NSIG) {
+               ___errno = 22;                  /* EINVAL */
+               return (-1);
+       }
+       __sigdelset(set, signo);
+       return (0);
+}
+
+__c99inline int
+sigismember(const sigset_t *set, int signo)
+{
+       if (signo <= 0 || signo >= _NSIG) {
+               ___errno = 22;                  /* EINVAL */
+               return (-1);
+       }
+       return (__sigismember(set, signo));
+}
+
+__c99inline int
+sigemptyset(sigset_t *set)
+{
+       __sigemptyset(set);
+       return (0);
+}
+
+__c99inline int
+sigfillset(sigset_t *set)
+{
+       __sigfillset(set);
+       return (0);
+}
+#endif /* !defined(__minix) || !defined(_SYSTEM) */
+#endif /* __c99inline */
+#endif /* !__LIBC12_SOURCE__ */
+
+/*
+ * X/Open CAE Specification Issue 4 Version 2
+ */      
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+int    killpg(pid_t, int);
+int    siginterrupt(int, int);
+#ifndef __minix
+int    sigstack(const struct sigstack *, struct sigstack *);
+#ifndef __LIBC12_SOURCE__
+int    sigaltstack(const stack_t * __restrict, stack_t * __restrict)
+    __RENAME(__sigaltstack14);
+#endif
+#endif /* !__minix */
+int    sighold(int);
+int    sigignore(int);
+int    sigpause(int);
+int    sigrelse(int);
+void   (*sigset (int, void (*)(int)))(int);
+#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+
+
+/*
+ * X/Open CAE Specification Issue 5; IEEE Std 1003.1b-1993 (POSIX)
+ */      
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#ifndef __minix 
+int    sigwait (const sigset_t * __restrict, int * __restrict);
+int    sigwaitinfo(const sigset_t * __restrict, siginfo_t * __restrict);
+#endif /* !__minix */
+void   psiginfo(const siginfo_t *, const char *);
+
+#ifndef __minix
+#ifndef __LIBC12_SOURCE__
+struct timespec;
+int    sigtimedwait(const sigset_t * __restrict,
+    siginfo_t * __restrict, const struct timespec * __restrict)
+    __RENAME(__sigtimedwait50);
+int    __sigtimedwait(const sigset_t * __restrict,
+    siginfo_t * __restrict, struct timespec * __restrict)
+    __RENAME(____sigtimedwait50);
+#endif
+#endif /* !__minix */
+#endif /* _POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE_EXTENDED || ... */
+
+
+#if defined(_NETBSD_SOURCE)
+#ifndef __minix
+#ifndef __PSIGNAL_DECLARED
+#define __PSIGNAL_DECLARED
+/* also in unistd.h */
+void   psignal(int, const char *);
+#endif /* __PSIGNAL_DECLARED */
+#endif /* !__minix */
+int    sigblock(int);
+int    sigsetmask(int);
+#endif /* _NETBSD_SOURCE */
+
+#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
+__END_DECLS
+
+#endif /* !_SIGNAL_H_ */
similarity index 100%
rename from nbsd_include/ssp/ssp.h
rename to include/ssp/ssp.h
similarity index 100%
rename from nbsd_include/ssp/stdio.h
rename to include/ssp/stdio.h
similarity index 100%
rename from nbsd_include/stab.h
rename to include/stab.h
diff --git a/include/stdarg.h b/include/stdarg.h
deleted file mode 100644 (file)
index 40a4298..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/* The <stdarg.h> header is ANSI's way to handle variable numbers of params.
- * Some programming languages require a function that is declared with n
- * parameters to be called with n parameters.  C does not.  A function may
- * called with more parameters than it is declared with.  The well-known
- * printf function, for example, may have arbitrarily many parameters.
- * The question arises how one can access all the parameters in a portable
- * way.  The C standard defines three macros that programs can use to
- * advance through the parameter list.  The definition of these macros for
- * MINIX are given in this file.  The three macros are:
- *
- *     va_start(ap, parmN)     prepare to access parameters
- *     va_arg(ap, type)        get next parameter value and type
- *     va_end(ap)              access is finished
- *
- * Ken Thompson's famous line from V6 UNIX is equally applicable to this file:
- *
- *     "You are not expected to understand this"
- *
- */
-
-#ifndef _STDARG_H
-#define _STDARG_H
-
-#ifdef __GNUC__
-/* The GNU C-compiler uses its own, but similar varargs mechanism. */
-
-typedef char *va_list;
-
-/* Amount of space required in an argument list for an arg of type TYPE.
- * TYPE may alternatively be an expression whose type is used.
- */
-
-#define __va_rounded_size(TYPE)  \
-  (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
-
-#if __GNUC__ < 2
-
-#ifndef __sparc__
-#define va_start(AP, LASTARG)                                           \
- (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
-#else
-#define va_start(AP, LASTARG)                                           \
- (__builtin_saveregs (),                                                \
-  AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
-#endif
-
-void va_end (va_list);          /* Defined in gnulib */
-#define va_end(AP)
-
-#define va_arg(AP, TYPE)                                                \
- (AP += __va_rounded_size (TYPE),                                       \
-  *((TYPE *) (AP - __va_rounded_size (TYPE))))
-
-#else  /* __GNUC__ >= 2 */
-
-#define va_start(ap, last) __builtin_va_start((ap), (last))
-#define va_arg(ap, type) __builtin_va_arg((ap), type)
-#define va_end(ap) __builtin_va_end(ap)
-#define va_copy(dest, src) __builtin_va_copy((dest), (src))
-
-#endif /* __GNUC__ >= 2 */
-
-#else  /* not __GNUC__ */
-
-typedef char *va_list;
-
-#define __vasz(x)              ((sizeof(x)+sizeof(int)-1) & ~(sizeof(int) -1))
-
-#define va_start(ap, parmN)    ((ap) = (va_list)&parmN + __vasz(parmN))
-#define va_arg(ap, type)      \
-  (*((type *)((va_list)((ap) = (void *)((va_list)(ap) + __vasz(type))) \
-                                                   - __vasz(type))))
-#define va_copy(ap2, ap) (ap2) = (ap)
-#define va_end(ap)
-
-#endif /* __GNUC__ */
-
-#endif /* _STDARG_H */
index 21e1781e7ca7296cb2b6dc47321515ff0b61521a..a1fb896314e68e563fc7be667ee91c5f722ef429 100644 (file)
@@ -46,8 +46,4 @@
 
 #define        __bool_true_false_are_defined   1
 
-#if __STDC_VERSION__ < 199901L && __GNUC__ < 3
-typedef int     _Bool;
-#endif
-
 #endif /* _STDBOOL_H_ */
index a053c9eb50e81e3022ad15cf0390b5d02e760b5e..e7635ad14a66fde4ffd09c28ff409f480e764e87 100644 (file)
@@ -1,31 +1,67 @@
-/* The <stddef.h> header defines certain commonly used macros. */
+/*     $NetBSD: stddef.h,v 1.16 2009/11/15 22:21:03 christos Exp $     */
 
-#ifndef _STDDEF_H
-#define _STDDEF_H
+/*-
+ * Copyright (c) 1990, 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. 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.
+ *
+ *     @(#)stddef.h    8.1 (Berkeley) 6/2/93
+ */
 
-#include <sys/null.h>
+#ifndef _STDDEF_H_
+#define _STDDEF_H_
 
-/* The following is not portable, but the compiler accepts it. */
-#ifdef __GNUC__
-#define offsetof(type, ident)  __builtin_offsetof (type, ident)
-#else
-#define offsetof(type, ident)  ((size_t) (unsigned long) &((type *)0)->ident)
-#endif
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <machine/ansi.h>
 
-#if _EM_PSIZE == _EM_WSIZE
-typedef int ptrdiff_t;         /* result of subtracting two pointers */
-#else  /* _EM_PSIZE == _EM_LSIZE */
-typedef long ptrdiff_t;
-#endif
+typedef        _BSD_PTRDIFF_T_ ptrdiff_t;
 
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef unsigned int size_t;   /* type returned by sizeof */
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
 #endif
 
-#ifndef _WCHAR_T
-#define _WCHAR_T
-typedef char wchar_t;          /* type expanded character set */
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
+typedef        _BSD_WCHAR_T_   wchar_t;
+#undef _BSD_WCHAR_T_
 #endif
 
-#endif /* _STDDEF_H */
+#include <sys/null.h>
+
+#if __GNUC_PREREQ__(4, 0)
+#define        offsetof(type, member)  __builtin_offsetof(type, member)
+#elif !defined(__cplusplus)
+#define        offsetof(type, member)  ((size_t)(unsigned long)(&((type *)0)->member))
+#else
+#if !__GNUC_PREREQ__(3, 4)
+#define __offsetof__(a) a
+#endif
+#define        offsetof(type, member) __offsetof__((reinterpret_cast<size_t> \
+    (&reinterpret_cast<const volatile char &>(static_cast<type *>(0)->member))))
+#endif  
+#endif /* _STDDEF_H_ */
diff --git a/include/stdint.h b/include/stdint.h
deleted file mode 100644 (file)
index 0cbf33b..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-/*     stdint.h - Standard sized integer types.        Author: Kees J. Bot
- *                                                             4 Oct 2003
- *
- * Assumption: Long is the biggest type.
- * Bug:                C99 requires a 64 bit type, and long isn't 64 bits yet, and
- *             will never be 64 bits under 16-bits Minix.
- * Omission:   Limits like PTR_DIFF_MAX not here yet, maybe <limits.h>?
- */
-
-#ifndef _STDINT_H
-#define _STDINT_H
-
-#include <sys/cdefs.h>
-#ifndef _MINIX__TYPES_H
-#include <minix/types.h>
-#endif
-#include <minix/sys_config.h>
-
-#if (_WORD_SIZE != 2 && _WORD_SIZE != 4) || \
-       (_PTR_SIZE != _WORD_SIZE && _PTR_SIZE != 2*_WORD_SIZE)
-#error Odd word or pointer sizes
-#endif
-
-/* Integer types of precisely the given bitsize. */
-typedef i8_t   int8_t;
-typedef i16_t  int16_t;
-typedef i32_t  int32_t;
-#if defined(__LONG_LONG_SUPPORTED)
-typedef long long int64_t;
-#elif _WORD_SIZE > 2 && __L64
-typedef i64_t  int64_t;
-#endif
-
-typedef u8_t   uint8_t;
-typedef u16_t  uint16_t;
-typedef u32_t  uint32_t;
-#if defined(__LONG_LONG_SUPPORTED)
-typedef unsigned long long uint64_t;
-#elif _WORD_SIZE > 2 && __L64
-typedef u64_t  uint64_t;
-#endif
-
-/* Integer types of at least the given bitsize. */
-typedef int8_t         int_least8_t;
-typedef int16_t                int_least16_t;
-typedef int32_t                int_least32_t;
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-typedef int64_t                int_least64_t;
-#endif
-
-typedef uint8_t                uint_least8_t;
-typedef uint16_t       uint_least16_t;
-typedef uint32_t       uint_least32_t;
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-typedef uint64_t       uint_least64_t;
-#endif
-
-/* Fast integer types of at least the given bitsize. */
-#if _WORD_SIZE == 2
-typedef int16_t                int_fast8_t;
-typedef int16_t                int_fast16_t;
-#else
-typedef int32_t                int_fast8_t;
-typedef int32_t                int_fast16_t;
-#endif
-typedef int32_t                int_fast32_t;
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-typedef int64_t                int_fast64_t;
-#endif
-
-#if _WORD_SIZE == 2
-typedef uint16_t       uint_fast8_t;
-typedef uint16_t       uint_fast16_t;
-#else
-typedef uint32_t       uint_fast8_t;
-typedef uint32_t       uint_fast16_t;
-#endif
-typedef uint32_t       uint_fast32_t;
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-typedef uint64_t       uint_fast64_t;
-#endif
-
-/* Integer type capable of holding a pointer and the largest integer type. */
-#if _PTR_SIZE == _WORD_SIZE
-typedef int            intptr_t;
-typedef unsigned       uintptr_t;
-#elif _PTR_SIZE == 2*_WORD_SIZE
-typedef long           intptr_t;
-typedef unsigned long  uintptr_t;
-#endif
-
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-typedef int64_t                intmax_t;
-typedef uint64_t       uintmax_t;
-#else
-typedef long           intmax_t;
-typedef unsigned long  uintmax_t;
-#endif
-
-#if !__cplusplus || defined(__STDC_LIMIT_MACROS)
-#ifndef _LIMITS_H
-#include <limits.h>
-#endif
-
-/* Range definitions for each of the above types conform <limits.h>. */
-#define INT8_MIN               (-INT8_MAX-1)
-#define INT16_MIN              (-INT16_MAX-1)
-#define INT32_MIN              (-INT32_MAX-1)
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define INT64_MIN              (-INT64_MAX-1)
-#endif
-
-#define INT8_MAX               127
-#define INT16_MAX              32767
-#define INT32_MAX              2147483647
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define INT64_MAX              9223372036854775807LL
-#endif
-
-#define UINT8_MAX              255
-#define UINT16_MAX             65535
-#define UINT32_MAX             4294967295U
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define UINT64_MAX             18446744073709551615ULL
-#endif
-
-#define INT_LEAST8_MIN         INT8_MIN
-#define INT_LEAST16_MIN                INT16_MIN
-#define INT_LEAST32_MIN                INT32_MIN
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define INT_LEAST64_MIN                INT64_MIN
-#endif
-
-#define INT_LEAST8_MAX         INT8_MAX
-#define INT_LEAST16_MAX                INT16_MAX
-#define INT_LEAST32_MAX                INT32_MAX
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define INT_LEAST64_MAX                INT64_MAX
-#endif
-
-#define UINT_LEAST8_MAX                UINT8_MAX
-#define UINT_LEAST16_MAX       UINT16_MAX
-#define UINT_LEAST32_MAX       UINT32_MAX
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define UINT_LEAST64_MAX       UINT64_MAX
-#endif
-
-#define INT_FAST8_MIN          (-INT_FAST8_MAX-1)
-#define INT_FAST16_MIN         (-INT_FAST16_MAX-1)
-#define INT_FAST32_MIN         INT32_MIN
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define INT_FAST64_MIN         INT64_MIN
-#endif
-
-#if _WORD_SIZE == 2
-#define INT_FAST8_MAX          INT16_MAX
-#define INT_FAST16_MAX         INT16_MAX
-#else
-#define INT_FAST8_MAX          INT32_MAX
-#define INT_FAST16_MAX         INT32_MAX
-#endif
-#define INT_FAST32_MAX         INT32_MAX
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define INT_FAST64_MAX         INT64_MAX
-#endif
-
-#if _WORD_SIZE == 2
-#define UINT_FAST8_MAX         UINT16_MAX
-#define UINT_FAST16_MAX                UINT16_MAX
-#else
-#define UINT_FAST8_MAX         UINT32_MAX
-#define UINT_FAST16_MAX                UINT32_MAX
-#endif
-#define UINT_FAST32_MAX                UINT32_MAX
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define UINT_FAST64_MAX                UINT64_MAX
-#endif
-
-#if _PTR_SIZE == _WORD_SIZE
-#define INTPTR_MIN             INT_MIN
-#define INTPTR_MAX             INT_MAX
-#define UINTPTR_MAX            UINT_MAX
-#elif _PTR_SIZE > _WORD_SIZE
-#define INTPTR_MIN             LONG_MIN
-#define INTPTR_MAX             LONG_MAX
-#define UINTPTR_MAX            ULONG_MAX
-#endif
-
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define INTMAX_MIN             INT64_MIN
-#define INTMAX_MAX             INT64_MAX
-#define UINTMAX_MAX            UINT64_MAX
-#else
-#define INTMAX_MIN             LONG_MIN
-#define INTMAX_MAX             LONG_MAX
-#define UINTMAX_MAX            ULONG_MAX
-#endif
-
-#endif /* !__cplusplus || __STDC_LIMIT_MACROS */
-
-/* Constants of the proper type. */
-#define INT8_C(c)      c
-#define INT16_C(c)     c
-#if _WORD_SIZE == 2
-#define INT32_C(c)     __CONCAT(c,l)
-#else
-#define INT32_C(c)     c
-#endif
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define INT64_C(c)     __CONCAT(c,l)
-#endif
-
-#define UINT8_C(c)     __CONCAT(c,u)
-#define UINT16_C(c)    __CONCAT(c,u)
-#if _WORD_SIZE == 2
-#define UINT32_C(c)    __CONCAT(c,lu)
-#else
-#define UINT32_C(c)    __CONCAT(c,u)
-#endif
-#if defined(__LONG_LONG_SUPPORTED) || (_WORD_SIZE > 2 && __L64)
-#define UINT64_C(c)    __CONCAT(c,lu)
-#endif
-
-#if !defined(__LONG_LONG_SUPPORTED) && !(_WORD_SIZE > 2 && __L64)
-#define INTMAX_C(c)    INT32_C(c)
-#define UINTMAX_C(c)   UINT32_C(c)
-#else
-#define INTMAX_C(c)    INT64_C(c)
-#define UINTMAX_C(c)   UINT64_C(c)
-#endif
-
-#endif /* _STDINT_H */
-
-/*
- * $PchId: stdint.h,v 1.2 2005/01/27 17:32:00 philip Exp $
- */
index b1dd483de99e63918e04333bf721040dcbd941d2..341de8b5d7483b80fb0afed6b79cc48d263491b1 100644 (file)
-/*
- * stdio.h - input/output definitions
+/*     $NetBSD: stdio.h,v 1.78 2010/09/24 09:21:53 tnozaki Exp $       */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  *
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
+ * 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.
+ *
+ *     @(#)stdio.h     8.5 (Berkeley) 4/29/95
  */
-/* $Header$ */
 
-#ifndef _STDIO_H
-#define        _STDIO_H
+#ifndef        _STDIO_H_
+#define        _STDIO_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/ansi.h>
+
+#include <machine/ansi.h>
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
+#endif
+#ifdef _BSD_SSIZE_T_
+typedef        _BSD_SSIZE_T_   ssize_t;
+#undef _BSD_SSIZE_T_
+#endif
 
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
+#include <sys/null.h>
+
+/*      
+ * This is fairly grotesque, but pure ANSI code must not inspect the
+ * innards of an fpos_t anyway.  The library internally uses off_t,
+ * which we assume is exactly as big as eight chars.
+ */
+#if (!defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)) || defined(_LIBC)
+typedef __off_t fpos_t;
+#else
+typedef struct __sfpos {
+       __off_t _pos;
+} fpos_t;
 #endif
-#include <minix/types.h>
 
-#include <sys/null.h>   /* For NULL */
+#define        _FSTDIO                 /* Define for new stdio with functions. */
 
 /*
- * Focus point of all stdio activity.
+ * NB: to fit things in six character monocase externals, the stdio
+ * code uses the prefix `__s' for stdio objects, typically followed
+ * by a three-character attempt at a mnemonic.
  */
-typedef struct __iobuf {
-       int             _count;
-       int             _fd;
-       int             _flags;
-       int             _bufsiz;
-       unsigned char   *_buf;
-       unsigned char   *_ptr;
+
+/* stdio buffers */
+struct __sbuf {
+       unsigned char *_base;
+       int     _size;
+};
+
+/*
+ * stdio state variables.
+ *
+ * The following always hold:
+ *
+ *     if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
+ *             _lbfsize is -_bf._size, else _lbfsize is 0
+ *     if _flags&__SRD, _w is 0
+ *     if _flags&__SWR, _r is 0
+ *
+ * This ensures that the getc and putc macros (or inline functions) never
+ * try to write or read from a file that is in `read' or `write' mode.
+ * (Moreover, they can, and do, automatically switch from read mode to
+ * write mode, and back, on "r+" and "w+" files.)
+ *
+ * _lbfsize is used only to make the inline line-buffered output stream
+ * code as compact as possible.
+ *
+ * _ub, _up, and _ur are used when ungetc() pushes back more characters
+ * than fit in the current _bf, or when ungetc() pushes back a character
+ * that does not match the previous one in _bf.  When this happens,
+ * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
+ * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
+ *
+ * NB: see WARNING above before changing the layout of this structure!
+ */
+typedef        struct __sFILE {
+       unsigned char *_p;      /* current position in (some) buffer */
+       int     _r;             /* read space left for getc() */
+       int     _w;             /* write space left for putc() */
+       unsigned short _flags;  /* flags, below; this FILE is free if 0 */
+       short   _file;          /* fileno, if Unix descriptor, else -1 */
+       struct  __sbuf _bf;     /* the buffer (at least 1 byte, if !NULL) */
+       int     _lbfsize;       /* 0 or -_bf._size, for inline putc */
+
+       /* operations */
+       void    *_cookie;       /* cookie passed to io functions */
+       int     (*_close)(void *);
+       int     (*_read) (void *, char *, int);
+       fpos_t  (*_seek) (void *, fpos_t, int);
+       int     (*_write)(void *, const char *, int);
+
+       /* file extension */
+       struct  __sbuf _ext;
+
+       /* separate buffer for long sequences of ungetc() */
+       unsigned char *_up;     /* saved _p when _p is doing ungetc data */
+       int     _ur;            /* saved _r when _r is counting ungetc data */
+
+       /* tricks to meet minimum requirements even when malloc() fails */
+       unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
+       unsigned char _nbuf[1]; /* guarantee a getc() buffer */
+
+       /* Formerly used by fgetln/fgetwln; kept for binary compatibility */
+       struct  __sbuf _lb__unused;
+
+       /* Unix stdio files get aligned to block boundaries on fseek() */
+       int     _blksize;       /* stat.st_blksize (may be != _bf._size) */
+       fpos_t  _offset;        /* current lseek offset */
 } FILE;
 
-#define        _IOFBF          0x000
-#define        _IOREAD         0x001
-#define        _IOWRITE        0x002
-#define        _IONBF          0x004
-#define        _IOMYBUF        0x008
-#define        _IOEOF          0x010
-#define        _IOERR          0x020
-#define        _IOLBF          0x040
-#define        _IOREADING      0x080
-#define        _IOWRITING      0x100
-#define        _IOAPPEND       0x200
-#define _IOFIFO                0x400
-
-/* The following definitions are also in <unistd.h>. They should not
- * conflict.
- */
-#define        SEEK_SET        0
-#define        SEEK_CUR        1
-#define        SEEK_END        2
-
-#define        stdin           (&__stdin)
-#define        stdout          (&__stdout)
-#define        stderr          (&__stderr)
-
-#define        BUFSIZ          4096
-#define        EOF             (-1)
-
-#define        FOPEN_MAX       20
-
-#define        FILENAME_MAX    NAME_MAX
-
-#define        TMP_MAX         999
-#define        L_tmpnam        (sizeof("/tmp/") + FILENAME_MAX)
-#define P_tmpdir "/tmp"
-#define __STDIO_VA_LIST__      void *
-
-typedef long int       fpos_t;
-
-#ifndef _SIZE_T
-#define        _SIZE_T
-typedef unsigned int   size_t;         /* type returned by sizeof */
-#endif /* _SIZE_T */
-
-extern FILE    *__iotab[FOPEN_MAX];
-extern FILE    __stdin, __stdout, __stderr;
-
-_PROTOTYPE( int remove, (const char *_filename)                                );
-_PROTOTYPE( int rename, (const char *_old, const char *_new)           );
-_PROTOTYPE( FILE *tmpfile, (void)                                      );
-_PROTOTYPE( char *tmpnam, (char *_s)                                   );
-_PROTOTYPE( int fclose, (FILE *_stream)                                        );
-_PROTOTYPE( int fflush, (FILE *_stream)                                        );
-_PROTOTYPE( FILE *fopen, (const char *_filename, const char *_mode)    );
-_PROTOTYPE( FILE *freopen,
-           (const char *_filename, const char *_mode, FILE *_stream)   );
-_PROTOTYPE( void setbuf, (FILE *_stream, char *_buf)                   );
-_PROTOTYPE( int setvbuf,
-               (FILE *_stream, char *_buf, int _mode, size_t _size)    );
-_PROTOTYPE( int fprintf, (FILE *_stream, const char *_format, ...)     );
-_PROTOTYPE( int printf, (const char *_format, ...)                     );
-_PROTOTYPE( int sprintf, (char *_s, const char *_format, ...)          );
-_PROTOTYPE( int vfprintf,
-               (FILE *_stream, const char *_format, char *_arg)        );
-_PROTOTYPE( int vprintf, (const char *_format, char *_arg)             );
-_PROTOTYPE( int vsprintf, (char *_s, const char *_format, char *_arg)  );
-_PROTOTYPE( int fscanf, (FILE *_stream, const char *_format, ...)      );
-_PROTOTYPE( int scanf, (const char *_format, ...)                      );
-_PROTOTYPE( int sscanf, (const char *_s, const char *_format, ...)     );
-#define vfscanf _doscan
-_PROTOTYPE( int vfscanf, (FILE *_stream, const char *_format, char *_arg));
-_PROTOTYPE( int vscanf, (const char *_format, char *_arg)              );
-_PROTOTYPE( int vsscanf, (const char *_s, const char *_format, char *_arg));
-_PROTOTYPE( int fgetc, (FILE *_stream)                                 );
-_PROTOTYPE( char *fgets, (char *_s, int _n, FILE *_stream)             );
-_PROTOTYPE( int fputc, (int _c, FILE *_stream)                         );
-_PROTOTYPE( int fputs, (const char *_s, FILE *_stream)                 );
-_PROTOTYPE( int getc, (FILE *_stream)                                  );
-_PROTOTYPE( int getchar, (void)                                                );
-_PROTOTYPE( char *gets, (char *_s)                                     );
-_PROTOTYPE( int putc, (int _c, FILE *_stream)                          );
-_PROTOTYPE( int putchar, (int _c)                                      );
-_PROTOTYPE( int puts, (const char *_s)                                 );
-_PROTOTYPE( int ungetc, (int _c, FILE *_stream)                                );
-_PROTOTYPE( size_t fread,
-           (void *_ptr, size_t _size, size_t _nmemb, FILE *_stream)    );
-_PROTOTYPE( size_t fwrite,
-       (const void *_ptr, size_t _size, size_t _nmemb, FILE *_stream)  );
-_PROTOTYPE( int fgetpos, (FILE *_stream, fpos_t *_pos)                 );
-_PROTOTYPE( int fseek, (FILE *_stream, long _offset, int _whence)      );
-_PROTOTYPE( int fseeko, (FILE *_stream, off_t _offset, int _whence)    );
-_PROTOTYPE( int fsetpos, (FILE *_stream, fpos_t *_pos)                 );
-_PROTOTYPE( long ftell, (FILE *_stream)                                        );
-_PROTOTYPE( off_t ftello, (FILE *_stream)                              );
-_PROTOTYPE( void rewind, (FILE *_stream)                               );
-_PROTOTYPE( void clearerr, (FILE *_stream)                             );
-_PROTOTYPE( int feof, (FILE *_stream)                                  );
-_PROTOTYPE( int ferror, (FILE *_stream)                                        );
-_PROTOTYPE( void perror, (const char *_s)                              );
-_PROTOTYPE( int __fillbuf, (FILE *_stream)                             );
-_PROTOTYPE( int __flushbuf, (int _c, FILE *_stream)                    );
+__BEGIN_DECLS
+extern FILE __sF[];
+__END_DECLS
+
+#define        __SLBF  0x0001          /* line buffered */
+#define        __SNBF  0x0002          /* unbuffered */
+#define        __SRD   0x0004          /* OK to read */
+#define        __SWR   0x0008          /* OK to write */
+       /* RD and WR are never simultaneously asserted */
+#define        __SRW   0x0010          /* open for reading & writing */
+#define        __SEOF  0x0020          /* found EOF */
+#define        __SERR  0x0040          /* found error */
+#define        __SMBF  0x0080          /* _buf is from malloc */
+#define        __SAPP  0x0100          /* fdopen()ed in append mode */
+#define        __SSTR  0x0200          /* this is an sprintf/snprintf string */
+#define        __SOPT  0x0400          /* do fseek() optimization */
+#define        __SNPT  0x0800          /* do not do fseek() optimization */
+#define        __SOFF  0x1000          /* set iff _offset is in fact correct */
+#define        __SMOD  0x2000          /* true => fgetln modified _p text */
+#define        __SALC  0x4000          /* allocate string space dynamically */
+
+/*
+ * The following three definitions are for ANSI C, which took them
+ * from System V, which brilliantly took internal interface macros and
+ * made them official arguments to setvbuf(), without renaming them.
+ * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
+ *
+ * Although numbered as their counterparts above, the implementation
+ * does not rely on this.
+ */
+#define        _IOFBF  0               /* setvbuf should set fully buffered */
+#define        _IOLBF  1               /* setvbuf should set line buffered */
+#define        _IONBF  2               /* setvbuf should set unbuffered */
+
+#define        BUFSIZ  1024            /* size of buffer used by setbuf */
+#define        EOF     (-1)
+
+/*
+ * FOPEN_MAX is a minimum maximum, and is the number of streams that
+ * stdio can provide without attempting to allocate further resources
+ * (which could fail).  Do not use this for anything.
+ */
+                               /* must be == _POSIX_STREAM_MAX <limits.h> */
+#define        FOPEN_MAX       20      /* must be <= OPEN_MAX <sys/syslimits.h> */
+#define        FILENAME_MAX    255     /* must be <= PATH_MAX <sys/syslimits.h> */
+
+/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define        P_tmpdir        "/var/tmp/"
+#endif
+#define        L_tmpnam        1024    /* XXX must be == PATH_MAX */
+/* Always ensure that this is consistent with <limits.h> */
+#ifndef TMP_MAX
+#define TMP_MAX                        308915776       /* Legacy */
+#endif
+
+/* Always ensure that these are consistent with <fcntl.h> and <unistd.h>! */
+#ifndef SEEK_SET
+#define        SEEK_SET        0       /* set file offset to offset */
+#endif
+#ifndef SEEK_CUR
+#define        SEEK_CUR        1       /* set file offset to current plus offset */
+#endif
+#ifndef SEEK_END
+#define        SEEK_END        2       /* set file offset to EOF plus offset */
+#endif
+
+#define        stdin   (&__sF[0])
+#define        stdout  (&__sF[1])
+#define        stderr  (&__sF[2])
+
+/*
+ * Functions defined in ANSI C standard.
+ */
+__BEGIN_DECLS
+void    clearerr(FILE *);
+int     fclose(FILE *);
+int     feof(FILE *);
+int     ferror(FILE *);
+int     fflush(FILE *);
+int     fgetc(FILE *);
+int     fgetpos(FILE * __restrict, fpos_t * __restrict);
+char   *fgets(char * __restrict, int, FILE * __restrict);
+FILE   *fopen(const char * __restrict , const char * __restrict);
+int     fprintf(FILE * __restrict , const char * __restrict, ...)
+               __printflike(2, 3);
+int     fputc(int, FILE *);
+int     fputs(const char * __restrict, FILE * __restrict);
+size_t  fread(void * __restrict, size_t, size_t, FILE * __restrict);
+FILE   *freopen(const char * __restrict, const char * __restrict,
+           FILE * __restrict);
+int     fscanf(FILE * __restrict, const char * __restrict, ...)
+               __scanflike(2, 3);
+int     fseek(FILE *, long, int);
+int     fsetpos(FILE *, const fpos_t *);
+long    ftell(FILE *);
+size_t  fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
+int     getc(FILE *);
+int     getchar(void);
+ssize_t         getdelim(char ** __restrict, size_t * __restrict, int,
+           FILE * __restrict);
+ssize_t         getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
+void    perror(const char *);
+int     printf(const char * __restrict, ...)
+               __printflike(1, 2);
+int     putc(int, FILE *);
+int     putchar(int);
+int     puts(const char *);
+int     remove(const char *);
+void    rewind(FILE *);
+int     scanf(const char * __restrict, ...)
+               __scanflike(1, 2);
+void    setbuf(FILE * __restrict, char * __restrict);
+int     setvbuf(FILE * __restrict, char * __restrict, int, size_t);
+int     sscanf(const char * __restrict, const char * __restrict, ...)
+               __scanflike(2, 3);
+FILE   *tmpfile(void);
+int     ungetc(int, FILE *);
+int     vfprintf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_)
+               __printflike(2, 0);
+int     vprintf(const char * __restrict, _BSD_VA_LIST_)
+               __printflike(1, 0);
+
+#ifndef __AUDIT__
+char   *gets(char *);
+int     sprintf(char * __restrict, const char * __restrict, ...)
+               __printflike(2, 3);
+char   *tmpnam(char *);
+int     vsprintf(char * __restrict, const char * __restrict,
+    _BSD_VA_LIST_)
+               __printflike(2, 0);
+#endif
+
+#if !defined(__minix) && (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))
+int     rename (const char *, const char *) __RENAME(__posix_rename);
+#else
+int     rename (const char *, const char *);
+#endif
+__END_DECLS
+
+/*
+ * IEEE Std 1003.1-90
+ */
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define        L_ctermid       1024    /* size for ctermid(); PATH_MAX */
+#define L_cuserid      9       /* size for cuserid(); UT_NAMESIZE + 1 */
+
+__BEGIN_DECLS
+char   *ctermid(char *);
+#ifndef __CUSERID_DECLARED
+#define __CUSERID_DECLARED
+/* also declared in unistd.h */
+char   *cuserid(char *);
+#endif /* __CUSERID_DECLARED */
+FILE   *fdopen(int, const char *);
+int     fileno(FILE *);
+__END_DECLS
+#endif /* not ANSI */
+
+/*
+ * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+void   flockfile(FILE *);
+int    ftrylockfile(FILE *);
+void   funlockfile(FILE *);
+int    getc_unlocked(FILE *);
+int    getchar_unlocked(void);
+int    putc_unlocked(int, FILE *);
+int    putchar_unlocked(int);
+__END_DECLS
+#endif /* _POSIX_C_SOURCE >= 1995056 || _XOPEN_SOURCE >= 500 || ... */
+
+/*
+ * Functions defined in POSIX 1003.2 and XPG2 or later.
+ */
+#if (_POSIX_C_SOURCE - 0) >= 2 || (_XOPEN_SOURCE - 0) >= 2 || \
+    defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+int     pclose(FILE *);
+FILE   *popen(const char *, const char *);
+__END_DECLS
+#endif
+
+/*
+ * Functions defined in ISO XPG4.2, ISO C99, POSIX 1003.1-2001 or later.
+ */
+#if ((__STDC_VERSION__ - 0) >= 199901L) || \
+    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    ((_XOPEN_SOURCE - 0) >= 500) || \
+    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+int     snprintf(char * __restrict, size_t, const char * __restrict, ...)
+               __printflike(3, 4);
+int     vsnprintf(char * __restrict, size_t, const char * __restrict,
+           _BSD_VA_LIST_)
+               __printflike(3, 0);
+__END_DECLS
+#endif
+
+/*
+ * Functions defined in XPG4.2.
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+int     getw(FILE *);
+int     putw(int, FILE *);
+
+#ifndef __AUDIT__
+char   *tempnam(const char *, const char *);
+#endif
+__END_DECLS
+#endif
+
+/*
+ * X/Open CAE Specification Issue 5 Version 2
+ */
+#if (_XOPEN_SOURCE - 0) >= 500 || defined(_LARGEFILE_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#ifndef        off_t
+typedef        __off_t         off_t;
+#define        off_t           __off_t
+#endif /* off_t */
+
+__BEGIN_DECLS
+int     fseeko(FILE *, off_t, int);
+off_t   ftello(FILE *);
+__END_DECLS
+#endif /* _XOPEN_SOURCE >= 500 || _LARGEFILE_SOURCE || _NETBSD_SOURCE */
+
+/*
+ * Functions defined in ISO C99.  Still put under _NETBSD_SOURCE due to
+ * backward compatible.
+ */
+#if defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+__BEGIN_DECLS
+int     vscanf(const char * __restrict, _BSD_VA_LIST_)
+               __scanflike(1, 0);
+int     vfscanf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_)
+               __scanflike(2, 0);
+int     vsscanf(const char * __restrict, const char * __restrict,
+    _BSD_VA_LIST_)
+    __scanflike(2, 0);
+__END_DECLS
+#endif /* _ISOC99_SOURCE || _NETBSD_SOURCE */
+
+/*
+ * Routines that are purely local.
+ */
+#if defined(_NETBSD_SOURCE)
+
+#define        FPARSELN_UNESCESC       0x01
+#define        FPARSELN_UNESCCONT      0x02
+#define        FPARSELN_UNESCCOMM      0x04
+#define        FPARSELN_UNESCREST      0x08
+#define        FPARSELN_UNESCALL       0x0f
+
+__BEGIN_DECLS
+int     asprintf(char ** __restrict, const char * __restrict, ...)
+               __printflike(2, 3);
+char   *fgetln(FILE * __restrict, size_t * __restrict);
+char   *fparseln(FILE *, size_t *, size_t *, const char[3], int);
+int     fpurge(FILE *);
+void    setbuffer(FILE *, char *, int);
+int     setlinebuf(FILE *);
+int     vasprintf(char ** __restrict, const char * __restrict,
+    _BSD_VA_LIST_)
+               __printflike(2, 0);
+const char *fmtcheck(const char *, const char *)
+               __format_arg(2);
+__END_DECLS
+
+/*
+ * Stdio function-access interface.
+ */
+__BEGIN_DECLS
+FILE   *funopen(const void *,
+               int (*)(void *, char *, int),
+               int (*)(void *, const char *, int),
+               fpos_t (*)(void *, fpos_t, int),
+               int (*)(void *));
+__END_DECLS
+#define        fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
+#define        fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
+#endif /* _NETBSD_SOURCE */
+
+/*
+ * Functions internal to the implementation.
+ */
+__BEGIN_DECLS
+int    __srget(FILE *);
+int    __swbuf(int, FILE *);
+__END_DECLS
+
+/*
+ * The __sfoo macros are here so that we can 
+ * define function versions in the C library.
+ */
+#define        __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
+#if defined(__GNUC__) && defined(__STDC__)
+static __inline int __sputc(int _c, FILE *_p) {
+       if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
+               return (*_p->_p++ = _c);
+       else
+               return (__swbuf(_c, _p));
+}
+#else
+/*
+ * This has been tuned to generate reasonable code on the vax using pcc.
+ */
+#define        __sputc(c, p) \
+       (--(p)->_w < 0 ? \
+               (p)->_w >= (p)->_lbfsize ? \
+                       (*(p)->_p = (c)), *(p)->_p != '\n' ? \
+                               (int)*(p)->_p++ : \
+                               __swbuf('\n', p) : \
+                       __swbuf((int)(c), p) : \
+               (*(p)->_p = (c), (int)*(p)->_p++))
+#endif
+
+#define        __sfeof(p)      (((p)->_flags & __SEOF) != 0)
+#define        __sferror(p)    (((p)->_flags & __SERR) != 0)
+#define        __sclearerr(p)  ((void)((p)->_flags &= ~(__SERR|__SEOF)))
+#define        __sfileno(p)    \
+    ((p)->_file == -1 ? -1 : (int)(unsigned short)(p)->_file)
+
+#ifndef __lint__
+#if !defined(_REENTRANT) && !defined(_PTHREADS)
+#define        feof(p)         __sfeof(p)
+#define        ferror(p)       __sferror(p)
+#define        clearerr(p)     __sclearerr(p)
+
+#define        getc(fp)        __sgetc(fp)
+#define putc(x, fp)    __sputc(x, fp)
+#endif /* !_REENTRANT && !_PTHREADS */
+#endif /* __lint__ */
 
 #define        getchar()       getc(stdin)
-#define        putchar(c)      putc(c,stdout)
-#define        getc(p)         (--(p)->_count >= 0 ? (int) (*(p)->_ptr++) : \
-                               __fillbuf(p))
-#define        putc(c, p)      (--(p)->_count >= 0 ? \
-                        (int) (*(p)->_ptr++ = (c)) : \
-                        __flushbuf((c),(p)))
-
-#define        feof(p)         (((p)->_flags & _IOEOF) != 0)
-#define        ferror(p)       (((p)->_flags & _IOERR) != 0)
-#define clearerr(p)     ((p)->_flags &= ~(_IOERR|_IOEOF))
-
-#ifdef _POSIX_SOURCE
-_PROTOTYPE( int fileno, (FILE *_stream)                                        );
-_PROTOTYPE (FILE *fdopen, (int _fildes, const char *_types) );
-#define        fileno(stream)          ((stream)->_fd)
-#define L_ctermid 255  /* required by POSIX */
-#define L_cuserid 255  /* required by POSIX */
-
-_PROTOTYPE(FILE *popen, (const char *_command, const char *_type));
-_PROTOTYPE(int pclose, (FILE *_stream));
-_PROTOTYPE(int snprintf, (char *_s, size_t _n, const char *_format, ...));
-_PROTOTYPE(int vsnprintf, (char *_s, size_t _n, const char *_format,
-                                                       char *_arg)     );
-_PROTOTYPE(char *fgetln, (FILE *stream, size_t *len));
-#endif
-
-#ifdef _MINIX
-_PROTOTYPE(int asprintf, (char **ret, const char *fmt, ...));
-_PROTOTYPE(int vasprintf, (char **ret, const char *fmt, char *_arg));
-#endif /* _MINIX */
-
-#endif /* _STDIO_H */
+#define        putchar(x)      putc(x, stdout)
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#if !defined(_REENTRANT) && !defined(_PTHREADS)
+#define        fileno(p)       __sfileno(p)
+#endif /* !_REENTRANT && !_PTHREADS */
+#endif /* !_ANSI_SOURCE */
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+int     vdprintf(int, const char * __restrict, _BSD_VA_LIST_)
+               __printflike(2, 0);
+int     dprintf(int, const char * __restrict, ...)
+               __printflike(2, 3);
+#endif /* (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) */
+
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+#define getc_unlocked(fp)      __sgetc(fp)
+#define putc_unlocked(x, fp)   __sputc(x, fp)
+
+#define getchar_unlocked()     getc_unlocked(stdin)
+#define putchar_unlocked(x)    putc_unlocked(x, stdout)
+#endif /* _POSIX_C_SOURCE >= 199506 || _XOPEN_SOURCE >= 500 || _REENTRANT... */
+
+#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
+    defined(_NETBSD_SOURCE)
+FILE *fmemopen(void * __restrict, size_t, const char * __restrict);
+#endif
+
+#if _FORTIFY_SOURCE > 0
+#include <ssp/stdio.h>
+#endif
+
+#endif /* _STDIO_H_ */
index 72c9dad4c86cd2d23b9c45c03d7016c2cbbc68bd..63d334719da74e358450b70ab28ac546d42e15ce 100644 (file)
-/* The <stdlib.h> header defines certain common macros, types, and functions.*/
+/*     $NetBSD: stdlib.h,v 1.94 2010/12/22 19:47:56 jruoho Exp $       */
 
-#ifndef _STDLIB_H
-#define _STDLIB_H
+/*-
+ * Copyright (c) 1990, 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. 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.
+ *
+ *     @(#)stdlib.h    8.5 (Berkeley) 5/19/95
+ */
 
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
+#ifndef _STDLIB_H_
+#define _STDLIB_H_
 
-#include <stddef.h>
 #include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+#if defined(_NETBSD_SOURCE)
+#include <sys/types.h>         /* for quad_t, etc. */
+#endif
+
+#include <machine/ansi.h>
+
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
+#endif
+
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
+typedef        _BSD_WCHAR_T_   wchar_t;
+#undef _BSD_WCHAR_T_
+#endif
+
+typedef struct {
+       int quot;               /* quotient */
+       int rem;                /* remainder */
+} div_t;
+
+typedef struct {
+       long quot;              /* quotient */
+       long rem;               /* remainder */
+} ldiv_t;
+
+#if !defined(_ANSI_SOURCE) && \
+    (defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
+     defined(_NETBSD_SOURCE))
+typedef struct {
+       /* LONGLONG */
+       long long int quot;     /* quotient */
+       /* LONGLONG */
+       long long int rem;      /* remainder */
+} lldiv_t;
+#endif
+
+#if defined(_NETBSD_SOURCE)
+typedef struct {
+       quad_t quot;            /* quotient */
+       quad_t rem;             /* remainder */
+} qdiv_t;
+#endif
+
+
 #include <sys/null.h>
 
-#define EXIT_FAILURE       1   /* standard error return using exit() */
-#define EXIT_SUCCESS       0   /* successful return using exit() */
-#define RAND_MAX       32767   /* largest value generated by rand() */
-#define MB_CUR_MAX         1   /* max value of multibyte character in MINIX */
-
-typedef struct { int quot, rem; } div_t;
-typedef struct { long quot, rem; } ldiv_t;
-
-/* The types are div_t, and ldiv_t. */
-
-/* Function Prototypes. */
-_PROTOTYPE( void abort, (void)                                         );
-_PROTOTYPE( int abs, (int _j)                                          );
-_PROTOTYPE( int atexit, (void (*_func)(void))                          );
-_PROTOTYPE( double atof, (const char *_nptr)                           );
-_PROTOTYPE( int atoi, (const char *_nptr)                              );
-_PROTOTYPE( long atol, (const char *_nptr)                             );
-_PROTOTYPE( void *calloc, (size_t _nmemb, size_t _size)                        );
-_PROTOTYPE( div_t div, (int _numer, int _denom)                                );
-_PROTOTYPE( __dead void exit, (int _status)                            );
-_PROTOTYPE( void free, (void *_ptr)                                    );
-_PROTOTYPE( char *getenv, (const char *_name)                          );
-_PROTOTYPE( long labs, (long _j)                                       );
-_PROTOTYPE( ldiv_t ldiv, (long _numer, long _denom)                    );
-_PROTOTYPE( void *malloc, (size_t _size)                               );
-_PROTOTYPE( int mblen, (const char *_s, size_t _n)                     );
-_PROTOTYPE( size_t mbstowcs, (wchar_t *_pwcs, const char *_s, size_t _n));
-_PROTOTYPE( int mbtowc, (wchar_t *_pwc, const char *_s, size_t _n)     );
-_PROTOTYPE( int rand, (void)                                           );
-_PROTOTYPE( void *realloc, (void *_ptr, size_t _size)                  );
-_PROTOTYPE( void srand, (unsigned int _seed)                           );
-_PROTOTYPE( double strtod, (const char *_nptr, char **_endptr)         );
-_PROTOTYPE( long strtol, (const char *_nptr, char **_endptr, int _base)        );
-_PROTOTYPE( int system, (const char *_string)                          );
-_PROTOTYPE( size_t wcstombs, (char *_s, const wchar_t *_pwcs, size_t _n));
-_PROTOTYPE( int wctomb, (char *_s, wchar_t _wchar)                     );
-_PROTOTYPE( void *bsearch, (const void *_key, const void *_base, 
-       size_t _nmemb, size_t _size, 
-       int (*compar) (const void *, const void *))                     );
-_PROTOTYPE( void qsort, (void *_base, size_t _nmemb, size_t _size,
-       int (*compar) (const void *, const void *))                     );
-_PROTOTYPE( unsigned long int strtoul,
-                       (const char *_nptr, char **_endptr, int _base)  );
-_PROTOTYPE( const char *getprogname, (void)                            );
-_PROTOTYPE( void    setprogname, (const char *)                                );
-
-#ifdef _POSIX_SOURCE
-/* Open Group Base Specifications Issue 6 */
-_PROTOTYPE( int mkstemp, (char *_fmt)                                  );
-_PROTOTYPE( char *initstate, (unsigned _seed, char *_state,
-                                                       size_t _size)   );
-_PROTOTYPE( long random, (void)                                                );
-_PROTOTYPE( char *realpath, (const char *file_name, 
-                                                 char *resolved_name)   );
-_PROTOTYPE( char *setstate, (const char *state)                                );
-_PROTOTYPE( void srandom, (unsigned seed)                              );
-_PROTOTYPE( int putenv, (char *string)                                 );
-_PROTOTYPE( int setenv, (const char *envname, const char *envval,
-                                                       int overwrite)  );
-_PROTOTYPE( int unsetenv, (const char *name)                           );
-_PROTOTYPE( int getsubopt, (char **optionp, char * const *keylistp, char **valuep));
-
-#ifdef __LONG_LONG_SUPPORTED
-_PROTOTYPE( long long strtoll, (const char *_nptr, char **_endptr,
-                                                            int _base) );
-_PROTOTYPE( unsigned long long strtoull, (const char *_nptr, 
-                                            char **_endptr, int _base) );
+#define        EXIT_FAILURE    1
+#define        EXIT_SUCCESS    0
+
+#define        RAND_MAX        0x7fffffff
+
+extern size_t __mb_cur_max;
+#define        MB_CUR_MAX      __mb_cur_max
+
+__BEGIN_DECLS
+__dead  void _Exit(int);
+__dead  void abort(void);
+__pure  int abs(int);
+int     atexit(void (*)(void));
+double  atof(const char *);
+int     atoi(const char *);
+long    atol(const char *);
+#ifndef __BSEARCH_DECLARED
+#define __BSEARCH_DECLARED
+/* also in search.h */
+void   *bsearch(const void *, const void *, size_t, size_t,
+    int (*)(const void *, const void *));
+#endif /* __BSEARCH_DECLARED */
+void   *calloc(size_t, size_t);
+div_t   div(int, int);
+__dead  void exit(int);
+void    free(void *);
+__aconst char *getenv(const char *);
+__pure long
+        labs(long);
+ldiv_t  ldiv(long, long);
+void   *malloc(size_t);
+void    qsort(void *, size_t, size_t, int (*)(const void *, const void *));
+int     rand(void);
+void   *realloc(void *, size_t);
+void    srand(unsigned);
+double  strtod(const char * __restrict, char ** __restrict);
+long    strtol(const char * __restrict, char ** __restrict, int);
+unsigned long
+        strtoul(const char * __restrict, char ** __restrict, int);
+int     system(const char *);
+
+/* These are currently just stubs. */
+int     mblen(const char *, size_t);
+size_t  mbstowcs(wchar_t * __restrict, const char * __restrict, size_t);
+int     wctomb(char *, wchar_t);
+int     mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
+size_t  wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+
+
+/*
+ * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+int     rand_r(unsigned int *);
+#endif
+
+
+/*
+ * X/Open Portability Guide >= Issue 4
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+double  drand48(void);
+double  erand48(unsigned short[3]);
+long    jrand48(unsigned short[3]);
+void    lcong48(unsigned short[7]);
+long    lrand48(void);
+long    mrand48(void);
+long    nrand48(unsigned short[3]);
+unsigned short *
+        seed48(unsigned short[3]);
+void    srand48(long);
+
+int     putenv(char *);
+#endif
+
+
+/*
+ * X/Open Portability Guide >= Issue 4 Version 2
+ */
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+long    a64l(const char *);
+char   *l64a(long);
+
+char   *initstate(unsigned long, char *, size_t);
+long    random(void);
+char   *setstate(char *);
+void    srandom(unsigned long);
+#ifdef _NETBSD_SOURCE
+#define        RANDOM_MAX      0x7fffffff      /* (((long)1 << 31) - 1) */
+#endif
+
+char   *mkdtemp(char *);
+int     mkstemp(char *);
+char   *mktemp(char *)
+#ifdef __MKTEMP_OK__
+       __RENAME(_mktemp)
+#endif
+       ;
+
+int     setkey(const char *);
+
+char   *realpath(const char *, char *);
+
+int     ttyslot(void);
+
+void   *valloc(size_t);                /* obsoleted by malloc() */
+
+int     grantpt(int);
+int     unlockpt(int);
+char   *ptsname(int);
+#endif
+
+/*
+ * ISO C99
+ */
+#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
+    defined(_NETBSD_SOURCE)
+/* LONGLONG */
+long long int  atoll(const char *);
+/* LONGLONG */
+long long int  llabs(long long int);
+/* LONGLONG */
+lldiv_t                lldiv(long long int, long long int);
+/* LONGLONG */
+long long int  strtoll(const char * __restrict, char ** __restrict, int);
+/* LONGLONG */
+unsigned long long int
+               strtoull(const char * __restrict, char ** __restrict, int);
+float          strtof(const char * __restrict, char ** __restrict);
+long double    strtold(const char * __restrict, char ** __restrict);
 #endif
 
+/*
+ * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \
+    defined(_NETBSD_SOURCE)
+int     setenv(const char *, const char *, int);
+#ifndef __LIBC12_SOURCE__
+int     unsetenv(const char *) __RENAME(__unsetenv13);
 #endif
 
-#ifdef _MINIX
-_PROTOTYPE( int getloadavg, (double *, int)                            );
+int     posix_openpt(int);
+int     posix_memalign(void **, size_t, size_t);
+#endif
 
-/* According to POSIX, getopt should be in unistd.h. What do we do with
- * this?
+/*
+ * Implementation-defined extensions
  */
-_PROTOTYPE(int getopt, (int _argc, char * const _argv[], const char *_opts));
-extern char *optarg;
-extern int optind, opterr, optopt;
+#if defined(_NETBSD_SOURCE)
+#if defined(alloca) && (alloca == __builtin_alloca) && \
+       defined(__GNUC__) && (__GNUC__ < 2)
+void   *alloca(int);     /* built-in for gcc */
+#elif defined(__PCC__) && !defined(__GNUC__)
+#define alloca(size) __builtin_alloca(size)
+#elif (__GNUC__ >= 2)
+#define alloca(size) __builtin_alloca(size)
+#else
+void   *alloca(size_t);
+#endif /* __GNUC__ */
 
-_PROTOTYPE(size_t shquote, (const char *arg, char *buf, size_t bufsize));
-_PROTOTYPE(char *mkdtemp, (char *path));
+uint32_t arc4random(void);
+void    arc4random_stir(void);
+void    arc4random_addrandom(u_char *, int);
+char   *getbsize(int *, long *);
+char   *cgetcap(char *, const char *, int);
+int     cgetclose(void);
+int     cgetent(char **, const char * const *, const char *);
+int     cgetfirst(char **, const char * const *);
+int     cgetmatch(const char *, const char *);
+int     cgetnext(char **, const char * const *);
+int     cgetnum(char *, const char *, long *);
+int     cgetset(const char *);
+int     cgetstr(char *, const char *, char **);
+int     cgetustr(char *, const char *, char **);
+void    csetexpandtc(int);
 
-#endif /* _MINIX */
+int     daemon(int, int);
+#ifndef __minix
+#ifndef __LIBC12_SOURCE__
+__aconst char *devname(dev_t, mode_t) __RENAME(__devname50);
+#endif
+#endif /* !__minix */
+
+#define        HN_DECIMAL              0x01
+#define        HN_NOSPACE              0x02
+#define        HN_B                    0x04
+#define        HN_DIVISOR_1000         0x08
+
+#define        HN_GETSCALE             0x10
+#define        HN_AUTOSCALE            0x20
+
+int     humanize_number(char *, size_t, int64_t, const char *, int, int);
+int     dehumanize_number(const char *, int64_t *);
+
+#ifndef __minix
+devmajor_t getdevmajor(const char *, mode_t);
+#endif /* !__minix */
+int     getloadavg(double [], int);
+
+int     getenv_r(const char *, char *, size_t);
+
+void    cfree(void *);
+
+int     heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
+int     mergesort(void *, size_t, size_t,
+           int (*)(const void *, const void *));
+int     radixsort(const unsigned char **, int, const unsigned char *,
+           unsigned);
+int     sradixsort(const unsigned char **, int, const unsigned char *,
+           unsigned);
+
+void    mi_vector_hash(const void * __restrict, size_t, uint32_t,
+           uint32_t[3]);
+
+void    setproctitle(const char *, ...)
+           __printflike(1, 2);
+const char *getprogname(void) __constfunc;
+void   setprogname(const char *);
+
+quad_t  qabs(quad_t);
+quad_t  strtoq(const char * __restrict, char ** __restrict, int);
+u_quad_t strtouq(const char * __restrict, char ** __restrict, int);
+
+       /* LONGLONG */
+long long strsuftoll(const char *, const char *, long long, long long);
+       /* LONGLONG */
+long long strsuftollx(const char *, const char *, long long, long long,
+                       char *, size_t);
+
+int     l64a_r(long, char *, int);
+
+size_t shquote(const char *, char *, size_t);
+size_t shquotev(int, char * const *, char *, size_t);
+#endif /* _NETBSD_SOURCE */
+#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE)
+qdiv_t  qdiv(quad_t, quad_t);
+#endif
+__END_DECLS
 
-#endif /* STDLIB_H */
+#endif /* !_STDLIB_H_ */
index a29f77abdec07f82ea2f117e7dd3b2a72293c5c8..98825fb705a3b391eb2283d2afb4d3186e6eac1f 100644 (file)
-/* The <string.h> header contains prototypes for the string handling 
- * functions.
- */
-
-#ifndef _STRING_H
-#define _STRING_H
+/*     $NetBSD: string.h,v 1.39 2009/07/22 19:48:27 kleink Exp $       */
 
-/* Not strictly necessary, but some sources, in particular
- * llvm, assume the defines in stdint.h are available when
- * string.h is include.
+/*-
+ * Copyright (c) 1990, 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. 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.
+ *
+ *     @(#)string.h    8.1 (Berkeley) 6/2/93
  */
-#include <stdint.h>
-#include <sys/null.h>
 
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef unsigned int size_t;   /* type returned by sizeof */
-#endif /*_SIZE_T */
+#ifndef _STRING_H_
+#define        _STRING_H_
+#include <machine/ansi.h>
 
-/* Function Prototypes. */
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
 #endif
 
-_PROTOTYPE( void *memchr, (const void *_s, int _c, size_t _n)          );
-_PROTOTYPE( int memcmp, (const void *_s1, const void *_s2, size_t _n)  );
-_PROTOTYPE( void *memcpy, (void *_s1, const void *_s2, size_t _n)      );
-_PROTOTYPE( void *memmove, (void *_s1, const void *_s2, size_t _n)     );
-_PROTOTYPE( void *memset, (void *_s, int _c, size_t _n)                        );
-_PROTOTYPE( char *strcat, (char *_s1, const char *_s2)                 );
-_PROTOTYPE( char *strchr, (const char *_s, int _c)                     );
-_PROTOTYPE( int strncmp, (const char *_s1, const char *_s2, size_t _n) );
-_PROTOTYPE( int strcmp, (const char *_s1, const char *_s2)             );
-_PROTOTYPE( int strcoll, (const char *_s1, const char *_s2)            );
-_PROTOTYPE( char *strcpy, (char *_s1, const char *_s2)                 );
-_PROTOTYPE( size_t strcspn, (const char *_s1, const char *_s2)         );
-_PROTOTYPE( char *strerror, (int _errnum)                              );
-_PROTOTYPE( size_t strlen, (const char *_s)                            );
-_PROTOTYPE( char *strncat, (char *_s1, const char *_s2, size_t _n)     );
-_PROTOTYPE( char *strncpy, (char *_s1, const char *_s2, size_t _n)     );
-_PROTOTYPE( char *strpbrk, (const char *_s1, const char *_s2)          );
-_PROTOTYPE( char *strrchr, (const char *_s, int _c)                    );
-_PROTOTYPE( size_t strspn, (const char *_s1, const char *_s2)          );
-_PROTOTYPE( char *strstr, (const char *_s1, const char *_s2)           );
-_PROTOTYPE( char *strtok, (char *_s1, const char *_s2)                 );
-_PROTOTYPE( size_t strxfrm, (char *_s1, const char *_s2, size_t _n)    );
+#include <sys/null.h>
 
-#ifdef _POSIX_SOURCE
-/* Open Group Base Specifications Issue 6 (not complete) */
- char *strdup(const char *_s1);
-#endif
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
 
-#ifdef _MINIX
-/* For backward compatibility. */
-_PROTOTYPE( char *index, (const char *_s, int _charwanted)             );
-_PROTOTYPE( char *rindex, (const char *_s, int _charwanted)            );
-_PROTOTYPE( void bcopy, (const void *_src, void *_dst, size_t _length) );
-_PROTOTYPE( int bcmp, (const void *_s1, const void *_s2, size_t _length));
-_PROTOTYPE( void bzero, (void *_dst, size_t _length)                   );
-_PROTOTYPE( void *memccpy, (char *_dst, const char *_src, int _ucharstop,
-                                                   size_t _size)       );
+__BEGIN_DECLS
+void   *memchr(const void *, int, size_t);
+int     memcmp(const void *, const void *, size_t);
+void   *memcpy(void * __restrict, const void * __restrict, size_t);
+void   *memmove(void *, const void *, size_t);
+void   *memset(void *, int, size_t);
+char   *strcat(char * __restrict, const char * __restrict);
+char   *strchr(const char *, int);
+int     strcmp(const char *, const char *);
+int     strcoll(const char *, const char *);
+char   *strcpy(char * __restrict, const char * __restrict);
+size_t  strcspn(const char *, const char *);
+__aconst char *strerror(int);
+size_t  strlen(const char *);
+char   *strncat(char * __restrict, const char * __restrict, size_t);
+int     strncmp(const char *, const char *, size_t);
+char   *strncpy(char * __restrict, const char * __restrict, size_t);
+char   *strpbrk(const char *, const char *);
+char   *strrchr(const char *, int);
+size_t  strspn(const char *, const char *);
+char   *strstr(const char *, const char *);
+char   *strtok(char * __restrict, const char * __restrict);
+#if (_POSIX_C_SOURCE - 0 >= 199506L) || (_XOPEN_SOURCE - 0 >= 500) || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+char   *strtok_r(char *, const char *, char **);
+int     strerror_r(int, char *, size_t);
+#endif /* _POSIX_C_SOURCE >= 199506 || XOPEN_SOURCE >= 500 || ... */
+size_t  strxfrm(char * __restrict, const char * __restrict, size_t);
 
-/* Misc. extra functions */
-_PROTOTYPE( int strcasecmp, (const char *_s1, const char *_s2)         );
-_PROTOTYPE( int strncasecmp, (const char *_s1, const char *_s2,
-                                                       size_t _len)    );
-_PROTOTYPE( size_t strnlen, (const char *_s, size_t _n)                        );
-_PROTOTYPE( size_t strlcat, (char *_dst, const char *_src, size_t _siz) );
-_PROTOTYPE( size_t strlcpy, (char *_dst, const char *_src, size_t _siz) );
-_PROTOTYPE( char * strsep, (char **stringp, const char *delim) );
-_PROTOTYPE( char *strcasestr, (const char *, const char *));
-_PROTOTYPE( char *strnstr, (const char *, const char *, size_t));
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+void   *memccpy(void *, const void *, int, size_t);
+char   *strdup(const char *);
+#endif
 
+#if (_POSIX_C_SOURCE - 0 >= 200809L) || (_XOPEN_SOURCE - 0 >= 700) || \
+    defined(_NETBSD_SOURCE)
+char   *stpcpy(char * __restrict, const char * __restrict);
+char   *stpncpy(char * __restrict, const char * __restrict, size_t);
+size_t strnlen(const char *, size_t);
+#ifndef __STRSIGNAL_DECLARED
+#define __STRSIGNAL_DECLARED
+/* also in unistd.h */
+__aconst char *strsignal(int);
+#endif /* __STRSIGNAL_DECLARED */
+/*
+ * For POSIX compliance, we still need:
+ * strcoll_l
+ * strerror_l
+ * strxfrm_l
+ */
 #endif
 
-#endif /* _STRING_H */
+#if defined(_NETBSD_SOURCE)
+#include <strings.h>           /* for backwards-compatibilty */
+void   *memmem(const void *, size_t, const void *, size_t);
+char   *strcasestr(const char *, const char *);
+size_t  strlcat(char *, const char *, size_t);
+size_t  strlcpy(char *, const char *, size_t);
+char   *strsep(char **, const char *);
+char   *stresep(char **, const char *, int);
+char   *strndup(const char *, size_t);
+void   *memrchr(const void *, int, size_t);
+#endif
+__END_DECLS
+
+#if _FORTIFY_SOURCE > 0
+#include <ssp/string.h>
+#endif
+#endif /* !defined(_STRING_H_) */
index 428bf16cd8067ac32f59d046f964d5d6b99d1e90..dc90dcb3534c3257af990ca33a769f4670655b32 100644 (file)
@@ -1,12 +1,74 @@
-/*
-strings.h
-*/
-
-#include <minix/ansi.h>
-
-/* Open Group Base Specifications Issue 6 (not complete) */
-_PROTOTYPE( char *index, (const char *_s, int _charwanted)             );
-_PROTOTYPE( int strcasecmp, (const char *_s1, const char *_s2)         );
-_PROTOTYPE( int strncasecmp, (const char *_s1, const char *_s2,
-                                                       size_t _len)    );
-_PROTOTYPE( int ffs, (int i)                                           );
+/*     $NetBSD: strings.h,v 1.17 2009/08/19 04:22:53 yamt Exp $        */
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#ifndef _STRINGS_H_
+#define _STRINGS_H_
+
+#include <machine/ansi.h>
+#include <sys/featuretest.h>
+
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#include <sys/null.h>
+#endif
+
+#include <sys/cdefs.h>
+
+#include <stdint.h>
+
+__BEGIN_DECLS
+int     bcmp(const void *, const void *, size_t);
+void    bcopy(const void *, void *, size_t);
+void    bzero(void *, size_t);
+int     ffs(int);
+char   *index(const char *, int);
+unsigned int   popcount(unsigned int) __constfunc;
+unsigned int   popcountl(unsigned long) __constfunc;
+unsigned int   popcountll(unsigned long long) __constfunc;
+unsigned int   popcount32(uint32_t) __constfunc;
+unsigned int   popcount64(uint64_t) __constfunc;
+char   *rindex(const char *, int);
+int     strcasecmp(const char *, const char *);
+int     strncasecmp(const char *, const char *, size_t);
+__END_DECLS
+
+#if defined(_NETBSD_SOURCE)
+#include <string.h>
+#endif
+
+#if _FORTIFY_SOURCE > 0
+#include <ssp/strings.h>
+#endif
+#endif /* !defined(_STRINGS_H_) */
similarity index 100%
rename from nbsd_include/struct.h
rename to include/struct.h
index 45ff089ca9859d3152faa2baaedd377733346002..02af8846fcceec7127619554670a76b1ed6a6aa2 100644 (file)
@@ -1,16 +1,63 @@
+#      $NetBSD: Makefile,v 1.126 2010/03/01 21:10:13 darran Exp $
+
+NETBSDINCSDIR= /usr/include
+INCSDIR= /usr/include/sys
+
 .include <bsd.sys.mk>
 
-INCSDIR=        /usr/include.ack/sys
 
-INCS=  asynchio.h file.h  \
-       ioctl.h ipc.h jmp_buf.h kbdio.h mman.h \
-       mount.h mtio.h param.h ptrace.h queue.h resource.h \
-       select.h sem.h shm.h sigcontext.h signal.h socket.h \
-       soundcard.h statfs.h statvfs.h stat.h svrctl.h timeb.h \
-       time.h times.h types.h ucontext.h ucred.h uio.h un.h \
-       utsname.h video.h vm.h wait.h cdefs.h null.h poll.h
+# Present only in minix
+INCS+= ioc_net.h statfs.h
+
+INCS+= ansi.h atomic.h \
+       bitops.h bswap.h \
+       cdefs.h cdefs_aout.h cdefs_elf.h ctype_bits.h ctype_inline.h \
+       dirent.h \
+       endian.h errno.h \
+       fcntl.h fd_set.h featuretest.h file.h \
+       float_ieee754.h gcq.h gmon.h hash.h \
+       ieee754.h inttypes.h ioctl.h ipc.h \
+       localedef.h \
+       md4.h md5.h \
+       mman.h mount.h \
+       null.h \
+       param.h poll.h ptrace.h \
+       ptree.h \
+       queue.h \
+       rbtree.h resource.h rmd160.h \
+       select.h sha1.h \
+       sha2.h siginfo.h signal.h sigtypes.h \
+       reboot.h sem.h shm.h socket.h \
+       stat.h statvfs.h \
+       sysctl.h stdint.h \
+       syslimits.h syslog.h \
+       termios.h time.h times.h \
+       tree.h ttycom.h ttydefaults.h \
+       types.h \
+       ucontext.h ucred.h uio.h un.h unistd.h utsname.h uuid.h \
+       wait.h
+
+INCSYMLINKS=\
+       sys/fcntl.h ${NETBSDINCSDIR}/fcntl.h \
+       sys/poll.h ${NETBSDINCSDIR}/poll.h \
+       sys/stdint.h ${NETBSDINCSDIR}/stdint.h \
+       sys/syslog.h ${NETBSDINCSDIR}/syslog.h \
+       sys/termios.h ${NETBSDINCSDIR}/termios.h \
+       sys/rmd160.h ${NETBSDINCSDIR}/rmd160.h \
+       sys/sha1.h ${NETBSDINCSDIR}/sha1.h \
+       sys/sha2.h ${NETBSDINCSDIR}/sha2.h \
+       sys/md4.h ${NETBSDINCSDIR}/md4.h \
+       sys/md5.h ${NETBSDINCSDIR}/md5.h \
+       sys/exec_elf.h ${NETBSDINCSDIR}/elf.h \
+
+
+#INCSYMLINKS+= ../soundcard.h ${INCSDIR}/soundcard.h
+
+namei: namei.src gennameih.awk
+       ${TOOL_AWK} -f gennameih.awk < namei.src
 
-.include "../../common/include/sys/Makefile.inc"
-.include "../../common/include/sys/Makefile.mount.inc"
+.include <bsd.own.mk>
+.include "${MINIXSRCDIR}/common/include/sys/Makefile.inc"
 
+.include <bsd.files.mk>
 .include <bsd.kinc.mk>
similarity index 100%
rename from nbsd_include/sys/ansi.h
rename to include/sys/ansi.h
similarity index 100%
rename from nbsd_include/sys/bswap.h
rename to include/sys/bswap.h
index f030bbce12fd6737aff91dcf12b047f98bc09997..3dee9c6b0b4b61c564042880b673262131b9c768 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdefs.h,v 1.78 2009/10/02 21:05:28 christos Exp $      */
+/*     $NetBSD: cdefs.h,v 1.81 2010/12/25 22:30:52 joerg Exp $ */
 
 /*
  * Copyright (c) 1991, 1993
 #define        __GNUC_PREREQ__(x, y)   0
 #endif
 
-#if 0
 #include <machine/cdefs.h>
 #ifdef __ELF__
 #include <sys/cdefs_elf.h>
 #else
 #include <sys/cdefs_aout.h>
 #endif
-#endif
-
-#if defined(__cplusplus)
-#define        __BEGIN_DECLS           extern "C" {
-#define        __END_DECLS             }
-#define        __static_cast(x,y)      static_cast<x>(y)
-#else
-#define        __BEGIN_DECLS
-#define        __END_DECLS
-#define        __static_cast(x,y)      (x)y
-#endif
 
 /*
  * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
  * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
- * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
- * mode -- there must be no spaces between its arguments, and for nested
- * __CONCAT's, all the __CONCAT's must be at the left.  __CONCAT can also
- * concatenate double-quoted strings produced by the __STRING macro, but
- * this only works with ANSI C.
+ * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
+ * in between its arguments.  __CONCAT can also concatenate double-quoted
+ * strings produced by the __STRING macro, but this only works with ANSI C.
  */
 
 #define        ___STRING(x)    __STRING(x)
@@ -90,8 +76,7 @@
 
 #if __STDC__ || defined(__cplusplus)
 #define        __P(protos)     protos          /* full-blown ANSI C */
-#define        __CONCAT1(x,y)  x ## y
-#define        __CONCAT(x,y)   __CONCAT1(x,y)
+#define        __CONCAT(x,y)   x ## y
 #define        __STRING(x)     #x
 
 #define        __const         const           /* define reserved names to standard */
 #define        __used          __unused
 #endif
 
+#if defined(__cplusplus)
+#define        __BEGIN_EXTERN_C        extern "C" {
+#define        __END_EXTERN_C          }
+#define        __static_cast(x,y)      static_cast<x>(y)
+#else
+#define        __BEGIN_EXTERN_C
+#define        __END_EXTERN_C
+#define        __static_cast(x,y)      (x)y
+#endif
+
+#if __GNUC_PREREQ__(4, 0)
+#  define __dso_public __attribute__((__visibility__("default")))
+#  define __dso_hidden __attribute__((__visibility__("hidden")))
+#  define __BEGIN_PUBLIC_DECLS \
+       _Pragma("GCC visibility push(default)") __BEGIN_EXTERN_C
+#  define __END_PUBLIC_DECLS   __END_EXTERN_C _Pragma("GCC visibility pop")
+#  define __BEGIN_HIDDEN_DECLS \
+       _Pragma("GCC visibility push(hidden)") __BEGIN_EXTERN_C
+#  define __END_HIDDEN_DECLS   __END_EXTERN_C _Pragma("GCC visibility pop")
+#else
+#  define __dso_public
+#  define __dso_hidden
+#  define __BEGIN_PUBLIC_DECLS __BEGIN_EXTERN_C
+#  define __END_PUBLIC_DECLS   __END_EXTERN_C
+#  define __BEGIN_HIDDEN_DECLS __BEGIN_EXTERN_C
+#  define __END_HIDDEN_DECLS   __END_EXTERN_C
+#endif
+
+#define        __BEGIN_DECLS           __BEGIN_PUBLIC_DECLS
+#define        __END_DECLS             __END_PUBLIC_DECLS
+
+/*
+ * Non-static C99 inline functions are optional bodies.  They don't
+ * create global symbols if not used, but can be replaced if desirable.
+ * This differs from the behavior of GCC before version 4.3.  The nearest
+ * equivalent for older GCC is `extern inline'.  For newer GCC, use the
+ * gnu_inline attribute additionally to get the old behavior.
+ *
+ * For C99 compilers other than GCC, the C99 behavior is expected.
+ */
+#if defined(__GNUC__) && defined(__GNUC_STDC_INLINE__)
+#define        __c99inline     extern __attribute__((__gnu_inline__)) __inline
+#elif defined(__GNUC__)
+#define        __c99inline     extern __inline
+#elif defined(__STDC_VERSION__)
+#define        __c99inline     __inline
+#endif
+
 #if defined(__lint__)
 #define        __packed        __packed
 #define        __aligned(x)    /* delete */
 #endif /* NO_KERNEL_RCSIDS */
 #endif /* _KERNEL */
 
-#if 0
 #if !defined(_STANDALONE) && !defined(_KERNEL)
 #if defined(__GNUC__) || defined(__PCC__)
 #define        __RENAME(x)     ___RENAME(x)
 #else /* _STANDALONE || _KERNEL */
 #define        __RENAME(x)     no renaming in kernel or standalone environment
 #endif
-#endif
+
 /*
  * A barrier to stop the optimizer from moving code or assume live
  * register values. This is gcc specific, the version is more or less
 #define        __predict_false(exp)    (exp)
 #endif
 
-/*
- * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
- * require it.
- */
-#if __GNUC_PREREQ__(4, 1)
-#define __offsetof(type, field)  __builtin_offsetof(type, field)
-#else
-#ifndef __cplusplus
-#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
-#else
-#define __offsetof(type, field)                                 \
-  (__offsetof__ (reinterpret_cast <size_t>                      \
-                 (&reinterpret_cast <const volatile char &>     \
-                  (static_cast<type *> (0)->field))))
-#endif
-#endif
-#define __rangeof(type, start, end) \
-        (__offsetof(type, end) - __offsetof(type, start))
-
 /*
  * Compiler-dependent macros to declare that functions take printf-like
  * or scanf-like arguments.  They are null except for versions of gcc
 #define __CAST(__dt, __st)     ((__dt)(__st))
 #endif
 
+#ifdef _MINIX
+/* If compiling in Minix tree, Minix ANSI definitions are always useful. */
+#include <minix/ansi.h>
+#endif
+
 #endif /* !_SYS_CDEFS_H_ */
similarity index 100%
rename from nbsd_include/sys/errno.h
rename to include/sys/errno.h
similarity index 100%
rename from nbsd_include/sys/fcntl.h
rename to include/sys/fcntl.h
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..96a0cfac4b6441ff4d01e8a619ec0297c5540b46 100644 (file)
@@ -0,0 +1,169 @@
+/*     $NetBSD: file.h,v 1.71 2009/12/24 19:01:12 elad Exp $   */
+
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * Copyright (c) 1982, 1986, 1989, 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. 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.
+ *
+ *     @(#)file.h      8.3 (Berkeley) 1/9/95
+ */
+
+#ifndef _SYS_FILE_H_
+#define        _SYS_FILE_H_
+
+#include <sys/fcntl.h>
+#include <sys/unistd.h>
+
+#ifdef _KERNEL
+#include <sys/mallocvar.h>
+#include <sys/queue.h>
+#include <sys/mutex.h>
+#include <sys/condvar.h>
+
+struct proc;
+struct lwp;
+struct uio;
+struct iovec;
+struct stat;
+struct knote;
+
+/*
+ * Kernel file descriptor.  One entry for each open kernel vnode and
+ * socket.
+ *
+ * This structure is exported via the KERN_FILE and KERN_FILE2 sysctl
+ * calls.  Only add members to the end, do not delete them.
+ */
+struct file {
+       off_t           f_offset;       /* first, is 64-bit */
+       kauth_cred_t    f_cred;         /* creds associated with descriptor */
+       const struct fileops {
+               int     (*fo_read)      (struct file *, off_t *, struct uio *,
+                                           kauth_cred_t, int);
+               int     (*fo_write)     (struct file *, off_t *, struct uio *,
+                                           kauth_cred_t, int);
+               int     (*fo_ioctl)     (struct file *, u_long, void *);
+               int     (*fo_fcntl)     (struct file *, u_int, void *);
+               int     (*fo_poll)      (struct file *, int);
+               int     (*fo_stat)      (struct file *, struct stat *);
+               int     (*fo_close)     (struct file *);
+               int     (*fo_kqfilter)  (struct file *, struct knote *);
+               void    (*fo_restart)   (struct file *);
+               void    (*fo_spare1)    (void);
+               void    (*fo_spare2)    (void);
+       } *f_ops;
+       void            *f_data;        /* descriptor data, e.g. vnode/socket */
+       LIST_ENTRY(file) f_list;        /* list of active files */
+       kmutex_t        f_lock;         /* lock on structure */
+       int             f_flag;         /* see fcntl.h */
+       u_int           f_marker;       /* traversal marker (sysctl) */
+#define        DTYPE_VNODE     1               /* file */
+#define        DTYPE_SOCKET    2               /* communications endpoint */
+#define        DTYPE_PIPE      3               /* pipe */
+#define        DTYPE_KQUEUE    4               /* event queue */
+#define        DTYPE_MISC      5               /* misc file descriptor type */
+#define        DTYPE_CRYPTO    6               /* crypto */
+#define        DTYPE_MQUEUE    7               /* message queue */
+#define DTYPE_NAMES \
+    "0", "file", "socket", "pipe", "kqueue", "misc", "crypto", "mqueue"
+       u_int           f_type;         /* descriptor type */
+       u_int           f_advice;       /* access pattern hint; UVM_ADV_* */
+       u_int           f_count;        /* reference count */
+       u_int           f_msgcount;     /* references from message queue */
+       u_int           f_unpcount;     /* deferred close: see uipc_usrreq.c */
+       SLIST_ENTRY(file) f_unplist;    /* deferred close: see uipc_usrreq.c */
+};
+
+/*
+ * Flags for fo_read and fo_write and do_fileread/write/v
+ */
+#define        FOF_UPDATE_OFFSET       0x0001  /* update the file offset */
+#define        FOF_IOV_SYSSPACE        0x0100  /* iov structure in kernel memory */
+
+LIST_HEAD(filelist, file);
+extern struct filelist filehead;       /* head of list of open files */
+extern u_int           maxfiles;       /* kernel limit on # of open files */
+extern u_int           nfiles;         /* actual number of open files */
+
+extern const struct fileops vnops;     /* vnode operations for files */
+
+int    dofileread(int, struct file *, void *, size_t,
+           off_t *, int, register_t *);
+int    dofilewrite(int, struct file *, const void *,
+           size_t, off_t *, int, register_t *);
+
+int    do_filereadv(int, const struct iovec *, int, off_t *,
+           int, register_t *);
+int    do_filewritev(int, const struct iovec *, int, off_t *,
+           int, register_t *);
+
+int    fsetown(pid_t *, u_long, const void *);
+int    fgetown(pid_t, u_long, void *);
+void   fownsignal(pid_t, int, int, int, void *);
+
+/* Commonly used fileops */
+int    fnullop_fcntl(struct file *, u_int, void *);
+int    fnullop_poll(struct file *, int);
+int    fnullop_kqfilter(struct file *, struct knote *);
+int    fbadop_read(struct file *, off_t *, struct uio *, kauth_cred_t, int);
+int    fbadop_write(struct file *, off_t *, struct uio *, kauth_cred_t, int);
+int    fbadop_ioctl(struct file *, u_long, void *);
+int    fbadop_close(struct file *);
+int    fbadop_stat(struct file *, struct stat *);
+void   fnullop_restart(struct file *);
+
+#endif /* _KERNEL */
+
+#endif /* _SYS_FILE_H_ */
similarity index 100%
rename from nbsd_include/sys/gcq.h
rename to include/sys/gcq.h
similarity index 100%
rename from nbsd_include/sys/gmon.h
rename to include/sys/gmon.h
similarity index 100%
rename from nbsd_include/sys/hash.h
rename to include/sys/hash.h
index 435cc062553af9bceaebf2caae5521142a361804..da3ae0b583cbfa6d12264fb884f4d9b6b44fbed5 100644 (file)
  */
 
 #include <sys/ioc_tty.h>       /* 'T' 't' 'k'          */
-#include <net/ioctl.h>         /* 'n'                  */
+#include <sys/ioc_net.h>       /* 'n'                  */
 #include <sys/ioc_disk.h>      /* 'd'                  */
 #include <sys/ioc_file.h>      /* 'f'                  */
 #include <sys/ioc_memory.h>    /* 'm'                  */
 #include <sys/ioc_tape.h>      /* 'M'                  */
 #include <sys/ioc_sound.h>     /* 's'                  */
 
+#if defined(_NETBSD_SOURCE)
+#define                TIOCDRAIN       TCDRAIN
+#define                TIOCGETA        TCGETS
+#define                TIOCSETA        TCSETS
+#define                TIOCSETAW       TCSETSW
+#define                TIOCSETAF       TCSETSF
+#endif
+
 #endif /* _S_IOCTL_H */
index d66ace307617f7ed2e5bfbf35cad030e42a70442..ae52b64fb9030627038ef8934e740c10c29d8323 100644 (file)
@@ -1,42 +1,51 @@
-#ifndef _SYS_IPC_H
-#define _SYS_IPC_H
+/*
+ * SVID compatible ipc.h file
+ */
 
-/* For gid_t, uid_t */
-#include <sys/types.h>
-
-/* Mode bits for `msgget', `semget', and `shmget'. */
-/* Create key if key does not exist. */
-#define IPC_CREAT      01000
-/* Fail if key exists. */
-#define IPC_EXCL       02000
-/* Return error on wait. */
-#define IPC_NOWAIT     04000
-
-/* Control commands for `msgctl', `semctl', and `shmctl'. */
-/* Remove identifier. */
-#define IPC_RMID       0
-/* Set `ipc_perm' options. */
-#define IPC_SET                1
-/* Get `ipc_perm' options. */
-#define IPC_STAT       2
-#define IPC_INFO       3       /* See ipcs. */
+#ifndef _SYS_IPC_H_
+#define _SYS_IPC_H_
 
-/* Special key values. */
-/* Private key. */
-#define IPC_PRIVATE    ((key_t) 0)
+#include <sys/featuretest.h>
+#include <sys/types.h>
 
 /* Data structure used to pass permission information to IPC operations. */
 struct ipc_perm
 {
-       key_t key;      /* Key. */
-       uid_t uid;              /* Owner's user ID. */
-       gid_t gid;              /* Owner's group ID. */
-       uid_t cuid;             /* Creator's user ID. */
-       gid_t cgid;             /* Creator's group ID. */
+       key_t key;                      /* Key. */
+       uid_t uid;                      /* Owner's user ID. */
+       gid_t  gid;                     /* Owner's group ID. */
+       uid_t cuid;                     /* Creator's user ID. */
+       gid_t  cgid;                    /* Creator's group ID. */
        unsigned short int mode;        /* Reader/write permission. */
        unsigned short int __seq;       /* Sequence number. */
 };
 
-_PROTOTYPE( key_t ftok, (const char *__path, int __id));
+/* X/Open required constants (same values as system 5) */
+#define        IPC_CREAT       001000  /* create entry if key does not exist */
+#define        IPC_EXCL        002000  /* fail if key exists */
+#define        IPC_NOWAIT      004000  /* error if request must wait */
+
+#define        IPC_PRIVATE     (key_t)0 /* private key */
+
+#define        IPC_RMID        0       /* remove identifier */
+#define        IPC_SET         1       /* set options */
+#define        IPC_STAT        2       /* get options */
+
+#ifdef __minix
+#define IPC_INFO       3       /* See ipcs. */
+#endif /* !__minix */
+
+/*
+ * Macro to convert between ipc ids and array indices or sequence ids.
+ */
+#if defined(_NETBSD_SOURCE)
+#define        IXSEQ_TO_IPCID(ix,perm) (((perm._seq) << 16) | (ix & 0xffff))
+#endif
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+key_t  ftok(const char *, int);
+__END_DECLS
 
-#endif /* _SYS_IPC_H */
+#endif /* !_SYS_IPC_H_ */
diff --git a/include/sys/jmp_buf.h b/include/sys/jmp_buf.h
deleted file mode 100644 (file)
index 94e6924..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/* This file is intended for use by program code (possibly written in
- * assembly) that needs to manipulate a jmp_buf or sigjmp_buf. The JB_*
- * values are byte offsets into the jmp_buf and sigjmp_buf structures.
- */
-
-#ifndef _JMP_BUF_H
-#define _JMP_BUF_H
-
-#include <minix/config.h>
-
-#if defined(__ACK__)
-/* as per lib/ack/rts/setjmp.e */
-
-/* note the lack of parentheses, which would confuse 'as' */
-#define JB_PC          0
-#define JB_SP          JB_PC + _EM_PSIZE
-#define JB_LB          JB_SP + _EM_PSIZE
-#define JB_MASK                JB_LB + _EM_PSIZE
-#define JB_FLAGS       JB_MASK + _EM_LSIZE
-
-#if (CHIP == INTEL)
-#define JB_BP          JB_LB
-#endif
-
-#elif defined(__GNUC__)
-
-#if (CHIP == INTEL) && (_WORD_SIZE == 4)
-/* as per lib/gnu/rts/__setjmp.gs */
-
-#define JB_FLAGS       0
-#define JB_MASK                4
-#define JB_PC          8
-#define JB_SP          12
-#define JB_BP          16
-#define JB_BX          20
-#define JB_CX          24
-#define JB_DX          28
-#define JB_SI          32
-#define JB_DI          36
-
-#endif /* (CHIP == INTEL) && (_WORD_SIZE == 4) */
-
-#endif /* __GNU__ */
-
-#endif /* _JMP_BUF_H */
similarity index 100%
rename from nbsd_include/sys/md4.h
rename to include/sys/md4.h
similarity index 100%
rename from nbsd_include/sys/md5.h
rename to include/sys/md5.h
index b08c912bc8a30c105b66c0937f3ab109c2e1ea28..4a28810cad3e277fd26bbd9d3fafafc298a01916 100644 (file)
@@ -1,39 +1,82 @@
+#ifndef _SYS_MMAN_H_
+#define _SYS_MMAN_H_
 
-#ifndef _MMAN_H
-#define _MMAN_H
+#include <sys/featuretest.h>
 
-#ifndef _TYPE_H
-#include <minix/type.h>
+#include <machine/ansi.h>
+
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
+#endif
+
+#include <sys/ansi.h>
+
+#ifndef        mode_t
+typedef        __mode_t        mode_t;
+#define        mode_t          __mode_t
 #endif
 
-/* prot argument for mmap() */
+#ifndef        off_t
+typedef        __off_t         off_t;          /* file offset */
+#define        off_t           __off_t
+#endif
+
+
+/*
+ * Protections are chosen from these bits, or-ed together
+ */
 #define PROT_NONE       0x00    /* no permissions */
 #define PROT_READ       0x01    /* pages can be read */
 #define PROT_WRITE      0x02    /* pages can be written */
 #define PROT_EXEC       0x04    /* pages can be executed */
 
-/* flags argument for mmap()  */
-#define MAP_PRIVATE     0x0002          /* changes are private */
-#define MAP_ANON       0x0004          /* anonymous memory */
+/*
+ * Flags contain sharing type and options.
+ * Sharing types; choose one.
+ */
+#ifndef __minix
+#define        MAP_SHARED      0x0001  /* share changes */
+#endif
+#define        MAP_PRIVATE     0x0002  /* changes are private */
+
+/*
+ * Mapping type
+ */
+#define MAP_ANON       0x0004  /* anonymous memory */
+
+/*
+ * Minix specific flags.
+ */
 #define MAP_PREALLOC   0x0008          /* not on-demand */
 #define MAP_CONTIG     0x0010          /* contiguous in physical memory */
 #define MAP_LOWER16M   0x0020          /* physically below 16MB */
 #define MAP_ALIGN64K   0x0040          /* physically aligned at 64kB */
 #define MAP_LOWER1M    0x0080          /* physically below 16MB */
-#define MAP_IPC_SHARED  0x0100          /* used to implement shared memory */
-
-/* mmap() error return */
-#define MAP_FAILED      ((void *)-1)
-
-_PROTOTYPE( void *minix_mmap, (void *, size_t, int, int, int, off_t));
-_PROTOTYPE( int minix_munmap, (void *, size_t));
-_PROTOTYPE( int minix_munmap_text, (void *, size_t));
-_PROTOTYPE( void *vm_remap, (endpoint_t d, endpoint_t s, void *da,
-                               void *sa, size_t si));
-_PROTOTYPE( void *vm_remap_ro, (endpoint_t d, endpoint_t s, void *da,
-                               void *sa, size_t si));
-_PROTOTYPE( int vm_unmap, (endpoint_t endpt, void *addr));
-_PROTOTYPE( unsigned long vm_getphys, (endpoint_t endpt, void *addr));
-_PROTOTYPE( u8_t vm_getrefcount, (endpoint_t endpt, void *addr));
-
-#endif /* _MMAN_H */
+#define        MAP_ALIGNMENT_64KB      MAP_ALIGN64K
+#define        MAP_IPC_SHARED  0x0100  /* share changes */
+
+/*
+ * Error indicator returned by mmap(2)
+ */
+#define        MAP_FAILED      ((void *) -1)   /* mmap() failed */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#ifndef __minix
+void * mmap(void *, size_t, int, int, int, off_t);
+int    munmap(void *, size_t);
+#else
+void * minix_mmap(void *, size_t, int, int, int, off_t);
+int    minix_munmap(void *, size_t);
+int            minix_munmap_text(void *, size_t);
+void *         vm_remap(int d, int s, void *da, void *sa, size_t si);
+void *         vm_remap_ro(int d, int s, void *da, void *sa, size_t si);
+int            vm_unmap(int endpt, void *addr);
+unsigned long  vm_getphys(int endpt, void *addr);
+u8_t           vm_getrefcount(int endpt, void *addr);
+#endif /* __minix */
+__END_DECLS
+
+#endif /* !_SYS_MMAN_H_ */
similarity index 100%
rename from nbsd_include/sys/mount.h
rename to include/sys/mount.h
index 1803084cf8245e220c6f583ab6d7535c13e07a4f..b750a3ecf215ba5502c3ca3aea51896762e4b654 100644 (file)
+#ifndef _SYS_PARAM_H_
+#define        _SYS_PARAM_H_
+
+/*
+ * Historic BSD #defines -- probably will remain untouched for all time.
+ */
+#define        BSD     199506          /* System version (year & month). */
+#define        BSD4_3  1
+#ifndef __minix
+#define        BSD4_4  1
+#endif
+
+/*
+ *     #define __NetBSD_Version__ MMmmrrpp00
+ *
+ *     M = major version
+ *     m = minor version; a minor number of 99 indicates current.
+ *     r = 0 (*)
+ *     p = patchlevel
+ *
+ * When new releases are made, src/gnu/usr.bin/groff/tmac/mdoc.local
+ * needs to be updated and the changes sent back to the groff maintainers.
+ *
+ * (*) Up to 2.0I "release" used to be "",A-Z,Z[A-Z] but numeric
+ *             e.g. NetBSD-1.2D  = 102040000 ('D' == 4)
+ *     NetBSD-2.0H     (200080000) was changed on 20041001 to:
+ *     2.99.9          (299000900)
+ */
+
+#define        __NetBSD_Version__      599002900       /* NetBSD 5.99.29 */
+
+#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
+    (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
+
 /*
-sys/param.h
-*/
+ * Historical NetBSD #define
+ *
+ * NetBSD 1.4 was the last release for which this value was incremented.
+ * The value is now permanently fixed at 199905. It will never be
+ * changed again.
+ *
+ * New code must use __NetBSD_Version__ instead, and should not even
+ * count on NetBSD being defined.
+ *
+ */
 
-#ifndef __SYS_PARAM_H__
-#define __SYS_PARAM_H__
+#define        NetBSD  199905          /* NetBSD version (year & month). */
 
-#include <limits.h>
-#include <minix/limits.h>
+#include <sys/null.h>
 
-#define MAXHOSTNAMELEN  256    /* max hostname size */
-#define NGROUPS                8       /* max number of supplementary groups */
-#define MAXPATHLEN     __MINIX_PATH_MAX
-#define MAXCOMLEN       16      /* max command length */
+#ifndef __ASSEMBLER__
+#include <sys/inttypes.h>
+#include <sys/types.h>
 
+/*
+ * Machine-independent constants (some used in following include files).
+ * Redefined constants are from POSIX 1003.1 limits file.
+ *
+ * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
+ * MAXHOSTNAMELEN should be >= (_POSIX_HOST_NAME_MAX + 1) (see <limits.h>)
+ * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
+ */
+#include <sys/syslimits.h>
+
+
+#define        MAXCOMLEN       16              /* max command name remembered */
+#define        MAXINTERP       PATH_MAX        /* max interpreter file name length */
+/* DEPRECATED: use LOGIN_NAME_MAX instead. */
+#define        MAXLOGNAME      (LOGIN_NAME_MAX - 1) /* max login name length */
+#ifndef __minix
+#define        NCARGS          ARG_MAX         /* max bytes for an exec function */
+#endif
+#define        NGROUPS         NGROUPS_MAX     /* max number groups */
+#define        NOGROUP         65535           /* marker for empty group set member */
+
+#define        MAXHOSTNAMELEN  256             /* max hostname size */
+
+#ifndef NOFILE
+#define        NOFILE          OPEN_MAX        /* max open files per process */
+#endif
+#ifndef MAXUPRC                                /* max simultaneous processes */
+#define        MAXUPRC         CHILD_MAX       /* POSIX 1003.1-compliant default */
+#else
+#if (MAXUPRC - 0) < CHILD_MAX
+#error MAXUPRC less than CHILD_MAX.  See options(4) for details.
+#endif /* (MAXUPRC - 0) < CHILD_MAX */
+#endif /* !defined(MAXUPRC) */
+
+/* Signals. */
+#include <sys/signal.h>
+
+/* Machine type dependent parameters. */
 #include <machine/param.h>
+#include <machine/limits.h>
+
+/* pages ("clicks") to disk blocks */
+#define        ctod(x)         ((x) << (PGSHIFT - DEV_BSHIFT))
+#define        dtoc(x)         ((x) >> (PGSHIFT - DEV_BSHIFT))
+
+/* bytes to pages */
+#define        ctob(x)         ((x) << PGSHIFT)
+#define        btoc(x)         (((x) + PGOFSET) >> PGSHIFT)
+
+/* bytes to disk blocks */
+#define        dbtob(x)        ((x) << DEV_BSHIFT)
+#define        btodb(x)        ((x) >> DEV_BSHIFT)
+
+#ifndef COHERENCY_UNIT
+#define        COHERENCY_UNIT          64
+#endif
+#ifndef CACHE_LINE_SIZE
+#define        CACHE_LINE_SIZE         64
+#endif
+#ifndef MAXCPUS
+#define        MAXCPUS                 32
+#endif
+#ifndef MAX_LWP_PER_PROC
+#define        MAX_LWP_PER_PROC        8000
+#endif
+
+/*
+ * Miscellaneous.
+ */
+#define        NBPW    sizeof(int)     /* number of bytes per word (integer) */
+
+#define        CMASK   022             /* default file mask: S_IWGRP|S_IWOTH */
+#define        NODEV   (dev_t)(-1)     /* non-existent device */
+
+#define        CBLOCK  64              /* Clist block size, must be a power of 2. */
+#define        CBQSIZE (CBLOCK/NBBY)   /* Quote bytes/cblock - can do better. */
+                               /* Data chars/clist. */
+#define        CBSIZE  (CBLOCK - (int)sizeof(struct cblock *) - CBQSIZE)
+#define        CROUND  (CBLOCK - 1)    /* Clist rounding. */
+
+/*
+ * File system parameters and macros.
+ *
+ * The file system is made out of blocks of at most MAXBSIZE units, with
+ * smaller units (fragments) only in the last direct block.  MAXBSIZE
+ * primarily determines the size of buffers in the buffer pool.  It may be
+ * made larger without any effect on existing file systems; however making
+ * it smaller may make some file systems unmountable.
+ */
+#ifndef MAXBSIZE                               /* XXX */
+#define        MAXBSIZE        MAXPHYS
+#endif
+#define        MAXFRAG         8
+
+/*
+ * MAXPATHLEN defines the longest permissible path length after expanding
+ * symbolic links. It is used to allocate a temporary buffer from the buffer
+ * pool in which to do the name expansion, hence should be a power of two,
+ * and must be less than or equal to MAXBSIZE.  MAXSYMLINKS defines the
+ * maximum number of symbolic links that may be expanded in a path name.
+ * It should be set high enough to allow all legitimate uses, but halt
+ * infinite loops reasonably quickly.
+ *
+ * MAXSYMLINKS should be >= _POSIX_SYMLOOP_MAX (see <limits.h>)
+ */
+#define        MAXPATHLEN      PATH_MAX
+#define        MAXSYMLINKS     32
+
+/* Bit map related macros. */
+#define        setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
+#define        clrbit(a,i)     ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
+#define        isset(a,i)      ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
+#define        isclr(a,i)      (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
+
+/* Macros for counting and rounding. */
+#ifndef howmany
+#define        howmany(x, y)   (((x)+((y)-1))/(y))
+#endif
+#define        roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
+#define        rounddown(x,y)  (((x)/(y))*(y))
+#define        roundup2(x, m)  (((x) + (m) - 1) & ~((m) - 1))
+#define        powerof2(x)     ((((x)-1)&(x))==0)
 
 /* Macros for min/max. */
-#define MIN(a,b)        ((/*CONSTCOND*/(a)<(b))?(a):(b))
-#define MAX(a,b)        ((/*CONSTCOND*/(a)>(b))?(a):(b))
+#define        MIN(a,b)        ((/*CONSTCOND*/(a)<(b))?(a):(b))
+#define        MAX(a,b)        ((/*CONSTCOND*/(a)>(b))?(a):(b))
+
+#endif /* !__ASSEMBLER__ */
 
-#endif /* __SYS_PARAM_H__ */
+#endif /* !_SYS_PARAM_H_ */
index 7c57e937cc5342f1af2100c0bc3eba9578335414..6e93bed787dd5e932e88883d130ab06a42b89f58 100644 (file)
 #ifndef _NBCOMPAT_POLL_H_
 #define        _NBCOMPAT_POLL_H_
 
-#include <sys/cdefs.h>
-
 typedef unsigned int   nfds_t;
 
+#define INFTIM -1
+
 struct pollfd {
        int     fd;             /* file descriptor */
        short   events;         /* events to look for */
index 734b5ecd733f4bb2835819da0843260d90ab9482..59c1a442aafeb47b84c98fb5235d28a3b12010e7 100644 (file)
@@ -50,10 +50,10 @@ struct ptrace_range {
 };
 
 /* Function Prototypes. */
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
+#include <sys/cdefs.h>
 
-_PROTOTYPE( long ptrace, (int _req, pid_t _pid, long _addr, long _data) );
+__BEGIN_DECLS
+long ptrace(int _req, pid_t _pid, long _addr, long _data);
+__END_DECLS
 
 #endif /* _PTRACE_H */
similarity index 100%
rename from nbsd_include/sys/ptree.h
rename to include/sys/ptree.h
index ccff073584f47cfb15f60225de42c275531ab33a..2aef2e85319b557c2aa7db4347e1695805472cab 100644 (file)
@@ -1,25 +1,34 @@
-#ifndef _SYS_RESOURCE_H
-#define _SYS_RESOURCE_H
+#ifndef _SYS_RESOURCE_H_
+#define        _SYS_RESOURCE_H_
 
-/* Priority range for the get/setpriority() interface.
- * It isn't a mapping on the internal minix scheduling
- * priority.
- */
-#define PRIO_MIN       -20
-#define PRIO_MAX        20
-
-#define PRIO_PROCESS   0
-#define PRIO_PGRP      1
-#define PRIO_USER      2
+#include <sys/featuretest.h>
+#include <sys/time.h>
 
-int getpriority(int, int);
-int setpriority(int, int, int);
+/*
+ * Process priority specifications to get/setpriority.
+ */
+#define        PRIO_MIN        -20
+#define        PRIO_MAX        20
 
-#ifdef _POSIX_SOURCE
+#define        PRIO_PROCESS    0
+#define        PRIO_PGRP       1
+#define        PRIO_USER       2
 
-#include <sys/time.h>
+/*
+ * Resource limits
+ */
+#define RLIMIT_CORE    1
+#define RLIMIT_CPU     2
+#define RLIMIT_DATA    3
+#define RLIMIT_FSIZE   4
+#define RLIMIT_NOFILE  5
+#define RLIMIT_STACK   6
+#define RLIMIT_AS      7
+#define        RLIMIT_VMEM     RLIMIT_AS       /* common alias */
 
-typedef unsigned long rlim_t;
+#if defined(_NETBSD_SOURCE)
+#define        RLIM_NLIMITS    8               /* number of resource limits */
+#endif
 
 #define RLIM_INFINITY ((rlim_t) -1)
 #define RLIM_SAVED_CUR RLIM_INFINITY
@@ -31,17 +40,12 @@ struct rlimit
        rlim_t rlim_max;
 };
 
-#define RLIMIT_CORE    1
-#define RLIMIT_CPU     2
-#define RLIMIT_DATA    3
-#define RLIMIT_FSIZE   4
-#define RLIMIT_NOFILE  5
-#define RLIMIT_STACK   6
-#define RLIMIT_AS      7
+#include <sys/cdefs.h>
 
-#define RLIM_NLIMITS 8
-int getrlimit(int resource, struct rlimit *rlp);
+__BEGIN_DECLS
+int    getpriority(int, int);
+int    getrlimit(int, struct rlimit *);
+int    setpriority(int, int, int);
+__END_DECLS
 
-#endif /* defined(_POSIX_SOURCE) */
-
-#endif
+#endif /* !_SYS_RESOURCE_H_ */
index 8b7f3b23bf61546fafd8e9464df1c20932c91ba1..e4ba9ce60068112857057266cfd0033647d7e26d 100644 (file)
@@ -1,47 +1,87 @@
-#ifndef _SYS_SELECT_H
-#define _SYS_SELECT_H 1
+/*     $NetBSD: select.h,v 1.36 2009/11/11 09:48:51 rmind Exp $        */
 
-#include <sys/time.h>
-#include <minix/types.h>
-#include <minix/limits.h>
-#include <limits.h>
-#include <string.h>
+/*-
+ * Copyright (c) 1992, 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. 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.
+ *
+ *     @(#)select.h    8.2 (Berkeley) 1/4/94
+ */
 
-/* Use this datatype as basic storage unit in fd_set */
-typedef u32_t fd_mask; 
+#ifndef _SYS_SELECT_H_
+#define        _SYS_SELECT_H_
 
-/* This many bits fit in an fd_set word. */
-#define _FDSETBITSPERWORD      (sizeof(fd_mask)*8)
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/fd_set.h>
 
-/* Bit manipulation macros */
-#define _FD_BITMASK(b) (1L << ((b) % _FDSETBITSPERWORD))
-#define _FD_BITWORD(b) ((b)/_FDSETBITSPERWORD)
+#ifdef _KERNEL
+#include <sys/selinfo.h>               /* for struct selinfo */
+#include <sys/signal.h>                        /* for sigset_t */
 
-/* Default FD_SETSIZE is OPEN_MAX. */
-#ifndef FD_SETSIZE
-#define FD_SETSIZE             __MINIX_OPEN_MAX
-#endif
+struct lwp;
+struct proc;
+struct timespec;
+struct cpu_info;
+struct socket;
 
-/* We want to store FD_SETSIZE bits. */
-#define _FDSETWORDS(b) (((b)+_FDSETBITSPERWORD-1)/_FDSETBITSPERWORD)
+int    selcommon(register_t *, int, fd_set *, fd_set *, fd_set *,
+    struct timespec *, sigset_t *);
+void   selrecord(struct lwp *selector, struct selinfo *);
+void   selnotify(struct selinfo *, int, long);
+void   selsysinit(struct cpu_info *);
+void   selinit(struct selinfo *);
+void   seldestroy(struct selinfo *);
+int    pollsock(struct socket *, const struct timespec *, int);
 
-typedef struct {
-       fd_mask fds_bits[_FDSETWORDS(FD_SETSIZE)];
-} fd_set;
+#else /* _KERNEL */
 
-_PROTOTYPE( int select, (int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout) );
+#include <sys/sigtypes.h>
+#include <time.h>
 
-#define FD_ZERO(s) do { int _i; for(_i = 0; _i < _FDSETWORDS(FD_SETSIZE); _i++) { (s)->fds_bits[_i] = 0; } } while(0)
-#define FD_SET(f, s) do { (s)->fds_bits[_FD_BITWORD(f)] |= _FD_BITMASK(f); } while(0)
-#define FD_CLR(f, s) do { (s)->fds_bits[_FD_BITWORD(f)] &= ~(_FD_BITMASK(f)); } while(0)
-#define FD_ISSET(f, s) ((s)->fds_bits[_FD_BITWORD(f)] & _FD_BITMASK(f))
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+#ifndef __minix
+int    pselect(int, fd_set * __restrict, fd_set * __restrict,
+    fd_set * __restrict, const struct timespec * __restrict,
+    const sigset_t * __restrict) __RENAME(__pselect50);
+#endif /* !__minix */
+int    select(int, fd_set * __restrict, fd_set * __restrict,
+    fd_set * __restrict, struct timeval * __restrict) __RENAME(__select50);
+#endif /* __LIBC12_SOURCE__ */
+__END_DECLS
+#endif /* _KERNEL */
 
+#ifdef _MINIX
 /* possible select() operation types; read, write, errors */
 /* (FS/driver internal use only) */
 #define SEL_RD         (1 << 0)
 #define SEL_WR         (1 << 1)
 #define SEL_ERR                (1 << 2)
 #define SEL_NOTIFY     (1 << 3) /* not a real select operation */
+#endif
 
-#endif /* _SYS_SELECT_H */
-
+#endif /* !_SYS_SELECT_H_ */
index a2d09afbdf968ae5e225ea4b607bac22b482c3aa..05971dde1abd0fdf342e34c13fbaa46d1048879b 100644 (file)
@@ -1,60 +1,79 @@
-#ifndef _SYS_SEM_H
-#define _SYS_SEM_H
+/*     $NetBSD: sem.h,v 1.29 2009/01/19 19:39:41 christos Exp $        */
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * SVID compatible sem.h file
+ *
+ * Author: Daniel Boulet
+ */
+
+#ifndef _SYS_SEM_H_
+#define _SYS_SEM_H_
+
+#include <sys/featuretest.h>
 
-#include <sys/types.h>
 #include <sys/ipc.h>
 
-#define SEMMNI 128
-#define SEMMSL 250
-#define SEMMNS (SEMMSL*SEMMNI)
-
-#define SEMOPM 32
-#define SEMVMX 32767
-
-/* Flags for `semop'.  */
-#define SEM_UNDO        0x1000          /* undo the operation on exit */
-
-/* Commands for `semctl'.  */
-#define GETPID          11              /* get sempid */
-#define GETVAL          12              /* get semval */
-#define GETALL          13              /* get all semval's */
-#define GETNCNT         14              /* get semncnt */
-#define GETZCNT         15              /* get semzcnt */
-#define SETVAL          16              /* set semval */
-#define SETALL          17              /* set all semval's */
-
-
-/* Data structure describing a set of semaphores.  */
-struct semid_ds
-{
+struct semid_ds {
        struct ipc_perm sem_perm;             /* operation permission struct */
-       time_t sem_otime;                   /* last semop() time */
+       time_t          sem_otime;            /* last semop() time */
        unsigned long int __unused1;
-       time_t sem_ctime;                   /* last time changed by semctl() */
+       time_t          sem_ctime;            /* last time changed by semctl() */
        unsigned long int __unused2;
        unsigned long int sem_nsems;          /* number of semaphores in set */
        unsigned long int __unused3;
        unsigned long int __unused4;
 };
 
-/* Structure used for argument to `semop' to describe operations.  */
-struct sembuf
-{
-       unsigned short int sem_num;   /* semaphore number */
-       short int sem_op;             /* semaphore operation */
-       short int sem_flg;            /* operation flag */
+/*
+ * semop's sops parameter structure
+ */
+struct sembuf {
+       unsigned short  sem_num;        /* semaphore # */
+       short           sem_op;         /* semaphore operation */
+       short           sem_flg;        /* operation flags */
 };
+#define SEM_UNDO       0x1000          /* undo changes on process exit */
 
-
-/* Semaphore control operation.  */
-_PROTOTYPE( int semctl, (int __semid, int __semnum, int __cmd, ...));
-
-/* Get semaphore.  */
-_PROTOTYPE( int semget, (key_t __key, int __nsems, int __semflg));
-
-/* Operate on semaphore.  */
-_PROTOTYPE( int semop, (int __semid, struct sembuf *__sops, size_t __nsops));
-
+/*
+ * commands for semctl
+ */
+#define GETPID          11              /* get sempid */
+#define GETVAL          12              /* get semval */
+#define GETALL          13              /* get all semval's */
+#define GETNCNT         14              /* get semncnt */
+#define GETZCNT         15              /* get semzcnt */
+#define SETVAL          16              /* set semval */
+#define SETALL          17              /* set all semval's */
 
 #ifdef __USE_MISC
 
@@ -62,20 +81,41 @@ _PROTOTYPE( int semop, (int __semid, struct sembuf *__sops, size_t __nsops));
 # define SEM_STAT 18
 # define SEM_INFO 19
 
-struct  seminfo
-{
-       int semmap;
-       int semmni;
-       int semmns;
-       int semmnu;
-       int semmsl;
-       int semopm;
-       int semume;
-       int semusz;
-       int semvmx;
-       int semaem;
+/*
+ * semaphore info struct
+ */
+struct seminfo {
+       int32_t semmap;         /* # of entries in semaphore map */
+       int32_t semmni;         /* # of semaphore identifiers */
+       int32_t semmns;         /* # of semaphores in system */
+       int32_t semmnu;         /* # of undo structures in system */
+       int32_t semmsl;         /* max # of semaphores per id */
+       int32_t semopm;         /* max # of operations per semop call */
+       int32_t semume;         /* max # of undo entries per process */
+       int32_t semusz;         /* size in bytes of undo structure */
+       int32_t semvmx;         /* semaphore maximum value */
+       int32_t semaem;         /* adjust on exit max value */
 };
 
 #endif /* __USE_MISC */
 
-#endif /* _SYS_SEM_H */
+/*
+ * Configuration parameters
+ */
+#define SEMMNI 128
+#define SEMMSL 250
+#define SEMMNS (SEMMSL*SEMMNI)
+
+#define SEMOPM 32
+#define SEMVMX 32767
+
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int    semctl(int, int, int, ...);
+int    semget(key_t, int, int);
+int    semop(int, struct sembuf *, size_t);
+__END_DECLS
+
+#endif /* !_SYS_SEM_H_ */
similarity index 100%
rename from nbsd_include/sys/sha1.h
rename to include/sys/sha1.h
similarity index 100%
rename from nbsd_include/sys/sha2.h
rename to include/sys/sha2.h
index 78fcec1b6c37b3d147250967004a16d5143ba5b8..2003c72af157c368898839a217e8c15e385b0db2 100644 (file)
@@ -1,35 +1,99 @@
-#ifndef _SYS_SHM_H
-#define _SYS_SHM_H
+/*     $NetBSD: shm.h,v 1.48 2009/01/19 19:39:41 christos Exp $        */
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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/types.h>
-#include <sys/ipc.h>
+/*
+ * Copyright (c) 1994 Adam Glass
+ * 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 Adam Glass.
+ * 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.
+ */
+
+/*
+ * As defined+described in "X/Open System Interfaces and Headers"
+ *                         Issue 4, p. XXX
+ */
 
-#include <unistd.h>
+#ifndef _SYS_SHM_H_
+#define _SYS_SHM_H_
 
-typedef unsigned long int shmatt_t;
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
 
-#define SHMLBA getpagesize()
+#include <sys/ipc.h>
+
+#define        SHM_RDONLY      010000  /* Attach read-only (else read-write) */
+#define        SHM_RND         020000  /* Round attach address to SHMLBA */
+
+/* Segment low boundry address multiple */
+#define        SHMLBA          getpagesize()
 #define SHMMNI 4096
 #define SHMSEG 32              /* max shared segs per process */
 
-struct shmid_ds
-{
-       struct ipc_perm shm_perm;       /* Ownership and permissions */
-       size_t  shm_segsz;                      /* Size of segment (bytes) */
-       time_t  shm_atime;                      /* Last attach time */
-       time_t  shm_dtime;                      /* Last detach time */
-       time_t  shm_ctime;                      /* Last change time */
-       pid_t   shm_cpid;                       /* PID of creator */
-       pid_t   shm_lpid;                       /* PID of last shmat()/shmdt() */
-       shmatt_t        shm_nattch;             /* No. of current attaches */
+typedef unsigned int   shmatt_t;
+
+struct shmid_ds {
+       struct ipc_perm shm_perm;       /* operation permission structure */
+       size_t          shm_segsz;      /* size of segment in bytes */
+       time_t          shm_atime;      /* time of last shmat() */
+       time_t          shm_dtime;      /* time of last shmdt() */
+       time_t          shm_ctime;      /* time of last change by shmctl() */
+       pid_t           shm_cpid;       /* process ID of creator */
+       pid_t           shm_lpid;       /* process ID of last shm operation */
+       shmatt_t        shm_nattch;     /* number of current attaches */
 };
 
-/* Permission flag for shmget. */
-#define SHM_R  0400
-#define SHM_W  0200
-
-#define SHM_RDONLY 010000              /* attach read-only else read-write */
-#define SHM_RND    020000              /* round attach address to SHMLBA */
 
 /* shm_mode upper byte flags */
 #define SHM_DEST 01000                 /* segment will be destroyed on last detach */
@@ -39,15 +103,28 @@ struct shmid_ds
 #define SHM_STAT       13
 #define SHM_INFO       14
 
-struct  shminfo
-{
-       unsigned long int shmmax;
-       unsigned long int shmmin;
-       unsigned long int shmmni;
-       unsigned long int shmseg;
-       unsigned long int shmall;
+
+#if defined(_NETBSD_SOURCE) || defined(__minix)
+/*
+ * Permission definitions used in shmflag arguments to shmat(2) and shmget(2).
+ * Provided for source compatibility only; do not use in new code!
+ */
+#define        SHM_R           0400
+#define        SHM_W           0200
+
+/*
+ * System 5 style catch-all structure for shared memory constants that
+ * might be of interest to user programs.  Do we really want/need this?
+ */
+struct shminfo {
+       unsigned long int shmmax;       /* max shared memory segment size (bytes) */
+       unsigned long int shmmin;       /* min shared memory segment size (bytes) */
+       unsigned long int shmmni;       /* max number of shared memory identifiers */
+       unsigned long int shmseg;       /* max shared memory segments per process */
+       unsigned long int shmall;       /* max amount of shared memory (pages) */
 };
 
+#ifdef __minix
 struct shm_info
 {
        int used_ids;
@@ -57,21 +134,15 @@ struct shm_info
        unsigned long int swap_attempts;
        unsigned long int swap_successes;
 };
+#endif /* __minix */
 
-/* The following System V style IPC functions implement a shared memory
- * facility.  The definition is found in XPG4.2.
- */
-
-/* Shared memory control operation. */
-_PROTOTYPE( int shmctl, (int __shmid, int __cmd, struct shmid_ds *__buf));
-
-/* Get shared memory segment. */
-_PROTOTYPE( int shmget, (key_t __key, size_t __size, int __shmflg));
-
-/* Attach shared memory segment. */
-_PROTOTYPE( void *shmat, (int __shmid, const void *__shmaddr, int __shmflg));
+#endif /* _NETBSD_SOURCE */
 
-/* Deattach shared memory segment. */
-_PROTOTYPE( int shmdt, (const void *__shmaddr));
+__BEGIN_DECLS
+void   *shmat(int, const void *, int);
+int    shmctl(int, int, struct shmid_ds *) __RENAME(__shmctl50);
+int    shmdt(const void *);
+int    shmget(key_t, size_t, int);
+__END_DECLS
 
-#endif /* _SYS_SHM_H */
+#endif /* !_SYS_SHM_H_ */
diff --git a/include/sys/sigcontext.h b/include/sys/sigcontext.h
deleted file mode 100644 (file)
index c7e6f0c..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef _SIGCONTEXT_H
-#define _SIGCONTEXT_H
-
-/* The sigcontext structure is used by the sigreturn(2) system call.
- * sigreturn() is seldom called by user programs, but it is used internally
- * by the signal catching mechanism.
- */
-
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
-
-#ifndef _MINIX_SYS_CONFIG_H
-#include <minix/sys_config.h>
-#endif
-
-#if !defined(_MINIX_CHIP)
-#include "error, configuration is not known"
-#endif
-
-/* The following structure should match the stackframe_s structure used
- * by the kernel's context switching code.  Floating point registers should
- * be added in a different struct.
- */
-#if (_MINIX_CHIP == _CHIP_INTEL)
-#include <machine/stackframe.h>
-#include <machine/fpu.h>
-
-typedef struct stackframe_s sigregs;
-struct sigframe {              /* stack frame created for signalled process */
-  _PROTOTYPE( void (*sf_retadr), (void) );
-  int sf_signo;
-  int sf_code;
-  struct sigcontext *sf_scp;
-  int sf_fp;
-  _PROTOTYPE( void (*sf_retadr2), (void) );
-  struct sigcontext *sf_scpcopy;
-};
-
-#else
-#include "error, _MINIX_CHIP is not supported"
-#endif /* _MINIX_CHIP == _CHIP_INTEL */
-
-struct sigcontext {
-  int sc_flags;                        /* sigstack state to restore (including
-                                * MF_FPU_INITIALIZED)
-                                */
-  long sc_mask;                        /* signal mask to restore */
-  sigregs sc_regs;              /* register set to restore */
-#if (_MINIX_CHIP == _CHIP_INTEL)
-  union fpu_state_u sc_fpu_state;
-#endif
-};
-
-#if (_MINIX_CHIP == _CHIP_INTEL)
-#if _WORD_SIZE == 4
-#define sc_gs sc_regs.gs
-#define sc_fs sc_regs.fs
-#endif /* _WORD_SIZE == 4 */
-#define sc_es sc_regs.es
-#define sc_ds sc_regs.ds
-#define sc_di sc_regs.di
-#define sc_si sc_regs.si
-#define sc_fp sc_regs.bp
-#define sc_st sc_regs.st               /* stack top -- used in kernel */
-#define sc_bx sc_regs.bx
-#define sc_dx sc_regs.dx
-#define sc_cx sc_regs.cx
-#define sc_retreg sc_regs.retreg
-#define sc_retadr sc_regs.retadr       /* return address to caller of
-                                       save -- used in kernel */
-#define sc_pc sc_regs.pc
-#define sc_cs sc_regs.cs
-#define sc_psw sc_regs.psw
-#define sc_sp sc_regs.sp
-#define sc_ss sc_regs.ss
-#endif /* _MINIX_CHIP == _CHIP_INTEL */
-
-_PROTOTYPE( int sigreturn, (struct sigcontext *_scp)                   );
-
-#endif /* _SIGCONTEXT_H */
index 4b80ddea3ce2f4a2a0a8b558ead2472f85c8e0bd..f9bc91f37c2c10f4ca96d811e02924fc5b6f9705 100644 (file)
@@ -1,2 +1,207 @@
-#include <signal.h>
+#ifndef        _SYS_SIGNAL_H_
+#define        _SYS_SIGNAL_H_
+
+#include <sys/featuretest.h>
+#include <sys/sigtypes.h>
+
+#define _NSIG          26
+#define NSIG _NSIG
+
+
+/* Regular signals. */
+#define SIGHUP             1   /* hangup */
+#define SIGINT             2   /* interrupt (DEL) */
+#define SIGQUIT            3   /* quit (ASCII FS) */
+#define SIGILL             4   /* illegal instruction */
+#define SIGTRAP            5   /* trace trap (not reset when caught) */
+#define SIGABRT            6   /* IOT instruction */
+#define SIGBUS             7   /* bus error */
+#define SIGFPE             8   /* floating point exception */
+#define SIGKILL            9   /* kill (cannot be caught or ignored) */
+#define SIGUSR1           10   /* user defined signal # 1 */
+#define SIGSEGV           11   /* segmentation violation */
+#define SIGUSR2           12   /* user defined signal # 2 */
+#define SIGPIPE           13   /* write on a pipe with no one to read it */
+#define SIGALRM           14   /* alarm clock */
+#define SIGTERM           15   /* software termination signal from kill */
+#define SIGEMT           16    /* EMT instruction */
+#define SIGCHLD           17   /* child process terminated or stopped */
+#define SIGWINCH         21    /* window size has changed */
+#define SIGVTALRM         24   /* virtual alarm */
+#define SIGPROF           25   /* profiler alarm */
+
+/* POSIX requires the following signals to be defined, even if they are
+ * not supported.  Here are the definitions, but they are not supported.
+ */
+#define SIGCONT           18   /* continue if stopped */
+#define SIGSTOP           19   /* stop signal */
+#define SIGTSTP           20   /* interactive stop signal */
+#define SIGTTIN           22   /* background process wants to read */
+#define SIGTTOU           23   /* background process wants to write */
+
+#ifdef _MINIX
+#define SIGIOT             SIGABRT /* for people who speak PDP-11 */
+
+/* MINIX specific signals. These signals are not used by user proceses, 
+ * but meant to inform system processes, like the PM, about system events.
+ * The order here determines the order signals are processed by system
+ * processes in user-space. Higher-priority signals should be first.
+ */
+/* Signals delivered by a signal manager. */
+#define SIGSNDELAY       26    /* end of delay for signal delivery */
+
+#define SIGS_FIRST       SIGHUP      /* first system signal */
+#define SIGS_LAST        SIGSNDELAY   /* last system signal */
+#define IS_SIGS(signo)    (signo>=SIGS_FIRST && signo<=SIGS_LAST)
+
+/* Signals delivered by the kernel. */
+#define SIGKMEM                  27    /* kernel memory request pending */
+#define SIGKMESS         28    /* new kernel message */
+#define SIGKSIGSM        29    /* kernel signal pending for signal manager */
+#define SIGKSIG          30    /* kernel signal pending */
+
+#define SIGK_FIRST       SIGKMEM      /* first kernel signal */
+#define SIGK_LAST        SIGKSIG     /* last kernel signal */
+#define IS_SIGK(signo)    (signo>=SIGK_FIRST && signo<=SIGK_LAST)
+
+/* Termination signals for Minix system processes. */
+#define SIGS_IS_LETHAL(sig) \
+    (sig == SIGILL || sig == SIGBUS || sig == SIGFPE || sig == SIGSEGV \
+    || sig == SIGEMT || sig == SIGABRT)
+#define SIGS_IS_TERMINATION(sig) (SIGS_IS_LETHAL(sig) \
+    || (sig == SIGKILL || sig == SIGPIPE))
+#define SIGS_IS_STACKTRACE(sig) (SIGS_IS_LETHAL(sig) && sig != SIGABRT)
+
+#endif
+
+#include <sys/cdefs.h>
+
+typedef void (*__sighandler_t)(int);
+
+/* Macros used as function pointers. */
+#define SIG_ERR    ((__sighandler_t) -1)       /* error return */
+#define SIG_DFL           ((__sighandler_t)  0)        /* default signal handling */
+#define SIG_IGN           ((__sighandler_t)  1)        /* ignore signal */
+#define SIG_HOLD   ((__sighandler_t)  2)       /* block signal */
+#define SIG_CATCH  ((__sighandler_t)  3)       /* catch signal */
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#include <sys/siginfo.h>
+#endif
+
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+#include <sys/ucontext.h>
+#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+
+/*
+ * Signal vector "template" used in sigaction call.
+ */
+struct sigaction {
+       union {
+               void (*_sa_handler)(int);
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+               void (*_sa_sigaction)(int, siginfo_t *, void *);
+#endif
+       } _sa_u;        /* signal handler */
+       sigset_t sa_mask;               /* signal mask to apply */
+       int     sa_flags;               /* see signal options below */
+};
+
+#define sa_handler _sa_u._sa_handler
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#define sa_sigaction _sa_u._sa_sigaction
+#endif
+
+#include <machine/signal.h>    /* sigcontext; codes for SIGILL, SIGFPE */
+
+/* Fields for sa_flags. */
+#define SA_ONSTACK   0x0001    /* deliver signal on alternate stack */
+#define SA_RESETHAND 0x0002    /* reset signal handler when signal caught */
+#define SA_NODEFER   0x0004    /* don't block signal while catching it */
+#define SA_RESTART   0x0008    /* automatic system call restart */
+#define SA_SIGINFO   0x0010    /* extended signal handling */
+#define SA_NOCLDWAIT 0x0020    /* don't create zombies */
+#define SA_NOCLDSTOP 0x0040    /* don't receive SIGCHLD when child stops */
+
+/* POSIX requires these values for use with sigprocmask(2). */
+#define SIG_BLOCK          0   /* for blocking signals */
+#define SIG_UNBLOCK        1   /* for unblocking signals */
+#define SIG_SETMASK        2   /* for setting the signal mask */
+#define SIG_INQUIRE        4   /* for internal use only */
+
+#if defined(_NETBSD_SOURCE)
+typedef        void (*sig_t)(int);     /* type of signal function */
+#endif
+
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+/*
+ * Flags used with stack_t/struct sigaltstack.
+ */
+#define SS_ONSTACK      1      /* Process is executing on an alternate stack */
+#define SS_DISABLE      2      /* Alternate stack is disabled */
+
+#define MINSIGSTKSZ    2048    /* Minimal stack size is 2k */
+#define        SIGSTKSZ        (MINSIGSTKSZ + 32768)   /* recommended stack size */
+#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+/*
+ * Structure used in sigstack call.
+ */
+struct sigstack {
+       void    *ss_sp;                 /* signal stack pointer */
+       int     ss_onstack;             /* current status */
+};
+#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE) && !defined(_KERNEL)
+/*
+ * Macro for converting signal number to a mask suitable for
+ * sigblock().
+ */
+#define sigmask(n)     __sigmask(n)
+
+#define        BADSIG          SIG_ERR
+#endif /* _NETBSD_SOURCE */
+
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+struct sigevent {
+       int     sigev_notify;
+       int     sigev_signo;
+       union sigval    sigev_value;
+       void    (*sigev_notify_function)(union sigval);
+       void /* pthread_attr_t */       *sigev_notify_attributes;
+};
+
+#define SIGEV_NONE     0
+#define SIGEV_SIGNAL   1
+#define SIGEV_THREAD   2
+#if defined(_NETBSD_SOURCE)
+#define SIGEV_SA       3
+#endif
+#endif /* (_POSIX_C_SOURCE - 0) >= 199309L || ... */
+
+#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+/*
+ * For historical reasons; programs expect signal's return value to be
+ * defined by <sys/signal.h>.
+ */
+__BEGIN_DECLS
+void   (*signal(int, void (*)(int)))(int);
+__END_DECLS
+#endif /* !_SYS_SIGNAL_H_ */
+
+
+
 
index e603b3aa35329e8ea192c325dcab6d0614177c64..a738ce8426026c4fb8216d1f2c7bad07d8ca65c5 100644 (file)
-/*
-sys/socket.h
-*/
+#ifndef _SYS_SOCKET_H_
+#define        _SYS_SOCKET_H_
 
-#ifndef SYS_SOCKET_H
-#define SYS_SOCKET_H
+#include <sys/featuretest.h>
 
-/* Can we include <stdint.h> here or do we need an additional header that is
- * safe to include?
+/*
+ * Definitions related to sockets: types, address families, options.
  */
-#include <stdint.h>
 
-#include <sys/ucred.h>
+/*
+ * Data types.
+ */
+#include <sys/ansi.h>
+
+#ifndef sa_family_t
+typedef __sa_family_t  sa_family_t;
+#define sa_family_t    __sa_family_t
+#endif
+
+#ifndef socklen_t
+typedef __socklen_t    socklen_t;
+#define socklen_t      __socklen_t
+#endif
+
+#include <machine/ansi.h>
 
-/* Open Group Base Specifications Issue 6 (not complete) */
-#include <net/gen/socket.h>
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
+#endif
 
-#define SOCK_STREAM    1
-#define SOCK_DGRAM     2
-#define SOCK_RAW       3
-#define SOCK_RDM       4
-#define SOCK_SEQPACKET 5
+#ifdef _BSD_SSIZE_T_
+typedef        _BSD_SSIZE_T_   ssize_t;
+#undef _BSD_SSIZE_T_
+#endif
 
-#define SOL_SOCKET     0xFFFF
+#include <sys/uio.h>
 
-#define SO_DEBUG       0x0001
-#define SO_REUSEADDR   0x0004
-#define SO_KEEPALIVE   0x0008
-#define SO_TYPE        0x0010  /* get socket type, SOCK_STREAM or SOCK_DGRAM */
+/*
+ * Socket types.
+ */
+#define        SOCK_STREAM     1               /* stream socket */
+#define        SOCK_DGRAM      2               /* datagram socket */
+#define        SOCK_RAW        3               /* raw-protocol interface */
+#define        SOCK_RDM        4               /* reliably-delivered message */
+#define        SOCK_SEQPACKET  5               /* sequenced packet stream */
+
+/*
+ * Option flags per-socket.
+ */
+#define        SO_DEBUG        0x0001          /* turn on debugging info recording */
+#define        SO_REUSEADDR    0x0004          /* allow local address reuse */
+#define        SO_KEEPALIVE    0x0008          /* keep connections alive */
+#define        SO_TYPE         0x0010          /* get socket type */
 
 #define SO_PASSCRED    0x0012
 #define SO_PEERCRED    0x0014
 
-#define SO_SNDBUF      0x1001  /* send buffer size */
-#define SO_RCVBUF      0x1002  /* receive buffer size */
-#define SO_ERROR       0x1007  /* get and clear error status */
+#define SO_SNDBUF      0x1001          /* send buffer size */
+#define SO_RCVBUF      0x1002          /* receive buffer size */
+#define        SO_ERROR        0x1007          /* get error status and clear */
+
 
-/* The how argument to shutdown */
-#define SHUT_RD                0       /* No further reads */
-#define SHUT_WR                1       /* No further writes */
-#define SHUT_RDWR      2       /* No further reads and writes */
+/*
+ * Level number for (get/set)sockopt() to apply to socket itself.
+ */
+#define        SOL_SOCKET      0xffff          /* options for socket level */
 
-#ifndef _SA_FAMILY_T
-#define _SA_FAMILY_T
-typedef uint8_t                sa_family_t;
-#endif /* _SA_FAMILY_T */
+/*
+ * Address families.
+ */
+#define        AF_UNSPEC       0               /* unspecified */
+#define        AF_LOCAL        1               /* local to host */
+#define        AF_UNIX         AF_LOCAL        /* backward compatibility */
+#define        AF_INET         2               /* internetwork: UDP, TCP, etc. */
+#define        AF_IMPLINK      3               /* arpanet imp addresses */
+#define        AF_PUP          4               /* pup protocols: e.g. BSP */
+#define        AF_CHAOS        5               /* mit CHAOS protocols */
+#define        AF_NS           6               /* XEROX NS protocols */
+#define        AF_ISO          7               /* ISO protocols */
+#define        AF_OSI          AF_ISO
+#define        AF_ECMA         8               /* european computer manufacturers */
+#define        AF_DATAKIT      9               /* datakit protocols */
+#define        AF_CCITT        10              /* CCITT protocols, X.25 etc */
+#define        AF_SNA          11              /* IBM SNA */
+#define AF_DECnet      12              /* DECnet */
+#define AF_DLI         13              /* DEC Direct data link interface */
+#define AF_LAT         14              /* LAT */
+#define        AF_HYLINK       15              /* NSC Hyperchannel */
+#define        AF_APPLETALK    16              /* Apple Talk */
+#define        AF_ROUTE        17              /* Internal Routing Protocol */
+#define        AF_LINK         18              /* Link layer interface */
+#if defined(_NETBSD_SOURCE)
+#define        pseudo_AF_XTP   19              /* eXpress Transfer Protocol (no AF) */
+#endif
+#define        AF_COIP         20              /* connection-oriented IP, aka ST II */
+#define        AF_CNT          21              /* Computer Network Technology */
+#if defined(_NETBSD_SOURCE)
+#define pseudo_AF_RTIP 22              /* Help Identify RTIP packets */
+#endif
+#define        AF_IPX          23              /* Novell Internet Protocol */
+#define        AF_INET6        24              /* IP version 6 */
+#if defined(_NETBSD_SOURCE)
+#define pseudo_AF_PIP  25              /* Help Identify PIP packets */
+#endif
+#define AF_ISDN                26              /* Integrated Services Digital Network*/
+#define AF_E164                AF_ISDN         /* CCITT E.164 recommendation */
+#define AF_NATM                27              /* native ATM access */
+#define AF_ARP         28              /* (rev.) addr. res. prot. (RFC 826) */
+#if defined(_NETBSD_SOURCE)
+#define pseudo_AF_KEY  29              /* Internal key management protocol  */
+#define        pseudo_AF_HDRCMPLT 30           /* Used by BPF to not rewrite hdrs
+                                          in interface output routine */
+#endif
+#define AF_BLUETOOTH   31              /* Bluetooth: HCI, SCO, L2CAP, RFCOMM */
+#define        AF_IEEE80211    32              /* IEEE80211 */
+
+#define        AF_MAX          33
+
+#ifndef        gid_t
+typedef        __gid_t         gid_t;          /* group id */
+#define        gid_t           __gid_t
+#endif
+
+#ifndef        uid_t
+typedef        __uid_t         uid_t;          /* user id */
+#define        uid_t           __uid_t
+#endif
 
-#ifndef _SOCKLEN_T
-#define _SOCKLEN_T
-typedef int32_t socklen_t;
-#endif /* _SOCKLEN_T */
+#include <sys/ucred.h>
 
+/*
+ * Structure used by kernel to store most
+ * addresses.
+ */
 struct sockaddr
 {
        sa_family_t     sa_family;
        char            sa_data[8];     /* Big enough for sockaddr_in */
 };
 
-struct msghdr
-{
-       void            *msg_name;
-       socklen_t       msg_namelen;
-       struct iovec    *msg_iov;
-       size_t          msg_iovlen;
-       void            *msg_control;
-       socklen_t       msg_controllen;
-       int             msg_flags;
+/*
+ * RFC 2553: protocol-independent placeholder for socket addresses
+ */
+#define _SS_MAXSIZE    128
+#define _SS_ALIGNSIZE  (sizeof(__int64_t))
+#define _SS_PAD1SIZE   (_SS_ALIGNSIZE - 1)
+#define _SS_PAD2SIZE   (_SS_MAXSIZE - 1 - \
+                               _SS_PAD1SIZE - _SS_ALIGNSIZE)
+
+#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+struct sockaddr_storage {
+       sa_family_t     ss_family;      /* address family */
+       char            __ss_pad1[_SS_PAD1SIZE];
+       __int64_t     __ss_align;/* force desired structure storage alignment */
+       char            __ss_pad2[_SS_PAD2SIZE];
 };
+#define        sstosa(__ss)    ((struct sockaddr *)(__ss))
+#define        sstocsa(__ss)   ((const struct sockaddr *)(__ss))
+#endif /* _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
 
-struct cmsghdr
-{
-       socklen_t       cmsg_len;
-       int             cmsg_level;
-       int             cmsg_type;
+/*
+ * Protocol families, same as address families for now.
+ */
+#define        PF_UNSPEC       AF_UNSPEC
+#define        PF_LOCAL        AF_LOCAL
+#define        PF_UNIX         PF_LOCAL        /* backward compatibility */
+#define PF_FILE                PF_LOCAL        /* Minix compatibility */
+#define        PF_INET         AF_INET
+#define        PF_IMPLINK      AF_IMPLINK
+#define        PF_PUP          AF_PUP
+#define        PF_CHAOS        AF_CHAOS
+#define        PF_NS           AF_NS
+#define        PF_ISO          AF_ISO
+#define        PF_OSI          AF_ISO
+#define        PF_ECMA         AF_ECMA
+#define        PF_DATAKIT      AF_DATAKIT
+#define        PF_CCITT        AF_CCITT
+#define        PF_SNA          AF_SNA
+#define PF_DECnet      AF_DECnet
+#define PF_DLI         AF_DLI
+#define PF_LAT         AF_LAT
+#define        PF_HYLINK       AF_HYLINK
+#define        PF_APPLETALK    AF_APPLETALK
+#define        PF_ROUTE        AF_ROUTE
+#define        PF_LINK         AF_LINK
+#if defined(_NETBSD_SOURCE)
+#define        PF_XTP          pseudo_AF_XTP   /* really just proto family, no AF */
+#endif
+#define        PF_COIP         AF_COIP
+#define        PF_CNT          AF_CNT
+#define        PF_INET6        AF_INET6
+#define        PF_IPX          AF_IPX          /* same format as AF_NS */
+#if defined(_NETBSD_SOURCE)
+#define PF_RTIP                pseudo_AF_RTIP  /* same format as AF_INET */
+#define PF_PIP         pseudo_AF_PIP
+#endif
+#define PF_ISDN                AF_ISDN         /* same as E164 */
+#define PF_E164                AF_E164
+#define PF_NATM                AF_NATM
+#define PF_ARP         AF_ARP
+#if defined(_NETBSD_SOURCE)
+#define PF_KEY                 pseudo_AF_KEY   /* like PF_ROUTE, only for key mgmt */
+#endif
+#define PF_BLUETOOTH   AF_BLUETOOTH
+
+#define        PF_MAX          AF_MAX
+
+/*
+ * Message header for recvmsg and sendmsg calls.
+ * Used value-result for recvmsg, value only for sendmsg.
+ */
+struct msghdr {
+       void            *msg_name;      /* optional address */
+       socklen_t       msg_namelen;    /* size of address */
+       struct iovec    *msg_iov;       /* scatter/gather array */
+       int             msg_iovlen;     /* # elements in msg_iov */
+       void            *msg_control;   /* ancillary data, see below */
+       socklen_t       msg_controllen; /* ancillary data buffer len */
+       int             msg_flags;      /* flags on received message */
+};
+
+/*
+ * Header for ancillary data objects in msg_control buffer.
+ * Used for additional information with/about a datagram
+ * not expressible by flags.  The format is a sequence
+ * of message elements headed by cmsghdr structures.
+ */
+struct cmsghdr {
+       socklen_t       cmsg_len;       /* data byte count, including hdr */
+       int             cmsg_level;     /* originating protocol */
+       int             cmsg_type;      /* protocol-specific type */
+/* followed by u_char  cmsg_data[]; */
 };
 
 #define CMSG_FIRSTHDR(mhdr)                                    \
@@ -97,75 +256,54 @@ struct cmsghdr
 #define CMSG_DATA(cmsg) \
        ( (unsigned char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr)) )
 
-#define CMSG_SPACE(len) \
-       ( CMSG_ALIGN(len) + CMSG_ALIGN(sizeof(struct cmsghdr)) )
-
-#define CMSG_LEN(len) \
-       ( len + CMSG_ALIGN(sizeof(struct cmsghdr)) )
+#define CMSG_SPACE(l)  (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(l))
+#define CMSG_LEN(l)    (CMSG_ALIGN(sizeof(struct cmsghdr)) + (l))
 
+/* "Socket"-level control message types: */
 #define SCM_RIGHTS     0x01
 #define SCM_CREDENTIALS        0x02
 #define SCM_SECURITY   0x04
 
-_PROTOTYPE( int accept, (int _socket,
-                               struct sockaddr *_RESTRICT _address,
-                               socklen_t *_RESTRICT _address_len)      );
-_PROTOTYPE( int bind, (int _socket, const struct sockaddr *_address,
-                                               socklen_t _address_len) );
-_PROTOTYPE( int connect, (int _socket, const struct sockaddr *_address,
-                                               socklen_t _address_len) );
-_PROTOTYPE( int getpeername, (int _socket,
-                               struct sockaddr *_RESTRICT _address,
-                               socklen_t *_RESTRICT _address_len)      );
-_PROTOTYPE( int getpeereid, (int _socket, uid_t *_euid, gid_t *_egid)  );
-_PROTOTYPE( int getsockname, (int _socket,
-                               struct sockaddr *_RESTRICT _address,
-                               socklen_t *_RESTRICT _address_len)      );
-_PROTOTYPE( int setsockopt,(int _socket, int _level, int _option_name,
-               const void *_option_value, socklen_t _option_len)       );
-_PROTOTYPE( int getsockopt, (int _socket, int _level, int _option_name,
-        void *_RESTRICT _option_value, socklen_t *_RESTRICT _option_len));
-_PROTOTYPE( int listen, (int _socket, int _backlog)                    );
-_PROTOTYPE( ssize_t recv, (int _socket, void *_buffer, size_t _length,
-                                                       int _flags)     );
-_PROTOTYPE( ssize_t recvfrom, (int _socket, void *_RESTRICT _buffer,
-       size_t _length, int _flags, struct sockaddr *_RESTRICT _address,
-                               socklen_t *_RESTRICT _address_len)      );
-_PROTOTYPE( ssize_t recvmsg, (int _socket, struct msghdr *_msg,
-                                                       int _flags)     );
-_PROTOTYPE( ssize_t send, (int _socket, const void *_buffer,
-                                       size_t _length, int _flags)     );
-_PROTOTYPE( ssize_t sendmsg, (int _socket, const struct msghdr *_msg,
-                                                       int _flags)     );
-_PROTOTYPE( ssize_t sendto, (int _socket, const void *_message,
-       size_t _length, int _flags, const struct sockaddr *_dest_addr,
-                                               socklen_t _dest_len)    );
-_PROTOTYPE( int shutdown, (int _socket, int _how)                      );
-_PROTOTYPE( int socket, (int _domain, int _type, int _protocol)                );
-_PROTOTYPE( int socketpair, (int _domain, int _type, int _protocol,
-                                                       int _sv[2])     );
-
-/* The following constants are often used in applications, but are not defined
- * by POSIX.
+
+/*
+ * Types of socket shutdown(2).
  */
-#define PF_INET                AF_INET
-#define PF_INET6       AF_INET6
-#define PF_UNIX                AF_UNIX
-#define PF_LOCAL       PF_UNIX
-#define PF_FILE                PF_UNIX
-#define PF_UNSPEC      AF_UNSPEC
-
-/* based on http://tools.ietf.org/html/rfc2553 */
-struct sockaddr_storage
-{
-       sa_family_t     ss_family;
-       char            __ss_pad1[6];
-#ifdef __LONG_LONG_SUPPORTED
-       int64_t         __ss_align;
-#else
-       int32_t         __ss_align[2];
-#endif
-       char            __ss_pad2[112];
-};
+#define        SHUT_RD         0               /* Disallow further receives. */
+#define        SHUT_WR         1               /* Disallow further sends. */
+#define        SHUT_RDWR       2               /* Disallow further sends/receives. */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int    __cmsg_alignbytes(void);
+__END_DECLS
+
+__BEGIN_DECLS
+int    accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
+int    bind(int, const struct sockaddr *, socklen_t);
+int    connect(int, const struct sockaddr *, socklen_t);
+int    getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);
+int    getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict);
+int    getsockopt(int, int, int, void *__restrict, socklen_t * __restrict);
+int    listen(int, int);
+ssize_t        recv(int, void *, size_t, int);
+ssize_t        recvfrom(int, void *__restrict, size_t, int,
+           struct sockaddr * __restrict, socklen_t * __restrict);
+ssize_t        recvmsg(int, struct msghdr *, int);
+ssize_t        send(int, const void *, size_t, int);
+ssize_t        sendto(int, const void *,
+           size_t, int, const struct sockaddr *, socklen_t);
+ssize_t        sendmsg(int, const struct msghdr *, int);
+int    setsockopt(int, int, int, const void *, socklen_t);
+int    shutdown(int, int);
+int    sockatmark(int);
+int    socket(int, int, int);
+int    socketpair(int, int, int, int *);
+__END_DECLS
+
+#define MSG_OOB         0x0001  /* process out-of-band data */
+#define MSG_PEEK        0x0002  /* peek at incoming message */
+#define MSG_DONTROUTE   0x0004  /* send without using routing tables */
+#define MSG_EOR         0x0008         /* complete record */
 
-#endif /* SYS_SOCKET_H */
+#endif /* !_SYS_SOCKET_H_ */
diff --git a/include/sys/soundcard.h b/include/sys/soundcard.h
deleted file mode 100644 (file)
index dac5c59..0000000
+++ /dev/null
@@ -1,2140 +0,0 @@
-/*
- * Purpose: The C/C++ header file that defines the OSS API.
- * Description:
- * This header file contains all the declarations required to compile OSS
- * programs. The latest version is always installed together with OSS
- * use of the latest version is strongly recommended.
- *
- * {!notice This header file contains many obsolete definitions
- * (for compatibility with older applications that still ned them).
- * Do not use this file as a reference manual of OSS.
- * Please check the OSS Programmer's guide for descriptions
- * of the supported API details (http://manuals.opensound.com/developer).} 
- */
-
-#ifndef SOUNDCARD_H
-#define SOUNDCARD_H
-
-/*
- * This file is part of Open Sound System
- *
- * Copyright (C) 4Front Technologies 1996-2008.
- *
- * This software is released under the BSD license.
- * See the COPYING file included in the main directory of this source
- * distribution for the license terms and conditions
- */
-
-
-#if defined(__cplusplus)
-#define EXTERNC extern "C"
-#else
-#define EXTERNC extern
-#endif /* EXTERN_C_WRAPPERS */
-
-#define OSS_VERSION    0x040100 /* 4.1 */
-
-#define SOUND_VERSION  OSS_VERSION
-#define OPEN_SOUND_SYSTEM
-
-#if defined(__hpux) && !defined(_HPUX_SOURCE)
-#      error "-D_HPUX_SOURCE must be used when compiling OSS applications"
-#endif
-
-#ifdef __hpux
-#include <sys/ioctl.h>
-#endif
-
-#ifdef linux
-/* In Linux we need to be prepared for cross compiling */
-#include <linux/ioctl.h>
-#else
-# ifdef __FreeBSD__
-#    include <sys/ioccom.h>
-# else
-#    include <sys/ioctl.h>
-# endif
-#endif
-
-#ifndef __SIOWR
-#if defined(__hpux) || (defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__INCioctlh) && !defined(__Lynx__))))
-
-/* 
- * Make sure the ioctl macros are compatible with the ones already used
- * by this operating system.
- */
-#define        SIOCPARM_MASK   IOCPARM_MASK
-#define        SIOC_VOID       IOC_VOID
-#define        SIOC_OUT        IOC_OUT
-#define        SIOC_IN         IOC_IN
-#define        SIOC_INOUT      IOC_INOUT
-#define __SIOC_SIZE    _IOC_SIZE
-#define __SIOC_DIR     _IOC_DIR
-#define __SIOC_NONE    _IOC_NONE
-#define __SIOC_READ    _IOC_READ
-#define __SIOC_WRITE   _IOC_WRITE
-#define        __SIO           _IO
-#define        __SIOR          _IOR
-#define        __SIOW          _IOW
-#define        __SIOWR         _IOWR
-
-
-#elif defined(__minix)
-
-#define        SIOCPARM_MASK   _IOCPARM_MASK
-#define        SIOC_VOID       _IOC_VOID
-#define        SIOC_OUT        _IOC_OUT
-#define        SIOC_IN         _IOC_IN
-#define        SIOC_INOUT      _IOC_INOUT
-#define __SIOC_SIZE    _MINIX_IOCTL_SIZE
-#define __SIOC_DIR(x)  (x & 0xf0000000)
-#define __SIOC_NONE    _IOC_VOID
-#define __SIOC_READ            _IOC_READ
-#define __SIOC_WRITE   _IOC_WRITE
-#define        __SIO           _IO
-#define        __SIOR          _IOR
-#define        __SIOW          _IOW
-#define        __SIOWR         _IORW
-
-
-#else
-
-/* #define     SIOCTYPE                (0xff<<8) */
-#define        SIOCPARM_MASK   0x1fff  /* parameters must be < 8192 bytes */
-#define        SIOC_VOID       0x00000000      /* no parameters */
-#define        SIOC_OUT        0x20000000      /* copy out parameters */
-#define        SIOC_IN         0x40000000      /* copy in parameters */
-#define        SIOC_INOUT      (SIOC_IN|SIOC_OUT)
-
-#define        __SIO(x,y)      ((int)(SIOC_VOID|(x<<8)|y))
-#define        __SIOR(x,y,t)   ((int)(SIOC_OUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
-#define        __SIOW(x,y,t)   ((int)(SIOC_IN|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
-#define        __SIOWR(x,y,t)  ((int)(SIOC_INOUT|((sizeof(t)&SIOCPARM_MASK)<<16)|(x<<8)|y))
-#define __SIOC_SIZE(x) ((x>>16)&SIOCPARM_MASK)
-#define __SIOC_DIR(x)  (x & 0xf0000000)
-#define __SIOC_NONE    SIOC_VOID
-#define __SIOC_READ    SIOC_OUT
-#define __SIOC_WRITE   SIOC_IN
-#  endif /* _IOWR */
-#endif /* !__SIOWR */
-
-#define OSS_LONGNAME_SIZE      64
-#define OSS_LABEL_SIZE         16
-#define OSS_DEVNODE_SIZE       32
-#define OSS_DEVNAME_SIZE       64
-#define OSS_CMD_SIZE           64
-#define OSS_ID_SIZE            16
-#define OSS_HANDLE_SIZE                32
-typedef char oss_longname_t[OSS_LONGNAME_SIZE];
-typedef char oss_label_t[OSS_LABEL_SIZE];
-typedef char oss_devnode_t[OSS_DEVNODE_SIZE];
-typedef char oss_devname_t[OSS_DEVNAME_SIZE];
-typedef char oss_cmd_t[OSS_CMD_SIZE];
-typedef char oss_id_t[OSS_ID_SIZE];
-typedef char oss_handle_t[OSS_HANDLE_SIZE];
-
-#ifndef DISABLE_SEQUENCER
-/*
- ****************************************************************************
- * IOCTL Commands for /dev/sequencer and /dev/music (AKA /dev/sequencer2)
- *
- * Note that this interface is obsolete and no longer developed. New
- * applications should use /dev/midi instead.
- ****************************************************************************/
-#define SNDCTL_SEQ_RESET               __SIO  ('Q', 0)
-#define SNDCTL_SEQ_SYNC                        __SIO  ('Q', 1)
-#define SNDCTL_SYNTH_INFO              __SIOWR('Q', 2, struct synth_info)
-#define SNDCTL_SEQ_CTRLRATE            __SIOWR('Q', 3, int)    /* Set/get timer resolution (HZ) */
-#define SNDCTL_SEQ_GETOUTCOUNT         __SIOR ('Q', 4, int)
-#define SNDCTL_SEQ_GETINCOUNT          __SIOR ('Q', 5, int)
-#define SNDCTL_SEQ_PERCMODE            __SIOW ('Q', 6, int)
-#define SNDCTL_FM_LOAD_INSTR           __SIOW ('Q', 7, struct sbi_instrument)  /* Obsolete. Don't use!!!!!! */
-#define SNDCTL_SEQ_TESTMIDI            __SIOW ('Q', 8, int)
-#define SNDCTL_SEQ_RESETSAMPLES                __SIOW ('Q', 9, int)
-#define SNDCTL_SEQ_NRSYNTHS            __SIOR ('Q',10, int)
-#define SNDCTL_SEQ_NRMIDIS             __SIOR ('Q',11, int)
-#define SNDCTL_MIDI_INFO               __SIOWR('Q',12, struct midi_info)       /* OBSOLETE - use SNDCTL_MIDIINFO instead */
-#define SNDCTL_SEQ_THRESHOLD           __SIOW ('Q',13, int)
-#define SNDCTL_SYNTH_MEMAVL            __SIOWR('Q',14, int)    /* in=dev#, out=memsize */
-#define SNDCTL_FM_4OP_ENABLE           __SIOW ('Q',15, int)    /* in=dev# */
-#define SNDCTL_SEQ_PANIC               __SIO  ('Q',17)
-#define SNDCTL_SEQ_OUTOFBAND           __SIOW ('Q',18, struct seq_event_rec)
-#define SNDCTL_SEQ_GETTIME             __SIOR ('Q',19, int)
-#define SNDCTL_SYNTH_ID                        __SIOWR('Q',20, struct synth_info)
-#define SNDCTL_SYNTH_CONTROL           __SIOWR('Q',21, struct synth_control)
-#define SNDCTL_SYNTH_REMOVESAMPLE      __SIOWR('Q',22, struct remove_sample)   /* Reserved for future use */
-#define SNDCTL_SEQ_TIMING_ENABLE       __SIO  ('Q', 23)        /* Enable incoming MIDI timing messages */
-#define SNDCTL_SEQ_ACTSENSE_ENABLE     __SIO  ('Q', 24)        /* Enable incoming active sensing messages */
-#define SNDCTL_SEQ_RT_ENABLE           __SIO  ('Q', 25)        /* Enable other incoming realtime messages */
-
-typedef struct synth_control
-{
-  int devno;                   /* Synthesizer # */
-  char data[4000];             /* Device spesific command/data record */
-} synth_control;
-
-typedef struct remove_sample
-{
-  int devno;                   /* Synthesizer # */
-  int bankno;                  /* MIDI bank # (0=General MIDI) */
-  int instrno;                 /* MIDI instrument number */
-} remove_sample;
-
-typedef struct seq_event_rec
-{
-  unsigned char arr[8];
-} seq_event_rec;
-
-#define SNDCTL_TMR_TIMEBASE            __SIOWR('T', 1, int)
-#define SNDCTL_TMR_START               __SIO  ('T', 2)
-#define SNDCTL_TMR_STOP                        __SIO  ('T', 3)
-#define SNDCTL_TMR_CONTINUE            __SIO  ('T', 4)
-#define SNDCTL_TMR_TEMPO               __SIOWR('T', 5, int)
-#define SNDCTL_TMR_SOURCE              __SIOWR('T', 6, int)
-#      define TMR_INTERNAL             0x00000001
-#      define TMR_EXTERNAL             0x00000002
-#              define TMR_MODE_MIDI    0x00000010
-#              define TMR_MODE_FSK     0x00000020
-#              define TMR_MODE_CLS     0x00000040
-#              define TMR_MODE_SMPTE   0x00000080
-#define SNDCTL_TMR_METRONOME           __SIOW ('T', 7, int)
-#define SNDCTL_TMR_SELECT              __SIOW ('T', 8, int)
-
-/*
- * Sample loading mechanism for internal synthesizers (/dev/sequencer)
- * (for the .PAT format).
- */
-
-struct patch_info
-{
-  unsigned short key;          /* Use WAVE_PATCH here */
-#define WAVE_PATCH     _PATCHKEY(0x04)
-#define GUS_PATCH      WAVE_PATCH
-#define WAVEFRONT_PATCH _PATCHKEY(0x06)
-
-  short device_no;             /* Synthesizer number */
-  short instr_no;              /* Midi pgm# */
-
-  unsigned int mode;
-/*
- * The least significant byte has the same format than the GUS .PAT
- * files
- */
-#define WAVE_16_BITS   0x01    /* bit 0 = 8 or 16 bit wave data. */
-#define WAVE_UNSIGNED  0x02    /* bit 1 = Signed - Unsigned data. */
-#define WAVE_LOOPING   0x04    /* bit 2 = looping enabled-1. */
-#define WAVE_BIDIR_LOOP        0x08    /* bit 3 = Set is bidirectional looping. */
-#define WAVE_LOOP_BACK 0x10    /* bit 4 = Set is looping backward. */
-#define WAVE_SUSTAIN_ON        0x20    /* bit 5 = Turn sustaining on. (Env. pts. 3) */
-#define WAVE_ENVELOPES 0x40    /* bit 6 = Enable envelopes - 1 */
-#define WAVE_FAST_RELEASE 0x80 /* bit 7 = Shut off immediately after note off */
-  /*  (use the env_rate/env_offs fields). */
-/* Linux specific bits */
-#define WAVE_VIBRATO   0x00010000      /* The vibrato info is valid */
-#define WAVE_TREMOLO   0x00020000      /* The tremolo info is valid */
-#define WAVE_SCALE     0x00040000      /* The scaling info is valid */
-#define WAVE_FRACTIONS 0x00080000      /* Fraction information is valid */
-/* Reserved bits */
-#define WAVE_ROM       0x40000000      /* For future use */
-#define WAVE_MULAW     0x20000000      /* For future use */
-/* Other bits must be zeroed */
-
-  int len;                     /* Size of the wave data in bytes */
-  int loop_start, loop_end;    /* Byte offsets from the beginning */
-
-/* 
- * The base_freq and base_note fields are used when computing the
- * playback speed for a note. The base_note defines the tone frequency
- * which is heard if the sample is played using the base_freq as the
- * playback speed.
- *
- * The low_note and high_note fields define the minimum and maximum note
- * frequencies for which this sample is valid. It is possible to define
- * more than one samples for an instrument number at the same time. The
- * low_note and high_note fields are used to select the most suitable one.
- *
- * The fields base_note, high_note and low_note should contain
- * the note frequency multiplied by 1000. For example value for the
- * middle A is 440*1000.
- */
-
-  unsigned int base_freq;
-  unsigned int base_note;
-  unsigned int high_note;
-  unsigned int low_note;
-  int panning;                 /* -128=left, 127=right */
-  int detuning;
-
-  /* Envelope. Enabled by mode bit WAVE_ENVELOPES  */
-  unsigned char env_rate[6];   /* GUS HW ramping rate */
-  unsigned char env_offset[6]; /* 255 == 100% */
-
-  /* 
-   * The tremolo, vibrato and scale info are not supported yet.
-   * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or
-   * WAVE_SCALE
-   */
-
-  unsigned char tremolo_sweep;
-  unsigned char tremolo_rate;
-  unsigned char tremolo_depth;
-
-  unsigned char vibrato_sweep;
-  unsigned char vibrato_rate;
-  unsigned char vibrato_depth;
-
-  int scale_frequency;
-  unsigned int scale_factor;   /* from 0 to 2048 or 0 to 2 */
-
-  int volume;
-  int fractions;
-  int reserved1;
-  int spare[2];
-  char data[1];                        /* The waveform data starts here */
-};
-
-struct sysex_info
-{
-  short key;                   /* Use SYSEX_PATCH or MAUI_PATCH here */
-#define SYSEX_PATCH    _PATCHKEY(0x05)
-#define MAUI_PATCH     _PATCHKEY(0x06)
-  short device_no;             /* Synthesizer number */
-  int len;                     /* Size of the sysex data in bytes */
-  unsigned char data[1];       /* Sysex data starts here */
-};
-
-/*
- * /dev/sequencer input events.
- *
- * The data written to the /dev/sequencer is a stream of events. Events
- * are records of 4 or 8 bytes. The first byte defines the size. 
- * Any number of events can be written with a write call. There
- * is a set of macros for sending these events. Use these macros if you
- * want to maximize portability of your program.
- *
- * Events SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO. Are also input events.
- * (All input events are currently 4 bytes long. Be prepared to support
- * 8 byte events also. If you receive any event having first byte >= 128,
- * it's a 8 byte event.
- *
- * The events are documented at the end of this file.
- *
- * Normal events (4 bytes)
- * There is also a 8 byte version of most of the 4 byte events. The
- * 8 byte one is recommended.
- *
- * NOTE! All 4 byte events are now obsolete. Applications should not write
- *       them. However 4 byte events are still used as inputs from
- *       /dev/sequencer (/dev/music uses only 8 byte ones).
- */
-#define SEQ_NOTEOFF            0
-#define SEQ_FMNOTEOFF          SEQ_NOTEOFF     /* Just old name */
-#define SEQ_NOTEON             1
-#define        SEQ_FMNOTEON            SEQ_NOTEON
-#define SEQ_WAIT               TMR_WAIT_ABS
-#define SEQ_PGMCHANGE          3
-#define SEQ_FMPGMCHANGE                SEQ_PGMCHANGE
-#define SEQ_SYNCTIMER          TMR_START
-#define SEQ_MIDIPUTC           5
-#define SEQ_DRUMON             6               /*** OBSOLETE ***/
-#define SEQ_DRUMOFF            7               /*** OBSOLETE ***/
-#define SEQ_ECHO               TMR_ECHO        /* For synching programs with output */
-#define SEQ_AFTERTOUCH         9
-#define SEQ_CONTROLLER         10
-#define SEQ_BALANCE            11
-#define SEQ_VOLMODE             12
-
-/************************************
- *     Midi controller numbers     *
- ************************************/
-/*
- * Controllers 0 to 31 (0x00 to 0x1f) and
- * 32 to 63 (0x20 to 0x3f) are continuous
- * controllers.
- * In the MIDI 1.0 these controllers are sent using
- * two messages. Controller numbers 0 to 31 are used
- * to send the MSB and the controller numbers 32 to 63
- * are for the LSB. Note that just 7 bits are used in MIDI bytes.
- */
-
-#define           CTL_BANK_SELECT              0x00
-#define           CTL_MODWHEEL                 0x01
-#define    CTL_BREATH                  0x02
-/*             undefined               0x03 */
-#define    CTL_FOOT                    0x04
-#define    CTL_PORTAMENTO_TIME         0x05
-#define    CTL_DATA_ENTRY              0x06
-#define    CTL_MAIN_VOLUME             0x07
-#define    CTL_BALANCE                 0x08
-/*             undefined               0x09 */
-#define    CTL_PAN                     0x0a
-#define    CTL_EXPRESSION              0x0b
-/*             undefined               0x0c */
-/*             undefined               0x0d */
-/*             undefined               0x0e */
-/*             undefined               0x0f */
-#define    CTL_GENERAL_PURPOSE1                0x10
-#define    CTL_GENERAL_PURPOSE2                0x11
-#define    CTL_GENERAL_PURPOSE3                0x12
-#define    CTL_GENERAL_PURPOSE4                0x13
-/*             undefined               0x14 - 0x1f */
-
-/*             undefined               0x20 */
-/* The controller numbers 0x21 to 0x3f are reserved for the */
-/* least significant bytes of the controllers 0x00 to 0x1f. */
-/* These controllers are not recognised by the driver. */
-
-/* Controllers 64 to 69 (0x40 to 0x45) are on/off switches. */
-/* 0=OFF and 127=ON (intermediate values are possible) */
-#define    CTL_DAMPER_PEDAL            0x40
-#define    CTL_SUSTAIN                 0x40    /* Alias */
-#define    CTL_HOLD                    0x40    /* Alias */
-#define    CTL_PORTAMENTO              0x41
-#define    CTL_SOSTENUTO               0x42
-#define    CTL_SOFT_PEDAL              0x43
-/*             undefined               0x44 */
-#define    CTL_HOLD2                   0x45
-/*             undefined               0x46 - 0x4f */
-
-#define    CTL_GENERAL_PURPOSE5                0x50
-#define    CTL_GENERAL_PURPOSE6                0x51
-#define    CTL_GENERAL_PURPOSE7                0x52
-#define    CTL_GENERAL_PURPOSE8                0x53
-/*             undefined               0x54 - 0x5a */
-#define    CTL_EXT_EFF_DEPTH           0x5b
-#define    CTL_TREMOLO_DEPTH           0x5c
-#define    CTL_CHORUS_DEPTH            0x5d
-#define    CTL_DETUNE_DEPTH            0x5e
-#define    CTL_CELESTE_DEPTH           0x5e    /* Alias for the above one */
-#define    CTL_PHASER_DEPTH            0x5f
-#define    CTL_DATA_INCREMENT          0x60
-#define    CTL_DATA_DECREMENT          0x61
-#define    CTL_NONREG_PARM_NUM_LSB     0x62
-#define    CTL_NONREG_PARM_NUM_MSB     0x63
-#define    CTL_REGIST_PARM_NUM_LSB     0x64
-#define    CTL_REGIST_PARM_NUM_MSB     0x65
-/*             undefined               0x66 - 0x78 */
-/*             reserved                0x79 - 0x7f */
-
-/* Pseudo controllers (not midi compatible) */
-#define    CTRL_PITCH_BENDER           255
-#define    CTRL_PITCH_BENDER_RANGE     254
-#define    CTRL_EXPRESSION             253     /* Obsolete */
-#define    CTRL_MAIN_VOLUME            252     /* Obsolete */
-
-/*
- * Volume mode defines how volumes are used
- */
-
-#define VOL_METHOD_ADAGIO      1
-#define VOL_METHOD_LINEAR      2
-
-/*
- * Note! SEQ_WAIT, SEQ_MIDIPUTC and SEQ_ECHO are used also as
- *      input events.
- */
-
-/*
- * Event codes 0xf0 to 0xfc are reserved for future extensions.
- */
-
-#define SEQ_FULLSIZE           0xfd    /* Long events */
-/*
- * SEQ_FULLSIZE events are used for loading patches/samples to the
- * synthesizer devices. These events are passed directly to the driver
- * of the associated synthesizer device. There is no limit to the size
- * of the extended events. These events are not queued but executed
- * immediately when the write() is called (execution can take several
- * seconds of time). 
- *
- * When a SEQ_FULLSIZE message is written to the device, it must
- * be written using exactly one write() call. Other events cannot
- * be mixed to the same write.
- *     
- * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the 
- * /dev/sequencer. Don't write other data together with the instrument structure
- * Set the key field of the structure to FM_PATCH. The device field is used to
- * route the patch to the corresponding device.
- *
- * For wave table use struct patch_info. Initialize the key field
- * to WAVE_PATCH.
- */
-#define SEQ_PRIVATE            0xfe    /* Low level HW dependent events (8 bytes) */
-#define SEQ_EXTENDED           0xff    /* Extended events (8 bytes) OBSOLETE */
-
-/*
- * Record for FM patches
- */
-
-typedef unsigned char sbi_instr_data[32];
-
-struct sbi_instrument
-{
-  unsigned short key;          /* FM_PATCH or OPL3_PATCH */
-#define FM_PATCH       _PATCHKEY(0x01)
-#define OPL3_PATCH     _PATCHKEY(0x03)
-  short device;                        /*  Synth# (0-4)    */
-  int channel;                 /*  Program# to be initialized  */
-  sbi_instr_data operators;    /*  Register settings for operator cells (.SBI format)  */
-};
-
-struct synth_info
-{                              /* Read only */
-  char name[30];
-  int device;                  /* 0-N. INITIALIZE BEFORE CALLING */
-  int synth_type;
-#define SYNTH_TYPE_FM                  0
-#define SYNTH_TYPE_SAMPLE              1
-#define SYNTH_TYPE_MIDI                        2       /* Midi interface */
-
-  int synth_subtype;
-#define FM_TYPE_ADLIB                  0x00
-#define FM_TYPE_OPL3                   0x01
-#define MIDI_TYPE_MPU401               0x401
-
-#define SAMPLE_TYPE_BASIC              0x10
-#define SAMPLE_TYPE_GUS                        SAMPLE_TYPE_BASIC
-#define SAMPLE_TYPE_WAVEFRONT          0x11
-
-  int perc_mode;               /* No longer supported */
-  int nr_voices;
-  int nr_drums;                        /* Obsolete field */
-  int instr_bank_size;
-  unsigned int capabilities;
-#define SYNTH_CAP_PERCMODE     0x00000001      /* No longer used */
-#define SYNTH_CAP_OPL3         0x00000002      /* Set if OPL3 supported */
-#define SYNTH_CAP_INPUT                0x00000004      /* Input (MIDI) device */
-  int dummies[19];             /* Reserve space */
-};
-
-struct sound_timer_info
-{
-  char name[32];
-  int caps;
-};
-
-struct midi_info               /* OBSOLETE */
-{
-  char name[30];
-  int device;                  /* 0-N. INITIALIZE BEFORE CALLING */
-  unsigned int capabilities;   /* To be defined later */
-  int dev_type;
-  int dummies[18];             /* Reserve space */
-};
-
-/*
- * Level 2 event types for /dev/sequencer
- */
-
-/*
- * The 4 most significant bits of byte 0 specify the class of
- * the event: 
- *
- *     0x8X = system level events,
- *     0x9X = device/port specific events, event[1] = device/port,
- *             The last 4 bits give the subtype:
- *                     0x02    = Channel event (event[3] = chn).
- *                     0x01    = note event (event[4] = note).
- *                     (0x01 is not used alone but always with bit 0x02).
- *            event[2] = MIDI message code (0x80=note off etc.)
- *
- */
-
-#define EV_SEQ_LOCAL           0x80
-#define EV_TIMING              0x81
-#define EV_CHN_COMMON          0x92
-#define EV_CHN_VOICE           0x93
-#define EV_SYSEX               0x94
-#define EV_SYSTEM              0x95    /* MIDI system and real time messages (input only) */
-/*
- * Event types 200 to 220 are reserved for application use.
- * These numbers will not be used by the driver.
- */
-
-/*
- * Events for event type EV_CHN_VOICE
- */
-
-#define MIDI_NOTEOFF           0x80
-#define MIDI_NOTEON            0x90
-#define MIDI_KEY_PRESSURE      0xA0
-
-/*
- * Events for event type EV_CHN_COMMON
- */
-
-#define MIDI_CTL_CHANGE                0xB0
-#define MIDI_PGM_CHANGE                0xC0
-#define MIDI_CHN_PRESSURE      0xD0
-#define MIDI_PITCH_BEND                0xE0
-
-#define MIDI_SYSTEM_PREFIX     0xF0
-
-/*
- * Timer event types
- */
-#define TMR_WAIT_REL           1       /* Time relative to the prev time */
-#define TMR_WAIT_ABS           2       /* Absolute time since TMR_START */
-#define TMR_STOP               3
-#define TMR_START              4
-#define TMR_CONTINUE           5
-#define TMR_TEMPO              6
-#define TMR_ECHO               8
-#define TMR_CLOCK              9       /* MIDI clock */
-#define TMR_SPP                        10      /* Song position pointer */
-#define TMR_TIMESIG            11      /* Time signature */
-
-/*
- *     Local event types
- */
-#define LOCL_STARTAUDIO                1
-#define LOCL_STARTAUDIO2       2
-#define LOCL_STARTAUDIO3       3
-#define LOCL_STARTAUDIO4       4
-
-#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS)
-/*
- * Some convenience macros to simplify programming of the
- * /dev/sequencer interface
- *
- * These macros define the API which should be used when possible.
- */
-#define SEQ_DECLAREBUF()               SEQ_USE_EXTBUF()
-
-void seqbuf_dump (void);       /* This function must be provided by programs */
-
-EXTERNC int OSS_init (int seqfd, int buflen);
-EXTERNC void OSS_seqbuf_dump (int fd, unsigned char *buf, int buflen);
-EXTERNC void OSS_seq_advbuf (int len, int fd, unsigned char *buf, int buflen);
-EXTERNC void OSS_seq_needbuf (int len, int fd, unsigned char *buf,
-                             int buflen);
-EXTERNC void OSS_patch_caching (int dev, int chn, int patch, int fd,
-                               unsigned char *buf, int buflen);
-EXTERNC void OSS_drum_caching (int dev, int chn, int patch, int fd,
-                              unsigned char *buf, int buflen);
-EXTERNC void OSS_write_patch (int fd, unsigned char *buf, int len);
-EXTERNC int OSS_write_patch2 (int fd, unsigned char *buf, int len);
-
-#define SEQ_PM_DEFINES int __foo_bar___
-#ifdef OSSLIB
-#  define SEQ_USE_EXTBUF() \
-               EXTERNC unsigned char *_seqbuf; \
-               EXTERNC int _seqbuflen;EXTERNC int _seqbufptr
-#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
-#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
-
-#  define SEQ_LOAD_GMINSTR(dev, instr) \
-               OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_LOAD_GMDRUM(dev, drum) \
-               OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
-#else /* !OSSLIB */
-
-#  define SEQ_LOAD_GMINSTR(dev, instr)
-#  define SEQ_LOAD_GMDRUM(dev, drum)
-
-#  define SEQ_USE_EXTBUF() \
-               EXTERNC unsigned char _seqbuf[]; \
-               EXTERNC int _seqbuflen;EXTERNC int _seqbufptr
-
-#ifndef USE_SIMPLE_MACROS
-/* Sample seqbuf_dump() implementation:
- *
- *     SEQ_DEFINEBUF (2048);   -- Defines a buffer for 2048 bytes
- *
- *     int seqfd;              -- The file descriptor for /dev/sequencer.
- *
- *     void
- *     seqbuf_dump ()
- *     {
- *       if (_seqbufptr)
- *         if (write (seqfd, _seqbuf, _seqbufptr) == -1)
- *           {
- *             perror ("write /dev/sequencer");
- *             exit (-1);
- *           }
- *       _seqbufptr = 0;
- *     }
- */
-
-#define SEQ_DEFINEBUF(len) \
-       unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0
-#define _SEQ_NEEDBUF(len) \
-       if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump()
-#define _SEQ_ADVBUF(len) _seqbufptr += len
-#define SEQ_DUMPBUF seqbuf_dump
-#else
-/*
- * This variation of the sequencer macros is used just to format one event
- * using fixed buffer.
- * 
- * The program using the macro library must define the following macros before
- * using this library.
- *
- * #define _seqbuf              name of the buffer (unsigned char[]) 
- * #define _SEQ_ADVBUF(len)     If the applic needs to know the exact
- *                              size of the event, this macro can be used.
- *                              Otherwise this must be defined as empty.
- * #define _seqbufptr           Define the name of index variable or 0 if
- *                              not required. 
- */
-#define _SEQ_NEEDBUF(len)      /* empty */
-#endif
-#endif /* !OSSLIB */
-
-#define SEQ_VOLUME_MODE(dev, mode) \
-                               {_SEQ_NEEDBUF(8);\
-                               _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
-                               _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\
-                               _seqbuf[_seqbufptr+2] = (dev);\
-                               _seqbuf[_seqbufptr+3] = (mode);\
-                               _seqbuf[_seqbufptr+4] = 0;\
-                               _seqbuf[_seqbufptr+5] = 0;\
-                               _seqbuf[_seqbufptr+6] = 0;\
-                               _seqbuf[_seqbufptr+7] = 0;\
-                               _SEQ_ADVBUF(8);}
-
-/*
- * Midi voice messages
- */
-
-#define _CHN_VOICE(dev, event, chn, note, parm) \
-                               {_SEQ_NEEDBUF(8);\
-                               _seqbuf[_seqbufptr] = EV_CHN_VOICE;\
-                               _seqbuf[_seqbufptr+1] = (dev);\
-                               _seqbuf[_seqbufptr+2] = (event);\
-                               _seqbuf[_seqbufptr+3] = (chn);\
-                               _seqbuf[_seqbufptr+4] = (note);\
-                               _seqbuf[_seqbufptr+5] = (parm);\
-                               _seqbuf[_seqbufptr+6] = (0);\
-                               _seqbuf[_seqbufptr+7] = 0;\
-                               _SEQ_ADVBUF(8);}
-
-#define SEQ_START_NOTE(dev, chn, note, vol) \
-                       _CHN_VOICE(dev, MIDI_NOTEON, chn, note, vol)
-
-#define SEQ_STOP_NOTE(dev, chn, note, vol) \
-                       _CHN_VOICE(dev, MIDI_NOTEOFF, chn, note, vol)
-
-#define SEQ_KEY_PRESSURE(dev, chn, note, pressure) \
-                       _CHN_VOICE(dev, MIDI_KEY_PRESSURE, chn, note, pressure)
-
-/*
- * Midi channel messages
- */
-
-#define _CHN_COMMON(dev, event, chn, p1, p2, w14) \
-                               {_SEQ_NEEDBUF(8);\
-                               _seqbuf[_seqbufptr] = EV_CHN_COMMON;\
-                               _seqbuf[_seqbufptr+1] = (dev);\
-                               _seqbuf[_seqbufptr+2] = (event);\
-                               _seqbuf[_seqbufptr+3] = (chn);\
-                               _seqbuf[_seqbufptr+4] = (p1);\
-                               _seqbuf[_seqbufptr+5] = (p2);\
-                               *(short *)&_seqbuf[_seqbufptr+6] = (w14);\
-                               _SEQ_ADVBUF(8);}
-/*
- * SEQ_SYSEX permits sending of sysex messages. (It may look that it permits
- * sending any MIDI bytes but it's absolutely not possible. Trying to do
- * so _will_ cause problems with MPU401 intelligent mode).
- *
- * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be 
- * sent by calling SEQ_SYSEX() several times (there must be no other events
- * between them). First sysex fragment must have 0xf0 in the first byte
- * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte
- * between these sysex start and end markers cannot be larger than 0x7f. Also
- * lengths of each fragments (except the last one) must be 6.
- *
- * Breaking the above rules may work with some MIDI ports but is likely to
- * cause fatal problems with some other devices (such as MPU401).
- */
-#define SEQ_SYSEX(dev, buf, len) \
-                               {int ii, ll=(len); \
-                                unsigned char *bufp=buf;\
-                                if (ll>6)ll=6;\
-                               _SEQ_NEEDBUF(8);\
-                               _seqbuf[_seqbufptr] = EV_SYSEX;\
-                               _seqbuf[_seqbufptr+1] = (dev);\
-                               for(ii=0;ii<ll;ii++)\
-                                  _seqbuf[_seqbufptr+ii+2] = bufp[ii];\
-                               for(ii=ll;ii<6;ii++)\
-                                  _seqbuf[_seqbufptr+ii+2] = 0xff;\
-                               _SEQ_ADVBUF(8);}
-
-#define SEQ_CHN_PRESSURE(dev, chn, pressure) \
-               _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
-
-#define SEQ_SET_PATCH SEQ_PGM_CHANGE
-#ifdef OSSLIB
-#   define SEQ_PGM_CHANGE(dev, chn, patch) \
-               {OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
-                _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
-#else
-#   define SEQ_PGM_CHANGE(dev, chn, patch) \
-               _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
-#endif
-
-#define SEQ_CONTROL(dev, chn, controller, value) \
-               _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
-
-#define SEQ_BENDER(dev, chn, value) \
-               _CHN_COMMON(dev, MIDI_PITCH_BEND, chn, 0, 0, value)
-
-#define SEQ_V2_X_CONTROL(dev, voice, controller, value)        \
-                               {_SEQ_NEEDBUF(8);\
-                               _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
-                               _seqbuf[_seqbufptr+1] = SEQ_CONTROLLER;\
-                               _seqbuf[_seqbufptr+2] = (dev);\
-                               _seqbuf[_seqbufptr+3] = (voice);\
-                               _seqbuf[_seqbufptr+4] = (controller);\
-                               _seqbuf[_seqbufptr+5] = ((value)&0xff);\
-                               _seqbuf[_seqbufptr+6] = ((value>>8)&0xff);\
-                               _seqbuf[_seqbufptr+7] = 0;\
-                               _SEQ_ADVBUF(8);}
-/*
- * The following 5 macros are incorrectly implemented and obsolete.
- * Use SEQ_BENDER and SEQ_CONTROL (with proper controller) instead.
- */
-#define SEQ_PITCHBEND(dev, voice, value) \
-       SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER, value)
-#define SEQ_BENDER_RANGE(dev, voice, value) \
-       SEQ_V2_X_CONTROL(dev, voice, CTRL_PITCH_BENDER_RANGE, value)
-#define SEQ_EXPRESSION(dev, voice, value) \
-       SEQ_CONTROL(dev, voice, CTL_EXPRESSION, value*128)
-#define SEQ_MAIN_VOLUME(dev, voice, value) \
-       SEQ_CONTROL(dev, voice, CTL_MAIN_VOLUME, (value*16383)/100)
-#define SEQ_PANNING(dev, voice, pos) \
-       SEQ_CONTROL(dev, voice, CTL_PAN, (pos+128) / 2)
-
-/*
- * Timing and syncronization macros
- */
-
-#define _TIMER_EVENT(ev, parm) {_SEQ_NEEDBUF(8);\
-                               _seqbuf[_seqbufptr+0] = EV_TIMING; \
-                               _seqbuf[_seqbufptr+1] = (ev); \
-                               _seqbuf[_seqbufptr+2] = 0;\
-                               _seqbuf[_seqbufptr+3] = 0;\
-                               *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
-                               _SEQ_ADVBUF(8);}
-
-#define SEQ_START_TIMER()              _TIMER_EVENT(TMR_START, 0)
-#define SEQ_STOP_TIMER()               _TIMER_EVENT(TMR_STOP, 0)
-#define SEQ_CONTINUE_TIMER()           _TIMER_EVENT(TMR_CONTINUE, 0)
-#define SEQ_WAIT_TIME(ticks)           _TIMER_EVENT(TMR_WAIT_ABS, ticks)
-#define SEQ_DELTA_TIME(ticks)          _TIMER_EVENT(TMR_WAIT_REL, ticks)
-#define SEQ_ECHO_BACK(key)             _TIMER_EVENT(TMR_ECHO, key)
-#define SEQ_SET_TEMPO(value)           _TIMER_EVENT(TMR_TEMPO, value)
-#define SEQ_SONGPOS(pos)               _TIMER_EVENT(TMR_SPP, pos)
-#define SEQ_TIME_SIGNATURE(sig)                _TIMER_EVENT(TMR_TIMESIG, sig)
-
-/*
- * Local control events
- */
-
-#define _LOCAL_EVENT(ev, parm)         {_SEQ_NEEDBUF(8);\
-                                       _seqbuf[_seqbufptr+0] = EV_SEQ_LOCAL; \
-                                       _seqbuf[_seqbufptr+1] = (ev); \
-                                       _seqbuf[_seqbufptr+2] = 0;\
-                                       _seqbuf[_seqbufptr+3] = 0;\
-                                       *(unsigned int *)&_seqbuf[_seqbufptr+4] = (parm); \
-                                       _SEQ_ADVBUF(8);}
-
-#define SEQ_PLAYAUDIO(devmask)         _LOCAL_EVENT(LOCL_STARTAUDIO, devmask)
-#define SEQ_PLAYAUDIO2(devmask)                _LOCAL_EVENT(LOCL_STARTAUDIO2, devmask)
-#define SEQ_PLAYAUDIO3(devmask)                _LOCAL_EVENT(LOCL_STARTAUDIO3, devmask)
-#define SEQ_PLAYAUDIO4(devmask)                _LOCAL_EVENT(LOCL_STARTAUDIO4, devmask)
-/*
- * Events for the level 1 interface only 
- */
-
-#define SEQ_MIDIOUT(device, byte)      {_SEQ_NEEDBUF(4);\
-                                       _seqbuf[_seqbufptr] = SEQ_MIDIPUTC;\
-                                       _seqbuf[_seqbufptr+1] = (byte);\
-                                       _seqbuf[_seqbufptr+2] = (device);\
-                                       _seqbuf[_seqbufptr+3] = 0;\
-                                       _SEQ_ADVBUF(4);}
-
-/*
- * Patch loading.
- */
-#ifdef OSSLIB
-#   define SEQ_WRPATCH(patchx, len) \
-               OSS_write_patch(seqfd, (char*)(patchx), len)
-#   define SEQ_WRPATCH2(patchx, len) \
-               OSS_write_patch2(seqfd, (char*)(patchx), len)
-#else
-#   define SEQ_WRPATCH(patchx, len) \
-               {if (_seqbufptr) SEQ_DUMPBUF();\
-                if (write(seqfd, (char*)(patchx), len)==-1) \
-                   perror("Write patch: /dev/sequencer");}
-#   define SEQ_WRPATCH2(patchx, len) \
-               (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
-#endif
-
-#endif
-#endif /* ifndef DISABLE_SEQUENCER */
-
-/*
- ****************************************************************************
- * ioctl commands for the /dev/midi## 
- ****************************************************************************/
-#define SNDCTL_MIDI_PRETIME    __SIOWR('m', 0, int)
-
-#if 0
-/*
- * The SNDCTL_MIDI_MPUMODE and SNDCTL_MIDI_MPUCMD calls
- * are completely obsolete. The hardware device (MPU-401 "intelligent mode"
- * and compatibles) has disappeared from the market 10 years ago so there 
- * is no need for this stuff. The MPU-401 "UART" mode devices don't support
- * this stuff.
- */
-typedef struct
-{
-  unsigned char cmd;
-  char nr_args, nr_returns;
-  unsigned char data[30];
-} mpu_command_rec;
-
-#define SNDCTL_MIDI_MPUMODE    __SIOWR('m', 1, int)
-#define SNDCTL_MIDI_MPUCMD     __SIOWR('m', 2, mpu_command_rec)
-#endif
-
-/*
- * SNDCTL_MIDI_MTCINPUT turns on a mode where OSS automatically inserts
- * MTC quarter frame messages (F1 xx) to the input.
- * The argument is the MTC mode:
- *
- *     -1 = Turn MTC messages OFF (default)
- *     24 = 24 FPS 
- *     25 = 25 FPS 
- *     29 = 30 FPS drop frame
- *     30 = 30 FPS 
- *
- * Note that 25 FPS mode is probably the only mode that is supported. Other
- * modes may be supported in the future versions of OSS, 25 FPS is handy 
- * because it generates 25*4=100 quarter frame messages per second which
- * matches the usual 100 HZ system timer rate).
- *
- * The quarter frame timer will be reset to 0:00:00:00.0 at the moment this
- * ioctl is made.
- */
-#define SNDCTL_MIDI_MTCINPUT   __SIOWR('m', 3, int)
-
-/*
- * MTC/SMPTE time code record (for future use)
- */
-typedef struct
-{
-  unsigned char hours, minutes, seconds, frames, qframes;
-  char direction;
-#define MTC_DIR_STOPPED                 0
-#define MTC_DIR_FORWARD                 1
-#define MTC_DIR_BACKWARD       -1
-  unsigned char time_code_type;
-  unsigned int flags;
-} oss_mtc_data_t;
-
-#define SNDCTL_MIDI_SETMODE    __SIOWR('m', 6, int)
-#      define MIDI_MODE_TRADITIONAL    0
-#      define MIDI_MODE_TIMED          1       /* Input times are in MIDI ticks */
-#      define MIDI_MODE_TIMED_ABS      2       /* Input times are absolute (usecs) */
-
-/*
- * Packet header for MIDI_MODE_TIMED and MIDI_MODE_TIMED_ABS
- */
-#ifdef OSS_NO_LONG_LONG
-  typedef unsigned long oss_midi_time_t;       /* This will not be enough but anyway */
-#else
-  typedef unsigned long long oss_midi_time_t;  /* Variable type for MIDI time (clock ticks) */
-#endif
-
-typedef struct
-{
-  int magic;                   /* Initialize to MIDI_HDR_MAGIC */
-#define MIDI_HDR_MAGIC -1
-  unsigned short event_type;
-#define MIDI_EV_WRITE                  0       /* Write or read (with payload) */
-#define MIDI_EV_TEMPO                  1
-#define MIDI_EV_ECHO                   2
-#define MIDI_EV_START                  3
-#define MIDI_EV_STOP                   4
-#define MIDI_EV_CONTINUE               5
-#define MIDI_EV_XPRESSWRITE            6
-#define MIDI_EV_TIMEBASE               7
-#define MIDI_EV_DEVCTL                 8       /* Device control read/write */
-  unsigned short options;
-#define MIDI_OPT_NONE                  0x0000
-#define MIDI_OPT_TIMED                 0x0001
-#define MIDI_OPT_CONTINUATION          0x0002
-#define MIDI_OPT_USECTIME              0x0004  /* Time is absolute (in usecs) */
-#define MIDI_OPT_BUSY                  0x0008  /* Reserved for internal use */
-  oss_midi_time_t time;
-#ifdef OSS_NO_LONG_LONG
-  /* oss_midi_time_t is just 32 bits instead of 64. Use a padding word to compensate this */
-  int budding;
-#endif
-  int parm;
-  int filler[4];               /* Fur future expansion - init to zeros */
-} midi_packet_header_t;
-/* 
- * MIDI_PAYLOAD_SIZE is the maximum size of one MIDI input chunk. It must be
- * less (or equal) than 1024 which is the read size recommended in the 
- * documentation. TODO: Explain this better.
- */
-#define MIDI_PAYLOAD_SIZE              1000
-
-typedef struct
-{
-  midi_packet_header_t hdr;
-  unsigned char payload[MIDI_PAYLOAD_SIZE];
-} midi_packet_t;
-
-#define SNDCTL_MIDI_TIMEBASE           __SIOWR('m', 7, int)
-#define SNDCTL_MIDI_TEMPO              __SIOWR('m', 8, int)
-/*
- * User land MIDI servers (synths) can use SNDCTL_MIDI_SET_LATENCY
- * to request MIDI events to be sent to them in advance. The parameter
- * (in microseconds) tells how much before the events are submitted.
- *
- * This feature is only valid for loopback devices and possibly some other
- * types of virtual devices.
- */
-#define SNDCTL_MIDI_SET_LATENCY                __SIOW ('m', 9, int)
-/*
- ****************************************************************************
- * IOCTL commands for /dev/dsp
- ****************************************************************************/
-
-#define SNDCTL_DSP_HALT                        __SIO  ('P', 0)
-#define SNDCTL_DSP_RESET               SNDCTL_DSP_HALT /* Old name */
-#define SNDCTL_DSP_SYNC                        __SIO  ('P', 1)
-#define SNDCTL_DSP_SPEED               __SIOWR('P', 2, int)
-
-/* SNDCTL_DSP_STEREO is obsolete - use SNDCTL_DSP_CHANNELS instead */
-#define SNDCTL_DSP_STEREO              __SIOWR('P', 3, int)
-/* SNDCTL_DSP_STEREO is obsolete - use SNDCTL_DSP_CHANNELS instead */
-
-#define SNDCTL_DSP_GETBLKSIZE          __SIOWR('P', 4, int)
-#define SNDCTL_DSP_SAMPLESIZE          SNDCTL_DSP_SETFMT
-#define SNDCTL_DSP_CHANNELS            __SIOWR('P', 6, int)
-#define SNDCTL_DSP_POST                        __SIO  ('P', 8)
-#define SNDCTL_DSP_SUBDIVIDE           __SIOWR('P', 9, int)
-#define SNDCTL_DSP_SETFRAGMENT         __SIOWR('P',10, int)
-
-/* Audio data formats (Note! U8=8 and S16_LE=16 for compatibility) */
-#define SNDCTL_DSP_GETFMTS             __SIOR ('P',11, int)    /* Returns a mask */
-#define SNDCTL_DSP_SETFMT              __SIOWR('P',5, int)     /* Selects ONE fmt */
-#      define AFMT_QUERY       0x00000000      /* Return current fmt */
-#      define AFMT_MU_LAW      0x00000001
-#      define AFMT_A_LAW       0x00000002
-#      define AFMT_IMA_ADPCM   0x00000004
-#      define AFMT_U8          0x00000008
-#      define AFMT_S16_LE      0x00000010      /* Little endian signed 16 */
-#      define AFMT_S16_BE      0x00000020      /* Big endian signed 16 */
-#      define AFMT_S8          0x00000040
-#      define AFMT_U16_LE      0x00000080      /* Little endian U16 */
-#      define AFMT_U16_BE      0x00000100      /* Big endian U16 */
-#      define AFMT_MPEG        0x00000200      /* MPEG (2) audio */
-
-/* AC3 _compressed_ bitstreams (See Programmer's Guide for details). */
-#      define AFMT_AC3         0x00000400
-/* Ogg Vorbis _compressed_ bit streams */
-#      define AFMT_VORBIS      0x00000800
-
-/* 32 bit formats (MSB aligned) formats */
-#      define AFMT_S32_LE      0x00001000
-#      define AFMT_S32_BE      0x00002000
-
-/* Reserved for _native_ endian double precision IEEE floating point */
-#      define AFMT_FLOAT       0x00004000
-
-/* 24 bit formats (LSB aligned in 32 bit word) formats */
-#      define AFMT_S24_LE      0x00008000
-#      define AFMT_S24_BE      0x00010000
-
-/*
- * S/PDIF raw format. In this format the S/PDIF frames (including all
- * control and user bits) are included in the data stream. Each sample
- * is stored in a 32 bit frame (see IEC-958 for more info). This format
- * is supported by very few devices and it's only usable for purposes
- * where full access to the control/user bits is required (real time control).
- */
-#      define AFMT_SPDIF_RAW   0x00020000
-
-/* 24 bit packed (3 byte) little endian format (USB compatibility) */
-#      define AFMT_S24_PACKED  0x00040000
-
-
-/*
- * Some big endian/little endian handling macros (native endian and opposite
- * endian formats). The usage of these macros is described in the OSS
- * Programmer's Manual.
- */
-
-#if defined(_AIX) || defined(AIX) || defined(sparc) || defined(__hppa) || defined(PPC) || defined(__powerpc__) && !defined(i386) && !defined(__i386) && !defined(__i386__)
-
-/* Big endian machines */
-#  define _PATCHKEY(id) (0xfd00|id)
-#  define AFMT_S16_NE AFMT_S16_BE
-#  define AFMT_U16_NE AFMT_U16_BE
-#  define AFMT_S32_NE AFMT_S32_BE
-#  define AFMT_S24_NE AFMT_S24_BE
-#  define AFMT_S16_OE AFMT_S16_LE
-#  define AFMT_S32_OE AFMT_S32_LE
-#  define AFMT_S24_OE AFMT_S24_LE
-#else
-#  define _PATCHKEY(id) ((id<<8)|0xfd)
-#  define AFMT_S16_NE AFMT_S16_LE
-#  define AFMT_U16_NE AFMT_U16_LE
-#  define AFMT_S32_NE AFMT_S32_LE
-#  define AFMT_S24_NE AFMT_S24_LE
-#  define AFMT_S16_OE AFMT_S16_BE
-#  define AFMT_S32_OE AFMT_S32_BE
-#  define AFMT_S24_OE AFMT_S24_BE
-#endif
-/*
- * Buffer status queries.
- */
-typedef struct audio_buf_info
-{
-  int fragments;               /* # of available fragments (partially usend ones not counted) */
-  int fragstotal;              /* Total # of fragments allocated */
-  int fragsize;                        /* Size of a fragment in bytes */
-  int bytes;                   /* Available space in bytes (includes partially used fragments) */
-  /* Note! 'bytes' could be more than fragments*fragsize */
-} audio_buf_info;
-
-#define SNDCTL_DSP_GETOSPACE           __SIOR ('P',12, audio_buf_info)
-#define SNDCTL_DSP_GETISPACE           __SIOR ('P',13, audio_buf_info)
-#define SNDCTL_DSP_GETCAPS             __SIOR ('P',15, int)
-#      define PCM_CAP_REVISION         0x000000ff      /* Bits for revision level (0 to 255) */
-#      define PCM_CAP_DUPLEX           0x00000100      /* Full duplex record/playback */
-#      define PCM_CAP_REALTIME         0x00000200      /* Not in use */
-#      define PCM_CAP_BATCH            0x00000400      /* Device has some kind of */
-                                                       /* internal buffers which may */
-                                                       /* cause some delays and */
-                                                       /* decrease precision of timing */
-#      define PCM_CAP_COPROC           0x00000800      /* Has a coprocessor */
-                                                       /* Sometimes it's a DSP */
-                                                       /* but usually not */
-#      define PCM_CAP_TRIGGER          0x00001000      /* Supports SETTRIGGER */
-#      define PCM_CAP_MMAP             0x00002000      /* Supports mmap() */
-#      define PCM_CAP_MULTI            0x00004000      /* Supports multiple open */
-#      define PCM_CAP_BIND             0x00008000      /* Supports binding to front/rear/center/lfe */
-#      define PCM_CAP_INPUT            0x00010000      /* Supports recording */
-#      define PCM_CAP_OUTPUT           0x00020000      /* Supports playback */
-#      define PCM_CAP_VIRTUAL          0x00040000      /* Virtual device */
-/* 0x00040000 and 0x00080000 reserved for future use */
-
-/* Analog/digital control capabilities */
-#      define PCM_CAP_ANALOGOUT        0x00100000
-#      define PCM_CAP_ANALOGIN         0x00200000
-#      define PCM_CAP_DIGITALOUT       0x00400000
-#      define PCM_CAP_DIGITALIN        0x00800000
-#      define PCM_CAP_ADMASK           0x00f00000
-/*
- * NOTE! (capabilities & PCM_CAP_ADMASK)==0 means just that the
- * digital/analog interface control features are not supported by the 
- * device/driver. However the device still supports analog, digital or
- * both inputs/outputs (depending on the device). See the OSS Programmer's
- * Guide for full details.
- */
-#      define PCM_CAP_SPECIAL          0x01000000      /* Not for ordinary "multimedia" use */
-#      define PCM_CAP_SHADOW           0x00000000      /* OBSOLETE */
-
-/*
- * Preferred channel usage. These bits can be used to
- * give recommendations to the application. Used by few drivers.
- * For example if ((caps & DSP_CH_MASK) == DSP_CH_MONO) means that
- * the device works best in mono mode. However it doesn't necessarily mean
- * that the device cannot be used in stereo. These bits should only be used
- * by special applications such as multi track hard disk recorders to find
- * out the initial setup. However the user should be able to override this
- * selection.
- *
- * To find out which modes are actually supported the application should 
- * try to select them using SNDCTL_DSP_CHANNELS.
- */
-#      define DSP_CH_MASK              0x06000000      /* Mask */
-#      define DSP_CH_ANY               0x00000000      /* No preferred mode */
-#      define DSP_CH_MONO              0x02000000
-#      define DSP_CH_STEREO            0x04000000
-#      define DSP_CH_MULTI             0x06000000      /* More than two channels */
-
-#      define PCM_CAP_HIDDEN           0x08000000      /* Hidden device */
-#      define PCM_CAP_FREERATE         0x10000000
-#      define PCM_CAP_MODEM            0x20000000      /* Modem device */
-#      define PCM_CAP_DEFAULT          0x40000000      /* "Default" device */
-
-/*
- * The PCM_CAP_* capability names were known as DSP_CAP_* prior OSS 4.0
- * so it's necessary to define the older names too.
- */
-#define DSP_CAP_ADMASK         PCM_CAP_ADMASK
-#define DSP_CAP_ANALOGIN       PCM_CAP_ANALOGIN
-#define DSP_CAP_ANALOGOUT      PCM_CAP_ANALOGOUT
-#define DSP_CAP_BATCH          PCM_CAP_BATCH
-#define DSP_CAP_BIND           PCM_CAP_BIND
-#define DSP_CAP_COPROC         PCM_CAP_COPROC
-#define DSP_CAP_DEFAULT                PCM_CAP_DEFAULT
-#define DSP_CAP_DIGITALIN      PCM_CAP_DIGITALIN
-#define DSP_CAP_DIGITALOUT     PCM_CAP_DIGITALOUT
-#define DSP_CAP_DUPLEX         PCM_CAP_DUPLEX
-#define DSP_CAP_FREERATE       PCM_CAP_FREERATE
-#define DSP_CAP_HIDDEN         PCM_CAP_HIDDEN
-#define DSP_CAP_INPUT          PCM_CAP_INPUT
-#define DSP_CAP_MMAP           PCM_CAP_MMAP
-#define DSP_CAP_MODEM          PCM_CAP_MODEM
-#define DSP_CAP_MULTI          PCM_CAP_MULTI
-#define DSP_CAP_OUTPUT         PCM_CAP_OUTPUT
-#define DSP_CAP_REALTIME       PCM_CAP_REALTIME
-#define DSP_CAP_REVISION       PCM_CAP_REVISION
-#define DSP_CAP_SHADOW         PCM_CAP_SHADOW
-#define DSP_CAP_TRIGGER                PCM_CAP_TRIGGER
-#define DSP_CAP_VIRTUAL                PCM_CAP_VIRTUAL
-
-#define SNDCTL_DSP_GETTRIGGER          __SIOR ('P',16, int)
-#define SNDCTL_DSP_SETTRIGGER          __SIOW ('P',16, int)
-#      define PCM_ENABLE_INPUT         0x00000001
-#      define PCM_ENABLE_OUTPUT        0x00000002
-
-typedef struct count_info
-{
-  unsigned int bytes;          /* Total # of bytes processed */
-  int blocks;                  /* # of fragment transitions since last time */
-  int ptr;                     /* Current DMA pointer value */
-} count_info;
-
-#define SNDCTL_DSP_GETIPTR             __SIOR ('P',17, count_info)
-#define SNDCTL_DSP_GETOPTR             __SIOR ('P',18, count_info)
-
-typedef struct buffmem_desc
-{
-  unsigned *buffer;
-  int size;
-} buffmem_desc;
-#define SNDCTL_DSP_SETSYNCRO           __SIO  ('P', 21)
-#define SNDCTL_DSP_SETDUPLEX           __SIO  ('P', 22)
-
-#define SNDCTL_DSP_PROFILE             __SIOW ('P', 23, int)   /* OBSOLETE */
-#define          APF_NORMAL    0       /* Normal applications */
-#define          APF_NETWORK   1       /* Underruns probably caused by an "external" delay */
-#define   APF_CPUINTENS 2      /* Underruns probably caused by "overheating" the CPU */
-
-#define SNDCTL_DSP_GETODELAY           __SIOR ('P', 23, int)
-
-typedef struct audio_errinfo
-{
-  int play_underruns;
-  int rec_overruns;
-  unsigned int play_ptradjust;
-  unsigned int rec_ptradjust;
-  int play_errorcount;
-  int rec_errorcount;
-  int play_lasterror;
-  int rec_lasterror;
-  int play_errorparm;
-  int rec_errorparm;
-  int filler[16];
-} audio_errinfo;
-
-#define SNDCTL_DSP_GETPLAYVOL          __SIOR ('P', 24, int)
-#define SNDCTL_DSP_SETPLAYVOL          __SIOWR('P', 24, int)
-#define SNDCTL_DSP_GETERROR            __SIOR ('P', 25, audio_errinfo)
-/*
- ****************************************************************************
- * Digital interface (S/PDIF) control interface
- */
-
-typedef struct oss_digital_control
-{
-  unsigned int caps;
-#define DIG_CBITIN_NONE                        0x00000000
-#define DIG_CBITIN_LIMITED             0x00000001
-#define DIG_CBITIN_DATA                0x00000002
-#define DIG_CBITIN_BYTE0               0x00000004
-#define DIG_CBITIN_FULL                0x00000008
-#define DIG_CBITIN_MASK                0x0000000f
-#define DIG_CBITOUT_NONE               0x00000000
-#define DIG_CBITOUT_LIMITED            0x00000010
-#define DIG_CBITOUT_BYTE0              0x00000020
-#define DIG_CBITOUT_FULL               0x00000040
-#define DIG_CBITOUT_DATA               0x00000080
-#define DIG_CBITOUT_MASK               0x000000f0
-#define DIG_UBITIN                     0x00000100
-#define DIG_UBITOUT                    0x00000200
-#define DIG_VBITOUT                    0x00000400
-#define DIG_OUTRATE                    0x00000800
-#define DIG_INRATE                     0x00001000
-#define DIG_INBITS                     0x00002000
-#define DIG_OUTBITS                    0x00004000
-#define DIG_EXACT                      0x00010000
-#define DIG_PRO                                0x00020000
-#define DIG_CONSUMER                   0x00040000
-#define DIG_PASSTHROUGH                        0x00080000
-#define DIG_OUTSEL                     0x00100000
-
-  unsigned int valid;
-#define VAL_CBITIN                     0x00000001
-#define VAL_UBITIN                     0x00000002
-#define VAL_CBITOUT                    0x00000004
-#define VAL_UBITOUT                    0x00000008
-#define VAL_ISTATUS                    0x00000010
-#define VAL_IRATE                      0x00000020
-#define VAL_ORATE                      0x00000040
-#define VAL_INBITS                     0x00000080
-#define VAL_OUTBITS                    0x00000100
-#define VAL_REQUEST                    0x00000200
-#define VAL_OUTSEL                     0x00000400
-
-#define VAL_OUTMASK (VAL_CBITOUT|VAL_UBITOUT|VAL_ORATE|VAL_OUTBITS|VAL_OUTSEL)
-
-  unsigned int request, param;
-#define SPD_RQ_PASSTHROUGH                             1
-
-  unsigned char cbitin[24];
-  unsigned char ubitin[24];
-  unsigned char cbitout[24];
-  unsigned char ubitout[24];
-
-  unsigned int outsel;
-#define OUTSEL_DIGITAL         1
-#define OUTSEL_ANALOG          2
-#define OUTSEL_BOTH            (OUTSEL_DIGITAL|OUTSEL_ANALOG)
-
-  int in_data;                 /* Audio/data if autodetectable by the receiver */
-#define IND_UNKNOWN            0
-#define IND_AUDIO              1
-#define IND_DATA               2
-
-  int in_locked;               /* Receiver locked */
-#define LOCK_NOT_INDICATED     0
-#define LOCK_UNLOCKED          1
-#define LOCK_LOCKED            2
-
-  int in_quality;              /* Input signal quality */
-#define IN_QUAL_NOT_INDICATED  0
-#define IN_QUAL_POOR           1
-#define IN_QUAL_GOOD           2
-
-  int in_vbit, out_vbit;       /* V bits */
-#define VBIT_NOT_INDICATED     0
-#define VBIT_OFF               1
-#define VBIT_ON                        2
-
-  unsigned int in_errors;      /* Various input error conditions */
-#define INERR_CRC              0x0001
-#define INERR_QCODE_CRC                0x0002
-#define INERR_PARITY           0x0004
-#define INERR_BIPHASE          0x0008
-
-  int srate_in, srate_out;
-  int bits_in, bits_out;
-
-  int filler[32];
-} oss_digital_control;
-
-#define SNDCTL_DSP_READCTL             __SIOWR('P', 26, oss_digital_control)
-#define SNDCTL_DSP_WRITECTL            __SIOWR('P', 27, oss_digital_control)
-
-/*
- ****************************************************************************
- * Sync groups for audio devices
- */
-typedef struct oss_syncgroup
-{
-  int id;
-  int mode;
-  int filler[16];
-} oss_syncgroup;
-
-#define SNDCTL_DSP_SYNCGROUP           __SIOWR('P', 28, oss_syncgroup)
-#define SNDCTL_DSP_SYNCSTART           __SIOW ('P', 29, int)
-
-/*
- **************************************************************************
- * "cooked" mode enables software based conversions for sample rate, sample
- * format (bits) and number of channels (mono/stereo). These conversions are
- * required with some devices that support only one sample rate or just stereo
- * to let the applications to use other formats. The cooked mode is enabled by
- * default. However it's necessary to disable this mode when mmap() is used or
- * when very deterministic timing is required. SNDCTL_DSP_COOKEDMODE is an
- * optional call introduced in OSS 3.9.6f. It's _error return must be ignored_
- * since normally this call will return erno=EINVAL.
- *
- * SNDCTL_DSP_COOKEDMODE must be called immediately after open before doing
- * anything else. Otherwise the call will not have any effect.
- */
-#define SNDCTL_DSP_COOKEDMODE          __SIOW ('P', 30, int)
-
-/*
- **************************************************************************
- * SNDCTL_DSP_SILENCE and SNDCTL_DSP_SKIP are new calls in OSS 3.99.0
- * that can be used to implement pause/continue during playback (no effect
- * on recording).
- */
-#define SNDCTL_DSP_SILENCE             __SIO  ('P', 31)
-#define SNDCTL_DSP_SKIP                        __SIO  ('P', 32)
-/*
- ****************************************************************************
- * Abort transfer (reset) functions for input and output
- */
-#define SNDCTL_DSP_HALT_INPUT          __SIO  ('P', 33)
-#define SNDCTL_DSP_RESET_INPUT SNDCTL_DSP_HALT_INPUT   /* Old name */
-#define SNDCTL_DSP_HALT_OUTPUT         __SIO  ('P', 34)
-#define SNDCTL_DSP_RESET_OUTPUT        SNDCTL_DSP_HALT_OUTPUT  /* Old name */
-/*
- ****************************************************************************
- * Low water level control
- */
-#define SNDCTL_DSP_LOW_WATER           __SIOW ('P', 34, int)
-
-/*
- ****************************************************************************
- * 64 bit pointer support. Only available in environments that support
- * the 64 bit (long long) integer type.
- */
-#ifndef OSS_NO_LONG_LONG
-typedef struct
-{
-  long long samples;
-  int fifo_samples;
-  int filler[32];              /* For future use */
-} oss_count_t;
-
-#define SNDCTL_DSP_CURRENT_IPTR                __SIOR ('P', 35, oss_count_t)
-#define SNDCTL_DSP_CURRENT_OPTR                __SIOR ('P', 36, oss_count_t)
-#endif
-
-/*
- ****************************************************************************
- * Interface for selecting recording sources and playback output routings.
- */
-#define SNDCTL_DSP_GET_RECSRC_NAMES    __SIOR ('P', 37, oss_mixer_enuminfo)
-#define SNDCTL_DSP_GET_RECSRC          __SIOR ('P', 38, int)
-#define SNDCTL_DSP_SET_RECSRC          __SIOWR('P', 38, int)
-
-#define SNDCTL_DSP_GET_PLAYTGT_NAMES   __SIOR ('P', 39, oss_mixer_enuminfo)
-#define SNDCTL_DSP_GET_PLAYTGT         __SIOR ('P', 40, int)
-#define SNDCTL_DSP_SET_PLAYTGT         __SIOWR('P', 40, int)
-#define SNDCTL_DSP_GETRECVOL           __SIOR ('P', 41, int)
-#define SNDCTL_DSP_SETRECVOL           __SIOWR('P', 41, int)
-
-/*
- ***************************************************************************
- * Some calls for setting the channel assignment with multi channel devices
- * (see the manual for details).
- */
-#ifndef OSS_NO_LONG_LONG
-#define SNDCTL_DSP_GET_CHNORDER                __SIOR ('P', 42, unsigned long long)
-#define SNDCTL_DSP_SET_CHNORDER                __SIOWR('P', 42, unsigned long long)
-#      define CHID_UNDEF       0
-#      define CHID_L           1
-#      define CHID_R           2
-#      define CHID_C           3
-#      define CHID_LFE         4
-#      define CHID_LS          5
-#      define CHID_RS          6
-#      define CHID_LR          7
-#      define CHID_RR          8
-#define CHNORDER_UNDEF         0x0000000000000000ULL
-#define CHNORDER_NORMAL                0x0000000087654321ULL
-#endif
-
-#define MAX_PEAK_CHANNELS      128
-typedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS];
-#define SNDCTL_DSP_GETIPEAKS           __SIOR('P', 43, oss_peaks_t)
-#define SNDCTL_DSP_GETOPEAKS           __SIOR('P', 44, oss_peaks_t)
-
-#define SNDCTL_DSP_POLICY              __SIOW('P', 45, int)    /* See the manual */
-
-/*
- ****************************************************************************
- * Few ioctl calls that are not official parts of OSS. They have been used
- * by few freeware implementations of OSS.
- */
-#define SNDCTL_DSP_GETCHANNELMASK      __SIOWR('P', 64, int)
-#define SNDCTL_DSP_BIND_CHANNEL                __SIOWR('P', 65, int)
-#     define DSP_BIND_QUERY           0x00000000
-#     define DSP_BIND_FRONT           0x00000001
-#     define DSP_BIND_SURR            0x00000002
-#     define DSP_BIND_CENTER_LFE      0x00000004
-#     define DSP_BIND_HANDSET         0x00000008
-#     define DSP_BIND_MIC             0x00000010
-#     define DSP_BIND_MODEM1          0x00000020
-#     define DSP_BIND_MODEM2          0x00000040
-#     define DSP_BIND_I2S             0x00000080
-#     define DSP_BIND_SPDIF           0x00000100
-#     define DSP_BIND_REAR            0x00000200
-
-#ifdef sun
-/* Not part of OSS. Reserved for internal use by Solaris */
-#define X_SADA_GET_PLAYTGT_MASK        __SIOR ('P', 66, int)
-#define X_SADA_GET_PLAYTGT     __SIOR ('P', 67, int)
-#define X_SADA_SET_PLAYTGT     __SIOWR('P', 68, int)
-#endif
-
-#ifndef NO_LEGACY_MIXER
-/*
- ****************************************************************************
- * IOCTL commands for the "legacy " /dev/mixer API (obsolete)
- *
- * Mixer controls
- *
- * There can be up to 20 different analog mixer channels. The
- * SOUND_MIXER_NRDEVICES gives the currently supported maximum. 
- * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells
- * the devices supported by the particular mixer.
- *
- * {!notice This "legacy" mixer API is obsolete. It has been superceded
- * by a new one (see below).
- */
-
-#define SOUND_MIXER_NRDEVICES  28
-#define SOUND_MIXER_VOLUME     0
-#define SOUND_MIXER_BASS       1
-#define SOUND_MIXER_TREBLE     2
-#define SOUND_MIXER_SYNTH      3
-#define SOUND_MIXER_PCM                4
-#define SOUND_MIXER_SPEAKER    5
-#define SOUND_MIXER_LINE       6
-#define SOUND_MIXER_MIC                7
-#define SOUND_MIXER_CD         8
-#define SOUND_MIXER_IMIX       9       /*  Recording monitor  */
-#define SOUND_MIXER_ALTPCM     10
-#define SOUND_MIXER_RECLEV     11      /* Recording level */
-#define SOUND_MIXER_IGAIN      12      /* Input gain */
-#define SOUND_MIXER_OGAIN      13      /* Output gain */
-/* 
- * Some soundcards have three line level inputs (line, aux1 and aux2). 
- * Since each card manufacturer has assigned different meanings to 
- * these inputs, it's impractical to assign specific meanings 
- * (eg line, cd, synth etc.) to them.
- */
-#define SOUND_MIXER_LINE1      14      /* Input source 1  (aux1) */
-#define SOUND_MIXER_LINE2      15      /* Input source 2  (aux2) */
-#define SOUND_MIXER_LINE3      16      /* Input source 3  (aux3) */
-#define SOUND_MIXER_DIGITAL1   17      /* Digital I/O 1 */
-#define SOUND_MIXER_DIGITAL2   18      /* Digital I/O 2 */
-#define SOUND_MIXER_DIGITAL3   19      /* Digital I/O 3 */
-#define SOUND_MIXER_PHONE      20      /* Phone */
-#define SOUND_MIXER_MONO       21      /* Mono Output */
-#define SOUND_MIXER_VIDEO      22      /* Video/TV (audio) in */
-#define SOUND_MIXER_RADIO      23      /* Radio in */
-#define SOUND_MIXER_DEPTH      24      /* Surround depth */
-#define SOUND_MIXER_REARVOL    25      /* Rear/Surround speaker vol */
-#define SOUND_MIXER_CENTERVOL  26      /* Center/LFE speaker vol */
-#define SOUND_MIXER_SIDEVOL    27      /* Side-Surround (8speaker) vol */
-
-/*
- * Warning: SOUND_MIXER_SURRVOL is an old name of SOUND_MIXER_SIDEVOL.
- *          They are both assigned to the same mixer control. Don't
- *          use both control names in the same program/driver.
- */
-#define SOUND_MIXER_SURRVOL    SOUND_MIXER_SIDEVOL
-
-/* Some on/off settings (SOUND_SPECIAL_MIN - SOUND_SPECIAL_MAX) */
-/* Not counted to SOUND_MIXER_NRDEVICES, but use the same number space */
-#define SOUND_ONOFF_MIN                28
-#define SOUND_ONOFF_MAX                30
-
-/* Note!       Number 31 cannot be used since the sign bit is reserved */
-#define SOUND_MIXER_NONE       31
-
-/*
- * The following unsupported macros are no longer functional.
- * Use SOUND_MIXER_PRIVATE# macros in future.
- */
-#define SOUND_MIXER_ENHANCE    SOUND_MIXER_NONE
-#define SOUND_MIXER_MUTE       SOUND_MIXER_NONE
-#define SOUND_MIXER_LOUD       SOUND_MIXER_NONE
-
-#define SOUND_DEVICE_LABELS \
-       {"Vol  ", "Bass ", "Treble", "Synth", "Pcm  ", "Speaker ", "Line ", \
-        "Mic  ", "CD   ", "Mix  ", "Pcm2 ", "Rec  ", "IGain", "OGain", \
-        "Aux1", "Aux2", "Aux3", "Digital1", "Digital2", "Digital3", \
-        "Phone", "Mono", "Video", "Radio", "Depth", \
-        "Rear", "Center", "Side"}
-
-#define SOUND_DEVICE_NAMES \
-       {"vol", "bass", "treble", "synth", "pcm", "speaker", "line", \
-        "mic", "cd", "mix", "pcm2", "rec", "igain", "ogain", \
-        "aux1", "aux2", "aux3", "dig1", "dig2", "dig3", \
-        "phone", "mono", "video", "radio", "depth", \
-        "rear", "center", "side"}
-
-/*     Device bitmask identifiers      */
-
-#define SOUND_MIXER_RECSRC     0xff    /* Arg contains a bit for each recording source */
-#define SOUND_MIXER_DEVMASK    0xfe    /* Arg contains a bit for each supported device */
-#define SOUND_MIXER_RECMASK    0xfd    /* Arg contains a bit for each supported recording source */
-#define SOUND_MIXER_CAPS       0xfc
-#      define SOUND_CAP_EXCL_INPUT     0x00000001      /* Only one recording source at a time */
-#      define SOUND_CAP_NOLEGACY       0x00000004      /* For internal use only */
-#      define SOUND_CAP_NORECSRC       0x00000008
-#define SOUND_MIXER_STEREODEVS 0xfb    /* Mixer channels supporting stereo */
-
-/* OSS/Free ONLY */
-#define SOUND_MIXER_OUTSRC    0xfa     /* Arg contains a bit for each input source to output */
-#define SOUND_MIXER_OUTMASK   0xf9     /* Arg contains a bit for each supported input source to output */
-/* OSS/Free ONLY */
-
-/*     Device mask bits        */
-
-#define SOUND_MASK_VOLUME      (1 << SOUND_MIXER_VOLUME)
-#define SOUND_MASK_BASS                (1 << SOUND_MIXER_BASS)
-#define SOUND_MASK_TREBLE      (1 << SOUND_MIXER_TREBLE)
-#define SOUND_MASK_SYNTH       (1 << SOUND_MIXER_SYNTH)
-#define SOUND_MASK_PCM         (1 << SOUND_MIXER_PCM)
-#define SOUND_MASK_SPEAKER     (1 << SOUND_MIXER_SPEAKER)
-#define SOUND_MASK_LINE                (1 << SOUND_MIXER_LINE)
-#define SOUND_MASK_MIC         (1 << SOUND_MIXER_MIC)
-#define SOUND_MASK_CD          (1 << SOUND_MIXER_CD)
-#define SOUND_MASK_IMIX                (1 << SOUND_MIXER_IMIX)
-#define SOUND_MASK_ALTPCM      (1 << SOUND_MIXER_ALTPCM)
-#define SOUND_MASK_RECLEV      (1 << SOUND_MIXER_RECLEV)
-#define SOUND_MASK_IGAIN       (1 << SOUND_MIXER_IGAIN)
-#define SOUND_MASK_OGAIN       (1 << SOUND_MIXER_OGAIN)
-#define SOUND_MASK_LINE1       (1 << SOUND_MIXER_LINE1)
-#define SOUND_MASK_LINE2       (1 << SOUND_MIXER_LINE2)
-#define SOUND_MASK_LINE3       (1 << SOUND_MIXER_LINE3)
-#define SOUND_MASK_DIGITAL1    (1 << SOUND_MIXER_DIGITAL1)
-#define SOUND_MASK_DIGITAL2    (1 << SOUND_MIXER_DIGITAL2)
-#define SOUND_MASK_DIGITAL3    (1 << SOUND_MIXER_DIGITAL3)
-#define SOUND_MASK_MONO                (1 << SOUND_MIXER_MONO)
-#define SOUND_MASK_PHONE       (1 << SOUND_MIXER_PHONE)
-#define SOUND_MASK_RADIO       (1 << SOUND_MIXER_RADIO)
-#define SOUND_MASK_VIDEO       (1 << SOUND_MIXER_VIDEO)
-#define SOUND_MASK_DEPTH       (1 << SOUND_MIXER_DEPTH)
-#define SOUND_MASK_REARVOL     (1 << SOUND_MIXER_REARVOL)
-#define SOUND_MASK_CENTERVOL   (1 << SOUND_MIXER_CENTERVOL)
-#define SOUND_MASK_SIDEVOL     (1 << SOUND_MIXER_SIDEVOL)
-
-/* Note! SOUND_MASK_SURRVOL is alias of SOUND_MASK_SIDEVOL */
-#define SOUND_MASK_SURRVOL     (1 << SOUND_MIXER_SIDEVOL)
-
-/* Obsolete macros */
-#define SOUND_MASK_MUTE                (1 << SOUND_MIXER_MUTE)
-#define SOUND_MASK_ENHANCE     (1 << SOUND_MIXER_ENHANCE)
-#define SOUND_MASK_LOUD                (1 << SOUND_MIXER_LOUD)
-
-#define MIXER_READ(dev)                        __SIOR('M', dev, int)
-#define SOUND_MIXER_READ_VOLUME                MIXER_READ(SOUND_MIXER_VOLUME)
-#define SOUND_MIXER_READ_BASS          MIXER_READ(SOUND_MIXER_BASS)
-#define SOUND_MIXER_READ_TREBLE                MIXER_READ(SOUND_MIXER_TREBLE)
-#define SOUND_MIXER_READ_SYNTH         MIXER_READ(SOUND_MIXER_SYNTH)
-#define SOUND_MIXER_READ_PCM           MIXER_READ(SOUND_MIXER_PCM)
-#define SOUND_MIXER_READ_SPEAKER       MIXER_READ(SOUND_MIXER_SPEAKER)
-#define SOUND_MIXER_READ_LINE          MIXER_READ(SOUND_MIXER_LINE)
-#define SOUND_MIXER_READ_MIC           MIXER_READ(SOUND_MIXER_MIC)
-#define SOUND_MIXER_READ_CD            MIXER_READ(SOUND_MIXER_CD)
-#define SOUND_MIXER_READ_IMIX          MIXER_READ(SOUND_MIXER_IMIX)
-#define SOUND_MIXER_READ_ALTPCM                MIXER_READ(SOUND_MIXER_ALTPCM)
-#define SOUND_MIXER_READ_RECLEV                MIXER_READ(SOUND_MIXER_RECLEV)
-#define SOUND_MIXER_READ_IGAIN         MIXER_READ(SOUND_MIXER_IGAIN)
-#define SOUND_MIXER_READ_OGAIN         MIXER_READ(SOUND_MIXER_OGAIN)
-#define SOUND_MIXER_READ_LINE1         MIXER_READ(SOUND_MIXER_LINE1)
-#define SOUND_MIXER_READ_LINE2         MIXER_READ(SOUND_MIXER_LINE2)
-#define SOUND_MIXER_READ_LINE3         MIXER_READ(SOUND_MIXER_LINE3)
-
-/* Obsolete macros */
-#define SOUND_MIXER_READ_MUTE          MIXER_READ(SOUND_MIXER_MUTE)
-#define SOUND_MIXER_READ_ENHANCE       MIXER_READ(SOUND_MIXER_ENHANCE)
-#define SOUND_MIXER_READ_LOUD          MIXER_READ(SOUND_MIXER_LOUD)
-
-#define SOUND_MIXER_READ_RECSRC                MIXER_READ(SOUND_MIXER_RECSRC)
-#define SOUND_MIXER_READ_DEVMASK       MIXER_READ(SOUND_MIXER_DEVMASK)
-#define SOUND_MIXER_READ_RECMASK       MIXER_READ(SOUND_MIXER_RECMASK)
-#define SOUND_MIXER_READ_STEREODEVS    MIXER_READ(SOUND_MIXER_STEREODEVS)
-#define SOUND_MIXER_READ_CAPS          MIXER_READ(SOUND_MIXER_CAPS)
-
-#define MIXER_WRITE(dev)               __SIOWR('M', dev, int)
-#define SOUND_MIXER_WRITE_VOLUME       MIXER_WRITE(SOUND_MIXER_VOLUME)
-#define SOUND_MIXER_WRITE_BASS         MIXER_WRITE(SOUND_MIXER_BASS)
-#define SOUND_MIXER_WRITE_TREBLE       MIXER_WRITE(SOUND_MIXER_TREBLE)
-#define SOUND_MIXER_WRITE_SYNTH                MIXER_WRITE(SOUND_MIXER_SYNTH)
-#define SOUND_MIXER_WRITE_PCM          MIXER_WRITE(SOUND_MIXER_PCM)
-#define SOUND_MIXER_WRITE_SPEAKER      MIXER_WRITE(SOUND_MIXER_SPEAKER)
-#define SOUND_MIXER_WRITE_LINE         MIXER_WRITE(SOUND_MIXER_LINE)
-#define SOUND_MIXER_WRITE_MIC          MIXER_WRITE(SOUND_MIXER_MIC)
-#define SOUND_MIXER_WRITE_CD           MIXER_WRITE(SOUND_MIXER_CD)
-#define SOUND_MIXER_WRITE_IMIX         MIXER_WRITE(SOUND_MIXER_IMIX)
-#define SOUND_MIXER_WRITE_ALTPCM       MIXER_WRITE(SOUND_MIXER_ALTPCM)
-#define SOUND_MIXER_WRITE_RECLEV       MIXER_WRITE(SOUND_MIXER_RECLEV)
-#define SOUND_MIXER_WRITE_IGAIN                MIXER_WRITE(SOUND_MIXER_IGAIN)
-#define SOUND_MIXER_WRITE_OGAIN                MIXER_WRITE(SOUND_MIXER_OGAIN)
-#define SOUND_MIXER_WRITE_LINE1                MIXER_WRITE(SOUND_MIXER_LINE1)
-#define SOUND_MIXER_WRITE_LINE2                MIXER_WRITE(SOUND_MIXER_LINE2)
-#define SOUND_MIXER_WRITE_LINE3                MIXER_WRITE(SOUND_MIXER_LINE3)
-
-/* Obsolete macros */
-#define SOUND_MIXER_WRITE_MUTE         MIXER_WRITE(SOUND_MIXER_MUTE)
-#define SOUND_MIXER_WRITE_ENHANCE      MIXER_WRITE(SOUND_MIXER_ENHANCE)
-#define SOUND_MIXER_WRITE_LOUD         MIXER_WRITE(SOUND_MIXER_LOUD)
-
-#define SOUND_MIXER_WRITE_RECSRC       MIXER_WRITE(SOUND_MIXER_RECSRC)
-
-typedef struct mixer_info      /* OBSOLETE */
-{
-  char id[16];
-  char name[32];
-  int modify_counter;
-  int fillers[10];
-} mixer_info;
-
-/* SOUND_MIXER_INFO is obsolete - use SNDCTL_MIXERINFO instead */
-#define SOUND_MIXER_INFO               __SIOR ('M', 101, mixer_info)
-
-/*
- * Two ioctls for special souncard function (OSS/Free only)
- */
-#define SOUND_MIXER_AGC  _SIOWR('M', 103, int)
-#define SOUND_MIXER_3DSE  _SIOWR('M', 104, int)
-/*
- * The SOUND_MIXER_PRIVATE# commands can be redefined by low level drivers.
- * These features can be used when accessing device specific features.
- */
-#define SOUND_MIXER_PRIVATE1           __SIOWR('M', 111, int)
-#define SOUND_MIXER_PRIVATE2           __SIOWR('M', 112, int)
-#define SOUND_MIXER_PRIVATE3           __SIOWR('M', 113, int)
-#define SOUND_MIXER_PRIVATE4           __SIOWR('M', 114, int)
-#define SOUND_MIXER_PRIVATE5           __SIOWR('M', 115, int)
-
-/* The following two controls were never implemented and they should not be used. */
-#define SOUND_MIXER_READ_MAINVOL               __SIOR ('M', 116, int)
-#define SOUND_MIXER_WRITE_MAINVOL              __SIOWR('M', 116, int)
-
-/*
- * SOUND_MIXER_GETLEVELS and SOUND_MIXER_SETLEVELS calls can be used
- * for querying current mixer settings from the driver and for loading
- * default volume settings _prior_ activating the mixer (loading
- * doesn't affect current state of the mixer hardware). These calls
- * are for internal use by the driver software only.
- */
-
-typedef struct mixer_vol_table
-{
-  int num;                     /* Index to volume table */
-  char name[32];
-  int levels[32];
-} mixer_vol_table;
-
-#define SOUND_MIXER_GETLEVELS          __SIOWR('M', 116, mixer_vol_table)
-#define SOUND_MIXER_SETLEVELS          __SIOWR('M', 117, mixer_vol_table)
-
-#define OSS_GETVERSION                 __SIOR ('M', 118, int)
-
-/*
- * Calls to set/get the recording gain for the currently active
- * recording source. These calls automatically map to the right control.
- * Note that these calls are not supported by all drivers. In this case
- * the call will return -1 with errno set to EINVAL
- *
- * The _MONGAIN work in similar way but set/get the monitoring gain for
- * the currently selected recording source.
- */
-#define SOUND_MIXER_READ_RECGAIN       __SIOR ('M', 119, int)
-#define SOUND_MIXER_WRITE_RECGAIN      __SIOWR('M', 119, int)
-#define SOUND_MIXER_READ_MONGAIN       __SIOR ('M', 120, int)
-#define SOUND_MIXER_WRITE_MONGAIN      __SIOWR('M', 120, int)
-
-/* The following call is for driver development time purposes. It's not
- * present in any released drivers.
- */
-typedef unsigned char oss_reserved_t[512];
-#define SOUND_MIXER_RESERVED           __SIOWR('M', 121, oss_reserved_t)
-#endif /* ifndef NO_LEGACY_MIXER */
-
-/*
- *************************************************************************
- * The "new" mixer API of OSS 4.0 and later.
- *
- * This improved mixer API makes it possible to access every possible feature
- * of every possible device. However you should read the mixer programming
- * section of the OSS API Developer's Manual. There is no chance that you
- * could use this interface correctly just by examining this header.
- */
-
-typedef struct oss_sysinfo
-{
-  char product[32];            /* For example OSS/Free, OSS/Linux or OSS/Solaris */
-  char version[32];            /* For example 4.0a */
-  int versionnum;              /* See OSS_GETVERSION */
-  char options[128];           /* Reserved */
-
-  int numaudios;               /* # of audio/dsp devices */
-  int openedaudio[8];          /* Bit mask telling which audio devices are busy */
-
-  int numsynths;               /* # of availavle synth devices */
-  int nummidis;                        /* # of available MIDI ports */
-  int numtimers;               /* # of available timer devices */
-  int nummixers;               /* # of mixer devices */
-
-  int openedmidi[8];           /* Bit mask telling which midi devices are busy */
-  int numcards;                        /* Number of sound cards in the system */
-  int numaudioengines;         /* Number of audio engines in the system */
-  char license[16];            /* For example "GPL" or "CDDL" */
-  char revision_info[256];     /* For internal use */
-  int filler[172];             /* For future expansion */
-} oss_sysinfo;
-
-typedef struct oss_mixext
-{
-  int dev;                     /* Mixer device number */
-  int ctrl;                    /* Controller number */
-  int type;                    /* Entry type */
-#      define MIXT_DEVROOT      0      /* Device root entry */
-#      define MIXT_GROUP        1      /* Controller group */
-#      define MIXT_ONOFF        2      /* OFF (0) or ON (1) */
-#      define MIXT_ENUM         3      /* Enumerated (0 to maxvalue) */
-#      define MIXT_MONOSLIDER   4      /* Mono slider (0 to 255) */
-#      define MIXT_STEREOSLIDER 5      /* Stereo slider (dual 0 to 255) */
-#      define MIXT_MESSAGE      6      /* (Readable) textual message */
-#      define MIXT_MONOVU       7      /* VU meter value (mono) */
-#      define MIXT_STEREOVU     8      /* VU meter value (stereo) */
-#      define MIXT_MONOPEAK     9      /* VU meter peak value (mono) */
-#      define MIXT_STEREOPEAK  10      /* VU meter peak value (stereo) */
-#      define MIXT_RADIOGROUP  11      /* Radio button group */
-#      define MIXT_MARKER      12      /* Separator between normal and extension entries */
-#      define MIXT_VALUE       13      /* Decimal value entry */
-#      define MIXT_HEXVALUE    14      /* Hexadecimal value entry */
-#      define MIXT_MONODB      15      /* OBSOLETE */
-#      define MIXT_STEREODB    16      /* OBSOLETE */
-#      define MIXT_SLIDER      17      /* Slider (mono) with full (31 bit) postitive integer range */
-#      define MIXT_3D          18
-
-/*
- * Sliders with range expanded to 15 bits per channel (0-32767)
- */
-#      define MIXT_MONOSLIDER16        19
-#      define MIXT_STEREOSLIDER16      20
-#      define MIXT_MUTE        21      /* Mute=1, unmute=0 */
-
-  /**************************************************************/
-
-  /* Possible value range (minvalue to maxvalue) */
-  /* Note that maxvalue may also be smaller than minvalue */
-  int maxvalue;
-  int minvalue;
-
-  int flags;
-#      define MIXF_READABLE    0x00000001      /* Has readable value */
-#      define MIXF_WRITEABLE   0x00000002      /* Has writeable value */
-#      define MIXF_POLL        0x00000004      /* May change itself */
-#      define MIXF_HZ          0x00000008      /* Herz scale */
-#      define MIXF_STRING      0x00000010      /* Use dynamic extensions for value */
-#      define MIXF_DYNAMIC     0x00000010      /* Supports dynamic extensions */
-#      define MIXF_OKFAIL      0x00000020      /* Interpret value as 1=OK, 0=FAIL */
-#      define MIXF_FLAT        0x00000040      /* Flat vertical space requirements */
-#      define MIXF_LEGACY      0x00000080      /* Legacy mixer control group */
-#      define MIXF_CENTIBEL    0x00000100      /* Centibel (0.1 dB) step size */
-#      define MIXF_DECIBEL     0x00000200      /* Step size of 1 dB */
-#      define MIXF_MAINVOL     0x00000400      /* Main volume control */
-#      define MIXF_PCMVOL      0x00000800      /* PCM output volume control */
-#      define MIXF_RECVOL      0x00001000      /* PCM recording volume control */
-#      define MIXF_MONVOL      0x00002000      /* Input->output monitor volume */
-#      define MIXF_WIDE        0x00004000      /* Enum control has wide labels */
-#      define MIXF_DESCR       0x00008000      /* Description (tooltip) available */
-  oss_id_t id;                 /* Mnemonic ID (mainly for internal use) */
-  int parent;                  /* Entry# of parent (group) node (-1 if root) */
-
-  int dummy;                   /* Internal use */
-
-  int timestamp;
-
-  char data[64];               /* Misc data (entry type dependent) */
-  unsigned char enum_present[32];      /* Mask of allowed enum values */
-  int control_no;              /* SOUND_MIXER_VOLUME..SOUND_MIXER_MIDI */
-  /* (-1 means not indicated) */
-
-/*
- * The desc field is reserved for internal purposes of OSS. It should not be 
- * used by applications.
- */
-  unsigned int desc;
-#define MIXEXT_SCOPE_MASK                      0x0000003f
-#define MIXEXT_SCOPE_OTHER                     0x00000000
-#define MIXEXT_SCOPE_INPUT                     0x00000001
-#define MIXEXT_SCOPE_OUTPUT                    0x00000002
-#define MIXEXT_SCOPE_MONITOR                   0x00000003
-#define MIXEXT_SCOPE_RECSWITCH                 0x00000004
-
-  char extname[32];
-  int update_counter;
-  int rgbcolor;                /* 0 means default color (not black) . Otherwise 24 bit RGB color */
-  int filler[6];
-} oss_mixext;
-
-/*
- * Recommended colors to be used in the rgbcolor field. These match the
- * colors used as the audio jack colors in HD audio motherboards.
- */
-#define OSS_RGB_BLUE   0x7aabde                /* Light blue */
-#define OSS_RGB_GREEN  0xb3c98c                /* Lime green */
-#define OSS_RGB_PINK   0xe88c99
-#define OSS_RGB_GRAY   0xd1ccc4
-#define OSS_RGB_BLACK  0x2b2926                /* Light black */
-#define OSS_RGB_ORANGE 0xe89e47
-#define OSS_RGB_RED    0xff0000
-#define OSS_RGB_YELLOW 0xffff00
-#define OSS_RGB_PURPLE 0x800080
-#define OSS_RGB_WHITE  0xf8f8ff
-
-typedef struct oss_mixext_root
-{
-  oss_id_t id;
-  char name[48];
-} oss_mixext_root;
-
-typedef struct oss_mixer_value
-{
-  int dev;
-  int ctrl;
-  int value;
-  int flags;                   /* Reserved for future use. Initialize to 0 */
-  int timestamp;               /* Must be set to oss_mixext.timestamp */
-  int filler[8];               /* Reserved for future use. Initialize to 0 */
-} oss_mixer_value;
-
-#define OSS_ENUM_MAXVALUE      255
-#define OSS_ENUM_STRINGSIZE    3000
-typedef struct oss_mixer_enuminfo
-{
-  int dev;
-  int ctrl;
-  int nvalues;
-  int version;                 /* Read the manual */
-  short strindex[OSS_ENUM_MAXVALUE];
-  char strings[OSS_ENUM_STRINGSIZE];
-} oss_mixer_enuminfo;
-
-#define OPEN_READ      PCM_ENABLE_INPUT
-#define OPEN_WRITE     PCM_ENABLE_OUTPUT
-#define OPEN_READWRITE (OPEN_READ|OPEN_WRITE)
-
-typedef struct oss_audioinfo
-{
-  int dev;                     /* Audio device number */
-  oss_devname_t name;
-  int busy;                    /* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */
-  int pid;
-  int caps;                    /* PCM_CAP_INPUT, PCM_CAP_OUTPUT */
-  int iformats, oformats;
-  int magic;                   /* Reserved for internal use */
-  oss_cmd_t cmd;               /* Command using the device (if known) */
-  int card_number;
-  int port_number;
-  int mixer_dev;
-  int legacy_device;           /* Obsolete field. Replaced by devnode */
-  int enabled;                 /* 1=enabled, 0=device not ready at this moment */
-  int flags;                   /* For internal use only - no practical meaning */
-  int min_rate, max_rate;      /* Sample rate limits */
-  int min_channels, max_channels;      /* Number of channels supported */
-  int binding;                 /* DSP_BIND_FRONT, etc. 0 means undefined */
-  int rate_source;
-  oss_handle_t handle;
-#define OSS_MAX_SAMPLE_RATES   20      /* Cannot be changed  */
-  unsigned int nrates, rates[OSS_MAX_SAMPLE_RATES];    /* Please read the manual before using these */
-  oss_longname_t song_name;    /* Song name (if given) */
-  oss_label_t label;           /* Device label (if given) */
-  int latency;                 /* In usecs, -1=unknown */
-  oss_devnode_t devnode;       /* Device special file name (absolute path) */
-  int next_play_engine;                /* Read the documentation for more info */
-  int next_rec_engine;         /* Read the documentation for more info */
-  int filler[184];
-} oss_audioinfo;
-
-typedef struct oss_mixerinfo
-{
-  int dev;
-  oss_id_t id;
-  char name[32];               /* oss_devname_t is better, but may break compat */
-  int modify_counter;
-  int card_number;
-  int port_number;
-  oss_handle_t handle;
-  int magic;                   /* Reserved */
-  int enabled;
-  int caps;
-#define MIXER_CAP_VIRTUAL      0x00000001
-#define MIXER_CAP_LAYOUT_B     0x00000002      /* For internal use only */
-#define MIXER_CAP_NARROW       0x00000004      /* Conserve horiz space */
-  int flags;                   /* Reserved */
-  int nrext;
-  /*
-   * The priority field can be used to select the default (motherboard)
-   * mixer device. The mixer with the highest priority is the
-   * most preferred one. -2 or less means that this device cannot be used
-   * as the default mixer.
-   */
-  int priority;
-  oss_devnode_t devnode;       /* Device special file name (absolute path) */
-  int legacy_device;
-  int filler[245];             /* Reserved */
-} oss_mixerinfo;
-
-typedef struct oss_midi_info
-{
-  int dev;                     /* Midi device number */
-  oss_devname_t name;
-  int busy;                    /* 0, OPEN_READ, OPEN_WRITE or OPEN_READWRITE */
-  int pid;
-  oss_cmd_t cmd;               /* Command using the device (if known) */
-  int caps;
-#define MIDI_CAP_MPU401                0x00000001      /**** OBSOLETE ****/
-#define MIDI_CAP_INPUT         0x00000002
-#define MIDI_CAP_OUTPUT                0x00000004
-#define MIDI_CAP_INOUT         (MIDI_CAP_INPUT|MIDI_CAP_OUTPUT)
-#define MIDI_CAP_VIRTUAL       0x00000008      /* Pseudo device */
-#define MIDI_CAP_MTCINPUT      0x00000010      /* Supports SNDCTL_MIDI_MTCINPUT */
-#define MIDI_CAP_CLIENT                0x00000020      /* Virtual client side device */
-#define MIDI_CAP_SERVER                0x00000040      /* Virtual server side device */
-#define MIDI_CAP_INTERNAL      0x00000080      /* Internal (synth) device */
-#define MIDI_CAP_EXTERNAL      0x00000100      /* external (MIDI port) device */
-#define MIDI_CAP_PTOP          0x00000200      /* Point to point link to one device */
-#define MIDI_CAP_MTC           0x00000400      /* MTC/SMPTE (control) device */
-  int magic;                   /* Reserved for internal use */
-  int card_number;
-  int port_number;
-  int enabled;                 /* 1=enabled, 0=device not ready at this moment */
-  int flags;                   /* For internal use only - no practical meaning */
-  oss_handle_t handle;
-  oss_longname_t song_name;    /* Song name (if known) */
-  oss_label_t label;           /* Device label (if given) */
-  int latency;                 /* In usecs, -1=unknown */
-  oss_devnode_t devnode;       /* Device special file name (absolute path) */
-  int legacy_device;           /* Legacy device mapping */
-  int filler[235];
-} oss_midi_info;
-
-typedef struct oss_card_info
-{
-  int card;
-  char shortname[16];
-  char longname[128];
-  int flags;
-  char hw_info[400];
-  int intr_count, ack_count;
-  int filler[154];
-} oss_card_info;
-
-#define SNDCTL_SYSINFO         __SIOR ('X', 1, oss_sysinfo)
-#define OSS_SYSINFO            SNDCTL_SYSINFO  /* Old name */
-
-#define SNDCTL_MIX_NRMIX       __SIOR ('X', 2, int)
-#define SNDCTL_MIX_NREXT       __SIOWR('X', 3, int)
-#define SNDCTL_MIX_EXTINFO     __SIOWR('X', 4, oss_mixext)
-#define SNDCTL_MIX_READ                __SIOWR('X', 5, oss_mixer_value)
-#define SNDCTL_MIX_WRITE       __SIOWR('X', 6, oss_mixer_value)
-
-#define SNDCTL_AUDIOINFO       __SIOWR('X', 7, oss_audioinfo)
-#define SNDCTL_MIX_ENUMINFO    __SIOWR('X', 8, oss_mixer_enuminfo)
-#define SNDCTL_MIDIINFO                __SIOWR('X', 9, oss_midi_info)
-#define SNDCTL_MIXERINFO       __SIOWR('X',10, oss_mixerinfo)
-#define SNDCTL_CARDINFO                __SIOWR('X',11, oss_card_info)
-#define SNDCTL_ENGINEINFO      __SIOWR('X',12, oss_audioinfo)
-#define SNDCTL_AUDIOINFO_EX    __SIOWR('X',13, oss_audioinfo)
-
-#define SNDCTL_MIX_DESCRIPTION __SIOWR('X',14, oss_mixer_enuminfo)
-
-/*
- * SNDCTL_MIX_MATRIX_WRITE and SNDCTL_MIX_MATRIX_READ are private ioctl
- * calls that each driver can define in whatever way they like. They can
- * be used _ONLY_ by device specific utilities. Each driver can define
- * meaning of the fields of oss_mixermatrix_t as they like. This means
- * that applications using this interface will depend on the specific device.
- *
- * This interface can be used for example to implement a (GUI) tool that can 
- * set the signal routings of an on-board mixer matrix of some high end
- * audio card. The application (designer) must have complete understanding
- * of the device to be supported. The application will not be portable to any
- * other device.
- *
- * Applications using this interface must verify that the magic field
- * returned by SNDCTL_MIXERINFO matches the right device/driver.
- */
-typedef struct
-{
-       int secret;     /* Initialize this to driver spcified secret value */
-       int source, target;
-       int function;
-       int value;
-       int options[16];
-} oss_mixermatrix_t;
-
-#define SNDCTL_MIX_MATRIX_WRITE        __SIOWR('X',15, oss_mixermatrix_t)
-#define SNDCTL_MIX_MATRIX_READ __SIOWR('X',16, oss_mixermatrix_t)
-
-/* ioctl codes 'X', 200-255 are reserved for internal use */
-
-/*
- * Few more "globally" available ioctl calls.
- */
-#define SNDCTL_SETSONG         __SIOW ('Y', 2, oss_longname_t)
-#define SNDCTL_GETSONG         __SIOR ('Y', 2, oss_longname_t)
-#define SNDCTL_SETNAME         __SIOW ('Y', 3, oss_longname_t)
-#define SNDCTL_SETLABEL                __SIOW ('Y', 4, oss_label_t)
-#define SNDCTL_GETLABEL                __SIOR ('Y', 4, oss_label_t)
-/*
- * The "new" mixer API definitions end here.
- ***************************************
- */
-
-/*
- *********************************************************
- * Few routines that are included in -lOSSlib
- *
- * At this moment this interface is not used. OSSlib contains just
- * stubs that call the related system calls directly.
- */
-#ifdef OSSLIB
-extern int osslib_open (const char *path, int flags, int dummy);
-extern void osslib_close (int fd);
-extern int osslib_write (int fd, const void *buf, int count);
-extern int osslib_read (int fd, void *buf, int count);
-extern int osslib_ioctl (int fd, unsigned int request, void *arg);
-#else
-#  define osslib_open  open
-#  define osslib_close close
-#  define osslib_write write
-#  define osslib_read  read
-#  define osslib_ioctl ioctl
-#endif
-
-#if 1
-#define SNDCTL_DSP_NONBLOCK            __SIO  ('P',14) /* Obsolete. Not supported any more */
-#endif
-
-#if 1
-/*
- * Some obsolete macros that are not part of Open Sound System API.
- */
-#define SOUND_PCM_READ_RATE             SOUND_PCM_READ_RATE_is_obsolete
-#define SOUND_PCM_READ_BITS             SOUND_PCM_READ_BITS_is_obsolete
-#define SOUND_PCM_READ_CHANNELS         SOUND_PCM_READ_CHANNELS_is_obsolete
-#define SOUND_PCM_WRITE_RATE            SOUND_PCM_WRITE_RATE_is_obsolet_use_SNDCTL_DSP_SPEED_instead
-#define SOUND_PCM_WRITE_CHANNELS        SOUND_PCM_WRITE_CHANNELS_is_obsolete_use_SNDCTL_DSP_CHANNELS_instead
-#define SOUND_PCM_WRITE_BITS            SOUND_PCM_WRITE_BITS_is_obsolete_use_SNDCTL_DSP_SETFMT_instead
-#define SOUND_PCM_POST                  SOUND_PCM_POST_is_obsolete_use_SNDCTL_DSP_POST_instead
-#define SOUND_PCM_RESET                 SOUND_PCM_RESET_is_obsolete_use_SNDCTL_DSP_HALT_instead
-#define SOUND_PCM_SYNC                  SOUND_PCM_SYNC_is_obsolete_use_SNDCTL_DSP_SYNC_instead
-#define SOUND_PCM_SUBDIVIDE             SOUND_PCM_SUBDIVIDE_is_obsolete_use_SNDCTL_DSP_SUBDIVIDE_instead
-#define SOUND_PCM_SETFRAGMENT           SOUND_PCM_SETFRAGMENT_is_obsolete_use_SNDCTL_DSP_SETFRAGMENT_instead
-#define SOUND_PCM_GETFMTS               SOUND_PCM_GETFMTS_is_obsolete_use_SNDCTL_DSP_GETFMTS_instead
-#define SOUND_PCM_SETFMT                SOUND_PCM_SETFMT_is_obsolete_use_SNDCTL_DSP_SETFMT_instead
-#define SOUND_PCM_GETOSPACE             SOUND_PCM_GETOSPACE_is_obsolete_use_SNDCTL_DSP_GETOSPACE_instead
-#define SOUND_PCM_GETISPACE             SOUND_PCM_GETISPACE_is_obsolete_use_SNDCTL_DSP_GETISPACE_instead
-#define SOUND_PCM_NONBLOCK              SOUND_PCM_NONBLOCK_is_obsolete_use_SNDCTL_DSP_NONBLOCK_instead
-#define SOUND_PCM_GETCAPS               SOUND_PCM_GETCAPS_is_obsolete_use_SNDCTL_DSP_GETCAPS_instead
-#define SOUND_PCM_GETTRIGGER            SOUND_PCM_GETTRIGGER_is_obsolete_use_SNDCTL_DSP_GETTRIGGER_instead
-#define SOUND_PCM_SETTRIGGER            SOUND_PCM_SETTRIGGER_is_obsolete_use_SNDCTL_DSP_SETTRIGGER_instead
-#define SOUND_PCM_SETSYNCRO             SOUND_PCM_SETSYNCRO_is_obsolete_use_SNDCTL_DSP_SETSYNCRO_instead
-#define SOUND_PCM_GETIPTR               SOUND_PCM_GETIPTR_is_obsolete_use_SNDCTL_DSP_GETIPTR_instead
-#define SOUND_PCM_GETOPTR               SOUND_PCM_GETOPTR_is_obsolete_use_SNDCTL_DSP_GETOPTR_instead
-#define SOUND_PCM_MAPINBUF              SOUND_PCM_MAPINBUF_is_obsolete_use_SNDCTL_DSP_MAPINBUF_instead
-#define SOUND_PCM_MAPOUTBUF             SOUND_PCM_MAPOUTBUF_is_obsolete_use_SNDCTL_DSP_MAPOUTBUF_instead
-#endif
-
-#endif
index 71e4a43ac2384522940f124d3fa94d4a94981f96..c10014e3b6bcbbd1ca7444dfc66d509a8a02b18b 100644 (file)
@@ -1,21 +1,18 @@
-/* The <sys/stat.h> header defines a struct that is used in the stat() and
- * fstat functions.  The information in this struct comes from the i-node of
- * some file.  These calls are the only approved way to inspect i-nodes.
- */
+#ifndef _SYS_STAT_H_
+#define        _SYS_STAT_H_
 
-#ifndef _STAT_H
-#define _STAT_H
+#include <sys/featuretest.h>
+#include <sys/types.h>         /* XXX */
 
-#ifndef _TYPES_H
-#include <minix/types.h>
+#if defined(_NETBSD_SOURCE)
+#include <sys/time.h>
 #endif
 
 
 struct stat {
   big_dev_t     st_dev;               /* inode's device */
   big_mode_t    st_mode;              /* inode protection mode */
-  ino_t         st_ino;               /* inode's number */
-  u32_t         padding;              /* inode's padding */
+  big_ino_t    st_ino;               /* inode's number */
   big_nlink_t   st_nlink;             /* number of hard links */
   big_uid_t     st_uid;               /* user ID of the file's owner */
   big_gid_t     st_gid;               /* group ID of the file's group */
@@ -35,10 +32,8 @@ struct stat {
   time_t    st_birthtime;         /* time of creation */
   long      st_birthtimensec;     /* nsec of time of creation */
 #endif
-  off_t st_size;               /* file size, in bytes */
-  u32_t     padding2;          /* size padding */
+  big_off_t st_size;           /* file size, in bytes */
   blkcnt_t  st_blocks;         /* blocks allocated for file */
-  u32_t     padding3;          /* blocks padding */
   blksize_t st_blksize;                /* optimal blocksize for I/O */
   u32_t     st_flags;          /* user defined flags for file */
   u32_t     st_gen;            /* file generation number */
@@ -61,80 +56,138 @@ struct minix_prev_stat {
 };
 
 
-/* Copy field by field because of st_gid type mismath and
- * difference in order after atime.
- */
-#define COPY_PREV_STAT_TO_NEW(dest, src)\
-       (dest)->st_dev = (src)->st_dev;\
-       (dest)->st_ino = (src)->st_ino;\
-       (dest)->st_mode = (src)->st_mode;\
-       (dest)->st_nlink = (src)->st_nlink;\
-       (dest)->st_uid = (src)->st_uid;\
-       (dest)->st_gid = (src)->st_gid;\
-       (dest)->st_rdev = (src)->st_rdev;\
-       (dest)->st_size = (src)->st_size;\
-       (dest)->st_atime = (src)->st_atime;\
-       (dest)->st_mtime = (src)->st_mtime;\
-       (dest)->st_ctime = (src)->st_ctime
+#if defined(_NETBSD_SOURCE)
+/* XXX after updating stat struct we don't want to update all the code */
+#define st_atime               st_atimespec.tv_sec
+#define st_mtime               st_mtimespec.tv_sec
+#define st_ctime               st_ctimespec.tv_sec
+#define st_birthtime            st_birthtimespec.tv_sec
+#define st_atimensec            st_atimespec.tv_nsec
+#define st_mtimensec            st_mtimespec.tv_nsec
+#define st_ctimensec            st_ctimespec.tv_nsec
+#define st_birthtimensec        st_birthtimespec.tv_nsec
+#endif
+
+
+#define        S_ISUID 0004000                 /* set user id on execution */
+#define        S_ISGID 0002000                 /* set group id on execution */
+#if defined(_NETBSD_SOURCE)
+#define        S_ISTXT 0001000                 /* sticky bit */
+#endif
+
+#define        S_IRWXU 0000700                 /* RWX mask for owner */
+#define        S_IRUSR 0000400                 /* R for owner */
+#define        S_IWUSR 0000200                 /* W for owner */
+#define        S_IXUSR 0000100                 /* X for owner */
+
+#if defined(_NETBSD_SOURCE)
+#define        S_IREAD         S_IRUSR
+#define        S_IWRITE        S_IWUSR
+#define        S_IEXEC         S_IXUSR
+#endif
+
+#define        S_IRWXG 0000070                 /* RWX mask for group */
+#define        S_IRGRP 0000040                 /* R for group */
+#define        S_IWGRP 0000020                 /* W for group */
+#define        S_IXGRP 0000010                 /* X for group */
+
+#define        S_IRWXO 0000007                 /* RWX mask for other */
+#define        S_IROTH 0000004                 /* R for other */
+#define        S_IWOTH 0000002                 /* W for other */
+#define        S_IXOTH 0000001                 /* X for other */
+
+#define        _S_IFMT   0170000               /* type of file mask */
+#define        _S_IFIFO  0010000               /* named pipe (fifo) */
+#define        _S_IFCHR  0020000               /* character special */
+#define        _S_IFDIR  0040000               /* directory */
+#define        _S_IFBLK  0060000               /* block special */
+#define        _S_IFREG  0100000               /* regular */
+#define        _S_IFLNK  0120000               /* symbolic link */
+#define        _S_IFSOCK 0140000               /* socket */
+#define        _S_ISVTX  0001000               /* save swapped text even after use */
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define        S_IFMT   _S_IFMT
+#define        S_IFIFO  _S_IFIFO
+#define        S_IFCHR  _S_IFCHR
+#define        S_IFDIR  _S_IFDIR
+#define        S_IFBLK  _S_IFBLK
+#define        S_IFREG  _S_IFREG
+#define        S_IFLNK  _S_IFLNK
+#define        S_ISVTX  _S_ISVTX
+#endif
+#if ((_XOPEN_SOURCE - 0) >= 600) || defined(_NETBSD_SOURCE)
+#define        S_IFSOCK _S_IFSOCK
+#endif
+
+#define        S_ISDIR(m)      (((m) & _S_IFMT) == _S_IFDIR)   /* directory */
+#define        S_ISCHR(m)      (((m) & _S_IFMT) == _S_IFCHR)   /* char special */
+#define        S_ISBLK(m)      (((m) & _S_IFMT) == _S_IFBLK)   /* block special */
+#define        S_ISREG(m)      (((m) & _S_IFMT) == _S_IFREG)   /* regular file */
+#define        S_ISFIFO(m)     (((m) & _S_IFMT) == _S_IFIFO)   /* fifo */
+#if ((_POSIX_C_SOURCE - 0) >= 200112L) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#define        S_ISLNK(m)      (((m) & _S_IFMT) == _S_IFLNK)   /* symbolic link */
+#endif
+#if ((_POSIX_C_SOURCE - 0) >= 200112L) || ((_XOPEN_SOURCE - 0) >= 600) || \
+    defined(_NETBSD_SOURCE)
+#define        S_ISSOCK(m)     (((m) & _S_IFMT) == _S_IFSOCK)  /* socket */
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#define        ACCESSPERMS     (S_IRWXU|S_IRWXG|S_IRWXO)       /* 0777 */
+                                                       /* 7777 */
+#define        ALLPERMS        (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
+                                                       /* 0666 */
+#define        DEFFILEMODE     (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
 
 #define S_BLKSIZE      512             /* block size used in the stat struct */
 
-/* Traditional mask definitions for st_mode. */
-#define S_IFMT   0170000       /* type of file */
-#define S_IFSOCK 0140000        /* socket */
-#define S_IFLNK  0120000       /* symbolic link */
-#define S_IFREG  0100000       /* regular */
-#define S_IFBLK  0060000       /* block special */
-#define S_IFDIR  0040000       /* directory */
-#define S_IFCHR  0020000       /* character special */
-#define S_IFIFO  0010000       /* this is a FIFO */
-#define S_ISUID  0004000       /* set user id on execution */
-#define S_ISGID  0002000       /* set group id on execution */
-#define S_ISVTX  0001000       /* save swapped text even after use */
-
-/* POSIX masks for st_mode. */
-#define S_IRWXU   00700                /* owner:  rwx------ */
-#define S_IRUSR   00400                /* owner:  r-------- */
-#define S_IWUSR   00200                /* owner:  -w------- */
-#define S_IXUSR   00100                /* owner:  --x------ */
-
-#define S_IRWXG   00070                /* group:  ---rwx--- */
-#define S_IRGRP   00040                /* group:  ---r----- */
-#define S_IWGRP   00020                /* group:  ----w---- */
-#define S_IXGRP   00010                /* group:  -----x--- */
-
-#define S_IRWXO   00007                /* others: ------rwx */
-#define S_IROTH   00004                /* others: ------r-- */ 
-#define S_IWOTH   00002                /* others: -------w- */
-#define S_IXOTH   00001                /* others: --------x */
-
-/* Synonyms for above. */
-#define S_IEXEC                S_IXUSR
-#define S_IWRITE       S_IWUSR
-#define S_IREAD                S_IRUSR
-
-/* The following macros test st_mode (from POSIX Sec. 5.6.1.1). */
-#define S_ISREG(m)     (((m) & S_IFMT) == S_IFREG)     /* is a reg file */
-#define S_ISDIR(m)     (((m) & S_IFMT) == S_IFDIR)     /* is a directory */
-#define S_ISCHR(m)     (((m) & S_IFMT) == S_IFCHR)     /* is a char spec */
-#define S_ISBLK(m)     (((m) & S_IFMT) == S_IFBLK)     /* is a block spec */
-#define S_ISLNK(m)     (((m) & S_IFMT) == S_IFLNK)     /* is a symlink */
-#define S_ISFIFO(m)    (((m) & S_IFMT) == S_IFIFO)     /* is a pipe/FIFO */
-#define S_ISSOCK(m)     (((m) & S_IFMT) == S_IFSOCK)   /* is a socket */
-
-#define DEFFILEMODE     (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
-#define ALLPERMS        (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)
-
-/* Function Prototypes. */
-_PROTOTYPE( int chmod, (const char *_path, mode_t _mode)               );
-_PROTOTYPE( int fchmod, (int fd, mode_t _mode)                 );
-_PROTOTYPE( int fstat, (int _fildes, struct stat *_buf)                        );
-_PROTOTYPE( int mkdir, (const char *_path, mode_t _mode)               );
-_PROTOTYPE( int mkfifo, (const char *_path, mode_t _mode)              );
-_PROTOTYPE( int stat, (const char *_path, struct stat *_buf)           );
-_PROTOTYPE( mode_t umask, (mode_t _cmask)                              );
-
-/* Open Group Base Specifications Issue 6 (not complete) */
-_PROTOTYPE( int lstat, (const char *_path, struct stat *_buf)          );
-
-#endif /* _STAT_H */
+/*
+ * Definitions of flags stored in file flags word.
+ *
+ * Super-user and owner changeable flags.
+ */
+#define        UF_SETTABLE     0x0000ffff      /* mask of owner changeable flags */
+#define        UF_NODUMP       0x00000001      /* do not dump file */
+#define        UF_IMMUTABLE    0x00000002      /* file may not be changed */
+#define        UF_APPEND       0x00000004      /* writes to file may only append */
+#define UF_OPAQUE      0x00000008      /* directory is opaque wrt. union */
+
+/*
+ * Super-user changeable flags.
+ */
+#define        SF_SETTABLE     0xffff0000      /* mask of superuser changeable flags */
+#define        SF_ARCHIVED     0x00010000      /* file is archived */
+#define        SF_IMMUTABLE    0x00020000      /* file may not be changed */
+#define        SF_APPEND       0x00040000      /* writes to file may only append */
+
+#endif /* _NETBSD_SOURCE */
+
+#if defined(__minix)
+#include <machine/vmparam.h>
+/* Convenient constant to use when st_blocksize field is required. */
+#define MINIX_ST_BLKSIZE PAGE_SIZE
+#endif
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+int    chmod(const char *, mode_t);
+int    mkdir(const char *, mode_t);
+int    mkfifo(const char *, mode_t);
+#ifndef __LIBC12_SOURCE__
+int    stat(const char *, struct stat *) __RENAME(__stat50);
+int    fstat(int, struct stat *) __RENAME(__fstat50);
+#endif
+mode_t umask(mode_t);
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+int    fchmod(int, mode_t);
+#ifndef __LIBC12_SOURCE__
+int    lstat(const char *, struct stat *) __RENAME(__lstat50);
+int    mknod(const char *, mode_t, dev_t) __RENAME(__mknod50);
+#endif
+#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
+__END_DECLS
+
+#endif /* !_SYS_STAT_H_ */
index 30bf979368dfb4ce14aa1b37d57f40037e2bc134..064f0eb566b92a30eb8c1f0462d66a681a7c9d9e 100644 (file)
@@ -3,14 +3,13 @@
 #ifndef _STATFS_H
 #define _STATFS_H
 
-#ifndef _TYPES_H
-#include <minix/types.h>
-#endif
+#include <sys/cdefs.h>
+#include <sys/types.h>
 
 struct statfs {
   off_t f_bsize;               /* file system block size */
 };
 
-_PROTOTYPE( int fstatfs, (int fd, struct statfs *st)           );
+int fstatfs(int fd, struct statfs *st);
 
 #endif /* _STATFS_H */
index dfeedaf645f96bee1154671ea1c66581240f3c1a..b68d3dc1c88bd77b07310f84a54503aa70d3769b 100644 (file)
@@ -1,12 +1,35 @@
-/* Statvfs implementation corresponding to:
- * http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/statvfs.h.html
- */
+#ifndef        _SYS_STATVFS_H_
+#define        _SYS_STATVFS_H_
 
-#ifndef _STATVFS_H
-#define _STATVFS_H
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/stdint.h>
+#include <machine/ansi.h>
+#include <sys/ansi.h>
 
-#include <minix/types.h>
+#define        _VFS_NAMELEN    32
+#define        _VFS_MNAMELEN   1024
 
+#ifndef        fsblkcnt_t
+typedef        __fsblkcnt_t    fsblkcnt_t;     /* fs block count (statvfs) */
+#define        fsblkcnt_t      __fsblkcnt_t
+#endif
+
+#ifndef        fsfilcnt_t
+typedef        __fsfilcnt_t    fsfilcnt_t;     /* fs file count */
+#define        fsfilcnt_t      __fsfilcnt_t
+#endif
+
+#ifndef        uid_t
+typedef        __uid_t         uid_t;          /* user id */
+#define        uid_t           __uid_t
+#endif
+
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_            size_t;
+#define        _SIZE_T
+#undef _BSD_SIZE_T_
+#endif
 
 struct statvfs {
        unsigned long f_bsize;  /* File system block size. */
@@ -26,14 +49,16 @@ struct statvfs {
        unsigned char __padding[32]; /* Padding for future compatibility */
 };
 
-_PROTOTYPE( int fstatvfs, (int fd, struct statvfs *st)             );
-_PROTOTYPE( int statvfs,  (const char *path, struct statvfs *st));
-
 /* Possible values for statvfs->f_flag */
-#define ST_RDONLY      0x001   /* Read-only file system */
-#define ST_NOSUID      0x002   /* Does not support the semantics of the
-                                * ST_ISUID and ST_ISGID file mode bits. */
-#define ST_NOTRUNC     0x004   /* File system does not truncate file names
-                                * longer than NAME_MAX */
+#define ST_RDONLY 0x1
+#define ST_NOSUID 0x2
+#ifdef __minix
+#define ST_NOTRUNC 0x4
+#endif /* !__minix*/
+
+__BEGIN_DECLS
+int    statvfs(const char *__restrict, struct statvfs *__restrict);
+int    fstatvfs(int, struct statvfs *);
+__END_DECLS
 
-#endif /* _STAVTFS_H */
+#endif /* _SYS_STATVFS_H_ */
index b4feedde03f0cc92828d94b91e13785705a15ede..d7b1e707a9895ef75c177ac94d4e4cf8c1224c67 100644 (file)
-/*
-sys/time.h
-*/
+#ifndef _SYS_TIME_H_
+#define        _SYS_TIME_H_
 
-#ifndef _SYS__TIME_H
-#define _SYS__TIME_H
+#include <sys/featuretest.h>
+#include <sys/types.h>
 
-#include <minix/ansi.h>
+/*
+ * Structure returned by gettimeofday(2) system call,
+ * and used in other calls.
+ */
+struct timeval {
+       time_t          tv_sec;         /* seconds */
+       suseconds_t     tv_usec;        /* and microseconds */
+};
 
-/* Open Group Base Specifications Issue 6 (not complete) */
-struct timeval
-{
-       long /*time_t*/ tv_sec;
-       long /*useconds_t*/ tv_usec;
+/*
+ * Structure defined by POSIX.1b to be like a timeval.
+ */
+struct timespec {
+       time_t  tv_sec;         /* seconds */
+       long    tv_nsec;        /* and nanoseconds */
 };
 
+#if defined(_NETBSD_SOURCE)
+#define        TIMEVAL_TO_TIMESPEC(tv, ts) do {                                \
+       (ts)->tv_sec = (tv)->tv_sec;                                    \
+       (ts)->tv_nsec = (tv)->tv_usec * 1000;                           \
+} while (/*CONSTCOND*/0)
+#define        TIMESPEC_TO_TIMEVAL(tv, ts) do {                                \
+       (tv)->tv_sec = (ts)->tv_sec;                                    \
+       (tv)->tv_usec = (suseconds_t)(ts)->tv_nsec / 1000;              \
+} while (/*CONSTCOND*/0)
+
+/*
+ * Note: timezone is obsolete. All timezone handling is now in
+ * userland. Its just here for back compatibility.
+ */
 struct timezone {
-       int     tz_minuteswest; /* minutes west of Greenwich */
-       int     tz_dsttime;     /* type of dst correction */
+       int     tz_minuteswest; /* minutes west of Greenwich */
+       int     tz_dsttime;     /* type of dst correction */
 };
 
 /* Operations on timevals. */
-#define timerclear(tp) (tp)->tv_sec = (tp)->tv_usec = 0L
-#define timerisset(tp) ((tp)->tv_sec || (tp)->tv_usec)
+#define        timerclear(tvp)         (tvp)->tv_sec = (tvp)->tv_usec = 0L
+#define        timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
+#define        timercmp(tvp, uvp, cmp)                                         \
+       (((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
+           ((tvp)->tv_usec cmp (uvp)->tv_usec) :                       \
+           ((tvp)->tv_sec cmp (uvp)->tv_sec))
+#define        timeradd(tvp, uvp, vvp)                                         \
+       do {                                                            \
+               (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;          \
+               (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;       \
+               if ((vvp)->tv_usec >= 1000000) {                        \
+                       (vvp)->tv_sec++;                                \
+                       (vvp)->tv_usec -= 1000000;                      \
+               }                                                       \
+       } while (/* CONSTCOND */ 0)
+#define        timersub(tvp, uvp, vvp)                                         \
+       do {                                                            \
+               (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;          \
+               (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;       \
+               if ((vvp)->tv_usec < 0) {                               \
+                       (vvp)->tv_sec--;                                \
+                       (vvp)->tv_usec += 1000000;                      \
+               }                                                       \
+       } while (/* CONSTCOND */ 0)
+
+
+/*
+ * hide bintime for _STANDALONE because this header is used for hpcboot.exe,
+ * which is built with compilers which don't recognize LL suffix.
+ *     http://mail-index.NetBSD.org/tech-userlevel/2008/02/27/msg000181.html
+ */
+#if !defined(_STANDALONE)
+struct bintime {
+       time_t  sec;
+       uint64_t frac;
+};
+
+static __inline void
+bintime_addx(struct bintime *bt, uint64_t x)
+{
+       uint64_t u;
+
+       u = bt->frac;
+       bt->frac += x;
+       if (u > bt->frac)
+               bt->sec++;
+}
+
+static __inline void
+bintime_add(struct bintime *bt, const struct bintime *bt2)
+{
+       uint64_t u;
+
+       u = bt->frac;
+       bt->frac += bt2->frac;
+       if (u > bt->frac)
+               bt->sec++;
+       bt->sec += bt2->sec;
+}
 
-int gettimeofday(struct timeval *_RESTRICT tp, void *_RESTRICT tzp);
+static __inline void
+bintime_sub(struct bintime *bt, const struct bintime *bt2)
+{
+       uint64_t u;
 
-/* Compatibility with other Unix systems */
-int settimeofday(const struct timeval *tp, const void *tzp);
+       u = bt->frac;
+       bt->frac -= bt2->frac;
+       if (u < bt->frac)
+               bt->sec--;
+       bt->sec -= bt2->sec;
+}
 
-/* setitimer/getitimer interface */
-struct itimerval
+/*-
+ * Background information:
+ *
+ * When converting between timestamps on parallel timescales of differing
+ * resolutions it is historical and scientific practice to round down rather
+ * than doing 4/5 rounding.
+ *
+ *   The date changes at midnight, not at noon.
+ *
+ *   Even at 15:59:59.999999999 it's not four'o'clock.
+ *
+ *   time_second ticks after N.999999999 not after N.4999999999
+ */
+
+static __inline void
+bintime2timespec(const struct bintime *bt, struct timespec *ts)
 {
-       struct timeval it_interval;
-       struct timeval it_value;
+
+       ts->tv_sec = bt->sec;
+       ts->tv_nsec =
+           (long)(((uint64_t)1000000000 * (uint32_t)(bt->frac >> 32)) >> 32);
+}
+
+static __inline void
+timespec2bintime(const struct timespec *ts, struct bintime *bt)
+{
+
+       bt->sec = ts->tv_sec;
+       /* 18446744073 = int(2^64 / 1000000000) */
+       bt->frac = ts->tv_nsec * (uint64_t)18446744073LL; 
+}
+
+static __inline void
+bintime2timeval(const struct bintime *bt, struct timeval *tv)
+{
+
+       tv->tv_sec = bt->sec;
+       tv->tv_usec =
+           (suseconds_t)(((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32);
+}
+
+static __inline void
+timeval2bintime(const struct timeval *tv, struct bintime *bt)
+{
+
+       bt->sec = tv->tv_sec;
+       /* 18446744073709 = int(2^64 / 1000000) */
+       bt->frac = tv->tv_usec * (uint64_t)18446744073709LL;
+}
+#endif /* !defined(_STANDALONE) */
+
+/* Operations on timespecs. */
+#define        timespecclear(tsp)      (tsp)->tv_sec = (time_t)((tsp)->tv_nsec = 0L)
+#define        timespecisset(tsp)      ((tsp)->tv_sec || (tsp)->tv_nsec)
+#define        timespeccmp(tsp, usp, cmp)                                      \
+       (((tsp)->tv_sec == (usp)->tv_sec) ?                             \
+           ((tsp)->tv_nsec cmp (usp)->tv_nsec) :                       \
+           ((tsp)->tv_sec cmp (usp)->tv_sec))
+#define        timespecadd(tsp, usp, vsp)                                      \
+       do {                                                            \
+               (vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec;          \
+               (vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec;       \
+               if ((vsp)->tv_nsec >= 1000000000L) {                    \
+                       (vsp)->tv_sec++;                                \
+                       (vsp)->tv_nsec -= 1000000000L;                  \
+               }                                                       \
+       } while (/* CONSTCOND */ 0)
+#define        timespecsub(tsp, usp, vsp)                                      \
+       do {                                                            \
+               (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;          \
+               (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;       \
+               if ((vsp)->tv_nsec < 0) {                               \
+                       (vsp)->tv_sec--;                                \
+                       (vsp)->tv_nsec += 1000000000L;                  \
+               }                                                       \
+       } while (/* CONSTCOND */ 0)
+#define timespec2ns(x) (((uint64_t)(x)->tv_sec) * 1000000000L + (x)->tv_nsec)
+#endif /* _NETBSD_SOURCE */
+
+/*
+ * Names of the interval timers, and structure
+ * defining a timer setting.
+ */
+#define        ITIMER_REAL     0
+#define        ITIMER_VIRTUAL  1
+#define        ITIMER_PROF     2
+
+struct itimerval {
+       struct  timeval it_interval;    /* timer interval */
+       struct  timeval it_value;       /* current value */
 };
 
-#define ITIMER_REAL 0
-#define ITIMER_VIRTUAL 1       /* Not implemented */
-#define ITIMER_PROF 2          /* Not implemented */
+/*
+ * Structure defined by POSIX.1b to be like a itimerval, but with
+ * timespecs. Used in the timer_*() system calls.
+ */
+struct itimerspec {
+       struct  timespec it_interval;
+       struct  timespec it_value;
+};
 
-int getitimer(int which, struct itimerval *value);
-int setitimer(int which, const struct itimerval *_RESTRICT value,
-               struct itimerval *_RESTRICT ovalue);
+#ifndef __minix
+#define        CLOCK_REALTIME  0
+#define        CLOCK_VIRTUAL   1
+#define        CLOCK_PROF      2
+#define        CLOCK_MONOTONIC 3
+#endif
 
+#if defined(_NETBSD_SOURCE)
+#define        TIMER_RELTIME   0x0     /* relative timer */
+#endif
+#define        TIMER_ABSTIME   0x1     /* absolute timer */
+
+#ifdef _KERNEL
+#include <sys/timevar.h>
+#else /* !_KERNEL */
+#ifndef _STANDALONE
+#if (_POSIX_C_SOURCE - 0) >= 200112L || \
+    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
 #include <sys/select.h>
+#endif
+
+#include <sys/cdefs.h>
+#include <time.h>
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+#if (_POSIX_C_SOURCE - 0) >= 200112L || \
+    defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+int    getitimer(int, struct itimerval *) __RENAME(__getitimer50);
+int    gettimeofday(struct timeval * __restrict, void *__restrict);
+int    setitimer(int, const struct itimerval * __restrict,
+           struct itimerval * __restrict) __RENAME(__setitimer50);
+#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
+#ifndef __minix
+int    adjtime(const struct timeval *, struct timeval *) __RENAME(__adjtime50);
+int    futimes(int, const struct timeval [2]) __RENAME(__futimes50);
+int    lutimes(const char *, const struct timeval [2]) __RENAME(__lutimes50);
+#endif /* !__minix */
+int    settimeofday(const struct timeval * __restrict,
+           const void *__restrict) __RENAME(__settimeofday50);
+#endif /* _NETBSD_SOURCE */
+#endif /* __LIBC12_SOURCE__ */
+__END_DECLS
 
-#endif /* _SYS__TIME_H */
+#endif /* !_STANDALONE */
+#endif /* !_KERNEL */
+#endif /* !_SYS_TIME_H_ */
diff --git a/include/sys/timeb.h b/include/sys/timeb.h
deleted file mode 100644 (file)
index b78d109..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _SYS__TIMEB_H
-#define _SYS__TIMEB_H
-
-#include <time.h>
-
-struct timeb
-{
-       time_t time;                /* Seconds since epoch, as from `time'.  */
-       unsigned short int millitm; /* Additional milliseconds.  */
-       short int timezone;         /* Minutes west of GMT.  */
-       short int dstflag;          /* Nonzero if Daylight Savings Time used.  */
-};
-
-/* Fill in TIMEBUF with information about the current time.  */
-
-_PROTOTYPE( int ftime, (struct timeb *__timebuf));
-
-#endif /* _SYS__TIMEB_H */
index 2966d1aa28ca2177942103c07bf76d9d539a82ad..c90a2835d08fb19d2884f587975ae791e8e427ea 100644 (file)
@@ -1,25 +1,24 @@
-/* The <times.h> header is for time times() system call. */
+#ifndef        _SYS_TIMES_H_
+#define        _SYS_TIMES_H_
 
-#ifndef _TIMES_H
-#define _TIMES_H
+#include <machine/ansi.h>
 
-#ifndef _CLOCK_T
-#define _CLOCK_T
-typedef long clock_t;          /* unit for system accounting */
+#ifdef _BSD_CLOCK_T_
+typedef        _BSD_CLOCK_T_   clock_t;
+#undef _BSD_CLOCK_T_
 #endif
 
 struct tms {
-  clock_t tms_utime;
-  clock_t tms_stime;
-  clock_t tms_cutime;
-  clock_t tms_cstime;
+       clock_t tms_utime;      /* User CPU time */
+       clock_t tms_stime;      /* System CPU time */
+       clock_t tms_cutime;     /* User CPU time of terminated child procs */
+       clock_t tms_cstime;     /* System CPU time of terminated child procs */
 };
 
-/* Function Prototypes. */
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
+#include <sys/cdefs.h>
 
-_PROTOTYPE( clock_t times, (struct tms *_buffer)                       );
+__BEGIN_DECLS
+clock_t times(struct tms *);
+__END_DECLS
 
-#endif /* _TIMES_H */
+#endif /* !_SYS_TIMES_H_ */
similarity index 100%
rename from nbsd_include/sys/tree.h
rename to include/sys/tree.h
index f56544c02d362bc839fc23f7b0a206097319b0f6..9dcf4fd9db5628ad645c610bbe5e0b4beb24dca0 100644 (file)
-#ifndef _INCLUDE_SYS_TYPE_H
-#define _INCLUDE_SYS_TYPE_H
+/*     $NetBSD: types.h,v 1.86 2009/03/07 21:59:25 ad Exp $    */
+
+/*-
+ * Copyright (c) 1982, 1986, 1991, 1993, 1994
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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. 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.
+ *
+ *     @(#)types.h     8.4 (Berkeley) 1/21/94
+ */
+
+#ifndef _SYS_TYPES_H_
+#define        _SYS_TYPES_H_
+
+#include <sys/featuretest.h>
+
+/* Machine type dependent parameters. */
+#include <machine/types.h>
+
+#include <machine/ansi.h>
+#include <machine/int_types.h>
+
+#include <sys/ansi.h>
+
+#ifndef        int8_t
+typedef        __int8_t        int8_t;
+#define        int8_t          __int8_t
+#endif
+
+#ifndef        uint8_t
+typedef        __uint8_t       uint8_t;
+#define        uint8_t         __uint8_t
+#endif
+
+#ifndef        int16_t
+typedef        __int16_t       int16_t;
+#define        int16_t         __int16_t
+#endif
+
+#ifndef        uint16_t
+typedef        __uint16_t      uint16_t;
+#define        uint16_t        __uint16_t
+#endif
+
+#ifndef        int32_t
+typedef        __int32_t       int32_t;
+#define        int32_t         __int32_t
+#endif
+
+#ifndef        uint32_t
+typedef        __uint32_t      uint32_t;
+#define        uint32_t        __uint32_t
+#endif
+
+#ifndef        int64_t
+typedef        __int64_t       int64_t;
+#define        int64_t         __int64_t
+#endif
+
+#ifndef        uint64_t
+typedef        __uint64_t      uint64_t;
+#define        uint64_t        __uint64_t
+#endif
+
+typedef        uint8_t         u_int8_t;
+typedef        uint16_t        u_int16_t;
+typedef        uint32_t        u_int32_t;
+typedef        uint64_t        u_int64_t;
+
+#ifdef __minix
+typedef uint8_t        u8_t;
+typedef uint16_t       u16_t;
+typedef uint32_t       u32_t;
+typedef uint64_t       u64_t;
+
+typedef int8_t         i8_t;
+typedef int16_t                i16_t;
+typedef int32_t                i32_t;
+typedef int64_t                i64_t;
+
+typedef uint64_t       big_ino_t;
+typedef int64_t                big_off_t;
+typedef u32_t          big_dev_t;
+typedef u32_t          big_gid_t;
+typedef u32_t          big_mode_t;
+typedef u32_t          big_nlink_t;
+typedef u32_t          big_uid_t;
+
+
+/* some Minix specific types that do not conflict with posix */
+typedef u32_t zone_t;      /* zone number */
+typedef u32_t block_t;     /* block number */
+typedef u32_t bit_t;       /* bit number in a bit map */
+typedef u16_t zone1_t;     /* zone number for V1 file systems */
+typedef u32_t bitchunk_t; /* collection of bits in a bitmap */
+
+/* ANSI C makes writing down the promotion of unsigned types very messy.  When
+ * sizeof(short) == sizeof(int), there is no promotion, so the type stays
+ * unsigned.  When the compiler is not ANSI, there is usually no loss of
+ * unsignedness, and there are usually no prototypes so the promoted type
+ * doesn't matter.  The use of types like Ino_t is an attempt to use ints
+ * (which are not promoted) while providing information to the reader.
+ */
+
+typedef unsigned long  Ino_t;
+
+#endif /* __minix */
+
+#include <machine/endian.h>
+
+#if defined(_NETBSD_SOURCE)
+typedef        unsigned char   u_char;
+typedef        unsigned short  u_short;
+typedef        unsigned int    u_int;
+typedef        unsigned long   u_long;
+
+typedef unsigned char  unchar;         /* Sys V compatibility */
+typedef        unsigned short  ushort;         /* Sys V compatibility */
+typedef        unsigned int    uint;           /* Sys V compatibility */
+typedef unsigned long  ulong;          /* Sys V compatibility */
+#endif
+
+typedef        uint64_t        u_quad_t;       /* quads */
+typedef        int64_t         quad_t;
+typedef        quad_t *        qaddr_t;
 
 /*
- * this files resolves conflicts between the file of the host system and
- * the minix specific one. This file is included directly only on Minix
- * and it is an error to do so on any other system
+ * The types longlong_t and u_longlong_t exist for use with the
+ * Sun-derived XDR routines involving these types, and their usage
+ * in other contexts is discouraged.  Further note that these types
+ * may not be equivalent to "long long" and "unsigned long long",
+ * they are only guaranteed to be signed and unsigned 64-bit types
+ * respectively.  Portable programs that need 64-bit types should use
+ * the C99 types int64_t and uint64_t instead.
  */
 
-#if !defined(_MINIX) && !defined(__minix) && !defined(__ACK__)
-#error "Including Minix specific file in program targeted for other system"
+typedef        int64_t         longlong_t;     /* for XDR */
+typedef        uint64_t        u_longlong_t;   /* for XDR */
+
+typedef        int64_t         blkcnt_t;       /* fs block count */
+typedef        uint32_t        blksize_t;      /* fs optimal block size */
+
+#ifndef        fsblkcnt_t
+typedef        __fsblkcnt_t    fsblkcnt_t;     /* fs block count (statvfs) */
+#define fsblkcnt_t     __fsblkcnt_t
+#endif
+
+#ifndef        fsfilcnt_t
+typedef        __fsfilcnt_t    fsfilcnt_t;     /* fs file count */
+#define fsfilcnt_t     __fsfilcnt_t
+#endif
+
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+/* We don't and shouldn't use caddr_t in the kernel anymore */
+#ifndef        caddr_t
+typedef        __caddr_t       caddr_t;        /* core address */
+#define        caddr_t         __caddr_t
+#endif
+#endif
+
+#ifdef __daddr_t
+typedef        __daddr_t       daddr_t;        /* disk address */
+#undef __daddr_t
 #else
-#include <minix/types.h>
+typedef        int64_t         daddr_t;        /* disk address */
+#endif
+
+
+typedef        uint32_t        dev_t;          /* device number */
+typedef        uint32_t        fixpt_t;        /* fixed point number */
+
+#ifndef        gid_t
+typedef        __gid_t         gid_t;          /* group id */
+#define        gid_t           __gid_t
 #endif
 
+typedef        int             idtype_t;       /* type of the id */
+typedef        uint32_t        id_t;           /* group id, process id or user id */
+typedef        unsigned long   ino_t;          /* inode number */
+typedef        long            key_t;          /* IPC key (for Sys V IPC) */
+
+#ifndef        mode_t
+typedef        __mode_t        mode_t;         /* permissions */
+#define        mode_t          __mode_t
+#endif
+
+typedef        short           nlink_t;        /* link count */
+
+#ifndef        off_t
+typedef        __off_t         off_t;          /* file offset */
+#define        off_t           __off_t
 #endif
+
+#ifndef        pid_t
+typedef        __pid_t         pid_t;          /* process id */
+#define        pid_t           __pid_t
+#endif
+
+typedef int32_t                lwpid_t;        /* LWP id */
+typedef unsigned long  rlim_t;         /* resource limit */
+typedef        int32_t         segsz_t;        /* segment size */
+typedef        int32_t         swblk_t;        /* swap offset */
+
+#ifndef        uid_t
+typedef        __uid_t         uid_t;          /* user id */
+#define        uid_t           __uid_t
+#endif
+
+
+typedef int            mqd_t;
+
+typedef        unsigned long   cpuid_t;
+
+typedef        int             psetid_t;
+
+#if defined(_KERNEL) || defined(_STANDALONE)
+/*
+ * Boolean type definitions for the kernel environment.  User-space
+ * boolean definitions are found in <stdbool.h>.
+ */
+#define bool   _Bool
+#define true   1
+#define false  0
+
+/*
+ * Deprecated Mach-style boolean_t type.  Should not be used by new code.
+ */
+typedef int    boolean_t;
+#ifndef TRUE
+#define        TRUE    1
+#endif
+#ifndef FALSE
+#define        FALSE   0
+#endif
+
+#endif /* _KERNEL || _STANDALONE */
+
+#if defined(_KERNEL) || defined(_LIBC)
+/*
+ * semctl(2)'s argument structure.  This is here for the benefit of
+ * <sys/syscallargs.h>.  It is not in the user's namespace in SUSv2.
+ * The SUSv2 semctl(2) takes variable arguments.
+ */
+union __semun {
+       int             val;            /* value for SETVAL */
+       struct semid_ds *buf;           /* buffer for IPC_STAT & IPC_SET */
+       unsigned short  *array;         /* array for GETALL & SETALL */
+};
+#include <sys/stdint.h>
+#endif /* _KERNEL || _LIBC */
+
+/*
+ * These belong in unistd.h, but are placed here too to ensure that
+ * long arguments will be promoted to off_t if the program fails to
+ * include that header or explicitly cast them to off_t.
+ */
+#if defined(_NETBSD_SOURCE)
+#ifndef __OFF_T_SYSCALLS_DECLARED
+#define __OFF_T_SYSCALLS_DECLARED
+#ifndef _KERNEL
+#include <sys/cdefs.h>
+__BEGIN_DECLS
+off_t   lseek(int, off_t, int);
+int     ftruncate(int, off_t);
+int     truncate(const char *, off_t);
+__END_DECLS
+#endif /* !_KERNEL */
+#endif /* __OFF_T_SYSCALLS_DECLARED */
+#endif /* defined(_NETBSD_SOURCE) */
+
+#if defined(_NETBSD_SOURCE)
+typedef int32_t __devmajor_t, __devminor_t;
+#define devmajor_t __devmajor_t
+#define devminor_t __devminor_t
+#define NODEVMAJOR (-1)
+
+/* Major, minor numbers, dev_t's. */
+#define MAJOR              8    /* major device = (dev>>MAJOR) & 0377 */
+#define MINOR              0    /* minor device = (dev>>MINOR) & 0377 */
+#define minor(dev)      ((devminor_t)(((dev) >> MINOR) & 0xff))
+#define major(dev)      ((devmajor_t)(((dev) >> MAJOR) & 0xff))
+#define makedev(major, minor)   \
+                        ((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
+
+#endif
+
+#ifdef _BSD_CLOCK_T_
+typedef        _BSD_CLOCK_T_           clock_t;
+#undef _BSD_CLOCK_T_
+#endif
+
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_            size_t;
+#define _SIZE_T
+#undef _BSD_SIZE_T_
+#endif
+
+#ifdef _BSD_SSIZE_T_
+typedef        _BSD_SSIZE_T_           ssize_t;
+#undef _BSD_SSIZE_T_
+#endif
+
+#ifdef _BSD_TIME_T_
+typedef        _BSD_TIME_T_            time_t;
+#undef _BSD_TIME_T_
+#endif
+
+#ifdef _BSD_CLOCKID_T_
+typedef        _BSD_CLOCKID_T_         clockid_t;
+#undef _BSD_CLOCKID_T_
+#endif
+
+#ifndef __minix
+#ifdef _BSD_TIMER_T_
+typedef        _BSD_TIMER_T_           timer_t;
+#undef _BSD_TIMER_T_
+#endif
+#endif
+
+#ifdef _BSD_SUSECONDS_T_
+typedef        _BSD_SUSECONDS_T_       suseconds_t;
+#undef _BSD_SUSECONDS_T_
+#endif
+
+#ifdef _BSD_USECONDS_T_
+typedef        _BSD_USECONDS_T_        useconds_t;
+#undef _BSD_USECONDS_T_
+#endif
+
+#ifdef _NETBSD_SOURCE
+#include <sys/fd_set.h>
+#define        NBBY    __NBBY
+
+typedef struct kauth_cred *kauth_cred_t;
+
+typedef int pri_t;
+
+#endif
+
+#if defined(__STDC__) && (defined(_KERNEL) || defined(_KMEMUSER))
+/*
+ * Forward structure declarations for function prototypes.  We include the
+ * common structures that cross subsystem boundaries here; others are mostly
+ * used in the same place that the structure is defined.
+ */
+struct lwp;
+typedef struct lwp lwp_t;
+struct user;
+struct __ucontext;
+struct proc;
+typedef struct proc proc_t;
+struct pgrp;
+struct rusage;
+struct file;
+typedef struct file file_t;
+struct buf;
+typedef struct buf buf_t;
+struct tty;
+struct uio;
+#endif
+
+#ifdef _KERNEL
+#define SET(t, f)      ((t) |= (f))
+#define        ISSET(t, f)     ((t) & (f))
+#define        CLR(t, f)       ((t) &= ~(f))
+#endif
+
+#ifndef __minix
+#if !defined(_KERNEL) && !defined(_STANDALONE)
+#if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#include <pthread_types.h>
+#endif
+#endif
+#endif /* !__minix */
+
+#endif /* !_SYS_TYPES_H_ */
index 446ff84e66eb7125dd883b8aad6460b4431e4151..dc2d293c94687c7d688d5ede241d2090abfcad6e 100644 (file)
@@ -1,15 +1,11 @@
-#ifndef _SYS_UCONTEXT_H
-#define _SYS_UCONTEXT_H 1
+#ifndef _SYS_UCONTEXT_H_
+#define _SYS_UCONTEXT_H_
 
-#include <signal.h>
+#include <sys/sigtypes.h>
 #include <machine/mcontext.h>
 
-#define NCARGS 6
-
-#define UCF_SWAPPED    001 /* Context has been swapped in by swapcontext(3) */
-#define UCF_IGNFPU     002 /* Ignore FPU context by get or setcontext(3) */
-#define UCF_IGNSIGM    004 /* Ignore signal mask by get or setcontext(3) */
 typedef struct __ucontext ucontext_t;
+
 struct __ucontext {
   unsigned int uc_flags;  /* Properties of ucontext */
   ucontext_t *uc_link;    /* Next context to resume when current is finished */
@@ -18,5 +14,25 @@ struct __ucontext {
   stack_t uc_stack;       /* The stack used by this context */
 };
 
-#endif /* _SYS_UCONTEXT_H */
+#ifndef _UC_UCONTEXT_ALIGN
+#define _UC_UCONTEXT_ALIGN (~0)
+#endif
+
+#define UCF_SWAPPED    001 /* Context has been swapped in by swapcontext(3) */
+#define UCF_IGNFPU     002 /* Ignore FPU context by get or setcontext(3) */
+#define UCF_IGNSIGM    004 /* Ignore signal mask by get or setcontext(3) */
+
+#define NCARGS 6
+
+#ifdef __minix
+__BEGIN_DECLS
+void resumecontext(ucontext_t *ucp);
+
+/* These functions get and set ucontext structure through PM/kernel. They don't
+ * manipulate the stack. */
+int getuctx(ucontext_t *ucp);
+int setuctx(const ucontext_t *ucp);
+__END_DECLS
+#endif /* __minix */
 
+#endif /* !_SYS_UCONTEXT_H_ */
index 5babf6fb5b93d95088bbfab9928d3aaf3708a812..3dfe8c1e2f09bcbdf8375e988b4f860c8c87cc6e 100644 (file)
@@ -5,14 +5,23 @@ struct ucred_old
 {
        pid_t   pid;
        short   uid;
-       char    gid;
+       char   gid;
 };
 
 struct ucred
 {
-       pid_t   pid;
-       uid_t   uid;
-       gid_t   gid;
+       pid_t   pid;
+       uid_t   uid;
+       gid_t   gid;
+};
+
+/* Userland's view of credentials. This should not change */
+struct uucred {
+        unsigned short  cr_unused;              /* not used, compat */
+        uid_t           cr_uid;                 /* effective user id */
+        gid_t           cr_gid;                 /* effective group id */
+        short           cr_ngroups;             /* number of groups */
+        gid_t           cr_groups[NGROUPS_MAX];     /* groups */
 };
 
 #endif
index d4dba19a3878b09c9eb5638ef73478bb992ba5fd..f85a2d18515dc3d79583fc3f077c56e47090da32 100644 (file)
@@ -1,23 +1,37 @@
-/*
-sys/uio.h
+#ifndef _SYS_UIO_H_
+#define        _SYS_UIO_H_
 
-definitions for vector I/O operations
-*/
+#include <machine/ansi.h>
+#include <sys/featuretest.h>
 
-#ifndef _SYS_UIO_H
-#define _SYS_UIO_H
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
+#endif
 
-/* Open Group Base Specifications Issue 6 (not complete) */
+#ifdef _BSD_SSIZE_T_
+typedef        _BSD_SSIZE_T_   ssize_t;
+#undef _BSD_SSIZE_T_
+#endif
 
-struct iovec
-{
-       void    *iov_base;
-       size_t  iov_len;
+struct iovec {
+       void    *iov_base;      /* Base address. */
+       size_t   iov_len;       /* Length. */
 };
 
-_PROTOTYPE(ssize_t readv, (int _fildes, const struct iovec *_iov,
-                                                       int _iovcnt)    );
-_PROTOTYPE(ssize_t writev, (int _fildes, const struct iovec *_iov,
-                                                       int iovcnt)     );
+#if defined(_NETBSD_SOURCE)
+/*
+ * Limits
+ */
+/* Deprecated: use IOV_MAX from <limits.h> instead. */
+#define UIO_MAXIOV     1024            /* max 1K of iov's */
+#endif /* _NETBSD_SOURCE */
+
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+ssize_t        readv(int, const struct iovec *, int);
+ssize_t        writev(int, const struct iovec *, int);
+__END_DECLS
 
-#endif /* _SYS_UIO_H */
+#endif /* !_SYS_UIO_H_ */
index 707316b6bd867da70f2394558e9d805da7f9b75f..c3c4b71fe524a0ef6c48eac62033bc2781759359 100644 (file)
@@ -1,18 +1,21 @@
-#ifndef SYS_UN_H
-#define SYS_UN_H
+#ifndef _SYS_UN_H_
+#define _SYS_UN_H_
 
-#include <stdint.h>
+#include <sys/ansi.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
 
-#ifndef _SA_FAMILY_T
-#define _SA_FAMILY_T
-/* Should match corresponding typedef in <sys/socket.h> */
-typedef uint8_t                sa_family_t;
-#endif /* _SA_FAMILY_T */
+#ifndef sa_family_t
+typedef __sa_family_t  sa_family_t;
+#define sa_family_t    __sa_family_t
+#endif
 
 #define UNIX_PATH_MAX 127
 
-struct sockaddr_un
-{
+/*
+ * Definitions for UNIX IPC domain.
+ */
+struct sockaddr_un {
        sa_family_t     sun_family;
        char            sun_path[UNIX_PATH_MAX];
 };
@@ -28,4 +31,4 @@ struct sockaddr_un
 #define SUN_LEN(unp) \
 ((size_t)((sizeof(*(unp)) - sizeof((unp)->sun_path)) + strlen((unp)->sun_path)))
 
-#endif
+#endif /* _SYS_UN_H_ */
index da0f70a1284dd333194048bb755e8dc257fca833..0338c2791512a8aaf25f0752217cfc22c8d7852b 100644 (file)
@@ -1,32 +1,33 @@
-/* The <sys/utsname.h> header gives the system name. */
+#ifndef        _SYS_UTSNAME_H_
+#define        _SYS_UTSNAME_H_
 
-#ifndef _UTSNAME_H
-#define _UTSNAME_H
+#include <sys/featuretest.h>
 
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
+#define        _SYS_NMLN       256
 
-#include <minix/types.h>
+#if defined(_NETBSD_SOURCE)
+#define        SYS_NMLN        _SYS_NMLN
+#endif
 
 struct utsname {
-  char sysname[15+1];
-  char nodename[255+1];
-  char release[11+1];
-  char version[7+1];
-  char machine[11+1];
-  char arch[11+1];
+       char    sysname[_SYS_NMLN];     /* Name of this OS. */
+       char    nodename[_SYS_NMLN];    /* Name of this network node. */
+       char    release[_SYS_NMLN];     /* Release level. */
+       char    version[_SYS_NMLN];     /* Version level. */
+       char    machine[_SYS_NMLN];     /* Hardware type. */
+       char    arch[_SYS_NMLN];
 };
 
-/* Function Prototypes. */
-_PROTOTYPE( int uname, (struct utsname *_name)                         );
+#include <sys/cdefs.h>
 
-#ifdef _MINIX
-/* Uname() is implemented with sysuname(). */
-
-_PROTOTYPE( int sysuname, (int _req, int _field, char *_value, 
-                                                       size_t _len));
+__BEGIN_DECLS
+int    uname(struct utsname *);
+#ifdef __minix
+int    sysuname(int _req, int _field, char *_value, size_t _len);
+#endif
+__END_DECLS
 
+#ifdef __minix
 /* req: Get or set a string. */
 #define _UTS_GET       0
 #define _UTS_SET       1
@@ -42,6 +43,6 @@ _PROTOTYPE( int sysuname, (int _req, int _field, char *_value,
 #define _UTS_SYSNAME   7
 #define _UTS_BUS       8
 #define _UTS_MAX       9       /* Number of strings. */
-#endif /* _MINIX */
+#endif /* __minix */
 
-#endif /* _UTSNAME_H */
+#endif /* !_SYS_UTSNAME_H_ */
similarity index 100%
rename from nbsd_include/sys/uuid.h
rename to include/sys/uuid.h
index bc6f596126357c94ae87a689f436835860ee4512..13261021629f89ab7af9edfc7db5792e353ee8ce 100644 (file)
@@ -1,3 +1,10 @@
+#ifndef _SYS_WAIT_H_
+#define _SYS_WAIT_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <sys/featuretest.h>
+
 /* The <sys/wait.h> header contains macros related to wait(). The value
  * returned by wait() and waitpid() depends on whether the process 
  * terminated by an exit() call, was killed by a signal, or was stopped
  *                             +---------------------+
  */
 
-#ifndef _WAIT_H
-#define _WAIT_H
-
-#ifndef _TYPES_H
-#include <minix/types.h>
-#endif
+/*
+ * Macros to test the exit status returned by wait
+ * and extract the relevant values.
+ */
 
 #define _LOW(v)                ( (v) & 0377)
 #define _HIGH(v)       ( ((v) >> 8) & 0377)
 
-#define WNOHANG         1      /* do not wait for child to exit */
-#define WUNTRACED       2      /* for job control; not implemented */
-
 #define WIFEXITED(s)   (_LOW(s) == 0)                      /* normal exit */
 #define WEXITSTATUS(s) (_HIGH(s))                          /* exit status */
 #define WTERMSIG(s)    (_LOW(s) & 0177)                    /* sig value */
 #define WIFSTOPPED(s)  (_LOW(s) == 0177)                   /* stopped */
 #define WSTOPSIG(s)    (_HIGH(s) & 0377)                   /* stop signal */
 
-/* Function Prototypes. */
-_PROTOTYPE( pid_t wait, (int *_stat_loc)                                  );
-_PROTOTYPE( pid_t waitpid, (pid_t _pid, int *_stat_loc, int _options)     );
+/*
+ * Option bits for the third argument of waitpid.  WNOHANG causes the
+ * wait to not hang if there are no stopped or terminated processes, rather
+ * returning an error indication in this case (pid==0).  WUNTRACED
+ * indicates that the caller should receive status about untraced children
+ * which stop due to signals.  If children are stopped and a wait without
+ * this option is done, it is as though they were still running... nothing
+ * about them is returned.
+ */
+#define WNOHANG                0x00000001      /* don't hang in wait */
+#define WUNTRACED      0x00000002      /* tell about stopped,
+                                          untraced children */
+
+/* POSIX extensions and 4.2/4.3 compatibility: */
+
+/*
+ * Tokens for special values of the "pid" parameter to waitpid.
+ */
+#define        WAIT_ANY        (-1)    /* any process */
+#define        WAIT_MYPGRP     0       /* any process in my process group */
+
+__BEGIN_DECLS
+pid_t  wait(int *);
+pid_t  waitpid(pid_t, int *, int);
+__END_DECLS
 
-#endif /* _WAIT_H */
+#endif /* !_SYS_WAIT_H_ */
index 464cb11bab2d83016b247b253d61d22a5b52cfd4..8dfc9f72d4626844949e772a7a06cbe1437d641c 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: sysexits.h,v 1.7 2005/09/30 20:56:19 rpaulo Exp $      */
+
 /*
  * Copyright (c) 1987, 1993
  *     The Regents of the University of California.  All rights reserved.
  * 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
+ * 3. 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.
  *
@@ -91,6 +89,8 @@
  *             perform the operation.  This is not intended for
  *             file system problems, which should use NOINPUT or
  *             CANTCREAT, but rather for higher level permissions.
+ *
+ *     Please update the sysexits(3) man page after adding more entries.
  */
 
 #define EX_OK          0       /* successful termination */
diff --git a/include/syslog.h b/include/syslog.h
deleted file mode 100644 (file)
index 604cc10..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-/* Copyright (c) 1983, 1986, 1988
- * 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.
- *
- * from  @(#)syslog.h  7.20 (Berkeley) 2/23/91
- * Porting to Minix by G. Falzoni <gfalzoni@inwind.it>
- */
-
-/*
-** Priorities/facilities are encoded into a single 16/32-bit quantity, where
-** the bottom 3 bits are the priority (0-7) and the top 13/28 bits are the
-** facility (0-big number).  Both the priorities and the facilities map
-** roughly one-to-one to strings in the syslogd(8) source code.
-** This mapping is included in this file.
-*/
-
-/* Priorities codes (these are ordered) */
-#define        LOG_EMERG       0       /* system is unusable */
-#define        LOG_ALERT       1       /* action must be taken immediately */
-#define        LOG_CRIT        2       /* critical conditions */
-#define        LOG_ERR         3       /* error conditions */
-#define        LOG_WARNING     4       /* warning conditions */
-#define        LOG_NOTICE      5       /* normal but significant condition */
-#define        LOG_INFO        6       /* informational */
-#define        LOG_DEBUG       7       /* debug-level messages */
-
-/* Extract priority */
-#define        LOG_PRIMASK     0x07    /* mask to extract priority part (internal) */
-#define        LOG_PRI(p)      ((p)&LOG_PRIMASK)
-
-/* Facility codes */
-#define        LOG_KERN        (0<<3)  /* kernel messages */
-#define        LOG_USER        (1<<3)  /* random user-level messages */
-#define        LOG_MAIL        (2<<3)  /* mail system */
-#define        LOG_DAEMON      (3<<3)  /* system daemons */
-#define        LOG_AUTH        (4<<3)  /* security/authorization messages */
-#define        LOG_SYSLOG      (5<<3)  /* messages generated internally by syslogd */
-#define        LOG_LPR         (6<<3)  /* line printer subsystem */
-#define        LOG_NEWS        (7<<3)  /* network news subsystem */
-#define        LOG_UUCP        (8<<3)  /* UUCP subsystem */
-#define        LOG_CRON        (9<<3)  /* clock daemon */
-#define        LOG_AUTHPRIV    (10<<3) /* security/authorization messages (private) */
-
- /* Other codes through 15 reserved for system use */
-#define        LOG_LOCAL0      (16<<3) /* reserved for local use */
-#define        LOG_LOCAL1      (17<<3) /* reserved for local use */
-#define        LOG_LOCAL2      (18<<3) /* reserved for local use */
-#define        LOG_LOCAL3      (19<<3) /* reserved for local use */
-#define        LOG_LOCAL4      (20<<3) /* reserved for local use */
-#define        LOG_LOCAL5      (21<<3) /* reserved for local use */
-#define        LOG_LOCAL6      (22<<3) /* reserved for local use */
-#define        LOG_LOCAL7      (23<<3) /* reserved for local use */
-#define        LOG_NFACILITIES 24      /* current number of facilities */
-
-/* Extract Facility */
-#define        LOG_FACMASK     0x03f8  /* mask to extract facility part */
-#define        LOG_FAC(p)      (((p)&LOG_FACMASK)>>3)
-
-/* Option flags for openlog */
-#define        LOG_PID         0x01    /* log the pid with each message */
-#define        LOG_CONS        0x02    /* log on the console if errors in sending */
-#define        LOG_ODELAY      0x04    /* delay open until first syslog() (default) */
-#define        LOG_NDELAY      0x08    /* don't delay open */
-#define        LOG_NOWAIT      0x10    /* don't wait for console forks: DEPRECATED */
-#define        LOG_PERROR      0x20    /* log to stderr as well */
-
-void closelog(void);
-void openlog(const char *, int, int);
-void syslog(int, const char *,...);
-
-#ifdef SYSLOG_NAMES
-
-#define        LOG_MAKEPRI(fac,pri) (((fac)<<3)|(pri))
-#define TABLE_NOPRI     0       /* Value to indicate no priority */
-#define TABLE_ALLPRI   0xFF    /* Value to indicate all priorities */
-#define        INTERNAL_NOPRI  0x10    /* the "no priority" priority */
-#define        INTERNAL_MARK   LOG_MAKEPRI(LOG_NFACILITIES, 0) /* Mark "facility" */
-
-struct _code {
-  char *c_name;
-  int c_val;
-};
-
-static const struct _code PriNames[] =
-{
- "alert", LOG_ALERT,
- "crit", LOG_CRIT,
- "debug", LOG_DEBUG,
- "emerg", LOG_EMERG,
- "err", LOG_ERR,
- "error", LOG_ERR,             /* DEPRECATED */
- "info", LOG_INFO,
- "none", INTERNAL_NOPRI,       /* INTERNAL */
- "notice", LOG_NOTICE,
- "panic", LOG_EMERG,           /* DEPRECATED */
- "warn", LOG_WARNING,          /* DEPRECATED */
- "warning", LOG_WARNING,
- "*", TABLE_ALLPRI,            /* INTERNAL */
- NULL, -1,
-};
-
-static const struct _code FacNames[] =
-{
- "auth", LOG_AUTH,
- "authpriv", LOG_AUTHPRIV,
- "cron", LOG_CRON,
- "daemon", LOG_DAEMON,
- "kern", LOG_KERN,
- "lpr", LOG_LPR,
- "mail", LOG_MAIL,
- "mark", INTERNAL_MARK,                /* INTERNAL */
- "news", LOG_NEWS,
- "security", LOG_AUTH,         /* DEPRECATED */
- "syslog", LOG_SYSLOG,
- "user", LOG_USER,
- "uucp", LOG_UUCP,
- "local0", LOG_LOCAL0,
- "local1", LOG_LOCAL1,
- "local2", LOG_LOCAL2,
- "local3", LOG_LOCAL3,
- "local4", LOG_LOCAL4,
- "local5", LOG_LOCAL5,
- "local6", LOG_LOCAL6,
- "local7", LOG_LOCAL7,
- NULL, -1,
-};
-#endif
-
-/** syslog.h **/
index d176a4ef7c3750752da899babf6a719a2f82a391..8e7741768342b5b5db7d5dc88bb93d2c6a5507c9 100644 (file)
@@ -1,71 +1,71 @@
-/* The <tar.h> header is used with the tape archiver, tar. */
+/*     $NetBSD: tar.h,v 1.4 2003/08/07 09:44:11 agc Exp $      */
+
+/*-
+ * Copyright (c) 1994
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chuck Karish of Mindcraft, Inc.
+ *
+ * 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. 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.
+ *
+ *     @(#)tar.h       8.2 (Berkeley) 1/4/94
+ */
 
 #ifndef _TAR_H
 #define _TAR_H
 
-#define TBLOCK                 512
-#define NAMSIZ         100
-#define PFXSIZ         155
-
-#define TMODLEN        8
-#define TUIDLEN                8
-#define TGIDLEN                8
-#define TSIZLEN                12
-#define TMTMLEN                12
-#define TCKSLEN                8
-
-#define TMAGIC         "ustar"
-#define TMAGLEN                6
-#define TVERSION       "00"
-#define TVERSLEN       2
-#define TUNMLEN                32
-#define TGNMLEN                32
-#define TDEVLEN                8
-
-#define REGTYPE                '0'
-#define AREGTYPE       '\0'
-#define LNKTYPE                '1'
-#define SYMTYPE                '2'
-#define CHRTYPE                '3'
-#define BLKTYPE                '4'
-#define DIRTYPE                '5'
-#define FIFOTYPE       '6'
-#define CONTTYPE       '7'
-
-#define TSUID          04000
-#define TSGID          02000
-#define TSVTX          01000
+#define        TMAGIC          "ustar" /* ustar and a null */
+#define        TMAGLEN         6
+#define        TVERSION        "00"    /* 00 and no null */
+#define        TVERSLEN        2
 
-#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
+/* Values used in typeflag field */
+#define        REGTYPE         '0'     /* Regular file */
+#define        AREGTYPE        '\0'    /* Regular file */
+#define        LNKTYPE         '1'     /* Link */
+#define        SYMTYPE         '2'     /* Reserved */
+#define        CHRTYPE         '3'     /* Character special */
+#define        BLKTYPE         '4'     /* Block special */
+#define        DIRTYPE         '5'     /* Directory */
+#define        FIFOTYPE        '6'     /* FIFO special */
+#define        CONTTYPE        '7'     /* Reserved */
 
-union hblock {
-  char dummy[TBLOCK];
-  struct header {
-       char name[NAMSIZ];
-       char mode[TMODLEN];
-       char uid[TUIDLEN];
-       char gid[TGIDLEN];
-       char size[TSIZLEN];
-       char mtime[TMTMLEN];
-       char chksum[TCKSLEN];
-       char typeflag;
-       char linkname[NAMSIZ];
-       char magic[TMAGLEN];
-       char version[TVERSLEN];
-       char uname[TUNMLEN];
-       char gname[TGNMLEN];
-       char devmajor[TDEVLEN];
-       char devminor[TDEVLEN];
-       char prefix[PFXSIZ];
-  } dbuf;
-};
+/* Bits used in the mode field - values in octal */
+#define        TSUID           04000   /* Set UID on execution */
+#define        TSGID           02000   /* Set GID on execution */
+#define        TSVTX           01000   /* Reserved */
+                               /* File permissions */
+#define        TUREAD          00400   /* Read by owner */
+#define        TUWRITE         00200   /* Write by owner */
+#define        TUEXEC          00100   /* Execute/Search by owner */
+#define        TGREAD          00040   /* Read by group */
+#define        TGWRITE         00020   /* Write by group */
+#define        TGEXEC          00010   /* Execute/Search by group */
+#define        TOREAD          00004   /* Read by other */
+#define        TOWRITE         00002   /* Write by other */
+#define        TOEXEC          00001   /* Execute/Search by other */
 
-#endif /* _TAR_H */
+#endif
diff --git a/include/termcap.h b/include/termcap.h
deleted file mode 100644 (file)
index 5dfc50f..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _TERMCAP_H
-#define _TERMCAP_H
-
-#include <minix/ansi.h>
-
-_PROTOTYPE( int tgetent, (char *_bp, char *_name)                      );
-_PROTOTYPE( int tgetflag, (char *_id)                                  );
-_PROTOTYPE( int tgetnum, (char *_id)                                   );
-_PROTOTYPE( char *tgetstr, (char *_id, char **_area)                   );
-_PROTOTYPE( char *tgoto, (char *_cm, int _destcol, int _destline)      );
-_PROTOTYPE( int tputs, (char *_cp, int _affcnt, void (*_outc)(int))    );
-
-#endif /* _TERMCAP_H */
similarity index 100%
rename from nbsd_include/tgmath.h
rename to include/tgmath.h
index ede1baf2bcfbc9b48566bf2786ac17b13fe2c08b..7360bc629a8ad9d3a57b22e41ea18e019dea7858 100644 (file)
-/* The <time.h> header is used by the procedures that deal with time.
- * Handling time is surprisingly complicated, what with GMT, local time
- * and other factors.  Although the Bishop of Ussher (1581-1656) once
- * calculated that based on the Bible, the world began on 12 Oct. 4004 BC
- * at 9 o'clock in the morning, in the UNIX world time begins at midnight, 
- * 1 Jan. 1970 GMT.  Before that, all was NULL and (void).
+/*     $NetBSD: time.h,v 1.40 2010/12/16 18:36:47 christos Exp $       */
+
+/*
+ * Copyright (c) 1989, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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. 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.
+ *
+ *     @(#)time.h      8.3 (Berkeley) 1/21/94
  */
 
-#ifndef _TIME_H
-#define _TIME_H
+#ifndef _TIME_H_
+#define        _TIME_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <machine/ansi.h>
 
 #include <sys/null.h>
 
-#define CLOCKS_PER_SEC    60
+#ifdef _BSD_CLOCK_T_
+typedef        _BSD_CLOCK_T_   clock_t;
+#undef _BSD_CLOCK_T_
+#endif
 
-#ifdef _POSIX_SOURCE
-#define CLK_TCK CLOCKS_PER_SEC /* obsolescent mame for CLOCKS_PER_SEC */
+#ifdef _BSD_TIME_T_
+typedef        _BSD_TIME_T_    time_t;
+#undef _BSD_TIME_T_
 #endif
 
-#ifndef _SIZE_T
-#define _SIZE_T
-typedef unsigned int size_t;
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
 #endif
 
-#ifndef _TIME_T
-#define _TIME_T
-typedef long time_t;           /* time in sec since 1 Jan 1970 0000 GMT */
+#ifdef _BSD_CLOCKID_T_
+typedef        _BSD_CLOCKID_T_ clockid_t;
+#undef _BSD_CLOCKID_T_
 #endif
 
-#ifndef _CLOCK_T
-#define _CLOCK_T
-typedef long clock_t;          /* time in ticks since process started */
+#ifndef __minix
+#ifdef _BSD_TIMER_T_
+typedef        _BSD_TIMER_T_   timer_t;
+#undef _BSD_TIMER_T_
+#endif
+#endif /* !__minix */
+
+#ifdef __minix
+#define CLOCKS_PER_SEC 60
+#else
+#define CLOCKS_PER_SEC 100
 #endif
 
 struct tm {
-  int tm_sec;                  /* seconds after the minute [0, 59] */
-  int tm_min;                  /* minutes after the hour [0, 59] */
-  int tm_hour;                 /* hours since midnight [0, 23] */
-  int tm_mday;                 /* day of the month [1, 31] */
-  int tm_mon;                  /* months since January [0, 11] */
-  int tm_year;                 /* years since 1900 */
-  int tm_wday;                 /* days since Sunday [0, 6] */
-  int tm_yday;                 /* days since January 1 [0, 365] */
-  int tm_isdst;                        /* Daylight Saving Time flag */
+       int     tm_sec;         /* seconds after the minute [0-61] */
+       int     tm_min;         /* minutes after the hour [0-59] */
+       int     tm_hour;        /* hours since midnight [0-23] */
+       int     tm_mday;        /* day of the month [1-31] */
+       int     tm_mon;         /* months since January [0-11] */
+       int     tm_year;        /* years since 1900 */
+       int     tm_wday;        /* days since Sunday [0-6] */
+       int     tm_yday;        /* days since January 1 [0-365] */
+       int     tm_isdst;       /* Daylight Savings Time flag */
+       long    tm_gmtoff;      /* offset from UTC in seconds */
+       __aconst char *tm_zone; /* timezone abbreviation */
 };
 
-extern char *tzname[];
+__BEGIN_DECLS
+char *asctime(const struct tm *);
+clock_t clock(void);
+#ifndef __LIBC12_SOURCE__
+char *ctime(const time_t *) __RENAME(__ctime50);
+double difftime(time_t, time_t) __RENAME(__difftime50);
+struct tm *gmtime(const time_t *) __RENAME(__gmtime50);
+#ifndef __MINIX
+struct tm *localtime(const time_t *) __RENAME(__locatime50);
+#else
+struct tm *localtime(const time_t *) __RENAME(__localtime50);
+#endif
+time_t time(time_t *) __RENAME(__time50);
+time_t mktime(struct tm *) __RENAME(__mktime50);
+#endif
+size_t strftime(char * __restrict, size_t, const char * __restrict,
+    const struct tm * __restrict)
+    __attribute__((__format__(__strftime__, 3, 0)));
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+#ifndef __LIBC12_SOURCE__
+/*
+ * CLK_TCK uses libc's internal __sysconf() to retrieve the machine's
+ * HZ. The value of _SC_CLK_TCK is 39 -- we hard code it so we do not
+ * need to include unistd.h
+ */
+long __sysconf(int);
+#ifdef __minix
+#define CLK_TCK                (__sysconf(3))
+#else
+#define CLK_TCK                (__sysconf(39))
+#endif /* !__minix */
+#endif
+#endif
 
-/* Function Prototypes. */
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
+extern __aconst char *tzname[2];
+#ifndef __LIBC12_SOURCE__
+void tzset(void) __RENAME(__tzset50);
 #endif
 
-_PROTOTYPE( clock_t clock, (void)                                      );
-_PROTOTYPE( double difftime, (time_t _time1, time_t _time0)            );
-_PROTOTYPE( time_t mktime, (struct tm *_timeptr)                       );
-_PROTOTYPE( time_t time, (time_t *_timeptr)                            );
-_PROTOTYPE( char *asctime, (const struct tm *_timeptr)                 );
-_PROTOTYPE( char *asctime_r, (const struct tm *_timeptr, char *buf)                    );
-_PROTOTYPE( char *ctime, (const time_t *_timer)                                );
-_PROTOTYPE( char *ctime_r, (const time_t *_timer, char *buf)                   );
-_PROTOTYPE( struct tm *gmtime, (const time_t *_timer)                  );
-_PROTOTYPE( struct tm *gmtime_r, (const time_t *_timer,struct tm *tmp)                 );
-_PROTOTYPE( struct tm *localtime, (const time_t *_timer)               );
-_PROTOTYPE( struct tm *localtime_r, (const time_t *const timep,
-                                       struct tm *tmp)                 );
-_PROTOTYPE( size_t strftime, (char *_s, size_t _max, const char *_fmt,
-                               const struct tm *_timep)                );
-_PROTOTYPE( char *strptime, (const char *buf, const char *format,
-                               struct tm *timeptr)                     );
-_PROTOTYPE( time_t timegm, (struct tm * const tmp)                     );
+/*
+ * X/Open Portability Guide >= Issue 4
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+extern int daylight;
+#ifndef __LIBC12_SOURCE__
+extern long int timezone __RENAME(__timezone13);
+#endif
+char *strptime(const char * __restrict, const char * __restrict,
+    struct tm * __restrict);
+#endif
 
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    defined(_NETBSD_SOURCE)
+struct tm *getdate(const char *);
+extern int getdate_err;
+#endif
 
-#ifdef _POSIX_SOURCE
-_PROTOTYPE( void tzset, (void)                                         );
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#include <sys/time.h>          /* XXX for struct timespec */
+struct sigevent;
+struct itimerspec;
+#ifndef __LIBC12_SOURCE__
+#ifndef __minix
+int clock_getres(clockid_t, struct timespec *)
+    __RENAME(__clock_getres50);
+int clock_gettime(clockid_t, struct timespec *)
+    __RENAME(__clock_gettime50);
+int clock_settime(clockid_t, const struct timespec *)
+    __RENAME(__clock_settime50);
+#endif /* !__minix */
+int nanosleep(const struct timespec *, struct timespec *)
+    __RENAME(__nanosleep50);
+#ifndef __minix
+int timer_gettime(timer_t, struct itimerspec *) __RENAME(__timer_gettime50);
+int timer_settime(timer_t, int, const struct itimerspec * __restrict, 
+    struct itimerspec * __restrict) __RENAME(__timer_settime50);
+#endif /* !__minix */ 
+#endif
+#ifndef __minix
+int timer_create(clockid_t, struct sigevent * __restrict,
+    timer_t * __restrict);
+int timer_delete(timer_t);
+int timer_getoverrun(timer_t);
+#endif /* __minix */
+#endif /* _POSIX_C_SOURCE >= 199309 || _XOPEN_SOURCE >= 500 || ... */
+
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+char *asctime_r(const struct tm * __restrict, char * __restrict);
+#ifndef __LIBC12_SOURCE__
+char *ctime_r(const time_t *, char *) __RENAME(__ctime_r50);
+struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict)
+    __RENAME(__gmtime_r50);
+struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict)
+    __RENAME(__localtime_r50);
+#endif
 #endif
 
-#ifdef _MINIX
-_PROTOTYPE( int stime, (time_t *_top)                                  );
+#if defined(_NETBSD_SOURCE)
+
+typedef struct __state *timezone_t;
+
+#ifndef __LIBC12_SOURCE__
+time_t time2posix(time_t) __RENAME(__time2posix50);
+time_t posix2time(time_t) __RENAME(__posix2time50);
+time_t timegm(struct tm *) __RENAME(__timegm50);
+time_t timeoff(struct tm *, long) __RENAME(__timeoff50);
+time_t timelocal(struct tm *) __RENAME(__timelocal50);
+struct tm *offtime(const time_t *, long) __RENAME(__offtime50);
+void tzsetwall(void) __RENAME(__tzsetwall50);
+
+struct tm *offtime_r(const time_t *, long, struct tm *) __RENAME(__offtime_r50);
+struct tm *localtime_rz(const timezone_t, const time_t * __restrict,
+    struct tm * __restrict) __RENAME(__localtime_rz50);
+char *ctime_rz(const timezone_t, const time_t *, char *) __RENAME(__ctime_rz50);
+time_t mktime_z(const timezone_t, struct tm *) __RENAME(__mktime_z50);
+time_t timelocal_z(const timezone_t, struct tm *) __RENAME(__timelocal_z50);
+time_t time2posix_z(const timezone_t, time_t) __RENAME(__time2posix_z50);
+time_t posix2time_z(const timezone_t, time_t) __RENAME(__posix2time_z50);
+timezone_t tzalloc(const char *) __RENAME(__tzalloc50);
+void tzfree(const timezone_t) __RENAME(__tzfree50);
+const char *tzgetname(const timezone_t, int) __RENAME(__tzgetname50);
 #endif
 
-extern long timezone;
+size_t strftime_z(const timezone_t, char * __restrict, size_t,
+    const char * __restrict, const struct tm * __restrict)
+    __attribute__((__format__(__strftime__, 4, 0)));
 
-#ifdef _POSIX_SOURCE
-struct timespec
-{
-       time_t tv_sec;
-       long tv_nsec;
-};
+#endif /* _NETBSD_SOURCE */
 
-int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
-#endif
+#ifdef _MINIX
+int stime(time_t *_top);
+#endif /* _MINIX */
+
+__END_DECLS
 
-#endif /* _TIME_H */
+#endif /* !_TIME_H_ */
similarity index 100%
rename from common/include/timers.h
rename to include/timers.h
index ece4daa64d67520479762da75a8d7b5bbf70999a..da30f13cf5606a93a88a993f4cf797424fda3c40 100644 (file)
@@ -1,23 +1,79 @@
-/* <ttyent.h> is used by getttyent(3).                 Author: Kees J. Bot
- *                                                             28 Oct 1995
+/*     $NetBSD: ttyent.h,v 1.14 2006/04/17 23:29:21 salo Exp $ */
+
+/*
+ * Copyright (c) 1989, 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. 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.
+ *
+ *     @(#)ttyent.h    8.1 (Berkeley) 6/2/93
  */
-#ifndef _TTYENT_H
-#define _TTYENT_H
 
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
+#ifndef        _TTYENT_H_
+#define        _TTYENT_H_
+
+#include <sys/cdefs.h>
+
+#define        _PATH_TTYS      "/etc/ttys"
+
+#define        _TTYS_OFF       "off"
+#define        _TTYS_ON        "on"
+#define        _TTYS_SECURE    "secure"
+#define        _TTYS_WINDOW    "window"
+#define        _TTYS_CLASS     "class"
+#define        _TTYS_LOCAL     "local"
+#define        _TTYS_RTSCTS    "rtscts"
+#define        _TTYS_DTRCTS    "dtrcts"
+#define        _TTYS_SOFTCAR   "softcar"
+#define        _TTYS_MDMBUF    "mdmbuf"
 
 struct ttyent {
-       char    *ty_name;       /* Name of the terminal device. */
-       char    *ty_type;       /* Terminal type name (termcap(3)). */
-       char    **ty_getty;     /* Program to run, normally getty. */
-       char    **ty_init;      /* Initialization command, normally stty. */
+       __aconst char *ty_name; /* terminal device name */
+       __aconst char *ty_getty;/* command to execute, usually getty */
+       __aconst char *ty_type; /* terminal type for termcap */
+#define        TTY_ON          0x01    /* enable logins (start ty_getty program) */
+#define        TTY_SECURE      0x02    /* allow uid of 0 to login */
+#define        TTY_LOCAL       0x04    /* set 'CLOCAL' on open (dev. specific) */
+#define        TTY_RTSCTS      0x08    /* set 'CRTSCTS' on open (dev. specific) */
+#define        TTY_SOFTCAR     0x10    /* ignore hardware carrier (dev. spec.) */
+#define        TTY_MDMBUF      0x20    /* set 'MDMBUF' on open (dev. specific) */
+#define TTY_DTRCTS      0x40    /* set 'CDTRCTS' on open (dev. specific) */
+       int     ty_status;      /* status flags */
+       __aconst char *ty_window;/* command to start up window manager */
+       __aconst char *ty_comment;/* comment field */
+       __aconst char *ty_class;/* category of tty usage */
 };
 
-_PROTOTYPE( struct ttyent *getttyent, (void)                           );
-_PROTOTYPE( struct ttyent *getttynam, (const char *_name)              );
-_PROTOTYPE( int setttyent, (void)                                      );
-_PROTOTYPE( void endttyent, (void)                                     );
+__BEGIN_DECLS
+struct ttyent *getttyent(void);
+struct ttyent *getttynam(const char *);
+#if defined(_NETBSD_SOURCE)
+int setttyentpath(const char *);
+#endif /* defined(_NETBSD_SOURCE) */
+int setttyent(void);
+int endttyent(void);
+__END_DECLS
 
-#endif /* _TTYENT_H */
+#endif /* !_TTYENT_H_ */
index dab518746aba1b8faa17137895027146440abb89..0029eae2ab0c70cf496f3d1ee037420221e9162a 100644 (file)
@@ -1,51 +1,55 @@
-#ifndef TZFILE_H
-
-#define TZFILE_H
+/*     $NetBSD: tzfile.h,v 1.7 2003/08/07 09:44:11 agc Exp $   */
 
 /*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson.
-*/
-
-/*
-** This header is for use ONLY with the time conversion code.
-** There is no guarantee that it will remain unchanged,
-** or that it will remain at all.
-** Do NOT copy it to any system include directory.
-** Thank you!
-*/
-
-/*
-** ID
-*/
-
-#ifndef lint
-#ifndef NOID
-static char    tzfilehid[] = "@(#)tzfile.h     7.18";
-#endif /* !defined NOID */
-#endif /* !defined lint */
+ * Copyright (c) 1988, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Arthur David Olson of the National Cancer Institute.
+ *
+ * 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. 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.
+ *
+ *     @(#)tzfile.h    8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _TZFILE_H_
+#define        _TZFILE_H_
 
 /*
-** Information about time zone files.
-*/
-
-#ifndef TZDIR
-#define TZDIR  "/usr/share/zoneinfo" /* Time zone object file directory */
-#endif /* !defined TZDIR */
-
-#ifndef TZDEFAULT
-#define TZDEFAULT      "localtime"
-#endif /* !defined TZDEFAULT */
-
-#ifndef TZDEFRULES
+ * Information about time zone files.
+ */
+                       /* Time zone object file directory */
+#define TZDIR          "/usr/share/zoneinfo"
+#define TZDEFAULT      "/etc/localtime"
 #define TZDEFRULES     "posixrules"
-#endif /* !defined TZDEFRULES */
 
 /*
 ** Each file begins with. . .
 */
 
-#define        TZ_MAGIC        "TZif"
+#define TZ_MAGIC       "TZif"
 
 struct tzhead {
        char    tzh_magic[4];           /* TZ_MAGIC */
@@ -78,7 +82,7 @@ struct tzhead {
 **                                     assumed to be wall clock time
 **     tzh_ttisgmtcnt (char)s          indexed by type; if TRUE, transition
 **                                     time is UTC, if FALSE,
-**                                     transition time is local time
+**                                     transition time is wall clock time
 **                                     if absent, transition times are
 **                                     assumed to be local time
 */
@@ -88,7 +92,6 @@ struct tzhead {
 ** exceed any of the limits below.
 */
 
-#ifndef TZ_MAX_TIMES
 /*
 ** The TZ_MAX_TIMES value below is enough to handle a bit more than a
 ** year's worth of solar time (corrected daily to the nearest second) or
@@ -96,29 +99,18 @@ struct tzhead {
 ** (where there are three time zone transitions every fourth year).
 */
 #define TZ_MAX_TIMES   370
-#endif /* !defined TZ_MAX_TIMES */
 
-#ifndef TZ_MAX_TYPES
+#define NOSOLAR                        /* 4BSD doesn't currently handle solar time */
+
 #ifndef NOSOLAR
-#define TZ_MAX_TYPES   256 /* Limited by what (unsigned char)'s can hold */
-#endif /* !defined NOSOLAR */
-#ifdef NOSOLAR
-/*
-** Must be at least 14 for Europe/Riga as of Jan 12 1995,
-** as noted by Earl Chew.
-*/
-#define TZ_MAX_TYPES   20      /* Maximum number of local time types */
-#endif /* !defined NOSOLAR */
-#endif /* !defined TZ_MAX_TYPES */
+#define TZ_MAX_TYPES   256     /* Limited by what (unsigned char)'s can hold */
+#else
+#define TZ_MAX_TYPES   10      /* Maximum number of local time types */
+#endif
 
-#ifndef TZ_MAX_CHARS
 #define TZ_MAX_CHARS   50      /* Maximum number of abbreviation characters */
-                               /* (limited by what unsigned chars can hold) */
-#endif /* !defined TZ_MAX_CHARS */
 
-#ifndef TZ_MAX_LEAPS
-#define TZ_MAX_LEAPS   50      /* Maximum number of leap second corrections */
-#endif /* !defined TZ_MAX_LEAPS */
+#define        TZ_MAX_LEAPS    50      /* Maximum number of leap second corrections */
 
 #define SECSPERMIN     60
 #define MINSPERHOUR    60
@@ -156,20 +148,11 @@ struct tzhead {
 #define EPOCH_YEAR     1970
 #define EPOCH_WDAY     TM_THURSDAY
 
-#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
-
 /*
-** Since everything in isleap is modulo 400 (or a factor of 400), we know that
-**     isleap(y) == isleap(y % 400)
-** and so
-**     isleap(a + b) == isleap((a + b) % 400)
-** or
-**     isleap(a + b) == isleap(a % 400 + b % 400)
-** This is true even if % means modulo rather than Fortran remainder
-** (which is allowed by C89 but not C99).
-** We use this to avoid addition overflow problems.
+** Accurate only for the past couple of centuries;
+** that will probably do.
 */
 
-#define isleap_sum(a, b)       isleap((a) % 400 + (b) % 400)
+#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
 
-#endif /* !defined TZFILE_H */
+#endif /* !_TZFILE_H_ */
index 1c91d309b08691281813db36857aa39216a2488c..8dad20d4dc7fb51c465c5d148319ddfb34f29969 100644 (file)
@@ -1,21 +1,45 @@
-#ifndef _UCONTEXT_H
-#define _UCONTEXT_H 1
+/*     $NetBSD: ucontext.h,v 1.6 2009/03/19 08:04:38 uebayasi Exp $    */
 
-#include <sys/ucontext.h>
-
-_PROTOTYPE( void makecontext, (ucontext_t *ucp, void (*func)(void),
-                               int argc, ...)                          );
-_PROTOTYPE( int swapcontext, (ucontext_t *oucp,
-                             const ucontext_t *ucp)                    );
-_PROTOTYPE( int getcontext, (ucontext_t *ucp)                  );
-_PROTOTYPE( int setcontext, (const ucontext_t *ucp)            );
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
 
-_PROTOTYPE( void resumecontext, (ucontext_t *ucp)              );
+#ifndef _UCONTEXT_H_
+#define _UCONTEXT_H_
 
-/* These functions get and set ucontext structure through PM/kernel. They don't
- * manipulate the stack. */
-_PROTOTYPE( int getuctx, (ucontext_t *ucp)                     );
-_PROTOTYPE( int setuctx, (const ucontext_t *ucp)               );
+#include <sys/cdefs.h>
+#include <sys/ucontext.h>
 
-#endif /* _UCONTEXT_H */
+__BEGIN_DECLS
+int    getcontext(ucontext_t *);
+int    setcontext(const ucontext_t *);
+void   makecontext(ucontext_t *, void (*)(), int, ...);
+int    swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict);
+__END_DECLS
 
+#endif /* !_UCONTEXT_H_ */
similarity index 100%
rename from nbsd_include/ulimit.h
rename to include/ulimit.h
index 1d1cdc8121be4c60aab95d1b3a55e27de18801e7..505f9ac23055c6c277c2cc444cfbd47a21adb89f 100644 (file)
-/* The <unistd.h> header contains a few miscellaneous manifest constants. */
+/*     $NetBSD: unistd.h,v 1.125 2011/01/19 19:21:29 christos Exp $    */
 
-#ifndef _UNISTD_H
-#define _UNISTD_H
+/*-
+ * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+/*
+ * Copyright (c) 1991, 1993, 1994
+ *     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. 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.
+ *
+ *     @(#)unistd.h    8.12 (Berkeley) 4/27/95
+ */
+
+#ifndef _UNISTD_H_
+#define        _UNISTD_H_
+
+#include <machine/ansi.h>
+#include <machine/int_types.h>
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <sys/types.h>
+#include <sys/unistd.h>
+
+#if _FORTIFY_SOURCE > 0
+#include <ssp/unistd.h>
+#endif
+
+/*
+ * IEEE Std 1003.1-90
+ */
+#define        STDIN_FILENO    0       /* standard input file descriptor */
+#define        STDOUT_FILENO   1       /* standard output file descriptor */
+#define        STDERR_FILENO   2       /* standard error file descriptor */
 
-#ifndef _TYPES_H
-#include <minix/types.h>
+#include <sys/null.h>
+
+__BEGIN_DECLS
+__dead  void _exit(int);
+int     access(const char *, int);
+unsigned int alarm(unsigned int);
+int     chdir(const char *);
+#if !defined(__minix) && (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))
+int    chown(const char *, uid_t, gid_t) __RENAME(__posix_chown);
+#else
+int    chown(const char *, uid_t, gid_t);
+#endif /* defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) */
+int     close(int);
+size_t  confstr(int, char *, size_t);
+#ifndef __CUSERID_DECLARED
+#define __CUSERID_DECLARED
+/* also declared in stdio.h */
+char   *cuserid(char *);       /* obsolete */
+#endif /* __CUSERID_DECLARED */
+int     dup(int);
+int     dup2(int, int);
+int     execl(const char *, const char *, ...);
+int     execle(const char *, const char *, ...);
+int     execlp(const char *, const char *, ...);
+int     execv(const char *, char * const *);
+int     execve(const char *, char * const *, char * const *);
+int     execvp(const char *, char * const *);
+pid_t   fork(void);
+long    fpathconf(int, int);
+#if __SSP_FORTIFY_LEVEL == 0
+char   *getcwd(char *, size_t);
 #endif
+gid_t   getegid(void);
+uid_t   geteuid(void);
+gid_t   getgid(void);
+int     getgroups(int, gid_t []);
+__aconst char *getlogin(void);
+int     getlogin_r(char *, size_t);
+pid_t   getpgrp(void);
+pid_t   getpid(void);
+pid_t   getppid(void);
+uid_t   getuid(void);
+int     isatty(int);
+int     link(const char *, const char *);
+long    pathconf(const char *, int);
+int     pause(void);
+int     pipe(int *);
+#if __SSP_FORTIFY_LEVEL == 0
+ssize_t         read(int, void *, size_t);
+#endif
+int     rmdir(const char *);
+int     setgid(gid_t);
+#ifndef __minix
+int     setpgid(pid_t, pid_t);
+#endif /* !__minix */
+pid_t   setsid(void);
+int     setuid(uid_t);
+unsigned int    sleep(unsigned int);
+long    sysconf(int);
+pid_t   tcgetpgrp(int);
+int     tcsetpgrp(int, pid_t);
+__aconst char *ttyname(int);
+int     unlink(const char *);
+ssize_t         write(int, const void *, size_t);
 
-#include <sys/ucred.h>
 
-/* Values used by access().  POSIX Table 2-8. */
-#define F_OK               0   /* test if file exists */
-#define X_OK               1   /* test if file is executable */
-#define W_OK               2   /* test if file is writable */
-#define R_OK               4   /* test if file is readable */
+/*
+ * IEEE Std 1003.2-92, adopted in X/Open Portability Guide Issue 4 and later
+ */
+#if (_POSIX_C_SOURCE - 0) >= 2 || defined(_XOPEN_SOURCE) || \
+    defined(_NETBSD_SOURCE)
+int     getopt(int, char * const [], const char *);
 
-/* Values used for whence in lseek(fd, offset, whence).  POSIX Table 2-9. */
-#define SEEK_SET           0   /* offset is absolute  */
-#define SEEK_CUR           1   /* offset is relative to current position */
-#define SEEK_END           2   /* offset is relative to end of file */
+extern  char *optarg;                  /* getopt(3) external variables */
+extern  int opterr;
+extern  int optind;
+extern  int optopt;
+#endif
 
-/* This value is required by POSIX Table 2-10. */
-#define _POSIX_VERSION 199009L /* which standard is being conformed to */
+/*
+ * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
+ */
+#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \
+    defined(_NETBSD_SOURCE)
+int     setegid(gid_t);
+int     seteuid(uid_t);
+#endif
 
-/* These three definitions are required by POSIX Sec. 8.2.1.2. */
-#define STDIN_FILENO       0   /* file descriptor for stdin */
-#define STDOUT_FILENO      1   /* file descriptor for stdout */
-#define STDERR_FILENO      2   /* file descriptor for stderr */
+/*
+ * The following three syscalls are also defined in <sys/types.h>
+ * We protect them against double declarations.
+ */
+#ifndef __OFF_T_SYSCALLS_DECLARED
+#define __OFF_T_SYSCALLS_DECLARED
+off_t   lseek(int, off_t, int);
+int     truncate(const char *, off_t);
+/*
+ * IEEE Std 1003.1b-93,
+ * also found in X/Open Portability Guide >= Issue 4 Verion 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199309L || \
+    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+int     ftruncate(int, off_t);
+#endif
+#endif /* __OFF_T_SYSCALLS_DECLARED */
 
-#ifdef _MINIX
-/* How to exit the system or stop a server process. */
-#define RBT_HALT          0    /* shutdown and return to monitor */
-#define RBT_REBOOT        1    /* reboot the system through the monitor */
-#define RBT_PANIC         2    /* a server panics */
-#define RBT_MONITOR       3    /* let the monitor do this */
-#define RBT_RESET         4    /* hard reset the system */
-#define RBT_DEFAULT       5    /* return to monitor, reset if not possible */
-#define RBT_INVALID       6    /* first invalid reboot flag */
 
-#define _PM_SEG_FLAG (1L << 30)        /* for read() and write() to FS by PM */
+/*
+ * IEEE Std 1003.1b-93, adopted in X/Open CAE Specification Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_NETBSD_SOURCE)
+#ifndef __minix 
+int     fdatasync(int);
+#endif /* !__minix */
+int     fsync(int);
 #endif
 
-/* NULL must be defined in <unistd.h> according to POSIX Sec. 2.7.1. */
-#include <sys/null.h>
 
-/* The following relate to configurable system variables. POSIX Table 4-2. */
-#define _SC_ARG_MAX       1
-#define _SC_CHILD_MAX     2
-#define _SC_CLOCKS_PER_SEC 3
-#define _SC_CLK_TCK       3
-#define _SC_NGROUPS_MAX           4
-#define _SC_OPEN_MAX      5
-#define _SC_JOB_CONTROL           6
-#define _SC_SAVED_IDS     7
-#define _SC_VERSION       8
-#define _SC_STREAM_MAX    9
-#define _SC_TZNAME_MAX    10
-#define _SC_PAGESIZE     11
-#define _SC_PAGE_SIZE    _SC_PAGESIZE
-
-/* The following relate to configurable pathname variables. POSIX Table 5-2. */
-#define _PC_LINK_MAX      1    /* link count */
-#define _PC_MAX_CANON     2    /* size of the canonical input queue */
-#define _PC_MAX_INPUT     3    /* type-ahead buffer size */
-#define _PC_NAME_MAX      4    /* file name size */
-#define _PC_PATH_MAX      5    /* pathname size */
-#define _PC_PIPE_BUF      6    /* pipe size */
-#define _PC_NO_TRUNC      7    /* treatment of long name components */
-#define _PC_VDISABLE      8    /* tty disable */
-#define _PC_CHOWN_RESTRICTED 9 /* chown restricted or not */
-
-/* POSIX defines several options that may be implemented or not, at the
- * implementer's whim.  This implementer has made the following choices:
- *
- * _POSIX_JOB_CONTROL      not defined:        no job control
- * _POSIX_SAVED_IDS        not defined:        no saved uid/gid
- * _POSIX_NO_TRUNC         defined as -1:      long path names are truncated
- * _POSIX_CHOWN_RESTRICTED  defined:           you can't give away files
- * _POSIX_VDISABLE         defined:            tty functions can be disabled
+/*
+ * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
+ */
+#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
+    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
+int     ttyname_r(int, char *, size_t);
+int     pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
+#endif
+
+/*
+ * X/Open Portability Guide, all issues
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+int     chroot(const char *);
+int     nice(int);
+#endif
+
+
+/*
+ * X/Open Portability Guide >= Issue 4
+ */
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+__aconst char *crypt(const char *, const char *);
+int     encrypt(char *, int);
+char   *getpass(const char *);
+pid_t   getsid(pid_t);
+#endif
+
+
+/*
+ * X/Open Portability Guide >= Issue 4 Version 2
+ */
+#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
+    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+#ifndef        intptr_t
+typedef        __intptr_t      intptr_t;
+#define        intptr_t        __intptr_t
+#endif
+
+#define F_ULOCK                0
+#define F_LOCK         1
+#define F_TLOCK                2
+#define F_TEST         3
+
+int     brk(void *);
+int     fchdir(int);
+#if !defined(__minix) && defined(_XOPEN_SOURCE)
+int     fchown(int, uid_t, gid_t) __RENAME(__posix_fchown);
+#else
+int     fchown(int, uid_t, gid_t);
+#endif
+int     getdtablesize(void);
+long    gethostid(void);
+int     gethostname(char *, size_t);
+__pure int
+        getpagesize(void);             /* legacy */
+#ifndef __minix
+pid_t   getpgid(pid_t);
+#endif /* !__minix */
+#ifndef __minix
+#if defined(_XOPEN_SOURCE)
+int     lchown(const char *, uid_t, gid_t) __RENAME(__posix_lchown);
+#else
+int     lchown(const char *, uid_t, gid_t);
+#endif
+#endif /* !__minix */
+int     lockf(int, int, off_t);
+#if __SSP_FORTIFY_LEVEL == 0
+ssize_t         readlink(const char * __restrict, char * __restrict, size_t);
+#endif
+void   *sbrk(intptr_t);
+#ifndef __minix
+/* XXX prototype wrong! */
+int     setpgrp(pid_t, pid_t);                 /* obsoleted by setpgid() */
+int     setregid(gid_t, gid_t);
+int     setreuid(uid_t, uid_t);
+#endif /* !__minix */
+void    swab(const void * __restrict, void * __restrict, ssize_t);
+int     symlink(const char *, const char *);
+void    sync(void);
+useconds_t ualarm(useconds_t, useconds_t);
+int     usleep(useconds_t);
+#ifndef __LIBC12_SOURCE__
+pid_t   vfork(void) __RENAME(__vfork14);
+#endif
+
+#ifndef __AUDIT__
+char   *getwd(char *);                         /* obsoleted by getcwd() */
+#endif
+#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
+
+
+/*
+ * X/Open CAE Specification Issue 5 Version 2
  */
-#define _POSIX_NO_TRUNC       (-1)
-#define _POSIX_CHOWN_RESTRICTED  1
-
-/* Function Prototypes. */
-_PROTOTYPE( void _exit, (int _status)                                  );
-_PROTOTYPE( int access, (const char *_path, int _amode)                        );
-_PROTOTYPE( unsigned int alarm, (unsigned int _seconds)                        );
-_PROTOTYPE( int chdir, (const char *_path)                             );
-_PROTOTYPE( int fchdir, (int fd)                                       );
-_PROTOTYPE( int chown, (const char *_path, uid_t _owner, gid_t _group) );
-_PROTOTYPE( int fchown, (int fd, uid_t _owner, gid_t _group)   );
-_PROTOTYPE( int close, (int _fd)                                       );
-_PROTOTYPE( char *ctermid, (char *_s)                                  );
-_PROTOTYPE( char *cuserid, (char *_s)                                  );
-_PROTOTYPE( int dup, (int _fd)                                         );
-_PROTOTYPE( int dup2, (int _fd, int _fd2)                              );
-_PROTOTYPE( int execl, (const char *_path, const char *_arg, ...)      );
-_PROTOTYPE( int execle, (const char *_path, const char *_arg, ...)     );
-_PROTOTYPE( int execlp, (const char *_file, const char *arg, ...)      );
-_PROTOTYPE( int execv, (const char *_path, char *const _argv[])                );
-_PROTOTYPE( int execve, (const char *_path, char *const _argv[], 
-                                               char *const _envp[])    );
-_PROTOTYPE( int execvp, (const char *_file, char *const _argv[])       );
-_PROTOTYPE( pid_t fork, (void)                                         );
-_PROTOTYPE( long fpathconf, (int _fd, int _name)                       );
-_PROTOTYPE( char *getcwd, (char *_buf, size_t _size)                   );
-_PROTOTYPE( gid_t getegid, (void)                                      );
-_PROTOTYPE( uid_t geteuid, (void)                                      );
-_PROTOTYPE( gid_t getgid, (void)                                       );
-_PROTOTYPE( int getgroups, (int _gidsetsize, gid_t _grouplist[])       );
-_PROTOTYPE( int setgroups, (int _ngroups, gid_t const *grps)           );
-_PROTOTYPE( char *getlogin, (void)                                     );
-_PROTOTYPE( pid_t getpgrp, (void)                                      );
-_PROTOTYPE( pid_t getpid, (void)                                       );
-_PROTOTYPE( pid_t getppid, (void)                                      );
-_PROTOTYPE( uid_t getuid, (void)                                       );
-_PROTOTYPE( int isatty, (int _fd)                                      );
-_PROTOTYPE( int issetugid, (void)                                      );
-_PROTOTYPE( int link, (const char *_existing, const char *_new)                );
-_PROTOTYPE( off_t lseek, (int _fd, off_t _offset, int _whence)         );
-_PROTOTYPE( long pathconf, (const char *_path, int _name)              );
-_PROTOTYPE( int pause, (void)                                          );
-_PROTOTYPE( int pipe, (int _fildes[2])                                 );
-_PROTOTYPE( ssize_t read, (int _fd, void *_buf, size_t _n)             );
-_PROTOTYPE( ssize_t pread, (int, void *, size_t, off_t)                        );
-_PROTOTYPE( int rmdir, (const char *_path)                             );
-_PROTOTYPE( int setgid, (gid_t _gid)                           );
-_PROTOTYPE( int setegid, (gid_t _gid)                          );
-_PROTOTYPE( pid_t setsid, (void)                                       );
-_PROTOTYPE( int setuid, (uid_t _uid)                           );
-_PROTOTYPE( int seteuid, (uid_t _uid)                          );
-_PROTOTYPE( unsigned int sleep, (unsigned int _seconds)                        );
-_PROTOTYPE( long sysconf, (int _name)                                  );
-_PROTOTYPE( pid_t tcgetpgrp, (int _fd)                                 );
-_PROTOTYPE( int tcsetpgrp, (int _fd, pid_t _pgrp_id)                   );
-_PROTOTYPE( char *ttyname, (int _fd)                                   );
-_PROTOTYPE( int unlink, (const char *_path)                            );
-_PROTOTYPE( ssize_t write, (int _fd, const void *_buf, size_t _n)      );
-_PROTOTYPE( ssize_t pwrite, (int _fd, const void *_buf, size_t _n, off_t _offset));
-_PROTOTYPE( int truncate, (const char *_path, off_t _length)           );
-_PROTOTYPE( int ftruncate, (int _fd, off_t _length)                    );
-_PROTOTYPE( int nice, (int _incr)                                      );
-
-/* Open Group Base Specifications Issue 6 (not complete) */
-_PROTOTYPE( int symlink, (const char *path1, const char *path2)                );
-_PROTOTYPE( int readlink, (const char *, char *, size_t)               );
-_PROTOTYPE( int getopt, (int _argc, char * const _argv[], char const *_opts)           );
-extern char *optarg;
-extern int optreset;   /* Reset getopt state */
-extern int optind, opterr, optopt;
-_PROTOTYPE( int usleep, (useconds_t _useconds)                         );
-
-_PROTOTYPE( int brk, (char *_addr)                                     );
-_PROTOTYPE( int chroot, (const char *_name)                            );
-_PROTOTYPE( int lseek64, (int _fd, u64_t _offset, int _whence,
-                                               u64_t *_newpos)         );
-_PROTOTYPE( int mknod, (const char *_name, mode_t _mode, dev_t _addr)  );
-_PROTOTYPE( int mknod4, (const char *_name, mode_t _mode, dev_t _addr,
-           long _size)                                                 );
-_PROTOTYPE( char *mktemp, (char *_template)                            );
-_PROTOTYPE( long ptrace, (int _req, pid_t _pid, long _addr, long _data)        );
-_PROTOTYPE( char *sbrk, (int _incr)                                    );
-_PROTOTYPE( int sync, (void)                                           );
-_PROTOTYPE( int fsync, (int fd)                                                );
-_PROTOTYPE( int reboot, (int _how, ...)                                        );
-_PROTOTYPE( int gethostname, (char *_hostname, size_t _len)            );
-_PROTOTYPE( int getdomainname, (char *_domain, size_t _len)            );
-
-
-/* For compatibility with other Unix systems */
-_PROTOTYPE( int getpagesize, (void)                                    );
-_PROTOTYPE( int setgroups, (int ngroups, const gid_t *gidset)          );
-_PROTOTYPE( int initgroups, (const char *name, gid_t basegid)          );
-_PROTOTYPE( void *setmode, (const char *)                              );
-_PROTOTYPE( mode_t  getmode, (const void *, mode_t)                    );
-_PROTOTYPE( void    strmode, (mode_t, char *)                          );
-_PROTOTYPE( int ttyslot, (void)                                                );
-_PROTOTYPE( int fttyslot, (int _fd)                                    );
-_PROTOTYPE( char *crypt, (const char *_key, const char *_salt)         );
-
-#ifdef _MINIX
-#ifndef _TYPE_H
+#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
+ssize_t         pread(int, void *, size_t, off_t);
+ssize_t         pwrite(int, const void *, size_t, off_t);
+#endif
+
+
+/*
+ * Implementation-defined extensions
+ */
+#ifdef __minix
+int lseek64(int fd, u64_t _offset, int _whence, u64_t *_newpos);
+#if defined(_MINIX)
 #include <minix/type.h>
+
+int getprocnr(void);
+int getnprocnr(pid_t pid);
+int getpprocnr(void);
+int _pm_findproc(char *proc_name, int *proc_nr);
+int mapdriver(char *label, int major, int style, int flags);
+pid_t getnpid(endpoint_t proc_ep);
+uid_t getnuid(endpoint_t proc_ep);
+gid_t getngid(endpoint_t proc_ep);
+int getnucred(endpoint_t proc_ep, struct ucred *ucred);
+ssize_t pread64(int fd, void *buf, size_t count, u64_t where);
+ssize_t pwrite64(int fd, const void *buf, size_t count, u64_t where);
+#endif /* __MINIX */
+#endif /* __minix */
+
+#if defined(_NETBSD_SOURCE)
+#ifndef __minix
+int     acct(const char *);
+#endif /* !__minix */
+int     closefrom(int);
+int     des_cipher(const char *, char *, long, int);
+int     des_setkey(const char *);
+void    endusershell(void);
+int     exect(const char *, char * const *, char * const *);
+int     fchroot(int);
+int     fsync_range(int, int, off_t, off_t);
+int     getdomainname(char *, size_t);
+int     getgrouplist(const char *, gid_t, gid_t *, int *);
+int     getgroupmembership(const char *, gid_t, gid_t *, int, int *);
+mode_t  getmode(const void *, mode_t);
+int     getpeereid(int, uid_t *, gid_t *);
+int     getsubopt(char **, char * const *, char **);
+__aconst char *getusershell(void);
+int     initgroups(const char *, gid_t);
+int     iruserok(uint32_t, int, const char *, const char *);
+int      issetugid(void);
+int     nfssvc(int, void *);
+#ifndef __minix
+int     profil(char *, size_t, u_long, u_int);
+#endif /* !__minix */
+#ifndef __PSIGNAL_DECLARED
+#define __PSIGNAL_DECLARED
+/* also in signal.h */
+void   psignal(int, const char *);
+#endif /* __PSIGNAL_DECLARED */
+int     rcmd(char **, int, const char *, const char *, const char *, int *);
+#ifdef __minix
+int     reboot(int, ...);
+#else
+int     reboot(int, char *);
 #endif
+#ifndef __minix
+int     revoke(const char *);
+#endif
+int     rresvport(int *);
+int     ruserok(const char *, int, const char *, const char *);
+int     setdomainname(const char *, size_t);
+int     setgroups(int, const gid_t *);
+int     sethostid(long);
+int     sethostname(const char *, size_t);
+int     setlogin(const char *);
+void   *setmode(const char *);
+int     setrgid(gid_t);
+int     setruid(uid_t);
+void    setusershell(void);
+void    strmode(mode_t, char *);
+#ifndef __STRSIGNAL_DECLARED
+#define __STRSIGNAL_DECLARED
+/* backwards-compatibility; also in string.h */
+__aconst char *strsignal(int);
+#endif /* __STRSIGNAL_DECLARED */
+#ifndef __minix
+int     swapctl(int, void *, int);
+int     swapon(const char *);                  /* obsoleted by swapctl() */
+#endif /* !__minix */
+int     syscall(int, ...);
+quad_t  __syscall(quad_t, ...);
+int     undelete(const char *);
 
-_PROTOTYPE( int getprocnr, (void)                                      );
-_PROTOTYPE( int getnprocnr, (pid_t pid)                                        );
-_PROTOTYPE( int getpprocnr, (void)                                     );
-_PROTOTYPE( int _pm_findproc, (char *proc_name, int *proc_nr)          );
-_PROTOTYPE( int mapdriver, (char *label, int major, int style,
-                                                       int flags)      );
-_PROTOTYPE( pid_t getnpid, (endpoint_t proc_ep)                                );
-_PROTOTYPE( uid_t getnuid, (endpoint_t proc_ep)                                );
-_PROTOTYPE( gid_t getngid, (endpoint_t proc_ep)                                );
-_PROTOTYPE( int getnucred, (endpoint_t proc_ep, struct ucred *ucred)   );
-_PROTOTYPE( ssize_t pread64, (int fd, void *buf, size_t count, u64_t where));
-_PROTOTYPE( ssize_t pwrite64, (int fd, const void *buf, size_t count,
-                               u64_t where));
+#if 1 /*INET6*/
+int     rcmd_af(char **, int, const char *,
+           const char *, const char *, int *, int);
+int     rresvport_af(int *, int);
+int     iruserok_sa(const void *, int, int, const char *, const char *);
+#endif
 
+#ifndef __SYS_SIGLIST_DECLARED
+#define __SYS_SIGLIST_DECLARED
+/* also in signal.h */
+extern const char *const *sys_siglist __RENAME(__sys_siglist14);
+#endif /* __SYS_SIGLIST_DECLARED */
+extern  int optreset;          /* getopt(3) external variable */
+extern  char *suboptarg;       /* getsubopt(3) external variable */
 #endif
 
-#ifdef _POSIX_SOURCE
-_PROTOTYPE( int getdtablesize, (void)                                   );
+__END_DECLS
+
+#ifdef __minix
+/* Minix expects RBT_* flags to be included with <unistd.h> */
+#include <sys/reboot.h>
 #endif
 
-#endif /* _UNISTD_H */
+#endif /* !_UNISTD_H_ */
index e34d940e76fc1e52b02e96073336c20ae0ca030b..34252cca49423d750fb8b5ff4d195fe436aa8ec6 100644 (file)
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.h,v 1.49 2007/12/14 16:36:19 christos Exp $       */
+/*     $NetBSD: util.h,v 1.55 2010/02/25 18:37:12 joerg Exp $  */
 
 /*-
  * Copyright (c) 1995
 #define        _UTIL_H_
 
 #include <sys/cdefs.h>
+#include <sys/ttycom.h>
 #include <sys/types.h>
 #include <stdio.h>
 #include <pwd.h>
 #include <termios.h>
 #include <utmp.h>
-#include <minix/ansi.h>
+#include <utmpx.h>
+#include <machine/ansi.h>
 
 #ifdef  _BSD_TIME_T_
 typedef _BSD_TIME_T_    time_t;
@@ -53,7 +55,6 @@ typedef _BSD_TIME_T_    time_t;
 #define        PW_POLICY_BYGROUP       2
 
 __BEGIN_DECLS
-#ifndef __minix
 struct disklabel;
 struct iovec;
 struct passwd;
@@ -62,8 +63,6 @@ struct utmp;
 struct winsize;
 struct sockaddr;
 
-typedef struct pw_policy *pw_policy_t; 
-
 char          *flags_to_string(unsigned long, const char *);
 pid_t          forkpty(int *, char *, struct termios *, struct winsize *);
 const char     *getbootfile(void);
@@ -71,39 +70,49 @@ off_t               getlabeloffset(void);
 int            getlabelsector(void);
 int            getmaxpartitions(void);
 int            getrawpartition(void);
-void           login(const struct utmp *);
-void           loginx(const struct utmpx *);
+#ifndef __LIBC12_SOURCE__
+void           login(const struct utmp *) __RENAME(__login50);
+void           loginx(const struct utmpx *) __RENAME(__loginx50);
+#endif
 int            login_tty(int);
 int            logout(const char *);
 int            logoutx(const char *, int, int);
 void           logwtmp(const char *, const char *, const char *);
 void           logwtmpx(const char *, const char *, const char *, int, int);
 int            opendisk(const char *, int, char *, size_t, int);
+int            opendisk1(const char *, int, char *, size_t, int,
+                         int (*)(const char *, int, ...));
 int            openpty(int *, int *, char *, struct termios *,
-                   struct winsize *);
-time_t         parsedate(const char *, const time_t *, const int *);
+    struct winsize *);
+#ifndef __LIBC12_SOURCE__
+time_t         parsedate(const char *, const time_t *, const int *)
+    __RENAME(__parsedate50);
+#endif
 int            pidfile(const char *);
 int            pidlock(const char *, int, pid_t *, const char *);
 int            pw_abort(void);
-void           pw_copy(int, int, struct passwd *, struct passwd *);
+#ifndef __LIBC12_SOURCE__
+void           pw_copy(int, int, struct passwd *, struct passwd *)
+    __RENAME(__pw_copy50);
 int            pw_copyx(int, int, struct passwd *, struct passwd *,
-                        char *, size_t);
+    char *, size_t) __RENAME(__pw_copyx50);
+#endif
 void           pw_edit(int, const char *);
 void           pw_error(const char *, int, int);
 void           pw_getconf(char *, size_t, const char *, const char *);
+#ifndef __LIBC12_SOURCE__
 void           pw_getpwconf(char *, size_t, const struct passwd *,
-                            const char *);
+    const char *) __RENAME(__pw_getpwconf50);
+#endif
 const char     *pw_getprefix(void);
 void           pw_init(void);
 int            pw_lock(int);
 int            pw_mkdb(const char *, int);
-pw_policy_t    pw_policy_load(void *, int);
-int            pw_policy_test(pw_policy_t, char *);
-void           pw_policy_free(pw_policy_t);
 void           pw_prompt(void);
 int            pw_setprefix(const char *);
 int            raise_default_signal(int);
 int            secure_path(const char *);
+int            snprintb_m(char *, size_t, const char *, uint64_t, size_t);
 int            snprintb(char *, size_t, const char *, uint64_t);
 int            sockaddr_snprintf(char *, size_t, const char *,
     const struct sockaddr *);
@@ -116,8 +125,6 @@ int         ttyunlock(const char *);
 uint16_t       disklabel_dkcksum(struct disklabel *);
 int            disklabel_scan(struct disklabel *, char *, size_t);
 
-#endif
-
 /* Error checked functions */
 void           (*esetfunc(void (*)(int, const char *, ...)))
     (int, const char *, ...);
@@ -128,13 +135,12 @@ char              *estrndup(const char *, size_t);
 void           *ecalloc(size_t, size_t);
 void           *emalloc(size_t);
 void           *erealloc(void *, size_t);
-FILE           *efopen(const char *, const char *);
-
+struct __sFILE *efopen(const char *, const char *);
 int            easprintf(char ** __restrict, const char * __restrict, ...)
-    __attribute__((__format__(__printf__, 2, 3)));
+                       __printflike(2, 3);
 int            evasprintf(char ** __restrict, const char * __restrict,
     _BSD_VA_LIST_)
-    __attribute__((__format__(__printf__, 2, 0)));
+                       __printflike(2, 0);
 __END_DECLS
 
 #endif /* !_UTIL_H_ */
index e020787030c6d67fdadd465577dc0c71f80df003..bf82611a7296e9372402a55963aa23015e96165f 100644 (file)
@@ -1,18 +1,57 @@
-/* The <utime.h> header is used for the utime() system call. */
+/*     $NetBSD: utime.h,v 1.9 2009/01/11 03:04:12 christos Exp $       */
 
-#ifndef _UTIME_H
-#define _UTIME_H
+/*-
+ * Copyright (c) 1990, 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. 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.
+ *
+ *     @(#)utime.h     8.1 (Berkeley) 6/2/93
+ */
 
-#ifndef _TYPES_H
-#include <minix/types.h>
+#ifndef        _UTIME_H_
+#define        _UTIME_H_
+
+#include <machine/ansi.h>
+
+#ifdef _BSD_TIME_T_
+typedef        _BSD_TIME_T_    time_t;
+#undef _BSD_TIME_T_
 #endif
 
 struct utimbuf {
-  time_t actime;               /* access time */
-  time_t modtime;              /* modification time */
+       time_t actime;          /* Access time */
+       time_t modtime;         /* Modification time */
 };
 
-/* Function Prototypes. */
-_PROTOTYPE( int utime, (const char *_path, const struct utimbuf *_times)     );
+#include <sys/cdefs.h>
+
+__BEGIN_DECLS
+#ifndef __LIBC12_SOURCE__
+int utime(const char *, const struct utimbuf *) __RENAME(__utime50);
+#endif
+__END_DECLS
 
-#endif /* _UTIME_H */
+#endif /* !_UTIME_H_ */
index 2e24d9483255eb4a0d856976bccac474cb6d9bac..dd23b085611b577a0be71f8944fa98a9fe6fcf33 100644 (file)
@@ -1,24 +1,83 @@
-/* The <utmp.h> header is used by init, login, who, etc. */
+/*     $NetBSD: utmp.h,v 1.12 2009/01/11 03:04:12 christos Exp $       */
 
-#ifndef _UTMP_H
-#define _UTMP_H
+/*
+ * Copyright (c) 1988, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * 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. 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.
+ *
+ *     @(#)utmp.h      8.2 (Berkeley) 1/21/94
+ */
 
-#define WTMP  "/usr/adm/wtmp"  /* the login history file */
-#define BTMP  "/usr/adm/btmp"  /* the bad-login history file */
-#define UTMP  "/etc/utmp"      /* the user accouting file */
+#ifndef        _UTMP_H_
+#define        _UTMP_H_
 
+#ifdef __minix
+#define _PATH_UTMP     "/etc/utmp"
+#define _PATH_WTMP     "/usr/adm/wtmp"
+#define _PATH_BTMP     "/usr/adm/btmp"
+#define _PATH_LASTLOG  "/usr/adm/lastlog"
+#define UTMP           _PATH_UTMP
+#define WTMP           _PATH_WTMP
+#define BTMP           _PATH_BTMP
+#else
+#define        _PATH_UTMP      "/var/run/utmp"
+#define        _PATH_WTMP      "/var/log/wtmp"
+#define        _PATH_LASTLOG   "/var/log/lastlog"
+#endif
+
+#define        UT_NAMESIZE     8
+#ifdef __minix
+#define UT_LINESIZE    12
+#else
+#define        UT_LINESIZE     8
+#endif
+#define        UT_HOSTSIZE     16
+
+struct lastlog {
+       time_t  ll_time;
+       char    ll_line[UT_LINESIZE];
+       char    ll_host[UT_HOSTSIZE];
+};
+
+#ifdef __minix
 struct utmp {
-  char ut_user[8];             /* user name */
+  char ut_name[UT_NAMESIZE];           /* user name */
   char ut_id[4];               /* /etc/inittab ID */
-  char ut_line[12];            /* terminal name */
-  char ut_host[16];            /* host name, when remote */
+  char ut_line[UT_LINESIZE];           /* terminal name */
+  char ut_host[UT_HOSTSIZE];           /* host name, when remote */
   short ut_pid;                        /* process id */
   short int ut_type;           /* type of entry */
   long ut_time;                        /* login/logout time */
 };
 
-#define ut_name ut_user                /* for compatibility with other systems */
-
 /* Definitions for ut_type. */
 #define RUN_LVL            1   /* this is a RUN_LEVEL record */
 #define BOOT_TIME          2   /* this is a REBOOT record */
@@ -27,4 +86,23 @@ struct utmp {
 #define USER_PROCESS       7   /* any other user process */
 #define DEAD_PROCESS       8   /* this process has died (wtmp only) */
 
-#endif /* _UTMP_H */
+#else /* !__minix */
+
+struct utmp {
+       char    ut_line[UT_LINESIZE];
+       char    ut_name[UT_NAMESIZE];
+       char    ut_host[UT_HOSTSIZE];
+       time_t  ut_time;
+};
+#endif /* __minix */
+
+__BEGIN_DECLS
+int utmpname(const char *);
+void setutent(void);
+#ifndef __LIBC12_SOURCE__
+struct utmp *getutent(void) __RENAME(__getutent50);
+#endif
+void endutent(void);
+__END_DECLS
+
+#endif /* !_UTMP_H_ */
similarity index 100%
rename from nbsd_include/utmpx.h
rename to include/utmpx.h
similarity index 100%
rename from nbsd_include/uuid.h
rename to include/uuid.h
similarity index 100%
rename from nbsd_include/varargs.h
rename to include/varargs.h
similarity index 100%
rename from nbsd_include/vis.h
rename to include/vis.h
index e7d7da1107e3d4d6cca250f7f64536ac08fa2384..e7fc28349a633ccbb4b85098a63994b88572b03a 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: wchar.h,v 1.29 2010/03/27 22:14:09 tnozaki Exp $       */
+
 /*-
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
 #ifndef _WCHAR_H_
 #define _WCHAR_H_
 
-#include <minix/ansi.h>
-#include <stdarg.h>
-#include <stddef.h>
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+#include <machine/wchar_limits.h>
+#include <sys/ansi.h>
+#include <sys/null.h>
 
 #include <stdio.h> /* for FILE* */
 
-/* mbstate_t is an opaque object to keep conversion state in wide-char
- * conversion. Do not refer to the contents in user programs.
- * (Based on NETBSD implementation.)
- */
-typedef union {
-    long int __mbstateL;   /* For alignment. NETBSD uses int64_t. */
-    char __mbstate8[128];
-} __mbstate_t;
-
-#ifndef        _MBSTATE_T
-#define        _MBSTATE_T
-typedef        __mbstate_t mbstate_t;
-#define _GLIBCXX_HAVE_MBSTATE_T 1
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
+typedef        _BSD_WCHAR_T_   wchar_t;
+#undef _BSD_WCHAR_T_
 #endif
 
-#ifndef        _WINT_T
-#define        _WINT_T
-typedef        int wint_t;
+#ifdef _BSD_MBSTATE_T_
+typedef        _BSD_MBSTATE_T_ mbstate_t;
+#undef _BSD_MBSTATE_T_
 #endif
 
+#ifdef _BSD_WINT_T_
+typedef        _BSD_WINT_T_    wint_t;
+#undef _BSD_WINT_T_
+#endif
 
-struct tm;
-
-#ifdef __ACK__
-#define __restrict
+#ifdef _BSD_SIZE_T_
+typedef        _BSD_SIZE_T_    size_t;
+#undef _BSD_SIZE_T_
 #endif
 
+struct tm;
+
+__BEGIN_DECLS
 wint_t btowc(int);
 size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
 size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
@@ -167,18 +167,18 @@ int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
 int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
 int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, ...);
 int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
-int vfwprintf(FILE * __restrict, const wchar_t * __restrict, va_list);
+int vfwprintf(FILE * __restrict, const wchar_t * __restrict, _BSD_VA_LIST_);
 int vswprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict,
-    va_list);
-int vwprintf(const wchar_t * __restrict, va_list);
+    _BSD_VA_LIST_);
+int vwprintf(const wchar_t * __restrict, _BSD_VA_LIST_);
 int wprintf(const wchar_t * __restrict, ...);
 int wscanf(const wchar_t * __restrict, ...);
 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
     defined(_NETBSD_SOURCE)
-int vfwscanf(FILE * __restrict, const wchar_t * __restrict, va_list);
+int vfwscanf(FILE * __restrict, const wchar_t * __restrict, _BSD_VA_LIST_);
 int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
-    va_list);
-int vwscanf(const wchar_t * __restrict, va_list);
+    _BSD_VA_LIST_);
+int vwscanf(const wchar_t * __restrict, _BSD_VA_LIST_);
 #endif
 #if defined(_NETBSD_SOURCE)
 struct tinfo;
@@ -188,6 +188,7 @@ wchar_t *wcsdup (const wchar_t *);
 int wcsncasecmp (const wchar_t *, const wchar_t *, size_t);
 int wcscasecmp(const wchar_t *, const wchar_t *);
 #endif
+__END_DECLS
 
 #ifndef WEOF
 #define        WEOF    ((wint_t)-1)
index 810c45be9acd5a214e81e3d4323447259d2f4480..b8689b15c48569287d5c1de4f0bb80d9502b0033 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: wctype.h,v 1.7 2010/03/27 22:14:09 tnozaki Exp $       */
+
 /*-
  * Copyright (c)1999 Citrus Project,
  * All rights reserved.
 #ifndef _WCTYPE_H_
 #define        _WCTYPE_H_
 
-#include <minix/ansi.h>
-#include <stddef.h>
-#include <wchar.h>
+#include <sys/cdefs.h>
+#include <sys/ansi.h>
+
+#ifdef _BSD_WINT_T_
+typedef        _BSD_WINT_T_    wint_t;
+#undef _BSD_WINT_T_
+#endif
 
-#ifndef        _WCTYPE_T
-#define        _WCTYPE_T
-typedef        void *wctype_t;
+#ifdef _BSD_WCTRANS_T_
+typedef        _BSD_WCTRANS_T_ wctrans_t;
+#undef _BSD_WCTRANS_T_
 #endif
 
-#ifndef        _WCTRANS_T
-#define        _WCTRANS_T
-typedef        void *wctrans_t;
+#ifdef _BSD_WCTYPE_T_
+typedef        _BSD_WCTYPE_T_  wctype_t;
+#undef _BSD_WCTYPE_T_
 #endif
 
 #ifndef WEOF
 #define        WEOF    ((wint_t)-1)
 #endif
 
+__BEGIN_DECLS
+int    iswalnum(wint_t);
+int    iswalpha(wint_t);
+int    iswblank(wint_t);
+int    iswcntrl(wint_t);
+int    iswdigit(wint_t);
+int    iswgraph(wint_t);
+int    iswlower(wint_t);
+int    iswprint(wint_t);
+int    iswpunct(wint_t);
+int    iswspace(wint_t);
+int    iswupper(wint_t);
+int    iswxdigit(wint_t);
 int    iswctype(wint_t, wctype_t);
 wint_t towctrans(wint_t, wctrans_t);
+wint_t towlower(wint_t);
+wint_t towupper(wint_t);
 wctrans_t wctrans(const char *);
 wctype_t wctype(const char *);
-wint_t towlower(wint_t);
-wint_t towupper(wint_t);
+__END_DECLS
 
 #endif         /* _WCTYPE_H_ */
similarity index 100%
rename from nbsd_include/wordexp.h
rename to include/wordexp.h
index 187d36d2b6f0e8e1ad8c0226dd2ace168965ba6a..5a97844f777baaa5648fa5ae983b2a026a6fb112 100644 (file)
@@ -18,9 +18,6 @@ LDADD+=       -ltimers -lsys -lexec
 
 CFLAGS += -D__kernel__
 
-.if ${COMPILER_TYPE} == "ack"
-LDFLAGS+= -.o
-.elif ${COMPILER_TYPE} == "gnu"
 CPPFLAGS+= -fno-stack-protector -D_NETBSD_SOURCE
 LDFLAGS+= -T ${.CURDIR}/arch/${ARCH}/kernel.lds
 LDFLAGS+= -nostdlib -L${LIBDIR}
@@ -32,7 +29,6 @@ LDADD+=       -lgcc -lsys -lgcc -lminc
 LDADD+= -L/usr/pkg/lib -L/usr/pkg/compiler-rt/lib -lCompilerRT-Generic -lsys -lCompilerRT-Generic -lminc
 DPADD+=        ${LIBC}
 .endif
-.endif
 
 CPPFLAGS+=     -I${.CURDIR} -I${.CURDIR}/arch/${ARCH}/include -I${MINIXSRCDIR}
 
@@ -102,11 +98,11 @@ extracted-errno.h: extract-errno.sh ../include/errno.h
        ${_MKTARGET_CREATE}
        cd ${.CURDIR} ; sh extract-errno.sh > ${.OBJDIR}/extracted-errno.h
 
-extracted-mfield.h: extract-mfield.sh ../lib/libc/other/*.c ../lib/libc/posix/*.c ../lib/libsys/*.c
+extracted-mfield.h: extract-mfield.sh ../lib/libc/sys-minix/*.c ../lib/libsys/*.c
        ${_MKTARGET_CREATE}
        cd ${.CURDIR} ; sh extract-mfield.sh > ${.OBJDIR}/extracted-mfield.h
 
-extracted-mtype.h: extract-mtype.sh ../common/include/minix/com.h
+extracted-mtype.h: extract-mtype.sh ../include/minix/com.h
        ${_MKTARGET_CREATE}
        cd ${.CURDIR} ; sh extract-mtype.sh > ${.OBJDIR}/extracted-mtype.h
 
index 08fb9fced8ae9f0f31641cbe35afea76b04e3e0e..28acb04577b4de5a66678573f3cfbdadc756b4f9 100644 (file)
@@ -32,13 +32,3 @@ SRCS += arch_smp.c trampoline.S
 .endif
 
 
-.if ${COMPILER_TYPE} == "ack"
-I86CPPFLAGS =  -mi86
-I86LDFLAGS =   -mi86
-
-CPPFLAGS.klib16.S =    ${I86CPPFLAGS}
-LDFLAGS.klib16.S  =    ${I86LDFLAGS}
-
-CPPFLAGS.trampoline.S =        ${I86CPPFLAGS}
-LDFLAGS.trampoline.S  =        ${I86LDFLAGS}
-.endif
index ff0242fd92b4d06a0072b0917fae962c168378ea..cb5a10feb5c7d5f50427bbd8b0c975fd7547d60d 100644 (file)
@@ -3,7 +3,7 @@
 set -e
 
 # grep message type and errno constants and make them into a .h file
-cat ../include/errno.h | \
+cat ../include/sys/errno.h | \
 tr -s ' \t' ' ' | \
 sed 's/^# /#/' | \
 egrep '^#define [A-Z_][A-Z0-9_]* \( ?_SIGN ?[0-9]+ ?\)' | \
index 14c60829426aa52b54759bcf7be019c855f57996..a84ba8f561fad3226e01bd2dd14e4752a48e8d65 100644 (file)
@@ -4,7 +4,7 @@ set -e
 
 find_files_and_lines()
 (
-       find  ../lib/libc/other ../lib/libc/posix ../lib/libsys -name '*.c' | \
+       find  ../lib/libc/sys-minix ../lib/libsys -name '*.c' | \
        xargs egrep -n '((_syscall|_taskcall)\([^,][^,]*,[      ]*|_kernel_call\()[A-Z_][A-Z0-9_]*,[    ]*&m\)' | \
        cut -d: -f1,2
 )
index 47507f6168b4ba142f50cdf5107938026a02fe7b..3322ad83cce1213202b8b56642694ff6d86c2eb2 100644 (file)
@@ -4,12 +4,12 @@ set -e
 
 # grep message type constants and make them into a .h file
 (
-       cat ../common/include/minix/callnr.h | \
+       cat ../include/minix/callnr.h | \
        tr -s ' \t' ' ' | \
        sed 's/^# /#/' | \
        egrep '^#define [A-Z_][A-Z0-9_]* [0-9]+' | grep -v NCALLS 
        
-       cat ../common/include/minix/com.h | \
+       cat ../include/minix/com.h | \
        tr -s ' \t' ' ' | \
        sed 's/^# /#/' | \
        egrep '^#define [A-Z_][A-Z0-9_]* \( ?([A-Z0-9_]+_BASE|KERNEL_CALL) ?\+[A-Za-z0-9_ +]+\)'        
index 8908ea14b3e5b5032c41b82cabf57afe781f7c85..225b16837e659a12b2abd4ecc708b4577ff7acd4 100644 (file)
@@ -1,51 +1,10 @@
 .include <bsd.own.mk>
 
-.if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no")
-LIBC_DIR=      nbsd_libc
-LIBM_DIR=      nbsd_libm
-LIBUTIL_DIR=   libutil
-LIBCOMPAT_DIR= nbsd_libcompat_minix
-LIBMINLIB_DIR= nbsd_libminlib
-LIBASYN_DIR=   nbsd_libasyn
-.endif
-
-LIBC_DIR?=     libc
-LIBM_DIR?=     libm
-LIBUTIL_DIR?=  libminixutil
-LIBCOMPAT_DIR?=
-LIBMINLIB_DIR?=
-LIBASYN_DIR?=
-
-SUBDIR= csu ${LIBCOMPAT_DIR} ${LIBC_DIR} libblockdriver libchardriver     \
-       libnetdriver libedit ${LIBM_DIR} libsys libtimers ${LIBUTIL_DIR}  \
+SUBDIR= csu libcompat_minix libc libblockdriver libchardriver     \
+       libnetdriver libedit libm libsys libtimers libutil \
        libl libhgfs libz libfetch libvtreefs libaudiodriver libmthread   \
-       libexec libdevman libusb ${LIBMINLIB_DIR} ${LIBASYN_DIR}          \
-       libddekit libminixfs libbdev 
-
-.if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no")
-SUBDIR+= libelf libminc libcrypt libterminfo libcurses libvassert libutil \
-        libpuffs librefuse libbz2 libarchive libprop
-.endif
-
-.if ${COMPILER_TYPE} == "ack"
-SUBDIR+= ack/libd ack/libe ack/libfp ack/liby
-.endif
+       libexec libdevman libusb libminlib libasyn          \
+       libddekit libminixfs libbdev libelf libminc libcrypt libterminfo \
+       libcurses libvassert libutil libpuffs librefuse libbz2 libarchive libprop
 
-.if ${OBJECT_FMT} == "a.out"
-SUBDIR+= libend
-.endif
 .include <bsd.subdir.mk>
-
-build_ack:
-       sh ack_build.sh obj dependall install
-
-build_elf:
-       sh elf_build.sh obj dependall install
-
-clean_all:
-       sh ack_build.sh clean
-       sh elf_build.sh clean
-
-cleandepend_all:
-       sh ack_build.sh cleandepend
-       sh elf_build.sh cleandepend
diff --git a/lib/ack/libd/Makefile b/lib/ack/libd/Makefile
deleted file mode 100644 (file)
index fda5d3d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# Makefile for libd
-
-# The ACK ANSI C compiler has an nice trick to reduce the size of programs
-# that do not use floating point.  If a program uses floating point then the
-# compiler generates an external reference to the label '_fp_hook'.  This makes
-# the loader bring in the floating point printing and conversion routines
-# '_f_print' and 'strtod' from the library libd.a.  Otherwise two dummy
-# routines are found in libc.a.  (The printf and scanf need floating point
-# for the %f formats, whether you use them or not.)
-
-CPPFLAGS+=-I${.CURDIR}/../../libc/stdio
-
-LIB=   d
-
-SRCS=  fphook.c
-
-.include <bsd.lib.mk>
diff --git a/lib/ack/libd/fphook.c b/lib/ack/libd/fphook.c
deleted file mode 100644 (file)
index 9f8c084..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * fltpr.c - print floating point numbers
- */
-/* $Header$ */
-
-#ifndef        NOFLOAT
-#include       <string.h>
-#include       <stdarg.h>
-#include       "loc_incl.h"
-int _fp_hook = 1;
-
-static char *
-_pfloat(long double r, register char *s, int n, int flags)
-{
-       register char *s1;
-       int sign, dp;
-       register int i;
-
-       s1 = _fcvt(r, n, &dp, &sign);
-       if (sign)
-               *s++ = '-';
-       else if (flags & FL_SIGN)
-               *s++ = '+';
-       else if (flags & FL_SPACE)
-               *s++ = ' ';
-
-       if (dp<=0)
-               *s++ = '0';
-       for (i=dp; i>0; i--)
-               if (*s1) *s++ = *s1++;
-               else *s++ = '0';
-       if (((i=n) > 0) || (flags & FL_ALT))
-               *s++ = '.';
-       while (++dp <= 0) {
-               if (--i<0)
-                       break;
-               *s++ = '0';
-       }
-       while (--i >= 0)
-               if (*s1) *s++ = *s1++;
-               else *s++ = '0';
-       return s;
-}
-
-static char *
-_pscien(long double r, register char *s, int n, int flags)
-{
-       int sign, dp; 
-       register char *s1;
-
-       s1 = _ecvt(r, n + 1, &dp, &sign);
-       if (sign)
-               *s++ = '-';
-       else if (flags & FL_SIGN)
-               *s++ = '+';
-       else if (flags & FL_SPACE)
-               *s++ = ' ';
-
-       *s++ = *s1++;
-       if ((n > 0) || (flags & FL_ALT))
-               *s++ = '.';
-       while (--n >= 0)
-               if (*s1) *s++ = *s1++;
-               else *s++ = '0';
-       *s++ = 'e';
-       if ( r != 0 ) --dp ;
-       if ( dp<0 ) {
-               *s++ = '-' ; dp= -dp ;
-       } else {
-               *s++ = '+' ;
-       }
-       if (dp >= 100) {
-               *s++ = '0' + (dp / 100);
-               dp %= 100;
-       }
-       *s++ = '0' + (dp/10);
-       *s++ = '0' + (dp%10);
-       return s;
-}
-
-#define        NDIGINEXP(exp)          (((exp) >= 100 || (exp) <= -100) ? 3 : 2)
-#define        LOW_EXP                 -4
-#define        USE_EXP(exp, ndigits)   (((exp) < LOW_EXP + 1) || (exp >= ndigits + 1))
-
-static char *
-_gcvt(long double value, int ndigit, char *s, int flags)
-{
-       int sign, dp;
-       register char *s1, *s2;
-       register int i;
-       register int nndigit = ndigit;
-
-       s1 = _ecvt(value, ndigit, &dp, &sign);
-       s2 = s;
-       if (sign) *s2++ = '-';
-       else if (flags & FL_SIGN)
-               *s2++ = '+';
-       else if (flags & FL_SPACE)
-               *s2++ = ' ';
-
-       if (!(flags & FL_ALT))
-               for (i = nndigit - 1; i > 0 && s1[i] == '0'; i--)
-                       nndigit--;
-
-       if (USE_EXP(dp,ndigit)) {
-               /* Use E format */
-               dp--;
-               *s2++ = *s1++;
-               if ((nndigit > 1) || (flags & FL_ALT)) *s2++ = '.';
-               while (--nndigit > 0) *s2++ = *s1++;
-               *s2++ = 'e';
-               if (dp < 0) {
-                       *s2++ = '-';
-                       dp = -dp;
-               }
-               else     *s2++ = '+';
-               s2 += NDIGINEXP(dp);
-               *s2 = 0;
-               for (i = NDIGINEXP(dp); i > 0; i--) {
-                       *--s2 = dp % 10 + '0';
-                       dp /= 10;
-               }
-               return s;
-       }
-       /* Use f format */
-       if (dp <= 0) {
-               if (*s1 != '0') {
-                       /* otherwise the whole number is 0 */
-                       *s2++ = '0';
-                       *s2++ = '.';
-               }
-               while (dp < 0) {
-                       dp++;
-                       *s2++ = '0';
-               }
-       }
-       for (i = 1; i <= nndigit; i++) {
-               *s2++ = *s1++;
-               if (i == dp) *s2++ = '.';
-       }
-       if (i <= dp) {
-               while (i++ <= dp) *s2++ = '0';
-               *s2++ = '.';
-       }
-       if ((s2[-1]=='.') && !(flags & FL_ALT)) s2--;
-       *s2 = '\0';
-       return s;
-}
-
-char *
-_f_print(va_list *ap, int flags, char *s, char c, int precision)
-{
-       register char *old_s = s;
-       long double ld_val;
-
-       if (flags & FL_LONGDOUBLE) ld_val = va_arg(*ap, long double);
-       else ld_val = (long double) va_arg(*ap, double);
-
-       switch(c) {
-       case 'f':
-               s = _pfloat(ld_val, s, precision, flags);
-               break;
-       case 'e':
-       case 'E':
-               s = _pscien(ld_val, s, precision , flags);
-               break;
-       case 'g':
-       case 'G':
-               s = _gcvt(ld_val, precision, s, flags);
-               s += strlen(s);
-               break;
-       }
-       if ( c == 'E' || c == 'G') {
-               while (*old_s && *old_s != 'e') old_s++;
-               if (*old_s == 'e') *old_s = 'E';
-       }
-       return s;
-}
-#endif /* NOFLOAT */
-/* $Header$ */
-
-#include <stdlib.h>
-#include "../ansi/ext_fmt.h"
-
-void _str_ext_cvt(const char *s, char **ss, struct EXTEND *e);
-double _ext_dbl_cvt(struct EXTEND *e);
-
-double
-strtod(const char *p, char **pp)
-{
-       struct EXTEND e;
-
-       _str_ext_cvt(p, pp, &e);
-       return _ext_dbl_cvt(&e);
-}
diff --git a/lib/ack/libe/Makefile b/lib/ack/libe/Makefile
deleted file mode 100644 (file)
index c849efd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Makefile for libe
-
-.include <bsd.own.mk>
-
-LIB=           e
-
-AFLAGS+=-Was-ack
-
-.include "${.CURDIR}/arch/${ARCH}/em/Makefile.inc"
-.include "${.CURDIR}/arch/${ARCH}/head/Makefile.inc"
-
-.include <bsd.lib.mk>
diff --git a/lib/ack/libe/Makefile.inc b/lib/ack/libe/Makefile.inc
deleted file mode 100644 (file)
index 4df075a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-.include <bsd.own.mk>
diff --git a/lib/ack/libe/arch/i386/em/Makefile.inc b/lib/ack/libe/arch/i386/em/Makefile.inc
deleted file mode 100644 (file)
index b944a0c..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# em sources
-.PATH: ${.CURDIR}/arch/${ARCH}/em
-
-SRCS+= \
-       em_adi.s \
-       em_and.s \
-       em_blm.s \
-       em_cii.s \
-       em_cms.s \
-       em_com.s \
-       em_csa4.s \
-       em_csb4.s \
-       em_cuu.s \
-       em_dup.s \
-       em_dvi.s \
-       em_dvu.s \
-       em_error.s \
-       em_exg.s \
-       em_fat.s \
-       em_fp8087.s \
-       em_gto.s \
-       em_hol0.s \
-       em_iaar.s \
-       em_ilar.s \
-       em_inn.s \
-       em_ior.s \
-       em_isar.s \
-       em_lar4.s \
-       em_loi.s \
-       em_mli.s \
-       em_mon.s \
-       em_ngi.s \
-       em_nop.s \
-       em_print.s \
-       em_rck.s \
-       em_rmi.s \
-       em_rmu.s \
-       em_rol.s \
-       em_ror.s \
-       em_sar4.s \
-       em_sbi.s \
-       em_set.s \
-       em_sli.s \
-       em_sri.s \
-       em_sti.s \
-       em_stop.s \
-       em_trp.s \
-       em_unknown.s \
-       em_xor.s
diff --git a/lib/ack/libe/arch/i386/em/byte_order.h b/lib/ack/libe/arch/i386/em/byte_order.h
deleted file mode 100644 (file)
index d08b45a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#define CHAR_UNSIGNED  0
-#define MSB_AT_LOW_ADDRESS     0
-#define MSW_AT_LOW_ADDRESS     0
-#define FL_MSB_AT_LOW_ADDRESS  0
-#define FL_MSW_AT_LOW_ADDRESS  0
-#define FL_MSL_AT_LOW_ADDRESS  0
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_adf4.s b/lib/ack/libe/arch/i386/em/disconnected/em_adf4.s
deleted file mode 100644 (file)
index c36c7b4..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .adf4
-
-       .sect .text
-.adf4:
-       mov     bx,sp
-       flds    4(bx)
-       fadds   8(bx)
-       fstps   8(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_adf8.s b/lib/ack/libe/arch/i386/em/disconnected/em_adf8.s
deleted file mode 100644 (file)
index 253dda9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .adf8
-
-       .sect .text
-.adf8:
-       mov     bx,sp
-       fldd    4(bx)
-       faddd   12(bx)
-       fstpd   12(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_cff4.s b/lib/ack/libe/arch/i386/em/disconnected/em_cff4.s
deleted file mode 100644 (file)
index 42b9464..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cff4
-
-       .sect .text
-.cff4:
-       mov     bx,sp
-       fldd    4(bx)
-       fstcw   4(bx)
-       wait
-       mov     dx,4(bx)
-       and     4(bx),0xf3ff    ! set to rounding mode
-       wait
-       fldcw   4(bx)
-       fstps   8(bx)
-       mov     4(bx),dx
-       wait
-       fldcw   4(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_cff8.s b/lib/ack/libe/arch/i386/em/disconnected/em_cff8.s
deleted file mode 100644 (file)
index cc038a8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cff8
-
-       .sect .text
-.cff8:
-       mov     bx,sp
-       flds    4(bx)
-       fstpd   4(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_cfi.s b/lib/ack/libe/arch/i386/em/disconnected/em_cfi.s
deleted file mode 100644 (file)
index 900f4e5..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cfi
-
-       .sect .text
-.cfi:
-       mov     bx,sp
-       fstcw   4(bx)
-       wait
-       mov     dx,4(bx)
-       or      4(bx),0xc00     ! truncating mode
-       wait
-       fldcw   4(bx)
-       cmp     8(bx),4
-       jne     2f
-                               ! loc 4 loc ? cfi
-       flds    12(bx)
-       fistpl  12(bx)
-1:
-       mov     4(bx),dx
-       wait
-       fldcw   4(bx)
-       ret
-2:
-                               ! loc 8 loc ? cfi
-       fldd    12(bx)
-       fistpl  16(bx)
-       jmp     1b
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_cfu.s b/lib/ack/libe/arch/i386/em/disconnected/em_cfu.s
deleted file mode 100644 (file)
index 96c98bb..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cfu
-
-       .sect .text
-.cfu:
-       mov     bx,sp
-       fstcw   4(bx)
-       wait
-       mov     dx,4(bx)
-       or      4(bx),0xc00     ! truncating mode
-       wait
-       fldcw   4(bx)
-       cmp     8(bx),4
-       jne     2f
-                               ! loc 4 loc ? cfu
-       flds    12(bx)
-       fabs                    ! ???
-       fiaddl  (bigmin)
-       fistpl  12(bx)
-       wait
-       mov     ax,12(bx)
-       sub     ax,(bigmin)
-       mov     12(bx),ax
-1:
-       mov     4(bx),dx
-       wait
-       fldcw   4(bx)
-       ret
-2:
-                               ! loc 8 loc ? cfu
-       fldd    12(bx)
-       fabs                    ! ???
-       fiaddl  (bigmin)
-       fistpl  16(bx)
-       mov     ax,16(bx)
-       sub     ax,(bigmin)
-       mov     16(bx),ax
-       jmp     1b
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_cif4.s b/lib/ack/libe/arch/i386/em/disconnected/em_cif4.s
deleted file mode 100644 (file)
index 0ccb187..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cif4
-
-       .sect .text
-.cif4:
-       mov     bx,sp
-       fildl   8(bx)
-       fstps   8(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_cif8.s b/lib/ack/libe/arch/i386/em/disconnected/em_cif8.s
deleted file mode 100644 (file)
index 94be62a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cif8
-
-       .sect .text
-.cif8:
-       mov     bx,sp
-       fildl   8(bx)
-       fstpd   4(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_cmf4.s b/lib/ack/libe/arch/i386/em/disconnected/em_cmf4.s
deleted file mode 100644 (file)
index 0e2f023..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cmf4
-
-       .sect .text
-.cmf4:
-       mov     bx,sp
-       xor     cx,cx
-       flds    8(bx)
-       flds    4(bx)
-       fcompp                  ! compare and pop operands
-       fstsw   ax
-       wait
-       sahf
-       je      1f
-       jb      2f
-       dec     cx
-       jmp     1f
-2:
-       inc     cx
-1:
-       mov     ax,cx
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_cmf8.s b/lib/ack/libe/arch/i386/em/disconnected/em_cmf8.s
deleted file mode 100644 (file)
index 00a15db..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cmf8
-
-       .sect .text
-.cmf8:
-       mov     bx,sp
-       xor     cx,cx
-       fldd    12(bx)
-       fldd    4(bx)
-       fcompp                  ! compare and pop operands
-       fstsw   ax
-       wait
-       sahf
-       je      1f
-       jb      2f
-       dec     cx
-       jmp     1f
-2:
-       inc     cx
-1:
-       mov     ax,cx
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_cuf4.s b/lib/ack/libe/arch/i386/em/disconnected/em_cuf4.s
deleted file mode 100644 (file)
index a99961b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cuf4
-
-       .sect .text
-.cuf4:
-       mov     bx,sp
-       fildl   8(bx)
-       cmp     8(bx),0
-       jge     1f
-       fisubl  (bigmin)
-       fisubl  (bigmin)
-1:
-       fstps   8(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_cuf8.s b/lib/ack/libe/arch/i386/em/disconnected/em_cuf8.s
deleted file mode 100644 (file)
index 928cb9f..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cuf8
-
-       .sect .text
-.cuf8:
-       mov     bx,sp
-       fildl   8(bx)
-       cmp     8(bx),0
-       jge     1f
-       fisubl  (bigmin)
-       fisubl  (bigmin)
-1:
-       fstpd   4(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_dvf4.s b/lib/ack/libe/arch/i386/em/disconnected/em_dvf4.s
deleted file mode 100644 (file)
index 8897227..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .dvf4
-
-       .sect .text
-.dvf4:
-       mov     bx,sp
-       flds    8(bx)
-       fdivs   4(bx)
-       fstps   8(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_dvf8.s b/lib/ack/libe/arch/i386/em/disconnected/em_dvf8.s
deleted file mode 100644 (file)
index 8fb6a47..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .dvf8
-
-       .sect .text
-.dvf8:
-       mov     bx,sp
-       fldd    12(bx)
-       fdivd   4(bx)
-       fstpd   12(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_fef4.s b/lib/ack/libe/arch/i386/em/disconnected/em_fef4.s
deleted file mode 100644 (file)
index adc6979..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .fef4
-
-       .sect .text
-.fef4:
-                               ! this could be simpler, if only the
-                               ! fxtract instruction was emulated properly
-       mov     bx,sp
-       mov     ax,8(bx)
-       and     ax,0x7f800000
-       je      1f              ! zero exponent
-       shr     ax,23
-       sub     ax,126
-       mov     cx,ax           ! exponent in cx
-       mov     ax,8(bx)
-       and     ax,0x807fffff
-       or      ax,0x3f000000   ! load -1 exponent
-       mov     bx,4(bx)
-       mov     4(bx),ax
-       mov     (bx),cx
-       ret
-1:                             ! we get here on zero exp
-       mov     ax,8(bx)
-       and     ax,0x007fffff
-       jne     1f              ! zero result
-       mov     bx,4(bx)
-       mov     (bx),ax
-       mov     4(bx),ax
-       ret
-1:                             ! otherwise unnormalized number
-       mov     cx,8(bx)
-       and     cx,0x807fffff
-       mov     dx,cx
-       and     cx,0x80000000
-       mov     ax,-125
-2:
-       test    dx,0x800000
-       jne     1f
-       dec     ax
-       shl     dx,1
-       or      dx,cx
-       jmp     2b
-1:
-       mov     bx,4(bx)
-       mov     (bx),ax
-       and     dx,0x807fffff
-       or      dx,0x3f000000   ! load -1 exponent
-       mov     4(bx),dx
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_fef8.s b/lib/ack/libe/arch/i386/em/disconnected/em_fef8.s
deleted file mode 100644 (file)
index 48234ed..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .fef8
-
-       .sect .text
-.fef8:
-                               ! this could be simpler, if only the
-                               ! fxtract instruction was emulated properly
-       mov     bx,sp
-       mov     ax,12(bx)
-       and     ax,0x7ff00000
-       je      1f              ! zero exponent
-       shr     ax,20
-       sub     ax,1022
-       mov     cx,ax           ! exponent in cx
-       mov     ax,12(bx)
-       and     ax,0x800fffff
-       or      ax,0x3fe00000   ! load -1 exponent
-       mov     dx,8(bx)
-       mov     bx,4(bx)
-       mov     4(bx),dx
-       mov     8(bx),ax
-       mov     (bx),cx
-       ret
-1:                             ! we get here on zero exp
-       mov     ax,12(bx)
-       and     ax,0xfffff
-       or      ax,8(bx)
-       jne     1f              ! zero result
-       mov     bx,4(bx)
-       mov     (bx),ax
-       mov     4(bx),ax
-       mov     8(bx),ax
-       ret
-1:                             ! otherwise unnormalized number
-       mov     cx,12(bx)
-       and     cx,0x800fffff
-       mov     dx,cx
-       and     cx,0x80000000
-       mov     ax,-1021
-2:
-       test    dx,0x100000
-       jne     1f
-       dec     ax
-       shl     8(bx),1
-       rcl     dx,1
-       or      dx,cx
-       jmp     2b
-1:
-       and     dx,0x800fffff
-       or      dx,0x3fe00000   ! load -1 exponent
-       mov     cx,8(bx)
-       mov     bx,4(bx)
-       mov     (bx),ax
-       mov     8(bx),dx
-       mov     4(bx),cx
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_fif4.s b/lib/ack/libe/arch/i386/em/disconnected/em_fif4.s
deleted file mode 100644 (file)
index 04f702f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .fif4
-
-       .sect .text
-.fif4:
-       mov     bx,sp
-       flds    8(bx)
-       fmuls   12(bx)          ! multiply
-       fld     st              ! copy result
-       ftst                    ! test sign; handle negative separately
-       fstsw   ax
-       wait
-       sahf                    ! result of test in condition codes
-       jb      1f
-       frndint                 ! this one rounds (?)
-       fcom    st(1)           ! compare with original; if <=, then OK
-       fstsw   ax
-       wait
-       sahf
-       jbe     2f
-       fisubs  (one)           ! else subtract 1
-       jmp     2f
-1:                             ! here, negative case
-       frndint                 ! this one rounds (?)
-       fcom    st(1)           ! compare with original; if >=, then OK
-       fstsw   ax
-       wait
-       sahf
-       jae     2f
-       fiadds  (one)           ! else add 1
-2:
-       fsub    st(1),st        ! subtract integer part
-       mov     bx,4(bx)
-       fstps   (bx)
-       fstps   4(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_fif8.s b/lib/ack/libe/arch/i386/em/disconnected/em_fif8.s
deleted file mode 100644 (file)
index 2b8154d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .fif8
-
-       .sect .text
-.fif8:
-       mov     bx,sp
-       fldd    8(bx)
-       fmuld   16(bx)          ! multiply
-       fld     st              ! and copy result
-       ftst                    ! test sign; handle negative separately
-       fstsw   ax
-       wait
-       sahf                    ! result of test in condition codes
-       jb      1f
-       frndint                 ! this one rounds (?)
-       fcom    st(1)           ! compare with original; if <=, then OK
-       fstsw   ax
-       wait
-       sahf
-       jbe     2f
-       fisubs  (one)           ! else subtract 1
-       jmp     2f
-1:                             ! here, negative case
-       frndint                 ! this one rounds (?)
-       fcom    st(1)           ! compare with original; if >=, then OK
-       fstsw   ax
-       wait
-       sahf
-       jae     2f
-       fiadds  (one)           ! else add 1
-2:
-       fsub    st(1),st        ! subtract integer part
-       mov     bx,4(bx)
-       fstpd   (bx)
-       fstpd   8(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_mlf4.s b/lib/ack/libe/arch/i386/em/disconnected/em_mlf4.s
deleted file mode 100644 (file)
index e3068ac..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .mlf4
-
-       .sect .text
-.mlf4:
-       mov     bx,sp
-       flds    4(bx)
-       fmuls   8(bx)
-       fstps   8(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_mlf8.s b/lib/ack/libe/arch/i386/em/disconnected/em_mlf8.s
deleted file mode 100644 (file)
index 56ff130..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .mlf8
-
-       .sect .text
-.mlf8:
-       mov     bx,sp
-       fldd    4(bx)
-       fmuld   12(bx)
-       fstpd   12(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_ngf4.s b/lib/ack/libe/arch/i386/em/disconnected/em_ngf4.s
deleted file mode 100644 (file)
index e21fe2b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .ngf4
-
-       .sect .text
-.ngf4:
-       mov     bx,sp
-       flds    4(bx)
-       fchs
-       fstps   4(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_ngf8.s b/lib/ack/libe/arch/i386/em/disconnected/em_ngf8.s
deleted file mode 100644 (file)
index baec4bc..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .ngf8
-
-       .sect .text
-.ngf8:
-       mov     bx,sp
-       fldd    4(bx)
-       fchs
-       fstpd   4(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_sbf4.s b/lib/ack/libe/arch/i386/em/disconnected/em_sbf4.s
deleted file mode 100644 (file)
index e76f9d1..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .sbf4
-
-       .sect .text
-.sbf4:
-       mov     bx,sp
-       flds    8(bx)
-       fsubs   4(bx)
-       fstps   8(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/disconnected/em_sbf8.s b/lib/ack/libe/arch/i386/em/disconnected/em_sbf8.s
deleted file mode 100644 (file)
index cab3d78..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .sbf8
-
-       .sect .text
-.sbf8:
-       mov     bx,sp
-       fldd    12(bx)
-       fsubd   4(bx)
-       fstpd   12(bx)
-       wait
-       ret
diff --git a/lib/ack/libe/arch/i386/em/em_adi.s b/lib/ack/libe/arch/i386/em/em_adi.s
deleted file mode 100644 (file)
index 396c197..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .adi
-
-       ! #bytes in ecx , top of stack in eax
-       .sect .text
-.adi:
-       pop     ebx              ! return address
-       cmp     ecx,4
-       jne     9f
-       pop     ecx
-       add     eax,ecx
-       jmp     ebx
-9:
-.extern        EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    ebx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_and.s b/lib/ack/libe/arch/i386/em/em_and.s
deleted file mode 100644 (file)
index eddfa79..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define        .and
-
-       ! #bytes in ecx
-       ! save edi; it might be a register variable
-
-       .sect .text
-.and:
-       pop     ebx             ! return address
-       mov     edx,edi
-       mov     edi,esp
-       add     edi,ecx
-       sar     ecx,2
-1:
-       pop     eax
-       and     eax,(edi)
-       stos
-       loop    1b
-       mov     edi,edx
-       jmp     ebx
diff --git a/lib/ack/libe/arch/i386/em/em_blm.s b/lib/ack/libe/arch/i386/em/em_blm.s
deleted file mode 100644 (file)
index a2a1c68..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .blm
-
-       ! ecx: count in words
-.blm:
-       mov     ebx,esp
-       mov     eax,esi
-       mov     edx,edi
-       mov     edi,4(ebx)
-       mov     esi,8(ebx)
-       rep     movs
-       mov     esi,eax
-       mov     edi,edx
-       ret     8
-
diff --git a/lib/ack/libe/arch/i386/em/em_cii.s b/lib/ack/libe/arch/i386/em/em_cii.s
deleted file mode 100644 (file)
index 0ad7ce3..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cii
-
-.sect .text
-.cii:
-       pop     ebx              ! return address
-                               ! pop     ecx, dest. size
-                               ! pop     edx, src. size
-                               ! eax is source
-       cmp     edx,1
-       jne     2f
-       movsxb  eax,al
-       mov     edx,4
-       jmp     1f
-2:
-       cmp     edx,2
-       jne     1f
-       cwde                    ! convert from 2 to 4 bytes
-       mov     edx,4
-1:
-       cmp     edx,ecx
-       jne     9f
-       cmp     edx,4
-       jne     9f
-       jmp     ebx
-9:
-.extern EILLINS
-.extern .fat
-       mov     eax,EILLINS
-       push    eax
-       jmp     .fat
diff --git a/lib/ack/libe/arch/i386/em/em_cms.s b/lib/ack/libe/arch/i386/em/em_cms.s
deleted file mode 100644 (file)
index d8d2639..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .cms
-
-       ! #bytes in ecx
-       .sect .text
-.cms:
-       pop     ebx              ! return address
-       mov     edx,esp
-       push    esi
-       push    edi
-       mov     esi,edx
-       add     edx,ecx
-       mov     edi,edx
-       add     edx,ecx
-       sar     ecx,2
-       repe cmps
-       je      1f
-       inc     ecx
-1:
-       pop     edi
-       pop     esi
-       mov     esp,edx
-       jmp     ebx
diff --git a/lib/ack/libe/arch/i386/em/em_com.s b/lib/ack/libe/arch/i386/em/em_com.s
deleted file mode 100644 (file)
index dfc5f70..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define        .com
-
-       ! #bytes in ecx
-       .sect .text
-.com:
-       mov     ebx,esp
-       add     ebx,4
-       sar     ecx,2
-1:
-       not     (ebx)
-       add     ebx,4
-       loop    1b
-       ret
diff --git a/lib/ack/libe/arch/i386/em/em_csa4.s b/lib/ack/libe/arch/i386/em/em_csa4.s
deleted file mode 100644 (file)
index f902450..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .csa4
-
-.sect .text
-.csa4:
-                               ! ebx, descriptor address
-                               ! eax, index
-       mov     edx,(ebx)         ! default
-       sub     eax,4(ebx)
-       cmp     eax,8(ebx)
-       ja      1f
-       sal     eax,2
-       add     ebx,eax
-       mov     ebx,12(ebx)
-       test    ebx,ebx
-       jnz     2f
-1:
-       mov     ebx,edx
-       test    ebx,ebx
-       jnz     2f
-.extern ECASE
-.extern .fat
-       mov     eax,ECASE
-       push    eax
-       jmp     .fat
-2:
-       jmp     ebx
diff --git a/lib/ack/libe/arch/i386/em/em_csb4.s b/lib/ack/libe/arch/i386/em/em_csb4.s
deleted file mode 100644 (file)
index 4a82141..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .csb4
-
-.sect .text
-.csb4:
-                               !ebx, descriptor address
-                               !eax,  index
-       mov     edx,(ebx)
-       mov     ecx,4(ebx)
-1:
-       add     ebx,8
-       dec     ecx
-       jl      4f
-       cmp     eax,(ebx)
-       jne     1b
-       mov     ebx,4(ebx)
-2:
-       test    ebx,ebx
-       jnz     3f
-.extern ECASE
-.extern .fat
-       mov     eax,ECASE
-       push    eax
-       jmp     .fat
-3:
-       jmp     ebx
-4:
-       mov     ebx,edx
-       jmp     2b
diff --git a/lib/ack/libe/arch/i386/em/em_cuu.s b/lib/ack/libe/arch/i386/em/em_cuu.s
deleted file mode 100644 (file)
index 16177b6..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .ciu
-.define .cui
-.define .cuu
-
-.sect .text
-.ciu:
-.cui:
-.cuu:
-       pop     ebx              ! return address
-                               ! pop     ecx, dest. size
-                               ! pop     edx, source size
-                               ! eax is source
-       cmp     edx,ecx
-       jne     8f
-       jmp     ebx
-8:
-.extern EILLINS
-.extern .fat
-       mov     eax,EILLINS
-       push    eax
-       jmp     .fat
diff --git a/lib/ack/libe/arch/i386/em/em_dup.s b/lib/ack/libe/arch/i386/em/em_dup.s
deleted file mode 100644 (file)
index 071a46c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define        .dup
-
-       ! #bytes in ecx
-       .sect .text
-.dup:
-       pop     ebx             ! return address
-       mov     eax,esi
-       mov     edx,edi
-       mov     esi,esp
-       sub     esp,ecx
-       mov     edi,esp
-       sar     ecx,2
-       rep movs
-       mov     esi,eax
-       mov     edi,edx
-       jmp     ebx
diff --git a/lib/ack/libe/arch/i386/em/em_dvi.s b/lib/ack/libe/arch/i386/em/em_dvi.s
deleted file mode 100644 (file)
index f7a8730..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .dvi
-
-        ! #bytes in eax
-       .sect .text
-.dvi:
-        pop     ebx              ! return address
-        cmp     eax,4
-        jne     1f
-        pop     eax
-        cwd
-        pop     ecx
-        idiv    ecx
-        push    eax
-        jmp     ebx
-1:
-.extern EODDZ
-.extern .trp
-        mov     eax,EODDZ
-        push    ebx
-        jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_dvu.s b/lib/ack/libe/arch/i386/em/em_dvu.s
deleted file mode 100644 (file)
index 5f5a717..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .dvu
-
-       ! #bytes in eax
-       .sect .text
-.dvu:
-       pop     ebx              ! return address
-       cmp     eax,4
-       jne     1f
-       pop     eax
-       xor     edx,edx
-       pop     ecx
-       div     ecx
-       push    eax
-       jmp     ebx
-1:
-.extern EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    ebx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_error.s b/lib/ack/libe/arch/i386/em/em_error.s
deleted file mode 100644 (file)
index f2501e1..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .error
-.define .Xtrp
-
-       ! eax is trap number
-       ! all registers must be saved
-       ! because return is possible
-       ! May only be called with error no's <16
-.sect .text
-.error:
-       mov  ecx,eax
-       mov  ebx,1
-       sal  ebx,cl
-.extern .ignmask
-.extern .trp
-       test ebx,(.ignmask)
-       jne  2f
-       call    .trp
-2:
-       ret
-
-.Xtrp:
-       pusha
-       cmp     eax,16
-       jge     1f
-       call    .error
-       popa
-       ret
-1:
-       call    .trp
-       popa
-       ret
diff --git a/lib/ack/libe/arch/i386/em/em_exg.s b/lib/ack/libe/arch/i386/em/em_exg.s
deleted file mode 100644 (file)
index ad693db..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define .exg
-
-       ! #bytes in ecx
-.sect .text
-.exg:
-       push    edi
-       mov     edi,esp
-       add     edi,8
-       mov     ebx,edi
-       add     ebx,ecx
-       sar     ecx,2
-1:
-       mov     eax,(ebx)
-       xchg    eax,(edi)
-       mov     (ebx),eax
-       add     edi,4
-       add     ebx,4
-       loop    1b
-2:
-       pop     edi
-       ret
diff --git a/lib/ack/libe/arch/i386/em/em_fat.s b/lib/ack/libe/arch/i386/em/em_fat.s
deleted file mode 100644 (file)
index 0302552..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .fat
-
-.fat:
-.extern .trp
-.extern .stop
-       call    .trp
-       call    .stop
-       ! no return
diff --git a/lib/ack/libe/arch/i386/em/em_fp8087.s b/lib/ack/libe/arch/i386/em/em_fp8087.s
deleted file mode 100644 (file)
index 53f6b7f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define one, bigmin
-
-       .sect .rom
-one:
-       .data2  1
-two:
-       .data2  2
-bigmin:
-       .data4  -2147483648
diff --git a/lib/ack/libe/arch/i386/em/em_gto.s b/lib/ack/libe/arch/i386/em/em_gto.s
deleted file mode 100644 (file)
index 0149f27..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .gto
-
-.gto:
-       mov     ebp,8(ebx)
-       mov     esp,4(ebx)
-       jmp     (ebx)
diff --git a/lib/ack/libe/arch/i386/em/em_hol0.s b/lib/ack/libe/arch/i386/em/em_hol0.s
deleted file mode 100644 (file)
index 8c919ae..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-
-.define hol0
-.sect .data
-hol0:
-       .data4  0, 0
-       .data4  0, 0
diff --git a/lib/ack/libe/arch/i386/em/em_iaar.s b/lib/ack/libe/arch/i386/em/em_iaar.s
deleted file mode 100644 (file)
index b74dc3f..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .iaar
-
-.iaar:
-       pop     ecx
-       pop     edx
-       cmp     edx,4
-.extern .unknown
-       jne     .unknown
-       pop     ebx     ! descriptor address
-       pop     eax     ! index
-       sub     eax,(ebx)
-       mul     8(ebx)
-       pop     ebx     ! array base
-       add     ebx,eax
-       push    ecx
-       ret
diff --git a/lib/ack/libe/arch/i386/em/em_ilar.s b/lib/ack/libe/arch/i386/em/em_ilar.s
deleted file mode 100644 (file)
index 1551486..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .ilar
-
-.ilar:
-       pop     ecx
-       pop     edx
-.extern .unknown
-       cmp     edx,4
-       jne     .unknown
-       pop     ebx      ! descriptor address
-       pop     eax      ! index
-       push    ecx
-.extern .lar4
-       jmp    .lar4
diff --git a/lib/ack/libe/arch/i386/em/em_inn.s b/lib/ack/libe/arch/i386/em/em_inn.s
deleted file mode 100644 (file)
index 95d8ac0..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .inn
-
-       ! #bytes in ecx
-       ! bit # in eax
-.inn:
-       xor     edx,edx
-       mov     ebx,8
-       div     ebx
-       mov     ebx,esp
-       add     ebx,4
-       add     ebx,eax
-       cmp     eax,ecx
-       jae     1f
-       movb    al,(ebx)
-       mov     ebx,edx
-       testb   al,bits(ebx)
-       jz      1f
-       mov     eax,1
-       jmp     2f
-1:
-       xor     eax,eax
-2:
-       pop     ebx
-       add     esp,ecx
-       ! eax is result
-       jmp     ebx
-
-       .sect .rom
-bits:
-       .data1 1,2,4,8,16,32,64,128
diff --git a/lib/ack/libe/arch/i386/em/em_ior.s b/lib/ack/libe/arch/i386/em/em_ior.s
deleted file mode 100644 (file)
index 3981ff5..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define        .ior
-
-       ! #bytes in ecx
-.ior:
-       pop     ebx             ! return address
-       mov     edx,edi
-       mov     edi,esp
-       add     edi,ecx
-       sar     ecx,2
-1:
-       pop     eax
-       or      eax,(edi)
-       stos
-       loop    1b
-       mov     edi,edx
-       jmp     ebx
diff --git a/lib/ack/libe/arch/i386/em/em_isar.s b/lib/ack/libe/arch/i386/em/em_isar.s
deleted file mode 100644 (file)
index 75b46b7..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .isar
-
-.isar:
-       pop     ecx
-       pop     eax
-       cmp     eax,4
-.extern .unknown
-       jne     .unknown
-       pop     ebx      ! descriptor address
-       pop     eax      ! index
-       push    ecx
-.extern .sar4
-       jmp    .sar4
diff --git a/lib/ack/libe/arch/i386/em/em_lar4.s b/lib/ack/libe/arch/i386/em/em_lar4.s
deleted file mode 100644 (file)
index 643ec96..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .lar4
-
-.lar4:
-                               ! ebx, descriptor address
-                               ! eax, index
-       sub     eax,(ebx)
-       mov     ecx,8(ebx)
-       imul    ecx
-       pop     ebx
-       pop     edx             ! base address
-       add     edx,eax
-       sar     ecx,1
-       jnb     1f
-       xor     eax,eax
-       movb    al,(edx)
-       push    eax
-       jmp     ebx
-1:
-       sar     ecx,1
-       jnb     1f
-       xor     eax,eax
-       o16 mov ax,(edx)
-       push    eax
-       jmp     ebx
-1:
-       xchg    edx,esi         ! saved esi
-       mov     eax,ecx
-       sal     eax,2
-       sub     esp,eax
-       mov     eax,edi         ! save edi
-       mov     edi,esp
-       rep movs
-       mov     edi,eax
-       mov     esi,edx
-       jmp     ebx
diff --git a/lib/ack/libe/arch/i386/em/em_loi.s b/lib/ack/libe/arch/i386/em/em_loi.s
deleted file mode 100644 (file)
index c0ed170..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .loi
-.define .los
-
-       ! #bytes in ecx
-       ! address in ebx
-       ! save esi/edi. they might be register variables
-.los:
-       pop     edx
-       mov     eax,ecx
-       sar     ecx,1
-       jnb     1f
-       movsxb  eax,(ebx)
-       push    eax
-       jmp     edx
-1:
-       sar     ecx,1
-       jnb     1f
-       movsx   eax,(ebx)
-       push    eax
-       jmp     edx
-1:
-       push    edx
-       mov     edx,esi
-       mov     esi,ebx
-       pop     ebx
-       sub     esp,eax
-       jmp     1f
-
-.loi:
-       ! only called with size >= 4
-       mov     edx,esi
-       mov     esi,ebx
-       pop     ebx
-       sub     esp,ecx
-       sar     ecx,2
-1:
-       mov     eax,edi
-       mov     edi,esp
-       rep movs
-       mov     esi,edx
-       mov     edi,eax
-       jmp     ebx
diff --git a/lib/ack/libe/arch/i386/em/em_mli.s b/lib/ack/libe/arch/i386/em/em_mli.s
deleted file mode 100644 (file)
index 84185fb..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .mli
-
-       ! #bytes in eax
-.mli:
-       pop     ebx              ! return address
-       cmp     eax,4
-       jne     1f
-       pop     eax
-       pop     ecx
-       mul     ecx
-       push    eax
-       jmp     ebx
-1:
-.extern EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    ebx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_mon.s b/lib/ack/libe/arch/i386/em/em_mon.s
deleted file mode 100644 (file)
index 42cac7c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .mon
-
-.mon:
-.extern .stop
-       call    .stop
diff --git a/lib/ack/libe/arch/i386/em/em_ngi.s b/lib/ack/libe/arch/i386/em/em_ngi.s
deleted file mode 100644 (file)
index b15a1fa..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .ngi
-
-       ! #bytes in eax
-.ngi:
-       pop     ebx              ! return address
-       cmp     eax,4
-       jne     1f
-       pop     ecx
-       neg     ecx
-       push    ecx
-       jmp     ebx
-1:
-.extern EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    ebx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_nop.s b/lib/ack/libe/arch/i386/em/em_nop.s
deleted file mode 100644 (file)
index 46fbbb7..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .nop
-.extern printd, printc, hol0
-
-.nop:
-       mov     eax,(hol0)
-       call    printd
-       movb    al,'\n'
-       jmp     printc
diff --git a/lib/ack/libe/arch/i386/em/em_print.s b/lib/ack/libe/arch/i386/em/em_print.s
deleted file mode 100644 (file)
index 8b09b50..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define        printc,printd,prints
-
-       ! argument in eax
-       ! uses ebx
-prints:
-       xchg    eax,ebx
-1:
-       movb    al,(ebx)
-       inc     ebx
-       testb   al,al
-       jz      2f
-       call    printc
-       jmp     1b
-2:
-       ret
-
-       ! argument in eax
-       ! uses ecx and edx
-printd:
-       xor     edx,edx
-       mov     ecx,10
-       div     ecx
-       test    eax,eax
-       jz      1f
-       push    edx
-       call    printd
-       pop     edx
-1:
-       xchg    eax,edx
-       addb    al,'0'
-
-       ! argument in eax
-printc:
-       push    eax
-       mov     ebx,esp
-       mov     eax,1
-       push    eax
-       push    ebx
-       push    eax
-       call    __write
-       pop     ebx
-       pop     ebx
-       pop     ebx
-       pop     ebx
-       ret
diff --git a/lib/ack/libe/arch/i386/em/em_rck.s b/lib/ack/libe/arch/i386/em/em_rck.s
deleted file mode 100644 (file)
index e1a6669..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .rck
-
-       ! descriptor address in ebx
-       ! value in eax, must be left there
-.rck:
-       cmp     eax,(ebx)
-       jl      2f
-       cmp     eax,4(ebx)
-       jg      2f
-       ret
-2:
-       push    eax
-.extern ERANGE
-.extern .error
-       mov     eax,ERANGE
-       call    .error
-       pop     eax
-       ret
diff --git a/lib/ack/libe/arch/i386/em/em_rmi.s b/lib/ack/libe/arch/i386/em/em_rmi.s
deleted file mode 100644 (file)
index 775abbd..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .rmi
-
-       ! #bytes in eax
-.rmi:
-       pop     ebx              ! return address
-       cmp     eax,4
-       jne     1f
-       pop     eax
-       cwd
-       pop     ecx
-       idiv    ecx
-       push    edx
-       jmp     ebx
-1:
-.extern EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    ebx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_rmu.s b/lib/ack/libe/arch/i386/em/em_rmu.s
deleted file mode 100644 (file)
index d51029d..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .rmu
-
-       ! #bytes in eax
-.rmu:
-       pop     ebx              ! return address
-       cmp     eax,4
-       jne     1f
-       pop     eax
-       xor     edx,edx
-       pop     ecx
-       idiv    ecx
-       push    edx
-       jmp     ebx
-1:
-.extern EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    ebx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_rol.s b/lib/ack/libe/arch/i386/em/em_rol.s
deleted file mode 100644 (file)
index 68365d7..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .rol
-
-       ! #bytes in eax
-.rol:
-       pop     edx              ! return address
-       cmp     eax,4
-       jne     1f
-       pop     eax
-       pop     ecx
-       rol     eax,cl
-       push    eax
-       jmp     edx
-1:
-.extern EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    edx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_ror.s b/lib/ack/libe/arch/i386/em/em_ror.s
deleted file mode 100644 (file)
index ef34a96..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .ror
-
-       ! #bytes in eax
-.ror:
-       pop     edx              ! return address
-       cmp     eax,4
-       jne     1f
-       pop     eax
-       pop     ecx
-       ror     eax,cl
-       push    eax
-       jmp     edx
-1:
-.extern EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    edx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_sar4.s b/lib/ack/libe/arch/i386/em/em_sar4.s
deleted file mode 100644 (file)
index 52a1f61..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .sar4
-
-.sar4:
-                               ! ebx, descriptor address
-                               ! eax, index
-       sub     eax,(ebx)
-       mov     ecx,8(ebx)
-       imul    ecx
-       pop     ebx
-       pop     edx             ! base address
-       add     edx,eax
-       sar     ecx,1
-       jnb     1f
-       pop     eax
-       movb    (edx),al
-       jmp     ebx
-1:
-       sar     ecx,1
-       jnb     1f
-       pop     eax
-       o16 mov (edx),ax
-       jmp     ebx
-1:
-       xchg    edi,edx         ! edi = base address, edx is saved edi
-       mov     eax,esi
-       mov     esi,esp
-       rep movs
-       mov     esp,esi
-       mov     esi,eax
-       mov     edi,edx
-       jmp     ebx
diff --git a/lib/ack/libe/arch/i386/em/em_sbi.s b/lib/ack/libe/arch/i386/em/em_sbi.s
deleted file mode 100644 (file)
index 2897d31..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .sbi
-
-       ! #bytes in ecx , top of stack in eax
-.sbi:
-       pop     ebx              ! return subress
-       cmp     ecx,4
-       jne     1f
-       pop     ecx
-       sub     eax,ecx
-       neg     eax
-       jmp     ebx
-1:
-.extern EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    ebx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_set.s b/lib/ack/libe/arch/i386/em/em_set.s
deleted file mode 100644 (file)
index 3493eac..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .set
-
-       ! #bytes in ecx
-       ! bit # in eax
-.set:
-       pop     ebx              ! return address
-       xor     edx,edx
-!ifdef create set
-       sub     esp,ecx
-       push    ebx
-       push    edi
-       mov     ebx,esp
-       xor     edi,edi
-       sar     ecx,2
-1:
-       mov     8(ebx)(edi),edx
-       add     edi,4
-       loop    1b
-!endif
-       mov     ebx,8
-       div     ebx
-       cmp     eax,edi
-       jae     2f
-       mov     edi,edx
-       movb    dl,bits(edi)
-       mov     edi,esp
-       add     edi,eax
-       orb     8(edi),dl
-       pop     edi
-       ret
-2:
-.extern ESET
-.extern .trp
-       pop     edi
-       mov     eax,ESET
-       jmp     .trp
-
-       .sect .rom
-bits:
-       .data1   1,2,4,8,16,32,64,128
diff --git a/lib/ack/libe/arch/i386/em/em_sli.s b/lib/ack/libe/arch/i386/em/em_sli.s
deleted file mode 100644 (file)
index dd5b616..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .sli
-
-       ! #bytes in eax
-.sli:
-       pop     edx              ! return address
-       cmp     eax,4
-       jne     1f
-       pop     eax
-       pop     ecx
-       sal     eax,cl
-       push    eax
-       jmp     edx
-1:
-.extern EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    edx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_sri.s b/lib/ack/libe/arch/i386/em/em_sri.s
deleted file mode 100644 (file)
index 2fb7871..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .sri
-
-       ! #bytes in eax
-.sri:
-       pop     edx              ! return address
-       cmp     eax,4
-       jne     1f
-       pop     eax
-       pop     ecx
-       sar     eax,cl
-       push    eax
-       jmp     edx
-1:
-.extern EODDZ
-.extern .trp
-       mov     eax,EODDZ
-       push    edx
-       jmp     .trp
diff --git a/lib/ack/libe/arch/i386/em/em_sti.s b/lib/ack/libe/arch/i386/em/em_sti.s
deleted file mode 100644 (file)
index 12385ee..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .sti
-.define .sts
-
-       ! #bytes in ecx
-       ! address in ebx
-       ! save edi/esi. they might be register variables
-.sts:
-       pop     edx
-       sar     ecx,1
-       jnb     1f
-       pop     eax
-       movb    (ebx),al
-       jmp     edx
-1:
-       sar     ecx,1
-       jnb     1f
-       pop     eax
-       o16 mov (ebx),ax
-       jmp     edx
-1:
-       push    edx
-       mov     edx,edi
-       mov     edi,ebx
-       pop     ebx
-       jmp     1f
-.sti:
-       ! only called with count >> 4
-       mov     edx,edi
-       mov     edi,ebx
-       pop     ebx
-       sar     ecx,2
-1:
-       mov     eax,esi
-       mov     esi,esp
-       rep movs
-       mov     esp,esi
-       mov     edi,edx
-       mov     esi,eax
-       jmp     ebx
diff --git a/lib/ack/libe/arch/i386/em/em_stop.s b/lib/ack/libe/arch/i386/em/em_stop.s
deleted file mode 100644 (file)
index 476045f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .stop
-.stop:
-       jmp     ___exit
diff --git a/lib/ack/libe/arch/i386/em/em_trp.s b/lib/ack/libe/arch/i386/em/em_trp.s
deleted file mode 100644 (file)
index 24af0e6..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .trp
-.extern .trppc, .stop
-
-               ! eax is trap number
-.trp:
-       xor     ebx,ebx
-       xchg    ebx,(.trppc)
-       test    ebx,ebx
-       jz      2f
-       push    eax
-       call    ebx
-       pop     eax
-       ret
-2:
-       push    eax
-       call    .stop
diff --git a/lib/ack/libe/arch/i386/em/em_unknown.s b/lib/ack/libe/arch/i386/em/em_unknown.s
deleted file mode 100644 (file)
index 59425f2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define .unknown
-.extern EILLINS, .fat
-
-.unknown:
-       mov  eax,EILLINS
-       push eax
-       jmp  .fat
diff --git a/lib/ack/libe/arch/i386/em/em_xor.s b/lib/ack/libe/arch/i386/em/em_xor.s
deleted file mode 100644 (file)
index 2dfb30d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.sect .text
-.define        .xor
-
-       ! #bytes in ecx
-.xor:
-       pop     ebx             ! return address
-       mov     edx,edi
-       mov     edi,esp
-       add     edi,ecx
-       sar     ecx,2
-1:
-       pop     eax
-       xor     eax,(edi)
-       stos
-       loop    1b
-       mov     edi,edx
-       jmp     ebx
diff --git a/lib/ack/libe/arch/i386/head/Makefile.inc b/lib/ack/libe/arch/i386/head/Makefile.inc
deleted file mode 100644 (file)
index 210ff28..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# head sources
-.PATH: ${.CURDIR}/arch/${ARCH}/head
-
-SRCS+= em_head.s
diff --git a/lib/ack/libe/arch/i386/head/em_abs.h b/lib/ack/libe/arch/i386/head/em_abs.h
deleted file mode 100644 (file)
index 9855cff..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* $Header$ */
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-#define LINO_AD         0
-#define FILN_AD         4
-
-#define LINO            (*(int    *)(_hol0()+LINO_AD))
-#define FILN            (*(char  **)(_hol0()+FILN_AD))
-
-#define EARRAY          0
-#define ERANGE          1
-#define ESET            2
-#define EIOVFL          3
-#define EFOVFL          4
-#define EFUNFL          5
-#define EIDIVZ          6
-#define EFDIVZ          7
-#define EIUND           8
-#define EFUND           9
-#define ECONV           10
-
-#define ESTACK          16
-#define EHEAP           17
-#define EILLINS         18
-#define EODDZ           19
-#define ECASE           20
-#define EMEMFLT         21
-#define EBADPTR         22
-#define EBADPC          23
-#define EBADLAE         24
-#define EBADMON         25
-#define EBADLIN         26
-#define EBADGTO         27
diff --git a/lib/ack/libe/arch/i386/head/em_head.s b/lib/ack/libe/arch/i386/head/em_head.s
deleted file mode 100644 (file)
index ec0d749..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define ERANGE,ESET,EHEAP,ECASE,EILLINS,EIDIVZ,EODDZ
-.define .trppc, .ignmask
-
-ERANGE         = 1
-ESET           = 2
-EIDIVZ         = 6
-EHEAP          = 17
-EILLINS                = 18
-EODDZ          = 19
-ECASE          = 20
-
-#include "em_abs.h"
-
-.sect .data
-.trppc:
-       .data4  0
-.ignmask:
-       .data4  EIOVFL | EIUND | ECONV | EFOVFL | EFUNFL
diff --git a/lib/ack/libfp/FP.script b/lib/ack/libfp/FP.script
deleted file mode 100755 (executable)
index 56a3fd6..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-s/_adf4/.adf4/
-s/_adf8/.adf8/
-s/_cff4/.cff4/
-s/_cff8/.cff8/
-s/_cfi/.cfi/
-s/_cfu/.cfu/
-s/_cif4/.cif4/
-s/_cif8/.cif8/
-s/_cmf4/.cmf4/
-s/_cmf8/.cmf8/
-s/_cuf4/.cuf4/
-s/_cuf8/.cuf8/
-s/_dvf4/.dvf4/
-s/_dvf8/.dvf8/
-s/_fef4/.fef4/
-s/_fef8/.fef8/
-s/_fif4/.fif4/
-s/_fif8/.fif8/
-s/_mlf4/.mlf4/
-s/_mlf8/.mlf8/
-s/_ngf4/.ngf4/
-s/_ngf8/.ngf8/
-s/_sbf4/.sbf4/
-s/_sbf8/.sbf8/
-s/_zrf4/.zrf4/
-s/_zrf8/.zrf8/
-s/_add_ext/.add_ext/
-s/_div_ext/.div_ext/
-s/_mul_ext/.mul_ext/
-s/_nrm_ext/.nrm_ext/
-s/_sft_ext/.sft_ext/
-s/_sub_ext/.sub_ext/
-s/_zrf_ext/.zrf_ext/
-s/_compact/.compact/
-s/_extend/.extend/
-s/_b64_add/.b64_add/
-s/_b64_sft/.b64_sft/
-s/_b64_rsft/.b64_rsft/
-s/_b64_lsft/.b64_lsft/
diff --git a/lib/ack/libfp/FP_bias.h b/lib/ack/libfp/FP_bias.h
deleted file mode 100644 (file)
index db17a41..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       include file for floating point package
-*/
-
-               /*      FLOAT FORMAT EXPONENT BIAS      */
-
-#define        SGL_BIAS         127    /* excess  128 notation used    */
-#define        DBL_BIAS        1023    /* excess 1024 notation used    */
-#define        EXT_BIAS           0    /* 2s-complement notation used  */
-                               /* this is possible because the */
-                               /* sign is in a seperate word   */
-               
-               /*      VARIOUS MAX AND MIN VALUES      */
-               /*      1) FOR THE DIFFERENT FORMATS    */
-
-#define        SGL_MAX            254  /*      standard definition     */
-#define        SGL_MIN              1  /*      standard definition     */
-#define        DBL_MAX           2046  /*      standard definition     */
-#define        DBL_MIN              1  /*      standard definition     */
-#define EXT_MAX                 16383  /*      standard minimum        */
-#define EXT_MIN                -16382  /*      standard minimum        */
diff --git a/lib/ack/libfp/FP_shift.h b/lib/ack/libfp/FP_shift.h
deleted file mode 100644 (file)
index 5b68563..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       include file for floating point package
-*/
-
-# define       CARRYBIT        0x80000000L
-# define       NORMBIT         0x80000000L
-# define       EXP_STORE       16
-
-
-                               /* parameters for Single Precision */
-#define SGL_EXPSHIFT   7
-#define SGL_M1LEFT     8
-#define SGL_ZERO       0xffffff80L
-#define SGL_EXACT      0xff
-#define SGL_RUNPACK    SGL_M1LEFT
-
-#define SGL_ROUNDUP    0x80
-#define        SGL_CARRYOUT    0x01000000L
-#define        SGL_MASK        0x007fffffL
-
-                               /* parameters for Double Precision */
-                               /* used in extend.c */
-
-#define DBL_EXPSHIFT   4
-
-#define DBL_M1LEFT     11
-
-#define        DBL_RPACK       (32-DBL_M1LEFT)
-#define        DBL_LPACK       DBL_M1LEFT
-
-                               /* used in compact.c */
-
-#define DBL_ZERO       0xfffffd00L
-
-#define DBL_EXACT      0x7ff
-
-#define DBL_RUNPACK    DBL_M1LEFT
-#define DBL_LUNPACK    (32-DBL_RUNPACK)
-
-#define DBL_ROUNDUP    0x400
-#define        DBL_CARRYOUT    0x00200000L
-#define        DBL_MASK        0x000fffffL
diff --git a/lib/ack/libfp/FP_trap.h b/lib/ack/libfp/FP_trap.h
deleted file mode 100644 (file)
index 045897b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       include file for floating point package
-*/
-
-                       /*      EM TRAPS        */
-
-#define        EIOVFL  3       /* Integer  Overflow            */
-#define        EFOVFL  4       /* Floating Overflow            */
-#define        EFUNFL  5       /* Floating Underflow           */
-#define        EIDIVZ  6       /* Integer  Divide by 0         */
-#define        EFDIVZ  7       /* Floating Divide by 0.0       */
-#define        EIUND   8       /* Integer  Undefined Number    */
-#define        EFUND   9       /* Floating Undefined Number    */
-#define        ECONV   10      /* Conversion Error             */
-# define trap(x) _fptrp(x)
diff --git a/lib/ack/libfp/FP_types.h b/lib/ack/libfp/FP_types.h
deleted file mode 100644 (file)
index a23f32b..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/********************************************************/
-/*
-       Type definitions for C Floating Point Package
-       include file for floating point package
-*/
-/********************************************************/
-/*
-       THESE STRUCTURES ARE USED TO ADDRESS THE INDIVIDUAL
-       PARTS OF THE FLOATING POINT NUMBER REPRESENTATIONS.
-
-       THREE STRUCTURES ARE DEFINED:
-               SINGLE: single precision floating format
-               DOUBLE: double precision floating format
-               EXTEND: double precision extended format
-*/
-/********************************************************/
-
-#ifndef __FPTYPES
-#define __FPTYPES
-
-typedef        struct  {
-       unsigned long   h_32;   /* higher 32 bits of 64 */
-       unsigned long   l_32;   /* lower  32 bits of 64 */
-}      B64;
-
-typedef        unsigned long   SINGLE;
-
-typedef        struct  {
-       unsigned long   d[2];
-}      DOUBLE;
-
-typedef        struct  {       /* expanded float format        */
-       short   sign;
-       short   exp;
-       B64     mantissa;
-#define m1 mantissa.h_32
-#define m2 mantissa.l_32
-} EXTEND;
-
-struct fef4_returns {
-       int     e;
-       SINGLE  f;
-};
-
-struct fef8_returns {
-       int     e;
-       DOUBLE  f;
-};
-
-struct fif4_returns {
-       SINGLE ipart;
-       SINGLE fpart;
-};
-
-struct fif8_returns {
-       DOUBLE ipart;
-       DOUBLE fpart;
-};
-
-#if __STDC__
-#define _PROTOTYPE(function, params)   function params
-#else
-#define _PROTOTYPE(function, params)   function()
-#endif
-_PROTOTYPE( void add_ext, (EXTEND *e1, EXTEND *e2));
-_PROTOTYPE( void mul_ext, (EXTEND *e1, EXTEND *e2));
-_PROTOTYPE( void div_ext, (EXTEND *e1, EXTEND *e2));
-_PROTOTYPE( void sub_ext, (EXTEND *e1, EXTEND *e2));
-_PROTOTYPE( void sft_ext, (EXTEND *e1, EXTEND *e2));
-_PROTOTYPE( void nrm_ext, (EXTEND *e1));
-_PROTOTYPE( void zrf_ext, (EXTEND *e1));
-_PROTOTYPE( void extend, (unsigned long *from, EXTEND *to, int size));
-_PROTOTYPE( void compact, (EXTEND *from, unsigned long *to, int size));
-_PROTOTYPE( void _fptrp, (int));
-_PROTOTYPE( void adf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( void adf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( void sbf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( void sbf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( void dvf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( void dvf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( void mlf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( void mlf8, (DOUBLE s2, DOUBLE s1));
-_PROTOTYPE( void ngf4, (SINGLE f));
-_PROTOTYPE( void ngf8, (DOUBLE f));
-_PROTOTYPE( void zrf4, (SINGLE *l));
-_PROTOTYPE( void zrf8, (DOUBLE *z));
-_PROTOTYPE( void cff4, (DOUBLE src));
-_PROTOTYPE( void cff8, (SINGLE src));
-_PROTOTYPE( void cif4, (int ss, long src));
-_PROTOTYPE( void cif8, (int ss, long src));
-_PROTOTYPE( void cuf4, (int ss, long src));
-_PROTOTYPE( void cuf8, (int ss, long src));
-_PROTOTYPE( long cfu, (int ds, int ss, DOUBLE src));
-_PROTOTYPE( long cfi, (int ds, int ss, DOUBLE src));
-_PROTOTYPE( int cmf4, (SINGLE s2, SINGLE s1));
-_PROTOTYPE( int cmf8, (DOUBLE d1, DOUBLE d2));
-_PROTOTYPE( void fef4, (struct fef4_returns *r, SINGLE s1));
-_PROTOTYPE( void fef8, (struct fef8_returns *r, DOUBLE s1));
-_PROTOTYPE( void fif4, (struct fif4_returns *p, SINGLE x, SINGLE y));
-_PROTOTYPE( void fif8, (struct fif8_returns *p, DOUBLE x, DOUBLE y));
-
-_PROTOTYPE( void b64_sft, (B64 *, int));
-_PROTOTYPE( void b64_lsft, (B64 *));
-_PROTOTYPE( void b64_rsft, (B64 *));
-_PROTOTYPE( int b64_add, (B64 *, B64 *));
-#endif
diff --git a/lib/ack/libfp/Makefile b/lib/ack/libfp/Makefile
deleted file mode 100644 (file)
index e13b158..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-# Makefile for libfp
-
-# .fc build rule
-.SUFFIXES:     .o .fc
-
-.fc.o:
-       ${_MKTARGET_COMPILE}
-       cp ${.IMPSRC} tmp.c
-       ${CC} -I${.CURDIR} ${CFLAGS} -S tmp.c
-       sed -f ${.CURDIR}/FP.script tmp.s > ${.PREFIX}.s
-       ${CC} -I${.CURDIR} -c -o ${.TARGET} ${.PREFIX}.s
-       rm  -f tmp.c tmp.s ${PREFIX}.s
-
-LIB=   fp
-
-SRCS=   \
-       add_ext.fc \
-       adder.fc \
-       adf4.fc \
-       adf8.fc \
-       cff4.fc \
-       cff8.fc \
-       cfi.fc \
-       cfu.fc \
-       cif4.fc \
-       cif8.fc \
-       cmf4.fc \
-       cmf8.fc \
-       compact.fc \
-       cuf4.fc \
-       cuf8.fc \
-       div_ext.fc \
-       dvf4.fc \
-       dvf8.fc \
-       extend.fc \
-       fef4.fc \
-       fef8.fc \
-       fif4.fc \
-       fif8.fc \
-       fptrp.s \
-       mlf4.fc \
-       mlf8.fc \
-       mul_ext.fc \
-       ngf4.fc \
-       ngf8.fc \
-       nrm_ext.fc \
-       sbf4.fc \
-       sbf8.fc \
-       sft_ext.fc \
-       shifter.fc \
-       sub_ext.fc \
-       zrf4.fc \
-       zrf8.fc \
-       zrf_ext.fc
-
-.include <bsd.lib.mk>
diff --git a/lib/ack/libfp/add_ext.fc b/lib/ack/libfp/add_ext.fc
deleted file mode 100644 (file)
index a077663..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       ADD TWO EXTENDED FORMAT NUMBERS
-*/
-
-#include "FP_types.h"
-
-void
-add_ext(e1,e2)
-register EXTEND        *e1,*e2;
-{
-       if ((e2->m1 | e2->m2) == 0L) {
-               return;
-       }
-       if ((e1->m1 | e1->m2) == 0L) {
-               *e1 = *e2;
-               return;
-       }
-       sft_ext(e1, e2);        /* adjust mantissas to equal powers */
-       if (e1->sign != e2->sign) {
-               /* e1 + e2 = e1 - (-e2) */
-               if (e2->m1 > e1->m1 ||
-                    (e2->m1 == e1->m1 && e2->m2 > e1->m2)) {
-                       /*      abs(e2) > abs(e1) */
-                       EXTEND x;
-
-                       x = *e1;
-                       *e1 = *e2;
-                       if (x.m2 > e1->m2) {
-                               e1->m1 -= 1;    /* carry in */
-                       }
-                       e1->m1 -= x.m1;
-                       e1->m2 -= x.m2;
-               }
-               else {
-                       if (e2->m2 > e1->m2)
-                               e1->m1 -= 1;    /* carry in */
-                       e1->m1 -= e2->m1;
-                       e1->m2 -= e2->m2;
-               }
-       }
-       else {
-               if (b64_add(&e1->mantissa,&e2->mantissa)) {     /* addition carry */
-                       b64_rsft(&e1->mantissa);        /* shift mantissa one bit RIGHT */
-                       e1->m1 |= 0x80000000L;  /* set max bit  */
-                       e1->exp++;              /* increase the exponent */
-               }
-       }
-       nrm_ext(e1);
-}
diff --git a/lib/ack/libfp/adder.fc b/lib/ack/libfp/adder.fc
deleted file mode 100644 (file)
index a0af3ce..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
- *     these are the routines the routines to do 32 and  64-bit addition
- */
-
-# ifdef        EXT_DEBUG
-# include <stdio.h>
-# endif
-
-# include "FP_types.h"
-# define       UNKNOWN -1
-# define       TRUE     1
-# define       FALSE    0
-# define       MAXBIT  0x80000000L
-
-       /*
-        *      add 64 bits
-        */
-int
-b64_add(e1,e2)
-               /*
-                * pointers to 64 bit 'registers'
-                */
-register       B64     *e1,*e2;
-{
-               register        int     overflow;
-                               int     carry;
-
-                       /* add higher pair of 32 bits */
-       overflow = ((unsigned long) 0xFFFFFFFF - e1->h_32 < e2->h_32);
-       e1->h_32 += e2->h_32;
-
-                       /* add lower pair of 32 bits */
-       carry = ((unsigned long) 0xFFFFFFFF - e1->l_32 < e2->l_32);
-       e1->l_32 += e2->l_32;
-# ifdef        EXT_DEBUG
-       printf("\t\t\t\t\tb64_add: overflow (%d); internal carry(%d)\n",
-                                       overflow,carry);
-       fflush(stdout);
-# endif
-       if ((carry) && (++e1->h_32 == 0))
-               return(TRUE);           /* had a 64 bit overflow */
-       return(overflow);               /* return status from higher add */
-}
diff --git a/lib/ack/libfp/adder.h b/lib/ack/libfp/adder.h
deleted file mode 100644 (file)
index 2fed414..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
- *     include file for 32 & 64 bit addition
- */
-
-typedef        struct  B64 {
-       unsigned long   h_32;   /* higher 32 bits of 64 */
-       unsigned long   l_32;   /* lower  32 bits of 64 */
-}      B64;
diff --git a/lib/ack/libfp/adf4.fc b/lib/ack/libfp/adf4.fc
deleted file mode 100644 (file)
index 572f3da..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       ADD TWO FLOATS - SINGLE (ADF 4)
-*/
-
-#include       "FP_types.h"
-
-void
-adf4(s2,s1)
-SINGLE s1,s2;
-{
-       EXTEND  e1,e2;
-       int     swap = 0;
-
-       if (s1 == (SINGLE) 0) {
-               s1 = s2;
-               return;
-       }
-       if (s2 == (SINGLE) 0) {
-               return;
-       }
-       extend(&s1,&e1,sizeof(SINGLE));
-       extend(&s2,&e2,sizeof(SINGLE));
-       add_ext(&e1,&e2);
-       compact(&e1,&s1,sizeof(SINGLE));
-}
diff --git a/lib/ack/libfp/adf8.fc b/lib/ack/libfp/adf8.fc
deleted file mode 100644 (file)
index 387c975..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       ADD TWO FLOATS - DOUBLE (ADF 8)
-*/
-
-#include       "FP_types.h"
-
-void
-adf8(s2,s1)
-DOUBLE s1,s2;
-{
-       EXTEND  e1,e2;
-
-       if (s1.d[0] == 0 && s1.d[1] == 0) {
-               s1 = s2;
-               return;
-       }
-       if (s2.d[0] == 0 && s2.d[1] == 0) {
-               return;
-       }
-
-       extend(&s1.d[0],&e1,sizeof(DOUBLE));
-       extend(&s2.d[0],&e2,sizeof(DOUBLE));
-       add_ext(&e1,&e2);
-       compact(&e1,&s1.d[0],sizeof(DOUBLE));
-}
diff --git a/lib/ack/libfp/byte_order.h b/lib/ack/libfp/byte_order.h
deleted file mode 100644 (file)
index d08b45a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#define CHAR_UNSIGNED  0
-#define MSB_AT_LOW_ADDRESS     0
-#define MSW_AT_LOW_ADDRESS     0
-#define FL_MSB_AT_LOW_ADDRESS  0
-#define FL_MSW_AT_LOW_ADDRESS  0
-#define FL_MSL_AT_LOW_ADDRESS  0
diff --git a/lib/ack/libfp/cff4.fc b/lib/ack/libfp/cff4.fc
deleted file mode 100644 (file)
index ae3b740..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-               CONVERT DOUBLE TO SINGLE (CFF 8 4)
-
-       This routine works quite simply. A floating point
-       of size 08 is converted to extended format.
-       This extended variable is converted back to
-       a floating point of size 04.
-
-*/
-
-#include       "FP_types.h"
-
-void
-cff4(src)
-DOUBLE src;    /* the source itself -  THIS TIME it's DOUBLE */
-{
-       EXTEND  buf;
-
-       extend(&src.d[0],&buf,sizeof(DOUBLE));  /* no matter what */
-       compact(&buf,&(src.d[1]),sizeof(SINGLE));
-}
diff --git a/lib/ack/libfp/cff8.fc b/lib/ack/libfp/cff8.fc
deleted file mode 100644 (file)
index a851803..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-               CONVERT SINGLE TO DOUBLE (CFF 4 8)
-
-       This routine works quite simply. A floating point
-       of size 04 is converted to extended format.
-       This extended variable is converted back to
-       a floating point of size 08.
-
-*/
-
-#include "FP_types.h"
-
-void
-cff8(src)
-SINGLE src;
-{
-       EXTEND  buf;
-
-       extend(&src,&buf,sizeof(SINGLE));       /* no matter what */
-       compact(&buf, &src,sizeof(DOUBLE));
-}
diff --git a/lib/ack/libfp/cfi.fc b/lib/ack/libfp/cfi.fc
deleted file mode 100644 (file)
index cfd2823..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-               CONVERT FLOAT TO SIGNED (CFI m n)
-
-               N.B. The caller must know what it is getting.
-                    A LONG is always returned. If it is an
-                    integer the high byte is cleared first.
-*/
-
-#include "FP_trap.h"
-#include "FP_types.h"
-#include "FP_shift.h"
-
-long
-cfi(ds,ss,src)
-int    ds;     /* destination size (2 or 4) */
-int    ss;     /* source size      (4 or 8) */
-DOUBLE src;    /* assume worst case */
-{
-       EXTEND  buf;
-       long    new;
-       short   max_exp;
-
-       extend(&src.d[0],&buf,ss);      /* get extended format */
-       if (buf.exp < 0) {      /* no conversion needed */
-               src.d[ss == 8] = 0L;
-               return(0L);
-       }
-       max_exp = (ds << 3) - 2;        /* signed numbers */
-                               /* have more limited max_exp */
-       if (buf.exp > max_exp) {
-               if (buf.exp == max_exp+1 && buf.sign && buf.m1 == NORMBIT &&
-                   buf.m2 == 0L) {
-               }
-               else {
-                       trap(EIOVFL);   /* integer overflow     */
-                       buf.exp %= max_exp; /* truncate */
-               }
-       }
-       new = buf.m1 >> (31-buf.exp);
-       if (buf.sign)
-               new = -new;
-done:
-       src.d[ss == 8] = new;
-       return(new);
-}
diff --git a/lib/ack/libfp/cfu.fc b/lib/ack/libfp/cfu.fc
deleted file mode 100644 (file)
index e9a551a..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-               CONVERT FLOAT TO UNSIGNED (CFU m n)
-
-               N.B. The caller must know what it is getting.
-                    A LONG is always returned. If it is an
-                    integer the high byte is cleared first.
-*/
-
-#include "FP_trap.h"
-#include "FP_types.h"
-
-long
-cfu(ds,ss,src)
-int    ds;     /* destination size (2 or 4) */
-int    ss;     /* source size      (4 or 8) */
-DOUBLE src;    /* assume worst case */
-{
-       EXTEND  buf;
-       long    new;
-       short   newint, max_exp;
-
-       extend(&src.d[0],&buf,ss);      /* get extended format  */
-       if (buf.exp < 0) {      /* no conversion needed */
-               src.d[ss == 8] = 0L;
-               return(0L);
-       }
-       max_exp = (ds << 3) - 1;
-       if (buf.exp > max_exp) {
-               trap(EIOVFL);   /* integer overflow     */
-               buf.exp %= max_exp;
-       }
-       new = buf.m1 >> (31-buf.exp);
-done:
-       src.d[ss == 8] = new;
-       return(new);
-}
diff --git a/lib/ack/libfp/cif4.fc b/lib/ack/libfp/cif4.fc
deleted file mode 100644 (file)
index 160d5f6..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       CONVERT INTEGER TO SINGLE (CIF n 4)
-
-       THIS ROUTINE WORKS BY FILLING AN EXTENDED
-       WITH THE INTEGER VALUE IN EXTENDED FORMAT
-       AND USES COMPACT() TO PUT IT INTO THE PROPER
-       FLOATING POINT PRECISION.
-*/
-
-#include "FP_types.h"
-
-void
-cif4(ss,src)
-int    ss;     /* source size */
-long   src;    /* largest possible integer to convert */
-{
-       EXTEND  buf;
-       short   *ipt;
-       long    i_src;
-       SINGLE  *result;
-
-       zrf_ext(&buf);
-       if (ss == sizeof(long)) {
-               buf.exp = 31;
-               i_src = src;
-               result = (SINGLE *) &src;
-       }
-       else    {
-               ipt = (short *) &src;
-               i_src = (long) *ipt;
-               buf.exp = 15;
-               result = (SINGLE *) &ss;
-       }
-       if (i_src == 0) {
-               *result = (SINGLE) 0L;
-               return;
-       }
-                       /* ESTABLISHED THAT src != 0    */
-                       /* adjust exponent field        */
-       buf.sign = (i_src < 0) ? 0x8000 : 0;
-                       /* clear sign bit of integer    */
-                       /* move to mantissa field       */
-       buf.m1 = (i_src < 0) ? -i_src : i_src;
-                       /* adjust mantissa field        */
-       if (ss != sizeof(long))
-               buf.m1 <<= 16;
-       nrm_ext(&buf);          /* adjust mantissa field        */
-       compact(&buf, result,sizeof(SINGLE));   /* put on stack */
-}
diff --git a/lib/ack/libfp/cif8.fc b/lib/ack/libfp/cif8.fc
deleted file mode 100644 (file)
index 1ab9798..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       CONVERT INTEGER TO FLOAT (CIF n 8)
-
-       THIS ROUTINE WORKS BY FILLING AN EXTENDED
-       WITH THE INTEGER VALUE IN EXTENDED FORMAT
-       AND USES COMPACT() TO PUT IT INTO THE PROPER
-       FLOATING POINT PRECISION.
-*/
-
-#include "FP_types.h"
-
-void
-cif8(ss,src)
-int    ss;     /* source size */
-long   src;    /* largest possible integer to convert */
-{
-       EXTEND  buf;
-       DOUBLE  *result;        /* for return value */
-       short   *ipt;
-       long    i_src;
-
-       result = (DOUBLE *) ((void *) &ss);     /* always */
-       zrf_ext(&buf);
-       if (ss == sizeof(long)) {
-               buf.exp = 31;
-               i_src = src;
-       }
-       else    {
-               ipt = (short *) &src;
-               i_src = (long) *ipt;
-               buf.exp = 15;
-       }
-       if (i_src == 0) {
-               zrf8(result);
-               return;
-       }
-                       /* ESTABLISHED THAT src != 0    */
-                       /* adjust exponent field        */
-       buf.sign = (i_src < 0) ? 0x8000 : 0;
-                       /* clear sign bit of integer    */
-                       /* move to mantissa field       */
-       buf.m1 = (i_src < 0) ? -i_src : i_src;
-                       /* adjust mantissa field        */
-       if (ss != sizeof(long))
-               buf.m1 <<= 16;
-       nrm_ext(&buf);
-       compact(&buf,&result->d[0],8);
-}
diff --git a/lib/ack/libfp/cmf4.fc b/lib/ack/libfp/cmf4.fc
deleted file mode 100644 (file)
index ee186ff..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       COMPARE SINGLES (CMF 4)
-*/
-
-#include       "FP_types.h"
-#include       "get_put.h"
-
-int
-cmf4(f1,f2)
-SINGLE f1,f2;
-{
-               /*
-                * return ((f1 < f2) ? 1 : (f1 - f2))
-                */
-#define SIGN(x) (((x) < 0) ? -1 : 1)
-        int    sign1,sign2;
-       long    l1,l2;
-
-       l1 = get4((char *) &f1);
-       l2 = get4((char *) &f2);
-
-       if (l1 == l2) return 0;
-
-        sign1 = SIGN(l1);
-        sign2 = SIGN(l2);
-        if (sign1 != sign2) {
-               if ((l1 & 0x7fffffff) == 0 &&
-                   (l2 & 0x7fffffff) == 0) return 0;
-                return ((sign1 > 0) ? -1 : 1);
-       }
-
-       return (sign1 * ((l1 < l2) ? 1 : -1));
-}
diff --git a/lib/ack/libfp/cmf8.fc b/lib/ack/libfp/cmf8.fc
deleted file mode 100644 (file)
index 5badab0..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       COMPARE DOUBLES (CMF 8)
-*/
-
-#include       "FP_types.h"
-#include       "get_put.h"
-
-int
-cmf8(d1,d2)
-DOUBLE d1,d2;
-{
-#define        SIGN(x) (((x) < 0) ? -1 : 1)
-               /*
-                * return ((d1 < d2) ? 1 : (d1 > d2) ? -1 : 0))
-                */
-       long    l1,l2;
-       int     sign1,sign2;
-       int     rv;
-
-#if FL_MSL_AT_LOW_ADDRESS
-       l1 = get4((char *)&d1);
-       l2 = get4((char *)&d2);
-#else
-       l1 = get4(((char *)&d1+4));
-       l2 = get4(((char *)&d2+4));
-#endif
-       sign1 = SIGN(l1);
-       sign2 = SIGN(l2);
-       if (sign1 != sign2) {
-               l1 &= 0x7fffffff;
-               l2 &= 0x7fffffff;
-               if (l1 != 0 || l2 != 0) {
-                       return ((sign1 > 0) ? -1 : 1);
-               }
-       }
-       if (l1 != l2)   {       /* we can decide here */
-               rv = l1 < l2 ? 1 : -1;
-       }
-       else    {               /* decide in 2nd half */
-               unsigned long u1, u2;
-#if FL_MSL_AT_LOW_ADDRESS
-               u1 = get4(((char *)&d1 + 4));
-               u2 = get4(((char *)&d2 + 4));
-#else
-               u1 = get4((char *)&d1);
-               u2 = get4((char *)&d2);
-#endif
-               if (u1 == u2)
-                       return(0);
-               if (u1 < u2) rv = 1;
-               else rv = -1;
-       }
-       return sign1 * rv;
-}
diff --git a/lib/ack/libfp/compact.fc b/lib/ack/libfp/compact.fc
deleted file mode 100644 (file)
index a5a1074..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       COMPACT EXTEND FORMAT INTO FLOAT OF PROPER SIZE
-*/
-
-# include "FP_bias.h"
-# include "FP_shift.h"
-# include "FP_trap.h"
-# include "FP_types.h"
-# include "get_put.h"
-
-void
-compact(f,to,size)
-EXTEND *f;
-unsigned long  *to;
-int    size;
-{
-       int     error = 0;
-
-       if (size == sizeof(DOUBLE)) {
-       /*
-        * COMPACT EXTENDED INTO DOUBLE
-        */
-               DOUBLE *DBL = (DOUBLE *) (void *) to;
-
-               if ((f->m1|(f->m2 & DBL_ZERO)) == 0L)   {
-                       zrf8(DBL);
-                       return;
-               }
-               f->exp += DBL_BIAS;     /* restore proper bias  */
-               if (f->exp > DBL_MAX)   {
-dbl_over:                      trap(EFOVFL);
-                       f->exp = DBL_MAX+1;
-                       f->m1 = 0;
-                       f->m2 = 0;
-                       if (error++)
-                               return;
-               }
-               else if (f->exp < DBL_MIN)      {
-                       b64_rsft(&(f->mantissa));
-                       if (f->exp < 0) {
-                               b64_sft(&(f->mantissa), -f->exp);
-                               f->exp = 0;
-                       }
-                       /* underflow ??? */
-               }
-                       
-               /* local CAST conversion                */
-
-               /* because of special format shift only 10 bits */
-               /* bit shift mantissa 10 bits           */
-
-               /* first align within words, then do store operation */
-
-               DBL->d[0] = f->m1 >> DBL_RUNPACK;   /* plus 22 == 32 */
-               DBL->d[1] = f->m2 >> DBL_RUNPACK;   /* plus 22 == 32 */
-               DBL->d[1] |= (f->m1 << DBL_LUNPACK); /* plus 10 == 32 */
-
-               /* if not exact then round to nearest   */
-               /* on a tie, round to even */
-
-#ifdef EXCEPTION_INEXACT
-               if ((f->m2 & DBL_EXACT) != 0) {
-                   INEXACT();
-#endif
-                   if (((f->m2 & DBL_EXACT) > DBL_ROUNDUP)
-                       || ((f->m2 & DBL_EXACT) == DBL_ROUNDUP
-                           && (f->m2 & (DBL_ROUNDUP << 1)))) {
-                       DBL->d[1]++;    /* rounding up  */
-                       if (DBL->d[1] == 0L) { /* carry out     */
-                           DBL->d[0]++;
-
-                           if (f->exp == 0 && (DBL->d[0] & ~DBL_MASK)) {
-                                       f->exp++;
-                               }
-                           if (DBL->d[0] & DBL_CARRYOUT) { /* carry out */
-                               if (DBL->d[0] & 01)
-                                   DBL->d[1] = CARRYBIT;
-                               DBL->d[0] >>= 1;
-                               f->exp++;
-                           }
-                       }
-                       /*      check for overflow                      */
-                       if (f->exp > DBL_MAX)
-                               goto dbl_over;
-                   }
-#ifdef EXCEPTION_INEXACT
-               }
-#endif
-
-               /*
-                * STORE EXPONENT AND SIGN:
-                *
-                * 1) clear leading bits (B4-B15)
-                * 2) shift and store exponent
-                */
-
-               DBL->d[0] &= DBL_MASK;
-               DBL->d[0] |= 
-                       ((long) (f->exp << DBL_EXPSHIFT) << EXP_STORE);
-               if (f->sign)
-                       DBL->d[0] |= CARRYBIT;
-
-               /*
-                * STORE MANTISSA
-                */
-
-#if FL_MSL_AT_LOW_ADDRESS
-               put4(DBL->d[0], (char *) &DBL->d[0]);
-               put4(DBL->d[1], (char *) &DBL->d[1]);
-#else
-               { unsigned long l;
-                 put4(DBL->d[1], (char *) &l);
-                 put4(DBL->d[0], (char *) &DBL->d[1]);
-                 DBL->d[0] = l;
-               }
-#endif
-       }
-       else {
-               /*
-                * COMPACT EXTENDED INTO FLOAT
-                */
-               SINGLE  *SGL;
-
-               /* local CAST conversion                */
-               SGL = (SINGLE *) (void *) to;
-               if ((f->m1 & SGL_ZERO) == 0L)   {
-                       *SGL = 0L;
-                       return;
-               }
-               f->exp += SGL_BIAS;     /* restore bias */
-               if (f->exp > SGL_MAX)   {
-sgl_over:                      trap(EFOVFL);
-                       f->exp = SGL_MAX+1;
-                       f->m1 = 0L;
-                       f->m2 = 0L;
-                       if (error++)
-                               return;
-               }
-               else if (f->exp < SGL_MIN)      {
-                       b64_rsft(&(f->mantissa));
-                       if (f->exp < 0) {
-                               b64_sft(&(f->mantissa), -f->exp);
-                               f->exp = 0;
-                       }
-                       /* underflow ??? */
-               }
-
-               /* shift mantissa and store     */
-               *SGL = (f->m1 >> SGL_RUNPACK);
-
-               /* check for rounding to nearest        */
-               /* on a tie, round to even              */
-#ifdef EXCEPTION_INEXACT
-               if (f->m2 != 0 ||
-                   (f->m1 & SGL_EXACT) != 0L) {
-                       INEXACT();
-#endif
-                       if (((f->m1 & SGL_EXACT) > SGL_ROUNDUP)
-                           || ((f->m1 & SGL_EXACT) == SGL_ROUNDUP
-                               && (f->m1 & (SGL_ROUNDUP << 1)))) {
-                               (*SGL)++;
-                               if (f->exp == 0 && (*SGL & ~SGL_MASK)) {
-                                       f->exp++;
-                               }
-                       /* check normal */
-                               if (*SGL & SGL_CARRYOUT)        {
-                                       *SGL >>= 1;
-                                       f->exp++;
-                               }
-                               if (f->exp > SGL_MAX)
-                                       goto sgl_over;
-                       }
-#ifdef EXCEPTION_INEXACT
-               }
-#endif
-
-               /*
-                * STORE EXPONENT AND SIGN:
-                *
-                * 1) clear leading bit of fraction
-                * 2) shift and store exponent
-                */
-
-               *SGL &= SGL_MASK; /* B23-B31 are 0 */
-               *SGL |= ((long) (f->exp << SGL_EXPSHIFT) << EXP_STORE);
-               if (f->sign)
-                       *SGL |= CARRYBIT;
-
-               /*
-                * STORE MANTISSA
-                */
-
-               put4(*SGL, (char *) &SGL);
-       }
-}
diff --git a/lib/ack/libfp/cuf4.fc b/lib/ack/libfp/cuf4.fc
deleted file mode 100644 (file)
index c022f0e..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       CONVERT INTEGER TO SINGLE (CUF n 4)
-
-       THIS ROUTINE WORKS BY FILLING AN EXTENDED
-       WITH THE INTEGER VALUE IN EXTENDED FORMAT
-       AND USES COMPACT() TO PUT IT INTO THE PROPER
-       FLOATING POINT PRECISION.
-*/
-
-#include "FP_types.h"
-
-void
-cuf4(ss,src)
-int    ss;     /* source size */
-long   src;    /* largest possible integer to convert */
-{
-       EXTEND  buf;
-       short   *ipt;
-       SINGLE  *result;
-       long    i_src;
-
-       zrf_ext(&buf);
-       if (ss == sizeof(long)) {
-               buf.exp = 31;
-               i_src = src;
-               result = (SINGLE *) &src;
-       }
-       else    {
-               ipt = (short *) &src;
-               i_src = (long) *ipt;
-               buf.exp = 15;
-               result = (SINGLE *) ((void *) &ss);
-       }
-       if (i_src == 0) {
-               *result = (SINGLE) 0L;
-               return;
-       }
-                       /* ESTABLISHED THAT src != 0    */
-
-                       /* adjust exponent field        */
-       if (ss != sizeof(long))
-               i_src <<= 16;
-
-                       /* move to mantissa field       */
-       buf.m1 = i_src;
-
-                       /* adjust mantissa field        */
-       nrm_ext(&buf);
-       compact(&buf,result,4);
-}
diff --git a/lib/ack/libfp/cuf8.fc b/lib/ack/libfp/cuf8.fc
deleted file mode 100644 (file)
index d18ec6c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       CONVERT INTEGER TO FLOAT (CUF n 8)
-
-       THIS ROUTINE WORKS BY FILLING AN EXTENDED
-       WITH THE INTEGER VALUE IN EXTENDED FORMAT
-       AND USES COMPACT() TO PUT IT INTO THE PROPER
-       FLOATING POINT PRECISION.
-*/
-
-#include "FP_types.h"
-
-void
-cuf8(ss,src)
-int    ss;     /* source size */
-long   src;    /* largest possible integer to convert */
-{
-       EXTEND  buf;
-       short   *ipt;
-       long    i_src;
-
-       zrf_ext(&buf);
-       if (ss == sizeof(long)) {
-               buf.exp = 31;
-               i_src = src;
-       }
-       else    {
-               ipt = (short *) &src;
-               i_src = (long) *ipt;
-               buf.exp = 15;
-       }
-       if (i_src == 0) {
-               zrf8((DOUBLE *)((void *)&ss));
-               return;
-       }
-                       /* ESTABLISHED THAT src != 0    */
-
-                       /* adjust exponent field        */
-       if (ss != sizeof(long))
-               i_src <<= 16;
-
-                       /* move to mantissa field       */
-       buf.m1 = i_src;
-
-                       /* adjust mantissa field        */
-       nrm_ext(&buf);
-       compact(&buf,(unsigned long *) (void *)&ss,8);
-}
diff --git a/lib/ack/libfp/div_ext.fc b/lib/ack/libfp/div_ext.fc
deleted file mode 100644 (file)
index bb95311..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       DIVIDE EXTENDED FORMAT
-*/
-
-#include "FP_bias.h"
-#include "FP_trap.h"
-#include "FP_types.h"
-
-/*
-       November 15, 1984
-
-       This is a routine to do the work.
-       There are two versions: 
-       One is based on the partial products method
-       and makes no use possible machine instructions
-       to divide (hardware dividers).
-       The other is used when USE_DIVIDE is defined. It is much faster on
-       machines with fast 4 byte operations.
-*/
-/********************************************************/
-
-void
-div_ext(e1,e2)
-EXTEND *e1,*e2;
-{
-       short   error = 0;
-       B64             result;
-       register        unsigned long   *lp;
-#ifndef USE_DIVIDE
-       short   count;
-#else
-       unsigned short u[9], v[5];
-       register int j;
-       register unsigned short *u_p = u;
-       int maxv = 4;
-#endif
-
-       if ((e2->m1 | e2->m2) == 0) {
-                /*
-                 * Exception 8.2 - Divide by zero
-                 */
-               trap(EFDIVZ);
-               e1->m1 = e1->m2 = 0L;
-               e1->exp = EXT_MAX;
-               return;
-       }
-       if ((e1->m1 | e1->m2) == 0) {   /* 0 / anything == 0 */
-               e1->exp = 0;    /* make sure */
-               return;
-       }
-#ifndef USE_DIVIDE
-       /*
-        * numbers are right shifted one bit to make sure
-        * that m1 is quaranteed to be larger if its
-        * maximum bit is set
-        */
-       b64_rsft(&e1->mantissa);        /* 64 bit shift right */
-       b64_rsft(&e2->mantissa);        /* 64 bit shift right */
-       e1->exp++;
-       e2->exp++;
-#endif
-       /*      check for underflow, divide by zero, etc        */
-       e1->sign ^= e2->sign;
-       e1->exp -= e2->exp;
-
-#ifndef USE_DIVIDE
-               /* do division of mantissas     */
-               /* uses partial product method  */
-               /* init control variables       */
-
-       count = 64;
-       result.h_32 = 0L;
-       result.l_32 = 0L;
-
-               /* partial product division loop */
-
-       while (count--) {
-               /* first left shift result 1 bit        */
-               /* this is ALWAYS done                  */
-
-               b64_lsft(&result);
-
-               /* compare dividend and divisor         */
-               /* if dividend >= divisor add a bit     */
-               /* and subtract divisior from dividend  */
-
-               if ( (e1->m1 < e2->m1) ||
-                       ((e1->m1 == e2->m1) && (e1->m2 < e2->m2) ))
-                       ;       /* null statement */
-                               /* i.e., don't add or subtract */
-               else    {
-                       result.l_32++;  /* ADD  */
-                       if (e2->m2 > e1->m2)
-                               e1->m1 -= 1;    /* carry in */
-                       e1->m1 -= e2->m1;       /* do SUBTRACTION */
-                       e1->m2 -= e2->m2;       /*    SUBTRACTION */
-               }
-
-               /*      shift dividend left one bit OR  */
-               /*      IF it equals ZERO we can break out      */
-               /*      of the loop, but still must shift       */
-               /*      the quotient the remaining count bits   */
-               /* NB   save the results of this test in error  */
-               /*      if not zero, then the result is inexact. */
-               /*      this would be reported in IEEE standard */
-
-               /*      lp points to dividend                   */
-               lp = &e1->m1;
-
-               error = ((*lp | *(lp+1)) != 0L) ? 1 : 0;
-               if (error)      {       /* more work */
-                       /*      assume max bit == 0 (see above) */
-                       b64_lsft(&e1->mantissa);
-                       continue;
-               }
-               else
-                       break;  /* leave loop   */
-       }       /* end of divide by subtraction loop    */
-
-       if (count > 0)  {
-               lp = &result.h_32;
-               if (count > 31) {       /* move to higher word */
-                       *lp = *(lp+1);
-                       count -= 32;
-                       *(lp+1) = 0L;   /* clear low word       */
-               }
-               if (*lp)
-                       *lp <<= count;  /* shift rest of way    */
-               lp++;   /*  == &result.l_32     */
-               if (*lp) {
-                       result.h_32 |= (*lp >> 32-count);
-                       *lp <<= count;
-               }
-       }
-#else /* USE_DIVIDE */
-
-       u[4] = (e1->m2 & 1) << 15;
-       b64_rsft(&(e1->mantissa));
-       u[0] = e1->m1 >> 16;
-       u[1] = e1->m1;
-       u[2] = e1->m2 >> 16;
-       u[3] = e1->m2;
-       u[5] = 0; u[6] = 0; u[7] = 0;
-       v[1] = e2->m1 >> 16;
-       v[2] = e2->m1;
-       v[3] = e2->m2 >> 16;
-       v[4] = e2->m2;
-       while (! v[maxv]) maxv--;
-       result.h_32 = 0;
-       result.l_32 = 0;
-       lp = &result.h_32;
-
-       /*
-        * Use an algorithm of Knuth (The art of programming, Seminumerical
-        * algorithms), to divide u by v. u and v are both seen as numbers
-        * with base 65536. 
-        */
-       for (j = 0; j <= 3; j++, u_p++) {
-               unsigned long q_est, temp;
-
-               if (j == 2) lp++;
-               if (u_p[0] == 0 && u_p[1] < v[1]) continue;
-               temp = ((unsigned long)u_p[0] << 16) + u_p[1];
-               if (u_p[0] >= v[1]) {
-                       q_est = 0x0000FFFFL;
-               }
-               else {
-                       q_est = temp / v[1];
-               }
-               temp -= q_est * v[1];
-               while (temp < 0x10000 && v[2]*q_est > ((temp<<16)+u_p[2])) {
-                       q_est--;
-                       temp += v[1];
-               }
-               /*      Now, according to Knuth, we have an estimate of the
-                       quotient, that is either correct or one too big, but
-                       almost always correct.
-               */
-               if (q_est != 0)  {
-                       int i;
-                       unsigned long k = 0;
-                       int borrow = 0;
-
-                       for (i = maxv; i > 0; i--) {
-                               unsigned long tmp = q_est * v[i] + k + borrow;
-                               unsigned short md = tmp;
-
-                               borrow = (md > u_p[i]);
-                               u_p[i] -= md;
-                               k = tmp >> 16;
-                       }
-                       k += borrow;
-                       borrow = u_p[0] < k;
-                       u_p[0] -= k;
-
-                       if (borrow) {
-                               /* So, this does not happen often; the estimate
-                                  was one too big; correct this
-                               */
-                               *lp |= (j & 1) ? (q_est - 1) : ((q_est-1)<<16);
-                               borrow = 0;
-                               for (i = maxv; i > 0; i--) {
-                                       unsigned long tmp 
-                                           = v[i]+(unsigned long)u_p[i]+borrow;
-                                       
-                                       u_p[i] = tmp;
-                                       borrow = tmp >> 16;
-                               }
-                               u_p[0] += borrow;
-                       }
-                       else *lp |= (j & 1) ? q_est : (q_est<<16);
-               }
-       }
-#ifdef EXCEPTION_INEXACT
-       u_p = &u[0];
-       for (j = 7; j >= 0; j--) {
-               if (*u_p++) {
-                       error = 1;
-                       break;
-               }
-       }
-#endif
-#endif
-
-#ifdef  EXCEPTION_INEXACT
-        if (error)      {
-                /*
-                 * report here exception 8.5 - Inexact
-                 * from Draft 8.0 of IEEE P754:
-                 * In the absence of an invalid operation exception,
-                 * if the rounded result of an operation is not exact or if
-                 * it overflows without a trap, then the inexact exception
-                 * shall be assigned. The rounded or overflowed result
-                 * shall be delivered to the destination.
-                 */
-                INEXACT();
-#endif
-       e1->mantissa = result;
-
-       nrm_ext(e1);
-       if (e1->exp < EXT_MIN)  {
-               /*
-                * Exception 8.4 - Underflow
-                */
-               trap(EFUNFL);   /* underflow */
-               e1->exp = EXT_MIN;
-               e1->m1 = e1->m2 = 0L;
-               return;
-       }
-       if (e1->exp >= EXT_MAX) {
-                /*
-                 * Exception 8.3 - Overflow
-                 */
-                trap(EFOVFL);   /* overflow */
-                e1->exp = EXT_MAX;
-                e1->m1 = e1->m2 = 0L;
-                return;
-        }
-}
diff --git a/lib/ack/libfp/dvf4.fc b/lib/ack/libfp/dvf4.fc
deleted file mode 100644 (file)
index 7d82cd8..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       DIVIDE TWO SINGLES - SINGLE Precision (dvf 4)
-*/
-
-#include       "FP_types.h"
-
-void
-dvf4(s2,s1)
-SINGLE s1,s2;
-{
-       EXTEND  e1,e2;
-
-       extend(&s1,&e1,sizeof(SINGLE));
-       extend(&s2,&e2,sizeof(SINGLE));
-
-               /* do a divide */
-       div_ext(&e1,&e2);
-       compact(&e1,&s1,sizeof(SINGLE));
-}
diff --git a/lib/ack/libfp/dvf8.fc b/lib/ack/libfp/dvf8.fc
deleted file mode 100644 (file)
index fafe50f..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       DIVIDE TWO FLOATS - DOUBLE Precision (DVF 8)
-*/
-
-#include       "FP_types.h"
-
-void
-dvf8(s2,s1)
-DOUBLE s1,s2;
-{
-       EXTEND  e1,e2;
-
-       extend(&s1.d[0],&e1,sizeof(DOUBLE));
-       extend(&s2.d[0],&e2,sizeof(DOUBLE));
-
-               /* do a divide */
-       div_ext(&e1,&e2);
-       compact(&e1,&s1.d[0],sizeof(DOUBLE));
-}
diff --git a/lib/ack/libfp/extend.fc b/lib/ack/libfp/extend.fc
deleted file mode 100644 (file)
index 70febb1..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       CONVERTS FLOATING POINT TO EXTENDED FORMAT
-
-       Two sizes of FLOATING Point are known:
-               SINGLE and DOUBLE
-*/
-/********************************************************/
-/*
-       It is not required to normalize in extended
-       format, but it has been chosen to do so.
-       Extended Format is as follows (at exit):
-
-->sign S000 0000 | 0000 0000           <SIGN>
-->exp  0EEE EEEE | EEEE EEEE           <EXPONENT>
-->m1   LFFF FFFF | FFFF FFFF           <L.Fraction>
-       FFFF FFFF | FFFF FFFF           <Fraction>
-->m2   FFFF FFFF | FFFF FFFF           <Fraction>
-       FFFF F000 | 0000 0000           <Fraction>
-*/
-/********************************************************/
-
-#include "FP_bias.h"
-#include "FP_shift.h"
-#include "FP_types.h"
-#include "get_put.h"
-/********************************************************/
-
-void
-extend(from,to,size)
-unsigned long  *from;
-EXTEND *to;
-int    size;
-{
-       register char *cpt1;
-       unsigned long   tmp;
-       int     leadbit = 0;
-
-       cpt1 = (char *) from;
-
-#if FL_MSL_AT_LOW_ADDRESS
-#if FL_MSW_AT_LOW_ADDRESS
-       to->exp = uget2(cpt1);
-#else
-       to->exp = uget2(cpt1+2);
-#endif
-#else
-#if FL_MSW_AT_LOW_ADDRESS
-       to->exp = uget2(cpt1+(size == sizeof(DOUBLE) ? 4 : 0));
-#else
-       to->exp = uget2(cpt1+(size == sizeof(DOUBLE) ? 6 : 2));
-#endif
-#endif
-       to->sign = (to->exp & 0x8000);  /* set sign bit */
-       to->exp ^= to->sign;
-       if (size == sizeof(DOUBLE))
-               to->exp >>= DBL_EXPSHIFT;
-       else
-               to->exp >>= SGL_EXPSHIFT;
-       if (to->exp > 0)
-               leadbit++;      /* will set Lead bit later      */
-       else to->exp++;
-
-       if (size == sizeof(DOUBLE))     {
-#if FL_MSL_AT_LOW_ADDRESS
-               to->m1 = get4(cpt1);
-               cpt1 += 4;
-               tmp = get4(cpt1);
-#else
-               tmp = get4(cpt1);
-               cpt1 += 4;
-               to->m1 = get4(cpt1);
-#endif
-               if (to->exp == 1 && to->m1 == 0 && tmp == 0) {
-                       to->exp = 0;
-                       to->sign = 0;
-                       to->m1 = 0;
-                       to->m2 = 0;
-                       return;
-               }
-               to->m1 <<= DBL_M1LEFT;          /* shift        */
-               to->exp -= DBL_BIAS;            /* remove bias  */
-               to->m1 |= (tmp>>DBL_RPACK);     /* plus 10 == 32        */
-               to->m2 = (tmp<<DBL_LPACK);      /* plus 22 == 32        */
-       }
-       else    {       /* size == sizeof(SINGLE)               */
-               to->m1 = get4(cpt1);
-               to->m1  <<= SGL_M1LEFT; /* shift        */
-               if (to->exp == 1 && to->m1 == 0) {
-                       to->exp = 0;
-                       to->sign = 0;
-                       to->m1 = 0;
-                       to->m2 = 0;
-                       return;
-               }
-               to->exp -= SGL_BIAS;            /* remove bias  */
-               to->m2 = 0L;
-       }
-
-       to->m1 |= NORMBIT;                              /* set bit L    */
-       if (leadbit == 0) {             /* set or clear Leading Bit     */
-               to->m1 &= ~NORMBIT;                     /* clear bit L  */
-               nrm_ext(to);                            /* and normalize */
-       }
-}
diff --git a/lib/ack/libfp/fef4.fc b/lib/ack/libfp/fef4.fc
deleted file mode 100644 (file)
index ff426f5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       SEPERATE INTO EXPONENT AND FRACTION (FEF 4)
-*/
-
-#include       "FP_types.h"
-
-void
-fef4(r,s1)
-SINGLE s1;
-struct fef4_returns    *r;
-{
-       EXTEND  buf;
-       register struct fef4_returns    *p = r; /* make copy; r might refer
-                                                  to itself (see table)
-                                               */
-
-       extend(&s1,&buf,sizeof(SINGLE));
-       if (buf.exp == 0 && buf.m1 == 0 && buf.m2 == 0) {
-               p->e = 0;
-       }
-       else {
-               p->e = buf.exp+1;
-               buf.exp = -1;
-       }
-       compact(&buf,&p->f,sizeof(SINGLE));
-}
diff --git a/lib/ack/libfp/fef8.fc b/lib/ack/libfp/fef8.fc
deleted file mode 100644 (file)
index 1c3b3b0..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       SEPERATE DOUBLE INTO EXPONENT AND FRACTION (FEF 8)
-*/
-
-#include       "FP_types.h"
-
-void
-fef8(r, s1)
-DOUBLE s1;
-struct fef8_returns *r;
-{
-       EXTEND  buf;
-       register struct fef8_returns *p = r;    /* make copy, r might refer
-                                                  to itself (see table)
-                                               */
-
-       extend(&s1.d[0],&buf,sizeof(DOUBLE));
-       if (buf.exp == 0 && buf.m1 == 0 && buf.m2 == 0) {
-               p->e = 0;
-       }
-       else {
-               p->e = buf.exp + 1;
-               buf.exp = -1;
-       }
-       compact(&buf,&p->f.d[0],sizeof(DOUBLE));
-}
diff --git a/lib/ack/libfp/fif4.fc b/lib/ack/libfp/fif4.fc
deleted file mode 100644 (file)
index 0593724..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       MULTIPLY AND DISMEMBER PARTS (FIF 4)
-*/
-
-#include "FP_types.h"
-#include "FP_shift.h"
-
-void
-fif4(p,x,y)
-SINGLE x,y;
-struct fif4_returns *p;
-{
-
-       EXTEND  e1,e2;
-
-       extend(&y,&e1,sizeof(SINGLE));
-       extend(&x,&e2,sizeof(SINGLE));
-               /* do a multiply */
-       mul_ext(&e1,&e2);
-       e2 = e1;
-       compact(&e2,&y,sizeof(SINGLE));
-       if (e1.exp < 0) {
-               p->ipart = 0;
-               p->fpart = y;
-               return;
-       }
-       if (e1.exp > 30 - SGL_M1LEFT) {
-               p->ipart = y;
-               p->fpart = 0;
-               return;
-       }
-       b64_sft(&e1.mantissa, 63 - e1.exp);
-       b64_sft(&e1.mantissa, e1.exp - 63);     /* "loose" low order bits */
-       compact(&e1,&(p->ipart),sizeof(SINGLE));
-       extend(&(p->ipart), &e2, sizeof(SINGLE));
-       extend(&y, &e1, sizeof(SINGLE));
-       sub_ext(&e1, &e2);
-       compact(&e1, &(p->fpart), sizeof(SINGLE));
-}
diff --git a/lib/ack/libfp/fif8.fc b/lib/ack/libfp/fif8.fc
deleted file mode 100644 (file)
index 9f1b9b1..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       MULTIPLY AND DISMEMBER PARTS (FIF 8)
-*/
-
-#include "FP_types.h"
-#include "FP_shift.h"
-
-void
-fif8(p,x,y)
-DOUBLE x,y;
-struct fif8_returns *p;
-{
-
-       EXTEND  e1,e2;
-
-       extend(&y.d[0],&e1,sizeof(DOUBLE));
-       extend(&x.d[0],&e2,sizeof(DOUBLE));
-               /* do a multiply */
-       mul_ext(&e1,&e2);
-       e2 = e1;
-       compact(&e2, &y.d[0], sizeof(DOUBLE));
-       if (e1.exp < 0) {
-               p->ipart.d[0] = 0;
-               p->ipart.d[1] = 0;
-               p->fpart = y;
-               return;
-       }
-       if (e1.exp > 62 - DBL_M1LEFT) {
-               p->ipart = y;
-               p->fpart.d[0] = 0;
-               p->fpart.d[1] = 0;
-               return;
-       }
-       b64_sft(&e1.mantissa, 63 - e1.exp);
-       b64_sft(&e1.mantissa, e1.exp - 63);     /* "loose" low order bits */
-       compact(&e1, &(p->ipart.d[0]), sizeof(DOUBLE));
-       extend(&(p->ipart.d[0]), &e2, sizeof(DOUBLE));
-       extend(&y.d[0], &e1, sizeof(DOUBLE));
-       sub_ext(&e1, &e2);
-       compact(&e1, &(p->fpart.d[0]), sizeof(DOUBLE));
-}
diff --git a/lib/ack/libfp/fptrp.s b/lib/ack/libfp/fptrp.s
deleted file mode 100644 (file)
index d2823f4..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.define __fptrp
-.sect .text
-__fptrp:
-#if __i386
-       push    ebp
-       mov     ebp, esp
-       mov     eax, 8(bp)
-       call    .Xtrp
-       leave
-       ret
-#else /* i86 */
-       push    bp
-       mov     bp, sp
-       mov     ax, 4(bp)
-       call    .Xtrp
-       jmp     .cret
-#endif
diff --git a/lib/ack/libfp/get_put.h b/lib/ack/libfp/get_put.h
deleted file mode 100644 (file)
index 9fd7f60..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-#include <byte_order.h>
-
-#if CHAR_UNSIGNED
-#define Xchar(ch)      (ch)
-#else
-#define Xchar(ch)      ((ch) & 0377)
-#endif
-
-#define BYTES_REVERSED (MSB_AT_LOW_ADDRESS != FL_MSB_AT_LOW_ADDRESS)
-#define WORDS_REVERSED (MSW_AT_LOW_ADDRESS != FL_MSW_AT_LOW_ADDRESS)
-#define LONGS_REVERSED (FL_MSL_AT_LOW_ADDRESS)
-
-#if BYTES_REVERSED
-#define uget2(c)       (Xchar((c)[1]) | ((unsigned) Xchar((c)[0]) << 8))
-#define Xput2(i, c)    (((c)[1] = (i)), ((c)[0] = (i) >> 8))
-#define put2(i, c)     { register int j = (i); Xput2(j, c); }
-#else
-#define uget2(c)       (* ((unsigned short *) (c)))
-#define Xput2(i, c)    (* ((short *) (c)) = (i))
-#define put2(i, c)     Xput2(i, c)
-#endif
-
-#define get2(c)                ((short) uget2(c))
-
-#if WORDS_REVERSED || BYTES_REVERSED
-#define get4(c)                (uget2((c)+2) | ((long) uget2(c) << 16))
-#define put4(l, c)     { register long x=(l); \
-                         Xput2((int)x,(c)+2); \
-                         Xput2((int)(x>>16),(c)); \
-                       }
-#else
-#define get4(c)                (* ((long *) (c)))
-#define put4(l, c)     (* ((long *) (c)) = (l))
-#endif
diff --git a/lib/ack/libfp/mlf4.fc b/lib/ack/libfp/mlf4.fc
deleted file mode 100644 (file)
index d5f515d..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
- * Multiply Single Precesion Float (MLF 4)
- */
-
-#include       "FP_types.h"
-
-void
-mlf4(s2,s1)
-SINGLE s1,s2;
-{
-       EXTEND  e1,e2;
-
-       extend(&s1,&e1,sizeof(SINGLE));
-       extend(&s2,&e2,sizeof(SINGLE));
-               /* do a multiply */
-       mul_ext(&e1,&e2);
-       compact(&e1,&s1,sizeof(SINGLE));
-}
diff --git a/lib/ack/libfp/mlf8.fc b/lib/ack/libfp/mlf8.fc
deleted file mode 100644 (file)
index b43cdf3..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
- * Multiply Double Precision Float (MLF 8)
- */
-
-#include       "FP_types.h"
-
-void
-mlf8(s2,s1)
-DOUBLE s1,s2;
-{
-       EXTEND  e1,e2;
-
-       extend(&s1.d[0],&e1,sizeof(DOUBLE));
-       extend(&s2.d[0],&e2,sizeof(DOUBLE));
-               /* do a multiply */
-       mul_ext(&e1,&e2);
-       compact(&e1,&s1.d[0],sizeof(DOUBLE));
-}
diff --git a/lib/ack/libfp/mul_ext.fc b/lib/ack/libfp/mul_ext.fc
deleted file mode 100644 (file)
index 78a6140..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       ROUTINE TO MULTIPLY TWO EXTENDED FORMAT NUMBERS
-*/
-
-# include "FP_bias.h"
-# include "FP_trap.h"
-# include "FP_types.h"
-# include "FP_shift.h"
-
-void
-mul_ext(e1,e2)
-EXTEND *e1,*e2;
-{
-       register int    i,j;            /* loop control */
-       unsigned short  mp[4];          /* multiplier */
-       unsigned short  mc[4];          /* multipcand */
-       unsigned short  result[8];      /* result */
-       register unsigned short *pres;
-
-       /* first save the sign (XOR)                    */
-       e1->sign ^= e2->sign;
-
-       /* compute new exponent */
-       e1->exp += e2->exp + 1;
-       /* 128 bit multiply of mantissas                        */
-
-               /* assign unknown long formats          */
-               /* to known unsigned word formats       */
-       mp[0] = e1->m1 >> 16;
-       mp[1] = (unsigned short) e1->m1;
-       mp[2] = e1->m2 >> 16;
-       mp[3] = (unsigned short) e1->m2;
-       mc[0] = e2->m1 >> 16;
-       mc[1] = (unsigned short) e2->m1;
-       mc[2] = e2->m2 >> 16;
-       mc[3] = (unsigned short) e2->m2;
-       for (i = 8; i--;) {
-               result[i] = 0;
-       }
-       /*
-        *      fill registers with their components
-        */
-       for(i=4, pres = &result[4];i--;pres--) if (mp[i]) {
-               unsigned short k = 0;
-               unsigned long mpi = mp[i];
-               for(j=4;j--;) {
-                       unsigned long tmp = (unsigned long)pres[j] + k;
-                       if (mc[j]) tmp += mpi * mc[j];
-                       pres[j] = tmp;
-                       k = tmp >> 16;
-               }
-               pres[-1] = k;
-       }
-        if (! (result[0] & 0x8000)) {
-                e1->exp--;
-                for (i = 0; i <= 3; i++) {
-                        result[i] <<= 1;
-                        if (result[i+1]&0x8000) result[i] |= 1;
-                }
-                result[4] <<= 1;
-        }
-
-       /*
-        *      combine the registers to a total
-        */
-       e1->m1 = ((unsigned long)(result[0]) << 16) + result[1];
-       e1->m2 = ((unsigned long)(result[2]) << 16) + result[3];
-       if (result[4] & 0x8000) {
-               if (++e1->m2 == 0)
-                       if (++e1->m1 == 0) {
-                               e1->m1 = NORMBIT;
-                               e1->exp++;
-                       }
-       }
-
-                                       /* check for overflow   */
-       if (e1->exp >= EXT_MAX) {
-               trap(EFOVFL);
-                       /* if caught                    */
-                       /* return signed infinity       */
-               e1->exp = EXT_MAX;
-infinity:      e1->m1 = e1->m2 =0L;
-               return;
-       }
-                               /* check for underflow  */
-       if (e1->exp < EXT_MIN)  {
-               trap(EFUNFL);
-               e1->exp = EXT_MIN;
-               goto infinity;
-       }
-}
diff --git a/lib/ack/libfp/ngf4.fc b/lib/ack/libfp/ngf4.fc
deleted file mode 100644 (file)
index 9f1f812..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-               NEGATE A FLOATING POINT (NGF 4)
-*/
-/********************************************************/
-
-#include "FP_types.h"
-#include "get_put.h"
-
-#define OFF ((FL_MSW_AT_LOW_ADDRESS ? 0 : 2) + (FL_MSB_AT_LOW_ADDRESS ? 0 : 1))
-void
-ngf4(f)
-SINGLE f;
-{
-       unsigned char *p;
-
-       if (f != (SINGLE) 0) {
-               p = (unsigned char *) &f + OFF;
-               *p ^= 0x80;
-       }
-}
diff --git a/lib/ack/libfp/ngf8.fc b/lib/ack/libfp/ngf8.fc
deleted file mode 100644 (file)
index 473ffa5..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-               NEGATE A FLOATING POINT (NGF 8)
-*/
-/********************************************************/
-
-#include "FP_types.h"
-#include "get_put.h"
-
-#define OFF ((FL_MSL_AT_LOW_ADDRESS ? 0 : 4) + (FL_MSW_AT_LOW_ADDRESS ? 0 : 2) + (FL_MSB_AT_LOW_ADDRESS ? 0 : 1))
-
-void
-ngf8(f)
-DOUBLE f;
-{
-       unsigned char   *p;
-
-       if (f.d[0] != 0 || f.d[1] != 0) {
-               p = (unsigned char *) &f + OFF;
-               *p ^= 0x80;
-       }
-}
diff --git a/lib/ack/libfp/nrm_ext.fc b/lib/ack/libfp/nrm_ext.fc
deleted file mode 100644 (file)
index dc83554..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/********************************************************/
-/*
-       NORMALIZE an EXTENDED FORMAT NUMBER
-*/
-/********************************************************/
-
-#include "FP_shift.h"
-#include "FP_types.h"
-
-void
-nrm_ext(e1)
-EXTEND *e1;
-{
-               /* we assume that the mantissa != 0     */
-               /* if it is then just return            */
-               /* to let it be a problem elsewhere     */
-               /* THAT IS, The exponent is not set to  */
-               /* zero. If we don't test here an       */
-               /* infinite loop is generated when      */
-               /* mantissa is zero                     */
-
-       if ((e1->m1 | e1->m2) == 0L)
-               return;
-
-               /* if top word is zero mov low word     */
-               /* to top word, adjust exponent value   */
-       if (e1->m1 == 0L)       {
-               e1->m1 = e1->m2;
-               e1->m2 = 0L;
-               e1->exp -= 32;
-       }
-       if ((e1->m1 & NORMBIT) == 0) {
-               unsigned long l = ((unsigned long)NORMBIT >> 1);
-               int cnt = -1;
-
-               while (! (l & e1->m1)) {
-                       l >>= 1;
-                       cnt--;
-               }
-               e1->exp += cnt;
-               b64_sft(&(e1->mantissa), cnt);
-       }
-}
diff --git a/lib/ack/libfp/sbf4.fc b/lib/ack/libfp/sbf4.fc
deleted file mode 100644 (file)
index 368c111..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       SUBTRACT TWO FLOATS - SINGLE Precision (SBF 4)
-*/
-
-#include       "FP_types.h"
-
-void
-sbf4(s2,s1)
-SINGLE s1,s2;
-{
-       EXTEND e1,e2;
-
-       if (s2 == (SINGLE) 0) {
-               return;
-       }
-       extend(&s1,&e1,sizeof(SINGLE));
-       extend(&s2,&e2,sizeof(SINGLE));
-       sub_ext(&e1,&e2);
-       compact(&e1,&s1,sizeof(SINGLE));
-}
diff --git a/lib/ack/libfp/sbf8.fc b/lib/ack/libfp/sbf8.fc
deleted file mode 100644 (file)
index 9d4c106..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       SUBTRACT TWO FLOATS - DOUBLE Precision (SBF 8)
-*/
-
-#include       "FP_types.h"
-
-void
-sbf8(s2,s1)
-DOUBLE s1,s2;
-{
-       EXTEND e1, e2;
-
-       if (s2.d[0] == 0 && s2.d[1] == 0) {
-               return;
-       }
-       extend(&s1.d[0],&e1,sizeof(DOUBLE));
-       extend(&s2.d[0],&e2,sizeof(DOUBLE));
-       sub_ext(&e1,&e2);
-       compact(&e1,&s1.d[0],sizeof(DOUBLE));
-}
diff --git a/lib/ack/libfp/sft_ext.fc b/lib/ack/libfp/sft_ext.fc
deleted file mode 100644 (file)
index a933f9d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       SHIFT TWO EXTENDED NUMBERS INTO PROPER
-       ALIGNMENT FOR ADDITION (exponents are equal)
-       Numbers should not be zero on entry.
-*/
-
-#include "FP_types.h"
-
-void
-sft_ext(e1,e2)
-EXTEND *e1,*e2;
-{
-       register        EXTEND  *s;
-       register        int     diff;
-
-       diff = e1->exp - e2->exp;
-
-       if (!diff)
-               return; /* exponents are equal  */
-
-       if (diff < 0)   { /* e2 is larger       */
-                       /* shift e1             */
-               diff = -diff;
-               s = e1;
-       }
-       else            /* e1 is larger         */
-                       /* shift e2             */
-               s = e2;
-
-       s->exp += diff;
-       b64_sft(&(s->mantissa), diff);
-}
diff --git a/lib/ack/libfp/shifter.fc b/lib/ack/libfp/shifter.fc
deleted file mode 100644 (file)
index 089da20..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-# include "FP_types.h"
-
-void
-b64_sft(e1,n)
-B64    *e1;
-int    n;
-{
-       if (n > 0) {
-               if (n > 63) {
-                       e1->l_32 = 0;
-                       e1->h_32 = 0;
-                       return;
-               }
-               if (n >= 32) {
-                       e1->l_32 = e1->h_32;
-                       e1->h_32 = 0;
-                       n -= 32;
-               }
-               if (n > 0) {
-                       e1->l_32 >>= n;
-                       if (e1->h_32 != 0) {
-                               e1->l_32 |= (e1->h_32 << (32 - n));
-                               e1->h_32 >>= n;
-                       }
-               }
-               return;
-       }
-       n = -n;
-       if (n > 0) {
-               if (n > 63) {
-                       e1->l_32 = 0;
-                       e1->h_32 = 0;
-                       return;
-               }
-               if (n >= 32) {
-                       e1->h_32 = e1->l_32;
-                       e1->l_32 = 0;
-                       n -= 32;
-               }
-               if (n > 0) {
-                       e1->h_32 <<= n;
-                       if (e1->l_32 != 0) {
-                               e1->h_32 |= (e1->l_32 >> (32 - n));
-                               e1->l_32 <<= n;
-                       }
-               }
-       }
-}
-
-void
-b64_lsft(e1)
-B64    *e1;
-{
-       /*      shift left 1 bit */
-       e1->h_32 <<= 1;
-       if (e1->l_32 & 0x80000000L) e1->h_32 |= 1;
-       e1->l_32 <<= 1;
-}
-
-void
-b64_rsft(e1)
-B64    *e1;
-{
-       /*      shift right 1 bit */
-       e1->l_32 >>= 1;
-       if (e1->h_32 & 1) e1->l_32 |= 0x80000000L;
-       e1->h_32 >>= 1;
-}
diff --git a/lib/ack/libfp/sub_ext.fc b/lib/ack/libfp/sub_ext.fc
deleted file mode 100644 (file)
index 64180aa..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       SUBTRACT 2 EXTENDED FORMAT NUMBERS
-*/
-
-#include "FP_types.h"
-
-void
-sub_ext(e1,e2)
-EXTEND *e1,*e2;
-{
-       if ((e2->m1 | e2->m2) == 0L) {
-               return;
-       }
-       if ((e1->m1 | e1->m2) == 0L) {
-               *e1 = *e2;
-               e1->sign = e2->sign ? 0 : 1;
-               return;
-       }
-       sft_ext(e1, e2);
-       if (e1->sign != e2->sign) {
-               /* e1 - e2 = e1 + (-e2) */
-               if (b64_add(&e1->mantissa,&e2->mantissa)) { /* addition carry */
-                       b64_rsft(&e1->mantissa);      /* shift mantissa one bit RIGHT */
-                       e1->m1 |= 0x80000000L;  /* set max bit  */
-                       e1->exp++;              /* increase the exponent */
-               }
-       }
-        else if (e2->m1 > e1->m1 ||
-                 (e2->m1 == e1->m1 && e2->m2 > e1->m2)) {
-               /*      abs(e2) > abs(e1) */
-               if (e1->m2 > e2->m2) {
-                       e2->m1 -= 1;    /* carry in */
-               }
-               e2->m1 -= e1->m1;
-               e2->m2 -= e1->m2;
-               *e1 = *e2;
-               e1->sign = e2->sign ? 0 : 1;
-       }
-       else {
-               if (e2->m2 > e1->m2)
-                       e1->m1 -= 1;    /* carry in */
-               e1->m1 -= e2->m1;
-               e1->m2 -= e2->m2;
-       }
-       nrm_ext(e1);
-}
diff --git a/lib/ack/libfp/zrf4.fc b/lib/ack/libfp/zrf4.fc
deleted file mode 100644 (file)
index a913e81..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       return a zero float (ZRF 4)
-*/
-
-#include "FP_types.h"
-
-void
-zrf4(l)
-SINGLE *l;
-{
-       *l = 0L;
-}
diff --git a/lib/ack/libfp/zrf8.fc b/lib/ack/libfp/zrf8.fc
deleted file mode 100644 (file)
index 4fcdbb8..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       return a zero double (ZRF 8)
-*/
-
-#include "FP_types.h"
-
-void
-zrf8(z)
-DOUBLE *z;
-{
-
-       z->d[0] = 0L;
-       z->d[1] = 0L;
-}
diff --git a/lib/ack/libfp/zrf_ext.fc b/lib/ack/libfp/zrf_ext.fc
deleted file mode 100644 (file)
index 8f58789..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-  (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* $Header$ */
-
-/*
-       ZERO and return EXTEND FORMAT FLOAT
-*/
-
-#include "FP_types.h"
-
-void
-zrf_ext(e)
-EXTEND *e;
-{
-       e->m1 = 0;
-       e->m2 = 0;
-       e->exp = 0;
-       e->sign = 0;
-}
diff --git a/lib/ack/liby/Makefile b/lib/ack/liby/Makefile
deleted file mode 100644 (file)
index 2f42f61..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# Makefile for liby
-
-LIB=   y
-
-SRCS=  \
-       main.c \
-       yyerror.c
-
-.include <bsd.lib.mk>
diff --git a/lib/ack/liby/main.c b/lib/ack/liby/main.c
deleted file mode 100644 (file)
index bd50419..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * Copyright (c) 1990 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)main.c     5.3 (Berkeley) 1/13/91";
-#endif /* not lint */
-
-main()
-{
-       exit(yyparse());
-}
diff --git a/lib/ack/liby/yyerror.c b/lib/ack/liby/yyerror.c
deleted file mode 100644 (file)
index f20628e..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * Copyright (c) 1990 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)yyerror.c  5.2 (Berkeley) 5/15/90";
-#endif /* not lint */
-
-#include <stdio.h>
-
-yyerror(msg)
-char *msg;
-{
-       (void)fprintf(stderr, "%s\n", msg);
-       return(0);
-}
diff --git a/lib/ack_build.sh b/lib/ack_build.sh
deleted file mode 100755 (executable)
index 67946fe..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-set -e
-
-export CC=cc
-export MAKEOBJDIR=obj-ack
-
-make $@
diff --git a/lib/elf_build.sh b/lib/elf_build.sh
deleted file mode 100755 (executable)
index 2c0c18e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-set -e
-
-export CC=${CC:-clang}
-export COMPILER_TYPE=gnu
-export PATH=$PATH:/usr/pkg/bin
-
-export MAKEOBJDIR=obj-elfbase-nbsd NBSD_LIBC=yes
-make $@
index cdd3fea678f0c72f41bc16a4e12760e3af206edf..8154143f4b703c4eb2384db50b5bd9314edc63d7 100644 (file)
@@ -60,10 +60,6 @@ SRCS=        archive_check_magic.c \
                archive_write_set_format_zip.c \
                filter_fork.c
 
-.if ${COMPILER_TYPE} == "ack"
-SRCS+=  minix_utils.c
-.endif
-
 CPPFLAGS+= -DHAVE_CONFIG_H
 .if ${NBSD_LIBC} == "yes"
 INCSDIR= /usr/include
diff --git a/lib/libarchive/minix_utils.c b/lib/libarchive/minix_utils.c
deleted file mode 100644 (file)
index cc8baf3..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "minix_utils.h"
-
-#if !defined(__LONG_LONG_SUPPORTED)
-u64_t lshift64(u64_t x, unsigned short b)
-{
-       u64_t r;
-
-       if(b >= 32) {
-               r.lo = 0;
-               r.hi = x.lo << (b - 32);
-       }else {
-               r.lo = x.lo << b;
-               r.hi = (x.lo >> (32 - b)) | (x.hi << b);
-       }
-       return r;
-}
-#endif
similarity index 85%
rename from lib/nbsd_libasyn/Makefile
rename to lib/libasyn/Makefile
index 55567e7a721d9be36083f100e9867b59a6f89762..693c57763d568c1daed9f664a4c961ed9aea9049 100644 (file)
@@ -1,5 +1,4 @@
 .include <bsd.own.mk>
-.PATH:         ${MINIXSRCDIR}/lib/libc/asyn 
 LIB=   asyn
 INCS=  asynchio.h
 INCSDIR= /usr/include/sys
similarity index 100%
rename from lib/libc/asyn/asyn.h
rename to lib/libasyn/asyn.h
index ed791ed585070525fd0b2ad4d38c06bc8e22ac0d..32e67e7526c6807bca7957e4afd172b37343d293 100644 (file)
-# Makefile for libc
+#      $NetBSD: Makefile,v 1.143 2010/09/04 12:17:58 ahoka Exp $
+#      @(#)Makefile    8.2 (Berkeley) 2/3/94
+#
+# All library objects contain sccsid strings by default; they may be
+# excluded as a space-saving measure.  To produce a library that does
+# not contain these strings, delete -DLIBC_SCCS and -DSYSLIBC_SCCS
+# from CPPFLAGS below.  To remove these strings from just the system call
+# stubs, remove just -DSYSLIBC_SCCS from CPPFLAGS.
+#
+# The NLS (message catalog) functions are always in libc.  To choose that
+# strerror(), perror(), strsignal(), psignal(), etc. actually call the NLS
+# functions, put -DNLS on the CPPFLAGS line below.
+#
+# The YP functions are always in libc. To choose that getpwent() and friends
+# actually call the YP functions, put -DYP on the CPPFLAGS line below.
+#
+# The Hesiod functions are always in libc. To choose that getpwent() and friends
+# actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below.
 
+.if defined(__MINIX)
+.include "minix-config.inc"
+.endif
 .include "Makefile.inc"
 
 LIB=           c
+CPPFLAGS+=     -I${.CURDIR}/include -I${.CURDIR}
+
+LIBCDIR=       ${.CURDIR}
+
+.if exists (${ARCHDIR}/Makefile.inc)
+.PATH: ${ARCHDIR}
+.include "${ARCHDIR}/Makefile.inc"
+.endif
 
-.include "${.CURDIR}/ansi/Makefile.inc"
-.include "${.CURDIR}/asyn/Makefile.inc"
+.if exists (${ARCHDIR}/genassym.cf)
+DPSRCS+=       assym.h
+CLEANFILES+=   assym.h assym.h.tmp
+
+assym.h: ${ARCHDIR}/genassym.cf
+       ${_MKTARGET_CREATE}
+       ${TOOL_GENASSYM} -- ${CC} ${CFLAGS} \
+               ${CPPFLAGS} ${CPPFLAGS.assym.h} ${PROF} \
+               < ${ARCHDIR}/genassym.cf > assym.h.tmp && \
+       mv -f assym.h.tmp assym.h
+.endif
+
+# The following controls how to build compatibility code for old NetBSD
+# binaries. If BUILDCOLD is yes, then we build a separate library; otherwise
+# we include the code in libc.
+BUILDCOLD?= no
+.if "${BUILDCOLD}" == "yes"
+SUBDIR=compat
+.include <bsd.subdir.mk>
+.else
+COMPATDIR= ${.CURDIR}/compat-minix
+.include "${.CURDIR}/compat-minix/Makefile.inc"
+.endif
+
+.include "${.CURDIR}/../../common/lib/libc/Makefile.inc"
+.include "${.CURDIR}/atomic/Makefile.inc"
+.include "${.CURDIR}/cdb/Makefile.inc"
 .include "${.CURDIR}/db/Makefile.inc"
-.include "${.CURDIR}/ip/Makefile.inc"
-.include "${.CURDIR}/math/Makefile.inc"
-.include "${.CURDIR}/other/Makefile.inc"
-.include "${.CURDIR}/posix/Makefile.inc"
+.if (${CITRUS} == "yes")
+.include "${.CURDIR}/citrus/Makefile.inc"
+.endif
+.include "${.CURDIR}/compat-43/Makefile.inc"
+.include "${.CURDIR}/dlfcn/Makefile.inc"
+.include "${.CURDIR}/gdtoa/Makefile.inc"
+.include "${.CURDIR}/gen/Makefile.inc"
+.if defined(__MINIX)
+# gmon needs profil()
+.else
+.include "${.CURDIR}/gmon/Makefile.inc"
+.endif
+.include "${.CURDIR}/hash/Makefile.inc"
+.include "${.CURDIR}/iconv/Makefile.inc"
+.include "${.CURDIR}/inet/Makefile.inc"
+.include "${.CURDIR}/isc/Makefile.inc"
+.include "${.CURDIR}/locale/Makefile.inc"
+.include "${.CURDIR}/md/Makefile.inc"
+.include "${.CURDIR}/misc/Makefile.inc"
+.include "${.CURDIR}/net/Makefile.inc"
+.include "${.CURDIR}/nameser/Makefile.inc"
+.include "${.CURDIR}/nls/Makefile.inc"
+.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
+.include "${.CURDIR}/quad/Makefile.inc"
+.endif
+.if (${USE_LIBTRE} == "yes")
+.include "${NETBSDSRCDIR}/external/bsd/tre/Makefile.inc"
+.else
 .include "${.CURDIR}/regex/Makefile.inc"
+.endif
+.include "${.CURDIR}/resolv/Makefile.inc"
+.if defined(__MINIX)
+# RPC needs pollts() and a reserved port allocator.
+.else
+.include "${.CURDIR}/rpc/Makefile.inc"
+.endif
+.include "${.CURDIR}/ssp/Makefile.inc"
 .include "${.CURDIR}/stdio/Makefile.inc"
-.include "${.CURDIR}/stdtime/Makefile.inc"
-.include "${.CURDIR}/syscall/Makefile.inc"
-.include "${.CURDIR}/sysvipc/Makefile.inc"
-.include "${.CURDIR}/wchar/Makefile.inc"
-
-.include "${.CURDIR}/arch/${ARCH}/misc/Makefile.inc"
-.include "${.CURDIR}/arch/${ARCH}/math/Makefile.inc"
-.include "${.CURDIR}/arch/${ARCH}/rts/Makefile.inc"
-.include "${.CURDIR}/arch/${ARCH}/string/Makefile.inc"
-
-.if ${COMPILER_TYPE} == "ack"
-.include "${.CURDIR}/ack/fphook/Makefile.inc"
-.include "${.CURDIR}/ack/math/Makefile.inc"
-.include "${.CURDIR}/ack/rts/Makefile.inc"
-.include "${.CURDIR}/arch/${ARCH}/int64/Makefile.inc"
-.elif ${COMPILER_TYPE} == "gnu"
-.include "${.CURDIR}/gnu/ieee_float/Makefile.inc"
-.include "${.CURDIR}/gnu/arch/${ARCH}/rts/Makefile.inc"
+.include "${.CURDIR}/stdlib/Makefile.inc"
+.include "${.CURDIR}/string/Makefile.inc"
+.include "${.CURDIR}/termios/Makefile.inc"
+.include "${.CURDIR}/thread-stub/Makefile.inc"
+.include "${.CURDIR}/time/Makefile.inc"
+.if defined(__MINIX)
+.include "${.CURDIR}/sys-minix/Makefile.inc"
+.else
+.include "${.CURDIR}/sys/Makefile.inc"
+.endif
+.include "${.CURDIR}/uuid/Makefile.inc"
+.if (${MKYP} != "no")
+.include "${.CURDIR}/yp/Makefile.inc"
+.endif
+
+# Remove from SRCS the .c files for any .S files added by the MD makefiles,
+# also remove from SRCS the .c files for the .S and .c files in NO_SRCS.
+# Add the .c file for .S files (in both variables) to LSRCS so that the
+# 'normal' .c file for assembly files is used for the lint librray.
+#
+# Usage:
+# Add .S files to NO_SRSC when another .S file provides the entry points.
+# Add .c files to NO_SRSC when another .c file provides the entry points.
+# (lint is run on all .c files in SRCS)
+
+.for check_file in ${SRCS:M*.S} ${NO_SRCS}
+unwanted_file := ${SRCS:M${check_file:.S=.c}}
+.if "${unwanted_file}" != ""
+SRCS := ${SRCS:N${unwanted_file}}
+.if "${unwanted_file}" != "${check_file}"
+LSRCS := ${LSRCS} ${unwanted_file}
+.endif
+.endif
+.endfor
+
+NLS=   C.msg Pig.msg ca.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg \
+       no.msg pl.msg sk.msg sv.msg
+
+.if defined(__MINIX)
+realall: 
+.else
+realall: tags
+.endif
+tags: ${.OBJDIR}/tags
+${.OBJDIR}/tags: ${SRCS}
+       ${_MKTARGET_CREATE}
+       -${TOOL_CTAGS} -w ${.ALLSRC:M*.c}
+       -egrep "^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" /dev/null ${.ALLSRC:M*.S} | \
+           sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
+           >> ${.TARGET}; sort -o ${.TARGET} ${.TARGET}
+
+.if !defined(__MINIX)
+FILES=         ${.OBJDIR}/tags
+FILESNAME=     libc.tags
+FILESDIR=      /var/db
+.endif
+
+
+# workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
+# multibyte for libc.so.  the quirk should be removed when we support
+# dlopen() from within statically linked binaries.
+.if (${CITRUS} == "yes")
+CSHLIBFLAGS+=  -D_I18N_DYNAMIC
 .endif
 
 .include <bsd.lib.mk>
+
+# force the dynamic linker to initialize libc first
+SHLIB_SHFLAGS+=        -Wl,-z,initfirst
+
+.include <bsd.own.mk>
+SUBDIR+= pkgconfig
+.include <bsd.subdir.mk>
+
index 4df075ad98ea041879f4538dd5825cafdfde0810..0b2facf8ea3f453167790374b836c8856553e922 100644 (file)
@@ -1 +1,72 @@
+#      $NetBSD: Makefile.inc,v 1.6 2010/05/30 08:28:53 tnozaki Exp $
+#      @(#)Makefile    8.2 (Berkeley) 2/3/94
+#
+# All library objects contain sccsid strings by default; they may be
+# excluded as a space-saving measure.  To produce a library that does
+# not contain these strings, delete -DLIBC_SCCS and -DSYSLIBC_SCCS
+# from CPPFLAGS below.  To remove these strings from just the system call
+# stubs, remove just -DSYSLIBC_SCCS from CPPFLAGS.
+#
+# The NLS (message catalog) functions are always in libc.  To choose that
+# strerror(), perror(), strsignal(), psignal(), etc. actually call the NLS
+# functions, put -DNLS on the CPPFLAGS line below.
+#
+# The YP functions are always in libc. To choose that getpwent() and friends
+# actually call the YP functions, put -DYP on the CPPFLAGS line below.
+#
+# The Hesiod functions are always in libc. To choose that getpwent() and friends
+# actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below.
+
+USE_FORT?=     yes
+
+.if defined(__MINIX)
+USE_SHLIBDIR= no
+.else
+USE_SHLIBDIR=  yes
+.endif
+
+CITRUS?=       yes
+
 .include <bsd.own.mk>
+
+WARNS=4
+.if defined(__MINIX)
+CPPFLAGS+=     -D_LIBC
+.else
+CPPFLAGS+=     -D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT
+.endif
+
+.if (${USE_HESIOD} != "no")
+CPPFLAGS+=     -DHESIOD
+.endif
+
+.if (${USE_INET6} != "no")
+CPPFLAGS+=     -DINET6
+.endif
+
+CPPFLAGS+=     -DNLS
+
+.if (${USE_YP} != "no")
+CPPFLAGS+=     -DYP
+.endif
+
+.if ${MACHINE_ARCH} == "i386"
+# Set lint to exit on warnings
+LINTFLAGS+=    -w
+.endif
+# ignore 'empty translation unit' warnings.
+LINTFLAGS+=    -X 272
+
+.include "libcincludes.mk"
+
+ARCHDIR=       ${.CURDIR}/arch/${ARCHSUBDIR}
+AFLAGS+=       -I${ARCHDIR}
+.if defined(DESTDIR)
+AFLAGS+=       -nostdinc -isystem ${DESTDIR}/usr/include
+.endif
+CLEANFILES+=   tags
+
+# Don't try to lint the C library against itself when creating llib-lc.ln
+LLIBS=
+
+INCSDIR=       /usr/include
diff --git a/lib/libc/ack/fphook/Makefile.inc b/lib/libc/ack/fphook/Makefile.inc
deleted file mode 100644 (file)
index 0a19f3b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# The ACK ANSI C compiler has an nice trick to reduce the size of programs
-# that do not use floating point.  If a program uses floating point then the
-# compiler generates an external reference to the label '_fp_hook'.  This makes
-# the loader bring in the floating point printing and conversion routines
-# '_f_print' and 'strtod' from the library libd.a.  Otherwise two dummy
-# routines are found in libc.a.  (The printf and scanf need floating point
-# for the %f formats, whether you use them or not.)
-
-# fphook sources
-.PATH: ${.CURDIR}/ack/fphook
-
-CPPFLAGS.fltpr.c+=-I${.CURDIR}/stdio
-
-SRCS+=fltpr.c strtod.c
diff --git a/lib/libc/ack/fphook/fltpr.c b/lib/libc/ack/fphook/fltpr.c
deleted file mode 100644 (file)
index 1972f3b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       "loc_incl.h"
-
-int _fp_hook = 1;
-
-char *
-_f_print(va_list *ap, int flags, char *s, char c, int precision)
-{
-       fprintf(stderr,"cannot print floating point\n");
-       exit(EXIT_FAILURE);
-}
diff --git a/lib/libc/ack/fphook/strtod.c b/lib/libc/ack/fphook/strtod.c
deleted file mode 100644 (file)
index 8f58baa..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include       <stdio.h>
-#include       <stdlib.h>
-
-double
-strtod(const char *p, char **pp)
-{
-       fprintf(stderr,"cannot print floating point\n");
-       exit(EXIT_FAILURE);
-}
diff --git a/lib/libc/ack/math/Makefile.inc b/lib/libc/ack/math/Makefile.inc
deleted file mode 100644 (file)
index 458e8de..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# math sources
-.PATH: ${.CURDIR}/ack/math
-
-SRCS+=  \
-       frexp.s \
-       modf.s \
-       isnan.c \
-       ldexp.c
diff --git a/lib/libc/ack/math/frexp.s b/lib/libc/ack/math/frexp.s
deleted file mode 100644 (file)
index 502caf7..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.extern _frexp
-.sect .text
-_frexp:
-#if __i386
-       push    ebp
-       mov     ebp, esp
-       push    12(ebp)
-       push    8(ebp)
-       mov     eax, esp
-       add     eax, -4
-       push    eax
-       call    .fef8
-       mov     eax, 16(ebp)
-       pop     (eax)
-       pop     eax
-       pop     edx
-       leave
-       ret
-#else /* i86 */
-       push    bp
-       mov     bp, sp
-       lea     bx, 4(bp)
-       mov     cx, #8
-       call    .loi
-       mov     ax, sp
-       add     ax, #-2
-       push    ax
-       call    .fef8
-       mov     bx, 12(bp)
-       pop     (bx)
-       call    .ret8
-       jmp     .cret
-#endif
diff --git a/lib/libc/ack/math/isnan.c b/lib/libc/ack/math/isnan.c
deleted file mode 100644 (file)
index 97257f4..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-int __IsNan(double d)
-{
-#if defined(vax) || defined(pdp)
-#else
-       float f = d;
-
-       if ((*((long *) &f) & 0x7f800000) == 0x7f800000 &&
-           (*((long *) &f) & 0x007fffff) != 0) return 1;
-#endif
-       return 0;
-}
diff --git a/lib/libc/ack/math/ldexp.c b/lib/libc/ack/math/ldexp.c
deleted file mode 100644 (file)
index a892dca..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <float.h>
-#include       <errno.h>
-
-double
-ldexp(double fl, int exp)
-{
-       int sign = 1;
-       int currexp;
-
-       if (isnan(fl)) {
-               errno = EDOM;
-               return fl;
-       }
-       if (fl == 0.0) return 0.0;
-       if (fl<0) {
-               fl = -fl;
-               sign = -1;
-       }
-       if (fl > DBL_MAX) {             /* for infinity */
-               errno = ERANGE;
-               return sign * fl;
-       }
-       fl = frexp(fl,&currexp);
-       exp += currexp;
-       if (exp > 0) {
-               if (exp > DBL_MAX_EXP) {
-                       errno = ERANGE;
-                       return sign * HUGE_VAL;
-               }
-               while (exp>30) {
-                       fl *= (double) (1L << 30);
-                       exp -= 30;
-               }
-               fl *= (double) (1L << exp);
-       }
-       else    {
-               /* number need not be normalized */
-               if (exp < DBL_MIN_EXP - DBL_MANT_DIG) {
-                       return 0.0;
-               }
-               while (exp<-30) {
-                       fl /= (double) (1L << 30);
-                       exp += 30;
-               }
-               fl /= (double) (1L << -exp);
-       }
-       return sign * fl;
-}
diff --git a/lib/libc/ack/math/modf.s b/lib/libc/ack/math/modf.s
deleted file mode 100644 (file)
index 5d1e39c..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-.sect .text; .sect .rom; .sect .data; .sect .bss
-.extern _modf
-.sect .text
-_modf:
-#if __i386
-       push    ebp
-       mov     ebp, esp
-       push    12(ebp)
-       push    8(ebp)
-       push    1
-       push    4
-       call    .cif8
-       mov     eax, esp
-       push    eax
-       call    .fif8
-       pop     ecx
-       mov     edx, 16(ebp)
-       pop     ecx
-       pop     ebx
-       mov     0(edx), ecx
-       mov     4(edx), ebx
-       pop     eax
-       pop     edx
-       leave
-       ret
-#else /* i86 */
-       push    bp
-       mov     bp, sp
-       lea     bx, 4(bp)
-       mov     cx, #8
-       call    .loi
-       mov     dx, #1
-       push    dx
-       push    dx
-       push    dx
-       mov     ax, #2
-       push    ax
-       call    .cif8
-       mov     ax, sp
-       push    ax
-       call    .fif8
-       pop     bx
-       mov     bx, 12(bp)
-       mov     cx, #8
-       call    .sti
-       call    .ret8
-       jmp     .cret
-#endif
diff --git a/lib/libc/ack/rts/Makefile.inc b/lib/libc/ack/rts/Makefile.inc
deleted file mode 100644 (file)
index 725dc83..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# rts sources
-.PATH: ${.CURDIR}/ack/rts
-
-SRCS+=setjmp.e
diff --git a/lib/libc/ack/rts/setjmp.e b/lib/libc/ack/rts/setjmp.e
deleted file mode 100644 (file)
index 7036e24..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-#
- mes 2,_EM_WSIZE,_EM_PSIZE
-;
-; layout of a setjmp buffer:
-;
-;  -----------------
-; |      flag       |          (!0 when blocked signals saved (POSIX))
-;  -----------------
-; | signal mask/set |          (for Berkeley 4.[2-] / POSIX)
-;  -----------------
-; |                 |
-; |  GTO descriptor |
-; |   (SP, LB, PC)  |
-; |                 |
-;  -----------------
-;
-; setjmp saves the signalmask, PC, SP, and LB of caller, and creates a
-; GTO descriptor from this.
-; The big problem here is how to get the return address, i.e. the PC of
-; the caller; This problem is solved by the front-end, which must pass
-; it as an extra parameter to setjmp.
-
-; a GTO descriptor must be in the global data area
-gtobuf
- bss 3*_EM_PSIZE,0,0
-
- inp $fill_ret_area
- exp $__setjmp
- pro $__setjmp,0
-#if    defined(_POSIX_SOURCE)
-; save mask of currently blocked signals. 
-; longjmp must restore this mask
- lol _EM_PSIZE                 ; the flag integer at offset _EM_PSIZE
- lal 0
- loi _EM_PSIZE
- stf 3*_EM_PSIZE+_EM_LSIZE
- lol _EM_PSIZE                 ; the flag integer at offset _EM_PSIZE
- zeq *1
- lal 0
- loi _EM_PSIZE
- adp 3*_EM_PSIZE
- cal $__newsigset
- asp _EM_PSIZE
-1
-#elif  defined(__BSD4_2)
- loc 0
- cal $sigblock
- asp _EM_WSIZE
- lfr _EM_WSIZE
- lal 0
- loi _EM_PSIZE
- stf 3*_EM_PSIZE
-#endif
-; create GTO descriptor for longjmp
- lxl 0
- dch           ; Local Base of caller
- lxa 0         ; Stackpointer of caller
- lal _EM_PSIZE+_EM_WSIZE
- loi _EM_PSIZE ; Return address of caller
- lal 0
- loi _EM_PSIZE ; address of jmpbuf
- sti 3*_EM_PSIZE       ; LB, SP, and PC stored in jmpbuf
- loc 0
- ret _EM_WSIZE ; setjmp must return 0
- end 0
-
- pro $fill_ret_area,0
-; put argument in function result area
- lol 0
- ret _EM_WSIZE
- end 0
-
- exp $longjmp
- pro $longjmp,?
-#if    defined(_POSIX_SOURCE)
-; restore blocked mask
- lal 0
- loi _EM_PSIZE
- lof 3*_EM_PSIZE+_EM_LSIZE
- zeq *2
- lal 0
- loi _EM_PSIZE
- adp 3*_EM_PSIZE
- cal $__oldsigset
- asp _EM_PSIZE
-2
-#elif  defined(__BSD4_2)
-; restore signal mask
- lal 0
- loi _EM_PSIZE
- lof 3*_EM_PSIZE
- cal $_sigsetmask
- asp _EM_WSIZE
- lfr _EM_WSIZE
- asp _EM_WSIZE
-#endif
- lal 0
- loi _EM_PSIZE ; address of jmpbuf
- lae gtobuf
- blm 3*_EM_PSIZE       ; fill GTO descriptor from jmpbuf
- lol _EM_PSIZE ; second parameter of longjmp: the return value
- dup _EM_WSIZE
- zne *3
-; of course, longjmp may not return 0!
- inc
-3
-; put return value in function result area
- cal $fill_ret_area
- asp _EM_WSIZE
- gto gtobuf    ; there we go ...
-; ASP and GTO do not damage function result area
- end 0
diff --git a/lib/libc/ansi/Makefile.inc b/lib/libc/ansi/Makefile.inc
deleted file mode 100644 (file)
index a0af253..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-# ansi sources
-.PATH: ${.CURDIR}/ansi
-
-SRCS+=  \
-       abort.c \
-       abs.c \
-       assert.c \
-       atexit.c \
-       atof.c \
-       atoi.c \
-       atol.c \
-       bsearch.c \
-       calloc.c \
-       chartab.c \
-       clock.c \
-       difftime.c \
-       div.c \
-       errlist.c \
-       exit.c \
-       ext_comp.c \
-       getenv.c \
-       isalnum.c \
-       isalpha.c \
-       isascii.c \
-       isblank.c \
-       iscntrl.c \
-       isdigit.c \
-       isgraph.c \
-       islower.c \
-       isprint.c \
-       ispunct.c \
-       isspace.c \
-       isupper.c \
-       isxdigit.c \
-       labs.c \
-       ldiv.c \
-       localeconv.c \
-       malloc.c \
-       malloc-debug.c \
-       mblen.c \
-       mbstowcs.c \
-       mbtowc.c \
-       misc.c \
-       qsort.c \
-       raise.c \
-       rand.c \
-       setlocale.c \
-       sigmisc.c \
-       signal.c \
-       strcoll.c \
-       strcspn.c \
-       strerror.c \
-       strpbrk.c \
-       strspn.c \
-       strstr.c \
-       strtok.c \
-       strtol.c \
-       strxfrm.c \
-       system.c \
-       tolower.c \
-       toupper.c \
-       wcstombs.c \
-       wctomb.c
diff --git a/lib/libc/ansi/abort.c b/lib/libc/ansi/abort.c
deleted file mode 100644 (file)
index 454d0e6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#if    defined(_POSIX_SOURCE)
-#include       <sys/types.h>
-#endif
-#include       <signal.h>
-#include       <stdlib.h>
-
-extern void (*_clean)(void);
-
-void
-abort(void)
-{
-       if (_clean) _clean();           /* flush all output files */
-       raise(SIGABRT);
-       exit(-1);
-       /* NORETURN */
-}
-
diff --git a/lib/libc/ansi/abs.c b/lib/libc/ansi/abs.c
deleted file mode 100644 (file)
index 63b893c..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-int
-abs(register int i)
-{
-       return i >= 0 ? i : -i;
-}
diff --git a/lib/libc/ansi/assert.c b/lib/libc/ansi/assert.c
deleted file mode 100644 (file)
index 3dab83b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * assert.c - diagnostics
- */
-/* $Header$ */
-
-#include       <assert.h>
-#include       <stdio.h>
-#include       <stdlib.h>
-
-void __bad_assertion(const char *mess) {
-
-       fputs(mess, stderr);
-       abort();
-}
diff --git a/lib/libc/ansi/atexit.c b/lib/libc/ansi/atexit.c
deleted file mode 100644 (file)
index 3f10bdb..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/* $Header$ */
-
-#include       <stdlib.h>
-
-#define        NEXITS  32
-
-extern void (*__functab[NEXITS])(void);
-extern int __funccnt;
-
-int
-atexit(void (*func)(void))
-{
-       if (__funccnt >= NEXITS)
-               return 1;
-       __functab[__funccnt++] = func;
-       return 0;
-}
diff --git a/lib/libc/ansi/atof.c b/lib/libc/ansi/atof.c
deleted file mode 100644 (file)
index e527b53..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-#include       <errno.h>
-
-double
-atof(const char *nptr)
-{
-       double d;
-       int e = errno;
-
-       d = strtod(nptr, (char **) NULL);
-       errno = e;
-       return d;
-}
diff --git a/lib/libc/ansi/atoi.c b/lib/libc/ansi/atoi.c
deleted file mode 100644 (file)
index ec829c7..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <ctype.h>
-#include       <stdlib.h>
-
-int
-atoi(register const char *nptr)
-{
-       return strtol(nptr, (char **) NULL, 10);
-}
diff --git a/lib/libc/ansi/atol.c b/lib/libc/ansi/atol.c
deleted file mode 100644 (file)
index 63235d9..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <ctype.h>
-#include       <stdlib.h>
-
-/* We do not use strtol here for backwards compatibility in behaviour on
-   overflow.
-*/
-long
-atol(register const char *nptr)
-{
-       long total = 0;
-       int minus = 0;
-
-       while (isspace(*nptr)) nptr++;
-       if (*nptr == '+') nptr++;
-       else if (*nptr == '-') {
-               minus = 1;
-               nptr++;
-       }
-       while (isdigit(*nptr)) {
-               total *= 10;
-               total += (*nptr++ - '0');
-       }
-       return minus ? -total : total;
-}
diff --git a/lib/libc/ansi/bsearch.c b/lib/libc/ansi/bsearch.c
deleted file mode 100644 (file)
index 88f3521..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-void *
-bsearch(register const void *key, register const void *base,
-       register size_t nmemb, register size_t size,
-       int (*compar)(const void *, const void *))
-{
-       register const void *mid_point;
-       register int  cmp;
-
-       while (nmemb > 0) {
-               mid_point = (char *)base + size * (nmemb >> 1);
-               if ((cmp = (*compar)(key, mid_point)) == 0)
-                       return (void *)mid_point;
-               if (cmp >= 0) {
-                       base  = (char *)mid_point + size;
-                       nmemb = (nmemb - 1) >> 1;
-               } else
-                       nmemb >>= 1;
-       }
-       return (void *)NULL;
-}
diff --git a/lib/libc/ansi/chartab.c b/lib/libc/ansi/chartab.c
deleted file mode 100644 (file)
index 334e041..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-#include       <ctype.h>
-
-char __ctype[] = {
-0,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C|_S,
-_C|_S,
-_C|_S,
-_C|_S,
-_C|_S,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_C,
-_S,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_N,
-_N,
-_N,
-_N,
-_N,
-_N,
-_N,
-_N,
-_N,
-_N,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_U|_X,
-_U|_X,
-_U|_X,
-_U|_X,
-_U|_X,
-_U|_X,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_U,
-_P,
-_P,
-_P,
-_P,
-_P,
-_P,
-_L|_X,
-_L|_X,
-_L|_X,
-_L|_X,
-_L|_X,
-_L|_X,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_L,
-_P,
-_P,
-_P,
-_P,
-_C,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-0,
-};
diff --git a/lib/libc/ansi/clock.c b/lib/libc/ansi/clock.c
deleted file mode 100644 (file)
index 049d512..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * clock - determine the processor time used
- */
-
-#define times _times
-#include <time.h>
-#include <sys/times.h>
-
-clock_t clock(void)
-{
-       struct tms tms;
-
-       times(&tms);
-       return tms.tms_utime;
-}
diff --git a/lib/libc/ansi/difftime.c b/lib/libc/ansi/difftime.c
deleted file mode 100644 (file)
index ed6e64c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * difftime - compute the difference between two calendar times
- */
-/* $Header$ */
-
-#include       <time.h>
-
-double
-difftime(time_t time1, time_t time0)
-{
-       /* be careful: time_t may be unsigned */
-       if ((time_t)-1 > 0 && time0 > time1) {
-               return - (double) (time0 - time1);
-       } else {
-               return (double)(time1 - time0);
-       }
-}
diff --git a/lib/libc/ansi/div.c b/lib/libc/ansi/div.c
deleted file mode 100644 (file)
index 79c35a3..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-static int tmp = -1;
-
-div_t
-div(register int numer, register int denom)
-{
-       div_t r;
-
-       /* The assignment of tmp should not be optimized !! */
-       if (tmp == -1) {
-               tmp = (tmp / 2 == 0);
-       }
-       if (numer == 0) {
-               r.quot = numer / denom;         /* might trap if denom == 0 */
-               r.rem = numer % denom;
-       } else if ( !tmp && ((numer < 0) != (denom < 0))) {
-               r.quot = (numer / denom) + 1;
-               r.rem = numer - (numer / denom + 1) * denom;
-       } else {
-               r.quot = numer / denom;
-               r.rem = numer % denom;
-       }
-       return r;
-}
diff --git a/lib/libc/ansi/errlist.c b/lib/libc/ansi/errlist.c
deleted file mode 100644 (file)
index 24377c6..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-static const char unknown[] = "Unknown error";
-
-const char *_sys_errlist[] = {
-        "Error 0",                     /* EGENERIC */
-        "Operation not permitted",     /* EPERM */
-        "No such file or directory",   /* ENOENT */
-        "No such process",             /* ESRCH */
-        "Interrupted system call",     /* EINTR */
-        "I/O error",                   /* EIO */
-        "No such device or address",   /* ENXIO */
-        "Arg list too long",           /* E2BIG */
-        "Exec format error",           /* ENOEXEC */
-        "Bad file number",             /* EBADF */
-        "No children",                 /* ECHILD */
-        "Resource temporarily unavailable",/* EAGAIN */
-        "Not enough core",             /* ENOMEM */
-        "Permission denied",           /* EACCES */
-        "Bad address",                 /* EFAULT */
-        "Block device required",       /* ENOTBLK */
-        "Resource busy",               /* EBUSY */
-        "File exists",                 /* EEXIST */
-        "Cross-device link",           /* EXDEV */
-        "No such device",              /* ENODEV */
-        "Not a directory",             /* ENOTDIR */
-        "Is a directory",              /* EISDIR */
-        "Invalid argument",            /* EINVAL */
-        "File table overflow",         /* ENFILE */
-        "Too many open files",         /* EMFILE */
-        "Not a typewriter",            /* ENOTTY */
-        "Text file busy",              /* ETXTBSY */
-        "File too large",              /* EFBIG */
-        "No space left on device",     /* ENOSPC */
-        "Illegal seek",                        /* ESPIPE */
-        "Read-only file system",       /* EROFS */
-        "Too many links",              /* EMLINK */
-        "Broken pipe",                 /* EPIPE */
-        "Math argument",               /* EDOM */
-        "Result too large",            /* ERANGE */
-       "Resource deadlock avoided",    /* EDEADLK */
-       "File name too long",           /* ENAMETOOLONG */
-       "No locks available",           /* ENOLCK */
-       "Function not implemented",     /* ENOSYS */
-       "Directory not empty",          /* ENOTEMPTY */
-       "Too many levels of symbolic links",    /* ELOOP */
-       "Service restarted",            /* ERESTART */
-       unknown,                        /* 42 */
-       "Identifier removed",           /* EIDRM */
-       "Illegal byte sequence",        /* EILSEQ */
-       "Wrong file format or type",    /* EFTYPE */
-       "Value too large to be stored in data type",    /* EOVERFLOW */
-       unknown,                        /* 47 */
-       unknown,                        /* 48 */
-       unknown,                        /* 49 */
-       "Invalid packet size",          /* EPACKSIZE */
-       "Not enough buffers left",      /* ENOBUFS */
-       "Illegal ioctl for device",     /* EBADIOCTL */
-       "Bad mode for ioctl",           /* EBADMODE */
-       "Would block",                  /* EWOULDBLOCK */
-       "Network unreachable",          /* ENETUNREACH */
-       "Host unreachable",             /* EHOSTUNREACH */
-       "Already connected",            /* EISCONN */
-       "Address in use",               /* EADDRINUSE */
-       "Connection refused",           /* ECONNREFUSED */
-       "Connection reset",             /* ECONNRESET */
-       "Connection timed out",         /* ETIMEDOUT */
-       "Urgent data present",          /* EURG */
-       "No urgent data present",       /* ENOURG */
-       "No connection",                /* ENOTCONN */
-       "Already shutdown",             /* ESHUTDOWN */
-       "No such connection",           /* ENOCONN */
-       "Address family not supported", /* EAFNOSUPPORT */
-       "Protocol not supported by AF", /* EPROTONOSUPPORT */
-       "Protocol wrong type for socket", /* EPROTOTYPE */
-       "Operation in progress",        /* EINPROGRESS */
-       "Address not available",        /* EADDRNOTAVAIL */
-       "Connection already in progress", /* EALREADY */
-       "Message too long",             /* EMSGSIZE */
-       "Socket operation on non-socket", /* ENOTSOCK */
-       "Protocol not available",       /* ENOPROTOOPT */
-       "Operation not supported",      /* EOPNOTSUPP */
-       "Network is down",              /* ENETDOWN */
-       "Protocol family not supported", /* EPFNOSUPPORT */
-       "Destination address required", /* EDESTADDRREQ */
-       "Host is down",                 /* EHOSTDOWN */
-};
-
-const int _sys_nerr = sizeof(_sys_errlist) / sizeof(_sys_errlist[0]);
diff --git a/lib/libc/ansi/exit.c b/lib/libc/ansi/exit.c
deleted file mode 100644 (file)
index a313e44..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdio.h>
-#include       <stdlib.h>
-
-#define        NEXITS  32
-
-void (*__functab[NEXITS])(void);
-int __funccnt = 0;
-
-extern __dead void _exit(int);
-
-/* only flush output buffers when necessary */
-int (*_clean)(void) = NULL;
-
-static void
-_calls(void)
-{
-       register int i = __funccnt;
-       
-       /* "Called in reversed order of their registration" */
-       while (--i >= 0)
-               (*__functab[i])();
-}
-
-__dead void
-exit(int status)
-{
-       _calls();
-       if (_clean) _clean();
-       _exit(status) ;
-}
diff --git a/lib/libc/ansi/ext_comp.c b/lib/libc/ansi/ext_comp.c
deleted file mode 100644 (file)
index 8404edb..0000000
+++ /dev/null
@@ -1,743 +0,0 @@
-/*
-  (c) copyright 1989 by the Vrije Universiteit, Amsterdam, The Netherlands.
-  See the copyright notice in the ACK home directory, in the file "Copyright".
-*/
-
-/* extended precision arithmetic for the strtod() and cvt() routines */
-
-/* This may require some more work when long doubles get bigger than 8
-   bytes. In this case, these routines may become obsolete. ???
-*/
-
-#include       "ext_fmt.h"
-#include       <float.h>
-#include       <errno.h>
-#include       <ctype.h>
-
-static int b64_add(struct mantissa *e1, struct mantissa *e2);
-static void b64_sft(struct mantissa *e1, int n);
-
-static void
-mul_ext(const struct EXTEND *e1, const struct EXTEND *e2, struct EXTEND *e3)
-{
-       /*      Multiply the extended numbers e1 and e2, and put the
-               result in e3.
-       */
-       register int    i,j;            /* loop control */
-       unsigned short  mp[4];
-       unsigned short  mc[4];
-       unsigned short  result[8];      /* result */
-
-       register unsigned short *pres;
-
-       /* first save the sign (XOR)                    */
-       e3->sign = e1->sign ^ e2->sign;
-
-       /* compute new exponent */
-       e3->exp = e1->exp + e2->exp + 1;
-
-       /* check for overflow/underflow ??? */
-
-       /* 128 bit multiply of mantissas        */
-
-       /* assign unknown long formats          */
-       /* to known unsigned word formats       */
-       mp[0] = e1->m1 >> 16;
-       mp[1] = (unsigned short) e1->m1;
-       mp[2] = e1->m2 >> 16;
-       mp[3] = (unsigned short) e1->m2;
-       mc[0] = e2->m1 >> 16;
-       mc[1] = (unsigned short) e2->m1;
-       mc[2] = e2->m2 >> 16;
-       mc[3] = (unsigned short) e2->m2;
-       for (i = 8; i--;) {
-               result[i] = 0;
-       }
-       /*
-        *      fill registers with their components
-        */
-       for(i=4, pres = &result[4];i--;pres--) if (mp[i]) {
-               unsigned short k = 0;
-               unsigned long mpi = mp[i];
-               for(j=4;j--;) {
-                       unsigned long tmp = (unsigned long)pres[j] + k;
-                       if (mc[j]) tmp += mpi * mc[j];
-                       pres[j] = tmp;
-                       k = tmp >> 16;
-               }
-               pres[-1] = k;
-       }
-
-       if (! (result[0] & 0x8000)) {
-               e3->exp--;
-               for (i = 0; i <= 3; i++) {
-                       result[i] <<= 1;
-                       if (result[i+1]&0x8000) result[i] |= 1;
-               }
-               result[4] <<= 1;
-       }       
-       /*
-        *      combine the registers to a total
-        */
-       e3->m1 = ((unsigned long)(result[0]) << 16) + result[1];
-       e3->m2 = ((unsigned long)(result[2]) << 16) + result[3];
-       if (result[4] & 0x8000) {
-               if (++e3->m2 == 0) {
-                       if (++e3->m1 == 0) {
-                               e3->m1 = 0x80000000;
-                               e3->exp++;
-                       }
-               }
-       }
-}
-
-static void
-add_ext(struct EXTEND *e1, struct EXTEND *e2, struct EXTEND *e3)
-{
-       /*      Add two extended numbers e1 and e2, and put the result
-               in e3
-       */
-       struct EXTEND ce2;
-       int diff;
-
-       if ((e2->m1 | e2->m2) == 0L) {
-               *e3 = *e1;
-               return;
-       }
-       if ((e1->m1 | e1->m2) == 0L) {
-               *e3 = *e2;
-               return;
-       }
-       ce2 = *e2;
-       *e3 = *e1;
-       e1 = &ce2;
-
-       /* adjust mantissas to equal power */
-       diff = e3->exp - e1->exp;
-       if (diff < 0) {
-               diff = -diff;
-               e3->exp += diff;
-               b64_sft(&(e3->mantissa), diff);
-       }
-       else if (diff > 0) {
-               e1->exp += diff;
-               b64_sft(&(e1->mantissa), diff);
-       }
-       if (e1->sign != e3->sign) {
-               /* e3 + e1 = e3 - (-e1) */
-               if (e1->m1 > e3->m1 ||
-                    (e1->m1 == e3->m1 && e1->m2 > e3->m2)) {
-                       /*      abs(e1) > abs(e3) */
-                       if (e3->m2 > e1->m2) {
-                               e1->m1 -= 1;    /* carry in */
-                       }
-                       e1->m1 -= e3->m1;
-                       e1->m2 -= e3->m2;
-                       *e3 = *e1;
-               }
-               else {
-                       if (e1->m2 > e3->m2)
-                               e3->m1 -= 1;    /* carry in */
-                       e3->m1 -= e1->m1;
-                       e3->m2 -= e1->m2;
-               }
-       }
-       else {
-               if (b64_add(&e3->mantissa,&e1->mantissa)) {/* addition carry */
-                       b64_sft(&e3->mantissa,1);/* shift mantissa one bit RIGHT */
-                       e3->m1 |= 0x80000000L;  /* set max bit  */
-                       e3->exp++;              /* increase the exponent */
-               }
-       }
-       if ((e3->m2 | e3->m1) != 0L) {
-               /* normalize */
-               if (e3->m1 == 0L) {
-                       e3->m1 = e3->m2; e3->m2 = 0L; e3->exp -= 32;
-               }
-               if (!(e3->m1 & 0x80000000)) {
-                       unsigned long l = 0x40000000;
-                       int cnt = -1;
-
-                       while (! (l & e3->m1)) {
-                               l >>= 1; cnt--;
-                       }
-                       e3->exp += cnt;
-                       b64_sft(&(e3->mantissa), cnt);
-               }
-       }
-}
-
-static int
-cmp_ext(struct EXTEND *e1, struct EXTEND *e2)
-{
-        struct EXTEND tmp; 
-         
-        e2->sign = ! e2->sign; 
-        add_ext(e1, e2, &tmp);  
-        e2->sign = ! e2->sign;
-        if (tmp.m1 == 0 && tmp.m2 == 0) return 0; 
-        if (tmp.sign) return -1;
-        return 1;
-}
-
-static void
-b64_sft(struct mantissa *e1, int n)
-{
-       if (n > 0) {
-               if (n > 63) {
-                       e1->l_32 = 0;
-                       e1->h_32 = 0;
-                       return;
-               }
-               if (n >= 32) {
-                       e1->l_32 = e1->h_32;
-                       e1->h_32 = 0;
-                       n -= 32;
-               }
-               if (n > 0) {
-                       e1->l_32 >>= n;
-                       if (e1->h_32 != 0) {
-                               e1->l_32 |= (e1->h_32 << (32 - n));
-                               e1->h_32 >>= n;
-                       }
-               }
-               return;
-       }
-       n = -n;
-       if (n > 0) {
-               if (n > 63) {
-                       e1->l_32 = 0;
-                       e1->h_32 = 0;
-                       return;
-               }
-               if (n >= 32) {
-                       e1->h_32 = e1->l_32;
-                       e1->l_32 = 0;
-                       n -= 32;
-               }
-               if (n > 0) {
-                       e1->h_32 <<= n;
-                       if (e1->l_32 != 0) {
-                               e1->h_32 |= (e1->l_32 >> (32 - n));
-                               e1->l_32 <<= n;
-                       }
-               }
-       }
-}
-
-static int
-b64_add(struct mantissa *e1, struct mantissa *e2)
-               /*
-                * pointers to 64 bit 'registers'
-                */
-{
-       register int    overflow;
-       int             carry;
-
-                       /* add higher pair of 32 bits */
-       overflow = ((unsigned long) 0xFFFFFFFF - e1->h_32 < e2->h_32);
-       e1->h_32 += e2->h_32;
-
-                       /* add lower pair of 32 bits */
-       carry = ((unsigned long) 0xFFFFFFFF - e1->l_32 < e2->l_32);
-       e1->l_32 += e2->l_32;
-       if ((carry) && (++e1->h_32 == 0))
-               return(1);              /* had a 64 bit overflow */
-       else
-               return(overflow);       /* return status from higher add */
-}
-
-/* The following tables can be computed with the following bc(1)
-   program:
-
-obase=16
-scale=0
-define t(x){
-       auto a, b, c
-       a=2;b=1;c=2^32;n=1
-       while(a<x) {
-               b=a;n+=n;a*=a
-       }
-       n/=2
-       a=b
-       while(b<x) {
-               a=b;b*=c;n+=32
-       }
-       n-=32
-       b=a
-       while(a<x) {
-               b=a;a+=a;n+=1
-       }
-       n-=1
-       x*=16^16
-       b=x%a
-       x/=a
-       if(a<=(2*b)) x+=1
-       obase=10
-       n
-       obase=16
-       return(x)
-}
-for (i=1;i<28;i++) {
-       t(10^i)
-}
-0
-for (i=1;i<20;i++) {
-       t(10^(28*i))
-}
-0
-define r(x){
-       auto a, b, c
-       a=2;b=1;c=2^32;n=1
-       while(a<x) {
-               b=a;n+=n;a*=a
-       }
-       n/=2
-       a=b
-       while(b<x) {
-               a=b;b*=c;n+=32
-       }
-       n-=32
-       b=a
-       while(a<x) {
-               b=a;a+=a;n+=1
-       }
-       a=b
-       a*=16^16
-       b=a%x
-       a/=x
-       if(x<=(2*b)) a+=1
-       obase=10
-       -n
-       obase=16
-       return(a)
-}
-for (i=1;i<28;i++) {
-       r(10^i)
-}
-0
-for (i=1;i<20;i++) {
-       r(10^(28*i))
-}
-0
-
-*/
-static struct EXTEND ten_powers[] = {  /* representation of 10 ** i */
-       { 0,    0,      { 0x80000000,   0 } },
-       { 0,    3,      { 0xA0000000,   0 } },
-       { 0,    6,      { 0xC8000000,   0 } },
-       { 0,    9,      { 0xFA000000,   0 } },
-       { 0,    13,     { 0x9C400000,   0 } },
-       { 0,    16,     { 0xC3500000,   0 } },
-       { 0,    19,     { 0xF4240000,   0 } },
-       { 0,    23,     { 0x98968000,   0 } },
-       { 0,    26,     { 0xBEBC2000,   0 } },
-       { 0,    29,     { 0xEE6B2800,   0 } },
-       { 0,    33,     { 0x9502F900,   0 } },
-       { 0,    36,     { 0xBA43B740,   0 } },
-       { 0,    39,     { 0xE8D4A510,   0 } },
-       { 0,    43,     { 0x9184E72A,   0 } },
-       { 0,    46,     { 0xB5E620F4,   0x80000000 } },
-       { 0,    49,     { 0xE35FA931,   0xA0000000 } },
-       { 0,    53,     { 0x8E1BC9BF,   0x04000000 } },
-       { 0,    56,     { 0xB1A2BC2E,   0xC5000000 } },
-       { 0,    59,     { 0xDE0B6B3A,   0x76400000 } },
-       { 0,    63,     { 0x8AC72304,   0x89E80000 } },
-       { 0,    66,     { 0xAD78EBC5,   0xAC620000 } },
-       { 0,    69,     { 0xD8D726B7,   0x177A8000 } },
-       { 0,    73,     { 0x87867832,   0x6EAC9000 } },
-       { 0,    76,     { 0xA968163F,   0x0A57B400 } },
-       { 0,    79,     { 0xD3C21BCE,   0xCCEDA100 } },
-       { 0,    83,     { 0x84595161,   0x401484A0 } },
-       { 0,    86,     { 0xA56FA5B9,   0x9019A5C8 } },
-       { 0,    89,     { 0xCECB8F27,   0xF4200F3A } }
-};
-
-static struct EXTEND big_ten_powers[] = {  /* representation of 10 ** (28*i) */
-       { 0,    0,      { 0x80000000,   0 } },
-       { 0,    93,     { 0x813F3978,   0xF8940984 } },
-       { 0,    186,    { 0x82818F12,   0x81ED44A0 } },
-       { 0,    279,    { 0x83C7088E,   0x1AAB65DB } },
-       { 0,    372,    { 0x850FADC0,   0x9923329E } },
-       { 0,    465,    { 0x865B8692,   0x5B9BC5C2 } },
-       { 0,    558,    { 0x87AA9AFF,   0x79042287 } },
-       { 0,    651,    { 0x88FCF317,   0xF22241E2 } },
-       { 0,    744,    { 0x8A5296FF,   0xE33CC930 } },
-       { 0,    837,    { 0x8BAB8EEF,   0xB6409C1A } },
-       { 0,    930,    { 0x8D07E334,   0x55637EB3 } },
-       { 0,    1023,   { 0x8E679C2F,   0x5E44FF8F } },
-       { 0,    1116,   { 0x8FCAC257,   0x558EE4E6 } },
-       { 0,    1209,   { 0x91315E37,   0xDB165AA9 } },
-       { 0,    1302,   { 0x929B7871,   0xDE7F22B9 } },
-       { 0,    1395,   { 0x940919BB,   0xD4620B6D } },
-       { 0,    1488,   { 0x957A4AE1,   0xEBF7F3D4 } },
-       { 0,    1581,   { 0x96EF14C6,   0x454AA840 } },
-       { 0,    1674,   { 0x98678061,   0x27ECE4F5 } },
-       { 0,    1767,   { 0x99E396C1,   0x3A3ACFF2 } }
-};
-
-static struct EXTEND r_ten_powers[] = { /* representation of 10 ** -i */
-       { 0,    0,      { 0x80000000,   0 } },
-       { 0,    -4,     { 0xCCCCCCCC,   0xCCCCCCCD } },
-       { 0,    -7,     { 0xA3D70A3D,   0x70A3D70A } },
-       { 0,    -10,    { 0x83126E97,   0x8D4FDF3B } },
-       { 0,    -14,    { 0xD1B71758,   0xE219652C } },
-       { 0,    -17,    { 0xA7C5AC47,   0x1B478423 } },
-       { 0,    -20,    { 0x8637BD05,   0xAF6C69B6 } },
-       { 0,    -24,    { 0xD6BF94D5,   0xE57A42BC } },
-       { 0,    -27,    { 0xABCC7711,   0x8461CEFD } },
-       { 0,    -30,    { 0x89705F41,   0x36B4A597 } },
-       { 0,    -34,    { 0xDBE6FECE,   0xBDEDD5BF } },
-       { 0,    -37,    { 0xAFEBFF0B,   0xCB24AAFF } },
-       { 0,    -40,    { 0x8CBCCC09,   0x6F5088CC } },
-       { 0,    -44,    { 0xE12E1342,   0x4BB40E13 } },
-       { 0,    -47,    { 0xB424DC35,   0x095CD80F } },
-       { 0,    -50,    { 0x901D7CF7,   0x3AB0ACD9 } },
-       { 0,    -54,    { 0xE69594BE,   0xC44DE15B } },
-       { 0,    -57,    { 0xB877AA32,   0x36A4B449 } },
-       { 0,    -60,    { 0x9392EE8E,   0x921D5D07 } },
-       { 0,    -64,    { 0xEC1E4A7D,   0xB69561A5 } },
-       { 0,    -67,    { 0xBCE50864,   0x92111AEB } },
-       { 0,    -70,    { 0x971DA050,   0x74DA7BEF } },
-       { 0,    -74,    { 0xF1C90080,   0xBAF72CB1 } },
-       { 0,    -77,    { 0xC16D9A00,   0x95928A27 } },
-       { 0,    -80,    { 0x9ABE14CD,   0x44753B53 } },
-       { 0,    -84,    { 0xF79687AE,   0xD3EEC551 } },
-       { 0,    -87,    { 0xC6120625,   0x76589DDB } },
-       { 0,    -90,    { 0x9E74D1B7,   0x91E07E48 } }
-};
-
-static struct EXTEND r_big_ten_powers[] = { /* representation of 10 ** -(28*i) */
-       { 0,    0,       { 0x80000000,  0 } },
-       { 0,    -94,     { 0xFD87B5F2,  0x8300CA0E } },
-       { 0,    -187,    { 0xFB158592,  0xBE068D2F } },
-       { 0,    -280,    { 0xF8A95FCF,  0x88747D94 } },
-       { 0,    -373,    { 0xF64335BC,  0xF065D37D } },
-       { 0,    -466,    { 0xF3E2F893,  0xDEC3F126 } },
-       { 0,    -559,    { 0xF18899B1,  0xBC3F8CA2 } },
-       { 0,    -652,    { 0xEF340A98,  0x172AACE5 } },
-       { 0,    -745,    { 0xECE53CEC,  0x4A314EBE } },
-       { 0,    -838,    { 0xEA9C2277,  0x23EE8BCB } },
-       { 0,    -931,    { 0xE858AD24,  0x8F5C22CA } },
-       { 0,    -1024,   { 0xE61ACF03,  0x3D1A45DF } },
-       { 0,    -1117,   { 0xE3E27A44,  0x4D8D98B8 } },
-       { 0,    -1210,   { 0xE1AFA13A,  0xFBD14D6E } },
-       { 0,    -1303,   { 0xDF82365C,  0x497B5454 } },
-       { 0,    -1396,   { 0xDD5A2C3E,  0xAB3097CC } },
-       { 0,    -1489,   { 0xDB377599,  0xB6074245 } },
-       { 0,    -1582,   { 0xD91A0545,  0xCDB51186 } },
-       { 0,    -1675,   { 0xD701CE3B,  0xD387BF48 } },
-       { 0,    -1768,   { 0xD4EEC394,  0xD6258BF8 } }
-};
-
-#define        TP      (int)(sizeof(ten_powers)/sizeof(ten_powers[0]))
-#define BTP    (int)(sizeof(big_ten_powers)/sizeof(big_ten_powers[0]))
-#define MAX_EXP        (TP * BTP - 1)
-
-static void
-add_exponent(struct EXTEND *e, int exp)
-{
-       int neg = exp < 0;
-       int divsz, modsz;
-       struct EXTEND x;
-
-       if (neg) exp = -exp;
-       divsz = exp / TP;
-       modsz = exp % TP;
-       if (neg) {
-               mul_ext(e, &r_ten_powers[modsz], &x);
-               mul_ext(&x, &r_big_ten_powers[divsz], e);
-       }
-       else {
-               mul_ext(e, &ten_powers[modsz], &x);
-               mul_ext(&x, &big_ten_powers[divsz], e);
-       }
-}
-
-void _str_ext_cvt(const char *s, char **ss, struct EXTEND *e)
-{
-       /*      Like strtod, but for extended precision */
-       register int    c;
-       int             dotseen = 0;
-       int             digitseen = 0;
-       int             exp = 0;
-
-       if (ss) *ss = (char *)s;
-       while (isspace((unsigned char) *s)) s++;
-
-       e->sign = 0;
-       e->exp = 0;
-       e->m1 = e->m2 = 0;
-
-       c = *s;
-       switch(c) {
-       case '-':
-               e->sign = 1;
-       case '+':
-               s++;
-       }
-       while (c = *s++, isdigit(c) || (c == '.' && ! dotseen++)) {
-               if (c == '.') continue;
-               digitseen = 1;
-               if (e->m1 <= (unsigned long)(0xFFFFFFFF)/10) {
-                       struct mantissa a1;
-
-                       a1 = e->mantissa;
-                       b64_sft(&(e->mantissa), -3);
-                       b64_sft(&a1, -1);
-                       b64_add(&(e->mantissa), &a1);
-                       a1.h_32 = 0;
-                       a1.l_32 = c - '0';
-                       b64_add(&(e->mantissa), &a1);
-               }
-               else exp++;
-               if (dotseen) exp--;
-       }
-       if (! digitseen) return;
-
-       if (ss) *ss = (char *)s - 1;
-
-       if (c == 'E' || c == 'e') {
-               int     exp1 = 0;
-               int     sign = 1;
-               int     exp_overflow = 0;
-
-               switch(*s) {
-               case '-':
-                       sign = -1;
-               case '+':
-                       s++;
-               }
-               if (c = *s, isdigit(c)) {
-                       do {
-                               int tmp;
-
-                               exp1 = 10 * exp1 + (c - '0');
-                               if ((tmp = sign * exp1 + exp) > MAX_EXP ||
-                                    tmp < -MAX_EXP) {
-                                       exp_overflow = 1;
-                               }
-                       } while (c = *++s, isdigit(c));
-                       if (ss) *ss = (char *)s;
-               }
-               exp += sign * exp1;
-               if (exp_overflow) {
-                       exp = sign * MAX_EXP;
-                       if (e->m1 != 0 || e->m2 != 0) errno = ERANGE;
-               }
-       }
-       if (e->m1 == 0 && e->m2 == 0) return;
-       e->exp = 63;
-       while (! (e->m1 & 0x80000000)) {
-               b64_sft(&(e->mantissa),-1);
-               e->exp--;
-       }
-       add_exponent(e, exp);
-}
-
-#include       <math.h>
-
-
-static void
-ten_mult(struct EXTEND *e)
-{
-       struct EXTEND e1 = *e;
-
-       e1.exp++;
-       e->exp += 3;
-       add_ext(e, &e1, e);
-}
-
-#define NDIGITS 128
-#define NSIGNIFICANT 19
-
-char *
-_ext_str_cvt(struct EXTEND *e, int ndigit, int *decpt, int *sign, int ecvtflag)
-{
-       /*      Like cvt(), but for extended precision */
-
-       static char buf[NDIGITS+1];
-       struct EXTEND m;
-       register char *p = buf;
-       register char *pe;
-       int findex = 0;
-
-       if (ndigit < 0) ndigit = 0;
-       if (ndigit > NDIGITS) ndigit = NDIGITS;
-       pe = &buf[ndigit];
-       buf[0] = '\0';
-
-       *sign = 0;
-       if (e->sign) {
-               *sign = 1;
-               e->sign = 0;
-       }
-
-       *decpt = 0;
-       if (e->m1 != 0) {
-               register struct EXTEND *pp = &big_ten_powers[1];
-
-               while(cmp_ext(e,pp) >= 0) {
-                       pp++;
-                       findex = pp - big_ten_powers;
-                       if (findex >= BTP) break;
-               }
-               pp--;
-               findex = pp - big_ten_powers;
-               mul_ext(e,&r_big_ten_powers[findex],e);
-               *decpt += findex * TP;
-               pp = &ten_powers[1];
-               while(pp < &ten_powers[TP] && cmp_ext(e, pp) >= 0) pp++;
-               pp--;
-               findex = pp - ten_powers;
-               *decpt += findex;
-
-               if (cmp_ext(e, &ten_powers[0]) < 0) {
-                       pp = &r_big_ten_powers[1];
-                       while(cmp_ext(e,pp) < 0) pp++;
-                       pp--;
-                       findex = pp - r_big_ten_powers;
-                       mul_ext(e, &big_ten_powers[findex], e);
-                       *decpt -= findex * TP;
-                       /* here, value >= 10 ** -28 */
-                       ten_mult(e);
-                       (*decpt)--;
-                       pp = &r_ten_powers[0];
-                       while(cmp_ext(e, pp) < 0) pp++;
-                       findex = pp - r_ten_powers;
-                       mul_ext(e, &ten_powers[findex], e);
-                       *decpt -= findex;
-                       findex = 0;
-               }
-               (*decpt)++;     /* because now value in [1.0, 10.0) */
-       }
-       if (! ecvtflag) {
-               /* for fcvt() we need ndigit digits behind the dot */
-               pe += *decpt;
-               if (pe > &buf[NDIGITS]) pe = &buf[NDIGITS];
-       }
-       m.exp = -62;
-       m.sign = 0;
-       m.m1 = 0xA0000000;
-       m.m2 = 0;
-       while (p <= pe) {
-               struct EXTEND oneminm;
-
-               if (p - pe > NSIGNIFICANT) {
-                       findex = 0;
-                       e->m1 = 0;
-               }
-               if (findex) {
-                       struct EXTEND tc, oldtc;
-                       int count = 0;
-
-                       oldtc.exp = 0;
-                       oldtc.sign = 0;
-                       oldtc.m1 = 0;
-                       oldtc.m2 = 0;
-                       tc = ten_powers[findex];
-                       while (cmp_ext(e, &tc) >= 0) {
-                               oldtc = tc;
-                               add_ext(&tc, &ten_powers[findex], &tc);
-                               count++;
-                       }
-                       *p++ = count + '0';
-                       oldtc.sign = 1;
-                       add_ext(e, &oldtc, e);
-                       findex--;
-                       continue;
-               }
-               if (e->m1) {
-                       m.sign = 1;
-                       add_ext(&ten_powers[0], &m, &oneminm);
-                       m.sign = 0;
-                       if (e->exp >= 0) {
-                               struct EXTEND x;
-
-                               x.m2 = 0; x.exp = e->exp;
-                               x.sign = 1;
-                               x.m1 = e->m1>>(31-e->exp);
-                               *p++ = (x.m1) + '0';
-                               x.m1 = x.m1 << (31-e->exp);
-                               add_ext(e, &x, e);
-                       }
-                       else *p++ = '0';
-                       /* Check that remainder is still significant */
-                       if (cmp_ext(&m, e) > 0 || cmp_ext(e, &oneminm) > 0) {
-                               if (e->m1 && e->exp >= -1) *(p-1) += 1;
-                               e->m1 = 0;
-                               continue;
-                       }
-                       ten_mult(&m);
-                       ten_mult(e);
-               }
-               else *p++ = '0';
-       }
-       if (pe >= buf) {
-               p = pe;
-               *p += 5;        /* round of at the end */
-               while (*p > '9') {
-                       *p = '0';
-                       if (p > buf) ++*--p;
-                       else {
-                               *p = '1';
-                               ++*decpt;
-                               if (! ecvtflag) {
-                                       /* maybe add another digit at the end,
-                                          because the point was shifted right
-                                       */
-                                       if (pe > buf) *pe = '0';
-                                       pe++;
-                               }
-                       }
-               }
-               *pe = '\0';
-       }
-       return buf;
-}
-
-void _dbl_ext_cvt(double value, struct EXTEND *e)
-{
-       /*      Convert double to extended
-       */
-       int exponent;
-
-       value = frexp(value, &exponent);
-       e->sign = value < 0.0;
-       if (e->sign) value = -value;
-       e->exp = exponent - 1;
-       value *= 4294967296.0;
-       e->m1 = value;
-       value -= e->m1;
-       value *= 4294967296.0;
-       e->m2 = value;
-}
-
-static struct EXTEND max_d;
-
-double
-_ext_dbl_cvt(struct EXTEND *e)
-{
-       /*      Convert extended to double
-       */
-       double f;
-       int sign = e->sign;
-
-       e->sign = 0;
-       if (e->m1 == 0 && e->m2 == 0) {
-               return 0.0;
-       }
-       if (max_d.exp == 0) {
-               _dbl_ext_cvt(DBL_MAX, &max_d);
-       }
-       if (cmp_ext(&max_d, e) < 0) {
-               f = HUGE_VAL;
-               errno = ERANGE;
-       }
-       else    f = ldexp((double)e->m1*4294967296.0 + (double)e->m2, e->exp-63);
-       if (sign) f = -f;
-       if (f == 0.0 && (e->m1 != 0 || e->m2 != 0)) {
-               errno = ERANGE;
-       }
-       return f;
-}
diff --git a/lib/libc/ansi/ext_fmt.h b/lib/libc/ansi/ext_fmt.h
deleted file mode 100644 (file)
index e8a5db1..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-struct mantissa {
-       unsigned long h_32;
-       unsigned long l_32;
-};
-
-struct EXTEND {
-       short   sign;
-       short   exp;
-       struct mantissa mantissa;
-#define m1 mantissa.h_32
-#define m2 mantissa.l_32
-};
-       
diff --git a/lib/libc/ansi/getenv.c b/lib/libc/ansi/getenv.c
deleted file mode 100644 (file)
index 6ec5e0f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-extern const char ***_penviron;
-
-char *
-getenv(const char *name)
-{
-       register const char **v = *_penviron;
-       register const char *p, *q;
-
-       if (v == NULL || name == NULL)
-               return (char *)NULL;
-       while ((p = *v++) != NULL) {
-               q = name;
-               while (*q && (*q == *p++))
-                       q++;
-               if (*q || (*p != '='))
-                       continue;
-               return (char *)p + 1;
-       }
-       return (char *)NULL;
-}
diff --git a/lib/libc/ansi/isalnum.c b/lib/libc/ansi/isalnum.c
deleted file mode 100644 (file)
index 2431df4..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (isalnum)(int c) {
-       return isalnum(c);
-}
diff --git a/lib/libc/ansi/isalpha.c b/lib/libc/ansi/isalpha.c
deleted file mode 100644 (file)
index f884c05..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (isalpha)(int c) {
-       return isalpha(c);
-}
diff --git a/lib/libc/ansi/isascii.c b/lib/libc/ansi/isascii.c
deleted file mode 100644 (file)
index 64165e0..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (isascii)(int c) {
-       return isascii(c);
-}
diff --git a/lib/libc/ansi/isblank.c b/lib/libc/ansi/isblank.c
deleted file mode 100644 (file)
index a3ce464..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (isblank)(int c) {
-       return isblank(c);
-}
diff --git a/lib/libc/ansi/iscntrl.c b/lib/libc/ansi/iscntrl.c
deleted file mode 100644 (file)
index f778ea3..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (iscntrl)(int c) {
-       return iscntrl(c);
-}
diff --git a/lib/libc/ansi/isdigit.c b/lib/libc/ansi/isdigit.c
deleted file mode 100644 (file)
index ebcbe48..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (isdigit)(int c) {
-       return isdigit(c);
-}
diff --git a/lib/libc/ansi/isgraph.c b/lib/libc/ansi/isgraph.c
deleted file mode 100644 (file)
index 1dccf8b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (isgraph)(int c) {
-       return isgraph(c);
-}
diff --git a/lib/libc/ansi/islower.c b/lib/libc/ansi/islower.c
deleted file mode 100644 (file)
index 8565dd1..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (islower)(int c) {
-       return islower(c);
-}
diff --git a/lib/libc/ansi/isprint.c b/lib/libc/ansi/isprint.c
deleted file mode 100644 (file)
index 10a9e58..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (isprint)(int c) {
-       return isprint(c);
-}
diff --git a/lib/libc/ansi/ispunct.c b/lib/libc/ansi/ispunct.c
deleted file mode 100644 (file)
index 35df5c6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (ispunct)(int c) {
-       return ispunct(c);
-}
diff --git a/lib/libc/ansi/isspace.c b/lib/libc/ansi/isspace.c
deleted file mode 100644 (file)
index 2e5fcf4..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (isspace)(int c) {
-       return isspace(c);
-}
diff --git a/lib/libc/ansi/isupper.c b/lib/libc/ansi/isupper.c
deleted file mode 100644 (file)
index 40a22ac..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (isupper)(int c) {
-       return isupper(c);
-}
diff --git a/lib/libc/ansi/isxdigit.c b/lib/libc/ansi/isxdigit.c
deleted file mode 100644 (file)
index 28a3ab0..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int (isxdigit)(int c) {
-       return isxdigit(c);
-}
diff --git a/lib/libc/ansi/labs.c b/lib/libc/ansi/labs.c
deleted file mode 100644 (file)
index ca593ea..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-long
-labs(register long l)
-{
-       return l >= 0 ? l : -l;
-}
diff --git a/lib/libc/ansi/ldiv.c b/lib/libc/ansi/ldiv.c
deleted file mode 100644 (file)
index 42c7619..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-static long tmp = -1;
-
-ldiv_t
-ldiv(register long numer, register long denom)
-{
-       ldiv_t r;
-
-       /* The assignment of tmp should not be optimized !! */
-       if (tmp == -1) {
-               tmp = (tmp / 2 == 0);
-       }
-       if (numer == 0) {
-               r.quot = numer / denom;         /* might trap if denom == 0 */
-               r.rem = numer % denom;
-       } else if ( !tmp && ((numer < 0) != (denom < 0))) {
-               r.quot = (numer / denom) + 1;
-               r.rem = numer - (numer / denom + 1) * denom;
-       } else {
-               r.quot = numer / denom;
-               r.rem = numer % denom;
-       }
-       return r;
-}
diff --git a/lib/libc/ansi/loc_time.h b/lib/libc/ansi/loc_time.h
deleted file mode 100644 (file)
index cc2dd95..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * loc_time.h - some local definitions
- */
-/* $Header$ */
-
-#define        YEAR0           1900                    /* the first year */
-#define        EPOCH_YR        1970            /* EPOCH = Jan 1 1970 00:00:00 */
-#define        SECS_DAY        (24L * 60L * 60L)
-#define        LEAPYEAR(year)  (!((year) % 4) && (((year) % 100) || !((year) % 400)))
-#define        YEARSIZE(year)  (LEAPYEAR(year) ? 366 : 365)
-#define        FIRSTSUNDAY(timp)       (((timp)->tm_yday - (timp)->tm_wday + 420) % 7)
-#define        FIRSTDAYOF(timp)        (((timp)->tm_wday - (timp)->tm_yday + 420) % 7)
-#define        TIME_MAX        ULONG_MAX
-#define        ABB_LEN         3
-
-extern const int _ytab[2][12];
-extern const char *_days[];
-extern const char *_months[];
-
-void _tzset(void);
-unsigned _dstget(struct tm *timep);
-
-extern long _timezone;
-extern long _dst_off;
-extern int _daylight;
-extern char *_tzname[2];
diff --git a/lib/libc/ansi/localeconv.c b/lib/libc/ansi/localeconv.c
deleted file mode 100644 (file)
index fdc03a0..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * localeconv - set components of a struct according to current locale
- */
-/* $Header$ */
-
-#include       <limits.h>
-#include       <locale.h>
-
-extern struct lconv _lc;
-
-struct lconv *
-localeconv(void)
-{
-       register struct lconv *lcp = &_lc;
-
-       lcp->decimal_point = ".";
-       lcp->thousands_sep = "";
-       lcp->grouping = "";
-       lcp->int_curr_symbol = "";
-       lcp->currency_symbol = "";
-       lcp->mon_decimal_point = "";
-       lcp->mon_thousands_sep = "";
-       lcp->mon_grouping = "";
-       lcp->positive_sign = "";
-       lcp->negative_sign = "";
-       lcp->int_frac_digits = CHAR_MAX;
-       lcp->frac_digits = CHAR_MAX;
-       lcp->p_cs_precedes = CHAR_MAX;
-       lcp->p_sep_by_space = CHAR_MAX;
-       lcp->n_cs_precedes = CHAR_MAX;
-       lcp->n_sep_by_space = CHAR_MAX;
-       lcp->p_sign_posn = CHAR_MAX;
-       lcp->n_sign_posn = CHAR_MAX;
-
-       return lcp;
-}
diff --git a/lib/libc/ansi/mblen.c b/lib/libc/ansi/mblen.c
deleted file mode 100644 (file)
index 93b146a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-#define        CHAR_SHIFT      8
-
-int
-mblen(const char *s, size_t n)
-{
-       if (s == (const char *)NULL) return 0;  /* no state dependent codings */
-       if (n <= 0) return 0;
-       return (*s != 0);
-}
diff --git a/lib/libc/ansi/mbstowcs.c b/lib/libc/ansi/mbstowcs.c
deleted file mode 100644 (file)
index 7b2015c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-size_t
-mbstowcs(register wchar_t *pwcs, register const char *s, size_t n)
-{
-       register int i = n;
-
-       while (--i >= 0) {
-               if (!(*pwcs++ = *s++))
-                       return n - i - 1;
-       }
-       return n;
-}
-
diff --git a/lib/libc/ansi/mbtowc.c b/lib/libc/ansi/mbtowc.c
deleted file mode 100644 (file)
index 47c1483..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-int
-mbtowc(wchar_t *pwc, register const char *s, size_t n)
-{
-       if (s == (const char *)NULL) return 0;
-       if (n <= 0) return 0;
-       if (pwc) *pwc = *s;
-       return (*s != 0);
-}
diff --git a/lib/libc/ansi/memchr.c b/lib/libc/ansi/memchr.c
deleted file mode 100644 (file)
index eb30869..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-void *
-memchr(const void *s, register int c, register size_t n)
-{
-       register const unsigned char *s1 = s;
-
-       c = (unsigned char) c;
-       if (n) {
-               n++;
-               while (--n > 0) {
-                       if (*s1++ != c) continue;
-                       return (void *) --s1;
-               }
-       }
-       return NULL;
-}
diff --git a/lib/libc/ansi/memcmp.c b/lib/libc/ansi/memcmp.c
deleted file mode 100644 (file)
index 1b46da2..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-
-#include       <string.h>
-
-int
-memcmp(const void *s1, const void *s2, size_t n)
-{
-       register const unsigned char *p1 = s1, *p2 = s2;
-
-       if (n) {
-               n++;
-               while (--n > 0) {
-                       if (*p1++ == *p2++) continue;
-                       return *--p1 - *--p2;
-               }
-       }
-       return 0;
-}
diff --git a/lib/libc/ansi/memcpy.c b/lib/libc/ansi/memcpy.c
deleted file mode 100644 (file)
index 6082fa4..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-void *
-memcpy(void *s1, const void *s2, register size_t n)
-{
-       register char *p1 = s1;
-       register const char *p2 = s2;
-
-
-       if (n) {
-               n++;
-               while (--n > 0) {
-                       *p1++ = *p2++;
-               }
-       }
-       return s1;
-}
diff --git a/lib/libc/ansi/memmove.c b/lib/libc/ansi/memmove.c
deleted file mode 100644 (file)
index e8d6539..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-void *
-memmove(void *s1, const void *s2, register size_t n)
-{
-       register char *p1 = s1;
-       register const char *p2 = s2;
-
-       if (n>0) {
-               if (p2 <= p1 && p2 + n > p1) {
-                       /* overlap, copy backwards */
-                       p1 += n;
-                       p2 += n;
-                       n++;
-                       while (--n > 0) {
-                               *--p1 = *--p2;
-                       }
-               } else {
-                       n++;
-                       while (--n > 0) {
-                               *p1++ = *p2++;
-                       }
-               }
-       }
-       return s1;
-}
diff --git a/lib/libc/ansi/memset.c b/lib/libc/ansi/memset.c
deleted file mode 100644 (file)
index 2138cf3..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-void *
-memset(void *s, register int c, register size_t n)
-{
-       register char *s1 = s;
-
-       if (n>0) {
-               n++;
-               while (--n > 0) {
-                       *s1++ = c;
-               }
-       }
-       return s;
-}
diff --git a/lib/libc/ansi/misc.c b/lib/libc/ansi/misc.c
deleted file mode 100644 (file)
index 6a06b81..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * misc - data and miscellaneous routines
- */
-/* $Header$ */
-
-#include       <ctype.h>
-#include       <time.h>
-#include       <stdlib.h>
-#include       <string.h>
-
-#include       "loc_time.h"
-
-#define        RULE_LEN        120
-#define        TZ_LEN          10
-
-/* Make sure that the strings do not end up in ROM.
- * These strings probably contain the wrong value, and we cannot obtain the
- * right value from the system. TZ is the only help.
- */
-
-long   _timezone = 0;
-long   _dst_off = 60 * 60;
-int    _daylight = 0;
-
-long   timezone = 0;
-int    daylight = 0;
-
-
-static struct dsttype {
-       char ds_type;           /* Unknown, Julian, Zero-based or M */
-       int ds_date[3];         /* months, weeks, days */
-       long ds_sec;            /* usually 02:00:00 */
-};
-
-const char *_days[] = {
-                       "Sunday", "Monday", "Tuesday", "Wednesday",
-                       "Thursday", "Friday", "Saturday"
-               };
-
-const char *_months[] = {
-                       "January", "February", "March",
-                       "April", "May", "June",
-                       "July", "August", "September",
-                       "October", "November", "December"
-               };
-
-const int _ytab[2][12] = {
-               { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
-               { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-       };
-
diff --git a/lib/libc/ansi/qsort.c b/lib/libc/ansi/qsort.c
deleted file mode 100644 (file)
index c9b2d33..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-static void qsort1(char *, char *, size_t);
-static int (*qcompar)(const char *, const char *);
-static void qexchange(char *, char *, size_t);
-static void q3exchange(char *, char *, char *, size_t);
-
-void
-qsort(void *base, size_t nel, size_t width,
-      int (*compar)(const void *, const void *))
-{
-       /* when nel is 0, the expression '(nel - 1) * width' is wrong */
-       if (!nel) return;
-       qcompar = (int (*)(const char *, const char *)) compar;
-       qsort1(base, (char *)base + (nel - 1) * width, width);
-}
-
-static void
-qsort1(char *a1, char *a2, register size_t width)
-{
-       register char *left, *right;
-       register char *lefteq, *righteq;
-       int cmp;
-
-       for (;;) {
-               if (a2 <= a1) return;
-               left = a1;
-               right = a2;
-               lefteq = righteq = a1 + width * (((a2-a1)+width)/(2*width));
-               /*
-                  Pick an element in the middle of the array.
-                  We will collect the equals around it.
-                  "lefteq" and "righteq" indicate the left and right
-                  bounds of the equals respectively.
-                  Smaller elements end up left of it, larger elements end
-                  up right of it.
-               */
-again:
-               while (left < lefteq && (cmp = (*qcompar)(left, lefteq)) <= 0) {
-                       if (cmp < 0) {
-                               /* leave it where it is */
-                               left += width;
-                       }
-                       else {
-                               /* equal, so exchange with the element to
-                                  the left of the "equal"-interval.
-                               */
-                               lefteq -= width;
-                               qexchange(left, lefteq, width);
-                       }
-               }
-               while (right > righteq) {
-                       if ((cmp = (*qcompar)(right, righteq)) < 0) {
-                               /* smaller, should go to left part
-                               */
-                               if (left < lefteq) {
-                                       /* yes, we had a larger one at the
-                                          left, so we can just exchange
-                                       */
-                                       qexchange(left, right, width);
-                                       left += width;
-                                       right -= width;
-                                       goto again;
-                               }
-                               /* no more room at the left part, so we
-                                  move the "equal-interval" one place to the
-                                  right, and the smaller element to the
-                                  left of it.
-                                  This is best expressed as a three-way
-                                  exchange.
-                               */
-                               righteq += width;
-                               q3exchange(left, righteq, right, width);
-                               lefteq += width;
-                               left = lefteq;
-                       }
-                       else if (cmp == 0) {
-                               /* equal, so exchange with the element to
-                                  the right of the "equal-interval"
-                               */
-                               righteq += width;
-                               qexchange(right, righteq, width);
-                       }
-                       else    /* just leave it */ right -= width;
-               }
-               if (left < lefteq) {
-                       /* larger element to the left, but no more room,
-                          so move the "equal-interval" one place to the
-                          left, and the larger element to the right
-                          of it.
-                       */
-                       lefteq -= width;
-                       q3exchange(right, lefteq, left, width);
-                       righteq -= width;
-                       right = righteq;
-                       goto again;
-               }
-               /* now sort the "smaller" part */
-               qsort1(a1, lefteq - width, width);
-               /* and now the larger, saving a subroutine call
-                  because of the for(;;)
-               */
-               a1 = righteq + width;
-       }
-       /*NOTREACHED*/
-}
-
-static void
-qexchange(register char *p, register char *q,
-         register size_t n)
-{
-       register int c;
-
-       while (n-- > 0) {
-               c = *p;
-               *p++ = *q;
-               *q++ = c;
-       }
-}
-
-static void
-q3exchange(register char *p, register char *q, register char *r,
-          register size_t n)
-{
-       register int c;
-
-       while (n-- > 0) {
-               c = *p;
-               *p++ = *r;
-               *r++ = *q;
-               *q++ = c;
-       }
-}
diff --git a/lib/libc/ansi/rand.c b/lib/libc/ansi/rand.c
deleted file mode 100644 (file)
index 82afb2e..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-static unsigned long int next = 1;
-
-int rand(void)
-{
-       next = next * 1103515245 + 12345;
-       return (unsigned int)(next/(2 * (RAND_MAX +1L)) % (RAND_MAX+1L));
-}
-
-void srand(unsigned int seed)
-{
-       next = seed;
-}
diff --git a/lib/libc/ansi/setlocale.c b/lib/libc/ansi/setlocale.c
deleted file mode 100644 (file)
index 8d098f2..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * setlocale - set the programs locale
- */
-/* $Header$ */
-
-#include       <locale.h>
-#include       <string.h>
-
-struct lconv _lc;
-
-char *
-setlocale(int category, const char *locale)
-{
-       if (!locale) return "C";
-       if (*locale && strcmp(locale, "C")) return (char *)NULL;
-       
-       switch(category) {
-       case LC_ALL:
-       case LC_CTYPE:
-       case LC_COLLATE:
-       case LC_TIME:
-       case LC_NUMERIC:
-       case LC_MONETARY:
-       case LC_MESSAGES:
-               return *locale ? (char *)locale : "C";
-       default:
-               return (char *)NULL;
-       }
-}
diff --git a/lib/libc/ansi/sigmisc.c b/lib/libc/ansi/sigmisc.c
deleted file mode 100644 (file)
index b58aee2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * sigmisc.c - used to get a signal mask
- */
-/* $Header$ */
-
-#if    defined(_POSIX_SOURCE)
-
-/* This can't be done in setjmp.e, since SIG_SETMASK is defined in
- * <signal.h>. This is a C-file, which can't be included.
- */
-
-#include       <sys/types.h>
-#include       <signal.h>
-#include       <stddef.h>
-
-int _sigprocmask(int, sigset_t *, sigset_t *);
-
-static void
-__testsigset(void) {
-       /* This switch compiles when a sigset_t has the right size. */
-       switch(0) {
-       case 0: 
-       case sizeof(sigset_t) <= sizeof(long): break;
-       }
-}
-
-void
-__newsigset(sigset_t *p)
-{
-       /* The SIG_SETMASK is not significant */
-       _sigprocmask(SIG_SETMASK, NULL, p);
-}
-
-void
-__oldsigset(sigset_t *p)
-{
-       _sigprocmask(SIG_SETMASK, p, NULL);
-}
-#endif /* _POSIX_SOURCE */
diff --git a/lib/libc/ansi/signal.c b/lib/libc/ansi/signal.c
deleted file mode 100644 (file)
index f00d38d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* SYSVR4 and ANSI compatible signal(2). */
-
-#include <lib.h>
-#define sigaction      _sigaction
-#define _SYSTEM 1
-#include <signal.h>
-
-PUBLIC sighandler_t signal(sig, disp)
-int sig;                       /* signal number */
-sighandler_t disp;             /* signal handler, or SIG_DFL, or SIG_IGN */
-{
-  struct sigaction sa, osa;
-
-  if (sig <= 0 || sig >= _NSIG || sig == SIGKILL) {
-       errno = EINVAL;
-       return(SIG_ERR);
-  }
-  (void) sigemptyset(&sa.sa_mask);
-
-#ifdef WANT_UNRELIABLE_SIGNALS
-  /* Allow the signal being handled to interrupt the signal handler. */
-  sa.sa_flags = SA_NODEFER;
-
-  /* When signal is caught, reset signal handler to SIG_DFL for all but
-   * SIGILL and SIGTRAP.
-   */
-  if (sig != SIGILL && sig != SIGTRAP) sa.sa_flags |= SA_RESETHAND;
-#else
-  sa.sa_flags = 0;
-#endif
-
-  sa.sa_handler = disp;
-  if (sigaction(sig, &sa, &osa) < 0) return(SIG_ERR);
-  return(osa.sa_handler);
-}
diff --git a/lib/libc/ansi/strcat.c b/lib/libc/ansi/strcat.c
deleted file mode 100644 (file)
index 133bd31..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-char *
-strcat(char *ret, register const char *s2)
-{
-       register char *s1 = ret;
-
-       while (*s1++ != '\0')
-               /* EMPTY */ ;
-       s1--;
-       while (*s1++ = *s2++)
-               /* EMPTY */ ;
-       return ret;
-}
diff --git a/lib/libc/ansi/strchr.c b/lib/libc/ansi/strchr.c
deleted file mode 100644 (file)
index 4c738c3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-char *
-strchr(register const char *s, register int c)
-{
-       c = (char) c;
-
-       while (c != *s) {
-               if (*s++ == '\0') return NULL;
-       }
-       return (char *)s;
-}
diff --git a/lib/libc/ansi/strcmp.c b/lib/libc/ansi/strcmp.c
deleted file mode 100644 (file)
index 0434c66..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-
-#include       <string.h>
-
-int
-strcmp(register const char *s1, register const char *s2)
-{
-       while (*s1 == *s2++) {
-               if (*s1++ == '\0') {
-                       return 0;
-               }
-       }
-       if (*s1 == '\0') return -1;
-       if (*--s2 == '\0') return 1;
-       return (unsigned char) *s1 - (unsigned char) *s2;
-}
diff --git a/lib/libc/ansi/strcoll.c b/lib/libc/ansi/strcoll.c
deleted file mode 100644 (file)
index 1d0a238..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-int
-strcoll(register const char *s1, register const char *s2)
-{
-       while (*s1 == *s2++) {
-               if (*s1++ == '\0') {
-                       return 0;
-               }
-       }
-       return *s1 - *--s2;
-}
diff --git a/lib/libc/ansi/strcpy.c b/lib/libc/ansi/strcpy.c
deleted file mode 100644 (file)
index 914ceaf..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-char *
-strcpy(char *ret, register const char *s2)
-{
-       register char *s1 = ret;
-
-       while (*s1++ = *s2++)
-               /* EMPTY */ ;
-
-       return ret;
-}
diff --git a/lib/libc/ansi/strcspn.c b/lib/libc/ansi/strcspn.c
deleted file mode 100644 (file)
index fbdc1d0..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-size_t
-strcspn(const char *string, const char *notin)
-{
-       register const char *s1, *s2;
-
-       for (s1 = string; *s1; s1++) {
-               for(s2 = notin; *s2 != *s1 && *s2; s2++)
-                       /* EMPTY */ ;
-               if (*s2)
-                       break;
-       }
-       return s1 - string;
-}
diff --git a/lib/libc/ansi/strerror.c b/lib/libc/ansi/strerror.c
deleted file mode 100644 (file)
index ee110eb..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-/*
- * I don't know why, but X3J11 says that strerror() should be in declared
- * in <string.h>.  That is why the function is defined here.
- */
-char *
-strerror(register int errnum)
-{
-       extern const char *_sys_errlist[];
-       extern const int _sys_nerr;
-
-       if (errnum < 0 || errnum >= _sys_nerr)
-               return "unknown error";
-       return (char *)_sys_errlist[errnum];
-}
diff --git a/lib/libc/ansi/strlen.c b/lib/libc/ansi/strlen.c
deleted file mode 100644 (file)
index ff673e1..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-size_t
-strlen(const char *org)
-{
-       register const char *s = org;
-
-       while (*s++)
-               /* EMPTY */ ;
-
-       return --s - org;
-}
diff --git a/lib/libc/ansi/strncat.c b/lib/libc/ansi/strncat.c
deleted file mode 100644 (file)
index 6a0a3b0..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-char *
-strncat(char *ret, register const char *s2, size_t n)
-{
-       register char *s1 = ret;
-
-       if (n > 0) {
-               while (*s1++)
-                       /* EMPTY */ ;
-               s1--;
-               while (*s1++ = *s2++)  {
-                       if (--n > 0) continue;
-                       *s1 = '\0';
-                       break;
-               }
-               return ret;
-       } else return s1;
-}
diff --git a/lib/libc/ansi/strncmp.c b/lib/libc/ansi/strncmp.c
deleted file mode 100644 (file)
index 901796c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-
-#include       <string.h>
-
-int
-strncmp(register const char *s1, register const char *s2, register size_t n)
-{
-       if (n) {
-               do {
-                       if (*s1 != *s2++)
-                               break;
-                       if (*s1++ == '\0')
-                               return 0;
-               } while (--n > 0);
-               if (n > 0) {
-                       if (*s1 == '\0') return -1;
-                       if (*--s2 == '\0') return 1;
-                       return (unsigned char) *s1 - (unsigned char) *s2;
-               }
-       }
-       return 0;
-}
diff --git a/lib/libc/ansi/strncpy.c b/lib/libc/ansi/strncpy.c
deleted file mode 100644 (file)
index ed3195f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-char *
-strncpy(char *ret, register const char *s2, register size_t n)
-{
-       register char *s1 = ret;
-
-       if (n>0) {
-               while((*s1++ = *s2++) && --n > 0)
-                       /* EMPTY */ ;
-               if ((*--s2 == '\0') && --n > 0) {
-                       do {
-                               *s1++ = '\0';
-                       } while(--n > 0);
-               }
-       }
-       return ret;
-}
diff --git a/lib/libc/ansi/strpbrk.c b/lib/libc/ansi/strpbrk.c
deleted file mode 100644 (file)
index 5f08731..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-char *
-strpbrk(register const char *string, register const char *brk)
-{
-       register const char *s1;
-
-       while (*string) {
-               for (s1 = brk; *s1 && *s1 != *string; s1++)
-                       /* EMPTY */ ;
-               if (*s1)
-                       return (char *)string;
-               string++;
-       }
-       return (char *)NULL;
-}
diff --git a/lib/libc/ansi/strrchr.c b/lib/libc/ansi/strrchr.c
deleted file mode 100644 (file)
index 0d35053..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-char *
-strrchr(register const char *s, int c)
-{
-       register const char *result = NULL;
-
-       c = (char) c;
-
-       do {
-               if (c == *s)
-                       result = s;
-       } while (*s++ != '\0');
-
-       return (char *)result;
-}
diff --git a/lib/libc/ansi/strspn.c b/lib/libc/ansi/strspn.c
deleted file mode 100644 (file)
index 322b703..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-size_t
-strspn(const char *string, const char *in)
-{
-       register const char *s1, *s2;
-
-       for (s1 = string; *s1; s1++) {
-               for (s2 = in; *s2 && *s2 != *s1; s2++)
-                       /* EMPTY */ ;
-               if (*s2 == '\0')
-                       break;
-       }
-       return s1 - string;
-}
diff --git a/lib/libc/ansi/strstr.c b/lib/libc/ansi/strstr.c
deleted file mode 100644 (file)
index 7d15a70..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-char *
-strstr(register const char *s, register const char *wanted)
-{
-       register const size_t len = strlen(wanted);
-
-       if (len == 0) return (char *)s;
-       while (*s != *wanted || strncmp(s, wanted, len))
-               if (*s++ == '\0')
-                       return (char *)NULL;
-       return (char *)s;
-}
diff --git a/lib/libc/ansi/strtok.c b/lib/libc/ansi/strtok.c
deleted file mode 100644 (file)
index b07c8a5..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-char *
-strtok(register char *string, const char *separators)
-{
-       register char *s1, *s2;
-       static char *savestring = NULL;
-
-       if (string == NULL) {
-               string = savestring;
-               if (string == NULL) return (char *)NULL;
-       }
-
-       s1 = string + strspn(string, separators);
-       if (*s1 == '\0') {
-               savestring = NULL;
-               return (char *)NULL;
-       }
-
-       s2 = strpbrk(s1, separators);
-       if (s2 != NULL)
-               *s2++ = '\0';
-       savestring = s2;
-       return s1;
-}
diff --git a/lib/libc/ansi/strtol.c b/lib/libc/ansi/strtol.c
deleted file mode 100644 (file)
index 9a200cc..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <ctype.h>
-#include       <errno.h>
-#include       <limits.h>
-#include       <stdlib.h>
-
-static unsigned long
-string2long(register const char *nptr, char **endptr,
-                       int base, int is_signed);
-
-long int
-strtol(register const char *nptr, char **endptr, int base)
-{
-       return (signed long)string2long(nptr, endptr, base, 1);
-}
-
-unsigned long int
-strtoul(register const char *nptr, char **endptr, int base)
-{
-       return (unsigned long)string2long(nptr, endptr, base, 0);
-}
-
-#define between(a, c, z)  ((unsigned) ((c) - (a)) <= (unsigned) ((z) - (a)))
-
-static unsigned long
-string2long(register const char *nptr, char ** const endptr,
-                       int base, int is_signed)
-{
-       register unsigned int v;
-       register unsigned long val = 0;
-       register int c;
-       int ovfl = 0, sign = 1;
-       const char *startnptr = nptr, *nrstart;
-
-       if (endptr) *endptr = (char *)nptr;
-       while (isspace(*nptr)) nptr++;
-       c = *nptr;
-
-       if (c == '-' || c == '+') {
-               if (c == '-') sign = -1;
-               nptr++;
-       }
-       nrstart = nptr;                 /* start of the number */
-
-       /* When base is 0, the syntax determines the actual base */
-       if (base == 0)
-               if (*nptr == '0')
-                       if (*++nptr == 'x' || *nptr == 'X') {
-                               base = 16;
-                               nptr++;
-                       }
-                       else    base = 8;
-               else    base = 10;
-       else if (base==16 && *nptr=='0' && (*++nptr =='x' || *nptr =='X'))
-               nptr++;
-
-       for (;;) {
-               c = *nptr;
-               if (between('0', c, '9')) {
-                       v = c - '0';
-               } else
-               if (between('a', c, 'z')) {
-                       v = c - 'a' + 0xa;
-               } else
-               if (between('A', c, 'Z')) {
-                       v = c - 'A' + 0xA;
-               } else {
-                       break;
-               }
-               if (v >= base) break;
-               if (val > (ULONG_MAX - v) / base) ovfl++;
-               val = (val * base) + v;
-               nptr++;
-       }
-       if (endptr) {
-               if (nrstart == nptr) *endptr = (char *)startnptr;
-               else *endptr = (char *)nptr;
-       }
-
-       if (!ovfl) {
-               /* Overflow is only possible when converting a signed long. */
-               if (is_signed
-                   && (   (sign < 0 && val > -(unsigned long)LONG_MIN)
-                       || (sign > 0 && val > LONG_MAX)))
-                   ovfl++;
-       }
-
-       if (ovfl) {
-               errno = ERANGE;
-               if (is_signed)
-                       if (sign < 0) return LONG_MIN;
-                       else return LONG_MAX;
-               else return ULONG_MAX;
-       }
-       return (long) sign * val;
-}
diff --git a/lib/libc/ansi/strxfrm.c b/lib/libc/ansi/strxfrm.c
deleted file mode 100644 (file)
index ca32913..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-size_t
-strxfrm(register char *s1, register const char *save, register size_t n)
-{
-       register const char *s2 = save;
-
-       while (*s2) {
-               if (n > 1) {
-                       n--;
-                       *s1++ = *s2++;
-               } else
-                       s2++;
-       }
-       if (n > 0)
-               *s1++ = '\0';
-       return s2 - save;
-}
diff --git a/lib/libc/ansi/system.c b/lib/libc/ansi/system.c
deleted file mode 100644 (file)
index 100e0cd..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#if    defined(_POSIX_SOURCE)
-#include       <sys/types.h>
-#endif
-#include       <stdlib.h>
-#include       <signal.h>
-#include       <limits.h>
-
-extern pid_t _fork(void);
-extern pid_t _wait(int *);
-extern void _exit(int);
-extern void _execve(const char *path, const char ** argv, const char ** envp);
-extern int _close(int);
-
-#define        FAIL    127
-
-extern const char ***_penviron;
-static const char *exec_tab[] = {
-       "sh",                   /* argv[0] */
-       "-c",                   /* argument to the shell */
-       NULL,                   /* to be filled with user command */
-       NULL                    /* terminating NULL */
-       };
-
-int
-system(const char *str)
-{
-       int pid, exitstatus, waitval;
-       int i;
-
-       if ((pid = _fork()) < 0) return str ? -1 : 0;
-
-       if (pid == 0) {
-               for (i = 3; i <= OPEN_MAX; i++)
-                       _close(i);
-               if (!str) str = "cd .";         /* just testing for a shell */
-               exec_tab[2] = str;              /* fill in command */
-               _execve("/bin/sh", exec_tab, *_penviron);
-               /* get here if execve fails ... */
-               _exit(FAIL);    /* see manual page */
-       }
-       while ((waitval = _wait(&exitstatus)) != pid) {
-               if (waitval == -1) break;
-       }
-       if (waitval == -1) {
-               /* no child ??? or maybe interrupted ??? */
-               exitstatus = -1;
-       }
-       if (!str) {
-               if (exitstatus == FAIL << 8)            /* execve() failed */
-                       exitstatus = 0;
-               else exitstatus = 1;                    /* /bin/sh exists */
-       }
-       return exitstatus;
-}
diff --git a/lib/libc/ansi/tolower.c b/lib/libc/ansi/tolower.c
deleted file mode 100644 (file)
index ff95ae0..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int tolower(int c) {
-       return isupper(c) ? c - 'A' + 'a' : c ;
-}
diff --git a/lib/libc/ansi/toupper.c b/lib/libc/ansi/toupper.c
deleted file mode 100644 (file)
index 521ae55..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#include       <ctype.h>
-
-int toupper(int c) {
-       return islower(c) ? c - 'a' + 'A' : c ;
-}
diff --git a/lib/libc/ansi/wcstombs.c b/lib/libc/ansi/wcstombs.c
deleted file mode 100644 (file)
index 97e5f8f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-#include       <locale.h>
-
-size_t
-wcstombs(register char *s, register const wchar_t *pwcs, size_t n)
-{
-       register int i = n;
-
-       while (--i >= 0) {
-               if (!(*s++ = *pwcs++))
-                       break;
-       }
-       return n - i - 1;
-}
diff --git a/lib/libc/ansi/wctomb.c b/lib/libc/ansi/wctomb.c
deleted file mode 100644 (file)
index 1afc0c5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-int
-/* was: wctomb(char *s, wchar_t wchar) 
- * This conflicts with prototype, so it was changed to:
- */
-wctomb(char *s, wchar_t wchar)
-{
-       if (!s) return 0;               /* no state dependent codings */
-
-       *s = wchar;
-       return 1;
-}
diff --git a/lib/libc/arch/i386/int64/Makefile.inc b/lib/libc/arch/i386/int64/Makefile.inc
deleted file mode 100644 (file)
index b3d7fa5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# int64 sources
-.PATH: ${.CURDIR}/arch/${ARCH}/int64
-
-SRCS+=  \
-       add64.S \
-       add64u.S \
-       bsr64.S \
-       cmp64.S \
-       cv64u.S \
-       cvu64.S \
-       diff64.S \
-       div64.c \
-       div64u.S \
-       ex64.S \
-       make64.S \
-       mul64.c \
-       mul64u.S \
-       sub64.S \
-       sub64u.S
diff --git a/lib/libc/arch/i386/int64/add64.S b/lib/libc/arch/i386/int64/add64.S
deleted file mode 100644 (file)
index 945667d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*     add64() - 64 bit addition                       Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <minix/compiler.h>
-#include <machine/asm.h>
-
-ENTRY(add64)
-/* u64_t add64(u64_t i, u64_t j); */
-       movl    4(%esp), %eax
-       movl    8(%esp), %edx
-       addl    16(%esp), %edx
-       movl    %edx, (%eax)
-       movl    12(%esp), %edx
-       adcl    20(%esp), %edx
-       movl    %edx, 4(%eax)
-       ret BYTES_TO_POP_ON_STRUCT_RETURN
-
-/* */
-/* $PchId: add64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/add64u.S b/lib/libc/arch/i386/int64/add64u.S
deleted file mode 100644 (file)
index cbf2160..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*     add64u() - unsigned to 64 bit addition          Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <minix/compiler.h>
-#include <machine/asm.h>
-
-ENTRY(add64u)
-/* u64_t add64u(u64_t i, unsigned j); */
-ENTRY(add64ul)
-/* u64_t add64ul(u64_t i, unsigned long j); */
-       movl    4(%esp), %eax
-       movl    8(%esp), %edx
-       addl    16(%esp), %edx
-       movl    %edx, (%eax)
-       movl    12(%esp), %edx
-       adcl    $0, %edx
-       movl    %edx, 4(%eax)
-       ret BYTES_TO_POP_ON_STRUCT_RETURN
-
-/* */
-/* $PchId: add64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/bsr64.S b/lib/libc/arch/i386/int64/bsr64.S
deleted file mode 100644 (file)
index 5c61e3d..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*     bsr64() - 64 bit bit scan reverse       Author: Erik van der Kouwe */
-/*                                                            15 May 2010 */
-#include <minix/compiler.h>
-#include <machine/asm.h>
-
-ENTRY(bsr64)
-/* int bsr64(u64_t i); */
-       bsr     8(%esp),        %eax    /* check high-order DWORD */
-       jnz     0f                      /* non-zero: return index+32 */
-       bsr     4(%esp),        %eax    /* check low-order DWORD */
-       jnz     1f                      /* non-zero: return index */
-       movl    $-1,            %eax    /* both were zero, return -1 */
-       jmp     1f
-0:     addl    $32,            %eax    /* add 32 to high-order index */
-1:     ret
diff --git a/lib/libc/arch/i386/int64/cmp64.S b/lib/libc/arch/i386/int64/cmp64.S
deleted file mode 100644 (file)
index 0c07354..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*     cmp64*() - 64 bit compare                       Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <machine/asm.h>
-
-ENTRY(cmp64)
-/* int cmp64(u64_t i, u64_t j); */
-       movl    %esp, %ecx
-0:
-       xorl    %eax, %eax
-       movl    4(%ecx), %edx
-       subl    12(%ecx), %edx
-       movl    8(%ecx), %edx
-       sbbl    16(%ecx), %edx
-       sbbl    %eax, %eax      /* eax = - (i < j) */
-       movl    12(%ecx), %edx
-       subl    4(%ecx), %edx
-       movl    16(%ecx), %edx
-       sbbl    8(%ecx), %edx
-       adcl    $0, %eax        /* eax = (i > j) - (i < j) */
-       ret
-
-ENTRY(cmp64u)
-/* int cmp64u(u64_t i, unsigned j); */
-ENTRY(cmp64ul)
-/* int cmp64ul(u64_t i, unsigned long j); */
-       movl    %esp, %ecx
-       push    16(%ecx)
-       movl    $0, 16(%ecx)
-       call    0b
-       pop     16(%ecx)
-       ret
-
-/* */
-/* $PchId: cmp64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/cv64u.S b/lib/libc/arch/i386/int64/cv64u.S
deleted file mode 100644 (file)
index 93c9264..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*     cv64u() - 64 bit converted to unsigned          Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <machine/asm.h>
-
-ENTRY(cv64u)
-/* unsigned cv64u(u64_t i); */
-ENTRY(cv64ul)
-/* unsigned long cv64ul(u64_t i); */
-       movl    4(%esp), %eax
-       cmpl    $0, 8(%esp)     /* return ULONG_MAX if really big */
-       je      0f
-       movl    $-1, %eax
-0:
-       ret
-
-/* */
-/* $PchId: cv64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/cvu64.S b/lib/libc/arch/i386/int64/cvu64.S
deleted file mode 100644 (file)
index 2395412..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*     cvu64() - unsigned converted to 64 bit          Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <minix/compiler.h>
-#include <machine/asm.h>
-
-ENTRY(cvu64)
-/* u64_t cvu64(unsigned i); */
-ENTRY(cvul64)
-/* u64_t cvul64(unsigned long i); */
-       movl    4(%esp), %eax
-       movl    8(%esp), %edx
-       movl    %edx, (%eax)
-       movl    $0, 4(%eax)
-       ret BYTES_TO_POP_ON_STRUCT_RETURN
-
-/* */
-/* $PchId: cvu64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/diff64.S b/lib/libc/arch/i386/int64/diff64.S
deleted file mode 100644 (file)
index 18719cd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*     diff64() - 64 bit subtraction giving unsigned   Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <machine/asm.h>
-
-ENTRY(diff64)
-/* unsigned diff64(u64_t i, u64_t j); */
-       movl    4(%esp), %eax
-       subl    12(%esp), %eax
-       ret
-
-/* */
-/* $PchId: diff64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/div64.c b/lib/libc/arch/i386/int64/div64.c
deleted file mode 100644 (file)
index ad5b006..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*     div64() - full 64-bit division                                     */
-/*     rem64() - full 64-bit modulo                                       */
-/*                                             Author: Erik van der Kouwe */
-/*                                                           14 May 2010  */
-#include <assert.h>
-#include <minix/u64.h>
-
-static u32_t shl64hi(u64_t i, unsigned shift)
-{
-       /* compute the high-order 32-bit value in (i << shift) */
-       if (shift == 0)
-               return i.hi;
-       else if (shift < 32)
-               return (i.hi << shift) | (i.lo >> (32 - shift));
-       else if (shift == 32)
-               return i.lo;
-       else if (shift < 64)
-               return i.lo << (shift - 32);
-       else
-               return 0;               
-}
-
-static u64_t divrem64(u64_t *i, u64_t j)
-{
-       u32_t i32, j32, q;
-       u64_t result = { 0, 0 };
-       unsigned shift;
-
-       /* as long as i >= j we work on reducing i */
-       while (cmp64(*i, j) >= 0) {
-               /* shift to obtain the 32 most significant bits */
-               shift = 63 - bsr64(*i);
-               i32 = shl64hi(*i, shift);
-               j32 = shl64hi(j, shift);
-
-               /* find a lower bound for *i/j */
-               if (j32 + 1 < j32) {
-                       /* avoid overflow, since *i >= j we know q >= 1 */
-                       q = 1; 
-               } else {
-                       /* use 32-bit division, round j32 up to ensure that
-                        * we obtain a lower bound 
-                        */
-                       q = i32 / (j32 + 1);
-
-                       /* since *i >= j we know q >= 1 */
-                       if (q < 1) q = 1;
-               }
-
-               /* perform the division using the lower bound we found */
-               *i = sub64(*i, mul64(j, cvu64(q)));
-               result = add64u(result, q);
-       }
-
-       /* if we get here then *i < j; because we round down we are finished */
-       return result;
-}
-
-u64_t div64(u64_t i, u64_t j)
-{
-       /* divrem64 is unsuitable for small divisors, especially zero which would 
-        * trigger a infinite loop; use assembly function in this case
-        */
-       if (!ex64hi(j)) {
-               return div64u64(i, ex64lo(j));
-       }
-
-       return divrem64(&i, j);
-}
-
-u64_t rem64(u64_t i, u64_t j)
-{
-       /* divrem64 is unsuitable for small divisors, especially zero which would 
-        * trigger a infinite loop; use assembly function in this case
-        */
-       if (!ex64hi(j)) {
-               return cvu64(rem64u(i, ex64lo(j)));
-       }
-
-       divrem64(&i, j);
-       return i;
-}
diff --git a/lib/libc/arch/i386/int64/div64u.S b/lib/libc/arch/i386/int64/div64u.S
deleted file mode 100644 (file)
index aaee092..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*     div64u() - 64 bit divided by unsigned giving unsigned long */
-/*                                                     Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <minix/compiler.h>
-#include <machine/asm.h>
-
-ENTRY(div64u)
-/* unsigned long div64u(u64_t i, unsigned j); */
-       xorl    %edx, %edx
-       movl    8(%esp), %eax   /* i = (ih<<32) + il */
-       divl    12(%esp)        /* ih = q * j + r */
-       movl    4(%esp), %eax
-       divl    12(%esp)        /* i / j = (q<<32) + ((r<<32) + il) / j */
-       ret
-
-ENTRY(div64u64)
-/* u64_t div64u64(u64_t i, unsigned j); */
-       xorl    %edx, %edx
-       movl    12(%esp), %eax  /* i = (ih<<32) + il */
-       divl    16(%esp)        /* ih = q * j + r */
-       movl    4(%esp), %ecx   /* get pointer to result */
-       movl    %eax, 4(%ecx)   /* store high-order result */
-       movl    8(%esp), %eax
-       divl    16(%esp)        /* i / j = (q<<32) + ((r<<32) + il) / j */
-       movl    %eax, 0(%ecx)   /* store low result */
-       movl    %ecx, %eax      /* return pointer to result struct */
-       ret     BYTES_TO_POP_ON_STRUCT_RETURN
-
-ENTRY(rem64u)
-/* unsigned rem64u(u64_t i, unsigned j); */
-       pop     %ecx
-       call    _C_LABEL(div64u)
-       movl    %edx, %eax
-       jmp     *%ecx
-
-/* */
-/* $PchId: div64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/ex64.S b/lib/libc/arch/i386/int64/ex64.S
deleted file mode 100644 (file)
index 9cc1f00..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*     ex64*() - extract low or high 32 bits of a 64 bit number */
-/*                                                     Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <machine/asm.h>
-
-ENTRY(ex64lo)
-/* unsigned long ex64lo(u64_t i); */
-       movl    4(%esp), %eax
-       ret
-
-ENTRY(ex64hi)
-/* unsigned long ex64hi(u64_t i); */
-       movl    8(%esp), %eax
-       ret
-
-/* */
-/* $PchId: ex64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/make64.S b/lib/libc/arch/i386/int64/make64.S
deleted file mode 100644 (file)
index 7215fc7..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*     make64() - make a 64 bit number from two 32 bit halves */
-/*                                                     Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <minix/compiler.h>
-#include <machine/asm.h>
-
-ENTRY(make64)
-/* u64_t make64(unsigned long lo, unsigned long hi); */
-       movl    4(%esp), %eax
-       movl    8(%esp), %edx
-       movl    %edx, (%eax)
-       movl    12(%esp), %edx
-       movl    %edx, 4(%eax)
-       ret BYTES_TO_POP_ON_STRUCT_RETURN
-
-/* */
-/* $PchId: make64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/mul64.c b/lib/libc/arch/i386/int64/mul64.c
deleted file mode 100644 (file)
index d3c12aa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <minix/u64.h>
-
-u64_t mul64(u64_t i, u64_t j)
-{
-       u64_t result;
-
-       /* Compute as follows:
-        *   i * j =
-        *   (i.hi << 32 + i.lo) * (j.hi << 32 + j.lo) =
-        *   (i.hi << 32) * (j.hi << 32 + j.lo) + i.lo * (j.hi << 32 + j.lo) =
-        *   (i.hi * j.hi) << 64 + (i.hi * j.lo) << 32 + (i.lo * j.hi << 32) + i.lo * j.lo
-        *
-        * 64-bit-result multiply only needed for (i.lo * j.lo)
-        * upper 32 bits overflow for (i.lo * j.hi) and (i.hi * j.lo)
-        * all overflows for (i.hi * j.hi)
-        */
-       result = mul64u(i.lo, j.lo);
-       result.hi += i.hi * j.lo + i.lo * j.hi; 
-       return result;
-}
diff --git a/lib/libc/arch/i386/int64/mul64u.S b/lib/libc/arch/i386/int64/mul64u.S
deleted file mode 100644 (file)
index 411a109..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*     mul64u() - unsigned long by unsigned multiply giving 64 bit result */
-/*                                                     Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <minix/compiler.h>
-#include <machine/asm.h>
-
-ENTRY(mul64u)
-/* u64_t mul64u(unsigned long i, unsigned j); */
-       movl    4(%esp), %ecx
-       movl    8(%esp), %eax
-       mull    12(%esp)
-       movl    %eax, (%ecx)
-       movl    %edx, 4(%ecx)
-       movl    %ecx, %eax
-       ret BYTES_TO_POP_ON_STRUCT_RETURN
-
-/* */
-/* $PchId: mul64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/sub64.S b/lib/libc/arch/i386/int64/sub64.S
deleted file mode 100644 (file)
index b2f7535..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*     sub64() - 64 bit subtraction                    Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <minix/compiler.h>
-#include <machine/asm.h>
-
-ENTRY(sub64)
-/* u64_t sub64(u64_t i, u64_t j); */
-       movl    4(%esp), %eax
-       movl    8(%esp), %edx
-       subl    16(%esp), %edx
-       movl    %edx, (%eax)
-       movl    12(%esp), %edx
-       sbbl    20(%esp), %edx
-       movl    %edx, 4(%eax)
-       ret BYTES_TO_POP_ON_STRUCT_RETURN
-
-/* */
-/* $PchId: sub64.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/int64/sub64u.S b/lib/libc/arch/i386/int64/sub64u.S
deleted file mode 100644 (file)
index f8001e1..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*     sub64() - unsigned from 64 bit subtraction      Author: Kees J. Bot */
-/*                                                             7 Dec 1995 */
-#include <minix/compiler.h>
-#include <machine/asm.h>
-
-ENTRY(sub64u)
-/* u64_t sub64u(u64_t i, unsigned j); */
-ENTRY(sub64ul)
-/* u64_t sub64ul(u64_t i, unsigned long j); */
-       movl    4(%esp), %eax
-       movl    8(%esp), %edx
-       subl    16(%esp), %edx
-       movl    %edx, (%eax)
-       movl    12(%esp), %edx
-       sbbl    $0, %edx
-       movl    %edx, 4(%eax)
-       ret BYTES_TO_POP_ON_STRUCT_RETURN
-
-/* */
-/* $PchId: sub64u.ack.s,v 1.2 1996/04/11 18:59:57 philip Exp $ */
diff --git a/lib/libc/arch/i386/math/Makefile.inc b/lib/libc/arch/i386/math/Makefile.inc
deleted file mode 100644 (file)
index f682d67..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# math sources
-.PATH: ${.CURDIR}/arch/${ARCH}/math
-
-SRCS+=   \
-       arch_compare.c \
-       arch_round.c   \
-       fpu_cw.S       \
-       fpu_sw.S       \
-       fpu_round.S    \
-       fegetround.c   \
-       feholdexcept.c \
-       fesetround.c
diff --git a/lib/libc/arch/i386/math/arch_compare.c b/lib/libc/arch/i386/math/arch_compare.c
deleted file mode 100644 (file)
index db085db..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-#include <assert.h>
-#include <minix/endpoint.h>
-#include <math.h>
-
-#include "fpu_cw.h"
-#include "fpu_sw.h"
-
-#define FPUSW_FLAG_MASK        \
-       (FPUSW_CONDITION_C0 | FPUSW_CONDITION_C2 | FPUSW_CONDITION_C3)
-
-#define DOUBLE_NORMAL_MIN 2.2250738585072013830902327173324e-308 /* 2^-1022 */
-
-int fpclassify(double x)
-{
-       /* use status word returned by fpu_xam to determine type */
-       switch (fpu_xam(x) & FPUSW_FLAG_MASK)
-       {
-               case FPUSW_CONDITION_C0:
-                       return FP_NAN;
-
-               case FPUSW_CONDITION_C2:
-                       /* 
-                        * unfortunately, fxam always operates on long doubles
-                        * regardless of the precision setting. This means some
-                        * subnormals are incorrectly classified as normals, 
-                        * since they can be normalized using the additional
-                        * exponent bits available. However, if we already know
-                        * that the number is normal as a long double, finding
-                        * out whether it would be subnormal as a double is just
-                        * a simple comparison.
-                        */
-                       if (-DOUBLE_NORMAL_MIN < x && x < DOUBLE_NORMAL_MIN)
-                               return FP_SUBNORMAL;
-                       else
-                               return FP_NORMAL;
-
-               case FPUSW_CONDITION_C0 | FPUSW_CONDITION_C2:
-                       return FP_INFINITE;
-
-               case FPUSW_CONDITION_C3:
-                       return FP_ZERO;
-
-               case FPUSW_CONDITION_C3 | FPUSW_CONDITION_C2:
-                       return FP_SUBNORMAL;
-       }
-
-       /* we don't expect any other case: unsupported, emtpy or reserved */
-       assert(0);
-       return -1;
-}
-
-int signbit(double x)
-{
-       u16_t sw;
-
-       /* examine and use status word to determine sign */
-       sw = fpu_xam(x);
-       return (sw & FPUSW_CONDITION_C1) ? 1 : 0;
-}
-
-#define FPUSW_GREATER  0
-#define FPUSW_LESS     FPUSW_CONDITION_C0
-#define FPUSW_EQUAL    FPUSW_CONDITION_C3
-#define FPUSW_UNORDERED        \
-       (FPUSW_CONDITION_C0 | FPUSW_CONDITION_C2 | FPUSW_CONDITION_C3)
-
-static int fpcompare(double x, double y, u16_t sw1, u16_t sw2)
-{
-       u16_t sw;
-
-       /* compare and check sanity */
-       sw = fpu_compare(x, y) & FPUSW_FLAG_MASK;
-       switch (sw)
-       {
-               case FPUSW_GREATER:
-               case FPUSW_LESS:
-               case FPUSW_EQUAL:
-               case FPUSW_UNORDERED:
-                       break;
-
-               default:
-                       /* other values are not possible (see IA32 Dev Man) */
-                       assert(0);
-                       return -1;
-       }
-
-       /* test whether FPUSW equals either sw1 or sw2 */
-       return sw == sw1 || sw == sw2;
-}
-
-int isgreater(double x, double y)
-{
-       return fpcompare(x, y, FPUSW_GREATER, -1);
-}
-
-int isgreaterequal(double x, double y)
-{
-       return fpcompare(x, y, FPUSW_GREATER, FPUSW_EQUAL);
-}
-
-int isless(double x, double y)
-{
-       return fpcompare(x, y, FPUSW_LESS, -1);
-}
-
-int islessequal(double x, double y)
-{
-       return fpcompare(x, y, FPUSW_LESS, FPUSW_EQUAL);
-}
-
-int islessgreater(double x, double y)
-{
-       return fpcompare(x, y, FPUSW_LESS, FPUSW_GREATER);
-}
-
-int isunordered(double x, double y)
-{
-       return fpcompare(x, y, FPUSW_UNORDERED, -1);
-}
diff --git a/lib/libc/arch/i386/math/arch_round.c b/lib/libc/arch/i386/math/arch_round.c
deleted file mode 100644 (file)
index a239f36..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <errno.h>
-#include <fenv.h>
-#include <math.h>
-
-#include "fpu_cw.h"
-#include "fpu_round.h"
-
-static double rndint(double x, u16_t cw_bits, u16_t cw_mask)
-{
-       u16_t cw;
-
-       /* set FPUCW to the right value */
-       cw = fpu_cw_get();
-       fpu_cw_set((cw & cw_mask) | cw_bits);
-
-       /* perform the round */
-       fpu_rndint(&x);
-       
-       /* restore FPUCW */
-       fpu_cw_set(cw);
-       return x;
-}
-
-double nearbyint(double x)
-{
-       /* round, disabling floating point precision error */
-       return rndint(x, FPUCW_EXCEPTION_MASK_PM, ~0);
-}
-
-double remainder(double x, double y)
-{
-       int xclass, yclass;
-
-       /* check arguments */
-       xclass = fpclassify(x);
-       yclass = fpclassify(y);
-       if (xclass == FP_NAN || yclass == FP_NAN)
-               return NAN;
-
-       if (xclass == FP_INFINITE || yclass == FP_ZERO)
-       {
-               errno = EDOM;
-               return NAN;
-       }
-
-       /* call the assembly implementation */
-       fpu_remainder(&x, y);
-       return x;
-}
-
-double trunc(double x)
-{
-       /* round in truncate mode, disabling floating point precision error */
-       return rndint(x, 
-               FPUCW_EXCEPTION_MASK_PM | FPUCW_ROUNDING_CONTROL_TRUNC, 
-               ~FPUCW_ROUNDING_CONTROL);
-}
diff --git a/lib/libc/arch/i386/math/fegetround.c b/lib/libc/arch/i386/math/fegetround.c
deleted file mode 100644 (file)
index f9225ad..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <assert.h>
-#include <fenv.h>
-
-#include "fpu_cw.h"
-
-int fegetround(void)
-{
-       u16_t cw;
-
-       /* read and categorize FPUCW */
-       cw = fpu_cw_get();
-       switch (cw & FPUCW_ROUNDING_CONTROL)
-       {
-               case FPUCW_ROUNDING_CONTROL_NEAREST: return FE_TONEAREST;
-               case FPUCW_ROUNDING_CONTROL_DOWN:    return FE_DOWNWARD;
-               case FPUCW_ROUNDING_CONTROL_UP:      return FE_UPWARD;
-               case FPUCW_ROUNDING_CONTROL_TRUNC:   return FE_TOWARDZERO;
-       }
-
-       /* each case has been handled, otherwise the constants are wrong */
-       assert(0);
-       return -1;
-}
diff --git a/lib/libc/arch/i386/math/feholdexcept.c b/lib/libc/arch/i386/math/feholdexcept.c
deleted file mode 100644 (file)
index 70a4937..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <fenv.h>
-
-#include "fpu_cw.h"
-#include "fpu_sw.h"
-
-int feholdexcept(fenv_t *envp)
-{
-       /* read FPUCW and FPUSW */
-       envp->cw = fpu_cw_get();
-       envp->sw = fpu_sw_get();
-       
-       /* update FPUCW to block exceptions */
-       fpu_cw_set(envp->cw | FPUCW_EXCEPTION_MASK);
-
-       return 0;
-}
diff --git a/lib/libc/arch/i386/math/fesetround.c b/lib/libc/arch/i386/math/fesetround.c
deleted file mode 100644 (file)
index 131d644..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <errno.h>
-#include <fenv.h>
-
-#include "fpu_cw.h"
-
-int fesetround(int round)
-{
-       u16_t cw;
-
-       /* read and update FPUCW */
-       cw = fpu_cw_get() & ~FPUCW_ROUNDING_CONTROL;
-       switch (round)
-       {
-               case FE_TONEAREST: cw |= FPUCW_ROUNDING_CONTROL_NEAREST; break;
-               case FE_DOWNWARD: cw |= FPUCW_ROUNDING_CONTROL_DOWN; break;
-               case FE_UPWARD: cw |= FPUCW_ROUNDING_CONTROL_UP; break;
-               case FE_TOWARDZERO: cw |= FPUCW_ROUNDING_CONTROL_TRUNC; break;
-
-               default:
-                       errno = EINVAL;
-                       return -1;
-       }
-
-       /* set FPUCW to the updated value */
-       fpu_cw_set(cw);
-       return 0;
-}
diff --git a/lib/libc/arch/i386/math/fpu_cw.S b/lib/libc/arch/i386/math/fpu_cw.S
deleted file mode 100644 (file)
index 373330a..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*     fpu_cw_get() - get FPU control word     Author: Erik van der Kouwe */
-/*     fpu_cw_set() - set FPU control word     9 Dec 2009 */
-#include <machine/asm.h>
-
-/* u16_t fpu_cw_get(void) */
-ENTRY(fpu_cw_get)
-/* clear unused bits just to be sure */
-       xor     %eax, %eax
-       push    %eax
-       fstcw   (%esp)
-       pop     %eax
-       ret
-
-/* void fpu_cw_set(u16_t fpu_cw) */
-ENTRY(fpu_cw_set)
-/* load control word from parameter */
-       fldcw   4(%esp)
-       ret
diff --git a/lib/libc/arch/i386/math/fpu_cw.h b/lib/libc/arch/i386/math/fpu_cw.h
deleted file mode 100644 (file)
index f981cab..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef __FPU_CW__
-#define __FPU_CW__
-
-#include <stdint.h>
-
-/* 
- * see section 8.1.5 "x87 FPU Control Word" in "Intel 64 and IA-32 Architectures 
- * Software Developer's Manual Volume 1 Basic Architecture" 
- */
-#define FPUCW_EXCEPTION_MASK    0x003f
-#define FPUCW_EXCEPTION_MASK_IM 0x0001
-#define FPUCW_EXCEPTION_MASK_DM 0x0002
-#define FPUCW_EXCEPTION_MASK_ZM 0x0004
-#define FPUCW_EXCEPTION_MASK_OM 0x0008
-#define FPUCW_EXCEPTION_MASK_UM 0x0010
-#define FPUCW_EXCEPTION_MASK_PM 0x0020
-
-#define FPUCW_PRECISION_CONTROL         0x0300
-#define FPUCW_PRECISION_CONTROL_SINGLE  0x0000
-#define FPUCW_PRECISION_CONTROL_DOUBLE  0x0200
-#define FPUCW_PRECISION_CONTROL_XDOUBLE 0x0300
-
-#define FPUCW_ROUNDING_CONTROL         0x0c00
-#define FPUCW_ROUNDING_CONTROL_NEAREST 0x0000
-#define FPUCW_ROUNDING_CONTROL_DOWN    0x0400
-#define FPUCW_ROUNDING_CONTROL_UP      0x0800
-#define FPUCW_ROUNDING_CONTROL_TRUNC   0x0c00
-
-/* get and set FPU control word */
-u16_t fpu_cw_get(void);
-void fpu_cw_set(u16_t fpu_cw);
-
-#endif /* !defined(__FPU_CW__) */
diff --git a/lib/libc/arch/i386/math/fpu_round.S b/lib/libc/arch/i386/math/fpu_round.S
deleted file mode 100644 (file)
index 80c67f0..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*     fpu_rndint() - round integer    Author: Erik van der Kouwe */
-/*                                     17 Dec 2009 */
-#include <machine/asm.h>
-
-/* void fpu_rndint(double *value) */
-ENTRY(fpu_rndint)
-/* move the value onto the floating point stack */
-       mov     4(%esp), %eax
-       fldl    (%eax)
-
-/* round it (beware of precision exception!) */
-       frndint
-
-/* store the result */
-       fstpl   (%eax)
-       ret
-
-/* void fpu_remainder(double *x, double y) */
-ENTRY(fpu_remainder)
-/* move the values onto the floating point stack */
-       fldl    8(%esp)
-       mov     4(%esp), %edx
-       fldl    (%edx)
-
-/* compute remainder, multiple iterations may be needed */
-1:
-       fprem1
-.byte  0xdf, 0xe0      /* fnstsw       ax */
-       sahf
-       jp      1b
-
-/* store the result and pop the divisor */
-       fstpl   (%edx)
-       fstp    %st
-       ret
diff --git a/lib/libc/arch/i386/math/fpu_round.h b/lib/libc/arch/i386/math/fpu_round.h
deleted file mode 100644 (file)
index d5b482f..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __FPU_RNDINT__
-#define __FPU_RNDINT__
-
-void fpu_rndint(double *value);
-void fpu_remainder(double *x, double y);
-
-#endif /* !defined(__FPU_RNDINT__) */
diff --git a/lib/libc/arch/i386/math/fpu_sw.S b/lib/libc/arch/i386/math/fpu_sw.S
deleted file mode 100644 (file)
index 85a9bf3..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* fpu_compare() - compare doubles     Author: Erik van der Kouwe */
-/* fpu_sw_get() - get FPU status       17 Dec 2009 */
-/* fpu_xam() - examine double */
-#include <machine/asm.h>
-
-/* u16_t fpu_compare(double x, double y) */
-ENTRY(fpu_compare)
-/* move the values onto the floating point stack */
-       fldl    12(%esp)
-       fldl    4(%esp)
-
-/* compare values and return status word */
-       fcompp
-       jmp     _C_LABEL(fpu_sw_get)
-
-/* u16_t fpu_sw_get(void) */
-ENTRY(fpu_sw_get)
-/* clear unused high-order word and get status word */
-       xor     %eax, %eax
-.byte  0xdf, 0xe0      /* fnstsw       ax */
-       ret
-
-/* u16_t fpu_xam(double value) */
-ENTRY(fpu_xam)
-/* move the value onto the floating point stack */
-       fldl    4(%esp)
-
-/* examine value and get status word */
-       fxam
-       call    _C_LABEL(fpu_sw_get)
-
-/* pop the value */
-       fstp    %st
-       ret
diff --git a/lib/libc/arch/i386/math/fpu_sw.h b/lib/libc/arch/i386/math/fpu_sw.h
deleted file mode 100644 (file)
index e66889d..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef __FPU_SW__
-#define __FPU_SW__
-
-#include <stdint.h>
-
-#define FPUSW_EXCEPTION_IE  0x0001
-#define FPUSW_EXCEPTION_DE  0x0002
-#define FPUSW_EXCEPTION_ZE  0x0004
-#define FPUSW_EXCEPTION_OE  0x0008
-#define FPUSW_EXCEPTION_UE  0x0010
-#define FPUSW_EXCEPTION_PE  0x0020
-#define FPUSW_STACK_FAULT   0x0040
-#define FPUSW_ERROR_SUMMARY 0x0080
-#define FPUSW_CONDITION_C0  0x0100
-#define FPUSW_CONDITION_C1  0x0200
-#define FPUSW_CONDITION_C2  0x0400
-#define FPUSW_CONDITION_C3  0x4000
-#define FPUSW_BUSY          0x8000
-
-u16_t fpu_compare(double x, double y);
-u16_t fpu_sw_get(void);
-void fpu_sw_set(u16_t value);
-u16_t fpu_xam(double value);
-
-#endif /* !defined(__FPU_SW__) */
-
diff --git a/lib/libc/arch/i386/misc/Makefile.inc b/lib/libc/arch/i386/misc/Makefile.inc
deleted file mode 100644 (file)
index 3f67277..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# misc sources
-.PATH: ${.CURDIR}/arch/${ARCH}/misc
-
-SRCS+=  \
-       _cpuid.S \
-       _cpufeature.c \
-       alloca.S \
-       get_bp.S \
-       getprocessor.S \
-       oneC_sum.S \
-       ucontext.S
-
diff --git a/lib/libc/arch/i386/misc/_cpufeature.c b/lib/libc/arch/i386/misc/_cpufeature.c
deleted file mode 100644 (file)
index e74ed10..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-
-#include <stdint.h>
-#include <minix/minlib.h>
-#include <minix/cpufeature.h>
-#include <machine/vm.h>
-
-int _cpufeature(int cpufeature)
-{
-       u32_t eax, ebx, ecx, edx;
-       int proc;
-
-       eax = ebx = ecx = edx = 0;
-       proc = getprocessor();
-
-       /* If processor supports CPUID and its CPUID supports enough
-        * parameters, retrieve EDX feature flags to test against.
-        */
-       if(proc >= 586) {
-               eax = 0;
-               _cpuid(&eax, &ebx, &ecx, &edx);
-               if(eax > 0) {
-                       eax = 1;
-                       _cpuid(&eax, &ebx, &ecx, &edx);
-               }
-       }
-
-       switch(cpufeature) {
-               case _CPUF_I386_PSE:
-                       return edx & CPUID1_EDX_PSE;
-               case _CPUF_I386_PGE:
-                       return edx & CPUID1_EDX_PGE;
-               case _CPUF_I386_APIC_ON_CHIP:
-                       return edx & CPUID1_EDX_APIC_ON_CHIP;
-               case _CPUF_I386_TSC:
-                       return edx & CPUID1_EDX_TSC;
-               case _CPUF_I386_FPU:
-                       return edx & CPUID1_EDX_FPU;
-#define SSE_FULL_EDX (CPUID1_EDX_FXSR | CPUID1_EDX_SSE | CPUID1_EDX_SSE2)
-#define SSE_FULL_ECX (CPUID1_ECX_SSE3 | CPUID1_ECX_SSSE3 | \
-       CPUID1_ECX_SSE4_1 | CPUID1_ECX_SSE4_2)
-               case _CPUF_I386_SSE1234_12:
-                       return  (edx & SSE_FULL_EDX) == SSE_FULL_EDX &&
-                               (ecx & SSE_FULL_ECX) == SSE_FULL_ECX;
-               case _CPUF_I386_FXSR:
-                       return edx & CPUID1_EDX_FXSR;
-               case _CPUF_I386_SSE:
-                       return edx & CPUID1_EDX_SSE;
-               case _CPUF_I386_SSE2:
-                       return edx & CPUID1_EDX_SSE2;
-               case _CPUF_I386_SSE3:
-                       return ecx & CPUID1_ECX_SSE3;
-               case _CPUF_I386_SSSE3:
-                       return ecx & CPUID1_ECX_SSSE3;
-               case _CPUF_I386_SSE4_1:
-                       return ecx & CPUID1_ECX_SSE4_1;
-               case _CPUF_I386_SSE4_2:
-                       return ecx & CPUID1_ECX_SSE4_2;
-               case _CPUF_I386_HTT:
-                       return edx & CPUID1_EDX_HTT;
-               case _CPUF_I386_HTT_MAX_NUM:
-                       return (ebx >> 16) & 0xff;
-       }
-
-       return 0;
-}
-
diff --git a/lib/libc/arch/i386/misc/alloca.S b/lib/libc/arch/i386/misc/alloca.S
deleted file mode 100644 (file)
index cf7251c..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* */
-/*     alloca() - allocate space on the stack          Author: Kees J. Bot */
-/*                                                             2 Dec 1993 */
-
-#include <machine/asm.h>
-
-ENTRY(alloca)
-#if __ACK__
-       pop     %ecx    /* Return address */
-       pop     %eax    /* Bytes to allocate */
-       addl    $2*4+3, %eax    /* Add space for two saved register variables */
-       andb    $0xF8, %al      /* Align */
-       movl    %esp, %ebx      /* Keep current esp */
-       subl    %eax, %esp      /* Lower stack */
-       movl    %esp, %eax      /* Return value */
-       push    4(%ebx) /* Push what is probably the saved esi */
-       push    (%ebx)  /* Saved edi */
-/* Now ACK can still do: */
-/*     pop edi; pop esi; leave; ret */
-       push    %eax    /* Dummy argument */
-       jmp     *%ecx
-#else
-       pop     %ecx    /* Return address */
-       pop     %eax    /* Bytes to allocate */
-       addl    $3, %eax
-       andb    $0xF8, %al      /* Align */
-       subl    %eax, %esp      /* Lower stack */
-       movl    %esp, %eax      /* Return value */
-       push    %eax    /* Dummy argument */
-       jmp     *%ecx
-#endif
diff --git a/lib/libc/arch/i386/rts/Makefile.inc b/lib/libc/arch/i386/rts/Makefile.inc
deleted file mode 100644 (file)
index 9919524..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# rts sources
-.PATH: ${.CURDIR}/arch/${ARCH}/rts
-
-SRCS+=   \
-       __sigreturn.S \
-       _ipc.S \
-       _senda.S \
-       brksize.S
index b01f09f72ffe792d260c42655d6b556059fc2759..c1611747ac004a60df2a2769768a1c398723d842 100644 (file)
@@ -1,29 +1,6 @@
-# string sources
-.PATH: ${.CURDIR}/arch/${ARCH}/string
+#      $NetBSD: Makefile.inc,v 1.5 2009/07/30 20:57:16 dsl Exp $
 
-SRCS+=  \
-       _memmove.S \
-       _strncat.S \
-       _strncmp.S \
-       _strncpy.S \
-       _strnlen.S \
-       bcmp.S \
-       bcopy.S \
-       bzero.S \
-       index.S \
-       memchr.S \
-       memcmp.S \
-       memcpy.S \
-       memmove.S \
-       memset.S \
-       rindex.S \
-       strcat.S \
-       strchr.S \
-       strcmp.S \
-       strcpy.S \
-       strlen.S \
-       strncat.S \
-       strncmp.S \
-       strncpy.S \
-       strnlen.S \
-       strrchr.S
+# objects built from assembler sources
+SRCS+= bcmp.S bcopy.S bzero.S ffs.S memchr.S memcmp.S \
+       memcpy.S memmove.S memset.S strcat.S strchr.S \
+       strcmp.S strcpy.S strlen.S strncmp.S strrchr.S swab.S
diff --git a/lib/libc/arch/i386/string/README b/lib/libc/arch/i386/string/README
deleted file mode 100644 (file)
index 93bad44..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-Notes on i80386 string assembly routines.              Author: Kees J. Bot
-                                                               2 Jan 1994
-
-Remarks.
-    All routines set up proper stack frames, so that stack traces can be
-    derived from core dumps.  String routines are often the ones that
-    get the bad pointer.
-
-    Flags are often not right in boundary cases (zero string length) on
-    repeated string scanning or comparing instructions.  This has been
-    handled in sometimes nonobvious ways.
-
-    Only the eax, edx, and ecx registers are not preserved, all other
-    registers are.  This is what GCC expects.  (ACK sees ebx as scratch
-    too.)  The direction byte is assumed to be wrong, and left clear on
-    exit.
-
-Assumptions.
-    The average string is short, so short strings should not suffer from
-    smart tricks to copy, compare, or search large strings fast.  This
-    means that the routines are fast on average, but not optimal for
-    long strings.
-
-    It doesn't pay to use word or longword operations on strings, the
-    setup time hurts the average case.
-
-    Memory blocks are probably large and on word or longword boundaries.
-
-    No unaligned word moves are done.  Again the setup time may hurt the
-    average case.  Furthermore, the author likes to enable the alignment
-    check on a 486.
-
-String routines.
-    They have been implemented using byte string instructions.  The
-    length of a string it usually determined first, followed by the
-    actual operation.
-
-Strcmp.
-    This is the only string routine that uses a loop, and not
-    instructions with a repeat prefix.  Problem is that we don't know
-    how long the string is.  Scanning for the end costs if the strings
-    are unequal in the first few bytes.
-
-Strchr.
-    The character we look for is often not there, or at some distance
-    from the start.  The string is scanned twice, for the terminating
-    zero and the character searched, in chunks of increasing length.
-
-Memory routines.
-    Memmove, memcpy, and memset use word or longword instructions if the
-    address(es) are at word or longword boundaries.  No tricks to get
-    alignment after doing a few bytes.  No unaligned operations.
diff --git a/lib/libc/arch/i386/string/_memmove.S b/lib/libc/arch/i386/string/_memmove.S
deleted file mode 100644 (file)
index 8e85790..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*     _memmove()                                      Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
-
-/* void *_memmove(void *s1, const void *s2, size_t n) */
-/*     Copy a chunk of memory.  Handle overlap. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(_memmove)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %esi
-       push    %edi
-       movl    8(%ebp), %edi   /* String s1 */
-       movl    12(%ebp), %esi  /* String s2 */
-       movl    16(%ebp), %ecx  /* Length */
-       movl    %edi, %eax
-       subl    %esi, %eax
-       cmpl    %ecx, %eax
-       jb      downwards       /* if (s2 - s1) < n then copy downwards */
-LABEL(_memcpy)
-       cld     /* Clear direction bit: upwards */
-       cmpl    $16, %ecx
-       jb      upbyte  /* Don't bother being smart with short arrays */
-       movl    %esi, %eax
-       orl     %edi, %eax
-       testb   $1, %al
-       jne     upbyte  /* Bit 0 set, use byte copy */
-       testb   $2, %al
-       jne     upword  /* Bit 1 set, use word copy */
-uplword:
-       shrdl   $2, %ecx, %eax  /* Save low 2 bits of ecx in eax */
-       shrl    $2, %ecx
-
-       rep movsl       /* Copy longwords. */
-       shldl   $2, %eax, %ecx  /* Restore excess count */
-upword:
-       shrl    $1, %ecx
-
-       rep movsw       /* Copy words */
-       adcl    %ecx, %ecx      /* One more byte? */
-upbyte:
-       rep movsb       /* Copy bytes */
-done:
-       movl    8(%ebp), %eax   /* Absolutely noone cares about this value */
-       pop     %edi
-       pop     %esi
-       pop     %ebp
-       ret
-
-/* Handle bad overlap by copying downwards, don't bother to do word copies. */
-downwards:
-       std     /* Set direction bit: downwards */
-       leal    -1(%esi,%ecx,1), %esi
-       leal    -1(%edi,%ecx,1), %edi
-
-       rep movsb       /* Copy bytes */
-       cld
-       jmp     done
diff --git a/lib/libc/arch/i386/string/_strncat.S b/lib/libc/arch/i386/string/_strncat.S
deleted file mode 100644 (file)
index d985751..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*     _strncat()                                      Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* char *_strncat(char *s1, const char *s2, size_t edx) */
-/*     Append string s2 to s1. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(_strncat)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %esi
-       push    %edi
-       movl    8(%ebp), %edi   /* String s1 */
-       movl    $-1, %ecx
-       xorb    %al, %al        /* Null byte */
-       cld
-
-       repne scasb     /* Look for the zero byte in s1 */
-       decl    %edi    /* Back one up (and clear 'Z' flag) */
-       push    %edi    /* Save end of s1 */
-       movl    12(%ebp), %edi  /* edi = string s2 */
-       movl    %edx, %ecx      /* Maximum count */
-
-       repne scasb     /* Look for the end of s2 */
-       jne     no0
-       incl    %ecx    /* Exclude null byte */
-no0:
-       subl    %ecx, %edx      /* Number of bytes in s2 */
-       movl    %edx, %ecx
-       movl    12(%ebp), %esi  /* esi = string s2 */
-       pop     %edi    /* edi = end of string s1 */
-
-       rep movsb       /* Copy bytes */
-       stosb   /* Add a terminating null */
-       movl    8(%ebp), %eax   /* Return s1 */
-       pop     %edi
-       pop     %esi
-       pop     %ebp
-       ret
diff --git a/lib/libc/arch/i386/string/_strncmp.S b/lib/libc/arch/i386/string/_strncmp.S
deleted file mode 100644 (file)
index 9fb90ca..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*     strncmp()                                       Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* int strncmp(const char *s1, const char *s2, size_t ecx) */
-/*     Compare two strings. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(_strncmp)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %esi
-       push    %edi
-       testl   %ecx, %ecx      /* Max length is zero? */
-       je      done
-       movl    8(%ebp), %esi   /* esi = string s1 */
-       movl    12(%ebp), %edi  /* edi = string s2 */
-       cld
-compare:
-       cmpsb   /* Compare two bytes */
-       jne     done
-       cmpb    $0, -1(%esi)    /* End of string? */
-       je      done
-       decl    %ecx    /* Length limit reached? */
-       jne     compare
-done:
-       seta    %al     /* al = (s1 > s2) */
-       setb    %ah     /* ah = (s1 < s2) */
-       subb    %ah, %al
-       movsbl  %al, %eax       /* eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1 */
-       pop     %edi
-       pop     %esi
-       pop     %ebp
-       ret
diff --git a/lib/libc/arch/i386/string/_strncpy.S b/lib/libc/arch/i386/string/_strncpy.S
deleted file mode 100644 (file)
index 9128d8d..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*     _strncpy()                                      Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* char *_strncpy(char *s1, const char *s2, size_t ecx) */
-/*     Copy string s2 to s1. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(_strncpy)
-       movl    12(%ebp), %edi  /* edi = string s2 */
-       xorb    %al, %al        /* Look for a zero byte */
-       movl    %ecx, %edx      /* Save maximum count */
-       cld
-
-       repne scasb     /* Look for end of s2 */
-       subl    %ecx, %edx      /* Number of bytes in s2 including null */
-       xchgl   %edx, %ecx
-       movl    12(%ebp), %esi  /* esi = string s2 */
-       movl    8(%ebp), %edi   /* edi = string s1 */
-
-       rep movsb       /* Copy bytes */
-       ret
diff --git a/lib/libc/arch/i386/string/_strnlen.S b/lib/libc/arch/i386/string/_strnlen.S
deleted file mode 100644 (file)
index 9d586a7..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*     _strnlen()                                      Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* size_t _strnlen(const char *s, size_t ecx) */
-/*     Return the length of a string. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(_strnlen)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %edi
-       movl    8(%ebp), %edi   /* edi = string */
-       xorb    %al, %al        /* Look for a zero byte */
-       movl    %ecx, %edx      /* Save maximum count */
-       cmpb    $1, %cl /* 'Z' bit must be clear if ecx = 0 */
-       cld
-
-       repne scasb     /* Look for zero */
-       jne     no0
-       incl    %ecx    /* Don't count zero byte */
-no0:
-       movl    %edx, %eax
-       subl    %ecx, %eax      /* Compute bytes scanned */
-       pop     %edi
-       pop     %ebp
-       ret
index ece14b4c03b6852340689d1ff35542d4314b170e..3ea341e0c3177a5eeae0013c65331215530fd4b9 100644 (file)
@@ -1,27 +1,34 @@
-/*     bcmp()                                          Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
+/*
+ * Written by J.T. Conklin <jtc@NetBSD.org>.
+ * Public domain.
+ */
 
-/* int bcmp(const void *s1, const void *s2, size_t n) */
-/*     Compare two chunks of memory. */
-/*     This is a BSD routine that escaped from the kernel.  Don't use. */
-/*     (Alas it is not without some use, it reports the number of bytes */
-/*     after the bytes that are equal.  So it can't be simply replaced.) */
-/* */
 #include <machine/asm.h>
 
+#if defined(LIBC_SCCS)
+       RCSID("$NetBSD: bcmp.S,v 1.9 2007/11/12 18:41:59 ad Exp $")
+#endif
+
 ENTRY(bcmp)
-       push    %ebp
-       movl    %esp, %ebp
-       push    16(%ebp)
-       push    12(%ebp)
-       push    8(%ebp)
-       call    _C_LABEL(memcmp) /* Let memcmp do the work */
-       testl   %eax, %eax
-       je      equal
-       subl    8(%ebp), %edx   /* Memcmp was nice enough to leave "esi" in edx */
-       decl    %edx    /* Number of bytes that are equal */
-       movl    16(%ebp), %eax
-       subl    %edx, %eax      /* Number of bytes that are unequal */
-equal:
-       leave
+       pushl   %edi
+       pushl   %esi
+       movl    12(%esp),%edi
+       movl    16(%esp),%esi
+       xorl    %eax,%eax               /* clear return value */
+
+       movl    20(%esp),%ecx           /* compare by words */
+       shrl    $2,%ecx
+       repe
+       cmpsl
+       jne     L1
+
+       movl    20(%esp),%ecx           /* compare remainder by bytes */
+       andl    $3,%ecx
+       repe
+       cmpsb
+       je      L2
+
+L1:    incl    %eax
+L2:    popl    %esi
+       popl    %edi
        ret
index 9d68340e5376e423d415e95cc19d14f56c061e94..35fb1df2d3c5189c83a425b6fa99522448080064 100644 (file)
@@ -1,14 +1,4 @@
-/*     bcopy()                                         Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
+/*     $NetBSD: bcopy.S,v 1.15 2005/02/09 18:15:16 christos Exp $      */
 
-/* void bcopy(const void *s1, void *s2, size_t n) */
-/*     Copy a chunk of memory.  Handle overlap. */
-/*     This is a BSD routine that escaped from the kernel.  Don't use. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(bcopy)
-       movl    4(%esp), %eax   /* Exchange string arguments */
-       xchgl   8(%esp), %eax
-       movl    %eax, 4(%esp)
-       jmp     _C_LABEL(_memmove) /* Call the proper routine */
+#define BCOPY
+#include "memcpy.S"
index 0782164ba3a50d9997f6bff51ce436ec32747de2..f837447419ad2739434f4a62acee9d328f45e1dd 100644 (file)
@@ -1,18 +1,4 @@
-/*     bzero()                                         Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
+/*     $NetBSD: bzero.S,v 1.12 2005/02/09 18:15:16 christos Exp $      */
 
-/* void bzero(void *s, size_t n) */
-/*     Set a chunk of memory to zero. */
-/*     This is a BSD routine that escaped from the kernel.  Don't use. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(bzero)
-       push    %ebp
-       movl    %esp, %ebp
-       push    12(%ebp)        /* Size */
-       push    $0      /* Zero */
-       push    8(%ebp) /* String */
-       call    _C_LABEL(memset) /* Call the proper routine */
-       leave
-       ret
+#define BZERO
+#include "memset.S"
index 6d77cef408dc03096b935ca656c3002fe565a5af..bda26bbe1baf68b08e09b48854f029bcc9835b16 100644 (file)
@@ -1,11 +1,4 @@
-/*     index()                                         Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
+/* $NetBSD: index.S,v 1.14 2005/02/09 18:15:16 christos Exp $ */
 
-/* char *index(const char *s, int c) */
-/*     Look for a character in a string.  Has suffered from a hostile */
-/*     takeover by strchr(). */
-/* */
-#include <machine/asm.h>
-
-ENTRY(index)
-       jmp     _C_LABEL(strchr)
+#define INDEX
+#include "strchr.S"
diff --git a/lib/libc/arch/i386/string/memchr.S b/lib/libc/arch/i386/string/memchr.S
deleted file mode 100644 (file)
index 64a5df2..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*     memchr()                                        Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
-
-/* void *memchr(const void *s, int c, size_t n) */
-/*     Look for a character in a chunk of memory. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(memchr)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %edi
-       movl    8(%ebp), %edi   /* edi = string */
-       movb    12(%ebp), %al   /* The character to look for */
-       movl    16(%ebp), %ecx  /* Length */
-       cmpb    $1, %cl /* 'Z' bit must be clear if ecx = 0 */
-       cld
-
-       repne scasb
-       jne     failure
-       leal    -1(%edi), %eax  /* Found */
-       pop     %edi
-       pop     %ebp
-       ret
-failure:
-       xorl    %eax, %eax
-       pop     %edi
-       pop     %ebp
-       ret
diff --git a/lib/libc/arch/i386/string/memcmp.S b/lib/libc/arch/i386/string/memcmp.S
deleted file mode 100644 (file)
index e7e23d9..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*     memcmp()                                        Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
-
-/* int memcmp(const void *s1, const void *s2, size_t n) */
-/*     Compare two chunks of memory. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(memcmp)
-       cld
-       push    %ebp
-       movl    %esp, %ebp
-       push    %esi
-       push    %edi
-       movl    8(%ebp), %esi   /* String s1 */
-       movl    12(%ebp), %edi  /* String s2 */
-       movl    16(%ebp), %ecx  /* Length */
-       cmpl    $16, %ecx
-       jb      cbyte   /* Don't bother being smart with short arrays */
-       movl    %esi, %eax
-       orl     %edi, %eax
-       testb   $1, %al
-       jne     cbyte   /* Bit 0 set, use byte compare */
-       testb   $2, %al
-       jne     cword   /* Bit 1 set, use word compare */
-clword:
-       shrdl   $2, %ecx, %eax  /* Save low two bits of ecx in eax */
-       shrl    $2, %ecx
-
-       repe cmpsl      /* Compare longwords */
-       subl    $4, %esi
-       subl    $4, %edi
-       incl    %ecx    /* Recompare the last longword */
-       shldl   $2, %eax, %ecx  /* And any excess bytes */
-       jmp     last
-cword:
-       shrdl   $1, %ecx, %eax  /* Save low bit of ecx in eax */
-       shrl    $1, %ecx
-
-       repe cmpsw      /* Compare words */
-       subl    $2, %esi
-       subl    $2, %edi
-       incl    %ecx    /* Recompare the last word */
-       shldl   $1, %eax, %ecx  /* And one more byte? */
-cbyte:
-       testl   %ecx, %ecx      /* Set 'Z' flag if ecx = 0 */
-last:
-       repe cmpsb      /* Look for the first differing byte */
-       seta    %al     /* al = (s1 > s2) */
-       setb    %ah     /* ah = (s1 < s2) */
-       subb    %ah, %al
-       movsbl  %al, %eax       /* eax = (s1 > s2) - (s1 < s2), i.e. -1, 0, 1 */
-       movl    %esi, %edx      /* For bcmp() to play with */
-       pop     %edi
-       pop     %esi
-       pop     %ebp
-       ret
diff --git a/lib/libc/arch/i386/string/memcpy.S b/lib/libc/arch/i386/string/memcpy.S
deleted file mode 100644 (file)
index 98c7992..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*     memcpy()                                        Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
-
-/* void *memcpy(void *s1, const void *s2, size_t n) */
-/*     Copy a chunk of memory. */
-/*     This routine need not handle overlap, so it does not handle overlap. */
-/*     One could simply call __memmove, the cost of the overlap check is */
-/*     negligible, but you are dealing with a programmer who believes that if */
-/*     anything can go wrong, it should go wrong. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(memcpy)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %esi
-       push    %edi
-       movl    8(%ebp), %edi   /* String s1 */
-       movl    12(%ebp), %esi  /* String s2 */
-       movl    16(%ebp), %ecx  /* Length */
-/* No overlap check here */
-       jmp     _C_LABEL(_memcpy) /* Call the part of __memmove that copies up */
diff --git a/lib/libc/arch/i386/string/memmove.S b/lib/libc/arch/i386/string/memmove.S
deleted file mode 100644 (file)
index b790464..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/*     memmove()                                       Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
-
-/* void *memmove(void *s1, const void *s2, size_t n) */
-/*     Copy a chunk of memory.  Handle overlap. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(memmove)
-       jmp     _C_LABEL(_memmove)      /* Call common code */
diff --git a/lib/libc/arch/i386/string/memset.S b/lib/libc/arch/i386/string/memset.S
deleted file mode 100644 (file)
index 16d0166..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*     memset()                                        Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
-
-/* void *memset(void *s, int c, size_t n) */
-/*     Set a chunk of memory to the same byte value. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(memset)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %edi
-       movl    8(%ebp), %edi   /* The string */
-       movzbl  12(%ebp), %eax  /* The fill byte */
-       movl    16(%ebp), %ecx  /* Length */
-       cld
-       cmpl    $16, %ecx
-       jb      sbyte   /* Don't bother being smart with short arrays */
-       testl   $1, %edi
-       jne     sbyte   /* Bit 0 set, use byte store */
-       testl   $2, %edi
-       jne     sword   /* Bit 1 set, use word store */
-slword:
-       movb    %al, %ah
-       movl    %eax, %edx
-       sall    $16, %edx
-       orl     %edx, %eax      /* One byte to four bytes */
-       shrdl   $2, %ecx, %edx  /* Save low two bits of ecx in edx */
-       shrl    $2, %ecx
-
-       rep stosl       /* Store longwords. */
-       shldl   $2, %edx, %ecx  /* Restore low two bits */
-sword:
-       movb    %al, %ah        /* One byte to two bytes */
-       shrl    $1, %ecx
-
-       rep stosw       /* Store words */
-       adcl    %ecx, %ecx      /* One more byte? */
-sbyte:
-       rep stosb       /* Store bytes */
-done:
-       movl    8(%ebp), %eax   /* Return some value you have no need for */
-       pop     %edi
-       pop     %ebp
-       ret
index b2073bd23e7ad5501edf64ad8ab8ec54602241f8..f39cc2c47cf882421ae9c19057d0123b72de7e38 100644 (file)
@@ -1,11 +1,4 @@
-/*     rindex()                                        Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
+/* $NetBSD: rindex.S,v 1.14 2005/02/09 18:15:16 christos Exp $ */
 
-/* char *rindex(const char *s, int c) */
-/*     Look for the last occurrence a character in a string.  Has suffered */
-/*     from a hostile takeover by strrchr(). */
-/* */
-#include <machine/asm.h>
-
-ENTRY(rindex)
-       jmp     _C_LABEL(strrchr)
+#define RINDEX
+#include "strrchr.S"
diff --git a/lib/libc/arch/i386/string/strcat.S b/lib/libc/arch/i386/string/strcat.S
deleted file mode 100644 (file)
index 589da58..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*     strcat()                                        Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* char *strcat(char *s1, const char *s2) */
-/*     Append string s2 to s1. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(strcat)
-       movl    $-1, %edx       /* Unlimited length */
-       jmp     _C_LABEL(_strncat) /* Common code */
diff --git a/lib/libc/arch/i386/string/strchr.S b/lib/libc/arch/i386/string/strchr.S
deleted file mode 100644 (file)
index 3f27568..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*     strchr()                                        Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* char *strchr(const char *s, int c) */
-/*     Look for a character in a string. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(strchr)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %edi
-       cld
-       movl    8(%ebp), %edi   /* edi = string */
-       movl    $16, %edx       /* Look at small chunks of the string */
-next:
-       shll    $1, %edx        /* Chunks become bigger each time */
-       movl    %edx, %ecx
-       xorb    %al, %al        /* Look for the zero at the end */
-
-       repne scasb
-       pushf   /* Remember the flags */
-       subl    %edx, %ecx
-       negl    %ecx    /* Some or all of the chunk */
-       subl    %ecx, %edi      /* Step back */
-       movb    12(%ebp), %al   /* The character to look for */
-
-       repne scasb
-       je      found
-       popf    /* Did we find the end of string earlier? */
-       jne     next    /* No, try again */
-       xorl    %eax, %eax      /* Return NULL */
-       pop     %edi
-       pop     %ebp
-       ret
-found:
-       pop     %eax    /* Get rid of those flags */
-       leal    -1(%edi), %eax  /* Address of byte found */
-       pop     %edi
-       pop     %ebp
-       ret
diff --git a/lib/libc/arch/i386/string/strcmp.S b/lib/libc/arch/i386/string/strcmp.S
deleted file mode 100644 (file)
index 9d57739..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*     strcmp()                                        Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* int strcmp(const char *s1, const char *s2) */
-/*     Compare two strings. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(strcmp)
-       movl    $-1, %ecx       /* Unlimited length */
-       jmp     _C_LABEL(_strncmp) /* Common code */
diff --git a/lib/libc/arch/i386/string/strcpy.S b/lib/libc/arch/i386/string/strcpy.S
deleted file mode 100644 (file)
index 03be30d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*     strcpy()                                        Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* char *strcpy(char *s1, const char *s2) */
-/*     Copy string s2 to s1. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(strcpy)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %esi
-       push    %edi
-       movl    $-1, %ecx       /* Unlimited length */
-       call    _C_LABEL(_strncpy) /* Common code */
-       movl    8(%ebp), %eax   /* Return s1 */
-       pop     %edi
-       pop     %esi
-       pop     %ebp
-       ret
diff --git a/lib/libc/arch/i386/string/strlen.S b/lib/libc/arch/i386/string/strlen.S
deleted file mode 100644 (file)
index 1dd4aea..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*     strlen()                                        Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* size_t strlen(const char *s) */
-/*     Return the length of a string. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(strlen)
-       movl    $-1, %ecx       /* Unlimited length */
-       jmp     _C_LABEL(_strnlen) /* Common code */
diff --git a/lib/libc/arch/i386/string/strncat.S b/lib/libc/arch/i386/string/strncat.S
deleted file mode 100644 (file)
index 23731e7..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*     strncat()                                       Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* size_t strncat(char *s1, const char *s2, size_t n) */
-/*     Append string s2 to s1. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(strncat)
-       movl    12(%esp), %edx  /* Maximum length */
-       jmp     _C_LABEL(_strncat) /* Common code */
index 0c5b8ba2a489bb85e78344c7dfb66613f5b79ba3..45b1ce21ff28dba9fd00fbcdb5020cf59f48e472 100644 (file)
-/*     strncmp()                                       Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
+/*
+ * Written by J.T. Conklin <jtc@NetBSD.org>.
+ * Public domain.
+ */
 
-/* int strncmp(const char *s1, const char *s2, size_t n) */
-/*     Compare two strings. */
-/* */
 #include <machine/asm.h>
 
+#if defined(LIBC_SCCS)
+       RCSID("$NetBSD: strncmp.S,v 1.14 2005/08/03 22:59:50 rpaulo Exp $")
+#endif
+
+/*
+ * NOTE: I've unrolled the loop eight times: large enough to make a
+ * significant difference, and small enough not to totally trash the
+ * cache.
+ */
+
 ENTRY(strncmp)
-       movl    12(%esp), %ecx  /* Maximum length */
-       jmp     _C_LABEL(_strncmp) /* Common code */
+       pushl   %ebx
+       movl    8(%esp),%eax
+       movl    12(%esp),%ecx
+       movl    16(%esp),%edx
+       testl   %edx,%edx
+       jmp     L2                      /* Jump into the loop! */
+
+       _ALIGN_TEXT,0x90
+L1:    incl    %eax
+       incl    %ecx
+       decl    %edx
+L2:    jz      L4                      /* strings are equal */
+       movb    (%eax),%bl
+       testb   %bl,%bl
+       jz      L3
+       cmpb    %bl,(%ecx)
+       jne     L3
+
+       incl    %eax
+       incl    %ecx
+       decl    %edx
+       jz      L4
+       movb    (%eax),%bl
+       testb   %bl,%bl
+       jz      L3
+       cmpb    %bl,(%ecx)
+       jne     L3
+
+       incl    %eax
+       incl    %ecx
+       decl    %edx
+       jz      L4
+       movb    (%eax),%bl
+       testb   %bl,%bl
+       jz      L3
+       cmpb    %bl,(%ecx)
+       jne     L3
+
+       incl    %eax
+       incl    %ecx
+       decl    %edx
+       jz      L4
+       movb    (%eax),%bl
+       testb   %bl,%bl
+       jz      L3
+       cmpb    %bl,(%ecx)
+       jne     L3
+
+       incl    %eax
+       incl    %ecx
+       decl    %edx
+       jz      L4
+       movb    (%eax),%bl
+       testb   %bl,%bl
+       jz      L3
+       cmpb    %bl,(%ecx)
+       jne     L3
+
+       incl    %eax
+       incl    %ecx
+       decl    %edx
+       jz      L4
+       movb    (%eax),%bl
+       testb   %bl,%bl
+       jz      L3
+       cmpb    %bl,(%ecx)
+       jne     L3
+
+       incl    %eax
+       incl    %ecx
+       decl    %edx
+       jz      L4
+       movb    (%eax),%bl
+       testb   %bl,%bl
+       jz      L3
+       cmpb    %bl,(%ecx)
+       jne     L3
+
+       incl    %eax
+       incl    %ecx
+       decl    %edx
+       jz      L4
+       movb    (%eax),%bl
+       testb   %bl,%bl
+       jz      L3
+       cmpb    %bl,(%ecx)
+       je      L1
+
+       _ALIGN_TEXT,0x90
+L3:    movzbl  (%eax),%eax             /* unsigned comparison */
+       movzbl  (%ecx),%ecx
+       subl    %ecx,%eax
+       popl    %ebx
+       ret
+       _ALIGN_TEXT,0x90
+L4:    xorl    %eax,%eax
+       popl    %ebx
+       ret
diff --git a/lib/libc/arch/i386/string/strncpy.S b/lib/libc/arch/i386/string/strncpy.S
deleted file mode 100644 (file)
index cc70ab5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*     strncpy()                                       Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* char *strncpy(char *s1, const char *s2, size_t n) */
-/*     Copy string s2 to s1. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(strncpy)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %esi
-       push    %edi
-       movl    16(%ebp), %ecx  /* Maximum length */
-       call    _C_LABEL(_strncpy) /* Common code */
-       movl    %edx, %ecx      /* Number of bytes not copied */
-
-       rep stosb       /* strncpy always copies n bytes by null padding */
-       movl    8(%ebp), %eax   /* Return s1 */
-       pop     %edi
-       pop     %esi
-       pop     %ebp
-       ret
diff --git a/lib/libc/arch/i386/string/strnlen.S b/lib/libc/arch/i386/string/strnlen.S
deleted file mode 100644 (file)
index f4d27d4..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*     strnlen()                                       Author: Kees J. Bot */
-/*                                                             1 Jan 1994 */
-
-/* size_t strnlen(const char *s, size_t n) */
-/*     Return the length of a string. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(strnlen)
-       movl    8(%esp), %ecx   /* Maximum length */
-       jmp     _C_LABEL(_strnlen) /* Common code */
diff --git a/lib/libc/arch/i386/string/strrchr.S b/lib/libc/arch/i386/string/strrchr.S
deleted file mode 100644 (file)
index a124635..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*     strrchr()                                       Author: Kees J. Bot */
-/*                                                             2 Jan 1994 */
-
-/* char *strrchr(const char *s, int c) */
-/*     Look for the last occurrence a character in a string. */
-/* */
-#include <machine/asm.h>
-
-ENTRY(strrchr)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %edi
-       movl    8(%ebp), %edi   /* edi = string */
-       movl    $-1, %ecx
-       xorb    %al, %al
-       cld
-
-       repne scasb     /* Look for the end of the string */
-       notl    %ecx    /* -1 - ecx = Length of the string + null */
-       decl    %edi    /* Put edi back on the zero byte */
-       movb    12(%ebp), %al   /* The character to look for */
-       std     /* Downwards search */
-
-       repne scasb
-       cld     /* Direction bit back to default */
-       jne     failure
-       leal    1(%edi), %eax   /* Found it */
-       pop     %edi
-       pop     %ebp
-       ret
-failure:
-       xorl    %eax, %eax      /* Not there */
-       pop     %edi
-       pop     %ebp
-       ret
similarity index 100%
rename from lib/nbsd_libc/cdb/cdb.5
rename to lib/libc/cdb/cdb.5
similarity index 100%
rename from lib/nbsd_libc/cdb/cdbr.3
rename to lib/libc/cdb/cdbr.3
similarity index 100%
rename from lib/nbsd_libc/cdb/cdbr.c
rename to lib/libc/cdb/cdbr.c
similarity index 100%
rename from lib/nbsd_libc/cdb/cdbw.3
rename to lib/libc/cdb/cdbw.3
similarity index 100%
rename from lib/nbsd_libc/cdb/cdbw.c
rename to lib/libc/cdb/cdbw.c
index 62f3cc758959ab76b4ce06cf2edb8f034c358e7a..a085952e07c8f916db4ac55c21de2a5938c4346e 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_close.c,v 1.14 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 
 #include <assert.h>
 #include <errno.h>
index d887be3664dd69b93a948709b05b89ca14c2ee97..2c5217a39102e32b0f08c58226eb4c5b2c5b9bf0 100644 (file)
@@ -37,9 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_conv.c,v 1.14 2008/09/10 17:52:35 joerg Exp $");
-#endif
 
 #include <assert.h>
 #include <stdio.h>
index 2986605d9b95e4280557a9f4596bfff81c15208b..590ca4ac22ccf2ee660b5fd6a0c382c9bcea99d4 100644 (file)
@@ -37,9 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_debug.c,v 1.15 2008/09/10 17:52:35 joerg Exp $");
-#endif
 
 #include <assert.h>
 #include <stdio.h>
index ca930b3a9a0942cd0f66aaabeb829f0c183c970a..701c8b2016bd9915ab6690392e2e0a7e69c2bb19 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_delete.c,v 1.17 2009/01/29 02:02:36 lukem Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index a512010b5909c6d0018d4684c28aacb80d54caa6..772210a7b8e9738ee1a96da59b44b0ee7c9eac0b 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_get.c,v 1.13 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index 679668e90d2b7f1fd11ddbfc312c6769fc639d46..b5f7158a8a39e5a9d0b0de283834b21fda2c662a 100644 (file)
@@ -37,9 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_open.c,v 1.24 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
 /*
  * Implementation of btree access method for 4.4BSD.
@@ -49,9 +47,7 @@ __RCSID("$NetBSD: bt_open.c,v 1.24 2008/09/11 12:58:00 joerg Exp $");
  * is wholly independent of the Postgres code.
  */
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/stat.h>
 
 #include <assert.h>
@@ -63,11 +59,7 @@ __RCSID("$NetBSD: bt_open.c,v 1.24 2008/09/11 12:58:00 joerg Exp $");
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#ifndef __minix
 #include <paths.h>
-#else
-#define _PATH_TMP "/tmp/"
-#endif
 
 #include <db.h>
 #include "btree.h"
@@ -77,18 +69,6 @@ __RCSID("$NetBSD: bt_open.c,v 1.24 2008/09/11 12:58:00 joerg Exp $");
 #define        MINPSIZE        128
 #endif
 
-#ifndef LITTLE_ENDIAN
-# define LITTLE_ENDIAN 1234
-#endif
-
-#ifndef BIG_ENDIAN
-# define BIG_ENDIAN    4321
-#endif
-
-#ifndef BYTE_ORDER
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-
 static int byteorder(void);
 static int nroot(BTREE *);
 static int tmp(void);
@@ -282,11 +262,16 @@ __bt_open(const char *fname, int flags, mode_t mode, const BTREEINFO *openinfo,
                 * Don't overflow the page offset type.
                 */
                if (b.psize == 0) {
-#ifndef __minix
-                       b.psize = sb.st_blksize;
-#else
-                       b.psize = 4096;
+#ifdef __minix
+                       if (sb.st_blksize == 0) {
+                               /* 0 in 2 cases: upgrade from old to new struct stat or
+                                * there is a bug in underlying fs.
+                                */
+                               b.psize = MINIX_ST_BLKSIZE;
+                       } else
 #endif
+                               b.psize = sb.st_blksize;
+
                        if (b.psize < MINPSIZE)
                                b.psize = MINPSIZE;
                        if (b.psize > MAX_PAGE_OFFSET + 1)
@@ -420,14 +405,10 @@ tmp(void)
        char *envtmp;
        char path[PATH_MAX];
 
-#ifndef __minix
        if (issetugid())
                envtmp = NULL;
        else
                envtmp = getenv("TMPDIR");
-#else
-       envtmp = getenv("TMPDIR");
-#endif
 
        len = snprintf(path,
            sizeof(path), "%s/bt.XXXXXX", envtmp ? envtmp : _PATH_TMP);
index caf37bad7730ae0709a9b6bbf3f9e86a04b70907..965480487168c2bff7a807fd7c27a3a37cab62e9 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_overflow.c,v 1.16 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/param.h>
 
 #include <assert.h>
index afa05ab106d5df1008096f8bf426edc0f3b9a442..0db4aeb8b9ba1fbb7d351aa5a10d97efcfeccc20 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_page.c,v 1.13 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index ace935d3b9df391e41e02ab769d1f6988e2e117e..37630b819acca72a4ceca7bc1164779adef6df4c 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_put.c,v 1.19 2009/02/12 06:40:14 lukem Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index db17049c5af7d9d991584e4e7e519a7046f3f38b..00da7c9b68baf94d13dbd915e91355d7855616a3 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_search.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index f1cfac3c41cc507db9196bd05af1070a0db83eb7..58f25a065f136966d8c5b113654bc1497525aa65 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_seq.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index 07c59b6a3aa858ae2d926fe36f595f5743ca9350..8a97501b5d50d3e846325cdd127624a6a02f3452 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_split.c,v 1.19 2009/04/22 18:44:06 christos Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index fe0640c7cc9d3b6ee494db47b7b5a861d47d6e66..db0d058e121a746f17965a62ef44259125477d03 100644 (file)
@@ -37,9 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: bt_utils.c,v 1.13 2008/09/10 17:52:35 joerg Exp $");
-#endif
 
 #include <sys/param.h>
 
index 9a30db32affc243504b9a7d80d68fda43a6933f4..fb3155e63b2da18360f51b01d9b719a7f4e08c3f 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: db.c,v 1.16 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <errno.h>
@@ -60,18 +56,16 @@ dbopen(const char *fname, int flags, mode_t mode, DBTYPE type,
     const void *openinfo)
 {
 
-#ifndef O_EXLOCK
-#define O_EXLOCK 0
-#endif
-
-#ifndef O_SHLOCK
-#define O_SHLOCK 0
-#endif
-
 #define        DB_FLAGS        (DB_LOCK | DB_SHMEM | DB_TXN)
+#ifdef __minix
+#define USE_OPEN_FLAGS                                                         \
+       (O_CREAT | O_EXCL | O_NONBLOCK | O_RDONLY |                     \
+        O_RDWR | O_TRUNC)
+#else /* !__minix */
 #define        USE_OPEN_FLAGS                                                  \
        (O_CREAT | O_EXCL | O_EXLOCK | O_NONBLOCK | O_RDONLY |          \
         O_RDWR | O_SHLOCK | O_TRUNC)
+#endif /* __minix */
 
        if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
                switch (type) {
index 2ff1d0e74525c447c8ecba04d4c6924ecd44e005..5e69e4cfe1eeefa8acd9a541d6fdd521cc329b87 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: hash.c,v 1.31 2009/02/12 06:35:54 lukem Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/param.h>
 #include <sys/stat.h>
 
@@ -60,33 +56,17 @@ __RCSID("$NetBSD: hash.c,v 1.31 2009/02/12 06:35:54 lukem Exp $");
 #include "page.h"
 #include "extern.h"
 
-#ifndef LITTLE_ENDIAN
-# define LITTLE_ENDIAN 1234
-#endif
-
-#ifndef BIG_ENDIAN
-# define BIG_ENDIAN    4321
-#endif
-
-#ifndef BYTE_ORDER
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT
-#endif
-
 static int   alloc_segs(HTAB *, int);
 static int   flush_meta(HTAB *);
 static int   hash_access(HTAB *, ACTION, DBT *, DBT *);
 static int   hash_close(DB *);
-static int   hash_delete(const DB *, const DBT *, unsigned int);
+static int   hash_delete(const DB *, const DBT *, uint32_t);
 static int   hash_fd(const DB *);
-static int   hash_get(const DB *, const DBT *, DBT *, unsigned int);
-static int   hash_put(const DB *, DBT *, const DBT *, unsigned int);
+static int   hash_get(const DB *, const DBT *, DBT *, uint32_t);
+static int   hash_put(const DB *, DBT *, const DBT *, uint32_t);
 static void *hash_realloc(SEGMENT **, size_t, size_t);
-static int   hash_seq(const DB *, DBT *, DBT *, unsigned int);
-static int   hash_sync(const DB *, unsigned int);
+static int   hash_seq(const DB *, DBT *, DBT *, uint32_t);
+static int   hash_sync(const DB *, uint32_t);
 static int   hdestroy(HTAB *);
 static HTAB *init_hash(HTAB *, const char *, const HASHINFO *);
 static int   init_htab(HTAB *, size_t);
@@ -321,11 +301,16 @@ init_hash(HTAB *hashp, const char *file, const HASHINFO *info)
        if (file != NULL) {
                if (stat(file, &statbuf))
                        return (NULL);
-#ifndef __minix
-               hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE);
-#else
-               hashp->BSIZE = MIN(4096, MAX_BSIZE);
+#ifdef __minix
+               if (statbuf.st_blksize == 0) {
+                       /* 0 in 2 cases: upgrade from old to new struct stat or
+                        * there is a bug in underlying fs.
+                        */
+                       hashp->BSIZE = MIN(MINIX_ST_BLKSIZE, MAX_BSIZE);
+               } else
 #endif
+                       hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE);
+
                hashp->BSHIFT = __log2((uint32_t)hashp->BSIZE);
        }
 
@@ -473,7 +458,7 @@ hdestroy(HTAB *hashp)
  *     -1 ERROR
  */
 static int
-hash_sync(const DB *dbp, unsigned int flags)
+hash_sync(const DB *dbp, uint32_t flags)
 {
        HTAB *hashp;
 
@@ -547,7 +532,7 @@ flush_meta(HTAB *hashp)
  *     -1 to indicate an internal ERROR (i.e. out of memory, etc)
  */
 static int
-hash_get(const DB *dbp, const DBT *key, DBT *data, unsigned int flag)
+hash_get(const DB *dbp, const DBT *key, DBT *data, uint32_t flag)
 {
        HTAB *hashp;
 
@@ -560,7 +545,7 @@ hash_get(const DB *dbp, const DBT *key, DBT *data, unsigned int flag)
 }
 
 static int
-hash_put(const DB *dbp, DBT *key, const DBT *data, unsigned int flag)
+hash_put(const DB *dbp, DBT *key, const DBT *data, uint32_t flag)
 {
        HTAB *hashp;
 
@@ -579,7 +564,7 @@ hash_put(const DB *dbp, DBT *key, const DBT *data, unsigned int flag)
 }
 
 static int
-hash_delete(const DB *dbp, const DBT *key, unsigned int flag)
+hash_delete(const DB *dbp, const DBT *key, uint32_t flag)
 {
        HTAB *hashp;
 
@@ -727,7 +712,7 @@ found:
 }
 
 static int
-hash_seq(const DB *dbp, DBT *key, DBT *data, unsigned int flag)
+hash_seq(const DB *dbp, DBT *key, DBT *data, uint32_t flag)
 {
        uint32_t bucket;
        BUFHEAD *bufp = NULL; /* XXX: gcc */
index 790168d1d54df383d38f10c85107399069554232..5c6fc9b18d37d991d3edd1ca99eb58a3569bd9ac 100644 (file)
@@ -37,9 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: hash_bigkey.c,v 1.23 2009/02/12 06:33:13 lukem Exp $");
-#endif
 
 /*
  * PACKAGE: hash
@@ -72,10 +70,6 @@ __RCSID("$NetBSD: hash_bigkey.c,v 1.23 2009/02/12 06:33:13 lukem Exp $");
 #include "page.h"
 #include "extern.h"
 
-#ifndef _DIAGASSERT
-#define _DIAGASSERT
-#endif
-
 static int collect_key(HTAB *, BUFHEAD *, int, DBT *, int);
 static int collect_data(HTAB *, BUFHEAD *, int, int);
 
index 44d91f3b5d698b60744abefa70d26c2b47dc09c6..6469736b7701f4540d539c07a0f36177cb8d3064 100644 (file)
@@ -37,9 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: hash_buf.c,v 1.18 2009/04/23 22:09:23 christos Exp $");
-#endif
 
 /*
  * PACKAGE: hash
@@ -93,10 +91,6 @@ static BUFHEAD *newbuf(HTAB *, uint32_t, BUFHEAD *);
 #define MRU_INSERT(B)  BUF_INSERT((B), &hashp->bufhead)
 #define LRU_INSERT(B)  BUF_INSERT((B), LRU)
 
-#ifndef _DIAGASSERT
-#define _DIAGASSERT assert
-#endif
-
 /*
  * We are looking for a buffer with address "addr".  If prev_bp is NULL, then
  * address is a bucket index.  If prev_bp is not NULL, then it points to the
index bad63e87e0f845dc9c8f3e9dd232c822658e2b50..6dd136dc2bfdc0b85eb66c2ff38af7cf7cc59ad3 100644 (file)
@@ -37,9 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: hash_func.c,v 1.13 2008/09/10 17:52:35 joerg Exp $");
-#endif
 
 #include <sys/types.h>
 
index 688e39b0e30092e88fd9d534e67b16d0e94960b2..74343da17f70b115097960bd7322485d17e220df 100644 (file)
@@ -37,9 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: hash_log2.c,v 1.13 2008/09/11 12:33:55 joerg Exp $");
-#endif
 
 #include <sys/types.h>
 
index b4cf1215f79d419dd433242f76decaca59de2f62..e79dfd9bf6afd8dd272fcce8151c3b863c8d50bc 100644 (file)
@@ -37,9 +37,7 @@
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: hash_page.c,v 1.23 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
 /*
  * PACKAGE:  hashing
@@ -57,9 +55,7 @@ __RCSID("$NetBSD: hash_page.c,v 1.23 2008/09/11 12:58:00 joerg Exp $");
  *     open_temp
  */
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 
 #include <sys/types.h>
 
@@ -70,11 +66,7 @@ __RCSID("$NetBSD: hash_page.c,v 1.23 2008/09/11 12:58:00 joerg Exp $");
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#ifndef __minix
 #include <paths.h>
-#else
-#define _PATH_TMP "/tmp/"
-#endif
 #include <assert.h>
 
 #include <db.h>
@@ -82,22 +74,6 @@ __RCSID("$NetBSD: hash_page.c,v 1.23 2008/09/11 12:58:00 joerg Exp $");
 #include "page.h"
 #include "extern.h"
 
-#ifndef LITTLE_ENDIAN
-# define LITTLE_ENDIAN 1234
-#endif
-
-#ifndef BIG_ENDIAN
-# define BIG_ENDIAN    4321
-#endif
-
-#ifndef BYTE_ORDER
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT assert
-#endif
-
 static uint32_t        *fetch_bitmap(HTAB *, int);
 static uint32_t         first_free(uint32_t);
 static int      open_temp(HTAB *);
@@ -894,14 +870,11 @@ open_temp(HTAB *hashp)
        char *envtmp;
        char namestr[PATH_MAX];
 
-#ifndef __minix
        if (issetugid())
                envtmp = NULL;
        else
                envtmp = getenv("TMPDIR");
-#else
-       envtmp = getenv("TMPDIR");
-#endif
+
        if (-1 == snprintf(namestr, sizeof(namestr), "%s/_hashXXXXXX",
            envtmp ? envtmp : _PATH_TMP))
                return -1;
index b187898146d4bc28c8c8074d6e93e7a649134906..1aea409b7cea6d19565e90ca1a907b82d76617c7 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: ndbm.c,v 1.23 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
 /*
  * This package provides a dbm compatible interface to the new hashing
  * package described in db(3).
  */
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/param.h>
 
 #include <fcntl.h>
index 2d65fafd0e0317f9e4f81df963776f2e2091f32a..75c6ab87c440dbc46257089be2473f836e538ab4 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: ndbmdatum.c,v 1.4 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
 /*
  * This package provides a dbm compatible interface to the new hashing
  * package described in db(3).
  */
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/param.h>
 
 #include <fcntl.h>
index 87b62f22125087b7a76d11006192c0791f8f1d8f..1db9a25f63d539d6605932d3da99ff1f483f23c8 100644 (file)
@@ -1,4 +1,4 @@
-.\"    $NetBSD: dbopen.3,v 1.18 2010/03/22 19:30:53 joerg Exp $
+.\"    $NetBSD: dbopen.3,v 1.19 2010/12/16 12:08:16 jruoho Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"    @(#)dbopen.3    8.5 (Berkeley) 1/2/94
 .\"
-.Dd April 17, 2003
+.Dd December 16, 2010
 .Dt DBOPEN 3
 .Os
 .Sh NAME
@@ -60,8 +60,9 @@ detail in their respective manual pages
 and
 .Xr recno 3 .
 .Pp
-.Nm
-opens
+The
+.Fn dbopen
+function opens
 .Fa file
 for reading and/or writing.
 Files never intended to be preserved on disk may be created by setting
@@ -134,15 +135,16 @@ is
 .Dv NULL ,
 each access method will use defaults appropriate for the system and
 the access method.
-.Pp
-.Nm
-returns a pointer to a DB structure on success and
+.Ss The DB Structure
+The
+.Fn dbopen
+function returns a pointer to a DB structure on success and
 .Dv NULL
 on error.
 The DB structure is defined in the
 .In db.h
 include file, and contains at least the following fields:
-.Bd -literal
+.Bd -literal -offset indent
 typedef struct {
        DBTYPE type;
        int (*close)(const DB *db);
@@ -162,7 +164,7 @@ These functions take a pointer to a structure as returned by
 .Nm ,
 and sometimes one or more pointers to key/data structures and a flag
 value.
-.Bl -tag -width closex
+.Bl -tag -width closex -offset indent
 .It Fa type
 The type of the underlying access method (and file format).
 .It Fa close
@@ -420,10 +422,10 @@ routines return \-1 on error (setting
 .Va errno )
 and 0 on success.
 .El
-.Ss KEY/DATA PAIRS
+.Ss Key/data Pairs
 Access to all file types is based on key/data pairs.
 Both keys and data are represented by the following data structure:
-.Bd -literal
+.Bd -literal -offset indent
 typedef struct {
        void *data;
        size_t size;
@@ -431,7 +433,7 @@ typedef struct {
 .Ed
 .Pp
 The elements of the DBT structure are defined as follows:
-.Bl -tag -width datax
+.Bl -tag -width datax -offset indent
 .It Fa data
 A pointer to a byte string.
 .It Fa size
@@ -515,11 +517,13 @@ for any of the errors specified for the library routine
 .Xr recno 3
 .Pp
 .Rs
-.%T "LIBTP: Portable, Modular Transactions for UNIX"
+.%T LIBTP: Portable, Modular Transactions for UNIX
 .%A Margo Seltzer
 .%A Michael Olson
-.%J USENIX proceedings
-.%D Winter 1992
+.%I USENIX Association
+.%B Proceedings of the 1992 Winter USENIX Technical Conference
+.%D 1992
+.%P 9-25
 .Re
 .Sh BUGS
 The typedef DBT is a mnemonic for
index c735a512450a79b03d389ffcf2b1fb70185cc06b..eaac286cbaa95ca0ba59ce420493c71300dec5d8 100644 (file)
@@ -1,4 +1,4 @@
-.\"    $NetBSD: hash.3,v 1.13 2010/03/22 19:30:53 joerg Exp $
+.\"    $NetBSD: hash.3,v 1.14 2010/12/16 11:57:20 jruoho Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"    @(#)hash.3      8.6 (Berkeley) 8/18/94
 .\"
-.Dd September 5, 2008
+.Dd December 16, 2010
 .Dt HASH 3
 .Os
 .Sh NAME
@@ -53,8 +53,8 @@ The access method specific data structure provided to
 .Fn dbopen
 is defined in the
 .In db.h
-include file as follows:
-.Bd -literal
+header as follows:
+.Bd -literal -offset indent
 typedef struct {
        u_int bsize;
        u_int ffactor;
@@ -152,16 +152,21 @@ for any of the errors specified for the library routine
 .Xr recno 3
 .Pp
 .Rs
-.%T "Dynamic Hash Tables"
+.%T Dynamic Hash Tables
 .%A Per-Ake Larson
 .%J Communications of the ACM
 .%D April 1988
+.%N Issue 4
+.%V Volume 31
 .Re
 .Rs
-.%T "A New Hash Package for UNIX"
+.%T A New Hash Package for UNIX
 .%A Margo Seltzer
-.%J USENIX Proceedings
-.%D Winter 1991
+.%I USENIX Association
+.%B Proceedings of the 1991 Winter USENIX Technical Conference
+.%D January 1991
+.%P 173-184
+.%U http://www.usenix.org/publications/library/proceedings/seltzer2.pdf
 .Re
 .Sh BUGS
 Only big and little endian byte order is supported.
index fa76eb54701f9c5d4cef8e5e3602940046bbde06..32673f90f2f6d4afb4f83f218472fb2583f0cae0 100644 (file)
@@ -1,4 +1,4 @@
-.\"    $NetBSD: mpool.3,v 1.9 2003/08/07 16:42:43 agc Exp $
+.\"    $NetBSD: mpool.3,v 1.10 2010/12/16 11:49:35 jruoho Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"    @(#)mpool.3     8.1 (Berkeley) 6/4/93
 .\"
-.Dd April 17, 2003
+.Dd December 16, 2010
 .Dt MPOOL 3
 .Os
 .Sh NAME
@@ -67,7 +67,7 @@ management of files.
 The buffers may be shared between processes.
 .Pp
 The function
-.Nm mpool_open
+.Fn mpool_open
 initializes a memory pool.
 The
 .Fa key
@@ -105,7 +105,7 @@ file's buffers, but will be the largest value specified by any of the
 processes sharing the file.
 .Pp
 The
-.Nm mpool_filter
+.Fn mpool_filter
 function is intended to make transparent input and output processing
 of the pages possible.
 If the
@@ -122,7 +122,7 @@ pointer, the page number and a pointer to the page to being read or
 written.
 .Pp
 The function
-.Nm mpool_new
+.Fn mpool_new
 takes an MPOOL pointer and an address as arguments.
 If a new page can be allocated, a pointer to the page is returned and
 the page number is stored into the
@@ -133,7 +133,7 @@ Otherwise,
 is returned and errno is set.
 .Pp
 The function
-.Nm mpool_get
+.Fn mpool_get
 takes a MPOOL pointer and a page number as arguments.
 If the page exists, a pointer to the page is returned.
 Otherwise,
@@ -142,14 +142,14 @@ is returned and errno is set.
 The flags parameter is not currently used.
 .Pp
 The function
-.Nm mpool_put
+.Fn mpool_put
 unpins the page referenced by
 .Fa pgaddr .
 .Fa pgaddr
 must be an address previously returned by
-.Nm mpool_get
+.Fn mpool_get
 or
-.Nm mpool_new .
+.Fn mpool_new .
 The flag value is specified by or'ing any of the following values:
 .Bl -tag -width MPOOL_DIRTYX -offset indent
 .It Dv MPOOL_DIRTY
@@ -157,35 +157,35 @@ The page has been modified and needs to be written to the backing
 file.
 .El
 .Pp
-.Nm mpool_put
+.Fn mpool_put
 returns 0 on success and \-1 if an error occurs.
 .Pp
 The function
-.Nm mpool_sync
+.Fn mpool_sync
 writes all modified pages associated with the MPOOL pointer to the
 backing file.
-.Nm mpool_sync
+.Fn mpool_sync
 returns 0 on success and \-1 if an error occurs.
 .Pp
 The
-.Nm mpool_close
+.Fn mpool_close
 function frees up any allocated memory associated with the memory pool
 cookie.
 Modified pages are
 .Em not
 written to the backing file.
-.Nm mpool_close
+.Fn mpool_close
 returns 0 on success and \-1 if an error occurs.
 .Sh ERRORS
 The
-.Nm mpool_open
+.Fn mpool_open
 function may fail and set
 .Va errno
 for any of the errors specified for the library routine
 .Xr malloc 3 .
 .Pp
 The
-.Nm mpool_get
+.Fn mpool_get
 function may fail and set
 .Va errno
 for the following:
@@ -195,9 +195,9 @@ The requested record doesn't exist.
 .El
 .Pp
 The
-.Nm mpool_new
+.Fn mpool_new
 and
-.Nm mpool_get
+.Fn mpool_get
 functions may fail and set
 .Va errno
 for any of the errors specified for the library routines
@@ -207,14 +207,14 @@ and
 .Xr malloc 3 .
 .Pp
 The
-.Nm mpool_sync
+.Fn mpool_sync
 function may fail and set
 .Va errno
 for any of the errors specified for the library routine
 .Xr write 2 .
 .Pp
 The
-.Nm mpool_close
+.Fn mpool_close
 function may fail and set
 .Va errno
 for any of the errors specified for the library routine
index c03c7679ab7e23e0cb54d57ba7f2022e088c5b21..a9ce4a0cf45d93f3b307b7d74f959dfc796c2218 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: mpool.c,v 1.19 2009/04/22 18:44:06 christos Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/queue.h>
 #include <sys/stat.h>
 
index 22ebf3aff8cf8f685e189116c054d59d30ca5aac..7fb5632869feb3740b44573ad836a6b30a280f2b 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: rec_close.c,v 1.15 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 #include <sys/uio.h>
 #include <sys/mman.h>
@@ -82,8 +78,12 @@ __rec_close(DB *dbp)
 
        /* Committed to closing. */
        status = RET_SUCCESS;
+#ifndef __minix
        if (F_ISSET(t, R_MEMMAPPED) && munmap(t->bt_smap, t->bt_msize))
                status = RET_ERROR;
+#else
+       assert(!F_ISSET(t, R_MEMMAPPED));
+#endif
 
        if (!F_ISSET(t, R_INMEM)) {
                if (F_ISSET(t, R_CLOSEFP)) {
index 84ef9c187e93860e78f323d3d43bd17a68335a41..a9dea5767c4c87b4391d80870661e60cdb9af243 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: rec_delete.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index eacf14b10842ad4d49a4732ff05b240f9af85c93..1dc80f9281bda5f74af70dd5477cc3e9fed7b65d 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: rec_get.c,v 1.16 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index fee429ce3c99def736d78b6250724026aeff7eed..ff1852e409d7be332af6f52962521113b541acb4 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: rec_open.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
index f28791ccd076bca47579944af6f7e8aea1f6ac3d..7c1181c6428aa07c161f23a504bee883cb360b0d 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: rec_put.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index 08b58093410a91c64e9642072a2c9dad1f78031c..1238c8db32844fd78e7363ae3b67f1afd0157f6c 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: rec_search.c,v 1.14 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index a3bceaf9c6c9b15061cb2b4d79c8873ee125b80c..3b1da48cc19ebe54fb8ee910567e7fe8f42a8ffd 100644 (file)
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: rec_seq.c,v 1.14 2008/09/11 12:58:00 joerg Exp $");
-#endif
 
-#ifndef __minix
 #include "namespace.h"
-#endif
 #include <sys/types.h>
 
 #include <assert.h>
index 73498738a609f6b89ce62441175be40d4599d1bd..2a61c7b68112e3047348d0d58717bef561bf0091 100644 (file)
@@ -34,9 +34,7 @@
 #endif
 
 #include <sys/cdefs.h>
-#ifndef __minix
 __RCSID("$NetBSD: rec_utils.c,v 1.12 2008/09/10 17:52:36 joerg Exp $");
-#endif
 
 #include <sys/param.h>
 
similarity index 97%
rename from lib/nbsd_libc/gen/Makefile.inc
rename to lib/libc/gen/Makefile.inc
index 99e64064d26e6b8fab21c34f7acd6046526148fb..9960547de085443df8b0707dfaa0e00fd90136e7 100644 (file)
@@ -213,8 +213,8 @@ CPPFLAGS.tolower_.c+=       -I${LIBCDIR}/locale
 CPPFLAGS.toupper_.c+=  -I${LIBCDIR}/locale
 
 .if defined(__MINIX)
-errlist.c: errlist.awk ${MINIXSRCDIR}/nbsd_include/sys/errno.h
-       cat ${MINIXSRCDIR}/nbsd_include/sys/errno.h | ${TOOL_SED} 's/(_SIGN//' | ${TOOL_AWK} -f ${MINIXSRCDIR}/lib/nbsd_libc/gen/errlist.awk > ${.TARGET}
+errlist.c: errlist.awk ${MINIXSRCDIR}/include/sys/errno.h
+       cat ${MINIXSRCDIR}/include/sys/errno.h | ${TOOL_SED} 's/(_SIGN//' | ${TOOL_AWK} -f ${MINIXSRCDIR}/lib/libc/gen/errlist.awk > ${.TARGET}
 .else
 errlist.c: errlist.awk ${NETBSDSRCDIR}/sys/sys/errno.h
        ${TOOL_AWK} -f ${.ALLSRC} > ${.TARGET}
similarity index 100%
rename from lib/nbsd_libc/gen/_err.c
rename to lib/libc/gen/_err.c
similarity index 100%
rename from lib/nbsd_libc/gen/err.3
rename to lib/libc/gen/err.3
similarity index 100%
rename from lib/libc/other/err.c
rename to lib/libc/gen/err.c
similarity index 100%
rename from lib/libc/other/errx.c
rename to lib/libc/gen/errx.c
similarity index 100%
rename from lib/nbsd_libc/gen/exec.3
rename to lib/libc/gen/exec.3
similarity index 100%
rename from lib/nbsd_libc/gen/ftok.3
rename to lib/libc/gen/ftok.3
similarity index 100%
rename from lib/nbsd_libc/gen/ftok.c
rename to lib/libc/gen/ftok.c
similarity index 100%
rename from lib/nbsd_libc/gen/fts.3
rename to lib/libc/gen/fts.3
similarity index 100%
rename from lib/nbsd_libc/gen/fts.c
rename to lib/libc/gen/fts.c
similarity index 100%
rename from lib/nbsd_libc/gen/ftw.3
rename to lib/libc/gen/ftw.3
similarity index 100%
rename from lib/nbsd_libc/gen/ftw.c
rename to lib/libc/gen/ftw.c
similarity index 100%
rename from lib/nbsd_libc/gen/glob.3
rename to lib/libc/gen/glob.3
similarity index 100%
rename from lib/nbsd_libc/gen/glob.c
rename to lib/libc/gen/glob.c
similarity index 100%
rename from lib/nbsd_libc/gen/nftw.c
rename to lib/libc/gen/nftw.c
similarity index 100%
rename from lib/nbsd_libc/gen/nice.3
rename to lib/libc/gen/nice.3
similarity index 100%
rename from lib/nbsd_libc/gen/nice.c
rename to lib/libc/gen/nice.c
similarity index 100%
rename from lib/nbsd_libc/gen/time.3
rename to lib/libc/gen/time.3
similarity index 100%
rename from lib/nbsd_libc/gen/time.c
rename to lib/libc/gen/time.c
similarity index 100%
rename from lib/nbsd_libc/gen/utmp.c
rename to lib/libc/gen/utmp.c
similarity index 100%
rename from lib/libc/other/verr.c
rename to lib/libc/gen/verr.c
similarity index 100%
rename from lib/libc/other/verrx.c
rename to lib/libc/gen/verrx.c
similarity index 100%
rename from lib/nbsd_libc/gen/vis.3
rename to lib/libc/gen/vis.3
similarity index 100%
rename from lib/nbsd_libc/gen/vis.c
rename to lib/libc/gen/vis.c
similarity index 100%
rename from lib/libc/other/vwarn.c
rename to lib/libc/gen/vwarn.c
similarity index 100%
rename from lib/nbsd_libc/gen/wait.c
rename to lib/libc/gen/wait.c
similarity index 100%
rename from lib/libc/other/warn.c
rename to lib/libc/gen/warn.c
diff --git a/lib/libc/gnu/arch/i386/rts/Makefile.inc b/lib/libc/gnu/arch/i386/rts/Makefile.inc
deleted file mode 100644 (file)
index 330681d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# rts sources
-.PATH: ${.CURDIR}/gnu/arch/${ARCH}/rts
-
-SRCS+=  \
-       __setjmp.S \
-       longjmp.S
diff --git a/lib/libc/gnu/arch/i386/rts/__setjmp.S b/lib/libc/gnu/arch/i386/rts/__setjmp.S
deleted file mode 100644 (file)
index 51e2f12..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/ __setjmp.gnu.s
-/
-/ Created:     Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
-#include <machine/asm.h>
-
-ENTRY(__setjmp)
-       movl    4(%esp), %eax           /* jmp_buf */
-       movl    %edx, 28(%eax)          /* save edx */
-       movl    0(%esp), %edx
-       movl    %edx, 8(%eax)           /* save program counter */
-       movl    %esp, 12(%eax)          /* save stack pointer */
-       movl    %ebp, 16(%eax)          /* save frame pointer */
-       movl    %ebx, 20(%eax)
-       movl    %ecx, 24(%eax)
-       movl    %esi, 32(%eax)
-       movl    %edi, 36(%eax)
-       
-       movl    8(%esp), %edx           /* save mask? */
-       movl    %edx, 0(%eax)           /* save whether to restore mask */
-       testl   %edx, %edx
-       jz              1f
-       leal    4(%eax), %edx           /* pointer to sigset_t */
-       push    %edx
-       call    _C_LABEL(__newsigset)   /* save mask     */
-       addl    $4, %esp
-1:
-       movl    $0, %eax
-       ret
-
-/ $PchId: __setjmp.gnu.s,v 1.4 1996/03/12 19:30:54 philip Exp $
diff --git a/lib/libc/gnu/arch/i386/rts/longjmp.S b/lib/libc/gnu/arch/i386/rts/longjmp.S
deleted file mode 100644 (file)
index 8194b20..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/ longjmp.gnu.s
-/
-/ Created:     Oct 15, 1993 by Philip Homburg <philip@cs.vu.nl>
-#include <machine/asm.h>
-
-ENTRY(longjmp)
-       movl    4(%esp), %eax           /* jmp_buf */
-       cmpl    $0, 0(%eax)                     /* save mask? */
-       je              1f
-       leal    4(%eax), %edx           /* pointer to sigset_t */
-       push    %edx
-       call    _C_LABEL(__oldsigset)   /* restore mask */
-       addl    $4, %esp
-       movl    4(%esp), %eax           /* jmp_buf */
-1:
-       movl    8(%esp), %ecx           /* result value */
-       movl    12(%eax), %esp          /* restore stack pointer */
-
-       movl    8(%eax), %edx           /* restore program counter */
-       movl    %edx, 0(%esp)
-
-       push    %ecx                    /* save result code */
-
-       movl    16(%eax), %ebp          /* restore frame pointer */
-       movl    20(%eax), %ebx
-       movl    24(%eax), %ecx
-       movl    28(%eax), %edx
-       movl    32(%eax), %esi
-       movl    36(%eax), %edi
-       pop     %eax
-       testl   %eax, %eax
-       jz      1f
-       ret
-1:     movl    $1, %eax
-       ret
-
-/ $PchId: longjmp.gnu.s,v 1.4 1996/03/12 19:30:02 philip Exp $
diff --git a/lib/libc/gnu/ieee_float/Makefile.inc b/lib/libc/gnu/ieee_float/Makefile.inc
deleted file mode 100644 (file)
index e9865bd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# ieee_float sources
-.PATH: ${.CURDIR}/gnu/ieee_float
-
-CPPFLAGS.fphook.c=-I${.CURDIR}/stdio
-
-SRCS+=  \
-       frexp.c \
-       isinf.c \
-       isnan.c \
-       ldexp.c \
-       modf.c \
-       fphook.c
diff --git a/lib/libc/gnu/ieee_float/fphook.c b/lib/libc/gnu/ieee_float/fphook.c
deleted file mode 100644 (file)
index 9f8c084..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * fltpr.c - print floating point numbers
- */
-/* $Header$ */
-
-#ifndef        NOFLOAT
-#include       <string.h>
-#include       <stdarg.h>
-#include       "loc_incl.h"
-int _fp_hook = 1;
-
-static char *
-_pfloat(long double r, register char *s, int n, int flags)
-{
-       register char *s1;
-       int sign, dp;
-       register int i;
-
-       s1 = _fcvt(r, n, &dp, &sign);
-       if (sign)
-               *s++ = '-';
-       else if (flags & FL_SIGN)
-               *s++ = '+';
-       else if (flags & FL_SPACE)
-               *s++ = ' ';
-
-       if (dp<=0)
-               *s++ = '0';
-       for (i=dp; i>0; i--)
-               if (*s1) *s++ = *s1++;
-               else *s++ = '0';
-       if (((i=n) > 0) || (flags & FL_ALT))
-               *s++ = '.';
-       while (++dp <= 0) {
-               if (--i<0)
-                       break;
-               *s++ = '0';
-       }
-       while (--i >= 0)
-               if (*s1) *s++ = *s1++;
-               else *s++ = '0';
-       return s;
-}
-
-static char *
-_pscien(long double r, register char *s, int n, int flags)
-{
-       int sign, dp; 
-       register char *s1;
-
-       s1 = _ecvt(r, n + 1, &dp, &sign);
-       if (sign)
-               *s++ = '-';
-       else if (flags & FL_SIGN)
-               *s++ = '+';
-       else if (flags & FL_SPACE)
-               *s++ = ' ';
-
-       *s++ = *s1++;
-       if ((n > 0) || (flags & FL_ALT))
-               *s++ = '.';
-       while (--n >= 0)
-               if (*s1) *s++ = *s1++;
-               else *s++ = '0';
-       *s++ = 'e';
-       if ( r != 0 ) --dp ;
-       if ( dp<0 ) {
-               *s++ = '-' ; dp= -dp ;
-       } else {
-               *s++ = '+' ;
-       }
-       if (dp >= 100) {
-               *s++ = '0' + (dp / 100);
-               dp %= 100;
-       }
-       *s++ = '0' + (dp/10);
-       *s++ = '0' + (dp%10);
-       return s;
-}
-
-#define        NDIGINEXP(exp)          (((exp) >= 100 || (exp) <= -100) ? 3 : 2)
-#define        LOW_EXP                 -4
-#define        USE_EXP(exp, ndigits)   (((exp) < LOW_EXP + 1) || (exp >= ndigits + 1))
-
-static char *
-_gcvt(long double value, int ndigit, char *s, int flags)
-{
-       int sign, dp;
-       register char *s1, *s2;
-       register int i;
-       register int nndigit = ndigit;
-
-       s1 = _ecvt(value, ndigit, &dp, &sign);
-       s2 = s;
-       if (sign) *s2++ = '-';
-       else if (flags & FL_SIGN)
-               *s2++ = '+';
-       else if (flags & FL_SPACE)
-               *s2++ = ' ';
-
-       if (!(flags & FL_ALT))
-               for (i = nndigit - 1; i > 0 && s1[i] == '0'; i--)
-                       nndigit--;
-
-       if (USE_EXP(dp,ndigit)) {
-               /* Use E format */
-               dp--;
-               *s2++ = *s1++;
-               if ((nndigit > 1) || (flags & FL_ALT)) *s2++ = '.';
-               while (--nndigit > 0) *s2++ = *s1++;
-               *s2++ = 'e';
-               if (dp < 0) {
-                       *s2++ = '-';
-                       dp = -dp;
-               }
-               else     *s2++ = '+';
-               s2 += NDIGINEXP(dp);
-               *s2 = 0;
-               for (i = NDIGINEXP(dp); i > 0; i--) {
-                       *--s2 = dp % 10 + '0';
-                       dp /= 10;
-               }
-               return s;
-       }
-       /* Use f format */
-       if (dp <= 0) {
-               if (*s1 != '0') {
-                       /* otherwise the whole number is 0 */
-                       *s2++ = '0';
-                       *s2++ = '.';
-               }
-               while (dp < 0) {
-                       dp++;
-                       *s2++ = '0';
-               }
-       }
-       for (i = 1; i <= nndigit; i++) {
-               *s2++ = *s1++;
-               if (i == dp) *s2++ = '.';
-       }
-       if (i <= dp) {
-               while (i++ <= dp) *s2++ = '0';
-               *s2++ = '.';
-       }
-       if ((s2[-1]=='.') && !(flags & FL_ALT)) s2--;
-       *s2 = '\0';
-       return s;
-}
-
-char *
-_f_print(va_list *ap, int flags, char *s, char c, int precision)
-{
-       register char *old_s = s;
-       long double ld_val;
-
-       if (flags & FL_LONGDOUBLE) ld_val = va_arg(*ap, long double);
-       else ld_val = (long double) va_arg(*ap, double);
-
-       switch(c) {
-       case 'f':
-               s = _pfloat(ld_val, s, precision, flags);
-               break;
-       case 'e':
-       case 'E':
-               s = _pscien(ld_val, s, precision , flags);
-               break;
-       case 'g':
-       case 'G':
-               s = _gcvt(ld_val, precision, s, flags);
-               s += strlen(s);
-               break;
-       }
-       if ( c == 'E' || c == 'G') {
-               while (*old_s && *old_s != 'e') old_s++;
-               if (*old_s == 'e') *old_s = 'E';
-       }
-       return s;
-}
-#endif /* NOFLOAT */
-/* $Header$ */
-
-#include <stdlib.h>
-#include "../ansi/ext_fmt.h"
-
-void _str_ext_cvt(const char *s, char **ss, struct EXTEND *e);
-double _ext_dbl_cvt(struct EXTEND *e);
-
-double
-strtod(const char *p, char **pp)
-{
-       struct EXTEND e;
-
-       _str_ext_cvt(p, pp, &e);
-       return _ext_dbl_cvt(&e);
-}
diff --git a/lib/libc/gnu/ieee_float/frexp.c b/lib/libc/gnu/ieee_float/frexp.c
deleted file mode 100644 (file)
index 7421797..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-libc/ieee_float/frexp.c
-
-Created:       Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
-
-Implementation of frexp that directly manipulates the exponent bits in an
-ieee float
-*/
-
-#include <sys/types.h>
-#include <math.h>
-
-#include "ieee_float.h"
-
-double frexp(value, eptr)
-double value;
-int *eptr;
-{
-       struct f64 *f64p;
-       int exp, exp_bias;
-       double factor;
-
-       f64p= (struct f64 *)&value;
-       exp_bias= 0;
-
-       exp= F64_GET_EXP(f64p);
-       if (exp == F64_EXP_MAX)
-       {       /* Either infinity or Nan */
-               *eptr= 0;
-               return value;
-       }
-       if (exp == 0)
-       {
-               /* Either 0 or denormal */
-               if (F64_GET_MANT_LOW(f64p) == 0 &&
-                       F64_GET_MANT_HIGH(f64p) == 0)
-               {
-                       *eptr= 0;
-                       return value;
-               }
-
-               /* Multiply by 2^64 */
-               factor= 65536.0;        /* 2^16 */
-               factor *= factor;       /* 2^32 */
-               factor *= factor;       /* 2^64 */
-               value *= factor;
-               exp_bias= 64;
-               exp= F64_GET_EXP(f64p);
-       }
-
-       exp= exp - F64_EXP_BIAS - exp_bias + 1;
-       *eptr= exp;
-       F64_SET_EXP(f64p, F64_EXP_BIAS-1);
-
-       return value;
-}
-
-/*
- * $PchId: frexp.c,v 1.3 1996/02/22 21:01:39 philip Exp $
- */
diff --git a/lib/libc/gnu/ieee_float/ieee_float.h b/lib/libc/gnu/ieee_float/ieee_float.h
deleted file mode 100644 (file)
index 940a2b1..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-libc/ieee_float/ieee_float.h
-
-Created:       Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
-
-Define structures and macros for manipulating IEEE floats
-*/
-
-#ifndef IEEE_FLOAT_H
-#define IEEE_FLOAT_H
-
-#define isnan __IsNan
-
-struct f64
-{
-       u32_t low_word;
-       u32_t high_word;
-};
-
-#define F64_SIGN_SHIFT 31
-#define F64_SIGN_MASK  1
-
-#define F64_EXP_SHIFT  20
-#define F64_EXP_MASK   0x7ff
-#define F64_EXP_BIAS   1023
-#define F64_EXP_MAX    2047
-
-#define F64_MANT_SHIFT 0
-#define F64_MANT_MASK  0xfffff
-
-#define F64_GET_SIGN(fp)       (((fp)->high_word >> F64_SIGN_SHIFT) & \
-                                       F64_SIGN_MASK)
-#define F64_GET_EXP(fp)                (((fp)->high_word >> F64_EXP_SHIFT) & \
-                                       F64_EXP_MASK)
-#define F64_SET_EXP(fp, val)   ((fp)->high_word= ((fp)->high_word &    \
-                               ~(F64_EXP_MASK << F64_EXP_SHIFT)) |     \
-                               (((val) & F64_EXP_MASK) << F64_EXP_SHIFT))
-
-#define F64_GET_MANT_LOW(fp)           ((fp)->low_word)
-#define F64_SET_MANT_LOW(fp, val)      ((fp)->low_word= (val))
-#define F64_GET_MANT_HIGH(fp)  (((fp)->high_word >> F64_MANT_SHIFT) & \
-                                       F64_MANT_MASK)
-#define F64_SET_MANT_HIGH(fp, val)     ((fp)->high_word= ((fp)->high_word & \
-                               ~(F64_MANT_MASK << F64_MANT_SHIFT)) |   \
-                               (((val) & F64_MANT_MASK) << F64_MANT_SHIFT))
-
-#endif /* IEEE_FLOAT_H */
-
-/*
- * $PchId: ieee_float.h,v 1.3 1996/02/22 21:01:39 philip Exp $
- */
diff --git a/lib/libc/gnu/ieee_float/isinf.c b/lib/libc/gnu/ieee_float/isinf.c
deleted file mode 100644 (file)
index 49316c6..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-libc/ieee_float/isinf.c
-
-Created:       Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
-
-Implementation of isinf that directly tests the bits in an ieee float
-*/
-
-#define _MINIX_SOURCE
-
-#include <sys/types.h>
-#include <math.h>
-
-#include "ieee_float.h"
-
-int isinf(value)
-double value;
-{
-       struct f64 *f64p;
-       int exp;
-
-       f64p= (struct f64 *)&value;
-       exp= F64_GET_EXP(f64p);
-       if (exp != F64_EXP_MAX)
-               return 0;
-       return F64_GET_MANT_LOW(f64p) == 0 && F64_GET_MANT_HIGH(f64p) == 0;
-}
-
-/*
- * $PchId: isinf.c,v 1.3 1996/02/22 21:01:39 philip Exp $
- */
diff --git a/lib/libc/gnu/ieee_float/isnan.c b/lib/libc/gnu/ieee_float/isnan.c
deleted file mode 100644 (file)
index 9d69510..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-libc/ieee_float/isnan.c
-
-Created:       Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
-
-Implementation of isnan that directly tests the bits in an ieee float
-*/
-
-#define _MINIX_SOURCE
-
-#include <sys/types.h>
-
-#include "ieee_float.h"
-
-int isnan(value)
-double value;
-{
-       struct f64 *f64p;
-       int exp;
-
-       f64p= (struct f64 *)&value;
-       exp= F64_GET_EXP(f64p);
-       if (exp != F64_EXP_MAX)
-               return 0;
-       return F64_GET_MANT_LOW(f64p) != 0 || F64_GET_MANT_HIGH(f64p) != 0;
-}
-
-/*
- * $PchId: isnan.c,v 1.3 1996/02/22 21:01:39 philip Exp $
- */
diff --git a/lib/libc/gnu/ieee_float/ldexp.c b/lib/libc/gnu/ieee_float/ldexp.c
deleted file mode 100644 (file)
index 32a9a3f..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-libc/ieee_float/ldexp.c
-
-Created:       Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
-
-Implementation of ldexp that directly manipulates the exponent bits in an
-ieee float
-*/
-
-#include <sys/types.h>
-#include <errno.h>
-#include <math.h>
-
-#include "ieee_float.h"
-
-double ldexp(value, exp)
-double value;
-int exp;
-{
-       struct f64 *f64p;
-       int oldexp, exp_bias;
-       double factor;
-
-       f64p= (struct f64 *)&value;
-       exp_bias= 0;
-
-       oldexp= F64_GET_EXP(f64p);
-       if (oldexp == F64_EXP_MAX)
-       {       /* Either infinity or Nan */
-               return value;
-       }
-       if (oldexp == 0)
-       {
-               /* Either 0 or denormal */
-               if (F64_GET_MANT_LOW(f64p) == 0 &&
-                       F64_GET_MANT_HIGH(f64p) == 0)
-               {
-                       return value;
-               }
-       }
-
-       /* If exp is too large (> 2*F64_EXP_MAX) or too small
-        * (< -2*F64_EXP_MAX) return HUGE_VAL or 0. This prevents overflows
-        * in exp if exp is really weird
-        */
-       if (exp >= 2*F64_EXP_MAX)
-       {
-               errno= ERANGE;
-               return HUGE_VAL;
-       }
-       if (exp <= -2*F64_EXP_MAX)
-       {
-               errno= ERANGE;
-               return 0;
-       }
-       
-       /* Normalize a denormal */
-       if (oldexp == 0)
-       {
-               /* Multiply by 2^64 */
-               factor= 65536.0;        /* 2^16 */
-               factor *= factor;       /* 2^32 */
-               factor *= factor;       /* 2^64 */
-               value *= factor;
-               exp= -64;
-               oldexp= F64_GET_EXP(f64p);
-       }
-
-       exp= oldexp + exp;
-       if (exp >= F64_EXP_MAX)
-       {       /* Overflow */
-               errno= ERANGE;
-               return HUGE_VAL;
-       }
-       if (exp > 0)
-       {
-               /* Normal */
-               F64_SET_EXP(f64p, exp);
-               return value;
-       }
-       /* Denormal, or underflow. */
-       exp += 64;
-       F64_SET_EXP(f64p, exp);
-       /* Divide by 2^64 */
-       factor= 65536.0;        /* 2^16 */
-       factor *= factor;       /* 2^32 */
-       factor *= factor;       /* 2^64 */
-       value /= factor;
-       if (value == 0.0)
-       {
-               /* Underflow */
-               errno= ERANGE;
-       }
-       return value;
-}
-
-/*
- * $PchId: ldexp.c,v 1.3 1996/02/22 21:01:39 philip Exp $
- */
diff --git a/lib/libc/gnu/ieee_float/modf.c b/lib/libc/gnu/ieee_float/modf.c
deleted file mode 100644 (file)
index 1b50a42..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-libc/ieee_float/modf.c
-
-Created:       Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
-
-Implementation of modf that directly manipulates the exponent bits in an
-ieee float
-*/
-
-#include <sys/types.h>
-#include <math.h>
-
-#include "ieee_float.h"
-
-double modf(value, iptr)
-double value;
-double *iptr;
-{
-       struct f64 *f64p;
-       double tmp;
-       int exp;
-       int mask_bits;
-       u32_t mant;
-
-       f64p= (struct f64 *)&value;
-
-       exp= F64_GET_EXP(f64p);
-       exp -= F64_EXP_BIAS;
-       if (exp < 0)
-       {
-               *iptr= 0;
-               return value;
-       }
-       mask_bits= 52-exp;
-       if (mask_bits <= 0)
-       {
-               *iptr= value;
-               return 0;
-       }
-       tmp= value;
-       if (mask_bits >= 32)
-       {
-               F64_SET_MANT_LOW(f64p, 0);
-               mask_bits -= 32;
-               mant= F64_GET_MANT_HIGH(f64p);
-               mant &= ~((1 << mask_bits)-1);
-               F64_SET_MANT_HIGH(f64p, mant);
-       }
-       else
-       {
-               mant= F64_GET_MANT_LOW(f64p);
-               mant &= ~((1 << mask_bits)-1);
-               F64_SET_MANT_LOW(f64p, mant);
-       }
-       *iptr= value;
-       return tmp-value;
-}
-
-/*
- * $PchId: modf.c,v 1.3 1996/02/22 21:01:39 philip Exp $
- */
diff --git a/lib/libc/ip/Makefile.inc b/lib/libc/ip/Makefile.inc
deleted file mode 100644 (file)
index f6c0927..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-# ip sources
-.PATH: ${.CURDIR}/ip
-
-SRCS+=  \
-       accept.c \
-       addrinfo.c \
-       bind.c \
-       connect.c \
-       dhcp_gettag.c \
-       dhcp_settag.c \
-       ether_line.c \
-       ethera2n.c \
-       ethere2a.c \
-       etherh2n.c \
-       ethern2h.c \
-       gai_strerror.c \
-       getdomain.c \
-       gethnmadr.c \
-       gethostent.c \
-       gethostname.c \
-       getifaddrs.c \
-       getnetbyaddr.c \
-       getnetbyname.c \
-       getnetent.c \
-       getpeereid.c \
-       getpeername.c \
-       getproto.c \
-       getprotoent.c \
-       getprotoname.c \
-       getservent.c \
-       getsockname.c \
-       getsockopt.c \
-       getsrvbyname.c \
-       getsrvbyport.c \
-       hton.c \
-       inet_addr.c \
-       inet_network.c \
-       inet_ntoa.c \
-       inet_ntop.c \
-       inet_pton.c \
-       listen.c \
-       memcspn.c \
-       nameinfo.c \
-       oneC_sum.c \
-       rcmd.c \
-       recv.c \
-       recvfrom.c \
-       recvmsg.c \
-       res_comp.c \
-       res_init.c \
-       res_mkquery.c \
-       res_query.c \
-       res_send.c \
-       ruserok.c \
-       send.c \
-       sendmsg.c \
-       sendto.c \
-       servxcheck.c \
-       sethostent.c \
-       setsockopt.c \
-       shutdown.c \
-       socket.c \
-       socketpair.c \
-       strcasecmp.c
diff --git a/lib/libc/ip/accept.c b/lib/libc/ip/accept.c
deleted file mode 100644 (file)
index cfbfe93..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include <net/netlib.h>
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_io.h>
-
-#define DEBUG 0
-
-static int _tcp_accept(int socket, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len);
-
-static int _uds_accept(int socket, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len);
-
-int accept(int socket, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len)
-{
-       int r;
-       nwio_udpopt_t udpopt;
-
-       r= _tcp_accept(socket, address, address_len);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-               return r;
-
-       r= _uds_accept(socket, address, address_len);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-               return r;
-
-       /* Unfortunately, we have to return EOPNOTSUPP for a socket that
-        * does not support accept (such as a UDP socket) and ENOTSOCK for
-        * filedescriptors that do not refer to a socket.
-        */
-       r= ioctl(socket, NWIOGUDPOPT, &udpopt);
-       if (r == 0)
-       {
-               /* UDP socket */
-               errno= EOPNOTSUPP;
-               return -1;
-       }
-       if ((errno == ENOTTY || errno == EBADIOCTL))
-       {
-               errno= ENOTSOCK;
-               return -1;
-       }
-
-       return r;
-}
-
-static int _tcp_accept(int socket, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len)
-{
-       int r, s1, t_errno;
-       tcp_cookie_t cookie;
-
-       s1= open(TCP_DEVICE, O_RDWR);
-       if (s1 == -1)
-               return s1;
-       r= ioctl(s1, NWIOGTCPCOOKIE, &cookie);
-       if (r == -1)
-       {
-               t_errno= errno;
-               close(s1);
-               errno= t_errno;
-               return -1;
-       }
-       r= ioctl(socket, NWIOTCPACCEPTTO, &cookie);
-       if (r == -1)
-       {
-               t_errno= errno;
-               close(s1);
-               errno= t_errno;
-               return -1;
-       }
-       if (address != NULL)
-               getpeername(s1, address, address_len);
-       return s1;
-}
-
-static int _uds_accept(int socket, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len)
-{
-       int s1;
-       int r;
-       struct sockaddr_un uds_addr;
-       socklen_t len;
-
-       memset(&uds_addr, '\0', sizeof(struct sockaddr_un));
-
-       r= ioctl(socket, NWIOGUDSADDR, &uds_addr);
-       if (r == -1) {
-               return r;
-       }
-
-       if (uds_addr.sun_family != AF_UNIX) {
-               errno= EINVAL;
-               return -1;
-       }
-
-       len= *address_len;
-       if (len > sizeof(struct sockaddr_un))
-               len = sizeof(struct sockaddr_un);
-
-       memcpy(address, &uds_addr, len);
-       *address_len= len;
-
-       s1= open(UDS_DEVICE, O_RDWR);
-       if (s1 == -1)
-               return s1;
-
-       r= ioctl(s1, NWIOSUDSACCEPT, address);
-       if (r == -1) {
-               int ioctl_errno = errno;
-               close(s1);
-               errno = ioctl_errno;
-               return r;
-       }
-
-       return s1;
-}
diff --git a/lib/libc/ip/addrinfo.c b/lib/libc/ip/addrinfo.c
deleted file mode 100755 (executable)
index 25babc1..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-#include <arpa/inet.h>
-#include <assert.h>
-#include <errno.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <unistd.h>
-
-/*
- * getaddrinfo and freeaddrinfo are based on
- * http://www.opengroup.org/onlinepubs/009695399/functions/getaddrinfo.html
- */
-void freeaddrinfo(struct addrinfo *ai)
-{
-       struct addrinfo *next;
-
-       while (ai)
-       {
-               /* preserve next pointer */
-               next = ai->ai_next;
-
-               /* free each member of the struct and the struct itself */
-               if (ai->ai_addr) free(ai->ai_addr);
-               if (ai->ai_canonname) free(ai->ai_canonname);
-               free(ai);
-
-               /* continue to free the next element of the linked list */
-               ai = next;
-       }
-}
-
-static int getaddrinfo_parse_hints(
-       const struct addrinfo *hints, 
-       int *flags,
-       int *socktype,
-       int *protocol)
-{
-       assert(flags);
-       assert(socktype);
-
-       /* 
-        * if hints is not specified, no flags are specified and all 
-        * socktypes must be returned 
-        */
-       if (!hints)
-       {
-               *flags = 0;
-               *socktype = 0;
-               *protocol = 0;
-               return 0;
-       }
-
-       /* check hints correctness */
-       if (hints->ai_addrlen || hints->ai_addr || 
-               hints->ai_canonname || hints->ai_next)
-       {
-               errno = EINVAL;
-               return EAI_SYSTEM;
-       }
-
-       /* check flags */
-       *flags = hints->ai_flags;
-       if (*flags & ~(AI_PASSIVE | AI_CANONNAME | 
-               AI_NUMERICHOST | AI_NUMERICSERV))
-               return EAI_BADFLAGS;
-
-       /* only support IPv4 */
-       if (hints->ai_family != AF_UNSPEC && hints->ai_family != AF_INET)
-               return EAI_FAMILY;
-
-       /* only support SOCK_STREAM and SOCK_DGRAM */
-       *socktype = hints->ai_socktype;
-       switch (*socktype)
-       {
-               case 0:
-               case SOCK_STREAM:
-               case SOCK_DGRAM: break;
-               default: return EAI_SOCKTYPE;
-       }
-
-       /* get protocol */
-       *protocol = hints->ai_protocol;
-
-       return 0;
-}
-
-static int getaddrinfo_resolve_hostname(
-       const char *nodename,
-       int flags,
-       char ***addr_list,
-       const char **canonname)
-{
-       static struct in_addr addr;
-       static char *addr_array[2];
-       struct hostent *hostent;
-
-       assert(addr_list);
-       assert(canonname);
-
-       /* if no hostname is specified, use local address */
-       if (!nodename)
-       {
-               if ((flags & AI_PASSIVE) == AI_PASSIVE)
-                       addr.s_addr = htonl(INADDR_ANY);
-               else
-                       addr.s_addr = htonl(INADDR_LOOPBACK);
-
-               addr_array[0] = (char *) &addr;
-               addr_array[1] = NULL;
-               *addr_list = addr_array;
-               *canonname = "localhost";
-               return 0;
-       }
-
-       if (!*nodename)
-               return EAI_NONAME;
-
-       /* convert literal IP address */
-       addr.s_addr = inet_addr(nodename);
-       if (addr.s_addr != (in_addr_t) -1)
-       {
-               addr_array[0] = (char *) &addr;
-               addr_array[1] = NULL;
-               *addr_list = addr_array;
-               *canonname = NULL;
-               return 0;
-       }
-
-       /* AI_NUMERICHOST avoids DNS lookup */
-       if ((flags & AI_NUMERICHOST) == AI_NUMERICHOST)
-               return EAI_NONAME;
-
-       /* attempt DNS lookup */
-       hostent = gethostbyname(nodename);
-       if (!hostent)
-               switch(h_errno)
-               {
-                       case HOST_NOT_FOUND: return EAI_NONAME;
-                       case NO_DATA:        return EAI_FAIL;
-                       case NO_RECOVERY:    return EAI_FAIL;
-                       case TRY_AGAIN:      return EAI_AGAIN;
-                       default:             assert(0); return EAI_FAIL;
-               }
-
-       /* assumption: only IPv4 addresses returned */
-       assert(hostent->h_addrtype == AF_INET);
-       assert(hostent->h_length == sizeof(addr));
-       *addr_list = hostent->h_addr_list;
-       *canonname = hostent->h_name;
-       return 0;
-}
-
-int getaddrinfo_resolve_servname(
-       const char *servname,
-       int flags, 
-       int socktype, 
-       unsigned short *port, 
-       int *protocol)
-{
-       char *endptr;
-       long port_long;
-       struct protoent *protoent;
-       struct servent *servent;
-
-       assert(port);
-       assert(protocol);
-
-       /* if not specified, set port and protocol to zero */
-       if (!servname)
-       {
-               *port = 0;
-               *protocol = 0;
-               return 0;
-       }
-
-       if (!*servname)
-               return EAI_SERVICE;
-
-       /* try to parse port number */
-       port_long = strtol(servname, &endptr, 0);
-       if (!*endptr)
-       {
-               /* check whether port is within range */
-               if (port_long < 0 || port_long > (unsigned short) ~0)
-                       return EAI_SERVICE;
-
-               *port = htons(port_long);
-               *protocol = 0;
-               return 0;
-       }
-
-       /* AI_NUMERICSERV avoids lookup */
-       if ((flags & AI_NUMERICSERV) == AI_NUMERICSERV)
-               return EAI_SERVICE;
-
-       /* look up port number */
-       servent = getservbyname(servname, 
-               (socktype == SOCK_STREAM) ? "tcp" : "udp");
-       if (!servent) 
-               return EAI_SERVICE;
-
-       *port = servent->s_port;
-
-       /* determine protocol number */
-       protoent = getprotobyname(servent->s_proto);
-       *protocol = protoent ? protoent->p_proto : 0;
-       return 0;
-}
-
-int getaddrinfo(
-       const char *nodename,
-       const char *servname,
-       const struct addrinfo *hints,
-       struct addrinfo **res)
-{
-       struct addrinfo *addrinfo, **addrinfo_p;
-       char **addr_list;
-       const char *canonname;
-       int flags, i, protocol, protocol_spec, r, result;
-       unsigned short port;
-       struct sockaddr_in *sockaddr;
-       int socktype, socktype_spec;
-
-       /* 
-        * The following flags are supported:
-        * - AI_CANONNAME
-        * - AI_PASSIVE
-        * - AI_NUMERICHOST 
-        * - AI_NUMERICSERV 
-        *
-        * The following flags not supported due to lack of IPv6 support:
-        * - AI_ADDRCONFIG 
-        * - AI_ALL 
-        * - AI_V4MAPPED 
-        */
-
-       /* check arguments */
-       if ((!nodename && !servname) || !res)
-               return EAI_NONAME;
-
-       /* parse hints */
-       if ((r = getaddrinfo_parse_hints(hints, &flags, &socktype_spec, &protocol_spec))) 
-               return r;
-
-       /* resolve hostname */
-       if ((r = getaddrinfo_resolve_hostname(nodename, flags, &addr_list, &canonname)))
-               return r;
-
-       /* return a result record for each address */
-       addrinfo_p = res;
-       *addrinfo_p = NULL;
-       result = EAI_NONAME;
-       while (*addr_list)
-       {
-               /* return a result record for each socktype */
-               for (i = 0; i < 2; i++)
-               {
-                       /* should current socktype be selected? */
-                       socktype = (i == 0) ? SOCK_STREAM : SOCK_DGRAM;
-                       if (socktype_spec != 0 && socktype_spec != socktype)
-                               continue;
-
-                       /* resolve port */
-                       if ((r = getaddrinfo_resolve_servname(servname, flags, socktype, &port, &protocol)))
-                       {
-                               freeaddrinfo(*res);
-                               return r;
-                       }
-
-                       /* enforce matching protocol */
-                       if (!protocol)
-                               protocol = protocol_spec;
-                       else if (protocol_spec && protocol != protocol_spec)
-                               continue;
-
-                       /* allocate result */
-                       *addrinfo_p = addrinfo = (struct addrinfo *) calloc(1, sizeof(struct addrinfo));
-                       if (!addrinfo)
-                       {
-                               freeaddrinfo(*res);
-                               return EAI_MEMORY;
-                       }
-
-                       sockaddr = (struct sockaddr_in *) calloc(1, sizeof(struct sockaddr_in));
-                       if (!sockaddr)
-                       {
-                               freeaddrinfo(*res);
-                               return EAI_MEMORY;
-                       }
-
-                       /* provide information in result */
-                       addrinfo->ai_family = AF_INET;
-                       addrinfo->ai_socktype = socktype;
-                       addrinfo->ai_protocol = protocol;
-                       addrinfo->ai_addrlen = sizeof(*sockaddr);
-                       addrinfo->ai_addr = (struct sockaddr *) sockaddr;
-                       sockaddr->sin_family = AF_INET;
-                       sockaddr->sin_port = port;
-                       memcpy(&sockaddr->sin_addr, *addr_list, sizeof(sockaddr->sin_addr));
-                       if (((flags & AI_CANONNAME) == AI_CANONNAME) && canonname)
-                       {
-                               addrinfo->ai_canonname = strdup(canonname);
-                               if (!addrinfo->ai_canonname)
-                               {
-                                       freeaddrinfo(*res);
-                                       return EAI_MEMORY;
-                               }
-                       }
-                       result = 0;
-
-                       /* chain next result to the current one */
-                       addrinfo_p = &addrinfo->ai_next;
-               }
-
-               /* move on to next address */
-               addr_list++;
-       }
-
-       /* found anything meaningful? */
-       return result;
-}
diff --git a/lib/libc/ip/bind.c b/lib/libc/ip/bind.c
deleted file mode 100644 (file)
index b73828e..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-#include <unistd.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <netinet/in.h>
-
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_io.h>
-#include <sys/un.h>
-
-#include <minix/config.h>
-#include <minix/const.h>
-
-#define DEBUG 0
-
-static int _tcp_bind(int socket, const struct sockaddr *address,
-       socklen_t address_len, nwio_tcpconf_t *tcpconfp);
-static int _udp_bind(int socket, const struct sockaddr *address,
-       socklen_t address_len, nwio_udpopt_t *udpoptp);
-static int _uds_bind(int socket, const struct sockaddr *address,
-       socklen_t address_len, struct sockaddr_un *uds_addr);
-
-int bind(int socket, const struct sockaddr *address, socklen_t address_len)
-{
-       int r;
-       nwio_tcpconf_t tcpconf;
-       nwio_udpopt_t udpopt;
-       struct sockaddr_un uds_addr;
-
-       r= ioctl(socket, NWIOGTCPCONF, &tcpconf);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-                       return r;
-               r= _tcp_bind(socket, address, address_len, &tcpconf);
-#if DEBUG
-               if (r == -1)
-               {
-                       int t_errno= errno;
-                       fprintf(stderr, "bind(tcp) failed: %s\n",
-                               strerror(errno));
-                       errno= t_errno;
-               }
-#endif
-               return r;
-       }
-
-       r= ioctl(socket, NWIOGUDPOPT, &udpopt);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-                       return r;
-               return _udp_bind(socket, address, address_len, &udpopt);
-       }
-
-       r= ioctl(socket, NWIOGUDSADDR, &uds_addr);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-                       return r;
-               return _uds_bind(socket, address, address_len, &uds_addr);
-       }
-
-#if DEBUG
-       fprintf(stderr, "bind: not implemented for fd %d\n", socket);
-#endif
-       errno= ENOSYS;
-       return -1;
-}
-
-static int _tcp_bind(int socket, const struct sockaddr *address,
-       socklen_t address_len, nwio_tcpconf_t *tcpconfp)
-{
-       int r;
-       nwio_tcpconf_t tcpconf;
-       struct sockaddr_in *sinp;
-
-       sinp= (struct sockaddr_in *)address;
-       if (sinp->sin_family != AF_INET || address_len != sizeof(*sinp))
-       {
-#if DEBUG
-               fprintf(stderr, "bind(tcp): sin_family = %d, len = %d\n",
-                       sinp->sin_family, address_len);
-#endif
-               errno= EAFNOSUPPORT;
-               return -1;
-       }
-
-       if (sinp->sin_addr.s_addr != INADDR_ANY &&
-               sinp->sin_addr.s_addr != tcpconfp->nwtc_locaddr)
-       {
-               errno= EADDRNOTAVAIL;
-               return -1;
-       }
-
-       tcpconf.nwtc_flags= 0;
-
-       if (sinp->sin_port == 0)
-               tcpconf.nwtc_flags |= NWTC_LP_SEL;
-       else
-       {
-               tcpconf.nwtc_flags |= NWTC_LP_SET;
-               tcpconf.nwtc_locport= sinp->sin_port;
-       }
-
-       r= ioctl(socket, NWIOSTCPCONF, &tcpconf);
-       return r;
-}
-
-static int _udp_bind(int socket, const struct sockaddr *address,
-       socklen_t address_len, nwio_udpopt_t *udpoptp)
-{
-       int r;
-       unsigned long curr_flags;
-       nwio_udpopt_t udpopt;
-       struct sockaddr_in *sinp;
-
-       sinp= (struct sockaddr_in *)address;
-       if (sinp->sin_family != AF_INET || address_len != sizeof(*sinp))
-       {
-#if DEBUG
-               fprintf(stderr, "bind(udp): sin_family = %d, len = %d\n",
-                       sinp->sin_family, address_len);
-#endif
-               errno= EAFNOSUPPORT;
-               return -1;
-       }
-
-       if (sinp->sin_addr.s_addr != INADDR_ANY &&
-               sinp->sin_addr.s_addr != udpoptp->nwuo_locaddr)
-       {
-               errno= EADDRNOTAVAIL;
-               return -1;
-       }
-
-       udpopt.nwuo_flags= 0;
-
-       if (sinp->sin_port == 0)
-               udpopt.nwuo_flags |= NWUO_LP_SEL;
-       else
-       {
-               udpopt.nwuo_flags |= NWUO_LP_SET;
-               udpopt.nwuo_locport= sinp->sin_port;
-       }
-
-       curr_flags= udpoptp->nwuo_flags;
-       if (!(curr_flags & NWUO_ACC_MASK))
-               udpopt.nwuo_flags |= NWUO_EXCL;
-       if (!(curr_flags & (NWUO_EN_LOC|NWUO_DI_LOC)))
-               udpopt.nwuo_flags |= NWUO_EN_LOC;
-       if (!(curr_flags & (NWUO_EN_BROAD|NWUO_DI_BROAD)))
-               udpopt.nwuo_flags |= NWUO_EN_BROAD;
-       if (!(curr_flags & (NWUO_RP_SET|NWUO_RP_ANY)))
-               udpopt.nwuo_flags |= NWUO_RP_ANY;
-       if (!(curr_flags & (NWUO_RA_SET|NWUO_RA_ANY)))
-               udpopt.nwuo_flags |= NWUO_RA_ANY;
-       if (!(curr_flags & (NWUO_RWDATONLY|NWUO_RWDATALL)))
-               udpopt.nwuo_flags |= NWUO_RWDATALL;
-       if (!(curr_flags & (NWUO_EN_IPOPT|NWUO_DI_IPOPT)))
-               udpopt.nwuo_flags |= NWUO_DI_IPOPT;
-
-       r= ioctl(socket, NWIOSUDPOPT, &udpopt);
-       return r;
-}
-
-static int _uds_bind(int socket, const struct sockaddr *address,
-       socklen_t address_len, struct sockaddr_un *uds_addr)
-{
-       int r;
-       int did_mknod;
-
-       if (address == NULL) {
-               errno = EFAULT;
-               return -1;
-       }
-
-       did_mknod = 0;
-
-       r = mknod(((struct sockaddr_un *) address)->sun_path,
-               S_IFSOCK|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH, 0);
-
-       if (r == -1 && errno != EEXIST) {
-               return -1;
-       } else if (r == 0) {
-               did_mknod = 1;
-       }
-
-       /* perform the bind */
-       r= ioctl(socket, NWIOSUDSADDR, (void *) address);
-
-       if (r == -1 && did_mknod) {
-
-               /* bind() failed in pfs, so we roll back the 
-                * file system change
-                */
-               unlink(((struct sockaddr_un *) address)->sun_path);
-       }
-
-       return r;
-}
diff --git a/lib/libc/ip/connect.c b/lib/libc/ip/connect.c
deleted file mode 100644 (file)
index f1f4b66..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <netinet/in.h>
-
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_io.h>
-
-#include <minix/const.h>
-
-#define DEBUG 0
-
-static int _tcp_connect(int socket, const struct sockaddr *address,
-       socklen_t address_len, nwio_tcpconf_t *tcpconfp);
-static int _udp_connect(int socket, const struct sockaddr *address,
-       socklen_t address_len, nwio_udpopt_t *udpoptp);
-static int _uds_connect(int socket, const struct sockaddr *address,
-       socklen_t address_len);
-
-int connect(int socket, const struct sockaddr *address,
-       socklen_t address_len)
-{
-       int r;
-       nwio_tcpconf_t tcpconf;
-       nwio_udpopt_t udpopt;
-
-       r= ioctl(socket, NWIOGTCPCONF, &tcpconf);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _tcp_connect(socket, address, address_len, &tcpconf);
-       }
-
-       r= ioctl(socket, NWIOGUDPOPT, &udpopt);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _udp_connect(socket, address, address_len, &udpopt);
-       }
-
-       r= _uds_connect(socket, address, address_len);
-       if (r != -1 ||
-               (errno != ENOTTY && errno != EBADIOCTL &&
-                errno != EAFNOSUPPORT))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-
-               return r;
-       }
-
-#if DEBUG
-       fprintf(stderr, "connect: not implemented for fd %d\n", socket);
-#endif
-       errno= ENOSYS;
-       return -1;
-}
-
-static int _tcp_connect(int socket, const struct sockaddr *address,
-       socklen_t address_len, nwio_tcpconf_t *tcpconfp)
-{
-       int r;
-       struct sockaddr_in *sinp;
-       nwio_tcpconf_t tcpconf;
-       nwio_tcpcl_t tcpcl;
-
-       if (address_len != sizeof(*sinp))
-       {
-               errno= EINVAL;
-               return -1;
-       }
-       sinp= (struct sockaddr_in *)address;
-       if (sinp->sin_family != AF_INET)
-       {
-               errno= EINVAL;
-               return -1;
-       }
-       tcpconf.nwtc_flags= NWTC_SET_RA | NWTC_SET_RP;
-       if ((tcpconfp->nwtc_flags & NWTC_LOCPORT_MASK) == NWTC_LP_UNSET)
-               tcpconf.nwtc_flags |= NWTC_LP_SEL;
-       tcpconf.nwtc_remaddr= sinp->sin_addr.s_addr;
-       tcpconf.nwtc_remport= sinp->sin_port;
-
-       if (ioctl(socket, NWIOSTCPCONF, &tcpconf) == -1)
-        {
-               /* Ignore EISCONN error. The NWIOTCPCONN ioctl will get the
-                * right error.
-                */
-               if (errno != EISCONN)
-                       return -1;
-       }
-
-       tcpcl.nwtcl_flags= TCF_DEFAULT;
-
-       r= fcntl(socket, F_GETFL);
-       if (r == 1)
-               return -1;
-       if (r & O_NONBLOCK)
-               tcpcl.nwtcl_flags |= TCF_ASYNCH;
-
-       r= ioctl(socket, NWIOTCPCONN, &tcpcl);
-       return r;
-}
-
-static int _udp_connect(int socket, const struct sockaddr *address,
-       socklen_t address_len, nwio_udpopt_t *udpoptp)
-{
-       int r;
-       struct sockaddr_in *sinp;
-       nwio_udpopt_t udpopt;
-
-       if (address == NULL)
-       {
-               /* Unset remote address */
-               udpopt.nwuo_flags= NWUO_RP_ANY | NWUO_RA_ANY | NWUO_RWDATALL;
-
-               r= ioctl(socket, NWIOSUDPOPT, &udpopt);
-               return r;
-       }
-
-       if (address_len != sizeof(*sinp))
-       {
-               errno= EINVAL;
-               return -1;
-       }
-       sinp= (struct sockaddr_in *)address;
-       if (sinp->sin_family != AF_INET)
-       {
-               errno= EINVAL;
-               return -1;
-       }
-       udpopt.nwuo_flags= NWUO_RP_SET | NWUO_RA_SET | NWUO_RWDATONLY;
-       if ((udpoptp->nwuo_flags & NWUO_LOCPORT_MASK) == NWUO_LP_ANY)
-               udpopt.nwuo_flags |= NWUO_LP_SEL;
-       udpopt.nwuo_remaddr= sinp->sin_addr.s_addr;
-       udpopt.nwuo_remport= sinp->sin_port;
-
-       r= ioctl(socket, NWIOSUDPOPT, &udpopt);
-       return r;
-}
-
-static int _uds_connect(int socket, const struct sockaddr *address,
-       socklen_t address_len)
-{
-
-       if (address == NULL) {
-               errno = EFAULT;
-               return -1;
-       }
-
-       /* perform the connect */
-       return ioctl(socket, NWIOSUDSCONN, (void *) address);
-}
diff --git a/lib/libc/ip/ether.h b/lib/libc/ip/ether.h
deleted file mode 100644 (file)
index 0923990..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/* Interface definitions for ethernet access library */
-
-typedef union etheraddr
-{
-    unsigned char bytes[6];            /* byteorder safe initialization */
-    unsigned short shorts[3];          /* force 2-byte alignment */
-}
-         ether_addr;
-
-typedef struct etherpacket
-{
-    ether_addr dest;
-    ether_addr src;
-    unsigned char type[2];             /* in network byte order! */
-    unsigned short pktlen;             /* length of pktbuf ONLY */
-    char *pktbuf;
-}
-           ether_packet;
-
-typedef struct ethervec
-{
-    ether_addr dest;
-    ether_addr src;
-    unsigned char type[2];             /* in network byte order! */
-    unsigned short iovcnt;             /* number of iovec to use */
-    struct iovec *iov;                 /* ptr to array of iovec */
-}
-        ether_vec;
-
-#ifndef __ETHER_BCAST_ADDR__
-extern ether_addr ether_bcast_addr;
-#endif
-
-#ifdef __STDC__
-
-int ether_open (char *name, unsigned type, ether_addr * address);
-
-ether_addr *ether_address (int fd, ether_addr * address);
-
-ether_addr *ether_intfaddr (char *intf, ether_addr * address);
-
-char **ether_interfaces (void);
-
-int ether_write (int fd, ether_packet * packet);
-
-int ether_writev (int fd, ether_vec * packet);
-
-int ether_read (int fd, ether_packet * packet);
-
-int ether_readv (int fd, ether_vec * packet);
-
-int ether_blocking (int fd, int state);
-
-int ether_send_self (int fd);
-
-int ether_mcast_self (int fd);
-
-int ether_bcast_self (int fd);
-
-char *ether_ntoa (ether_addr *);
-
-ether_addr *ether_aton (char *);
-
-#ifdef __GNUC__
-
-/*
- * Avoid stupid warnings if structs aren't defined
- */
-
-typedef struct in_addr *_ether_NoNsEnSe;
-typedef struct hostent *_ether_nOnSeNsE;
-
-#endif
-
-char *ether_e2a (ether_addr *, char *);
-
-ether_addr *ether_a2e (char *, ether_addr *);
-
-struct in_addr *ether_e2ip (ether_addr *, struct in_addr *);
-
-ether_addr *ether_ip2e (struct in_addr *, ether_addr *);
-
-char *ether_e2host (ether_addr *, char *);
-
-ether_addr *ether_host2e (char *, ether_addr *);
-
-ether_addr *ether_hostent2e (struct hostent *, ether_addr *);
-
-#else
-
-int ether_open ();
-ether_addr *ether_address ();
-ether_addr *ether_intfaddr ();
-char **ether_interfaces ();
-int ether_write ();
-int ether_writev ();
-int ether_read ();
-int ether_readv ();
-int ether_blocking ();
-int ether_send_self ();
-int ether_mcast_self ();
-int ether_bcast_self ();
-
-char *ether_ntoa ();
-ether_addr *ether_aton ();
-char *ether_e2a ();
-ether_addr *ether_a2e ();
-struct in_addr *ether_e2ip ();
-ether_addr *ether_ip2e ();
-char *ether_e2host ();
-ether_addr *ether_host2e ();
-ether_addr *ether_hostent2e ();
-
-#endif
-
-#undef ether_cmp                       /* lose def from netinet/if_ether.h */
-
-#define ether_cmp(addr1,addr2) \
- ((addr1)->shorts[0] != (addr2)->shorts[0] \
-  || (addr1)->shorts[1] != (addr2)->shorts[1] \
-  || (addr1)->shorts[2] != (addr2)->shorts[2])
-
-#define ETHERSTRLEN 18                 /* max length of "xx:xx:xx:xx:xx:xx" */
-
-#ifdef NOFILE                          /* i.e. we have included sys/param.h */
-#ifndef MAXHOSTNAMELEN                 /* but MAXHOSTNAMELEN still isnt set */
-#define MAXHOSTNAMELEN 64
-#endif
-#endif
-
-/* should be defined in terms of ether_packet struct; need offsetof() macro */
-
-#define ETHER_DST      0
-#define ETHER_SRC      6
-#define ETHER_TYPE     12
-#define ETHER_PKT      14
-#define ETHER_MIN      46
-#define ETHER_MAX      1500
-
-#define ETHER_MINTYPE  0x5DD           /* lowest protocol not valid IEEE802 */
-#define ETHER_MAXTYPE  0xFFFF          /* largest possible protocol */
-
-#define ETHER_MCAST(addr) (((unsigned char *) (addr))[0] & 0x01)
-
-#ifdef NT_ALLTYPES
-#define ETHER_ALLTYPES NT_ALLTYPES
-#else
-#define ETHER_ALLTYPES ((unsigned) -1)
-#endif
diff --git a/lib/libc/ip/ether_line.c b/lib/libc/ip/ether_line.c
deleted file mode 100644 (file)
index b88fa34..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-**  ETHER_LINE
-**
-**     This routine parses the array pointed to by "line" (which should be
-**     from a file in the format of /etc/ethers) and returns in "eaddr" the
-**     ethernet address at the start of the line and the corresponding host
-**     name in "hostname".  It assumes either tabs or spaces separate the
-**     two.  The buffer pointed to by "hostname" must be big enough to hold
-**     the host name plus a NULL byte.
-**     The function returns 0 on success and 1 on failure.
-**     Arguments are assumed sensible.  Null pointers will probably cause
-**     exceptions.
-**     Author: Gregory J. Sharp, July 1990
-**     Adapted to MINIX: Philip Homburg, May 1992
-*/
-
-#include <sys/types.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <net/gen/ether.h>
-#include <net/gen/if_ether.h>
-
-int
-ether_line(line, eaddr, hostname)
-char *                 line;
-struct ether_addr *    eaddr;
-char *                 hostname;
-{
-    register int i;
-    register unsigned long val;
-
-/* skip leading white space */
-    while (*line != '\n' && (*line == ' ' || *line == '\t'))
-       line++;
-
-/* read the ethernet address */
-    for (i = 0; i < 5; i++)
-    {
-       val = (unsigned long) strtol(line, &line, 16);
-       if (val > 255 || *line++ != ':')
-           return 1;
-       eaddr->ea_addr[i] = val & 0xff;
-    }
-    val = (unsigned long) strtol(line, &line, 16);
-    if (val > 255 || (*line != ' ' && *line != '\t'))
-       return 1;
-    eaddr->ea_addr[i] = val & 0xff;
-
-/* skip leading white space */
-    while (*line != '\n' && (*line == ' ' || *line == '\t'))
-       line++;
-
-/* read in the hostname */
-    while (!isspace(*line))
-       *hostname++ = *line++;
-    *hostname = '\0';
-    return 0;
-}
diff --git a/lib/libc/ip/ethera2n.c b/lib/libc/ip/ethera2n.c
deleted file mode 100644 (file)
index 601999d..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-ethera2n.c
-
-Convert an ASCII string with an ethernet address into a struct ether_addr.
-
-Created:       Nov 17, 1992 by Philip Homburg
-*/
-
-#include <sys/types.h>
-#include <stdlib.h>
-#include <net/gen/ether.h>
-#include <net/gen/if_ether.h>
-
-struct ether_addr *ether_aton(s)
-_CONST char *s;
-{
-       static struct ether_addr ea;
-
-       int i;
-       long v;
-       char *check;
-
-       if (s == NULL)
-               return NULL;
-
-       for (i=0; i<6; i++)
-       {
-               v= strtol(s, &check, 16);
-               if (v<0 || v>255)
-                       return NULL;
-               if ((i<5 && check[0] != ':') || (i == 5 && check[0] != '\0'))
-                       return NULL;
-               ea.ea_addr[i]= v;
-               s= check+1;
-       }
-       return &ea;
-}
-
-/*
- * $PchId: ethera2n.c,v 1.3 1996/02/22 21:10:01 philip Exp $
- */
diff --git a/lib/libc/ip/ethere2a.c b/lib/libc/ip/ethere2a.c
deleted file mode 100644 (file)
index 5876cda..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* This file was part of the etherlib package. */
-
-#include <stdio.h>
-
-#ifdef _MINIX
-#include <sys/types.h>
-#include <stdlib.h>
-
-#include <net/gen/ether.h>
-#include <net/gen/if_ether.h>
-
-#define ETHERSTRLEN 18                 /* max length of "xx:xx:xx:xx:xx:xx" */
-#define ether_addr     ether_addr_t
-#define bytes          ea_addr
-char *ether_e2a _ARGS(( ether_addr_t *a, char *e ));
-#else
-#include "libether.h"
-#endif
-
-char *
-ether_e2a (addr, estring)
-ether_addr *addr;
-char *estring;
-{
-#ifdef lint
-    char *sprintf ();
-#endif
-    if (estring == NULL)
-       estring = (char *) malloc (ETHERSTRLEN);
-
-    if (estring != NULL)
-       (void) sprintf (estring, "%x:%x:%x:%x:%x:%x",
-                       addr->bytes[0], addr->bytes[1], addr->bytes[2],
-                       addr->bytes[3], addr->bytes[4], addr->bytes[5]);
-    return (estring);
-}
-
-#ifndef ETHERDB
-
-char *
-ether_ntoa (addr)
-ether_addr *addr;
-{
-    static char estring[ETHERSTRLEN];
-
-    return (ether_e2a (addr, estring));
-}
-
-#endif
diff --git a/lib/libc/ip/etherh2n.c b/lib/libc/ip/etherh2n.c
deleted file mode 100644 (file)
index fa4b188..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-etherh2n.c
-
-Created:       May 20, 1992 by Philip Homburg
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <net/gen/if_ether.h>
-
-int
-ether_hostton(hostname, e)
-char *hostname;
-struct ether_addr *e;
-{
-       FILE *etherf;
-       char b[256], hn[256];
-
-       etherf= fopen(_PATH_ETHERS, "r");
-       if (etherf == NULL)
-               return 1;
-
-       while(fgets(b, sizeof(b), etherf) != NULL)
-       {
-               if (ether_line(b, e, hn) == 0 && strcmp(hn, hostname) == 0)
-               {
-                       fclose(etherf);
-                       return 0;
-               }
-       }
-       fclose(etherf);
-       return 1;
-}
diff --git a/lib/libc/ip/ethern2h.c b/lib/libc/ip/ethern2h.c
deleted file mode 100644 (file)
index cf4e791..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-ethern2h.c
-
-Created:       Nov 12, 1992 by Philip Homburg
-*/
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <net/gen/ether.h>
-#include <net/gen/if_ether.h>
-
-int
-ether_ntohost(hostname, e)
-char *hostname;
-struct ether_addr *e;
-{
-       FILE *etherf;
-       char b[256];
-       struct ether_addr e_tmp;
-
-       etherf= fopen(_PATH_ETHERS, "r");
-       if (etherf == NULL)
-               return 1;
-
-       while(fgets(b, sizeof(b), etherf) != NULL)
-       {
-               if (ether_line(b, &e_tmp, hostname) == 0 && 
-               memcmp(&e_tmp, e, sizeof(e_tmp)) == 0)
-               {
-                       fclose(etherf);
-                       return 0;
-               }
-       }
-       fclose(etherf);
-       return 1;
-}
diff --git a/lib/libc/ip/gai_strerror.c b/lib/libc/ip/gai_strerror.c
deleted file mode 100755 (executable)
index ccb0acf..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#include <errno.h>
-#include <netdb.h>
-#include <stdio.h> 
-#include <string.h>
-
-/*
- * gai_strerror is based on
- * http://www.opengroup.org/onlinepubs/009695399/functions/gai_strerror.html 
- */
-const char *gai_strerror(int ecode)
-{
-       static char buffer[256];
-
-       /* check for each known error code */
-       switch (ecode)
-       {
-               case EAI_AGAIN:
-                       return "The name could not be resolved at this time";
-
-               case EAI_BADFLAGS:
-                       return "The flags had an invalid value";
-
-               case EAI_FAIL:
-                       return "A non-recoverable error occurred";
-
-               case EAI_FAMILY:
-                       return "The address family was not recognized or the "
-                               "address length was invalid for the specified "
-                               "family";
-
-               case EAI_MEMORY:
-                       return "There was a memory allocation failure";
-
-               case EAI_NONAME:
-                       return "The name does not resolve for the supplied "
-                               "parameters, NI_NAMEREQD is set and the host's "
-                               "name cannot be located, or both nodename and "
-                               "servname were null";
-
-               case EAI_SERVICE:
-                       return "The service passed was not recognized for the "
-                               "specified socket type";
-
-               case EAI_SOCKTYPE:
-                       return "The intended socket type was not recognized";
-
-               case EAI_SYSTEM:
-                       snprintf(buffer, 
-                               sizeof(buffer), 
-                               "A system error occurred: %s",
-                               strerror(errno));
-                       return buffer;
-
-               case EAI_OVERFLOW:
-                       return "An argument buffer overflowed";
-       }
-
-       /* unknown error code */
-       snprintf(buffer, 
-               sizeof(buffer), 
-               "An unknown error code was passed to gai_strerror: %d",
-               ecode);
-       return buffer;
-}
diff --git a/lib/libc/ip/getdomain.c b/lib/libc/ip/getdomain.c
deleted file mode 100644 (file)
index 8da6942..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*     getdomainname()                                 Author: Kees J. Bot
- *                                                             2 Dec 1994
- */
-#define nil 0
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-
-int getdomainname(char *domain, size_t size)
-{
-       char nodename[256];
-       char *dot;
-
-       if (gethostname(nodename, sizeof(nodename)) < 0)
-               return -1;
-       nodename[sizeof(nodename)-1]= 0;
-       if ((dot= strchr(nodename, '.')) == nil) dot= ".";
-
-       strncpy(domain, dot+1, size);
-       if (size > 0) domain[size-1]= 0;
-       return 0;
-}
diff --git a/lib/libc/ip/gethnmadr.c b/lib/libc/ip/gethnmadr.c
deleted file mode 100644 (file)
index e7368eb..0000000
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Copyright (c) 1985, 1988 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gethostnamadr.c    6.41 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef _MINIX
-#include <sys/types.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <net/hton.h>
-#include <net/gen/nameser.h>
-#include <net/gen/netdb.h>
-#include <net/gen/in.h>
-#include <net/gen/inet.h>
-#include <net/gen/resolv.h>
-#include <net/gen/socket.h>
-#else
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <ctype.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-#endif /* AMOEABA */
-
-#define        MAXALIASES      35
-#define        MAXADDRS        35
-
-static char *h_addr_ptrs[MAXADDRS + 1];
-
-#ifdef _MINIX
-union querybuf;
-
-extern int dn_skipname _ARGS(( const u_char *comp_dn, const u_char *eom ));
-#define getshort _getshort
-static struct hostent *getanswer _ARGS(( union querybuf *answer, int anslen, 
-       int iquery ));
-#define bcmp memcmp
-#define bcopy(s, d, l) memcpy(d, s, l)
-#endif /* _MINIX */
-
-static struct hostent host;
-static char *host_aliases[MAXALIASES];
-static char hostbuf[BUFSIZ+1];
-static struct in_addr host_addr;
-
-#ifndef _MINIX
-char *strpbrk();
-#endif /* !_MINIX */
-
-#if PACKETSZ > 1024
-#define        MAXPACKET       PACKETSZ
-#else
-#define        MAXPACKET       1024
-#endif
-
-typedef union querybuf
-{
-       dns_hdr_t hdr;
-       u_char buf[MAXPACKET];
-} querybuf_t;
-
-typedef union align {
-    long al;
-    char ac;
-} align_t;
-
-static struct hostent *
-getanswer(answer, anslen, iquery)
-       querybuf_t *answer;
-       int anslen;
-       int iquery;
-{
-       register dns_hdr_t *hp;
-       register u_char *cp;
-       register int n;
-       u_char *eom;
-       char *bp, **ap;
-       int type, class, buflen, ancount, qdcount;
-       int haveanswer, getclass = C_ANY;
-       char **hap;
-
-       eom = answer->buf + anslen;
-       /*
-        * find first satisfactory answer
-        */
-       hp = &answer->hdr;
-       ancount = ntohs(hp->dh_ancount);
-       qdcount = ntohs(hp->dh_qdcount);
-       bp = hostbuf;
-       buflen = sizeof(hostbuf);
-       cp = answer->buf + sizeof(dns_hdr_t);
-       if (qdcount) {
-               if (iquery) {
-                       if ((n = dn_expand((u_char *)answer->buf, eom,
-                            cp, (u_char *)bp, buflen)) < 0) {
-                               h_errno = NO_RECOVERY;
-                               return ((struct hostent *) NULL);
-                       }
-                       cp += n + QFIXEDSZ;
-                       host.h_name = bp;
-                       n = strlen(bp) + 1;
-                       bp += n;
-                       buflen -= n;
-               } else
-                       cp += dn_skipname(cp, eom) + QFIXEDSZ;
-               while (--qdcount > 0)
-                       cp += dn_skipname(cp, eom) + QFIXEDSZ;
-       } else if (iquery) {
-               if (hp->dh_flag1 & DHF_AA)
-                       h_errno = HOST_NOT_FOUND;
-               else
-                       h_errno = TRY_AGAIN;
-               return ((struct hostent *) NULL);
-       }
-       ap = host_aliases;
-       *ap = NULL;
-       host.h_aliases = host_aliases;
-       hap = h_addr_ptrs;
-       *hap = NULL;
-#if BSD >= 43 || defined(h_addr)       /* new-style hostent structure */
-       host.h_addr_list = h_addr_ptrs;
-#endif
-       haveanswer = 0;
-       while (--ancount >= 0 && cp < eom) {
-               if ((n = dn_expand((u_char *)answer->buf, eom, cp, (u_char *)bp,
-                       buflen)) < 0)
-                       break;
-               cp += n;
-               type = getshort(cp);
-               cp += sizeof(u_short);
-               class = getshort(cp);
-               cp += sizeof(u_short) + sizeof(u_long);
-               n = getshort(cp);
-               cp += sizeof(u_short);
-               if (type == T_CNAME) {
-                       cp += n;
-                       if (ap >= &host_aliases[MAXALIASES-1])
-                               continue;
-                       *ap++ = bp;
-                       n = strlen(bp) + 1;
-                       bp += n;
-                       buflen -= n;
-                       continue;
-               }
-               if (iquery && type == T_PTR) {
-                       if ((n = dn_expand((u8_t *)answer->buf, eom,
-                           cp, (u8_t *)bp, buflen)) < 0) {
-                               cp += n;
-                               continue;
-                       }
-                       cp += n;
-                       host.h_name = bp;
-                       return(&host);
-               }
-               if (iquery || type != T_A)  {
-#ifdef DEBUG
-                       if (_res.options & RES_DEBUG)
-                               printf("unexpected answer type %d, size %d\n",
-                                       type, n);
-#endif
-                       cp += n;
-                       continue;
-               }
-               if (haveanswer) {
-                       if (n != host.h_length) {
-                               cp += n;
-                               continue;
-                       }
-                       if (class != getclass) {
-                               cp += n;
-                               continue;
-                       }
-               } else {
-                       host.h_length = n;
-                       getclass = class;
-                       host.h_addrtype = (class == C_IN) ? AF_INET : AF_UNSPEC;
-                       if (!iquery) {
-                               host.h_name = bp;
-                               bp += strlen(bp) + 1;
-                       }
-               }
-
-               bp += (size_t)(sizeof(align_t) - 
-                                               ((u_long)bp % sizeof(align_t)));
-
-               if (bp + n >= &hostbuf[sizeof(hostbuf)]) {
-#ifdef DEBUG
-                       if (_res.options & RES_DEBUG)
-                               printf("size (%d) too big\n", n);
-#endif
-                       break;
-               }
-               bcopy(cp, *hap++ = bp, n);
-               bp +=n;
-               cp += n;
-               haveanswer++;
-       }
-       if (haveanswer) {
-               *ap = NULL;
-#if BSD >= 43 || defined(h_addr)       /* new-style hostent structure */
-               *hap = NULL;
-#else
-               host.h_addr = h_addr_ptrs[0];
-#endif
-               return (&host);
-       } else {
-               h_errno = TRY_AGAIN;
-               return ((struct hostent *) NULL);
-       }
-}
-
-struct hostent *
-gethostbyname(name)
-       _CONST char *name;
-{
-       querybuf_t buf;
-       register _CONST char *cp;
-       int n;
-
-       /*
-        * disallow names consisting only of digits/dots, unless
-        * they end in a dot.
-        */
-       if (isdigit(name[0]))
-               for (cp = name;; ++cp) {
-                       if (!*cp) {
-                               if (*--cp == '.')
-                                       break;
-                               /*
-                                * All-numeric, no dot at the end.
-                                * Fake up a hostent as if we'd actually
-                                * done a lookup.  What if someone types
-                                * 255.255.255.255?  The test below will
-                                * succeed spuriously... ???
-                                */
-                               if ((host_addr.s_addr = inet_addr(name)) == -1) {
-                                       h_errno = HOST_NOT_FOUND;
-                                       return((struct hostent *) NULL);
-                               }
-                               host.h_name = (char *) name;
-                               host.h_aliases = host_aliases;
-                               host_aliases[0] = NULL;
-                               host.h_addrtype = AF_INET;
-                               host.h_length = sizeof(u_long);
-                               h_addr_ptrs[0] = (char *)&host_addr;
-                               h_addr_ptrs[1] = (char *)0;
-#if BSD >= 43 || defined(h_addr)       /* new-style hostent structure */
-                               host.h_addr_list = h_addr_ptrs;
-#else
-                               host.h_addr = h_addr_ptrs[0];
-#endif
-                               return (&host);
-                       }
-                       if (!isdigit(*cp) && *cp != '.') 
-                               break;
-               }
-
-       if ((n = res_search((char*)name, C_IN, T_A, buf.buf, sizeof(buf))) < 0) {
-#ifdef DEBUG
-               if (_res.options & RES_DEBUG)
-                       printf("res_search failed\n");
-#endif
-               return ((struct hostent *) NULL);
-       }
-       return (getanswer(&buf, n, 0));
-}
-
-struct hostent *
-gethostbyaddr(addr, len, type)
-       const char *addr;
-       int len, type;
-{
-       int n;
-       querybuf_t buf;
-       register struct hostent *hp;
-       char qbuf[MAXDNAME];
-       
-       if (type != AF_INET)
-               return ((struct hostent *) NULL);
-       (void)sprintf(qbuf, "%u.%u.%u.%u.in-addr.arpa",
-               ((unsigned)addr[3] & 0xff),
-               ((unsigned)addr[2] & 0xff),
-               ((unsigned)addr[1] & 0xff),
-               ((unsigned)addr[0] & 0xff));
-       n = res_query(qbuf, C_IN, T_PTR, (u8_t *)&buf, sizeof(buf));
-       if (n < 0) {
-#ifdef DEBUG
-               if (_res.options & RES_DEBUG)
-                       printf("res_query failed\n");
-#endif
-               return ((struct hostent *) NULL);
-       }
-       hp = getanswer(&buf, n, 1);
-       if (hp == NULL)
-               return ((struct hostent *) NULL);
-       hp->h_addrtype = type;
-       hp->h_length = len;
-       h_addr_ptrs[0] = (char *)&host_addr;
-       h_addr_ptrs[1] = (char *)0;
-       host_addr = *(struct in_addr *)addr;
-#if BSD < 43 && !defined(h_addr)       /* new-style hostent structure */
-       hp->h_addr = h_addr_ptrs[0];
-#endif
-       return(hp);
-}
diff --git a/lib/libc/ip/gethostent.c b/lib/libc/ip/gethostent.c
deleted file mode 100644 (file)
index 1a9aed2..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-/*     gethostent() - Interface to /etc/hosts          Author: Kees J. Bot
- *                                                             31 May 1999
- */
-
-/* Prefix the functions defined here with underscores to distinguish them
- * from the newer replacements in the resolver library.
- */
-#define sethostent     _sethostent
-#define endhostent     _endhostent
-#define gethostent     _gethostent
-#define gethostbyname  _gethostbyname
-#define gethostbyaddr  _gethostbyaddr
-
-#define nil 0
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <net/gen/netdb.h>
-#include <net/gen/in.h>
-#include <net/gen/inet.h>
-#include <net/gen/socket.h>
-
-#define arraysize(a)   (sizeof(a) / sizeof((a)[0]))
-#define arraylimit(a)  ((a) + arraysize(a))
-#define isspace(c)     ((unsigned) (c) <= ' ')
-
-static char HOSTS[]= _PATH_HOSTS;
-static char *hosts= HOSTS;     /* Current hosts file. */
-static FILE *hfp;              /* Open hosts file. */
-
-void sethostent(int stayopen)
-/* Start search.  (Same as ending it.) */
-{
-    endhostent();
-}
-
-void endhostent(void)
-/* End search and reinitialize. */
-{
-    if (hfp != nil) {
-       fclose(hfp);
-       hfp= nil;
-    }
-    hosts= _PATH_HOSTS;
-}
-
-struct hostent *gethostent(void)
-/* Return the next entry from the hosts files. */
-{
-    static char line[256];     /* One line in a hosts file. */
-    static ipaddr_t addr;      /* IP address found first on the line. */
-    static char *names[16];    /* Pointers to the words on the line. */
-    static char *addrs[2]= {   /* List of IP addresses (just one.) */
-       (char *) &addr,
-       nil,
-    };
-    static struct hostent host = {
-       nil,                    /* h_name, will set to names[1]. */
-       names + 2,              /* h_aliases, the rest of the names. */
-       AF_INET,                /* h_addrtype */
-       sizeof(ipaddr_t),       /* Size of an address in the address list. */
-       addrs,                  /* List of IP addresses. */
-    };
-    static char nexthosts[128];        /* Next hosts file to include. */
-    char *lp, **np;
-    int c;
-
-    for (;;) {
-       if (hfp == nil) {
-           /* No hosts file open, try to open the next one. */
-           if (hosts == 0) return nil;
-           if ((hfp= fopen(hosts, "r")) == nil) { hosts= nil; continue; }
-       }
-
-       /* Read a line. */
-       lp= line;
-       while ((c= getc(hfp)) != EOF && c != '\n') {
-           if (lp < arraylimit(line)) *lp++= c;
-       }
-
-       /* EOF?  Then close and prepare for reading the next file. */
-       if (c == EOF) {
-           fclose(hfp);
-           hfp= nil;
-           hosts= nil;
-           continue;
-       }
-
-       if (lp == arraylimit(line)) continue;
-       *lp= 0;
-
-       /* Break the line up in words. */
-       np= names;
-       lp= line;
-       for (;;) {
-           while (isspace(*lp) && *lp != 0) lp++;
-           if (*lp == 0 || *lp == '#') break;
-           if (np == arraylimit(names)) break;
-           *np++= lp;
-           while (!isspace(*lp) && *lp != 0) lp++;
-           if (*lp == 0) break;
-           *lp++= 0;
-       }
-
-       if (np == arraylimit(names)) continue;
-       *np= nil;
-
-       /* Special "include file" directive. */
-       if (np == names + 2 && strcmp(names[0], "include") == 0) {
-           fclose(hfp);
-           hfp= nil;
-           hosts= nil;
-           if (strlen(names[1]) < sizeof(nexthosts)) {
-               strcpy(nexthosts, names[1]);
-               hosts= nexthosts;
-           }
-           continue;
-       }
-
-       /* At least two words, the first of which is an IP address. */
-       if (np < names + 2) continue;
-       if (!inet_aton((char *) names[0], &addr)) continue;
-       host.h_name= (char *) names[1];
-
-       return &host;
-    }
-}
-
-/* Rest kept in reserve, we probably never need 'em. */
-#if XXX
-struct hostent *gethostbyname(const char *name)
-{
-    struct hostent *he;
-    char **pa;
-    char alias[256];
-    char *domain;
-    
-    sethostent(0);
-    while ((he= gethostent()) != nil) {
-       if (strcasecmp(he->h_name, name) == 0) goto found;
-
-       domain= strchr(he->h_name, '.');
-       for (pa= he->h_aliases; *pa != nil; pa++) {
-           strcpy(alias, *pa);
-           if (domain != nil && strchr(alias, '.') == nil) {
-               strcat(alias, domain);
-           }
-           if (strcasecmp(alias, name) == 0) goto found;
-       }
-    }
-  found:
-    endhostent();
-    return he;
-}
-
-struct hostent *gethostbyaddr(const char *addr, int len, int type)
-{
-    struct hostent *he;
-
-    sethostent(0);
-    while ((he= gethostent()) != nil) {
-       if (he->h_name[0] == '%') continue;
-       if (type == AF_INET && memcmp(he->h_addr, addr, len) == 0) break;
-    }
-    endhostent();
-    return he;
-}
-#endif
diff --git a/lib/libc/ip/gethostname.c b/lib/libc/ip/gethostname.c
deleted file mode 100644 (file)
index 74cb135..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/* gethostname(2) system call emulation */
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <net/gen/netdb.h>
-
-#define HOSTNAME_FILE "/etc/hostname.file"
-
-int gethostname(char *buf, size_t len)
-{
-       int fd;
-       int r;
-       char *nl;
-
-       if ((fd= open(HOSTNAME_FILE, O_RDONLY)) < 0) return -1;
-
-       r= read(fd, buf, len);
-       close(fd);
-       if (r == -1) return -1;
-
-       buf[len-1]= '\0';
-       if ((nl= strchr(buf, '\n')) != NULL) *nl= '\0';
-       return 0;
-}
diff --git a/lib/libc/ip/getifaddrs.c b/lib/libc/ip/getifaddrs.c
deleted file mode 100644 (file)
index 1872ae3..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <ifaddrs.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-
-#include <net/gen/in.h>
-#include <net/gen/ip_io.h>
-#include <net/gen/tcp.h>
-#include <net/gen/udp.h>
-
-int
-getifaddrs(struct ifaddrs **ifap)
-{
-       static int fd = -1;
-       nwio_ipconf_t ipconf;
-       int flags;
-       static struct ifaddrs ifa;
-       static struct sockaddr_in addr, netmask;
-
-       memset(&ifa, 0, sizeof(ifa));
-       memset(&addr, 0, sizeof(addr));
-       memset(&netmask, 0, sizeof(netmask));
-       ifa.ifa_next = NULL;
-       ifa.ifa_name = "ip";
-       addr.sin_family = netmask.sin_family = AF_INET;
-       ifa.ifa_addr = (struct sockaddr *) &addr;
-       ifa.ifa_netmask = (struct sockaddr *) &netmask;
-       addr.sin_addr.s_addr = 0;
-       netmask.sin_addr.s_addr = 0;
-
-       if(fd < 0) {
-               char *ipd;
-               if(!(ipd=getenv("IP_DEVICE")))
-                       ipd="/dev/ip";
-               if((fd = open(ipd, O_RDWR)) < 0)
-                       return -1;
-       }
-
-       /* Code taken from commands/simple/ifconfig.c. */
-
-       if((flags = fcntl(fd, F_GETFL)) < 0 ||
-          fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0 ||
-          ioctl(fd, NWIOGIPCONF, &ipconf))
-               return 0;       /* Report interface as down. */
-
-       addr.sin_addr.s_addr = ipconf.nwic_ipaddr;
-       netmask.sin_addr.s_addr = ipconf.nwic_netmask;
-       if(addr.sin_addr.s_addr) ifa.ifa_flags = IFF_UP;
-
-       /* Just report on this interface. */
-
-       *ifap = &ifa;
-
-       return 0;
-}
-
-void
-freeifaddrs(struct ifaddrs *ifp)
-{
-       /* getifaddrs points to static data, so no need to free. */
-       ;
-}
-
diff --git a/lib/libc/ip/getnetbyaddr.c b/lib/libc/ip/getnetbyaddr.c
deleted file mode 100644 (file)
index f77bdb6..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetbyaddr.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <net/gen/netdb.h>
-
-extern int _net_stayopen;
-
-struct netent *
-getnetbyaddr(net, type)
-       register long net;
-       register int type;
-{
-       register struct netent *p;
-
-       setnetent(_net_stayopen);
-       while ((p = getnetent()))
-               if (p->n_addrtype == type && p->n_net == net)
-                       break;
-       if (!_net_stayopen)
-               endnetent();
-       return (p);
-}
diff --git a/lib/libc/ip/getnetbyname.c b/lib/libc/ip/getnetbyname.c
deleted file mode 100644 (file)
index 09924a2..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetbyname.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <string.h>
-#include <net/gen/netdb.h>
-
-extern int _net_stayopen;
-
-struct netent *
-getnetbyname(name)
-       register const char *name;
-{
-       register struct netent *p;
-       register char **cp;
-
-       setnetent(_net_stayopen);
-       while ((p = getnetent())) {
-               if (strcmp(p->n_name, name) == 0)
-                       break;
-               for (cp = p->n_aliases; *cp != 0; cp++)
-                       if (strcmp(*cp, name) == 0)
-                               goto found;
-       }
-found:
-       if (!_net_stayopen)
-               endnetent();
-       return (p);
-}
diff --git a/lib/libc/ip/getnetent.c b/lib/libc/ip/getnetent.c
deleted file mode 100644 (file)
index 22a8faf..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetent.c        8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <net/gen/in.h>
-#include <net/gen/netdb.h>
-#include <net/gen/inet.h>
-#include <net/gen/socket.h>
-
-#define        MAXALIASES      35
-
-static FILE *netf;
-static char line[BUFSIZ+1];
-static struct netent net;
-static char *net_aliases[MAXALIASES];
-int _net_stayopen;
-
-void
-setnetent(f)
-       int f;
-{
-       if (netf == NULL)
-               netf = fopen(_PATH_NETWORKS, "r" );
-       else
-               rewind(netf);
-       _net_stayopen |= f;
-}
-
-void
-endnetent()
-{
-       if (netf) {
-               fclose(netf);
-               netf = NULL;
-       }
-       _net_stayopen = 0;
-}
-
-struct netent *
-getnetent()
-{
-       char *p;
-       register char *cp, **q;
-
-       if (netf == NULL && (netf = fopen(_PATH_NETWORKS, "r" )) == NULL)
-               return (NULL);
-again:
-       p = fgets(line, BUFSIZ, netf);
-       if (p == NULL)
-               return (NULL);
-       if (*p == '#')
-               goto again;
-       cp = strpbrk(p, "#\n");
-       if (cp == NULL)
-               goto again;
-       *cp = '\0';
-       net.n_name = p;
-       cp = strpbrk(p, " \t");
-       if (cp == NULL)
-               goto again;
-       *cp++ = '\0';
-       while (*cp == ' ' || *cp == '\t')
-               cp++;
-       p = strpbrk(cp, " \t");
-       if (p != NULL)
-               *p++ = '\0';
-       net.n_net = inet_network(cp);
-       net.n_addrtype = AF_INET;
-       q = net.n_aliases = net_aliases;
-       if (p != NULL) 
-               cp = p;
-       while (cp && *cp) {
-               if (*cp == ' ' || *cp == '\t') {
-                       cp++;
-                       continue;
-               }
-               if (q < &net_aliases[MAXALIASES - 1])
-                       *q++ = cp;
-               cp = strpbrk(cp, " \t");
-               if (cp != NULL)
-                       *cp++ = '\0';
-       }
-       *q = NULL;
-       return (&net);
-}
diff --git a/lib/libc/ip/getpeereid.c b/lib/libc/ip/getpeereid.c
deleted file mode 100644 (file)
index ef7f609..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <errno.h>
-#include <string.h>
-#include <sys/socket.h>
-
-/*
- * get the effective user ID and effective group ID of a peer
- * connected through a Unix domain socket.
- */
-int getpeereid(int sd, uid_t *euid, gid_t *egid) {
-       int rc;
-       struct ucred cred;
-       socklen_t ucred_length;
-
-       /* Initialize Data Structures */
-       ucred_length = sizeof(struct ucred);
-       memset(&cred, '\0', ucred_length);
-
-       /* Validate Input Parameters */
-       if (euid == NULL || egid == NULL) {
-               errno = EFAULT;
-               return -1;
-       } /* getsockopt will handle validating 'sd' */
-
-       /* Get the credentials of the peer at the other end of 'sd' */
-       rc = getsockopt(sd, SOL_SOCKET, SO_PEERCRED, &cred, &ucred_length);
-       if (rc == 0) {
-               /* Success - return the results */
-               *euid = cred.uid;
-               *egid = cred.gid;
-               return 0;
-       } else {
-               /* Failure - getsockopt takes care of setting errno */
-               return -1;
-       }
-}
diff --git a/lib/libc/ip/getpeername.c b/lib/libc/ip/getpeername.c
deleted file mode 100644 (file)
index c45c005..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <sys/un.h>
-
-#define DEBUG 0
-
-static int _tcp_getpeername(int socket, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconfp);
-
-static int _uds_getpeername(int socket, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr);
-
-int getpeername(int socket, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len)
-{
-       int r;
-       nwio_tcpconf_t tcpconf;
-       struct sockaddr_un uds_addr;
-
-       r= ioctl(socket, NWIOGTCPCONF, &tcpconf);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _tcp_getpeername(socket, address, address_len,
-                       &tcpconf);
-       }
-
-       r= ioctl(socket, NWIOGUDSPADDR, &uds_addr);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _uds_getpeername(socket, address, address_len,
-                       &uds_addr);
-       }
-
-
-#if DEBUG
-       fprintf(stderr, "getpeername: not implemented for fd %d\n", socket);
-#endif
-       errno= ENOSYS;
-       return -1;
-}
-
-static int _tcp_getpeername(int socket, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconfp)
-{
-       socklen_t len;
-       struct sockaddr_in sin;
-
-       if (tcpconfp->nwtc_remaddr == 0 ||
-               tcpconfp->nwtc_remport == 0)
-       {
-               errno= ENOTCONN;
-               return -1;
-       }
-
-       memset(&sin, '\0', sizeof(sin));
-       sin.sin_family= AF_INET;
-       sin.sin_addr.s_addr= tcpconfp->nwtc_remaddr;
-       sin.sin_port= tcpconfp->nwtc_remport;
-
-       len= *address_len;
-       if (len > sizeof(sin))
-               len= sizeof(sin);
-       memcpy(address, &sin, len);
-       *address_len= len;
-
-       return 0;
-}
-
-static int _uds_getpeername(int socket, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr)
-{
-       socklen_t len;
-
-       if (uds_addr->sun_family != AF_UNIX)
-       {
-               errno= ENOTCONN;
-               return -1;
-       }
-
-       len= *address_len;
-       if (len > sizeof(struct sockaddr_un))
-               len = sizeof(struct sockaddr_un);
-
-       memcpy(address, uds_addr, len);
-       *address_len= len;
-
-       return 0;
-}
diff --git a/lib/libc/ip/getproto.c b/lib/libc/ip/getproto.c
deleted file mode 100644 (file)
index 7ceea47..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getproto.c 5.6 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
-#include <stddef.h>
-
-#ifdef _MINIX
-#include <minix/ansi.h>
-#include <net/gen/netdb.h>
-#endif
-
-extern int _proto_stayopen;
-
-struct protoent *
-getprotobynumber(proto)
-       register int proto;
-{
-       register struct protoent *p;
-
-       setprotoent(_proto_stayopen);
-       while ((p = getprotoent()))
-               if (p->p_proto == proto)
-                       break;
-       if (!_proto_stayopen)
-               endprotoent();
-       return (p);
-}
diff --git a/lib/libc/ip/getprotoent.c b/lib/libc/ip/getprotoent.c
deleted file mode 100644 (file)
index 33b466e..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getprotoent.c      5.7 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef _MINIX
-#include <net/gen/netdb.h>
-
-static char *any _ARGS(( char *cp, char *match ));
-#endif
-
-#define        MAXALIASES      35
-
-static FILE *protof = NULL;
-static char line[BUFSIZ+1];
-static struct protoent proto;
-static char *proto_aliases[MAXALIASES];
-int _proto_stayopen;
-
-void
-setprotoent(f)
-       int f;
-{
-       if (protof == NULL)
-               protof = fopen(_PATH_PROTOCOLS, "r" );
-       else
-               rewind(protof);
-       _proto_stayopen |= f;
-}
-
-void
-endprotoent()
-{
-       if (protof) {
-               fclose(protof);
-               protof = NULL;
-       }
-       _proto_stayopen = 0;
-}
-
-struct protoent *
-getprotoent()
-{
-       char *p;
-       register char *cp, **q;
-
-       if (protof == NULL && (protof = fopen(_PATH_PROTOCOLS, "r" )) == NULL)
-               return (NULL);
-again:
-       if ((p = fgets(line, BUFSIZ, protof)) == NULL)
-               return (NULL);
-       if (*p == '#')
-               goto again;
-       cp = any(p, "#\n");
-       if (cp == NULL)
-               goto again;
-       *cp = '\0';
-       proto.p_name = p;
-       cp = any(p, " \t");
-       if (cp == NULL)
-               goto again;
-       *cp++ = '\0';
-       while (*cp == ' ' || *cp == '\t')
-               cp++;
-       p = any(cp, " \t");
-       if (p != NULL)
-               *p++ = '\0';
-       proto.p_proto = atoi(cp);
-       q = proto.p_aliases = proto_aliases;
-       if (p != NULL) {
-               cp = p;
-               while (cp && *cp) {
-                       if (*cp == ' ' || *cp == '\t') {
-                               cp++;
-                               continue;
-                       }
-                       if (q < &proto_aliases[MAXALIASES - 1])
-                               *q++ = cp;
-                       cp = any(cp, " \t");
-                       if (cp != NULL)
-                               *cp++ = '\0';
-               }
-       }
-       *q = NULL;
-       return (&proto);
-}
-
-static char *
-any(cp, match)
-       register char *cp;
-       char *match;
-{
-       register char *mp, c;
-
-       while ((c = *cp)) {
-               for (mp = match; *mp; mp++)
-                       if (*mp == c)
-                               return (cp);
-               cp++;
-       }
-       return ((char *)0);
-}
diff --git a/lib/libc/ip/getprotoname.c b/lib/libc/ip/getprotoname.c
deleted file mode 100644 (file)
index 0832acf..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getprotoname.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <netdb.h>
-#include <string.h>
-
-extern int _proto_stayopen;
-
-struct protoent *
-getprotobyname(name)
-       register const char *name;
-{
-       register struct protoent *p;
-       register char **cp;
-
-       setprotoent(_proto_stayopen);
-       while ( (p = getprotoent()) ) {
-               if (strcmp(p->p_name, name) == 0)
-                       break;
-               for (cp = p->p_aliases; *cp != 0; cp++)
-                       if (strcmp(*cp, name) == 0)
-                               goto found;
-       }
-found:
-       if (!_proto_stayopen)
-               endprotoent();
-       return (p);
-}
diff --git a/lib/libc/ip/getservent.c b/lib/libc/ip/getservent.c
deleted file mode 100644 (file)
index a8c3337..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getservent.c       5.8 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <net/hton.h>
-#include <net/gen/netdb.h>
-
-#define        MAXALIASES      35
-
-static FILE *servf = NULL;
-static char line[BUFSIZ+1];
-static struct servent serv;
-static char *serv_aliases[MAXALIASES];
-int _serv_stayopen;
-
-static char *any _ARGS(( char *cp, char *match ));
-
-void
-setservent(f)
-       int f;
-{
-       if (servf == NULL)
-               servf = fopen(_PATH_SERVICES, "r" );
-       else
-               rewind(servf);
-       _serv_stayopen |= f;
-}
-
-void
-endservent()
-{
-       if (servf) {
-               fclose(servf);
-               servf = NULL;
-       }
-       _serv_stayopen = 0;
-}
-
-struct servent *
-getservent()
-{
-       char *p;
-       register char *cp, **q;
-
-       if (servf == NULL && (servf = fopen(_PATH_SERVICES, "r" )) == NULL)
-               return (NULL);
-again:
-       if ((p = fgets(line, BUFSIZ, servf)) == NULL)
-               return (NULL);
-       if (*p == '#')
-               goto again;
-       cp = any(p, "#\n");
-       if (cp == NULL)
-               goto again;
-       *cp = '\0';
-       serv.s_name = p;
-       p = any(p, " \t");
-       if (p == NULL)
-               goto again;
-       *p++ = '\0';
-       while (*p == ' ' || *p == '\t')
-               p++;
-       cp = any(p, ",/");
-       if (cp == NULL)
-               goto again;
-       *cp++ = '\0';
-       serv.s_port = htons((u16_t)atoi(p));
-       serv.s_proto = cp;
-       q = serv.s_aliases = serv_aliases;
-       cp = any(cp, " \t");
-       if (cp != NULL)
-               *cp++ = '\0';
-       while (cp && *cp) {
-               if (*cp == ' ' || *cp == '\t') {
-                       cp++;
-                       continue;
-               }
-               if (q < &serv_aliases[MAXALIASES - 1])
-                       *q++ = cp;
-               cp = any(cp, " \t");
-               if (cp != NULL)
-                       *cp++ = '\0';
-       }
-       *q = NULL;
-       return (&serv);
-}
-
-static char *
-any(cp, match)
-       register char *cp;
-       char *match;
-{
-       register char *mp, c;
-
-       while ((c = *cp)) {
-               for (mp = match; *mp; mp++)
-                       if (*mp == c)
-                               return (cp);
-               cp++;
-       }
-       return ((char *)0);
-}
diff --git a/lib/libc/ip/getsockname.c b/lib/libc/ip/getsockname.c
deleted file mode 100644 (file)
index acfbfbb..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
-
-   getsockname()
-
-   from socket emulation library for Minix 2.0.x
-
-*/
-
-
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <sys/un.h>
-
-/*
-#define DEBUG 0
-*/
-
-static int _tcp_getsockname(int fd, struct sockaddr *_RESTRICT address,
-   socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconfp);
-
-static int _uds_getsockname(int fd, struct sockaddr *_RESTRICT address,
-   socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr);
-
-int getsockname(int fd, struct sockaddr *_RESTRICT address,
-   socklen_t *_RESTRICT address_len)
-{
-       int r;
-       nwio_tcpconf_t tcpconf;
-       struct sockaddr_un uds_addr;
-
-#ifdef DEBUG
-       fprintf(stderr,"mnx_getsockname: ioctl fd %d.\n", fd);
-#endif
-
-       r= ioctl(fd, NWIOGTCPCONF, &tcpconf);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-
-               return _tcp_getsockname(fd, address, address_len, &tcpconf);
-       }
-
-       r= ioctl(fd, NWIOGUDSADDR, &uds_addr);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-
-               return _uds_getsockname(fd, address, address_len, &uds_addr);
-       }
-
-#if DEBUG
-       fprintf(stderr, "getsockname: not implemented for fd %d\n", socket);
-#endif
-
-       errno= ENOSYS;
-       return -1;
-}
-
-
-static int _tcp_getsockname(int fd, struct sockaddr *_RESTRICT address,
-   socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconf)
-{
-       socklen_t len;
-       struct sockaddr_in sin;
-
-#ifdef DEBUG1
-       fprintf(stderr, "mnx_getsockname: from %s, %u",
-                       inet_ntoa(tcpconf.nwtc_remaddr),
-                       ntohs(tcpconf.nwtc_remport));
-       fprintf(stderr," for %s, %u\n",
-                       inet_ntoa(tcpconf.nwtc_locaddr),
-                       ntohs(tcpconf.nwtc_locport));
-#endif
-
-       memset(&sin, '\0', sizeof(sin));
-       sin.sin_family= AF_INET;
-       sin.sin_addr.s_addr= tcpconf->nwtc_locaddr ;
-       sin.sin_port= tcpconf->nwtc_locport;
-
-       len= *address_len;
-       if (len > sizeof(sin))
-               len= sizeof(sin);
-       memcpy(address, &sin, len);
-       *address_len= len;
-
-       return 0;
-}
-
-static int _uds_getsockname(int fd, struct sockaddr *_RESTRICT address,
-   socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr)
-{
-       socklen_t len;
-
-       if (uds_addr->sun_family != AF_UNIX)
-       {
-               errno= EINVAL;
-               return -1;
-       }
-
-       len= *address_len;
-       if (len > sizeof(struct sockaddr_un))
-               len = sizeof(struct sockaddr_un);
-
-       memcpy(address, uds_addr, len);
-       *address_len= len;
-
-       return 0;
-}
diff --git a/lib/libc/ip/getsockopt.c b/lib/libc/ip/getsockopt.c
deleted file mode 100644 (file)
index 816fb78..0000000
+++ /dev/null
@@ -1,254 +0,0 @@
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/ucred.h>
-#include <netinet/tcp.h>
-
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_io.h>
-
-#include <minix/type.h>
-
-#define DEBUG 0
-
-static int _tcp_getsockopt(int socket, int level, int option_name,
-       void *_RESTRICT option_value, socklen_t *_RESTRICT option_len);
-static int _udp_getsockopt(int socket, int level, int option_name,
-       void *_RESTRICT option_value, socklen_t *_RESTRICT option_len);
-static int _uds_getsockopt(int socket, int level, int option_name,
-       void *_RESTRICT option_value, socklen_t *_RESTRICT option_len);
-static void getsockopt_copy(void *return_value, size_t return_len,
-       void *_RESTRICT option_value, socklen_t *_RESTRICT option_len);
-
-int getsockopt(int socket, int level, int option_name,
-        void *_RESTRICT option_value, socklen_t *_RESTRICT option_len)
-{
-       int r;
-       nwio_tcpopt_t tcpopt;
-       nwio_udpopt_t udpopt;
-       struct sockaddr_un uds_addr;
-
-       r= ioctl(socket, NWIOGTCPOPT, &tcpopt);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _tcp_getsockopt(socket, level, option_name,
-                       option_value, option_len);
-       }
-
-       r= ioctl(socket, NWIOGUDPOPT, &udpopt);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _udp_getsockopt(socket, level, option_name,
-                       option_value, option_len);
-       }
-
-       r= ioctl(socket, NWIOGUDSADDR, &uds_addr);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _uds_getsockopt(socket, level, option_name,
-                       option_value, option_len);
-       }
-
-
-#if DEBUG
-       fprintf(stderr, "getsockopt: not implemented for fd %d\n", socket);
-#endif
-       errno= ENOTSOCK;
-       return -1;
-}
-
-static void getsockopt_copy(void *return_value, size_t return_len,
-       void *_RESTRICT option_value, socklen_t *_RESTRICT option_len)
-{
-       /* copy as much data as possible */
-       if (*option_len < return_len)
-               memcpy(option_value, return_value, *option_len);
-       else
-               memcpy(option_value, return_value, return_len);
-
-       /* return length */
-       *option_len = return_len;
-}
-
-static int _tcp_getsockopt(int socket, int level, int option_name,
-       void *_RESTRICT option_value, socklen_t *_RESTRICT option_len)
-{
-       int i, r, err;
-
-       if (level == SOL_SOCKET && option_name == SO_REUSEADDR)
-       {
-               i = 1;  /* Binds to TIME_WAIT sockets never cause errors */
-               getsockopt_copy(&i, sizeof(i), option_value, option_len);
-               return 0;
-       }
-       if (level == SOL_SOCKET && option_name == SO_KEEPALIVE)
-       {
-               i = 1;  /* Keepalive is always on */
-               getsockopt_copy(&i, sizeof(i), option_value, option_len);
-               return 0;
-       }
-       if (level == SOL_SOCKET && option_name == SO_ERROR)
-       {
-               r = ioctl(socket, NWIOTCPGERROR, &err);
-               if (r != 0)
-                       return r;
-
-               getsockopt_copy(&err, sizeof(err), option_value, option_len);
-               return 0;
-       }
-       if (level == SOL_SOCKET && option_name == SO_RCVBUF)
-       {
-               i = 32 * 1024;  /* Receive buffer in the current 
-                                * implementation 
-                                */
-               getsockopt_copy(&i, sizeof(i), option_value, option_len);
-               return 0;
-       }
-       if (level == SOL_SOCKET && option_name == SO_SNDBUF)
-       {
-               i = 32 * 1024;  /* Send buffer in the current implementation */
-               getsockopt_copy(&i, sizeof(i), option_value, option_len);
-               return 0;
-       }
-       if (level == SOL_SOCKET && option_name == SO_TYPE)
-       {
-               i = SOCK_STREAM;        /* this is a TCP socket */
-               getsockopt_copy(&i, sizeof(i), option_value, option_len);
-               return 0;
-       }
-       if (level == IPPROTO_TCP && option_name == TCP_NODELAY)
-       {
-               i = 0;  /* nodelay is always off */
-               getsockopt_copy(&i, sizeof(i), option_value, option_len);
-               return 0;
-       }
-#if DEBUG
-       fprintf(stderr, "_tcp_getsocketopt: level %d, name %d\n",
-               level, option_name);
-#endif
-
-       errno= ENOPROTOOPT;
-       return -1;
-}
-
-static int _udp_getsockopt(int socket, int level, int option_name,
-       void *_RESTRICT option_value, socklen_t *_RESTRICT option_len)
-{
-       int i;
-
-       if (level == SOL_SOCKET && option_name == SO_TYPE)
-       {
-               i = SOCK_DGRAM; /* this is a UDP socket */
-               getsockopt_copy(&i, sizeof(i), option_value, option_len);
-               return 0;
-       }
-#if DEBUG
-       fprintf(stderr, "_udp_getsocketopt: level %d, name %d\n",
-               level, option_name);
-#endif
-
-       errno= ENOSYS;
-       return -1;
-}
-
-static int _uds_getsockopt(int socket, int level, int option_name,
-       void *_RESTRICT option_value, socklen_t *_RESTRICT option_len)
-{
-       int i, r;
-       size_t size;
-
-       if (level == SOL_SOCKET && option_name == SO_RCVBUF)
-       {
-               r= ioctl(socket, NWIOGUDSRCVBUF, &size);
-               if (r == -1) {
-                       return r;
-               }
-
-               getsockopt_copy(&size, sizeof(size), option_value, option_len);
-               return 0;
-       }
-
-       if (level == SOL_SOCKET && option_name == SO_SNDBUF)
-       {
-               r= ioctl(socket, NWIOGUDSSNDBUF, &size);
-               if (r == -1) {
-                       return r;
-               }
-
-               getsockopt_copy(&size, sizeof(size), option_value, option_len);
-               return 0;
-       }
-
-       if (level == SOL_SOCKET && option_name == SO_TYPE)
-       {
-               r= ioctl(socket, NWIOGUDSSOTYPE, &i);
-               if (r == -1) {
-                       return r;
-               }
-
-               getsockopt_copy(&i, sizeof(i), option_value, option_len);
-               return 0;
-       }
-
-       if (level == SOL_SOCKET && option_name == SO_PEERCRED)
-       {
-               struct ucred cred;
-
-               r= ioctl(socket, NWIOGUDSPEERCRED, &cred);
-               if (r == -1) {
-                       return -1;
-               }
-
-               getsockopt_copy(&cred, sizeof(struct ucred), option_value,
-                                                       option_len);
-               return 0;
-       }
-
-
-       if (level == SOL_SOCKET && option_name == SO_REUSEADDR)
-       {
-               i = 1;  /* as long as nobody is listen()ing on the address,
-                        * it can be reused without waiting for a 
-                        * timeout to expire.
-                        */
-               getsockopt_copy(&i, sizeof(i), option_value, option_len);
-               return 0;
-       }
-
-       if (level == SOL_SOCKET && option_name == SO_PASSCRED)
-       {
-               i = 1;  /* option is always 'on' */
-               getsockopt_copy(&i, sizeof(i), option_value, option_len);
-               return 0;
-       }
-
-#if DEBUG
-       fprintf(stderr, "_uds_getsocketopt: level %d, name %d\n",
-               level, option_name);
-#endif
-
-       errno= ENOSYS;
-       return -1;
-}
diff --git a/lib/libc/ip/getsrvbyname.c b/lib/libc/ip/getsrvbyname.c
deleted file mode 100644 (file)
index 242f1aa..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getservbyname.c    5.6 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
-#include <string.h>
-
-#include <net/gen/netdb.h>
-
-extern int _serv_stayopen;
-
-struct servent *
-getservbyname(name, proto)
-       const char *name, *proto;
-{
-       register struct servent *p;
-       register char **cp;
-
-       setservent(_serv_stayopen);
-       while ((p = getservent())) {
-               if (strcmp(name, p->s_name) == 0)
-                       goto gotname;
-               for (cp = p->s_aliases; *cp; cp++)
-                       if (strcmp(name, *cp) == 0)
-                               goto gotname;
-               continue;
-gotname:
-               if (proto == 0 || strcmp(p->s_proto, proto) == 0)
-                       break;
-       }
-       if (!_serv_stayopen)
-               endservent();
-       return (p);
-}
diff --git a/lib/libc/ip/getsrvbyport.c b/lib/libc/ip/getsrvbyport.c
deleted file mode 100644 (file)
index 3606873..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getservbyport.c    5.6 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
-#include <stddef.h>
-#include <string.h>
-
-#ifdef _MINIX
-#include <net/gen/netdb.h>
-#endif
-
-extern int _serv_stayopen;
-
-struct servent *
-getservbyport(port, proto)
-       int port;
-       const char *proto;
-{
-       register struct servent *p;
-
-       setservent(_serv_stayopen);
-       while ((p = getservent())) {
-               if (p->s_port != port)
-                       continue;
-               if (proto == 0 || strcmp(p->s_proto, proto) == 0)
-                       break;
-       }
-       if (!_serv_stayopen)
-               endservent();
-       return (p);
-}
diff --git a/lib/libc/ip/hton.c b/lib/libc/ip/hton.c
deleted file mode 100644 (file)
index 4f93f59..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-hton.c
-*/
-
-#include <sys/types.h>
-#include <minix/config.h>
-#include <net/hton.h>
-
-u16_t _tmp;
-u32_t _tmp_l;
-
-#if _WORD_SIZE > 2
-u16_t (htons)(u16_t x) { return HTONS(x); }
-u16_t (ntohs)(u16_t x) { return NTOHS(x); }
-u32_t (htonl)(u32_t x) { return HTONL(x); }
-u32_t (ntohl)(u32_t x) { return NTOHL(x); }
-#endif
-
diff --git a/lib/libc/ip/inet_addr.c b/lib/libc/ip/inet_addr.c
deleted file mode 100644 (file)
index 2e771dd..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 1983, 1990 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted provided
- * that: (1) source distributions retain this entire copyright notice and
- * comment, and (2) distributions including binaries display the following
- * acknowledgement:  ``This product includes software developed by the
- * University of California, Berkeley and its contributors'' in the
- * documentation or other materials provided with the distribution and in
- * all advertising materials mentioning features or use of this software.
- * 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_addr.c        5.8 (Berkeley) 6/23/90";
-#endif /* LIBC_SCCS and not lint */
-
-#if _MINIX
-#include <sys/types.h>
-#include <ctype.h>
-#include <errno.h>
-
-#include <net/hton.h>
-#include <net/gen/in.h>
-#include <net/gen/inet.h>
-#endif
-
-#ifdef __STDC__
-#define _CONST const
-#else
-#define _CONST
-#endif
-
-/*
- * Ascii internet address interpretation routine.
- * The value returned is in network order.
- */
-ipaddr_t
-inet_addr(cp)
-       register _CONST char *cp;
-{
-       ipaddr_t val;
-
-       if (inet_aton(cp, &val))
-               return (val);
-       errno= EINVAL;
-       return (ipaddr_t)-1;
-}
-
-/* 
- * Check whether "cp" is a valid ascii representation
- * of an Internet address and convert to a binary address.
- * Returns 1 if the address is valid, 0 if not.
- * This replaces inet_addr, the return value from which
- * cannot distinguish between failure and a local broadcast address.
- */
-
-int
-inet_aton(cp, addr)
-       register _CONST char *cp;
-       ipaddr_t *addr;
-{
-       register u32_t val, base, n;
-       register char c;
-       u32_t parts[4], *pp = parts;
-
-       for (;;) {
-               /*
-                * Collect number up to ``.''.
-                * Values are specified as for C:
-                * 0x=hex, 0=octal, other=decimal.
-                */
-               val = 0; base = 10;
-               if (*cp == '0') {
-                       if (*++cp == 'x' || *cp == 'X')
-                               base = 16, cp++;
-                       else
-                               base = 8;
-               }
-               while ((c = *cp) != '\0') {
-                       if (isascii(c) && isdigit(c)) {
-                               val = (val * base) + (c - '0');
-                               cp++;
-                               continue;
-                       }
-                       if (base == 16 && isascii(c) && isxdigit(c)) {
-                               val = (val << 4) + 
-                                       (c + 10 - (islower(c) ? 'a' : 'A'));
-                               cp++;
-                               continue;
-                       }
-                       break;
-               }
-               if (*cp == '.') {
-                       /*
-                        * Internet format:
-                        *      a.b.c.d
-                        *      a.b.c   (with c treated as 16-bits)
-                        *      a.b     (with b treated as 24 bits)
-                        */
-                       if (pp >= parts + 3 || val > 0xff)
-                               return (0);
-                       *pp++ = val, cp++;
-               } else
-                       break;
-       }
-       /*
-        * Check for trailing characters.
-        */
-       if (*cp && (!isascii(*cp) || !isspace(*cp)))
-               return (0);
-       /*
-        * Concoct the address according to
-        * the number of parts specified.
-        */
-       n = pp - parts + 1;
-       switch (n) {
-
-       case 1:                         /* a -- 32 bits */
-               break;
-
-       case 2:                         /* a.b -- 8.24 bits */
-               if (val > 0xffffff)
-                       return (0);
-               val |= parts[0] << 24;
-               break;
-
-       case 3:                         /* a.b.c -- 8.8.16 bits */
-               if (val > 0xffff)
-                       return (0);
-               val |= (parts[0] << 24) | (parts[1] << 16);
-               break;
-
-       case 4:                         /* a.b.c.d -- 8.8.8.8 bits */
-               if (val > 0xff)
-                       return (0);
-               val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
-               break;
-       }
-       if (addr)
-               *addr = htonl(val);
-       return (1);
-}
diff --git a/lib/libc/ip/inet_network.c b/lib/libc/ip/inet_network.c
deleted file mode 100644 (file)
index 15da001..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_network.c     8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <ctype.h>
-#include <net/gen/in.h>
-#include <net/gen/inet.h>
-
-#define INADDR_NONE    ((ipaddr_t) -1)
-
-/*
- * Internet network address interpretation routine.
- * The library routines call this routine to interpret
- * network numbers.
- */
-ipaddr_t
-inet_network(cp)
-       register const char *cp;
-{
-       register ipaddr_t val, base, n;
-       register char c;
-       ipaddr_t parts[4], *pp = parts;
-       register int i;
-
-again:
-       val = 0; base = 10;
-       if (*cp == '0')
-               base = 8, cp++;
-       if (*cp == 'x' || *cp == 'X')
-               base = 16, cp++;
-       while ((c = *cp)) {
-               if (isdigit(c)) {
-                       val = (val * base) + (c - '0');
-                       cp++;
-                       continue;
-               }
-               if (base == 16 && isxdigit(c)) {
-                       val = (val << 4) + (c + 10 - (islower(c) ? 'a' : 'A'));
-                       cp++;
-                       continue;
-               }
-               break;
-       }
-       if (*cp == '.') {
-               if (pp >= parts + 4)
-                       return (INADDR_NONE);
-               *pp++ = val, cp++;
-               goto again;
-       }
-       if (*cp && !isspace(*cp))
-               return (INADDR_NONE);
-       *pp++ = val;
-       n = pp - parts;
-       if (n > 4)
-               return (INADDR_NONE);
-       for (val = 0, i = 0; i < n; i++) {
-               val <<= 8;
-               val |= parts[i] & 0xff;
-       }
-       return (val);
-}
diff --git a/lib/libc/ip/inet_ntoa.c b/lib/libc/ip/inet_ntoa.c
deleted file mode 100644 (file)
index 97a9a53..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)inet_ntoa.c        5.5 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * Convert network-format internet address
- * to base 256 d.d.d.d representation.
- */
-
-#include <sys/types.h>
-#include <stdio.h>
-
-#include <net/gen/in.h>
-#include <net/gen/inet.h>
-
-char *
-inet_ntoa(in)
-       ipaddr_t in;
-{
-       static char b[18];
-       register u8_t *p;
-
-       p = (u8_t *)&in;
-       sprintf(b, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
-       return (b);
-}
diff --git a/lib/libc/ip/inet_ntop.c b/lib/libc/ip/inet_ntop.c
deleted file mode 100644 (file)
index b7c377b..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 1996-2001  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 <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/null.h>
-#include <sys/socket.h>
-
-#define NS_INT16SZ      2
-#define NS_IN6ADDRSZ   16
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-
-static const char *inet_ntop4(const unsigned char *src, char *dst,
-                             size_t size);
-
-#ifdef AF_INET6
-static const char *inet_ntop6(const unsigned char *src, char *dst,
-                             size_t size);
-#endif
-
-/* char *
- * isc_net_ntop(af, src, dst, size)
- *     convert a network format address to presentation format.
- * return:
- *     pointer to presentation format address (`dst'), or NULL (see errno).
- * author:
- *     Paul Vixie, 1996.
- */
-const char *
-inet_ntop(int af, const void *src, char *dst, size_t size)
-{
-       switch (af) {
-       case AF_INET:
-               return (inet_ntop4(src, dst, size));
-#ifdef AF_INET6
-       case AF_INET6:
-               return (inet_ntop6(src, dst, size));
-#endif
-       default:
-               errno = EAFNOSUPPORT;
-               return (NULL);
-       }
-       /* NOTREACHED */
-}
-
-/* const char *
- * inet_ntop4(src, dst, size)
- *     format an IPv4 address
- * return:
- *     `dst' (as a const)
- * notes:
- *     (1) uses no statics
- *     (2) takes a unsigned char* not an in_addr as input
- * author:
- *     Paul Vixie, 1996.
- */
-static const char *
-inet_ntop4(const unsigned char *src, char *dst, size_t size)
-{
-       static const char *fmt = "%u.%u.%u.%u";
-       char tmp[sizeof "255.255.255.255"];
-       size_t len;
-
-       len = snprintf(tmp, sizeof tmp, fmt, src[0], src[1], src[2], src[3]);
-       if (len >= size) {
-               errno = ENOSPC;
-               return (NULL);
-       }
-       memcpy(dst, tmp, len + 1);
-
-       return (dst);
-}
-
-/* const char *
- * isc_inet_ntop6(src, dst, size)
- *     convert IPv6 binary address into presentation (printable) format
- * author:
- *     Paul Vixie, 1996.
- */
-#ifdef AF_INET6
-static const char *
-inet_ntop6(const unsigned char *src, char *dst, size_t size)
-{
-       /*
-        * Note that int32_t and int16_t need only be "at least" large enough
-        * to contain a value of the specified size.  On some systems, like
-        * Crays, there is no such thing as an integer variable with 16 bits.
-        * Keep this in mind if you think this function should have been coded
-        * to use pointer overlays.  All the world's not a VAX.
-        */
-       char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
-       struct { int base, len; } best, cur;
-       unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
-       int i, inc;
-
-       /*
-        * Preprocess:
-        *      Copy the input (bytewise) array into a wordwise array.
-        *      Find the longest run of 0x00's in src[] for :: shorthanding.
-        */
-       memset(words, '\0', sizeof words);
-       for (i = 0; i < NS_IN6ADDRSZ; i++)
-               words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
-       best.base = -1;
-       cur.base = -1;
-       for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
-               if (words[i] == 0) {
-                       if (cur.base == -1)
-                               cur.base = i, cur.len = 1;
-                       else
-                               cur.len++;
-               } else {
-                       if (cur.base != -1) {
-                               if (best.base == -1 || cur.len > best.len)
-                                       best = cur;
-                               cur.base = -1;
-                       }
-               }
-       }
-       if (cur.base != -1) {
-               if (best.base == -1 || cur.len > best.len)
-                       best = cur;
-       }
-       if (best.base != -1 && best.len < 2)
-               best.base = -1;
-
-       /*
-        * Format the result.
-        */
-       tp = tmp;
-       for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
-               /* Are we inside the best run of 0x00's? */
-               if (best.base != -1 && i >= best.base &&
-                   i < (best.base + best.len)) {
-                       if (i == best.base)
-                               *tp++ = ':';
-                       continue;
-               }
-               /* Are we following an initial run of 0x00s or any real hex? */
-               if (i != 0)
-                       *tp++ = ':';
-               /* Is this address an encapsulated IPv4? */
-               if (i == 6 && best.base == 0 &&
-                   (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
-                       if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)))
-                               return (NULL);
-                       tp += strlen(tp);
-                       break;
-               }
-               inc = snprintf(tp, 5, "%x", words[i]);
-               tp += inc;
-       }
-       /* Was it a trailing run of 0x00's? */
-       if (best.base != -1 && (best.base + best.len) ==
-           (NS_IN6ADDRSZ / NS_INT16SZ))
-               *tp++ = ':';
-       *tp++ = '\0';
-
-       /*
-        * Check for overflow, copy, and we're done.
-        */
-       if ((size_t)(tp - tmp) > size) {
-               errno = ENOSPC;
-               return (NULL);
-       }
-       memcpy(dst, tmp, tp - tmp);
-       return (dst);
-}
-#endif /* AF_INET6 */
diff --git a/lib/libc/ip/inet_pton.c b/lib/libc/ip/inet_pton.c
deleted file mode 100644 (file)
index 90b3029..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Copyright (C) 1996-2001  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 <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/null.h>
-#include <sys/socket.h>
-
-#define NS_INT16SZ      2
-#define NS_INADDRSZ     4
-#define NS_IN6ADDRSZ   16
-
-/*
- * WARNING: Don't even consider trying to compile this on a system where
- * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
- */
-
-static int inet_pton4(const char *src, unsigned char *dst);
-#ifdef INET6
-static int inet_pton6(const char *src, unsigned char *dst);
-#endif
-
-/* int
- * inet_pton(af, src, dst)
- *     convert from presentation format (which usually means ASCII printable)
- *     to network format (which is usually some kind of binary format).
- * return:
- *     1 if the address was valid for the specified address family
- *     0 if the address wasn't valid (`dst' is untouched in this case)
- *     -1 if some other error occurred (`dst' is untouched in this case, too)
- * author:
- *     Paul Vixie, 1996.
- */
-int
-inet_pton(int af,
-         const char *src,
-         void *dst)
-{
-       switch (af) {
-       case AF_INET:
-               return (inet_pton4(src, dst));
-#ifdef INET6
-       case AF_INET6:
-               return (inet_pton6(src, dst));
-#endif
-       default:
-               errno = EAFNOSUPPORT;
-               return (-1);
-       }
-       /* NOTREACHED */
-}
-
-/* int
- * inet_pton4(src, dst)
- *     like inet_aton() but without all the hexadecimal and shorthand.
- * return:
- *     1 if `src' is a valid dotted quad, else 0.
- * notice:
- *     does not touch `dst' unless it's returning 1.
- * author:
- *     Paul Vixie, 1996.
- */
-static int
-inet_pton4(src, dst)
-       const char *src;
-       unsigned char *dst;
-{
-       static const char digits[] = "0123456789";
-       int saw_digit, octets, ch;
-       unsigned char tmp[NS_INADDRSZ], *tp;
-
-       saw_digit = 0;
-       octets = 0;
-       *(tp = tmp) = 0;
-       while ((ch = *src++) != '\0') {
-               const char *pch;
-
-               if ((pch = strchr(digits, ch)) != NULL) {
-                       unsigned int new = *tp * 10 + (pch - digits);
-
-                       if (new > 255)
-                               return (0);
-                       *tp = new;
-                       if (! saw_digit) {
-                               if (++octets > 4)
-                                       return (0);
-                               saw_digit = 1;
-                       }
-               } else if (ch == '.' && saw_digit) {
-                       if (octets == 4)
-                               return (0);
-                       *++tp = 0;
-                       saw_digit = 0;
-               } else
-                       return (0);
-       }
-       if (octets < 4)
-               return (0);
-       memcpy(dst, tmp, NS_INADDRSZ);
-       return (1);
-}
-
-/* int
- * inet_pton6(src, dst)
- *     convert presentation level address to network order binary form.
- * return:
- *     1 if `src' is a valid [RFC1884 2.2] address, else 0.
- * notice:
- *     (1) does not touch `dst' unless it's returning 1.
- *     (2) :: in a full address is silently ignored.
- * credit:
- *     inspired by Mark Andrews.
- * author:
- *     Paul Vixie, 1996.
- */
-#ifdef INET6
-static int
-inet_pton6(src, dst)
-       const char *src;
-       unsigned char *dst;
-{
-       static const char xdigits_l[] = "0123456789abcdef",
-                         xdigits_u[] = "0123456789ABCDEF";
-       unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
-       const char *xdigits, *curtok;
-       int ch, saw_xdigit;
-       unsigned int val;
-
-       memset((tp = tmp), '\0', NS_IN6ADDRSZ);
-       endp = tp + NS_IN6ADDRSZ;
-       colonp = NULL;
-       /* Leading :: requires some special handling. */
-       if (*src == ':')
-               if (*++src != ':')
-                       return (0);
-       curtok = src;
-       saw_xdigit = 0;
-       val = 0;
-       while ((ch = *src++) != '\0') {
-               const char *pch;
-
-               if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
-                       pch = strchr((xdigits = xdigits_u), ch);
-               if (pch != NULL) {
-                       val <<= 4;
-                       val |= (pch - xdigits);
-                       if (val > 0xffff)
-                               return (0);
-                       saw_xdigit = 1;
-                       continue;
-               }
-               if (ch == ':') {
-                       curtok = src;
-                       if (!saw_xdigit) {
-                               if (colonp)
-                                       return (0);
-                               colonp = tp;
-                               continue;
-                       }
-                       if (tp + NS_INT16SZ > endp)
-                               return (0);
-                       *tp++ = (unsigned char) (val >> 8) & 0xff;
-                       *tp++ = (unsigned char) val & 0xff;
-                       saw_xdigit = 0;
-                       val = 0;
-                       continue;
-               }
-               if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
-                   inet_pton4(curtok, tp) > 0) {
-                       tp += NS_INADDRSZ;
-                       saw_xdigit = 0;
-                       break;  /* '\0' was seen by inet_pton4(). */
-               }
-               return (0);
-       }
-       if (saw_xdigit) {
-               if (tp + NS_INT16SZ > endp)
-                       return (0);
-               *tp++ = (unsigned char) (val >> 8) & 0xff;
-               *tp++ = (unsigned char) val & 0xff;
-       }
-       if (colonp != NULL) {
-               /*
-                * Since some memmove()'s erroneously fail to handle
-                * overlapping regions, we'll do the shift by hand.
-                */
-               const int n = tp - colonp;
-               int i;
-
-               for (i = 1; i <= n; i++) {
-                       endp[- i] = colonp[n - i];
-                       colonp[n - i] = 0;
-               }
-               tp = endp;
-       }
-       if (tp != endp)
-               return (0);
-       memcpy(dst, tmp, NS_IN6ADDRSZ);
-       return (1);
-}
-#endif
diff --git a/lib/libc/ip/listen.c b/lib/libc/ip/listen.c
deleted file mode 100644 (file)
index 5a8f55d..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_io.h>
-
-#define DEBUG 0
-
-int listen(int socket, int backlog)
-{
-       int r;
-
-       r= ioctl(socket, NWIOTCPLISTENQ, &backlog);
-       if (r != -1 || errno != EBADIOCTL)
-               return r;
-
-       r= ioctl(socket, NWIOSUDSBLOG, &backlog);
-       if (r != -1 || errno != EBADIOCTL)
-               return r;
-
-#if DEBUG
-       fprintf(stderr, "listen: not implemented for fd %d\n", socket);
-#endif
-       errno= ENOSYS;
-       return -1;
-}
-
diff --git a/lib/libc/ip/memcspn.c b/lib/libc/ip/memcspn.c
deleted file mode 100644 (file)
index 8b5d1e2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <string.h>
-
-size_t
-memcspn(const char *string, size_t strlen, const char *notin, size_t notinlen)
-{
-       register const char *s1, *s2;
-       int i,j;
-
-       for (s1 = string, i = 0; i<strlen; s1++, i++) {
-               for(s2 = notin, j = 0; *s2 != *s1 && j < notinlen; s2++, j++)
-                       /* EMPTY */ ;
-               if (j != notinlen)
-                       break;
-       }
-       return s1 - string;
-}
diff --git a/lib/libc/ip/nameinfo.c b/lib/libc/ip/nameinfo.c
deleted file mode 100755 (executable)
index 3444c29..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-#include <arpa/inet.h>
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <netdb.h>
-#include <unistd.h>
-
-static size_t first_component_len(const char *s)
-{
-       const char *first = s;
-
-       /* find the first dot or end of string */
-       while (*s && *s != '.')
-               s++;
-
-       /* return length */
-       return s - first;
-}
-
-static int getnameinfo_get_host(const struct sockaddr_in *sockaddr, 
-       char *node, socklen_t nodelen, int flags)
-{
-       struct hostent *hostent;
-       const char *ipaddr;
-
-       /* perform look-up */
-       if ((flags & NI_NUMERICHOST) != NI_NUMERICHOST)
-       {
-               hostent = gethostbyaddr(
-                       (char *) &sockaddr->sin_addr, 
-                       sizeof(sockaddr->sin_addr), 
-                       AF_INET);
-
-               if (hostent && hostent->h_name)
-               {
-                       /* return the hostname that was found */
-                       if (nodelen <= strlen(hostent->h_name))
-                               return EAI_OVERFLOW;
-
-                       strcpy(node, hostent->h_name);
-                       return 0;
-               }
-       }
-
-       if ((flags & NI_NAMEREQD) == NI_NAMEREQD)
-               return EAI_NONAME;
-
-       /* basic implementation to provide numeric values */
-       ipaddr = inet_ntoa(sockaddr->sin_addr);
-       if (nodelen <= strlen(ipaddr))
-               return EAI_OVERFLOW;
-
-       strcpy(node, ipaddr);
-       return 0;
-}
-
-static int getnameinfo_get_serv(const struct sockaddr_in *sockaddr, 
-       char *service, socklen_t servicelen, int flags)
-{
-       struct servent *servent;
-       unsigned short port;
-
-       /* perform look-up */
-       if ((flags & NI_NUMERICSERV) != NI_NUMERICSERV)
-       {
-               servent = getservbyport(sockaddr->sin_port, 
-                       ((flags & NI_DGRAM) == NI_DGRAM) ? "udp" : "tcp");
-               if (servent && servent->s_name)
-               {
-                       /* return the service name that was found */
-                       if (strlen(servent->s_name) >= servicelen)
-                               return EAI_OVERFLOW;
-
-                       strcpy(service, servent->s_name);
-                       return 0;
-               }
-       }
-
-       /* return port number */
-       port = ntohs(sockaddr->sin_port);
-       if (snprintf(service, servicelen, "%u", port) >= servicelen)
-               return EAI_OVERFLOW;
-
-       return 0;
-}
-
-/*
- * getnameinfo is based on
- * http://www.opengroup.org/onlinepubs/009695399/functions/getnameinfo.html
- */
-int getnameinfo(const struct sockaddr *sa, socklen_t salen,
-       char *node, socklen_t nodelen, char *service,
-       socklen_t servicelen, int flags)
-{
-       int r;
-       const struct sockaddr_in *sockaddr;
-
-       /* 
-        * The following flags are really supported:
-        * - NI_NUMERICHOST
-        * - NI_NAMEREQD 
-        * - NI_NUMERICSERV 
-        * - NI_DGRAM
-        *
-        * The following flag is not supported:
-        * - NI_NUMERICSCOPE
-        *
-        * The following flags could have been supported but is not implemented:
-        * - NI_NOFQDN
-        */
-
-       /* check for invalid parameters; only support IPv4 */
-       if (sa == NULL)
-       {
-               errno = EINVAL;
-               return EAI_SYSTEM;
-       }
-       
-       if (sa->sa_family != AF_INET || salen != sizeof(struct sockaddr_in))
-               return EAI_FAMILY;
-
-       if (flags & ~(NI_NUMERICHOST | NI_NAMEREQD | NI_NUMERICSERV | NI_DGRAM))
-               return EAI_BADFLAGS;
-
-       if ((!node || !nodelen) && (!service || !servicelen))
-               return EAI_NONAME;
-
-       /* look up host */
-       sockaddr = (const struct sockaddr_in *) sa;
-       if (node && nodelen > 0)
-       {
-               r = getnameinfo_get_host(sockaddr, node, nodelen, flags);
-               if (r)
-                       return r;
-       }
-
-       /* look up service */
-       if (service && servicelen > 0)
-       {
-               r = getnameinfo_get_serv(sockaddr, service, servicelen, flags);
-               if (r)
-                       return r;
-       }
-
-       return 0;
-}
diff --git a/lib/libc/ip/oneC_sum.c b/lib/libc/ip/oneC_sum.c
deleted file mode 100644 (file)
index 702b9d3..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*     oneC_sum() - One complement's checksum          Author: Kees J. Bot
- *                                                             8 May 1995
- * See RFC 1071, "Computing the Internet checksum"
- */
-
-#include <sys/types.h>
-#include <net/gen/oneCsum.h>
-
-u16_t oneC_sum(u16_t prev, void *data, size_t size)
-{
-       u8_t *dptr;
-       size_t n;
-       u16_t word;
-       u32_t sum;
-       int swap= 0;
-
-       sum= prev;
-       dptr= data;
-       n= size;
-
-       swap= ((size_t) dptr & 1);
-       if (swap) {
-               sum= ((sum & 0xFF) << 8) | ((sum & 0xFF00) >> 8);
-               if (n > 0) {
-                       ((u8_t *) &word)[0]= 0;
-                       ((u8_t *) &word)[1]= dptr[0];
-                       sum+= (u32_t) word;
-                       dptr+= 1;
-                       n-= 1;
-               }
-       }
-
-       while (n >= 8) {
-               sum+= (u32_t) ((u16_t *) dptr)[0]
-                   + (u32_t) ((u16_t *) dptr)[1]
-                   + (u32_t) ((u16_t *) dptr)[2]
-                   + (u32_t) ((u16_t *) dptr)[3];
-               dptr+= 8;
-               n-= 8;
-       }
-
-       while (n >= 2) {
-               sum+= (u32_t) ((u16_t *) dptr)[0];
-               dptr+= 2;
-               n-= 2;
-       }
-
-       if (n > 0) {
-               ((u8_t *) &word)[0]= dptr[0];
-               ((u8_t *) &word)[1]= 0;
-               sum+= (u32_t) word;
-       }
-
-       sum= (sum & 0xFFFF) + (sum >> 16);
-       if (sum > 0xFFFF) sum++;
-
-       if (swap) {
-               sum= ((sum & 0xFF) << 8) | ((sum & 0xFF00) >> 8);
-       }
-       return sum;
-}
diff --git a/lib/libc/ip/rcmd.c b/lib/libc/ip/rcmd.c
deleted file mode 100644 (file)
index bc79909..0000000
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * Copyright (c) 1983 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rcmd.c     5.22 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-#include <net/gen/netdb.h>
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/hton.h>
-#include <net/netlib.h>
-
-#define MAXHOSTNAMELEN 256
-#define MAXPATHLEN PATH_MAX
-
-#ifdef __STDC__
-#define CONST  const
-#else
-#define CONST
-#endif
-
-extern errno;
-
-int rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
-char **ahost;
-int rport;
-CONST char *locuser, *remuser, *cmd;
-int *fd2p;
-{
-       int fd, fd2, result;
-       struct hostent *hp;
-       int n;
-       static tcpport_t lport;
-       nwio_tcpconf_t tcpconf;
-       nwio_tcpcl_t tcpconnopt;
-       pid_t pid;
-       char num[8];
-       char c;
-       char *tcp_device;
-
-       fd= -1;
-       fd2= -1;
-
-       if (lport == 0) {
-               pid = getpid();
-               lport = 1;
-               do {
-                       lport = (lport << 1) | (pid & 1);
-
-                       pid >>= 1;
-               } while (lport < TCPPORT_RESERVED/2);
-       }
-
-       tcp_device= getenv("TCP_DEVICE");
-       if (tcp_device == NULL)
-               tcp_device= TCP_DEVICE;
-       hp= gethostbyname(*ahost);
-       if (!hp)
-       {
-               fprintf(stderr, "%s: unknown host\n", *ahost);
-               return -1;
-       }
-       *ahost= hp->h_name;
-       n = TCPPORT_RESERVED/2;
-       do
-       {
-               if (--lport < TCPPORT_RESERVED/2)
-                       lport = TCPPORT_RESERVED-1;
-               fd= open (tcp_device, O_RDWR);
-               if (fd<0)
-               {
-                       fprintf(stderr, "unable to open %s: %s\n",
-                               tcp_device, strerror(errno));
-                       goto bad;
-               }
-               tcpconf.nwtc_flags= NWTC_LP_SET | NWTC_SET_RA | NWTC_SET_RP |
-                       NWTC_EXCL;
-               tcpconf.nwtc_locport= htons(lport);
-               tcpconf.nwtc_remport= rport;
-               tcpconf.nwtc_remaddr= *(ipaddr_t *)hp->h_addr;
-
-               result= ioctl(fd, NWIOSTCPCONF, &tcpconf);
-               if (result<0)
-               {
-                       if (errno == EADDRINUSE)
-                       {
-                               close(fd);
-                               continue;
-                       }
-                       fprintf(stderr, "unable to ioctl(NWIOSTCPCONF): %s\n",
-                               strerror(errno));
-                       goto bad;
-               }
-               tcpconf.nwtc_flags= NWTC_SHARED;
-               result= ioctl(fd, NWIOSTCPCONF, &tcpconf);
-               if (result<0)
-               {
-                       fprintf(stderr, "unable to ioctl(NWIOSTCPCONF): %s\n",
-                               strerror(errno));
-                       goto bad;
-               }
-               tcpconnopt.nwtcl_flags= 0;
-
-               do
-               {
-                       result= ioctl (fd, NWIOTCPCONN, &tcpconnopt);
-                       if (result<0 && errno == EAGAIN)
-                       {
-                               sleep(2);
-                       }
-               } while (result<0 && errno == EAGAIN);
-               if (result<0 && errno != EADDRINUSE)
-               {
-                       fprintf(stderr,
-                               "unable to ioctl(NWIOTCPCONN): %s\n",
-                               strerror(errno));
-                       goto bad;
-               }
-               if (result>=0)
-                       break;
-       } while (--n > 0);
-       if (n == 0)
-       {
-               fprintf(stderr, "can't get port\n");
-               return -1;
-       }
-       if (!fd2p)
-       {
-               if (write(fd, "", 1) != 1)
-               {
-                       fprintf(stderr, "unable to write: %s", strerror(errno));
-                       goto bad;
-               }
-       }
-       else
-       {
-               fd2= open (tcp_device, O_RDWR);
-               if (fd2<0)
-               {
-                       fprintf(stderr, "unable to open %s: %s\n",
-                               tcp_device, strerror(errno));
-                       goto bad;
-               }
-               tcpconf.nwtc_flags= NWTC_LP_SET | NWTC_UNSET_RA | 
-                       NWTC_UNSET_RP | NWTC_SHARED;
-               tcpconf.nwtc_locport= htons(lport);
-
-               result= ioctl(fd2, NWIOSTCPCONF, &tcpconf);
-               if (result<0)
-               {
-                       fprintf(stderr,
-                               "unable to ioctl(NWIOSTCPCONF): %s\n",
-                               strerror(errno));
-                       goto bad;
-               }
-               pid= fork();
-               if (pid<0)
-               {
-                       fprintf(stderr, "unable to fork: %s\n",
-                               strerror(errno));
-                       goto bad;
-               }
-               if (!pid)
-               {
-                       alarm(0);
-                       signal(SIGALRM, SIG_DFL);
-                       alarm(30); /* give up after half a minute */
-                       tcpconnopt.nwtcl_flags= 0;
-
-                       do
-                       {
-                               result= ioctl (fd2, NWIOTCPLISTEN,
-                                       &tcpconnopt);
-                               if (result<0 && errno == EAGAIN)
-                               {
-                                       sleep(2);
-                               }
-                       } while (result<0 && errno == EAGAIN);
-                       if (result<0 && errno != EADDRINUSE)
-                       {
-                               fprintf(stderr,
-                                       "unable to ioctl(NWIOTCPLISTEN): %s\n",
-                                       strerror(errno));
-                               exit(1);
-                       }
-                       if (result>=0)
-                               exit(0);
-                       else
-                               exit(1);
-               }
-               /*
-                * This sleep is a HACK.  The command that we are starting
-                * will try to connect to the fd2 port.  It seems that for
-                * this to succeed the child process must have already made
-                * the call to ioctl above (the NWIOTCPLISTEN) call.
-                * The sleep gives the child a chance to make the call
-                * before the parent sends the port number to the
-                * command being started.
-                */
-               sleep(1);
-
-               sprintf(num, "%d", lport);
-               if (write(fd, num, strlen(num)+1) != strlen(num)+1)
-               {
-                       fprintf(stderr, "unable to write: %s\n",
-                               strerror(errno));
-                       goto bad;
-               }
-
-       }
-       write (fd, locuser, strlen(locuser)+1);
-       write (fd, remuser, strlen(remuser)+1);
-       write (fd, cmd, strlen(cmd)+1);
-       if (read(fd, &c, 1) != 1)
-       {
-               fprintf(stderr, "unable to read: %s\n", strerror(errno) );
-               goto bad;
-       }
-       if (c != 0)
-       {
-               while (read(fd, &c, 1) == 1)
-               {
-                       write(2, &c, 1);
-                       if (c == '\n')
-                               break;
-               }
-               goto bad;
-       }
-       if (fd2p)
-       {
-               *fd2p= fd2;
-               result= ioctl(fd2, NWIOGTCPCONF, &tcpconf);
-               if (result<0)
-               {
-                       fprintf(stderr, "unable to ioctl(NWIOGTCPCONF): %s\n",
-                               strerror(errno) );
-                       goto bad;
-               }
-               if (ntohs(tcpconf.nwtc_remport) >= TCPPORT_RESERVED)
-               {
-                       fprintf(stderr, "unable to setup 2nd channel\n");
-                       goto bad;
-               }
-       }
-       return fd;
-
-bad:
-       if (fd>=0)
-               close(fd);
-       if (fd2>=0)
-               close(fd2);
-       return -1;
-}
diff --git a/lib/libc/ip/recv.c b/lib/libc/ip/recv.c
deleted file mode 100644 (file)
index b40f0a6..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdlib.h>
-#include <sys/socket.h>
-
-ssize_t recv(int socket, void *buffer, size_t length, int flags)
-{
-       return recvfrom(socket, buffer, length, flags, NULL, NULL);
-}
diff --git a/lib/libc/ip/recvfrom.c b/lib/libc/ip/recvfrom.c
deleted file mode 100644 (file)
index 8c3097c..0000000
+++ /dev/null
@@ -1,292 +0,0 @@
-#undef NDEBUG
-
-#include <assert.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_hdr.h>
-#include <net/gen/udp_io.h>
-
-#define DEBUG 0
-
-static ssize_t _tcp_recvfrom(int socket, void *_RESTRICT buffer, size_t length,
-       int flags, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconfp);
-static ssize_t _udp_recvfrom(int socket, void *_RESTRICT buffer, size_t length,
-       int flags, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len, nwio_udpopt_t *udpoptp);
-static ssize_t _uds_recvfrom_conn(int socket, void *_RESTRICT buffer,
-       size_t length, int flags, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr);
-static ssize_t _uds_recvfrom_dgram(int socket, void *_RESTRICT buffer,
-       size_t length, int flags, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len);
-
-ssize_t recvfrom(int socket, void *_RESTRICT buffer, size_t length,
-       int flags, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len)
-{
-       int r;
-       nwio_tcpconf_t tcpconf;
-       nwio_udpopt_t udpopt;
-       struct sockaddr_un uds_addr;
-       int uds_sotype = -1;
-
-#if DEBUG
-       fprintf(stderr, "recvfrom: for fd %d\n", socket);
-#endif
-
-       r= ioctl(socket, NWIOGTCPCONF, &tcpconf);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-                       return r;
-               return _tcp_recvfrom(socket, buffer, length, flags,
-                       address, address_len, &tcpconf);
-       }
-
-       r= ioctl(socket, NWIOGUDPOPT, &udpopt);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-                       return r;
-               return _udp_recvfrom(socket, buffer, length, flags,
-                       address, address_len, &udpopt);
-       }
-
-       r= ioctl(socket, NWIOGUDSSOTYPE, &uds_sotype);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-
-               if (r == -1) {
-                       return r;
-               }
-
-               if (uds_sotype == SOCK_DGRAM) {
-                       return _uds_recvfrom_dgram(socket, buffer, 
-                               length, flags, address, address_len);
-               } else {
-                       return _uds_recvfrom_conn(socket, buffer, 
-                               length, flags, address, address_len, 
-                               &uds_addr);
-               }
-       }
-
-#if DEBUG
-       fprintf(stderr, "recvfrom: not implemented for fd %d\n", socket);
-#endif
-       errno= ENOSYS;
-       assert(0);
-       return -1;
-}
-
-static ssize_t _tcp_recvfrom(int socket, void *_RESTRICT buffer, size_t length,
-       int flags, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len, nwio_tcpconf_t *tcpconfp)
-{
-       int r;
-       size_t len;
-       struct sockaddr_in sin;
-
-       if (flags != 0)
-       {
-#if DEBUG
-               fprintf(stderr, "recvfrom(tcp): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-       }
-
-       r = read(socket, buffer, length);
-
-       if (r >= 0 && address != NULL)
-       {
-               sin.sin_family= AF_INET;
-               sin.sin_addr.s_addr= tcpconfp->nwtc_remaddr;
-               sin.sin_port= tcpconfp->nwtc_remport;
-               len= *address_len;
-               if (len > sizeof(sin))
-                       len= sizeof(sin);
-               memcpy(address, &sin, len);
-               *address_len= sizeof(sin);
-       }       
-
-       return r;
-}
-
-static ssize_t _udp_recvfrom(int socket, void *_RESTRICT buffer, size_t length,
-       int flags, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len, nwio_udpopt_t *udpoptp)
-{
-       int r, t_errno;
-       size_t buflen, len;
-       void *buf;
-       udp_io_hdr_t *io_hdrp;
-       struct sockaddr_in sin;
-
-       if (flags)
-       {
-#if DEBUG
-               fprintf(stderr, "recvfrom(udp): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-       }
-
-       if (udpoptp->nwuo_flags & NWUO_RWDATONLY)
-       {
-               if (address != NULL &&
-                       (udpoptp->nwuo_flags & (NWUO_RA_SET | NWUO_RP_SET)) !=
-                       (NWUO_RA_SET | NWUO_RP_SET))
-               {
-
-#if DEBUG
-                       fprintf(stderr,
-                       "recvfrom(udp): RWDATONLY on unconnected socket\n");
-#endif
-                       errno= ENOTCONN;
-                       return -1;
-               }
-
-               r= read(socket, buffer, length);
-               if (r == -1)
-                       return r;
-
-               if (address != NULL)
-               {
-                       sin.sin_family= AF_INET;
-                       sin.sin_addr.s_addr= udpoptp->nwuo_remaddr;
-                       sin.sin_port= udpoptp->nwuo_remport;
-                       len= *address_len;
-                       if (len > sizeof(sin))
-                               len= sizeof(sin);
-                       memcpy(address, &sin, len);
-                       *address_len= sizeof(sin);
-               }
-
-               return r;
-       }
-
-       buflen= sizeof(*io_hdrp) + length;
-       if (buflen < length)
-       {       
-               /* Overflow */
-               errno= EMSGSIZE;
-               return -1;
-       }
-       buf= malloc(buflen);
-       if (buf == NULL)
-               return -1;
-
-       r= read(socket, buf, buflen);
-       if (r == -1)
-       {
-               t_errno= errno;
-#if DEBUG
-               fprintf(stderr, "recvfrom(udp): read failed: %s\n",
-                       strerror(errno));
-               fprintf(stderr, "udp opt flags = 0x%x\n", udpoptp->nwuo_flags);
-#endif
-               free(buf);
-               errno= t_errno;
-               return -1;
-       }
-
-       assert(r >= sizeof(*io_hdrp));
-       length= r-sizeof(*io_hdrp);
-
-       io_hdrp= buf;
-       memcpy(buffer, &io_hdrp[1], length);
-
-       if (address != NULL)
-       {
-               sin.sin_family= AF_INET;
-               sin.sin_addr.s_addr= io_hdrp->uih_src_addr;
-               sin.sin_port= io_hdrp->uih_src_port;
-               len= *address_len;
-               if (len > sizeof(sin))
-                       len= sizeof(sin);
-               memcpy(address, &sin, len);
-               *address_len= sizeof(sin);
-       }       
-       free(buf);
-       return length;
-}
-
-static ssize_t _uds_recvfrom_conn(int socket, void *_RESTRICT buffer, 
-       size_t length, int flags, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len, struct sockaddr_un *uds_addr)
-{
-       int r;
-       size_t len;
-
-       /* for connection oriented unix domain sockets (SOCK_STREAM / 
-        * SOCK_SEQPACKET)
-        */
-
-       if (flags != 0)
-       {
-#if DEBUG
-               fprintf(stderr, "recvfrom(uds): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-       }
-
-       r = read(socket, buffer, length);
-
-       if (r >= 0 && address != NULL)
-       {
-
-               len= *address_len;
-               if (len > sizeof(struct sockaddr_un))
-                       len= sizeof(struct sockaddr_un);
-               memcpy(address, uds_addr, len);
-               *address_len= sizeof(struct sockaddr_un);
-       }       
-
-       return r;
-}
-
-static ssize_t _uds_recvfrom_dgram(int socket, void *_RESTRICT buffer, 
-       size_t length, int flags, struct sockaddr *_RESTRICT address,
-       socklen_t *_RESTRICT address_len)
-{
-       int r;
-       size_t len;
-
-       /* for connectionless unix domain sockets (SOCK_DGRAM) */
-
-       if (flags != 0)
-       {
-#if DEBUG
-               fprintf(stderr, "recvfrom(uds): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-       }
-
-       r = read(socket, buffer, length);
-
-       if (r >= 0 && address != NULL)
-       {
-               len= *address_len;
-               if (len > sizeof(struct sockaddr_un))
-                       len= sizeof(struct sockaddr_un);
-               ioctl(socket, NWIOGUDSFADDR, address);
-               *address_len= sizeof(struct sockaddr_un);
-       }       
-
-       return r;
-}
-
diff --git a/lib/libc/ip/recvmsg.c b/lib/libc/ip/recvmsg.c
deleted file mode 100644 (file)
index 9b8f4fc..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-#undef NDEBUG
-
-#include <errno.h>
-#include <net/ioctl.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/un.h>
-
-#define DEBUG 0
-
-static ssize_t _uds_recvmsg_conn(int socket, struct msghdr *msg, int flags);
-static ssize_t _uds_recvmsg_dgram(int socket, struct msghdr *msg, int flags);
-
-ssize_t recvmsg(int socket, struct msghdr *msg, int flags)
-{
-       int r;
-       int uds_sotype;
-
-       if (msg == NULL) {
-               errno= EFAULT;
-               return -1;
-       }
-
-       r= ioctl(socket, NWIOGUDSSOTYPE, &uds_sotype);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL)) {
-               if (r == -1) {
-                       return r;
-               }
-
-               if (uds_sotype == SOCK_DGRAM) {
-                       return _uds_recvmsg_dgram(socket, msg, flags);
-               } else {
-                       return _uds_recvmsg_conn(socket, msg, flags);
-               }
-       }
-
-#if DEBUG
-       fprintf(stderr, "recvmsg: not implemented for fd %d\n", socket);
-#endif
-
-       errno= ENOSYS;
-       return -1;
-}
-
-static ssize_t _uds_recvmsg_conn(int socket, struct msghdr *msg, int flags)
-{
-       int r, rc;
-
-       if (flags != 0) {
-#if DEBUG
-               fprintf(stderr, "recvmsg(uds): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-       }
-
-       r= readv(socket, msg->msg_iov, msg->msg_iovlen);
-
-       if (r >= 0 && msg->msg_name && msg->msg_namelen > 0) {
-               getpeername(socket, msg->msg_name, &msg->msg_namelen);
-       }
-
-       /* get control data */
-       if (r >= 0 && msg->msg_control && msg->msg_controllen > 0) {
-               struct msg_control msg_ctrl;
-
-               memset(&msg_ctrl, '\0', sizeof(struct msg_control));
-               msg_ctrl.msg_controllen = msg->msg_controllen;
-               rc = ioctl(socket, NWIOGUDSCTRL, &msg_ctrl);
-               if (rc == -1) {
-                       return rc;
-               }
-
-               if (msg_ctrl.msg_controllen <= msg->msg_controllen) {
-                       memcpy(msg->msg_control, msg_ctrl.msg_control,
-                                               msg_ctrl.msg_controllen);
-                       msg->msg_controllen = msg_ctrl.msg_controllen;
-               }
-       }
-
-       msg->msg_flags = 0;
-
-       return r;
-}
-
-static ssize_t _uds_recvmsg_dgram(int socket, struct msghdr *msg, int flags)
-{
-       int r, rc;
-
-       if (flags != 0) {
-#if DEBUG
-               fprintf(stderr, "recvmsg(uds): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-       }
-
-       r= readv(socket, msg->msg_iov, msg->msg_iovlen);
-
-       if (r >= 0 && msg->msg_name &&
-                               msg->msg_namelen >= sizeof(struct sockaddr_un))
-       {
-               rc= ioctl(socket, NWIOGUDSFADDR, msg->msg_name);
-               if (rc == -1) {
-                       return rc;
-               }
-               msg->msg_namelen= sizeof(struct sockaddr_un);
-       }
-
-       /* get control data */
-       if (r >= 0 && msg->msg_control && msg->msg_controllen > 0) {
-               struct msg_control msg_ctrl;
-
-               memset(&msg_ctrl, '\0', sizeof(struct msg_control));
-               msg_ctrl.msg_controllen = msg->msg_controllen;
-               rc = ioctl(socket, NWIOGUDSCTRL, &msg_ctrl);
-               if (rc == -1) {
-                       return rc;
-               }
-
-               if (msg_ctrl.msg_controllen <= msg->msg_controllen) {
-                       memcpy(msg->msg_control, msg_ctrl.msg_control,
-                                               msg_ctrl.msg_controllen);
-                       msg->msg_controllen = msg_ctrl.msg_controllen;
-               }
-       }
-
-       msg->msg_flags = 0;
-
-       return r;
-}
diff --git a/lib/libc/ip/res_comp.c b/lib/libc/ip/res_comp.c
deleted file mode 100644 (file)
index 44c0129..0000000
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Copyright (c) 1985 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted provided
- * that: (1) source distributions retain this entire copyright notice and
- * comment, and (2) distributions including binaries display the following
- * acknowledgement:  ``This product includes software developed by the
- * University of California, Berkeley and its contributors'' in the
- * documentation or other materials provided with the distribution and in
- * all advertising materials mentioning features or use of this software.
- * 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_comp.c 6.18 (Berkeley) 6/27/90";
-#endif /* LIBC_SCCS and not lint */
-
-#if _MINIX
-#include <sys/types.h>
-#include <stdlib.h>
-
-#include <net/gen/in.h>
-#include <net/gen/nameser.h>
-#include <net/gen/resolv.h>
-
-static int dn_find _ARGS(( const u_char *exp_dn, const u_char *msg,
-       u_char **dnptrs, u_char **lastdnptr ));
-int dn_skipname _ARGS(( const u_char *comp_dn, const u_char *eom ));
-
-#define getshort _getshort
-#define getlong _getlong
-#define putshort __putshort
-#define putlong __putlong
-#else
-#include <sys/types.h>
-#include <stdio.h>
-#include <arpa/nameser.h>
-
-static int dn_find();
-#endif
-
-#ifdef __STDC__
-#define CONST  const
-#else
-#define CONST
-#endif
-
-/*
- * Expand compressed domain name 'comp_dn' to full domain name.
- * 'msg' is a pointer to the begining of the message,
- * 'eomorig' points to the first location after the message,
- * 'exp_dn' is a pointer to a buffer of size 'length' for the result.
- * Return size of compressed name or -1 if there was an error.
- */
-int
-dn_expand(msg, eomorig, comp_dn, exp_dn, length)
-       CONST u_char *msg, *eomorig, *comp_dn;
-       u_char *exp_dn;
-       int length;
-{
-       register CONST u_char *cp;
-       register u_char *dn;
-       register int n, c;
-       CONST u_char *eom;
-       int len = -1, checked = 0;
-
-       dn = exp_dn;
-       cp = comp_dn;
-       eom = exp_dn + length;
-       /*
-        * fetch next label in domain name
-        */
-       while ((n = *cp++)) {
-               /*
-                * Check for indirection
-                */
-               switch (n & INDIR_MASK) {
-               case 0:
-                       if (dn != exp_dn) {
-                               if (dn >= eom)
-                                       return (-1);
-                               *dn++ = '.';
-                       }
-                       if (dn+n >= eom)
-                               return (-1);
-                       checked += n + 1;
-                       while (--n >= 0) {
-                               if ((c = *cp++) == '.') {
-                                       if (dn + n + 2 >= eom)
-                                               return (-1);
-                                       *dn++ = '\\';
-                               }
-                               *dn++ = c;
-                               if (cp >= eomorig)      /* out of range */
-                                       return(-1);
-                       }
-                       break;
-
-               case INDIR_MASK:
-                       if (len < 0)
-                               len = cp - comp_dn + 1;
-                       cp = msg + (((n & 0x3f) << 8) | (*cp & 0xff));
-                       if (cp < msg || cp >= eomorig)  /* out of range */
-                               return(-1);
-                       checked += 2;
-                       /*
-                        * Check for loops in the compressed name;
-                        * if we've looked at the whole message,
-                        * there must be a loop.
-                        */
-                       if (checked >= eomorig - msg)
-                               return (-1);
-                       break;
-
-               default:
-                       return (-1);                    /* flag error */
-               }
-       }
-       *dn = '\0';
-       if (len < 0)
-               len = cp - comp_dn;
-       return (len);
-}
-
-/*
- * Compress domain name 'exp_dn' into 'comp_dn'.
- * Return the size of the compressed name or -1.
- * 'length' is the size of the array pointed to by 'comp_dn'.
- * 'dnptrs' is a list of pointers to previous compressed names. dnptrs[0]
- * is a pointer to the beginning of the message. The list ends with NULL.
- * 'lastdnptr' is a pointer to the end of the arrary pointed to
- * by 'dnptrs'. Side effect is to update the list of pointers for
- * labels inserted into the message as we compress the name.
- * If 'dnptr' is NULL, we don't try to compress names. If 'lastdnptr'
- * is NULL, we don't update the list.
- */
-int
-dn_comp(exp_dn, comp_dn, length, dnptrs, lastdnptr)
-       CONST u_char *exp_dn;
-       u_char *comp_dn;
-       int length;
-       u_char **dnptrs, **lastdnptr;
-{
-       register u_char *cp;
-       register CONST u_char *dn;
-       register int c, l;
-       u_char **cpp, **lpp, *sp, *eob;
-       u_char *msg;
-
-       dn = exp_dn;
-       cp = comp_dn;
-       eob = cp + length;
-       if (dnptrs != NULL) {
-               if ((msg = *dnptrs++) != NULL) {
-                       for (cpp = dnptrs; *cpp != NULL; cpp++)
-                               ;
-                       lpp = cpp;      /* end of list to search */
-               }
-       } else
-               msg = NULL;
-       for (c = *dn++; c != '\0'; ) {
-               /* look to see if we can use pointers */
-               if (msg != NULL) {
-                       if ((l = dn_find(dn-1, msg, dnptrs, lpp)) >= 0) {
-                               if (cp+1 >= eob)
-                                       return (-1);
-                               *cp++ = (l >> 8) | INDIR_MASK;
-                               *cp++ = l % 256;
-                               return (cp - comp_dn);
-                       }
-                       /* not found, save it */
-                       if (lastdnptr != NULL && cpp < lastdnptr-1) {
-                               *cpp++ = cp;
-                               *cpp = NULL;
-                       }
-               }
-               sp = cp++;      /* save ptr to length byte */
-               do {
-                       if (c == '.') {
-                               c = *dn++;
-                               break;
-                       }
-                       if (c == '\\') {
-                               if ((c = *dn++) == '\0')
-                                       break;
-                       }
-                       if (cp >= eob) {
-                               if (msg != NULL)
-                                       *lpp = NULL;
-                               return (-1);
-                       }
-                       *cp++ = c;
-               } while ((c = *dn++) != '\0');
-               /* catch trailing '.'s but not '..' */
-               if ((l = cp - sp - 1) == 0 && c == '\0') {
-                       cp--;
-                       break;
-               }
-               if (l <= 0 || l > MAXLABEL) {
-                       if (msg != NULL)
-                               *lpp = NULL;
-                       return (-1);
-               }
-               *sp = l;
-       }
-       if (cp >= eob) {
-               if (msg != NULL)
-                       *lpp = NULL;
-               return (-1);
-       }
-       *cp++ = '\0';
-       return (cp - comp_dn);
-}
-
-/*
- * Skip over a compressed domain name. Return the size or -1.
- */
-int
-dn_skipname(comp_dn, eom)
-       CONST u_char *comp_dn, *eom;
-{
-       register CONST u_char *cp;
-       register int n;
-
-       cp = comp_dn;
-       while (cp < eom && (n = *cp++)) {
-               /*
-                * check for indirection
-                */
-               switch (n & INDIR_MASK) {
-               case 0:         /* normal case, n == len */
-                       cp += n;
-                       continue;
-               default:        /* illegal type */
-                       return (-1);
-               case INDIR_MASK:        /* indirection */
-                       cp++;
-               }
-               break;
-       }
-       return (cp - comp_dn);
-}
-
-/*
- * Search for expanded name from a list of previously compressed names.
- * Return the offset from msg if found or -1.
- * dnptrs is the pointer to the first name on the list,
- * not the pointer to the start of the message.
- */
-static int
-dn_find(exp_dn, msg, dnptrs, lastdnptr)
-       CONST u_char *exp_dn, *msg;
-       u_char **dnptrs, **lastdnptr;
-{
-       CONST register u_char *dn, *cp;
-       register u_char **cpp;
-       register int n;
-       CONST u_char *sp;
-
-       for (cpp = dnptrs; cpp < lastdnptr; cpp++) {
-               dn = exp_dn;
-               sp = cp = *cpp;
-               while ((n = *cp++)) {
-                       /*
-                        * check for indirection
-                        */
-                       switch (n & INDIR_MASK) {
-                       case 0:         /* normal case, n == len */
-                               while (--n >= 0) {
-                                       if (*dn == '.')
-                                               goto next;
-                                       if (*dn == '\\')
-                                               dn++;
-                                       if (*dn++ != *cp++)
-                                               goto next;
-                               }
-                               if ((n = *dn++) == '\0' && *cp == '\0')
-                                       return (sp - msg);
-                               if (n == '.')
-                                       continue;
-                               goto next;
-
-                       default:        /* illegal type */
-                               return (-1);
-
-                       case INDIR_MASK:        /* indirection */
-                               cp = msg + (((n & 0x3f) << 8) | *cp);
-                       }
-               }
-               if (*dn == '\0')
-                       return (sp - msg);
-       next:   ;
-       }
-       return (-1);
-}
-
-/*
- * Routines to insert/extract short/long's. Must account for byte
- * order and non-alignment problems. This code at least has the
- * advantage of being portable.
- *
- * used by sendmail.
- */
-
-u16_t
-getshort(msgp)
-       CONST u8_t *msgp;
-{
-       return ((msgp[0] << 8) | (msgp[1] << 0));
-}
-
-u32_t
-getlong(msgp)
-       CONST u8_t *msgp;
-{
-       return (  ((u32_t) msgp[0] << 24)
-               | ((u32_t) msgp[1] << 16)
-               | ((u32_t) msgp[2] <<  8)
-               | ((u32_t) msgp[3] <<  0));
-}
-
-
-void
-putshort(u16_t s, u8_t *msgp)
-{
-
-       msgp[1] = s;
-       msgp[0] = s >> 8;
-}
-
-void
-putlong(u32_t l, u8_t *msgp)
-{
-
-       msgp[3] = l;
-       msgp[2] = (l >>= 8);
-       msgp[1] = (l >>= 8);
-       msgp[0] = l >> 8;
-}
diff --git a/lib/libc/ip/res_init.c b/lib/libc/ip/res_init.c
deleted file mode 100644 (file)
index 741f0b2..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*-
- * Copyright (c) 1985, 1989 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted provided
- * that: (1) source distributions retain this entire copyright notice and
- * comment, and (2) distributions including binaries display the following
- * acknowledgement:  ``This product includes software developed by the
- * University of California, Berkeley and its contributors'' in the
- * documentation or other materials provided with the distribution and in
- * all advertising materials mentioning features or use of this software.
- * 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_init.c 6.14 (Berkeley) 6/27/90";
-#endif /* LIBC_SCCS and not lint */
-
-#if _MINIX
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <net/hton.h>
-#include <net/gen/in.h>
-#include <net/gen/inet.h>
-#include <net/gen/nameser.h>
-#include <net/gen/netdb.h>
-#include <net/gen/resolv.h>
-#include <net/gen/socket.h>
-
-#define index(s,c) strchr(s,c)
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-#endif
-
-/*
- * Resolver state
- */
-struct state _res;
-
-/*
- * Set up default settings.  If the configuration file exist, the values
- * there will have precedence.  Otherwise, the server address is set to
- * 127.0.0.1 (localhost) and the default domain name comes from gethostname().
- *
- * The configuration file should only be used if you want to redefine your
- * domain or run without a server on your machine.
- *
- * Return 0 if completes successfully, -1 on error
- */
-int
-res_init()
-{
-       register FILE *fp;
-       register char *cp, **pp;
-       register int n;
-       char buf[BUFSIZ];
-       int haveenv = 0;
-       int havesearch = 0;
-       struct servent* servent;
-       u16_t nameserver_port;
-
-       /* Resolver state default settings */
-       _res.retrans = RES_TIMEOUT;     /* retransmition time interval */
-       _res.retry = 4;                 /* number of times to retransmit */
-       _res.options = RES_DEFAULT;     /* options flags */
-       _res.nscount = 0;               /* number of name servers */
-       _res.defdname[0] = 0;           /* domain */
-
-       servent= getservbyname("domain", NULL);
-       if (!servent)
-       {
-               h_errno= NO_RECOVERY;
-               return -1;
-       }
-       nameserver_port= servent->s_port;
-
-       /* Allow user to override the local domain definition */
-       if ((cp = getenv("LOCALDOMAIN")) != NULL) {
-               (void)strncpy(_res.defdname, cp, sizeof(_res.defdname));
-               haveenv++;
-       }
-
-       if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) {
-           /* read the config file */
-           while (fgets(buf, sizeof(buf), fp) != NULL) {
-               /* read default domain name */
-               if (!strncmp(buf, "domain", sizeof("domain") - 1)) {
-                   if (haveenv)        /* skip if have from environ */
-                           continue;
-                   cp = buf + sizeof("domain") - 1;
-                   while (*cp == ' ' || *cp == '\t')
-                           cp++;
-                   if ((*cp == '\0') || (*cp == '\n'))
-                           continue;
-                   (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
-                   if ((cp = index(_res.defdname, '\n')) != NULL)
-                           *cp = '\0';
-                   havesearch = 0;
-                   continue;
-               }
-               /* set search list */
-               if (!strncmp(buf, "search", sizeof("search") - 1)) {
-                   if (haveenv)        /* skip if have from environ */
-                           continue;
-                   cp = buf + sizeof("search") - 1;
-                   while (*cp == ' ' || *cp == '\t')
-                           cp++;
-                   if ((*cp == '\0') || (*cp == '\n'))
-                           continue;
-                   (void)strncpy(_res.defdname, cp, sizeof(_res.defdname) - 1);
-                   if ((cp = index(_res.defdname, '\n')) != NULL)
-                           *cp = '\0';
-                   /*
-                    * Set search list to be blank-separated strings
-                    * on rest of line.
-                    */
-                   cp = _res.defdname;
-                   pp = _res.dnsrch;
-                   *pp++ = cp;
-                   for (n = 0; *cp && pp < _res.dnsrch + MAXDNSRCH; cp++) {
-                           if (*cp == ' ' || *cp == '\t') {
-                                   *cp = 0;
-                                   n = 1;
-                           } else if (n) {
-                                   *pp++ = cp;
-                                   n = 0;
-                           }
-                   }
-                   /* null terminate last domain if there are excess */
-                   while (*cp != '\0' && *cp != ' ' && *cp != '\t')
-                           cp++;
-                   *cp = '\0';
-                   *pp++ = 0;
-                   havesearch = 1;
-                   continue;
-               }
-               /* read nameservers to query */
-               if (!strncmp(buf, "nameserver", sizeof("nameserver") - 1) &&
-                  _res.nscount < MAXNS) {
-                   cp = buf + sizeof("nameserver") - 1;
-                   while (*cp == ' ' || *cp == '\t')
-                           cp++;
-                   if ((*cp == '\0') || (*cp == '\n'))
-                           continue;
-                   if (!inet_aton(cp, &_res.nsaddr_list[_res.nscount]))
-                           continue;
-                   _res.nsport_list[_res.nscount]= nameserver_port;
-                   _res.nscount++;
-                   continue;
-               }
-           }
-           (void) fclose(fp);
-       }
-       if (_res.nscount == 0) {
-               /* "localhost" is the default nameserver. */
-               _res.nsaddr_list[0]= HTONL(0x7F000001);
-               _res.nsport_list[0]= nameserver_port;
-               _res.nscount= 1;
-       }
-       if (_res.defdname[0] == 0) {
-               if (gethostname(buf, sizeof(_res.defdname)) == 0 &&
-                  (cp = index(buf, '.')))
-                       (void)strcpy(_res.defdname, cp + 1);
-       }
-
-       /* find components of local domain that might be searched */
-       if (havesearch == 0) {
-               pp = _res.dnsrch;
-               *pp++ = _res.defdname;
-               for (cp = _res.defdname, n = 0; *cp; cp++)
-                       if (*cp == '.')
-                               n++;
-               cp = _res.defdname;
-               for (; n >= LOCALDOMAINPARTS && pp < _res.dnsrch + MAXDFLSRCH;
-                   n--) {
-                       cp = index(cp, '.');
-                       *pp++ = ++cp;
-               }
-               *pp++ = 0;
-       }
-       _res.options |= RES_INIT;
-       return (0);
-}
diff --git a/lib/libc/ip/res_mkquery.c b/lib/libc/ip/res_mkquery.c
deleted file mode 100644 (file)
index 132eeb8..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 1985 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_mkquery.c      6.12 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
-#if _MINIX
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <net/hton.h>
-#include <net/gen/in.h>
-#include <net/gen/nameser.h>
-#include <net/gen/resolv.h>
-
-#define bzero(b,l) memset(b,0,l)
-#define bcopy(s,d,l) memcpy(d,s,l)
-
-#define putshort __putshort
-#define putlong __putlong
-#else
-#include <stdio.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-#endif
-
-#ifdef __STDC__
-#define _CONST const
-#else
-#define _CONST
-#endif
-
-/*
- * Form all types of queries.
- * Returns the size of the result or -1.
- */
-int
-res_mkquery(op, dname, class, type, data, datalen, newrr, buf, buflen)
-       int op;                 /* opcode of query */
-       _CONST char *dname;     /* domain name */
-       int class, type;        /* class and type of query */
-       _CONST char *data;      /* resource record data */
-       int datalen;            /* length of data */
-       _CONST struct rrec *newrr; /* new rr for modify or append */
-       char *buf;              /* buffer to put query */
-       int buflen;             /* size of buffer */
-{
-       register dns_hdr_t *hp;
-       register char *cp;
-       register int n;
-       char *dnptrs[10], **dpp, **lastdnptr;
-
-#ifdef DEBUG
-       if (_res.options & RES_DEBUG)
-               printf("res_mkquery(%d, %s, %d, %d)\n", op, dname, class, type);
-#endif /* DEBUG */
-       /*
-        * Initialize header fields.
-        */
-       if ((buf == NULL) || (buflen < sizeof(dns_hdr_t)))
-               return(-1);
-       bzero(buf, sizeof(dns_hdr_t));
-       hp = (dns_hdr_t *) buf;
-       hp->dh_id = htons(++_res.id);
-       hp->dh_flag1= 0;
-       hp->dh_flag2= 0;
-       hp->dh_flag1 |= (op << 3) & DHF_OPCODE;
-       hp->dh_flag2 |= ((_res.options & RES_PRIMARY) != 0 ? 1 : 0) << 6;
-       hp->dh_flag1 |= (_res.options & RES_RECURSE) != 0 ? 1 : 0;
-       hp->dh_flag2 |= NOERROR & DHF_RCODE;
-       cp = buf + sizeof(dns_hdr_t);
-       buflen -= sizeof(dns_hdr_t);
-       dpp = dnptrs;
-       *dpp++ = buf;
-       *dpp++ = NULL;
-       lastdnptr = dnptrs + sizeof(dnptrs)/sizeof(dnptrs[0]);
-       /*
-        * perform opcode specific processing
-        */
-       switch (op) {
-       case QUERY:
-               if ((buflen -= QFIXEDSZ) < 0)
-                       return(-1);
-               if ((n = dn_comp((u8_t *)dname, (u8_t *)cp, buflen, 
-                       (u8_t **)dnptrs, (u8_t **)lastdnptr)) < 0)
-                       return (-1);
-               cp += n;
-               buflen -= n;
-               putshort(type, (u8_t *)cp);
-               cp += sizeof(u_short);
-               putshort(class, (u8_t *)cp);
-               cp += sizeof(u_short);
-               hp->dh_qdcount = HTONS(1);
-               if (op == QUERY || data == NULL)
-                       break;
-               /*
-                * Make an additional record for completion domain.
-                */
-               buflen -= RRFIXEDSZ;
-               if ((n = dn_comp((u8_t *)data, (u8_t *)cp, buflen, 
-                       (u8_t **)dnptrs, (u8_t **)lastdnptr)) < 0)
-                       return (-1);
-               cp += n;
-               buflen -= n;
-               putshort(T_NULL, (u8_t *)cp);
-               cp += sizeof(u_short);
-               putshort(class, (u8_t *)cp);
-               cp += sizeof(u_short);
-               putlong(0, (u8_t *)cp);
-               cp += sizeof(u_long);
-               putshort(0, (u8_t *)cp);
-               cp += sizeof(u_short);
-               hp->dh_arcount = HTONS(1);
-               break;
-
-       case IQUERY:
-               /*
-                * Initialize answer section
-                */
-               if (buflen < 1 + RRFIXEDSZ + datalen)
-                       return (-1);
-               *cp++ = '\0';   /* no domain name */
-               putshort(type, (u8_t *)cp);
-               cp += sizeof(u_short);
-               putshort(class, (u8_t *)cp);
-               cp += sizeof(u_short);
-               putlong(0, (u8_t *)cp);
-               cp += sizeof(u_long);
-               putshort(datalen, (u8_t *)cp);
-               cp += sizeof(u_short);
-               if (datalen) {
-                       bcopy(data, cp, datalen);
-                       cp += datalen;
-               }
-               hp->dh_ancount = HTONS(1);
-               break;
-
-#ifdef ALLOW_UPDATES
-       /*
-        * For UPDATEM/UPDATEMA, do UPDATED/UPDATEDA followed by UPDATEA
-        * (Record to be modified is followed by its replacement in msg.)
-        */
-       case UPDATEM:
-       case UPDATEMA:
-
-       case UPDATED:
-               /*
-                * The res code for UPDATED and UPDATEDA is the same; user
-                * calls them differently: specifies data for UPDATED; server
-                * ignores data if specified for UPDATEDA.
-                */
-       case UPDATEDA:
-               buflen -= RRFIXEDSZ + datalen;
-               if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
-                       return (-1);
-               cp += n;
-               putshort(type, cp);
-                cp += sizeof(u_short);
-                putshort(class, cp);
-                cp += sizeof(u_short);
-               putlong(0, cp);
-               cp += sizeof(u_long);
-               putshort(datalen, cp);
-                cp += sizeof(u_short);
-               if (datalen) {
-                       bcopy(data, cp, datalen);
-                       cp += datalen;
-               }
-               if ( (op == UPDATED) || (op == UPDATEDA) ) {
-                       hp->ancount = HTONS(0);
-                       break;
-               }
-               /* Else UPDATEM/UPDATEMA, so drop into code for UPDATEA */
-
-       case UPDATEA:   /* Add new resource record */
-               buflen -= RRFIXEDSZ + datalen;
-               if ((n = dn_comp(dname, cp, buflen, dnptrs, lastdnptr)) < 0)
-                       return (-1);
-               cp += n;
-               putshort(newrr->r_type, cp);
-                cp += sizeof(u_short);
-                putshort(newrr->r_class, cp);
-                cp += sizeof(u_short);
-               putlong(0, cp);
-               cp += sizeof(u_long);
-               putshort(newrr->r_size, cp);
-                cp += sizeof(u_short);
-               if (newrr->r_size) {
-                       bcopy(newrr->r_data, cp, newrr->r_size);
-                       cp += newrr->r_size;
-               }
-               hp->ancount = HTONS(0);
-               break;
-
-#endif /* ALLOW_UPDATES */
-       }
-       return (cp - buf);
-}
diff --git a/lib/libc/ip/res_query.c b/lib/libc/ip/res_query.c
deleted file mode 100644 (file)
index 9bc4ad3..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that: (1) source distributions retain this entire copyright
- * notice and comment, and (2) distributions including binaries display
- * the following acknowledgement:  ``This product includes software
- * developed by the University of California, Berkeley and its contributors''
- * in the documentation or other materials provided with the distribution
- * and in all advertising materials mentioning features or use of this
- * software. 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_query.c        5.7 (Berkeley) 6/1/90";
-#endif /* LIBC_SCCS and not lint */
-
-#if _MINIX
-#include <sys/types.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <net/hton.h>
-#include <net/gen/in.h>
-#include <net/gen/nameser.h>
-#include <net/gen/netdb.h>
-#include <net/gen/resolv.h>
-
-#define bcopy(s,d,l) memcpy(d,s,l)
-
-#define hostalias __hostalias
-#else
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <ctype.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-
-extern int errno;
-#endif
-
-#if __STDC__
-#define CONST  const
-#else
-#define CONST
-#endif
-
-#if PACKETSZ > 1024
-#define MAXPACKET      PACKETSZ
-#else
-#define MAXPACKET      1024
-#endif
-
-int h_errno;
-
-/*
- * Formulate a normal query, send, and await answer.
- * Returned answer is placed in supplied buffer "answer".
- * Perform preliminary check of answer, returning success only
- * if no error is indicated and the answer count is nonzero.
- * Return the size of the response on success, -1 on error.
- * Error number is left in h_errno.
- * Caller must parse answer and determine whether it answers the question.
- */
-int
-res_query(name, class, type, answer, anslen)
-       char *name;             /* domain name */
-       int class, type;        /* class and type of query */
-       u_char *answer;         /* buffer to put answer */
-       int anslen;             /* size of answer buffer */
-{
-       char buf[MAXPACKET];
-       dns_hdr_t *hp;
-       int n;
-
-       if ((_res.options & RES_INIT) == 0 && res_init() == -1)
-               return (-1);
-#ifdef DEBUG
-       if (_res.options & RES_DEBUG)
-               printf("res_query(%s, %d, %d)\n", name, class, type);
-#endif
-       n = res_mkquery(QUERY, name, class, type, (char *)NULL, 0, NULL,
-           buf, sizeof(buf));
-
-       if (n <= 0) {
-#ifdef DEBUG
-               if (_res.options & RES_DEBUG)
-                       printf("res_query: mkquery failed\n");
-#endif
-               h_errno = NO_RECOVERY;
-               return (n);
-       }
-       n = res_send(buf, n, (char *)answer, anslen);
-       if (n < 0) {
-#ifdef DEBUG
-               if (_res.options & RES_DEBUG)
-                       printf("res_query: send error(%d)\n", errno);
-#endif
-               h_errno = TRY_AGAIN;
-               return(n);
-       }
-
-       hp = (dns_hdr_t *) answer;
-       if ((hp->dh_flag2 & DHF_RCODE) != NOERROR || 
-               ntohs(hp->dh_ancount) == 0) {
-#ifdef DEBUG
-               if (_res.options & RES_DEBUG)
-                       printf("rcode = %d, ancount=%d\n", 
-                               hp->dh_flag2 & DHF_RCODE,
-                           ntohs(hp->dh_ancount));
-#endif
-               switch (hp->dh_flag2 & DHF_RCODE) {
-                       case NXDOMAIN:
-                               h_errno = HOST_NOT_FOUND;
-                               break;
-                       case SERVFAIL:
-                               h_errno = TRY_AGAIN;
-                               break;
-                       case NOERROR:
-                               h_errno = NO_DATA;
-                               break;
-                       case FORMERR:
-                       case NOTIMP:
-                       case REFUSED:
-                       default:
-                               h_errno = NO_RECOVERY;
-                               break;
-               }
-               return (-1);
-       }
-       return(n);
-}
-
-/*
- * Formulate a normal query, send, and retrieve answer in supplied buffer.
- * Return the size of the response on success, -1 on error.
- * If enabled, implement search rules until answer or unrecoverable failure
- * is detected.  Error number is left in h_errno.
- * Only useful for queries in the same name hierarchy as the local host
- * (not, for example, for host address-to-name lookups in domain in-addr.arpa).
- */
-int
-res_search(name, class, type, answer, anslen)
-       char *name;             /* domain name */
-       int class, type;        /* class and type of query */
-       u_char *answer;         /* buffer to put answer */
-       int anslen;             /* size of answer */
-{
-       register char *cp, **domain;
-       int n, ret, got_nodata = 0;
-
-       if ((_res.options & RES_INIT) == 0 && res_init() == -1)
-               return (-1);
-
-       errno = 0;
-       h_errno = HOST_NOT_FOUND;               /* default, if we never query */
-       for (cp = name, n = 0; *cp; cp++)
-               if (*cp == '.')
-                       n++;
-       if (n == 0 && (cp = hostalias(name)))
-               return (res_query(cp, class, type, answer, anslen));
-
-       /*
-        * First try the name as fully-qualified, but only if it contained
-        * at least one dot (even trailing). This is purely a heuristic; we
-        * assume that any reasonable query about a top-level domain (for
-        * servers, SOA, etc) will not use res_search.
-        */
-       if (n && (ret = res_querydomain(name, (char *)NULL, class, type,
-           answer, anslen)) > 0)
-               return (ret);
-
-       /*
-        * If the FQDN lookup failed, we do at least one level of search if
-        *      - there is no dot and RES_DEFNAME is set, or
-        *      - there is at least one dot, there is no trailing dot,
-        *        and RES_DNSRCH is set.
-        */
-       if ((n == 0 && _res.options & RES_DEFNAMES) ||
-          (n != 0 && *--cp != '.' && _res.options & RES_DNSRCH))
-            for (domain = _res.dnsrch; *domain; domain++) {
-               ret = res_querydomain(name, *domain, class, type,
-                   answer, anslen);
-               if (ret > 0)
-                       return (ret);
-               /*
-                * If no server present, give up.
-                * If name isn't found in this domain,
-                * keep trying higher domains in the search list
-                * (if that's enabled).
-                * On a NO_DATA error, keep trying, otherwise
-                * a wildcard entry of another type could keep us
-                * from finding this entry higher in the domain.
-                * If we get some other error (negative answer or
-                * server failure), then stop searching up,
-                * but try the input name below in case it's fully-qualified.
-                */
-               if (errno == ECONNREFUSED) {
-                       h_errno = TRY_AGAIN;
-                       return (-1);
-               }
-               if (h_errno == NO_DATA)
-                       got_nodata++;
-               if ((h_errno != HOST_NOT_FOUND && h_errno != NO_DATA) ||
-                   (_res.options & RES_DNSRCH) == 0)
-                       break;
-       }
-       if (got_nodata)
-               h_errno = NO_DATA;
-       return (-1);
-}
-
-/*
- * Perform a call on res_query on the concatenation of name and domain,
- * removing a trailing dot from name if domain is NULL.
- */
-int
-res_querydomain(name, domain, class, type, answer, anslen)
-       char *name, *domain;
-       int class, type;        /* class and type of query */
-       u_char *answer;         /* buffer to put answer */
-       int anslen;             /* size of answer */
-{
-       char nbuf[2*MAXDNAME+2];
-       char *longname = nbuf;
-       int n;
-
-#ifdef DEBUG
-       if (_res.options & RES_DEBUG)
-               printf("res_querydomain(%s, %s, %d, %d)\n",
-                   name, domain, class, type);
-#endif
-       if (domain == NULL) {
-               /*
-                * Check for trailing '.';
-                * copy without '.' if present.
-                */
-               n = strlen(name) - 1;
-               if (name[n] == '.' && n < sizeof(nbuf) - 1) {
-                       bcopy(name, nbuf, n);
-                       nbuf[n] = '\0';
-               } else
-                       longname = name;
-       } else
-               (void)sprintf(nbuf, "%.*s.%.*s",
-                   MAXDNAME, name, MAXDNAME, domain);
-
-       return (res_query(longname, class, type, answer, anslen));
-}
-
-char *
-hostalias(name)
-       register CONST char *name;
-{
-       register char *C1, *C2;
-       FILE *fp;
-       char *file;
-       char buf[BUFSIZ];
-       static char abuf[MAXDNAME];
-
-       file = getenv("HOSTALIASES");
-       if (file == NULL || (fp = fopen(file, "r")) == NULL)
-               return (NULL);
-       buf[sizeof(buf) - 1] = '\0';
-       while (fgets(buf, sizeof(buf), fp)) {
-               for (C1 = buf; *C1 && !isspace(*C1); ++C1);
-               if (!*C1)
-                       break;
-               *C1 = '\0';
-               if (!strcasecmp(buf, name)) {
-                       while (isspace(*++C1));
-                       if (!*C1)
-                               break;
-                       for (C2 = C1 + 1; *C2 && !isspace(*C2); ++C2);
-                       abuf[sizeof(abuf) - 1] = *C2 = '\0';
-                       (void)strncpy(abuf, C1, sizeof(abuf) - 1);
-                       fclose(fp);
-                       return (abuf);
-               }
-       }
-       fclose(fp);
-       return (NULL);
-}
diff --git a/lib/libc/ip/res_send.c b/lib/libc/ip/res_send.c
deleted file mode 100644 (file)
index 980e9de..0000000
+++ /dev/null
@@ -1,892 +0,0 @@
-/*
- * Copyright (c) 1985, 1989 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)res_send.c 6.27 (Berkeley) 2/24/91";
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * Send query to name server and wait for reply.
- */
-
-#if !_MINIX
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <stdio.h>
-#include <errno.h>
-#include <resolv.h>
-#include <unistd.h>
-#include <string.h>
-
-#else /* _MINIX */
-
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/select.h>
-#include <sys/stat.h>
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <net/hton.h>
-
-#include <net/netlib.h>
-#include <net/gen/in.h>
-#include <net/gen/inet.h>
-#include <net/gen/netdb.h>
-#include <net/gen/nameser.h>
-#include <net/gen/resolv.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_hdr.h>
-#include <net/gen/udp_io.h>
-
-static int udp_connect _ARGS(( void ));
-static int udp_sendto _ARGS(( int fd, const char *buf, unsigned buflen,
-                               ipaddr_t addr, udpport_t port ));
-static int udp_receive _ARGS(( int fd, char *buf, unsigned buflen,
-                               time_t timeout ));
-static int tcpip_writeall _ARGS((int fd, const char *buf, size_t siz));
-static int tcp_connect _ARGS((ipaddr_t host, tcpport_t port, int *terrno));
-
-#endif /* !_MINIX */
-
-static int s = -1;     /* socket used for communications */
-#if !_MINIX
-static struct sockaddr no_addr;
-
-#ifndef FD_SET
-#define        NFDBITS         32
-#define        FD_SETSIZE      32
-#define        FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
-#define        FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
-#define        FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
-#define FD_ZERO(p)     bzero((char *)(p), sizeof(*(p)))
-#endif /* FD_SET */
-#endif /* _MINIX */
-
-int
-res_send(buf, buflen, answer, anslen)
-       const char *buf;
-       int buflen;
-       char *answer;
-       int anslen;
-{
-       register int n;
-       int try, v_circuit, resplen, ns;
-       int gotsomewhere = 0, connected = 0;
-       int connreset = 0;
-#if !_MINIX
-       u_short id, len;
-#else /* _MINIX */
-       u16_t id, len;
-#endif /* !_MINIX */
-       char *cp;
-#if !_MINIX
-       fd_set dsmask;
-       struct timeval timeout;
-       HEADER *hp = (HEADER *) buf;
-       HEADER *anhp = (HEADER *) answer;
-       struct iovec iov[2];
-#else /* _MINIX */
-       time_t timeout;
-       dns_hdr_t *hp = (dns_hdr_t *) buf;
-       dns_hdr_t *anhp = (dns_hdr_t *) answer;
-#endif /* !_MINIX */
-       int terrno = ETIMEDOUT;
-       char junk[512];
-
-#ifdef DEBUG
-       if (_res.options & RES_DEBUG) {
-               printf("res_send()\n");
-               __p_query(buf);
-       }
-#endif /* DEBUG */
-       if (!(_res.options & RES_INIT))
-               if (res_init() == -1) {
-                       return(-1);
-               }
-
-       v_circuit = (_res.options & RES_USEVC) || buflen > PACKETSZ;
-#if !_MINIX
-       id = hp->id;
-#else /* _MINIX */
-       id = hp->dh_id;
-#endif /* !_MINIX */
-       /*
-        * Send request, RETRY times, or until successful
-        */
-       for (try = 0; try < _res.retry; try++) {
-          for (ns = 0; ns < _res.nscount; ns++) {
-#ifdef DEBUG
-#if !_MINIX
-               if (_res.options & RES_DEBUG)
-                       printf("Querying server (# %d) address = %s\n", ns+1,
-                             inet_ntoa(_res.nsaddr_list[ns].sin_addr));
-#else /* _MINIX */
-               if (_res.options & RES_DEBUG)
-                       printf("Querying server (# %d) address = %s\n", ns+1,
-                             inet_ntoa(_res.nsaddr_list[ns]));
-#endif /* !_MINIX */
-#endif /* DEBUG */
-       usevc:
-               if (v_circuit) {
-#if !_MINIX
-                       int truncated = 0;
-
-                       /*
-                        * Use virtual circuit;
-                        * at most one attempt per server.
-                        */
-                       try = _res.retry;
-                       if (s < 0) {
-                               s = socket(AF_INET, SOCK_STREAM, 0);
-                               if (s < 0) {
-                                       terrno = errno;
-#ifdef DEBUG
-                                       if (_res.options & RES_DEBUG)
-                                           perror("socket (vc) failed");
-#endif /* DEBUG */
-                                       continue;
-                               }
-                               if (connect(s,
-                                   (struct sockaddr *)&(_res.nsaddr_list[ns]),
-                                   sizeof(struct sockaddr)) < 0) {
-                                       terrno = errno;
-#ifdef DEBUG
-                                       if (_res.options & RES_DEBUG)
-                                           perror("connect failed");
-#endif /* DEBUG */
-                                       (void) close(s);
-                                       s = -1;
-                                       continue;
-                               }
-                       }
-                       /*
-                        * Send length & message
-                        */
-                       len = htons((u_short)buflen);
-                       iov[0].iov_base = (caddr_t)&len;
-                       iov[0].iov_len = sizeof(len);
-                       iov[1].iov_base = (char *)buf;
-                       iov[1].iov_len = buflen;
-                       if (writev(s, iov, 2) != sizeof(len) + buflen) {
-                               terrno = errno;
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       perror("write failed");
-#endif /* DEBUG */
-                               (void) close(s);
-                               s = -1;
-                               continue;
-                       }
-                       /*
-                        * Receive length & response
-                        */
-                       cp = answer;
-                       len = sizeof(short);
-                       while (len != 0 &&
-                           (n = read(s, (char *)cp, (int)len)) > 0) {
-                               cp += n;
-                               len -= n;
-                       }
-                       if (n <= 0) {
-                               terrno = errno;
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       perror("read failed");
-#endif /* DEBUG */
-                               (void) close(s);
-                               s = -1;
-                               /*
-                                * A long running process might get its TCP
-                                * connection reset if the remote server was
-                                * restarted.  Requery the server instead of
-                                * trying a new one.  When there is only one
-                                * server, this means that a query might work
-                                * instead of failing.  We only allow one reset
-                                * per query to prevent looping.
-                                */
-                               if (terrno == ECONNRESET && !connreset) {
-                                       connreset = 1;
-                                       ns--;
-                               }
-                               continue;
-                       }
-                       cp = answer;
-                       if ((resplen = ntohs(*(u_short *)cp)) > anslen) {
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       fprintf(stderr, "response truncated\n");
-#endif /* DEBUG */
-                               len = anslen;
-                               truncated = 1;
-                       } else
-                               len = resplen;
-                       while (len != 0 &&
-                          (n = read(s, (char *)cp, (int)len)) > 0) {
-                               cp += n;
-                               len -= n;
-                       }
-                       if (n <= 0) {
-                               terrno = errno;
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       perror("read failed");
-#endif /* DEBUG */
-                               (void) close(s);
-                               s = -1;
-                               continue;
-                       }
-                       if (truncated) {
-                               /*
-                                * Flush rest of answer
-                                * so connection stays in synch.
-                                */
-                               anhp->tc = 1;
-                               len = resplen - anslen;
-                               while (len != 0) {
-                                       n = (len > sizeof(junk) ?
-                                           sizeof(junk) : len);
-                                       if ((n = read(s, junk, n)) > 0)
-                                               len -= n;
-                                       else
-                                               break;
-                               }
-                       }
-#else /* _MINIX */
-                       int truncated = 0;
-                       int nbytes;
-
-                       /*
-                        * Use virtual circuit;
-                        * at most one attempt per server.
-                        */
-                       try = _res.retry;
-                       if (s < 0) 
-                       {
-                               s= tcp_connect(_res.nsaddr_list[ns],
-                                       _res.nsport_list[ns], &terrno);
-                               if (s == -1)
-                                       continue;
-                       }
-                       /*
-                        * Send length & message
-                        */
-                       len = htons((u_short)buflen);
-                       nbytes= tcpip_writeall(s, (char *)&len, 
-                               sizeof(len));
-                       if (nbytes != sizeof(len))
-                       {
-                               terrno= errno;
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       fprintf(stderr, "write failed: %s\n",
-                                       strerror(terrno));
-#endif /* DEBUG */
-                               close(s);
-                               s= -1;
-                               continue;
-                       }
-                       nbytes= tcpip_writeall(s, buf, buflen);
-                       if (nbytes != buflen)
-                       {
-                               terrno= errno;
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       fprintf(stderr, "write failed: %s\n",
-                                       strerror(terrno));
-#endif /* DEBUG */
-                               close(s);
-                               s= -1;
-                               continue;
-                       }
-                       /*
-                        * Receive length & response
-                        */
-                       cp = answer;
-                       len = sizeof(short);
-                       while (len != 0)
-                       {
-                               n = read(s, (char *)cp, (int)len);
-                               if (n <= 0)
-                                       break;
-                               cp += n;
-                               assert(len >= n);
-                               len -= n;
-                       }
-                       if (len) {
-                               terrno = errno;
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       fprintf(stderr, "read failed: %s\n",
-                                               strerror(terrno));
-#endif /* DEBUG */
-                               close(s);
-                               s= -1;
-                               /*
-                                * A long running process might get its TCP
-                                * connection reset if the remote server was
-                                * restarted.  Requery the server instead of
-                                * trying a new one.  When there is only one
-                                * server, this means that a query might work
-                                * instead of failing.  We only allow one reset
-                                * per query to prevent looping.
-                                */
-                               if (terrno == ECONNRESET && !connreset) {
-                                       connreset = 1;
-                                       ns--;
-                               }
-                               continue;
-                       }
-                       cp = answer;
-                       if ((resplen = ntohs(*(u_short *)cp)) > anslen) {
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       fprintf(stderr, "response truncated\n");
-#endif /* DEBUG */
-                               len = anslen;
-                               truncated = 1;
-                       } else
-                               len = resplen;
-                       while (len != 0)
-                       {
-                               n= read(s, (char *)cp, (int)len);
-                               if (n <= 0)
-                                       break;
-                               cp += n;
-                               assert(len >= n);
-                               len -= n;
-                       }
-                       if (len) {
-                               terrno = errno;
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       fprintf(stderr, "read failed: %s\n",
-                                               strerror(terrno));
-#endif /* DEBUG */
-                               close(s);
-                               s= -1;
-                               continue;
-                       }
-                       if (truncated) {
-                               /*
-                                * Flush rest of answer
-                                * so connection stays in synch.
-                                */
-                               anhp->dh_flag1 |= DHF_TC;
-                               len = resplen - anslen;
-                               while (len != 0) {
-                                       n = (len > sizeof(junk) ?
-                                           sizeof(junk) : len);
-                                       n = read(s, junk, n);
-                                       if (n <= 0)
-                                       {
-                                               assert(len >= n);
-                                               len -= n;
-                                       }
-                                       else
-                                               break;
-                               }
-                       }
-#endif /* _MINIX */
-               } else {
-#if !_MINIX
-                       /*
-                        * Use datagrams.
-                        */
-                       if (s < 0) {
-                               s = socket(AF_INET, SOCK_DGRAM, 0);
-                               if (s < 0) {
-                                       terrno = errno;
-#ifdef DEBUG
-                                       if (_res.options & RES_DEBUG)
-                                           perror("socket (dg) failed");
-#endif /* DEBUG */
-                                       continue;
-                               }
-                       }
-#if    BSD >= 43
-                       /*
-                        * I'm tired of answering this question, so:
-                        * On a 4.3BSD+ machine (client and server,
-                        * actually), sending to a nameserver datagram
-                        * port with no nameserver will cause an
-                        * ICMP port unreachable message to be returned.
-                        * If our datagram socket is "connected" to the
-                        * server, we get an ECONNREFUSED error on the next
-                        * socket operation, and select returns if the
-                        * error message is received.  We can thus detect
-                        * the absence of a nameserver without timing out.
-                        * If we have sent queries to at least two servers,
-                        * however, we don't want to remain connected,
-                        * as we wish to receive answers from the first
-                        * server to respond.
-                        */
-                       if (_res.nscount == 1 || (try == 0 && ns == 0)) {
-                               /*
-                                * Don't use connect if we might
-                                * still receive a response
-                                * from another server.
-                                */
-                               if (connected == 0) {
-                       if (connect(s, (struct sockaddr *)&_res.nsaddr_list[ns],
-                                           sizeof(struct sockaddr)) < 0) {
-#ifdef DEBUG
-                                               if (_res.options & RES_DEBUG)
-                                                       perror("connect");
-#endif /* DEBUG */
-                                               continue;
-                                       }
-                                       connected = 1;
-                               }
-                               if (send(s, buf, buflen, 0) != buflen) {
-#ifdef DEBUG
-                                       if (_res.options & RES_DEBUG)
-                                               perror("send");
-#endif /* DEBUG */
-                                       continue;
-                               }
-                       } else {
-                               /*
-                                * Disconnect if we want to listen
-                                * for responses from more than one server.
-                                */
-                               if (connected) {
-                                       (void) connect(s, &no_addr,
-                                           sizeof(no_addr));
-                                       connected = 0;
-                               }
-#endif /* BSD */
-                               if (sendto(s, buf, buflen, 0,
-                                   (struct sockaddr *)&_res.nsaddr_list[ns],
-                                   sizeof(struct sockaddr)) != buflen) {
-#ifdef DEBUG
-                                       if (_res.options & RES_DEBUG)
-                                               perror("sendto");
-#endif /* DEBUG */
-                                       continue;
-                               }
-#if    BSD >= 43
-                       }
-#endif /* BSD */
-
-                       /*
-                        * Wait for reply
-                        */
-                       timeout.tv_sec = (_res.retrans << try);
-                       if (try > 0)
-                               timeout.tv_sec /= _res.nscount;
-                       if (timeout.tv_sec <= 0)
-                               timeout.tv_sec = 1;
-                       timeout.tv_usec = 0;
-wait:
-                       FD_ZERO(&dsmask);
-                       FD_SET(s, &dsmask);
-                       n = select(s+1, &dsmask, (fd_set *)NULL,
-                               (fd_set *)NULL, &timeout);
-                       if (n < 0) {
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       perror("select");
-#endif /* DEBUG */
-                               continue;
-                       }
-                       if (n == 0) {
-                               /*
-                                * timeout
-                                */
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       printf("timeout\n");
-#endif /* DEBUG */
-#if BSD >= 43
-                               gotsomewhere = 1;
-#endif
-                               continue;
-                       }
-                       if ((resplen = recv(s, answer, anslen, 0)) <= 0) {
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       perror("recvfrom");
-#endif /* DEBUG */
-                               continue;
-                       }
-                       gotsomewhere = 1;
-                       if (id != anhp->id) {
-                               /*
-                                * response from old query, ignore it
-                                */
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG) {
-                                       printf("old answer:\n");
-                                       __p_query(answer);
-                               }
-#endif /* DEBUG */
-                               goto wait;
-                       }
-                       if (!(_res.options & RES_IGNTC) && anhp->tc) {
-                               /*
-                                * get rest of answer;
-                                * use TCP with same server.
-                                */
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       printf("truncated answer\n");
-#endif /* DEBUG */
-                               (void) close(s);
-                               s = -1;
-                               v_circuit = 1;
-                               goto usevc;
-                       }
-#else /* _MINIX */
-                       /*
-                        * Use datagrams.
-                        */
-                       if (s < 0) {
-                               s = udp_connect();
-                               if (s < 0) {
-                                       terrno = errno;
-#ifdef DEBUG
-                                       if (_res.options & RES_DEBUG)
-                                           perror("udp_connect failed");
-#endif /* DEBUG */
-                                       continue;
-                               }
-                       }
-                       if (udp_sendto(s, buf, buflen, _res.nsaddr_list[ns],
-                               _res.nsport_list[ns]) != buflen) {
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       perror("sendto");
-#endif /* DEBUG */
-                               continue;
-                       }
-
-                       /*
-                        * Wait for reply
-                        */
-                       timeout= (_res.retrans << try);
-                       if (try > 0)
-                               timeout /= _res.nscount;
-                       if (timeout <= 0)
-                               timeout= 1;
-wait:
-                       if ((resplen= udp_receive(s, answer, anslen, timeout))
-                               == -1)
-                       {
-                               if (errno == EINTR)
-                               {
-                               /*
-                                * timeout
-                                */
-#ifdef DEBUG
-                                       if (_res.options & RES_DEBUG)
-                                               printf("timeout\n");
-#endif /* DEBUG */
-                                       gotsomewhere = 1;
-                               }
-                               else
-                               {
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       perror("udp_receive");
-#endif /* DEBUG */
-                               }
-                               continue;
-                       }
-                       gotsomewhere = 1;
-                       if (id != anhp->dh_id) {
-                               /*
-                                * response from old query, ignore it
-                                */
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG) {
-                                       printf("old answer:\n");
-                                       __p_query(answer);
-                               }
-#endif /* DEBUG */
-                               goto wait;
-                       }
-                       if (!(_res.options & RES_IGNTC) &&
-                               (anhp->dh_flag1 & DHF_TC)) {
-                               /*
-                                * get rest of answer;
-                                * use TCP with same server.
-                                */
-#ifdef DEBUG
-                               if (_res.options & RES_DEBUG)
-                                       printf("truncated answer\n");
-#endif /* DEBUG */
-                               (void) close(s);
-                               s = -1;
-                               v_circuit = 1;
-                               goto usevc;
-                       }
-#endif /* !_MINIX */
-               }
-#ifdef DEBUG
-               if (_res.options & RES_DEBUG) {
-                       printf("got answer:\n");
-                       __p_query(answer);
-               }
-#endif /* DEBUG */
-               /*
-                * If using virtual circuits, we assume that the first server
-                * is preferred * over the rest (i.e. it is on the local
-                * machine) and only keep that one open.
-                * If we have temporarily opened a virtual circuit,
-                * or if we haven't been asked to keep a socket open,
-                * close the socket.
-                */
-               if ((v_circuit &&
-                   ((_res.options & RES_USEVC) == 0 || ns != 0)) ||
-                   (_res.options & RES_STAYOPEN) == 0) {
-                       (void) close(s);
-                       s = -1;
-               }
-               return (resplen);
-          }
-       }
-       if (s >= 0) {
-               (void) close(s);
-               s = -1;
-       }
-       if (v_circuit == 0)
-               if (gotsomewhere == 0)
-                       errno = ECONNREFUSED;   /* no nameservers found */
-               else
-                       errno = ETIMEDOUT;      /* no answer obtained */
-       else
-               errno = terrno;
-       return (-1);
-}
-
-/*
- * This routine is for closing the socket if a virtual circuit is used and
- * the program wants to close it.  This provides support for endhostent()
- * which expects to close the socket.
- *
- * This routine is not expected to be user visible.
- */
-void
-_res_close()
-{
-       if (s != -1) {
-               (void) close(s);
-               s = -1;
-       }
-}
-
-#if _MINIX
-static int tcp_connect(ipaddr_t host, tcpport_t port, int *terrno)
-{
-       char *dev_name;
-       int fd;
-       int error;
-       nwio_tcpconf_t tcpconf;
-       nwio_tcpcl_t clopt;
-
-       dev_name= getenv("TCP_DEVICE");
-       if (!dev_name)
-               dev_name= TCP_DEVICE;
-       fd= open(dev_name, O_RDWR);
-       if (fd == -1)
-       {
-               *terrno= errno;
-               return -1;
-       }
-       tcpconf.nwtc_flags= NWTC_EXCL | NWTC_LP_SEL | NWTC_SET_RA | NWTC_SET_RP;
-       tcpconf.nwtc_remaddr= host;
-       tcpconf.nwtc_remport= port;
-       error= ioctl(fd, NWIOSTCPCONF, &tcpconf);
-       if (error == -1)
-       {
-               *terrno= errno;
-               close(fd);
-               return -1;
-       }
-       clopt.nwtcl_flags= 0;
-       error= ioctl(fd, NWIOTCPCONN, &clopt);
-       if (error == -1)
-       {
-               *terrno= errno;
-               close(fd);
-               return -1;
-       }
-       *terrno= 0;
-       return fd;
-}
-
-static int tcpip_writeall(int fd, const char *buf, size_t siz)
-{
-       size_t siz_org;
-       int nbytes;
-
-       siz_org= siz;
-
-       while (siz)
-       {
-               nbytes= write(fd, buf, siz);
-               if (nbytes <= 0)
-                       return siz_org-siz;
-               assert(siz >= nbytes);
-               buf += nbytes;
-               siz -= nbytes;
-       }
-       return siz_org;
-}
-
-
-static int udp_connect()
-{
-       nwio_udpopt_t udpopt;
-       char *dev_name;
-       int fd, r, terrno;
-
-       dev_name= getenv("UDP_DEVICE");
-       if (!dev_name)
-               dev_name= UDP_DEVICE;
-       fd= open(dev_name, O_RDWR);
-       if (fd == -1)
-               return -1;
-
-       udpopt.nwuo_flags= NWUO_COPY | NWUO_LP_SEL | NWUO_EN_LOC |
-               NWUO_EN_BROAD | NWUO_RP_ANY | NWUO_RA_ANY | NWUO_RWDATALL |
-               NWUO_DI_IPOPT;
-       r= ioctl(fd, NWIOSUDPOPT, &udpopt);
-       if (r == -1)
-       {
-               terrno= errno;
-               close(fd);
-               errno= terrno;
-               return -1;
-       }
-       return fd;
-}
-
-static int udp_sendto(
-  int fd,
-  const char *buf,
-  unsigned buflen,
-  ipaddr_t addr,
-  udpport_t port
-)
-{
-       char *newbuf;
-       udp_io_hdr_t *udp_io_hdr;
-       int r, terrno;
-
-       newbuf= malloc(sizeof(*udp_io_hdr) + buflen);
-       if (newbuf == NULL)
-       {
-               errno= ENOMEM;
-               return -1;
-       }
-       udp_io_hdr= (udp_io_hdr_t *)newbuf;
-       udp_io_hdr->uih_dst_addr= addr;
-       udp_io_hdr->uih_dst_port= port;
-       udp_io_hdr->uih_ip_opt_len= 0;
-       udp_io_hdr->uih_data_len= buflen;
-
-       memcpy(newbuf + sizeof(*udp_io_hdr), buf, buflen);
-       r= write(fd, newbuf, sizeof(*udp_io_hdr) + buflen);
-       terrno= errno;
-       free(newbuf);
-       if (r >= sizeof(*udp_io_hdr))
-               r -= sizeof(*udp_io_hdr);
-       errno= terrno;
-       return r;
-}
-
-static int udp_receive(int fd, char *buf, unsigned buflen, time_t timeout)
-{
-       char *newbuf;
-       udp_io_hdr_t *udp_io_hdr;
-       int r, terrno;
-       fd_set readfds;
-       struct timeval timeval;
-       
-       /* allocate buffer for packet */
-       newbuf = malloc(sizeof(*udp_io_hdr) + buflen);
-       if (newbuf == NULL)
-       {
-               errno = ENOMEM;
-               return -1;
-       }
-       
-       /* only read if there is something to be read within timeout seconds */
-       FD_ZERO(&readfds);
-       FD_SET(fd, &readfds);
-       timeval.tv_sec = timeout;
-       timeval.tv_usec = 0;
-       r = select(fd + 1, &readfds, NULL, NULL, &timeval);
-       if (r >= 0 && !FD_ISSET(fd, &readfds))
-       {
-               errno = EINTR;
-               r = -1;
-       }
-
-       if (r >= 0)
-               r = read(fd, newbuf, sizeof(*udp_io_hdr) + buflen);
-
-       /* clean up in case of failure */
-       terrno = errno;
-       if (r < 0 || r <= sizeof(*udp_io_hdr))
-       {
-               if (r > 0)
-                       r = 0;
-
-               free(newbuf);
-               errno = terrno;
-               return r;
-       }
-
-       /* copy packet body to caller-provided buffer */
-       memcpy(buf, newbuf + sizeof(*udp_io_hdr), r - sizeof(*udp_io_hdr));
-       free(newbuf);
-
-       return r - sizeof(*udp_io_hdr);
-}
-
-#endif
diff --git a/lib/libc/ip/ruserok.c b/lib/libc/ip/ruserok.c
deleted file mode 100644 (file)
index f4d946d..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*     ruserok() - hosts.equiv and .rhosts check       Author: Kees J. Bot
- *                                                             25 May 2001
- *
- * Under Minix one can use IP addresses, CIDR network blocks, and hostnames
- * with wildcards in .rhosts files.  Only the iruserok() interface can be
- * used, and the IP address is reverse/forward crosschecked if a hostname
- * match is done.  Ruserok() is dead and buried.  The superuser parameter is
- * ignored, because it makes root too special.  Most users on Minix can be
- * root, so hosts.equiv would become useless if root can't use it.  Likewise
- * .rhosts isn't checked to be root or user owned and stuff, users have to
- * be careful themselves.
- */
-
-#include <sys/types.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <limits.h>
-#include <pwd.h>
-#include <net/hton.h>
-#include <net/gen/in.h>
-#include <net/gen/netdb.h>
-#include <net/gen/inet.h>
-#include <net/gen/socket.h>
-#include <net/gen/nameser.h>
-
-/* Odd global variable.  Seems to be used by lpd(8). */
-int    __check_rhosts_file = 1;
-
-static int cidr_aton(char *word, ipaddr_t *addr, ipaddr_t *mask)
-/* Try to interpret 'word' as an CIDR spec, e.g. 172.16.102.64/27. */
-{
-    char *slash;
-    int r;
-    static char S32[]= "/32";
-
-    if (*word == 0) return 0;
-
-    if ((slash= strchr(word, '/')) == NULL) slash= S32;
-
-    *slash= 0;
-    r= inet_aton(word, addr);
-    *slash++= '/';
-    if (!r) return 0;
-
-    r= 0;
-    while ((*slash - '0') < 10u) {
-       r= 10*r + (*slash++ - '0');
-       if (r > 32) return 0;
-    }
-    if (*slash != 0 || slash[-1] == '/') return 0;
-    *mask= htonl(r == 0 ? 0L : (0xFFFFFFFFUL >> (32 - r)) << (32 - r));
-    return 1;
-}
-
-static int match(const char *word, const char *pattern)
-/* Match word onto a pattern.  Pattern may contain the * wildcard. */
-{
-    unsigned cw, cp;
-#define lc(c, d) ((((c)= (d)) - 'A') <= ('Z' - 'A') ? (c)+= ('a' - 'A') : 0)
-
-    for (;;) {
-       (void) lc(cw, *word);
-       (void) lc(cp, *pattern);
-
-       if (cp == '*') {
-           do pattern++; while (*pattern == '*');
-           (void) lc(cp, *pattern);
-           if (cp == 0) return 1;
-
-           while (cw != 0) {
-               if (cw == cp && match(word+1, pattern+1)) return 1;
-               word++;
-               (void) lc(cw, *word);
-           }
-           return 0;
-       } else
-       if (cw == 0 || cp == 0) {
-           return cw == cp;
-       } else
-       if (cw == cp) {
-           word++;
-           pattern++;
-       } else {
-           return 0;
-       }
-    }
-#undef lc
-}
-
-static int get_name(ipaddr_t addr, char *name)
-/* Do a reverse lookup on the remote IP address followed by a forward lookup
- * to check if the host has that address.  Return true if this is so, return
- * either the true name or the ascii IP address in name[].
- */
-{
-    struct hostent *he;
-    int ok, i;
-
-    ok= 0;
-    he= gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
-    if (he != NULL) {
-       strcpy(name, he->h_name);
-       he= gethostbyname(name);
-
-       if (he != NULL && he->h_addrtype == AF_INET) {
-           for (i= 0; he->h_addr_list[i] != NULL; i++) {
-               if (memcmp(he->h_addr_list[i], &addr, sizeof(addr)) == 0) {
-                   ok= 1;
-                   break;
-               }
-           }
-       }
-    }
-    strcpy(name, ok ? he->h_name : inet_ntoa(addr));
-    return ok;
-}
-
-int __ivaliduser(FILE *hostf, unsigned long raddr,
-    const char *luser, const char *ruser)
-{
-    register char *p;
-    char buf[MAXDNAME + 128];          /* host + login */
-    char rhost[MAXDNAME];              /* remote host */
-    char *word[2];
-    int i, ch, got_name;
-    ipaddr_t addr, mask;
-
-    got_name = -1;
-
-    while (fgets(buf, sizeof(buf), hostf)) {
-       /* Skip lines that are too long. */
-       if (strchr(buf, '\n') == NULL) {
-           while ((ch = fgetc(hostf)) != '\n' && ch != EOF);
-           continue;
-       }
-       i = 0;
-       p = buf;
-       for (;;) {
-           while (isspace(*p)) *p++ = '\0';
-           if (*p == '\0') break;
-           if (i < 2) word[i] = p;
-           i++;
-           while (*p != '\0' && !isspace(*p)) p++;
-       }
-       if (i != 1 && i != 2) continue;
-       if (word[0][0] == '#') continue;
-       if (strcmp(ruser, i == 2 ? word[1] : luser) != 0) continue;
-
-       if (cidr_aton(word[0], &addr, &mask)) {
-           if (((raddr ^ addr) & mask) == 0) return (0);
-           continue;
-       }
-
-       if (got_name == -1) got_name = get_name(raddr, rhost);
-       if (match(rhost, word[0])) return (0);
-    }
-    return (-1);
-}
-
-int iruserok(unsigned long raddr, int superuser,
-    const char *ruser, const char *luser)
-{
-    /* Returns 0 if ok, -1 if not ok. */
-    struct passwd *pwd;
-    FILE *hostf;
-    int i, r;
-    char pbuf[PATH_MAX];
-
-    for (i = 0; i < 2; i++) {
-       if (i == 0) {
-           strcpy(pbuf, _PATH_HEQUIV);
-       } else {
-           if (!__check_rhosts_file) return (-1);
-           if ((pwd = getpwnam(luser)) == NULL) return (-1);
-           (void)strcpy(pbuf, pwd->pw_dir);
-           (void)strcat(pbuf, "/.rhosts");
-       }
-
-       if ((hostf = fopen(pbuf, "r")) == NULL)
-       {
-               if (errno == ENOENT)
-                       continue;
-               return (-1);
-       }
-
-       r = __ivaliduser(hostf, raddr, luser, ruser);
-       (void)fclose(hostf);
-       if (r == 0) return (0);
-    }
-    return (-1);
-}
diff --git a/lib/libc/ip/send.c b/lib/libc/ip/send.c
deleted file mode 100644 (file)
index 3bba66b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdlib.h>
-#include <sys/socket.h>
-
-ssize_t send(int socket, const void *buffer, size_t length, int flags)
-{
-       return sendto(socket, buffer, length, flags, NULL, 0);
-}
diff --git a/lib/libc/ip/sendmsg.c b/lib/libc/ip/sendmsg.c
deleted file mode 100644 (file)
index dc1ebf6..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-#undef NDEBUG
-
-#include <errno.h>
-#include <net/ioctl.h>
-#include <stdlib.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <sys/un.h>
-
-#define DEBUG 0
-
-static ssize_t _uds_sendmsg_conn(int socket, const struct msghdr *msg, 
-       int flags);
-static ssize_t _uds_sendmsg_dgram(int socket, const struct msghdr *msg, 
-       int flags);
-
-ssize_t sendmsg(int socket, const struct msghdr *msg, int flags)
-{
-       int r;
-       int uds_sotype;
-
-       if (msg == NULL) {
-               errno= EFAULT;
-               return -1;
-       }
-
-       r= ioctl(socket, NWIOGUDSSOTYPE, &uds_sotype);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL)) {
-               if (r == -1) {
-                       return r;
-               }
-
-               if (uds_sotype == SOCK_DGRAM) {
-                       return _uds_sendmsg_dgram(socket, msg, flags);
-               } else {
-                       return _uds_sendmsg_conn(socket, msg, flags);
-               }
-
-       }
-
-#if DEBUG
-       fprintf(stderr, "sendmsg: not implemented for fd %d\n", socket);
-#endif
-
-       errno= ENOSYS;
-       return -1;
-}
-
-static ssize_t _uds_sendmsg_conn(int socket, const struct msghdr *msg, 
-       int flags)
-{
-       struct msg_control msg_ctrl;
-       int r;
-
-       if (flags != 0) {
-#if DEBUG
-               fprintf(stderr, "sendmsg(uds): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-
-       }
-
-       /* grab the control data */
-       memset(&msg_ctrl, '\0', sizeof(struct msg_control));
-       if (msg->msg_controllen > MSG_CONTROL_MAX) {
-               errno = ENOMEM;
-               return -1;
-       } else if (msg->msg_controllen > 0) {
-               memcpy(&msg_ctrl.msg_control, msg->msg_control,
-                                                       msg->msg_controllen);
-       }
-       msg_ctrl.msg_controllen = msg->msg_controllen;
-
-       /* send the control data to PFS */
-       r= ioctl(socket, NWIOSUDSCTRL, (void *) &msg_ctrl);
-       if (r == -1) {
-               return r;
-       }
-
-       /* Silently ignore destination, if given. */
-
-       return writev(socket, msg->msg_iov, msg->msg_iovlen);
-}
-
-static ssize_t _uds_sendmsg_dgram(int socket, const struct msghdr *msg, 
-       int flags)
-{
-       struct msg_control msg_ctrl;
-       struct sockaddr_un *dest_addr;
-       int i, r;
-
-       if (flags != 0) {
-#if DEBUG
-               fprintf(stderr, "sendmsg(uds): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-
-       }
-
-       dest_addr = msg->msg_name;
-       if (dest_addr == NULL) {
-               errno= EFAULT;
-               return -1;
-       }
-
-       /* set the target address */
-       r= ioctl(socket, NWIOSUDSTADDR, (void *) dest_addr);
-       if (r == -1) {
-               return r;
-       }
-
-       /* grab the control data */
-       memset(&msg_ctrl, '\0', sizeof(struct msg_control));
-       if (msg->msg_controllen > MSG_CONTROL_MAX) {
-               errno = ENOMEM;
-               return -1;
-       } else if (msg->msg_controllen > 0) {
-               memcpy(&msg_ctrl.msg_control, msg->msg_control,
-                                                       msg->msg_controllen);
-       }
-       msg_ctrl.msg_controllen = msg->msg_controllen;
-
-       /* send the control data to PFS */
-       r= ioctl(socket, NWIOSUDSCTRL, (void *) &msg_ctrl);
-       if (r == -1) {
-               return r;
-       }
-
-       /* do the send */
-       return writev(socket, msg->msg_iov, msg->msg_iovlen);
-}
diff --git a/lib/libc/ip/sendto.c b/lib/libc/ip/sendto.c
deleted file mode 100644 (file)
index eaffc56..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-#undef NDEBUG
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_hdr.h>
-#include <net/gen/udp_io.h>
-
-#define DEBUG 0
-
-static ssize_t _tcp_sendto(int socket, const void *message, size_t length,
-       int flags, const struct sockaddr *dest_addr, socklen_t dest_len);
-static ssize_t _udp_sendto(int socket, const void *message, size_t length,
-       int flags, const struct sockaddr *dest_addr, socklen_t dest_len,
-       nwio_udpopt_t *udpoptp);
-static ssize_t _uds_sendto_conn(int socket, const void *message, size_t length,
-       int flags, const struct sockaddr *dest_addr, socklen_t dest_len);
-static ssize_t _uds_sendto_dgram(int socket, const void *message, size_t length,
-       int flags, const struct sockaddr *dest_addr, socklen_t dest_len);
-
-ssize_t sendto(int socket, const void *message, size_t length, int flags,
-       const struct sockaddr *dest_addr, socklen_t dest_len)
-{
-       int r;
-       nwio_tcpopt_t tcpopt;
-       nwio_udpopt_t udpopt;
-       struct sockaddr_un uds_addr;
-       int uds_sotype = -1;
-
-       r= ioctl(socket, NWIOGTCPOPT, &tcpopt);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-                       return r;
-               return _tcp_sendto(socket, message, length, flags,
-                       dest_addr, dest_len);
-       }
-
-       r= ioctl(socket, NWIOGUDPOPT, &udpopt);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-                       return r;
-               return _udp_sendto(socket, message, length, flags,
-                       dest_addr, dest_len, &udpopt);
-       }
-
-       r= ioctl(socket, NWIOGUDSSOTYPE, &uds_sotype);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1) {
-                       return r;
-               }
-
-               if (uds_sotype == SOCK_DGRAM) {
-
-                       return _uds_sendto_dgram(socket, message, 
-                               length, flags,dest_addr, dest_len);
-               } else {
-
-                       return _uds_sendto_conn(socket, message,
-                               length, flags, dest_addr, dest_len);
-               }
-       }
-
-#if DEBUG
-       fprintf(stderr, "sendto: not implemented for fd %d\n", socket);
-#endif
-       errno= ENOSYS;
-       return -1;
-}
-
-static ssize_t _tcp_sendto(int socket, const void *message, size_t length,
-       int flags, const struct sockaddr *dest_addr, socklen_t dest_len)
-{
-
-       if (flags != 0) {
-#if DEBUG
-               fprintf(stderr, "sendto(tcp): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-       }
-
-       /* Silently ignore destination, if given. */
-
-       return write(socket, message, length);
-}
-
-static ssize_t _udp_sendto(int socket, const void *message, size_t length,
-       int flags, const struct sockaddr *dest_addr, socklen_t dest_len,
-       nwio_udpopt_t *udpoptp)
-{
-       int r, t_errno;
-       size_t buflen;
-       void *buf;
-       struct sockaddr_in *sinp;
-       udp_io_hdr_t *io_hdrp;
-
-       if (flags)
-       {
-#if DEBUG
-               fprintf(stderr, "sendto(udp): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-       }
-
-       if (udpoptp->nwuo_flags & NWUO_RWDATONLY)
-               return write(socket, message, length);
-
-       if ((udpoptp->nwuo_flags & NWUO_RP_ANY) ||
-               (udpoptp->nwuo_flags & NWUO_RA_ANY))
-       {
-               if (!dest_addr)
-               {
-                       errno= ENOTCONN;
-                       return -1;
-               }
-
-               /* Check destination address */
-               if (dest_len < sizeof(*sinp))
-               {
-                       errno= EINVAL;
-                       return -1;
-               }
-               sinp= (struct sockaddr_in *)dest_addr;
-               if (sinp->sin_family != AF_INET)
-               {
-                       errno= EAFNOSUPPORT;
-                       return -1;
-               }
-       }
-
-       buflen= sizeof(*io_hdrp) + length;
-       if (buflen < length)
-       {       
-               /* Overflow */
-               errno= EMSGSIZE;
-               return -1;
-       }
-       buf= malloc(buflen);
-       if (buf == NULL)
-               return -1;
-
-       io_hdrp= buf;
-       io_hdrp->uih_src_addr= 0;       /* Unused */
-       io_hdrp->uih_src_port= 0;       /* Will cause error if NWUO_LP_ANY */
-       if (udpoptp->nwuo_flags & NWUO_RA_ANY)
-               io_hdrp->uih_dst_addr= sinp->sin_addr.s_addr;
-       else
-               io_hdrp->uih_dst_addr= 0;
-       if (udpoptp->nwuo_flags & NWUO_RP_ANY)
-               io_hdrp->uih_dst_port= sinp->sin_port;
-       else
-               io_hdrp->uih_dst_port= 0;
-       io_hdrp->uih_ip_opt_len= 0;
-       io_hdrp->uih_data_len= 0;
-
-       memcpy(&io_hdrp[1], message, length);
-       r= write(socket, buf, buflen);
-       if (r == -1)
-       {
-               t_errno= errno;
-               free(buf);
-               errno= t_errno;
-               return -1;
-       }
-       assert(r == buflen);
-       free(buf);
-       return length;
-}
-
-static ssize_t _uds_sendto_conn(int socket, const void *message, size_t length,
-       int flags, const struct sockaddr *dest_addr, socklen_t dest_len)
-{
-
-       /* for connection oriented unix domain sockets (SOCK_STREAM / 
-        * SOCK_SEQPACKET)
-        */
-
-       if (flags != 0) {
-#if DEBUG
-               fprintf(stderr, "sendto(uds): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-       }
-
-       /* Silently ignore destination, if given. */
-
-       return write(socket, message, length);
-}
-
-static ssize_t _uds_sendto_dgram(int socket, const void *message, size_t length,
-       int flags, const struct sockaddr *dest_addr, socklen_t dest_len)
-{
-       int r;
-
-       /* for connectionless unix domain sockets (SOCK_DGRAM) */
-
-       if (flags != 0) {
-#if DEBUG
-               fprintf(stderr, "sendto(uds): flags not implemented\n");
-#endif
-               errno= ENOSYS;
-               return -1;
-       }
-
-       if (dest_addr == NULL) {
-               errno = EFAULT;
-               return -1;
-       }
-
-       /* set the target address */
-       r= ioctl(socket, NWIOSUDSTADDR, (void *) dest_addr);
-       if (r == -1) {
-               return r;
-       }
-
-       /* do the send */
-       return write(socket, message, length);
-}
diff --git a/lib/libc/ip/servxcheck.c b/lib/libc/ip/servxcheck.c
deleted file mode 100644 (file)
index dc10dcd..0000000
+++ /dev/null
@@ -1,283 +0,0 @@
-/*     servxcheck() - Service access check.            Author: Kees J. Bot
- *                                                             8 Jan 1997
- */
-#define nil 0
-#define ioctl _ioctl
-#define open _open
-#define write _write
-#define close _close
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <syslog.h>
-#include <errno.h>
-#include <string.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include <net/hton.h>
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/inet.h>
-#include <net/gen/socket.h>
-#include <net/gen/netdb.h>
-
-/* Default service access file. */
-static const char *path_servacces = _PATH_SERVACCES;
-
-#define WLEN   256
-
-static int getword(FILE *fp, char *word)
-/* Read a word from the file open by 'fp', skip whitespace and comments.
- * Colon and semicolon are returned as a one character "word".  Returns
- * word[0] or EOF.
- */
-{
-    int c;
-    char *pw;
-    int wc;
-
-    wc= 0;
-    for (;;) {
-       if ((c= getc(fp)) == EOF) return EOF;
-       if (c == '#') { wc= 1; continue; }
-       if (c == '\n') { wc= 0; continue; }
-       if (wc) continue;
-       if (c <= ' ') continue;
-       break;
-    }
-
-    pw= word;
-    if (c == ':' || c == ';') {
-           *pw++ = c;
-    } else {
-       do {
-           if (pw < word + WLEN-1) *pw++ = c;
-           c= getc(fp);
-       } while (c != EOF && c > ' ' && c != ':' && c != ';');
-       if (c != EOF) ungetc(c, fp);
-    }
-    *pw= 0;
-    return word[0];
-}
-
-static int netspec(char *word, ipaddr_t *addr, ipaddr_t *mask)
-/* Try to interpret 'word' as an network spec, e.g. 172.16.102.64/27. */
-{
-    char *slash;
-    int r;
-    static char S32[]= "/32";
-
-    if (*word == 0) return 0;
-
-    if ((slash= strchr(word, '/')) == NULL) slash= S32;
-
-    *slash= 0;
-    r= inet_aton(word, addr);
-    *slash++= '/';
-    if (!r) return 0;
-
-    r= 0;
-    while ((*slash - '0') < 10u) {
-       r= 10*r + (*slash++ - '0');
-       if (r > 32) return 0;
-    }
-    if (*slash != 0 || slash[-1] == '/') return 0;
-    *mask= htonl(r == 0 ? 0L : (0xFFFFFFFFUL >> (32 - r)) << (32 - r));
-    return 1;
-}
-
-static int match(const char *word, const char *pattern)
-/* Match word onto a pattern.  Pattern may contain the * wildcard. */
-{
-    unsigned cw, cp;
-#define lc(c, d) ((((c)= (d)) - 'A') <= ('Z' - 'A') ? (c)+= ('a' - 'A') : 0)
-
-    for (;;) {
-       (void) lc(cw, *word);
-       (void) lc(cp, *pattern);
-
-       if (cp == '*') {
-           do pattern++; while (*pattern == '*');
-           (void) lc(cp, *pattern);
-           if (cp == 0) return 1;
-
-           while (cw != 0) {
-               if (cw == cp && match(word+1, pattern+1)) return 1;
-               word++;
-               (void) lc(cw, *word);
-           }
-           return 0;
-       } else
-       if (cw == 0 || cp == 0) {
-           return cw == cp;
-       } else
-       if (cw == cp) {
-           word++;
-           pattern++;
-       } else {
-           return 0;
-       }
-    }
-#undef lc
-}
-
-static int get_name(ipaddr_t addr, char *name)
-/* Do a reverse lookup on the remote IP address followed by a forward lookup
- * to check if the host has that address.  Return true if this is so, return
- * either the true name or the ascii IP address in name[].
- */
-{
-    struct hostent *he;
-    int i;
-
-    he= gethostbyaddr((char *) &addr, sizeof(addr), AF_INET);
-    if (he != NULL) {
-       strcpy(name, he->h_name);
-       he= gethostbyname(name);
-
-       if (he != NULL && he->h_addrtype == AF_INET) {
-           for (i= 0; he->h_addr_list[i] != NULL; i++) {
-               if (memcmp(he->h_addr_list[i], &addr, sizeof(addr)) == 0) {
-                   strcpy(name, he->h_name);
-                   return 1;
-               }
-           }
-       }
-    }
-    strcpy(name, inet_ntoa(addr));
-    return 0;
-}
-
-/* "state" and "log" flags, made to be bitwise comparable. */
-#define DEFFAIL                 0x01
-#define FAIL           (0x02 | DEFFAIL)
-#define PASS            0x04
-
-int servxcheck(ipaddr_t peer, const char *service,
-               void (*logf)(int pass, const char *name))
-{
-    FILE *fp;
-    char word[WLEN];
-    char name[WLEN];
-    int c;
-    int got_name, slist, seen, explicit, state, log;
-    ipaddr_t addr, mask;
-
-    /* Localhost? */
-    if ((peer & HTONL(0xFF000000)) == HTONL(0x7F000000)) return 1;
-
-    if ((fp= fopen(path_servacces, "r")) == nil) {
-       /* Succeed on error, fail if simply nonexistent. */
-       return (errno != ENOENT);
-    }
-
-    slist= 1;          /* Services list (before the colon.) */
-    seen= 0;           /* Given service not yet seen. */
-    explicit= 0;       /* Service mentioned explicitly. */
-    got_name= -1;      /* No reverse lookup done yet. */
-    log= FAIL;         /* By default log failures only. */
-    state= DEFFAIL;    /* Access denied until we know better. */
-
-    while ((c= getword(fp, word)) != EOF) {
-       if (c == ':') {
-           slist= 0;           /* Switch to access list. */
-       } else
-       if (c == ';') {
-           slist= 1;           /* Back to list of services. */
-           seen= 0;
-       } else
-       if (slist) {
-           /* Traverse services list. */
-
-           if (match(service, word)) {
-               /* Service has been spotted! */
-               if (match(word, service)) {
-                   /* Service mentioned without wildcards. */
-                   seen= explicit= 1;
-               } else {
-                   /* Matched by a wildcard. */
-                   if (!explicit) seen= 1;
-               }
-           }
-       } else {
-           /* Traverse access list. */
-
-           if (c == 'l' && strcmp(word, "log") == 0) {
-               if (seen) {
-                   /* Log failures and successes. */
-                   log= FAIL|PASS;
-               }
-               continue;
-           }
-
-           if (c != '-' && c != '+') {
-               if (logf == nil) {
-                   syslog(LOG_ERR, "%s: strange check word '%s'\n",
-                       path_servacces, word);
-               }
-               continue;
-           }
-
-           if (seen) {
-               if (state == DEFFAIL) {
-                   /* First check determines the default. */
-                   state= c == '+' ? FAIL : PASS;
-               }
-
-               if ((state == PASS) == (c == '+')) {
-                   /* This check won't change state. */
-               } else
-               if (word[1] == 0) {
-                   /* Lone + or - allows all or none. */
-                   state= c == '-' ? FAIL : PASS;
-               } else
-               if (netspec(word+1, &addr, &mask)) {
-                   /* Remote host is on the specified network? */
-                   if (((peer ^ addr) & mask) == 0) {
-                       state= c == '-' ? FAIL : PASS;
-                   }
-               } else {
-                   /* Name check. */
-                   if (got_name == -1) {
-                       got_name= get_name(peer, name);
-                   }
-
-                   /* Remote host name matches the word? */
-                   if (!got_name) {
-                       state= FAIL;
-                   } else
-                   if (match(name, word+1)) {
-                       state= c == '-' ? FAIL : PASS;
-                   }
-               }
-           }
-       }
-    }
-    fclose(fp);
-
-    if ((log & state) != 0) {
-       /* Log the result of the check. */
-       if (got_name == -1) (void) get_name(peer, name);
-
-       if (logf != nil) {
-           (*logf)(state == PASS, name);
-       } else {
-           syslog(LOG_NOTICE, "service '%s' %s to %s\n",
-               service, state == PASS ? "granted" : "denied", name);
-       }
-    }
-    return state == PASS;
-}
-
-char *servxfile(const char *file)
-/* Specify a file to use for the access checks other than the default.  Return
- * the old path.
- */
-{
-    const char *oldpath= path_servacces;
-    path_servacces= file;
-    return (char *) oldpath;   /* (avoid const poisoning) */
-}
diff --git a/lib/libc/ip/sethostent.c b/lib/libc/ip/sethostent.c
deleted file mode 100644 (file)
index 5ed5ede..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*     $OpenBSD: sethostent.c,v 1.1 1997/03/12 10:42:11 downsj Exp $   */
-
-/*
- * Copyright (c) 1985, 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)sethostent.c       8.1 (Berkeley) 6/4/93";
-static char rcsid[] = "$From: sethostent.c,v 8.5 1996/09/28 06:51:07 vixie Exp $";
-#else
-static char rcsid[] = "$OpenBSD: sethostent.c,v 1.1 1997/03/12 10:42:11 downsj Exp $";
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef notyet
-#include <sys/types.h>
-#include <sys/param.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <netdb.h>
-#include <resolv.h>
-#else
-#include <sys/types.h>
-#include <net/gen/in.h>
-#include <net/gen/nameser.h>
-#include <net/gen/netdb.h>
-#include <net/gen/resolv.h>
-#endif
-
-void
-sethostent(stayopen)
-       int stayopen;
-{
-       if ((_res.options & RES_INIT) == 0 && res_init() == -1)
-               return;
-       if (stayopen)
-       {
-               _res.options |= RES_STAYOPEN;
-#ifdef __minix_vmd
-               _res.options |= RES_USEVC;
-#endif
-       }
-}
-
-void
-endhostent()
-{
-       _res.options &= ~(RES_STAYOPEN | RES_USEVC);
-       _res_close();
-}
-
-/*
- * $PchId: sethostent.c,v 1.2 2000/04/01 18:27:16 philip Exp $
- */
diff --git a/lib/libc/ip/setsockopt.c b/lib/libc/ip/setsockopt.c
deleted file mode 100644 (file)
index 4e204a4..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <netinet/tcp.h>
-
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_io.h>
-
-#define DEBUG 0
-
-static int _tcp_setsockopt(int socket, int level, int option_name,
-       const void *option_value, socklen_t option_len);
-
-static int _udp_setsockopt(int socket, int level, int option_name,
-       const void *option_value, socklen_t option_len);
-
-static int _uds_setsockopt(int socket, int level, int option_name,
-       const void *option_value, socklen_t option_len);
-
-int setsockopt(int socket, int level, int option_name,
-        const void *option_value, socklen_t option_len)
-{
-       int r;
-       nwio_tcpopt_t tcpopt;
-       nwio_udpopt_t udpopt;
-       struct sockaddr_un uds_addr;
-
-       r= ioctl(socket, NWIOGTCPOPT, &tcpopt);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _tcp_setsockopt(socket, level, option_name,
-                       option_value, option_len);
-       }
-
-       r= ioctl(socket, NWIOGUDPOPT, &udpopt);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _udp_setsockopt(socket, level, option_name,
-                       option_value, option_len);
-       }
-
-       r= ioctl(socket, NWIOGUDSADDR, &uds_addr);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _uds_setsockopt(socket, level, option_name,
-                       option_value, option_len);
-       }
-
-
-#if DEBUG
-       fprintf(stderr, "setsockopt: not implemented for fd %d\n", socket);
-#endif
-       errno= ENOTSOCK;
-       return -1;
-}
-
-static int _tcp_setsockopt(int socket, int level, int option_name,
-       const void *option_value, socklen_t option_len)
-{
-       int i;
-
-       if (level == SOL_SOCKET && option_name == SO_REUSEADDR)
-       {
-               if (option_len != sizeof(i))
-               {
-                       errno= EINVAL;
-                       return -1;
-               }
-               i= *(int *)option_value;
-               if (!i)
-               {
-                       /* At the moment there is no way to turn off 
-                        * reusing addresses.
-                        */
-                       errno= ENOSYS;
-                       return -1;
-               }
-               return 0;
-       }
-       if (level == SOL_SOCKET && option_name == SO_KEEPALIVE)
-       {
-               if (option_len != sizeof(i))
-               {
-                       errno= EINVAL;
-                       return -1;
-               }
-               i= *(int *)option_value;
-               if (!i)
-               {
-                       /* At the moment there is no way to turn off 
-                        * keepalives.
-                        */
-                       errno= ENOSYS;
-                       return -1;
-               }
-               return 0;
-       }
-       if (level == SOL_SOCKET && option_name == SO_RCVBUF)
-       {
-               if (option_len != sizeof(i))
-               {
-                       errno= EINVAL;
-                       return -1;
-               }
-               i= *(int *)option_value;
-               if (i > 32*1024)
-               {
-                       /* The receive buffer is limited to 32K at the moment.
-                        */
-                       errno= ENOSYS;
-                       return -1;
-               }
-               /* There is no way to reduce the receive buffer, do we have to
-                * let this call fail for smaller buffers?
-                */
-               return 0;
-       }
-       if (level == SOL_SOCKET && option_name == SO_SNDBUF)
-       {
-               if (option_len != sizeof(i))
-               {
-                       errno= EINVAL;
-                       return -1;
-               }
-               i= *(int *)option_value;
-               if (i > 32*1024)
-               {
-                       /* The send buffer is limited to 32K at the moment.
-                        */
-                       errno= ENOSYS;
-                       return -1;
-               }
-               /* There is no way to reduce the send buffer, do we have to
-                * let this call fail for smaller buffers?
-                */
-               return 0;
-       }
-       if (level == IPPROTO_TCP && option_name == TCP_NODELAY)
-       {
-               if (option_len != sizeof(i))
-               {
-                       errno= EINVAL;
-                       return -1;
-               }
-               i= *(int *)option_value;
-               if (i)
-               {
-                       /* At the moment there is no way to turn on 
-                        * nodelay.
-                        */
-                       errno= ENOSYS;
-                       return -1;
-               }
-               return 0;
-       }
-#if DEBUG
-       fprintf(stderr, "_tcp_setsocketopt: level %d, name %d\n",
-               level, option_name);
-#endif
-
-       errno= ENOSYS;
-       return -1;
-}
-
-static int _udp_setsockopt(int socket, int level, int option_name,
-       const void *option_value, socklen_t option_len)
-{
-#if DEBUG
-       fprintf(stderr, "_udp_setsocketopt: level %d, name %d\n",
-               level, option_name);
-#endif
-
-       errno= ENOSYS;
-       return -1;
-}
-
-
-static int _uds_setsockopt(int socket, int level, int option_name,
-       const void *option_value, socklen_t option_len)
-{
-       int i;
-       size_t size;
-
-       if (level == SOL_SOCKET && option_name == SO_RCVBUF)
-       {
-               if (option_len != sizeof(size))
-               {
-                       errno= EINVAL;
-                       return -1;
-               }
-               size= *(size_t *)option_value;
-               return ioctl(socket, NWIOSUDSRCVBUF, &size);
-       }
-
-       if (level == SOL_SOCKET && option_name == SO_SNDBUF)
-       {
-               if (option_len != sizeof(size))
-               {
-                       errno= EINVAL;
-                       return -1;
-               }
-               size= *(size_t *)option_value;
-               return ioctl(socket, NWIOSUDSSNDBUF, &size);
-       }
-
-       if (level == SOL_SOCKET && option_name == SO_REUSEADDR)
-       {
-               if (option_len != sizeof(i))
-               {
-                       errno= EINVAL;
-                       return -1;
-               }
-               i= *(int *)option_value;
-               if (!i)
-               {
-                       /* At the moment there is no way to turn off 
-                        * reusing addresses.
-                        */
-                       errno= ENOSYS;
-                       return -1;
-               }
-               return 0;
-       }
-
-       if (level == SOL_SOCKET && option_name == SO_PASSCRED)
-       {
-               if (option_len != sizeof(i))
-               {
-                       errno= EINVAL;
-                       return -1;
-               }
-               i= *(int *)option_value;
-               if (!i)
-               {
-                       /* credentials can always be received. */
-                       errno= ENOSYS;
-                       return -1;
-               }
-               return 0;
-       }
-
-#if DEBUG
-       fprintf(stderr, "_uds_setsocketopt: level %d, name %d\n",
-               level, option_name);
-#endif
-
-       errno= ENOSYS;
-       return -1;
-}
diff --git a/lib/libc/ip/shutdown.c b/lib/libc/ip/shutdown.c
deleted file mode 100644 (file)
index b2df69b..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include <net/gen/in.h>
-#include <net/gen/tcp.h>
-#include <net/gen/tcp_io.h>
-
-#define DEBUG 0
-
-static int _tcp_shutdown(int socket, int how);
-static int _uds_shutdown(int socket, int how);
-
-int shutdown(int socket, int how)
-{
-       int r;
-       struct sockaddr_un uds_addr;
-       nwio_tcpconf_t tcpconf;
-
-       r= ioctl(socket, NWIOGTCPCONF, &tcpconf);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _tcp_shutdown(socket, how);
-       }
-
-       r= ioctl(socket, NWIOGUDSADDR, &uds_addr);
-       if (r != -1 || (errno != ENOTTY && errno != EBADIOCTL))
-       {
-               if (r == -1)
-               {
-                       /* Bad file descriptor */
-                       return -1;
-               }
-               return _uds_shutdown(socket, how);
-       }
-
-#if DEBUG
-       fprintf(stderr, "shutdown: not implemented for fd %d\n", socket);
-#endif
-       errno= ENOSYS;
-       return -1;
-}
-
-static int _tcp_shutdown(int socket, int how)
-{
-       int r;
-
-       if (how == SHUT_WR || how == SHUT_RDWR)
-       {
-               r= ioctl(socket, NWIOTCPSHUTDOWN, NULL);
-               if (r == -1)
-                       return -1;
-               if (how == SHUT_WR)
-                       return 0;
-       }
-
-       /* We can't shutdown the read side of the socket. */
-       errno= ENOSYS;
-       return -1;
-}
-
-static int _uds_shutdown(int socket, int how)
-{
-       return ioctl(socket, NWIOSUDSSHUT, &how);
-}
diff --git a/lib/libc/ip/socket.c b/lib/libc/ip/socket.c
deleted file mode 100644 (file)
index 0c53aaa..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/socket.h>
-
-#include <net/netlib.h>
-#include <net/ioctl.h>
-#include <netinet/in.h>
-
-#define DEBUG 0
-
-static int _tcp_socket(int protocol);
-static int _udp_socket(int protocol);
-static int _uds_socket(int type, int protocol);
-
-int socket(int domain, int type, int protocol)
-{
-#if DEBUG
-       fprintf(stderr, "socket: domain %d, type %d, protocol %d\n",
-               domain, type, protocol);
-#endif
-       if (domain != AF_INET && domain != AF_UNIX)
-       {
-#if DEBUG
-               fprintf(stderr, "socket: bad domain %d\n", domain);
-#endif
-               errno= EAFNOSUPPORT;
-               return -1;
-       }
-
-       if (domain == AF_UNIX && (type == SOCK_STREAM ||
-                               type == SOCK_DGRAM || type == SOCK_SEQPACKET))
-               return _uds_socket(type, protocol);
-
-       if (domain == AF_INET && type == SOCK_STREAM)
-               return _tcp_socket(protocol);
-
-       if (domain == AF_INET && type == SOCK_DGRAM)
-               return _udp_socket(protocol);
-
-#if DEBUG
-       fprintf(stderr, "socket: nothing for domain %d, type %d, protocol %d\n",
-               domain, type, protocol);
-#endif
-       errno= EPROTOTYPE;
-       return -1;
-}
-
-static int _tcp_socket(int protocol)
-{
-       int fd;
-       if (protocol != 0 && protocol != IPPROTO_TCP)
-       {
-#if DEBUG
-               fprintf(stderr, "socket(tcp): bad protocol %d\n", protocol);
-#endif
-               errno= EPROTONOSUPPORT;
-               return -1;
-       }
-       fd= open(TCP_DEVICE, O_RDWR);
-       return fd;
-}
-
-static int _udp_socket(int protocol)
-{
-       int r, fd, t_errno;
-       struct sockaddr_in sin;
-
-       if (protocol != 0 && protocol != IPPROTO_UDP)
-       {
-#if DEBUG
-               fprintf(stderr, "socket(udp): bad protocol %d\n", protocol);
-#endif
-               errno= EPROTONOSUPPORT;
-               return -1;
-       }
-       fd= open(UDP_DEVICE, O_RDWR);
-       if (fd == -1)
-               return fd;
-
-       /* Bind is implict for UDP sockets? */
-       sin.sin_family= AF_INET;
-       sin.sin_addr.s_addr= INADDR_ANY;
-       sin.sin_port= 0;
-       r= bind(fd, (struct sockaddr *)&sin, sizeof(sin));
-       if (r != 0)
-       {
-               t_errno= errno;
-               close(fd);
-               errno= t_errno;
-               return -1;
-       }
-       return fd;
-}
-
-static int _uds_socket(int type, int protocol)
-{
-       int fd, r;
-       if (protocol != 0)
-       {
-#if DEBUG
-               fprintf(stderr, "socket(uds): bad protocol %d\n", protocol);
-#endif
-               errno= EPROTONOSUPPORT;
-               return -1;
-       }
-
-       fd= open(UDS_DEVICE, O_RDWR);
-       if (fd == -1) {
-               return fd;
-       }
-
-       /* set the type for the socket via ioctl (SOCK_DGRAM, 
-        * SOCK_STREAM, SOCK_SEQPACKET, etc)
-        */
-       r= ioctl(fd, NWIOSUDSTYPE, &type);
-       if (r == -1) {
-               int ioctl_errno;
-
-               /* if that failed rollback socket creation */
-               ioctl_errno= errno;
-               close(fd);
-
-               /* return the error thrown by the call to ioctl */
-               errno= ioctl_errno;
-               return -1;
-       }
-
-       return fd;
-}
diff --git a/lib/libc/ip/socketpair.c b/lib/libc/ip/socketpair.c
deleted file mode 100644 (file)
index 55a2c7d..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <net/ioctl.h>
-#include <net/netlib.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/un.h>
-
-#define DEBUG 0
-
-static int _uds_socketpair(int type, int protocol, int sv[2]);
-
-/*
- * Create a pair of connected sockets
- */
-int socketpair(int domain, int type, int protocol, int sv[2]) {
-
-#if DEBUG
-       fprintf(stderr, "socketpair: domain %d, type %d, protocol %d\n",
-               domain, type, protocol);
-#endif
-
-       if (domain != AF_UNIX)
-       {
-               errno = EAFNOSUPPORT;
-               return -1;
-       }
-
-       if (domain == AF_UNIX &&
-                       (type == SOCK_STREAM || type == SOCK_SEQPACKET))
-               return _uds_socketpair(type, protocol, sv);
-
-#if DEBUG
-       fprintf(stderr,
-               "socketpair: nothing for domain %d, type %d, protocol %d\n",
-               domain, type, protocol);
-#endif
-
-       errno= EPROTOTYPE;
-       return -1;
-}
-
-static int _uds_socketpair(int type, int protocol, int sv[2])
-{
-       dev_t dev;
-       int r, i;
-       struct stat sbuf;
-
-       if (protocol != 0)
-       {
-#if DEBUG
-               fprintf(stderr, "socketpair(uds): bad protocol %d\n", protocol);
-#endif
-               errno= EPROTONOSUPPORT;
-               return -1;
-       }
-
-       /* in this 'for' loop two unconnected sockets are created */
-       for (i = 0; i < 2; i++) {
-               sv[i]= open(UDS_DEVICE, O_RDWR);
-               if (sv[i] == -1) {
-                       int open_errno = errno;
-
-                       if (i == 1) {
-                               /* if we failed to open() the 2nd 
-                                * socket, we need to close the 1st
-                                */
-                               close(sv[0]);
-                               errno = open_errno;
-                       }
-
-                       return -1;
-               }
-
-               /* set the type for the socket via ioctl
-                * (SOCK_STREAM, SOCK_SEQPACKET, etc)
-                */
-               r= ioctl(sv[i], NWIOSUDSTYPE, &type);
-               if (r == -1) {
-                       int ioctl_errno;
-
-                       /* if that failed rollback socket creation */
-                       ioctl_errno= errno;
-                       close(sv[i]);
-
-                       if (i == 1) {
-                               /* if we just closed the 2nd socket, we 
-                                * need to close the 1st
-                                */
-                               close(sv[0]);
-                       }
-
-                       /* return the error thrown by the call to ioctl */
-                       errno= ioctl_errno;
-                       return -1;
-               }
-       }
-
-       r= fstat(sv[1], &sbuf);
-       if (r == -1) {
-               int fstat_errno;
-
-               /* if that failed rollback socket creation */
-               fstat_errno= errno;
-
-               close(sv[0]);
-               close(sv[1]);
-
-               /* return the error thrown by the call to fstat */
-               errno= fstat_errno;
-               return -1;
-       }
-
-       dev = sbuf.st_dev;
-
-       /* connect the sockets sv[0] and sv[1] */
-       r= ioctl(sv[0], NWIOSUDSPAIR, &dev);
-       if (r == -1) {
-               int ioctl_errno;
-
-               /* if that failed rollback socket creation */
-               ioctl_errno= errno;
-
-               close(sv[0]);
-               close(sv[1]);
-
-               /* return the error thrown by the call to ioctl */
-               errno= ioctl_errno;
-               return -1;
-       }
-
-
-       return 0;
-}
diff --git a/lib/libc/ip/strcasecmp.c b/lib/libc/ip/strcasecmp.c
deleted file mode 100644 (file)
index b6a954d..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (c) 1987, 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/types.h>
-#include <minix/ansi.h>
-#include <strings.h>
-#include <ctype.h>
-
-int
-strcasecmp(s1, s2)
-       const char *s1, *s2;
-{
-       const u_char
-                       *us1 = (const u_char *)s1,
-                       *us2 = (const u_char *)s2;
-
-       while (tolower(*us1) == tolower(*us2++))
-               if (*us1++ == '\0')
-                       return (0);
-       return (tolower(*us1) - tolower(*--us2));
-}
-
-int
-strncasecmp(s1, s2, n)
-       const char *s1, *s2;
-       size_t n;
-{
-       if (n != 0) {
-               const u_char
-                               *us1 = (const u_char *)s1,
-                               *us2 = (const u_char *)s2;
-
-               do {
-                       if (tolower(*us1) != tolower(*us2++))
-                               return (tolower(*us1) - tolower(*--us2));
-                       if (*us1++ == '\0')
-                               break;
-               } while (--n != 0);
-       }
-       return (0);
-}
similarity index 52%
rename from lib/nbsd_libc/libcincludes.mk
rename to lib/libc/libcincludes.mk
index 03d7df2167447dc90c428f61e09ff5203b3d4b56..66afcc3b990179f433361ccfa3d56badac722fd4 100644 (file)
@@ -3,24 +3,6 @@
 # Makefile fragment shared across several parts that want to look
 # inside libc's include tree.
 
-.if defined(__MINIX)
-MACHINE_ARCH= ${MACHINE}
-MACHINE_CPU= ${MACHINE}
-.if defined(LIBC_MACHINE_ARCH) && \
-    exists(${MINIXSRCDIR}/lib/nbsd_libc/arch/${LIBC_MACHINE_ARCH}/SYS.h)
-ARCHSUBDIR=    ${LIBC_MACHINE_ARCH}
-.elif exists(${MINIXSRCDIR}/lib/nbsd_libc/arch/${MACHINE_ARCH}/SYS.h)
-ARCHSUBDIR=    ${MACHINE_ARCH}
-.elif exists(${MINIXSRCDIR}/lib/nbsd_libc/arch/${MACHINE_CPU}/SYS.h)
-ARCHSUBDIR=    ${MACHINE_CPU}
-.else
-.BEGIN:
-       @echo no ARCHDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU}
-       @false
-.endif
-
-ARCHDIR=       ${MINIXSRCCDIR}/lib/nbsd_libc/arch/${ARCHSUBDIR}
-.else
 .if defined(LIBC_MACHINE_ARCH) && \
     exists(${NETBSDSRCDIR}/lib/libc/arch/${LIBC_MACHINE_ARCH}/SYS.h)
 ARCHSUBDIR=    ${LIBC_MACHINE_ARCH}
@@ -35,4 +17,3 @@ ARCHSUBDIR=   ${MACHINE_CPU}
 .endif
 
 ARCHDIR=       ${NETBSDSRCDIR}/lib/libc/arch/${ARCHSUBDIR}
-.endif
diff --git a/lib/libc/math/Makefile.inc b/lib/libc/math/Makefile.inc
deleted file mode 100644 (file)
index 67baac7..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# math sources
-.PATH: ${.CURDIR}/math
-
-SRCS+=  \
-       asin.c \
-       atan.c \
-       atan2.c \
-       ceil.c \
-       compare.c \
-       exp.c \
-       fabs.c \
-       floor.c \
-       fmod.c \
-       hugeval.c \
-       log.c \
-       log10.c \
-       pow.c \
-       s_rint.c \
-       scalbn.c \
-       sin.c \
-       sinh.c \
-       sqrt.c \
-       tan.c \
-       n_j1.c \
-       tanh.c \
-       s_finite.c \
-       s_copysign.c
diff --git a/lib/libc/math/asin.c b/lib/libc/math/asin.c
deleted file mode 100644 (file)
index ea90fce..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-static double
-asin_acos(double x, int cosfl)
-{
-       int negative = x < 0;
-       int     i;
-       double  g;
-       static double p[] = {
-               -0.27368494524164255994e+2,
-                0.57208227877891731407e+2,
-               -0.39688862997540877339e+2,
-                0.10152522233806463645e+2,
-               -0.69674573447350646411e+0
-       };
-       static double q[] = {
-               -0.16421096714498560795e+3,
-                0.41714430248260412556e+3,
-               -0.38186303361750149284e+3,
-                0.15095270841030604719e+3,
-               -0.23823859153670238830e+2,
-                1.0
-       };
-
-       if (__IsNan(x)) {
-               errno = EDOM;
-               return x;
-       }
-
-       if (negative) {
-               x = -x;
-       }
-       if (x > 0.5) {
-               i = 1;
-               if (x > 1) {
-                       errno = EDOM;
-                       return 0;
-               }
-               g = 0.5 - 0.5 * x;
-               x = - sqrt(g);
-               x += x;
-       }
-       else {
-               /* ??? avoid underflow ??? */
-               i = 0;
-               g = x * x;
-       }
-       x += x * g * POLYNOM4(g, p) / POLYNOM5(g, q);
-       if (cosfl) {
-               if (! negative) x = -x;
-       }
-       if ((cosfl == 0) == (i == 1)) {
-               x = (x + M_PI_4) + M_PI_4;
-       }
-       else if (cosfl && negative && i == 1) {
-               x = (x + M_PI_2) + M_PI_2;
-       }
-       if (! cosfl && negative) x = -x;
-       return x;
-}
-
-double
-asin(double x)
-{
-       return asin_acos(x, 0);
-}
-
-double
-acos(double x)
-{
-       return asin_acos(x, 1);
-}
diff --git a/lib/libc/math/atan.c b/lib/libc/math/atan.c
deleted file mode 100644 (file)
index ff1c912..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <float.h>
-#include       <math.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-double
-atan(double x)
-{
-       /*      Algorithm and coefficients from:
-                       "Software manual for the elementary functions"
-                       by W.J. Cody and W. Waite, Prentice-Hall, 1980
-       */
-
-       static double p[] = {
-               -0.13688768894191926929e+2,
-               -0.20505855195861651981e+2,
-               -0.84946240351320683534e+1,
-               -0.83758299368150059274e+0
-       };
-       static double q[] = {
-                0.41066306682575781263e+2,
-                0.86157349597130242515e+2,
-                0.59578436142597344465e+2,
-                0.15024001160028576121e+2,
-                1.0
-       };
-       static double a[] = {
-               0.0,
-               0.52359877559829887307710723554658381,  /* pi/6 */
-               M_PI_2,
-               1.04719755119659774615421446109316763   /* pi/3 */
-       };
-
-       int     neg = x < 0;
-       int     n;
-       double  g;
-
-       if (__IsNan(x)) {
-               errno = EDOM;
-               return x;
-       }
-       if (neg) {
-               x = -x;
-       }
-       if (x > 1.0) {
-               x = 1.0/x;
-               n = 2;
-       }
-       else    n = 0;
-
-       if (x > 0.26794919243112270647) {       /* 2-sqtr(3) */
-               n = n + 1;
-               x = (((0.73205080756887729353*x-0.5)-0.5)+x)/
-                       (1.73205080756887729353+x);
-       }
-
-       /* ??? avoid underflow ??? */
-
-       g = x * x;
-       x += x * g * POLYNOM3(g, p) / POLYNOM4(g, q);
-       if (n > 1) x = -x;
-       x += a[n];
-       return neg ? -x : x;
-}
diff --git a/lib/libc/math/atan2.c b/lib/libc/math/atan2.c
deleted file mode 100644 (file)
index 0e253c7..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-double
-atan2(double y, double x)
-{
-       double absx, absy, val;
-
-       if (x == 0 && y == 0) {
-               errno = EDOM;
-               return 0;
-       }
-       absy = y < 0 ? -y : y;
-       absx = x < 0 ? -x : x;
-       if (absy - absx == absy) {
-               /* x negligible compared to y */
-               return y < 0 ? -M_PI_2 : M_PI_2;
-       }
-       if (absx - absy == absx) {
-               /* y negligible compared to x */
-               val = 0.0;
-       }
-       else    val = atan(y/x);
-       if (x > 0) {
-               /* first or fourth quadrant; already correct */
-               return val;
-       }
-       if (y < 0) {
-               /* third quadrant */
-               return val - M_PI;
-       }
-       return val + M_PI;
-}
diff --git a/lib/libc/math/ceil.c b/lib/libc/math/ceil.c
deleted file mode 100644 (file)
index 15f6492..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-
-double
-ceil(double x)
-{
-       double val;
-
-       return modf(x, &val) > 0 ? val + 1.0 : val ;
-       /*      this also works if modf always returns a positive
-               fractional part
-       */
-}
diff --git a/lib/libc/math/compare.c b/lib/libc/math/compare.c
deleted file mode 100644 (file)
index e3dd91d..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <assert.h>
-#include <math.h>
-
-/* functions missing here are architecture-specific and are in i386/float */
-
-int isfinite(double x)
-{
-       /* return value based on classification */
-       switch (fpclassify(x))
-       {
-               case FP_INFINITE:
-               case FP_NAN:
-                       return 0;
-
-               case FP_NORMAL:
-               case FP_SUBNORMAL:
-               case FP_ZERO:
-                       return 1;
-       }
-
-       /* if we get here, fpclassify is buggy */
-       assert(0);
-       return -1;
-}
-
-int isinf(double x)
-{
-       return fpclassify(x) == FP_INFINITE;
-}
-
-int isnan(double x)
-{
-       return fpclassify(x) == FP_NAN;
-}
-
-int isnormal(double x)
-{
-       return fpclassify(x) == FP_NORMAL;
-}
diff --git a/lib/libc/math/exp.c b/lib/libc/math/exp.c
deleted file mode 100644 (file)
index ff76afb..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <float.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-
-double
-exp(double x)
-{
-       /*      Algorithm and coefficients from:
-                       "Software manual for the elementary functions"
-                       by W.J. Cody and W. Waite, Prentice-Hall, 1980
-       */
-
-       static double p[] = {
-               0.25000000000000000000e+0,
-               0.75753180159422776666e-2,
-               0.31555192765684646356e-4
-       };
-
-       static double q[] = {
-               0.50000000000000000000e+0,
-               0.56817302698551221787e-1,
-               0.63121894374398503557e-3,
-               0.75104028399870046114e-6
-       };
-       double  xn, g;
-       int     n;
-       int     negative = x < 0;
-
-       if (__IsNan(x)) {
-               errno = EDOM;
-               return x;
-       }
-       if (x < M_LN_MIN_D) {
-               errno = ERANGE;
-               return 0.0;
-       }
-       if (x > M_LN_MAX_D) {
-               errno = ERANGE;
-               return HUGE_VAL;
-       }
-
-       if (negative) x = -x;
-       /* ??? avoid underflow ??? */
-
-       n = x * M_LOG2E + 0.5;  /* 1/ln(2) = log2(e), 0.5 added for rounding */
-       xn = n;
-       {
-               double  x1 = (long) x;
-               double  x2 = x - x1;
-
-               g = ((x1-xn*0.693359375)+x2) - xn*(-2.1219444005469058277e-4);
-       }
-       if (negative) {
-               g = -g;
-               n = -n;
-       }
-       xn = g * g;
-       x = g * POLYNOM2(xn, p);
-       n += 1;
-       return (ldexp(0.5 + x/(POLYNOM3(xn, q) - x), n));
-}
diff --git a/lib/libc/math/fabs.c b/lib/libc/math/fabs.c
deleted file mode 100644 (file)
index 3cb1238..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-float
-fabsf(float x)
-{
-       return  x < 0 ? -x : x;
-}
-
-double
-fabs(double x)
-{
-       return  x < 0 ? -x : x;
-}
-
diff --git a/lib/libc/math/floor.c b/lib/libc/math/floor.c
deleted file mode 100644 (file)
index ee0e6de..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-
-double
-floor(double x)
-{
-       double val;
-
-       return modf(x, &val) < 0 ? val - 1.0 : val ;
-       /*      this also works if modf always returns a positive
-               fractional part
-       */
-}
diff --git a/lib/libc/math/fmod.c b/lib/libc/math/fmod.c
deleted file mode 100644 (file)
index 8117b2b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Eck
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <errno.h>
-
-double
-fmod(double x, double y)
-{
-       long    i;
-       double val;
-       double frac;
-
-       if (y == 0) {
-               errno = EDOM;
-               return 0;
-       }
-       frac = modf( x / y, &val);
-
-       return frac * y;
-
-/*
-       val = x / y;
-       if (val > LONG_MIN && val < LONG_MAX) {
-               i = val;
-               return x - i * y;
-       }
-*/
-}
diff --git a/lib/libc/math/hugeval.c b/lib/libc/math/hugeval.c
deleted file mode 100644 (file)
index cb99525..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * (c) copyright 1990 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Hans van Eck
- */
-/* $Header$ */
-#include       <assert.h>
-#include       <math.h>
-
-double
-__infinity(void)
-{
-#if (CHIP == INTEL)
-       static unsigned char ieee_infinity[] = { 
-               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f };
-
-       assert(sizeof(double) == sizeof(ieee_infinity));
-       return *(double *) ieee_infinity;
-#else
-       return 1.0e+1000;       /* This will generate a warning */
-#endif
-}
-
-double
-__qnan(void)
-{
-#if (CHIP == INTEL)
-       static unsigned char ieee_qnan[] = { 
-               0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f };
-
-       assert(sizeof(double) == sizeof(ieee_qnan));
-       return *(double *) ieee_qnan;
-#else
-#error QNaN not defined on this architecture
-#endif
-}
-
diff --git a/lib/libc/math/localmath.h b/lib/libc/math/localmath.h
deleted file mode 100644 (file)
index 29432af..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * localmath.h - This header is used by the mathematical library.
- */
-/* $Header$ */
-
-#define __IsNan isnan
-
-/* some constants (Hart & Cheney) */
-#define        M_PI            3.14159265358979323846264338327950288
-#define        M_2PI           6.28318530717958647692528676655900576
-#define        M_3PI_4         2.35619449019234492884698253745962716
-#define        M_PI_2          1.57079632679489661923132169163975144
-#define        M_3PI_8         1.17809724509617246442349126872981358
-#define        M_PI_4          0.78539816339744830961566084581987572
-#define        M_PI_8          0.39269908169872415480783042290993786
-#define        M_1_PI          0.31830988618379067153776752674502872
-#define        M_2_PI          0.63661977236758134307553505349005744
-#define        M_4_PI          1.27323954473516268615107010698011488
-#define        M_E             2.71828182845904523536028747135266250
-#define        M_LOG2E         1.44269504088896340735992468100189213
-#define        M_LOG10E        0.43429448190325182765112891891660508
-#define        M_LN2           0.69314718055994530941723212145817657
-#define        M_LN10          2.30258509299404568401799145468436421
-#define        M_SQRT2         1.41421356237309504880168872420969808
-#define        M_1_SQRT2       0.70710678118654752440084436210484904
-#define        M_EULER         0.57721566490153286060651209008240243
-
-/* macros for constructing polynomials */
-#define        POLYNOM1(x, a)  ((a)[1]*(x)+(a)[0])
-#define        POLYNOM2(x, a)  (POLYNOM1((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM3(x, a)  (POLYNOM2((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM4(x, a)  (POLYNOM3((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM5(x, a)  (POLYNOM4((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM6(x, a)  (POLYNOM5((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM7(x, a)  (POLYNOM6((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM8(x, a)  (POLYNOM7((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM9(x, a)  (POLYNOM8((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM10(x, a) (POLYNOM9((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM11(x, a) (POLYNOM10((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM12(x, a) (POLYNOM11((x),(a)+1)*(x)+(a)[0])
-#define        POLYNOM13(x, a) (POLYNOM12((x),(a)+1)*(x)+(a)[0])
-
-#define        M_LN_MAX_D      (M_LN2 * DBL_MAX_EXP)
-#define        M_LN_MIN_D      (M_LN2 * (DBL_MIN_EXP - 1))
diff --git a/lib/libc/math/log.c b/lib/libc/math/log.c
deleted file mode 100644 (file)
index e6a6739..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <float.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-double
-log(double x)
-{
-       /*      Algorithm and coefficients from:
-                       "Software manual for the elementary functions"
-                       by W.J. Cody and W. Waite, Prentice-Hall, 1980
-       */
-       static double a[] = {
-               -0.64124943423745581147e2,
-                0.16383943563021534222e2,
-               -0.78956112887491257267e0
-       };
-       static double b[] = {
-               -0.76949932108494879777e3,
-                0.31203222091924532844e3,
-               -0.35667977739034646171e2,
-                1.0
-       };
-
-       double  znum, zden, z, w;
-       int     exponent;
-
-       if (__IsNan(x)) {
-               errno = EDOM;
-               return x;
-       }
-       if (x < 0) {
-               errno = EDOM;
-               return -HUGE_VAL;
-       }
-       else if (x == 0) {
-               errno = ERANGE;
-               return -HUGE_VAL;
-       }
-
-       if (x <= DBL_MAX) {
-       }
-       else return x;  /* for infinity and Nan */
-       x = frexp(x, &exponent);
-       if (x > M_1_SQRT2) {
-               znum = (x - 0.5) - 0.5;
-               zden = x * 0.5 + 0.5;
-       }
-       else {
-               znum = x - 0.5;
-               zden = znum * 0.5 + 0.5;
-               exponent--;
-       }
-       z = znum/zden; w = z * z;
-       x = z + z * w * (POLYNOM2(w,a)/POLYNOM3(w,b));
-       z = exponent;
-       x += z * (-2.121944400546905827679e-4);
-       return x + z * 0.693359375;
-}
diff --git a/lib/libc/math/log10.c b/lib/libc/math/log10.c
deleted file mode 100644 (file)
index 85e4296..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-double
-log10(double x)
-{
-       if (__IsNan(x)) {
-               errno = EDOM;
-               return x;
-       }
-       if (x < 0) {
-               errno = EDOM;
-               return -HUGE_VAL;
-       }
-       else if (x == 0) {
-               errno = ERANGE;
-               return -HUGE_VAL;
-       }
-
-       return log(x) / M_LN10;
-}
diff --git a/lib/libc/math/math_private.h b/lib/libc/math/math_private.h
deleted file mode 100644 (file)
index d367f2a..0000000
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * from: @(#)fdlibm.h 5.1 93/09/24
- * $FreeBSD: src/lib/msun/src/math_private.h,v 1.17.2.2 2007/06/13 18:17:25 bde Exp $
- */
-
-#ifndef _MATH_PRIVATE_H_
-#define        _MATH_PRIVATE_H_
-
-#include <sys/types.h>
-#include <net/hton.h>
-
-/*
- * The original fdlibm code used statements like:
- *     n0 = ((*(int*)&one)>>29)^1;             * index of high word *
- *     ix0 = *(n0+(int*)&x);                   * high word of x *
- *     ix1 = *((1-n0)+(int*)&x);               * low word of x *
- * to dig two 32 bit words out of the 64 bit IEEE floating point
- * value.  That is non-ANSI, and, moreover, the gcc instruction
- * scheduler gets it wrong.  We instead use the following macros.
- * Unlike the original code, we determine the endianness at compile
- * time, not at run time; I don't see much benefit to selecting
- * endianness at run time.
- */
-
-/*
- * A union which permits us to convert between a double and two 32 bit
- * ints.
- */
-
-#if BIG_ENDIAN
-
-typedef union
-{
-  double value;
-  struct
-  {
-    u32_t msw;
-    u32_t lsw;
-  } parts;
-} ieee_double_shape_type;
-
-#endif
-
-#if LITTLE_ENDIAN
-
-typedef union
-{
-  double value;
-  struct
-  {
-    u32_t lsw;
-    u32_t msw;
-  } parts;
-} ieee_double_shape_type;
-
-#endif
-
-/* Get two 32 bit ints from a double.  */
-
-#define EXTRACT_WORDS(ix0,ix1,d)                               \
-do {                                                           \
-  ieee_double_shape_type ew_u;                                 \
-  ew_u.value = (d);                                            \
-  (ix0) = ew_u.parts.msw;                                      \
-  (ix1) = ew_u.parts.lsw;                                      \
-} while (0)
-
-/* Get the more significant 32 bit int from a double.  */
-
-#define GET_HIGH_WORD(i,d)                                     \
-do {                                                           \
-  ieee_double_shape_type gh_u;                                 \
-  gh_u.value = (d);                                            \
-  (i) = gh_u.parts.msw;                                                \
-} while (0)
-
-/* Get the less significant 32 bit int from a double.  */
-
-#define GET_LOW_WORD(i,d)                                      \
-do {                                                           \
-  ieee_double_shape_type gl_u;                                 \
-  gl_u.value = (d);                                            \
-  (i) = gl_u.parts.lsw;                                                \
-} while (0)
-
-/* Set a double from two 32 bit ints.  */
-
-#define INSERT_WORDS(d,ix0,ix1)                                        \
-do {                                                           \
-  ieee_double_shape_type iw_u;                                 \
-  iw_u.parts.msw = (ix0);                                      \
-  iw_u.parts.lsw = (ix1);                                      \
-  (d) = iw_u.value;                                            \
-} while (0)
-
-/* Set the more significant 32 bits of a double from an int.  */
-
-#define SET_HIGH_WORD(d,v)                                     \
-do {                                                           \
-  ieee_double_shape_type sh_u;                                 \
-  sh_u.value = (d);                                            \
-  sh_u.parts.msw = (v);                                                \
-  (d) = sh_u.value;                                            \
-} while (0)
-
-/* Set the less significant 32 bits of a double from an int.  */
-
-#define SET_LOW_WORD(d,v)                                      \
-do {                                                           \
-  ieee_double_shape_type sl_u;                                 \
-  sl_u.value = (d);                                            \
-  sl_u.parts.lsw = (v);                                                \
-  (d) = sl_u.value;                                            \
-} while (0)
-
-/*
- * A union which permits us to convert between a float and a 32 bit
- * int.
- */
-
-typedef union
-{
-  float value;
-  /* FIXME: Assumes 32 bit int.  */
-  unsigned int word;
-} ieee_float_shape_type;
-
-/* Get a 32 bit int from a float.  */
-
-#define GET_FLOAT_WORD(i,d)                                    \
-do {                                                           \
-  ieee_float_shape_type gf_u;                                  \
-  gf_u.value = (d);                                            \
-  (i) = gf_u.word;                                             \
-} while (0)
-
-/* Set a float from a 32 bit int.  */
-
-#define SET_FLOAT_WORD(d,i)                                    \
-do {                                                           \
-  ieee_float_shape_type sf_u;                                  \
-  sf_u.word = (i);                                             \
-  (d) = sf_u.value;                                            \
-} while (0)
-
-#if 0
-
-#ifdef _COMPLEX_H
-/*
- * Inline functions that can be used to construct complex values.
- *
- * The C99 standard intends x+I*y to be used for this, but x+I*y is
- * currently unusable in general since gcc introduces many overflow,
- * underflow, sign and efficiency bugs by rewriting I*y as
- * (0.0+I)*(y+0.0*I) and laboriously computing the full complex product.
- * In particular, I*Inf is corrupted to NaN+I*Inf, and I*-0 is corrupted
- * to -0.0+I*0.0.
- */
-static __inline float complex
-cpackf(float x, float y)
-{
-       float complex z;
-
-       __real__ z = x;
-       __imag__ z = y;
-       return (z);
-}
-
-static __inline double complex
-cpack(double x, double y)
-{
-       double complex z;
-
-       __real__ z = x;
-       __imag__ z = y;
-       return (z);
-}
-
-static __inline long double complex
-cpackl(long double x, long double y)
-{
-       long double complex z;
-
-       __real__ z = x;
-       __imag__ z = y;
-       return (z);
-}
-#endif /* _COMPLEX_H */
-/*
- * ieee style elementary functions
- *
- * We rename functions here to improve other sources' diffability
- * against fdlibm.
- */
-#define        __ieee754_sqrt  sqrt
-#define        __ieee754_acos  acos
-#define        __ieee754_acosh acosh
-#define        __ieee754_log   log
-#define        __ieee754_atanh atanh
-#define        __ieee754_asin  asin
-#define        __ieee754_atan2 atan2
-#define        __ieee754_exp   exp
-#define        __ieee754_cosh  cosh
-#define        __ieee754_fmod  fmod
-#define        __ieee754_pow   pow
-#define        __ieee754_lgamma lgamma
-#define        __ieee754_gamma gamma
-#define        __ieee754_lgamma_r lgamma_r
-#define        __ieee754_gamma_r gamma_r
-#define        __ieee754_log10 log10
-#define        __ieee754_sinh  sinh
-#define        __ieee754_hypot hypot
-#define        __ieee754_j0    j0
-#define        __ieee754_j1    j1
-#define        __ieee754_y0    y0
-#define        __ieee754_y1    y1
-#define        __ieee754_jn    jn
-#define        __ieee754_yn    yn
-#define        __ieee754_remainder remainder
-#define        __ieee754_scalb scalb
-#define        __ieee754_sqrtf sqrtf
-#define        __ieee754_acosf acosf
-#define        __ieee754_acoshf acoshf
-#define        __ieee754_logf  logf
-#define        __ieee754_atanhf atanhf
-#define        __ieee754_asinf asinf
-#define        __ieee754_atan2f atan2f
-#define        __ieee754_expf  expf
-#define        __ieee754_coshf coshf
-#define        __ieee754_fmodf fmodf
-#define        __ieee754_powf  powf
-#define        __ieee754_lgammaf lgammaf
-#define        __ieee754_gammaf gammaf
-#define        __ieee754_lgammaf_r lgammaf_r
-#define        __ieee754_gammaf_r gammaf_r
-#define        __ieee754_log10f log10f
-#define        __ieee754_sinhf sinhf
-#define        __ieee754_hypotf hypotf
-#define        __ieee754_j0f   j0f
-#define        __ieee754_j1f   j1f
-#define        __ieee754_y0f   y0f
-#define        __ieee754_y1f   y1f
-#define        __ieee754_jnf   jnf
-#define        __ieee754_ynf   ynf
-#define        __ieee754_remainderf remainderf
-#define        __ieee754_scalbf scalbf
-
-/* fdlibm kernel function */
-int    __ieee754_rem_pio2(double,double*);
-double __kernel_sin(double,double,int);
-double __kernel_cos(double,double);
-double __kernel_tan(double,double,int);
-int    __kernel_rem_pio2(double*,double*,int,int,int,const int*);
-
-/* float versions of fdlibm kernel functions */
-int    __ieee754_rem_pio2f(float,float*);
-float  __kernel_sindf(double);
-float  __kernel_cosdf(double);
-float  __kernel_tandf(double,int);
-int    __kernel_rem_pio2f(float*,float*,int,int,int,const int*);
-
-#endif
-
-#endif /* !_MATH_PRIVATE_H_ */
diff --git a/lib/libc/math/pow.c b/lib/libc/math/pow.c
deleted file mode 100644 (file)
index b4a9006..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <float.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-double
-pow(double x, double y)
-{
-       /*      Simple version for now. The Cody and Waite book has
-               a very complicated, much more precise version, but
-               this version has machine-dependent arrays A1 and A2,
-               and I don't know yet how to solve this ???
-       */
-       double dummy;
-       int     result_neg = 0;
-
-       if ((x == 0 && y == 0) ||
-           (x < 0 && modf(y, &dummy) != 0)) {
-               errno = EDOM;
-               return 0;
-       }
-
-       if (x == 0) return x;
-
-       if (x < 0) {
-               if (modf(y/2.0, &dummy) != 0) {
-                       /* y was odd */
-                       result_neg = 1;
-               }
-               x = -x;
-       }
-       x = log(x);
-
-       if (x < 0) {
-               x = -x;
-               y = -y;
-       }
-       /* Beware of overflow in the multiplication */
-       if (x > 1.0 && y > DBL_MAX/x) {
-               errno = ERANGE;
-               return result_neg ? -HUGE_VAL : HUGE_VAL;
-       }
-
-       x = exp(x * y);
-       return result_neg ? -x : x;
-}
diff --git a/lib/libc/math/s_copysign.c b/lib/libc/math/s_copysign.c
deleted file mode 100644 (file)
index 5640014..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* @(#)s_copysign.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_copysign.c,v 1.11 2002/05/26 22:01:54 wiz Exp $");
-#endif
-
-/*
- * copysign(double x, double y)
- * copysign(x,y) returns a value with the magnitude of x and
- * with the sign bit of y.
- */
-
-#include "math.h"
-#include "math_private.h"
-
-double
-copysign(double x, double y)
-{
-       unsigned long hx,hy;
-       GET_HIGH_WORD(hx,x);
-       GET_HIGH_WORD(hy,y);
-       SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
-        return x;
-}
diff --git a/lib/libc/math/s_finite.c b/lib/libc/math/s_finite.c
deleted file mode 100644 (file)
index 9f2756c..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* @(#)s_finite.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_finite.c,v 1.11 2002/05/26 22:01:55 wiz Exp $");
-#endif
-
-/*
- * finite(x) returns 1 is x is finite, else 0;
- * no branching!
- */
-
-#include "math.h"
-#include "math_private.h"
-
-int
-finite(double x)
-{
-       int hx;
-       GET_HIGH_WORD(hx,x);
-       return (int)((unsigned int)((hx&0x7fffffff)-0x7ff00000)>>31);
-}
diff --git a/lib/libc/math/s_rint.c b/lib/libc/math/s_rint.c
deleted file mode 100644 (file)
index fd21fd0..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/* @(#)s_rint.c 5.1 93/09/24 */
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * rint(x)
- * Return x rounded to integral value according to the prevailing
- * rounding mode.
- * Method:
- *     Using floating addition.
- * Exception:
- *     Inexact flag raised if x not equal to rint(x).
- */
-
-#include "math_private.h"
-
-static const double
-TWO52[2]={
-  4.50359962737049600000e+15, /* 0x43300000, 0x00000000 */
- -4.50359962737049600000e+15, /* 0xC3300000, 0x00000000 */
-};
-
-double
-rint(double x)
-{
-       i32_t i0,j0,sx;
-       u32_t i,i1;
-       double w,t;
-       EXTRACT_WORDS(i0,i1,x);
-       sx = (i0>>31)&1;
-       j0 = ((i0>>20)&0x7ff)-0x3ff;
-       if(j0<20) {
-           if(j0<0) {
-               if(((i0&0x7fffffff)|i1)==0) return x;
-               i1 |= (i0&0x0fffff);
-               i0 &= 0xfffe0000;
-               i0 |= ((i1|-i1)>>12)&0x80000;
-               SET_HIGH_WORD(x,i0);
-               w = TWO52[sx]+x;
-               t =  w-TWO52[sx];
-               GET_HIGH_WORD(i0,t);
-               SET_HIGH_WORD(t,(i0&0x7fffffff)|(sx<<31));
-               return t;
-           } else {
-               i = (0x000fffff)>>j0;
-               if(((i0&i)|i1)==0) return x; /* x is integral */
-               i>>=1;
-               if(((i0&i)|i1)!=0) {
-                   /*
-                    * Some bit is set after the 0.5 bit.  To avoid the
-                    * possibility of errors from double rounding in
-                    * w = TWO52[sx]+x, adjust the 0.25 bit to a lower
-                    * guard bit.  We do this for all j0<=51.  The
-                    * adjustment is trickiest for j0==18 and j0==19
-                    * since then it spans the word boundary.
-                    */
-                   if(j0==19) i1 = 0x40000000; else
-                   if(j0==18) i1 = 0x80000000; else
-                   i0 = (i0&(~i))|((0x20000)>>j0);
-               }
-           }
-       } else if (j0>51) {
-           if(j0==0x400) return x+x;   /* inf or NaN */
-           else return x;              /* x is integral */
-       } else {
-           i = ((u32_t)(0xffffffff))>>(j0-20);
-           if((i1&i)==0) return x;     /* x is integral */
-           i>>=1;
-           if((i1&i)!=0) i1 = (i1&(~i))|((0x40000000)>>(j0-20));
-       }
-       INSERT_WORDS(x,i0,i1);
-       *(volatile double *)&w = TWO52[sx]+x;   /* clip any extra precision */
-       return w-TWO52[sx];
-}
diff --git a/lib/libc/math/scalbn.c b/lib/libc/math/scalbn.c
deleted file mode 100644 (file)
index 311c40e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <math.h>
-
-double scalbln(double x, long n)
-{
-       return ldexp(x, n);
-}
-
-float scalblnf(float x, long n)
-{
-       return ldexp(x, n);
-}
-
-double scalbn(double x, int n)
-{
-       return ldexp(x, n);
-}
-
-float scalbnf(float x, int n)
-{
-       return ldexp(x, n);
-}
-
diff --git a/lib/libc/math/sin.c b/lib/libc/math/sin.c
deleted file mode 100644 (file)
index 1f00f83..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <float.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-static double
-sinus(double x, int cos_flag)
-{
-       /*      Algorithm and coefficients from:
-                       "Software manual for the elementary functions"
-                       by W.J. Cody and W. Waite, Prentice-Hall, 1980
-       */
-
-       static double r[] = {
-               -0.16666666666666665052e+0,
-                0.83333333333331650314e-2,
-               -0.19841269841201840457e-3,
-                0.27557319210152756119e-5,
-               -0.25052106798274584544e-7,
-                0.16058936490371589114e-9,
-               -0.76429178068910467734e-12,
-                0.27204790957888846175e-14
-       };
-
-       double  y;
-       int     neg = 1;
-
-       if (__IsNan(x)) {
-               errno = EDOM;
-               return x;
-       }
-       if (x < 0) {
-               x = -x;
-               neg = -1;
-       }
-       if (cos_flag) {
-               neg = 1;
-               y = M_PI_2 + x;
-       }
-       else    y = x;
-
-       /* ??? avoid loss of significance, if y is too large, error ??? */
-
-       y = y * M_1_PI + 0.5;
-
-       if (y >= DBL_MAX/M_PI) return 0.0;
-
-       /*      Use extended precision to calculate reduced argument.
-               Here we used 12 bits of the mantissa for a1.
-               Also split x in integer part x1 and fraction part x2.
-       */
-#define A1 3.1416015625
-#define A2 -8.908910206761537356617e-6
-       {
-               double x1, x2;
-
-               modf(y, &y);
-               if (modf(0.5*y, &x1)) neg = -neg;
-               if (cos_flag) y -= 0.5;
-               x2 = modf(x, &x1);
-               x = x1 - y * A1;
-               x += x2;
-               x -= y * A2;
-#undef A1
-#undef A2
-       }
-       if (x < 0) {
-               neg = -neg;
-               x = -x;
-       }
-
-       /* ??? avoid underflow ??? */
-
-       y = x * x;
-       x += x * y * POLYNOM7(y, r);
-       return neg==-1 ? -x : x;
-}
-
-double
-sin(double x)
-{
-       return sinus(x, 0);
-}
-
-double
-cos(double x)
-{
-       if (x < 0) x = -x;
-       return sinus(x, 1);
-}
diff --git a/lib/libc/math/sinh.c b/lib/libc/math/sinh.c
deleted file mode 100644 (file)
index 356604a..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <float.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-static double
-sinh_cosh(double x, int cosh_flag)
-{
-       /*      Algorithm and coefficients from:
-                       "Software manual for the elementary functions"
-                       by W.J. Cody and W. Waite, Prentice-Hall, 1980
-       */
-
-       static double p[] = {
-               -0.35181283430177117881e+6,
-               -0.11563521196851768270e+5,
-               -0.16375798202630751372e+3,
-               -0.78966127417357099479e+0
-       };
-       static double q[] = {
-               -0.21108770058106271242e+7,
-                0.36162723109421836460e+5,
-               -0.27773523119650701167e+3,
-                1.0
-       };
-       int     negative = x < 0;
-       double  y = negative ? -x : x;
-
-       if (__IsNan(x)) {
-               errno = EDOM;
-               return x;
-       }
-       if (! cosh_flag && y <= 1.0) {
-               /* ??? check for underflow ??? */
-               y = y * y;
-               return x + x * y * POLYNOM3(y, p)/POLYNOM3(y,q);
-       }
-
-       if (y >= M_LN_MAX_D) {
-               /* exp(y) would cause overflow */
-#define LNV    0.69316101074218750000e+0
-#define VD2M1  0.52820835025874852469e-4
-               double  w = y - LNV;
-               
-               if (w < M_LN_MAX_D+M_LN2-LNV) {
-                       x = exp(w);
-                       x += VD2M1 * x;
-               }
-               else {
-                       errno = ERANGE;
-                       x = HUGE_VAL;
-               }
-       }
-       else {
-               double  z = exp(y);
-               
-               x = 0.5 * (z + (cosh_flag ? 1.0 : -1.0)/z);
-       }
-       return negative ? -x : x;
-}
-
-double
-sinh(double x)
-{
-       return sinh_cosh(x, 0);
-}
-
-double
-cosh(double x)
-{
-       if (x < 0) x = -x;
-       return sinh_cosh(x, 1);
-}
diff --git a/lib/libc/math/sqrt.c b/lib/libc/math/sqrt.c
deleted file mode 100644 (file)
index 2f2402e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <float.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-#define NITER  5
-
-double
-sqrt(double x)
-{
-       int exponent;
-       double val;
-
-       if (__IsNan(x)) {
-               errno = EDOM;
-               return x;
-       }
-       if (x <= 0) {
-               if (x < 0) errno = EDOM;
-               return 0;
-       }
-
-       if (x > DBL_MAX) return x;      /* for infinity */
-
-       val = frexp(x, &exponent);
-       if (exponent & 1) {
-               exponent--;
-               val *= 2;
-       }
-       val = ldexp(val + 1.0, exponent/2 - 1);
-       /* was: val = (val + 1.0)/2.0; val = ldexp(val, exponent/2); */
-       for (exponent = NITER - 1; exponent >= 0; exponent--) {
-               val = (val + x / val) / 2.0;
-       }
-       return val;
-}
diff --git a/lib/libc/math/tan.c b/lib/libc/math/tan.c
deleted file mode 100644 (file)
index 809b49a..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <math.h>
-#include       <float.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-double
-tan(double x)
-{
-       /*      Algorithm and coefficients from:
-                       "Software manual for the elementary functions"
-                       by W.J. Cody and W. Waite, Prentice-Hall, 1980
-       */
-
-       int negative = x < 0;
-       int invert = 0;
-       double  y;
-       static double   p[] = {
-                1.0,
-               -0.13338350006421960681e+0,
-                0.34248878235890589960e-2,
-               -0.17861707342254426711e-4
-       };
-       static double   q[] = {
-                1.0,
-               -0.46671683339755294240e+0,
-                0.25663832289440112864e-1,
-               -0.31181531907010027307e-3,
-                0.49819433993786512270e-6
-       };
-
-       if (__IsNan(x)) {
-               errno = EDOM;
-               return x;
-       }
-       if (negative) x = -x;
-       /* ??? avoid loss of significance, error if x is too large ??? */
-
-       y = x * M_2_PI + 0.5;
-
-       if (y >= DBL_MAX/M_PI_2) return 0.0;
-
-       /*      Use extended precision to calculate reduced argument.
-               Here we used 12 bits of the mantissa for a1.
-               Also split x in integer part x1 and fraction part x2.
-       */
-    #define A1 1.57080078125
-    #define A2 -4.454455103380768678308e-6
-       {
-               double x1, x2;
-
-               modf(y, &y);
-               if (modf(0.5*y, &x1)) invert = 1;
-               x2 = modf(x, &x1);
-               x = x1 - y * A1;
-               x += x2;
-               x -= y * A2;
-    #undef A1
-    #undef A2
-       }
-
-       /* ??? avoid underflow ??? */
-       y = x * x;
-       x += x * y * POLYNOM2(y, p+1);
-       y = POLYNOM4(y, q);
-       if (negative) x = -x;
-       return invert ? -y/x : x/y;
-}
diff --git a/lib/libc/math/tanh.c b/lib/libc/math/tanh.c
deleted file mode 100644 (file)
index ea29c61..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-/* $Header$ */
-
-#include       <float.h>
-#include       <math.h>
-#include       <errno.h>
-#include       "localmath.h"
-
-double
-tanh(double x)
-{
-       /*      Algorithm and coefficients from:
-                       "Software manual for the elementary functions"
-                       by W.J. Cody and W. Waite, Prentice-Hall, 1980
-       */
-
-       static double p[] = {
-               -0.16134119023996228053e+4,
-               -0.99225929672236083313e+2,
-               -0.96437492777225469787e+0
-       };
-       static double q[] = {
-                0.48402357071988688686e+4,
-                0.22337720718962312926e+4,
-                0.11274474380534949335e+3,
-                1.0
-       };
-       int     negative = x < 0;
-
-       if (__IsNan(x)) {
-               errno = EDOM;
-               return x;
-       }
-       if (negative) x = -x;
-
-       if (x >= 0.5*M_LN_MAX_D) {
-               x = 1.0;
-       }
-#define LN3D2  0.54930614433405484570e+0       /* ln(3)/2 */
-       else if (x > LN3D2) {
-               x = 0.5 - 1.0/(exp(x+x)+1.0);
-               x += x;
-       }
-       else {
-               /* ??? avoid underflow ??? */
-               double g = x*x;
-               x += x * g * POLYNOM2(g, p)/POLYNOM3(g, q);
-       }
-       return negative ? -x : x;
-}
similarity index 100%
rename from lib/nbsd_libc/md/md2hl.c
rename to lib/libc/md/md2hl.c
similarity index 100%
rename from lib/nbsd_libc/md/md4hl.c
rename to lib/libc/md/md4hl.c
similarity index 100%
rename from lib/nbsd_libc/md/md5hl.c
rename to lib/libc/md/md5hl.c
similarity index 100%
rename from lib/nbsd_libc/md/mdX.3
rename to lib/libc/md/mdX.3
similarity index 100%
rename from lib/nbsd_libc/md/mdXhl.c
rename to lib/libc/md/mdXhl.c
similarity index 100%
rename from lib/nbsd_libc/net/rcmd.3
rename to lib/libc/net/rcmd.3
similarity index 100%
rename from lib/nbsd_libc/net/rcmd.c
rename to lib/libc/net/rcmd.c
similarity index 100%
rename from lib/nbsd_libc/net/recv.c
rename to lib/libc/net/recv.c
similarity index 100%
rename from lib/nbsd_libc/net/send.c
rename to lib/libc/net/send.c
similarity index 100%
rename from lib/nbsd_libc/nls/C.msg
rename to lib/libc/nls/C.msg
similarity index 100%
rename from lib/nbsd_libc/nls/ca.msg
rename to lib/libc/nls/ca.msg
similarity index 100%
rename from lib/nbsd_libc/nls/cs.msg
rename to lib/libc/nls/cs.msg
similarity index 100%
rename from lib/nbsd_libc/nls/de.msg
rename to lib/libc/nls/de.msg
similarity index 100%
rename from lib/nbsd_libc/nls/es.msg
rename to lib/libc/nls/es.msg
similarity index 100%
rename from lib/nbsd_libc/nls/fi.msg
rename to lib/libc/nls/fi.msg
similarity index 100%
rename from lib/nbsd_libc/nls/fr.msg
rename to lib/libc/nls/fr.msg
similarity index 100%
rename from lib/nbsd_libc/nls/nl.msg
rename to lib/libc/nls/nl.msg
similarity index 100%
rename from lib/nbsd_libc/nls/no.msg
rename to lib/libc/nls/no.msg
similarity index 100%
rename from lib/nbsd_libc/nls/pl.msg
rename to lib/libc/nls/pl.msg
similarity index 100%
rename from lib/nbsd_libc/nls/sk.msg
rename to lib/libc/nls/sk.msg
similarity index 100%
rename from lib/nbsd_libc/nls/sv.msg
rename to lib/libc/nls/sv.msg
diff --git a/lib/libc/other/Makefile.inc b/lib/libc/other/Makefile.inc
deleted file mode 100644 (file)
index 6b9d1c7..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-# other sources
-.PATH: ${.CURDIR}/other
-
-CPPFLAGS.fslib.c+=-I${.CURDIR}/../../servers
-CPPFLAGS.fsversion.c+=-I${.CURDIR}/../../servers
-
-SRCS+=  \
-       __pm_findproc.c \
-       _brk.c \
-       _cprofile.c \
-       _getdents.c \
-       _getnpid.c \
-       _getnucred.c \
-       _getnuid.c \
-       _getngid.c \
-       _getnprocnr.c \
-       _getpprocnr.c \
-       _getprocnr.c \
-       _lseek64.c \
-       _mapdriver.c \
-       _mcontext.c \
-       _mount.c \
-       _reboot.c \
-       _sbrk.c \
-       _seekdir.c \
-       _setgroups.c \
-       _sprofile.c \
-       _svrctl.c \
-       _sysuname.c \
-       _vm_memctl.c \
-       _vm_set_priv.c \
-       _vm_update.c \
-       _vm_query_exit.c \
-       basename.c \
-       bcmp.c \
-       bcopy.c \
-       bzero.c \
-       configfile.c \
-       ctermid.c \
-       cuserid.c \
-       dirname.c \
-       environ.c \
-       err.c \
-       errx.c \
-       errno.c \
-       fdopen.c \
-       ffs.c \
-       flock.c \
-       fslib.c \
-       fts.c \
-       fgetln.c \
-       fsversion.c \
-       gcov.c \
-       gcov_flush.c \
-       getgrent.c \
-       getlogin.c \
-       getopt_long.c \
-       getpagesize.c \
-       getpass.c \
-       getprogname.c \
-       getsubopt.c \
-       getttyent.c \
-       getw.c \
-       hypot.c \
-       index.c \
-       initgroups.c \
-       issetugid.c \
-       itoa.c \
-       loadname.c \
-       lock.c \
-       lrand.c \
-       lsearch.c \
-       memccpy.c \
-       minix_rs.c \
-       mtab.c \
-       nlist.c \
-       paramvalue.c \
-       peekpoke.c \
-       popen.c \
-       putenv.c \
-       putw.c \
-       random.c \
-       read_tsc.S \
-       read_tsc_64.c \
-       realpath.c \
-       rindex.c \
-       rlimit.c \
-       setenv.c \
-       setmode.c \
-       settimeofday.c \
-       shquote.c \
-       sizeup.c \
-       stderr.c \
-       strcasestr.c \
-       strdup.c \
-       strlcat.c \
-       strlcpy.c \
-       strmode.c \
-       strnstr.c \
-       strtok_r.c \
-       strtoll.c \
-       strsep.c \
-       swab.c \
-       syscall.c \
-       sysconf.c \
-       syslog.c \
-       telldir.c \
-       termcap.c \
-       ttyname.c \
-       ttyslot.c \
-       u64util.c \
-       v8regerror.c \
-       v8regexp.c \
-       v8regsub.c \
-       vectorio.c \
-       verr.c \
-       verrx.c \
-       vwarn.c \
-       vwarnx.c \
-       warn.c \
-       warnx.c
-
-# XXX To be removed after full
-# XXX switch to NetBSD passwd.
-SRCS+=  \
-       getpwent.c \
-       pwcache.c
diff --git a/lib/libc/other/__pm_findproc.c b/lib/libc/other/__pm_findproc.c
deleted file mode 100644 (file)
index 51b4435..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <lib.h>
-#define _pm_findproc   __pm_findproc
-#include <unistd.h>
-#include <string.h>
-
-PUBLIC int _pm_findproc(proc_name, proc_nr)
-char *proc_name;               /* name of process to search for */
-int *proc_nr;                  /* return process number here */
-{
-  message m;
-
-  m.m1_p1 = proc_name;
-  m.m1_i1 = -1;                        /* search by name */
-  m.m1_i2 = strlen(proc_name) + 1;
-  if (_syscall(PM_PROC_NR, GETPROCNR, &m) < 0) return(-1);
-  *proc_nr = m.m1_i1;
-  return(0);
-}
-
diff --git a/lib/libc/other/_brk.c b/lib/libc/other/_brk.c
deleted file mode 100644 (file)
index 266ba37..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <lib.h>
-#define brk    _brk
-#define sbrk   _sbrk
-#include <unistd.h>
-
-extern char *_brksize;
-
-/* Both OSF/1 and SYSVR4 man pages specify that brk(2) returns int.
- * However, BSD4.3 specifies that brk() returns char*.  POSIX omits
- * brk() on the grounds that it imposes a memory model on an architecture.
- * For this reason, brk() and sbrk() are not in the lib/posix directory.
- * On the other hand, they are so crucial to correct operation of so many
- * parts of the system, that we have chosen to hide the name brk using _brk,
- * as with system calls.  In this way, if a user inadvertently defines a
- * procedure brk, MINIX may continue to work because the true call is _brk.
- */
-PUBLIC int brk(addr)
-char *addr;
-{
-  message m;
-
-  if (addr != _brksize) {
-       m.PMBRK_ADDR = addr;
-       if (_syscall(PM_PROC_NR, BRK, &m) < 0) return(-1);
-       _brksize = m.m2_p1;
-  }
-  return(0);
-}
-
diff --git a/lib/libc/other/_cprofile.c b/lib/libc/other/_cprofile.c
deleted file mode 100644 (file)
index 40aad03..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <lib.h>
-
-#define cprofile _cprofile
-
-PUBLIC int cprofile(int action, int size, char *ctl_ptr, int *mem_ptr)
-{
-  message m;
-
-  m.PROF_ACTION         = action;
-  m.PROF_MEM_SIZE       = size;
-  m.PROF_CTL_PTR        = (void *) ctl_ptr;
-  m.PROF_MEM_PTR        = (void *) mem_ptr;
-
-  return _syscall(PM_PROC_NR, CPROF, &m);
-}
-
diff --git a/lib/libc/other/_getdents.c b/lib/libc/other/_getdents.c
deleted file mode 100644 (file)
index f5c22e9..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <lib.h>
-#define getdents _getdents
-#include <dirent.h>
-
-PUBLIC ssize_t getdents(fd, buffer, nbytes)
-int fd;
-struct dirent *buffer;
-size_t nbytes;
-{
-  message m;
-
-  m.m1_i1 = fd;
-  m.m1_i2 = nbytes;
-  m.m1_p1 = (char *) buffer;
-  return _syscall(VFS_PROC_NR, GETDENTS, &m);
-}
diff --git a/lib/libc/other/_getngid.c b/lib/libc/other/_getngid.c
deleted file mode 100644 (file)
index bf2e313..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <lib.h>
-#define getngid        _getngid
-#include <unistd.h>
-
-PUBLIC gid_t getngid(endpoint_t proc_ep)
-{
-  message m;
-  m.m1_i1 = proc_ep;           /* search gid for this process */
-  if (_syscall(PM_PROC_NR, GETEPINFO, &m) < 0) return ( (gid_t) -1);
-  return( (gid_t) m.m2_i2);    /* return search result */
-}
diff --git a/lib/libc/other/_getnpid.c b/lib/libc/other/_getnpid.c
deleted file mode 100644 (file)
index 3a1a986..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <lib.h>
-#define getnpid        _getnpid
-#include <unistd.h>
-
-PUBLIC pid_t getnpid(endpoint_t proc_ep)
-{
-  message m;
-  m.m1_i1 = proc_ep;           /* search pid for this process */
-  return _syscall(PM_PROC_NR, GETEPINFO, &m);
-}
diff --git a/lib/libc/other/_getnprocnr.c b/lib/libc/other/_getnprocnr.c
deleted file mode 100644 (file)
index d86813c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <lib.h>
-#define getnprocnr     _getnprocnr
-#include <unistd.h>
-
-
-PUBLIC int getnprocnr(pid_t pid)
-{
-  message m;
-  int t = GETPROCNR;
-  m.m1_i1 = pid;               /* pass pid >=0 to search for */
-  m.m1_i2 = 0;                 /* don't pass name to search for */
-  if (_syscall(PM_PROC_NR, t, &m) < 0) return(-1);
-  return(m.m1_i1);             /* return search result */
-}
-
diff --git a/lib/libc/other/_getnucred.c b/lib/libc/other/_getnucred.c
deleted file mode 100644 (file)
index 4c71aa7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <lib.h>
-#define getnucred      _getnucred
-#include <errno.h>
-#include <sys/ucred.h>
-#include <unistd.h>
-
-PUBLIC int getnucred(endpoint_t proc_ep, struct ucred *ucred)
-{
-  message m;
-  pid_t pid;
-
-  if (ucred == NULL) {
-    errno = EFAULT;
-    return -1;
-  }
-
-  m.m1_i1 = proc_ep;           /* search for this process */
-
-  pid = _syscall(PM_PROC_NR, GETEPINFO, &m);
-  if (pid < 0) {
-     return -1;
-  }
-
-  ucred->pid = pid;
-  ucred->uid = m.PM_NUID;
-  ucred->gid = m.PM_NGID;
-
-  return 0;
-}
diff --git a/lib/libc/other/_getnuid.c b/lib/libc/other/_getnuid.c
deleted file mode 100644 (file)
index 556ff6b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <lib.h>
-#define getnuid        _getnuid
-#include <unistd.h>
-
-PUBLIC uid_t getnuid(endpoint_t proc_ep)
-{
-  message m;
-  m.m1_i1 = proc_ep;           /* search uid for this process */
-  if (_syscall(PM_PROC_NR, GETEPINFO, &m) < 0) return ( (uid_t) -1);
-  return( (uid_t) m.m2_i1);    /* return search result */
-}
diff --git a/lib/libc/other/_getpprocnr.c b/lib/libc/other/_getpprocnr.c
deleted file mode 100644 (file)
index 7ff8500..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <lib.h>
-#define getpprocnr     _getpprocnr
-#include <unistd.h>
-
-
-PUBLIC int getpprocnr()
-{
-  message m;
-  m.m1_i1 = -1;                        /* don't pass pid to search for */
-  m.m1_i2 = 0;                 /* don't pass name to search for */
-  if (_syscall(PM_PROC_NR, GETPROCNR, &m) < 0) return(-1);
-  return(m.m1_i2);             /* return parent process number */
-}
-
diff --git a/lib/libc/other/_getprocnr.c b/lib/libc/other/_getprocnr.c
deleted file mode 100644 (file)
index fa920c8..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <lib.h>
-#define getprocnr      _getprocnr
-#include <unistd.h>
-
-
-PUBLIC int getprocnr()
-{
-  message m;
-  m.m1_i1 = -1;                        /* don't pass pid to search for */
-  m.m1_i2 = 0;                 /* don't pass name to search for */
-  if (_syscall(PM_PROC_NR, GETPROCNR, &m) < 0) return(-1);
-  return(m.m1_i1);             /* return own process number */
-}
-
diff --git a/lib/libc/other/_lseek64.c b/lib/libc/other/_lseek64.c
deleted file mode 100644 (file)
index f7c0a94..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <lib.h>
-#define lseek64        _lseek64
-#include <unistd.h>
-#include <minix/u64.h>
-
-PUBLIC int lseek64(fd, offset, whence, newpos)
-int fd;
-u64_t offset;
-int whence;
-u64_t *newpos;
-{
-  message m;
-
-  m.m2_i1 = fd;
-  m.m2_l1 = ex64lo(offset);
-  m.m2_l2 = ex64hi(offset);
-  m.m2_i2 = whence;
-  if (_syscall(VFS_PROC_NR, LLSEEK, &m) < 0) return -1;
-  if (newpos)
-       *newpos= make64(m.m2_l1, m.m2_l2);
-  return 0;
-}
diff --git a/lib/libc/other/_mapdriver.c b/lib/libc/other/_mapdriver.c
deleted file mode 100644 (file)
index fb08ce7..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <lib.h>
-#define mapdriver      _mapdriver
-#include <string.h>
-#include <unistd.h>
-
-
-PUBLIC int mapdriver(label, major, dev_style, flags)
-char *label;
-int major;
-int dev_style;
-int flags;
-{
-  message m;
-  m.m2_p1 = label;
-  m.m2_l1 = strlen(label);
-  m.m2_i1 = major;
-  m.m2_i2 = dev_style;
-  m.m2_i3 = flags;
-  if (_syscall(VFS_PROC_NR, MAPDRIVER, &m) < 0) return(-1);
-  return(0);
-}
-
diff --git a/lib/libc/other/_mcontext.c b/lib/libc/other/_mcontext.c
deleted file mode 100644 (file)
index cedf8c2..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * mcontext.c
- */
-#include <lib.h>
-#include <ucontext.h>
-#include <unistd.h>
-
-PUBLIC int setmcontext(const mcontext_t *mcp)
-{
-  message m;
-
-  m.m1_p1 = (char *) mcp;
-
-  return(_syscall(PM_PROC_NR, SETMCONTEXT, &m));
-}
-
-
-PUBLIC int getmcontext(mcontext_t *mcp)
-{
-  message m;
-
-  m.m1_p1 = (char *) mcp;
-
-  return(_syscall(PM_PROC_NR, GETMCONTEXT, &m));
-}
-
diff --git a/lib/libc/other/_mount.c b/lib/libc/other/_mount.c
deleted file mode 100644 (file)
index 4567b00..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-
-#include <lib.h>
-#define mount  _mount
-#define umount _umount
-#include <string.h>
-#include <sys/mount.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <minix/syslib.h>
-#include <minix/rs.h>
-#include <paths.h>
-#include <unistd.h>
-#define OK     0
-
-#define FSDEFAULT "mfs"
-
-static char fspath[] = "/sbin/:/usr/pkg/bin/"; /* Must include trailing '/' */
-
-PRIVATE int rs_down(char *label)
-{
-       char cmd[200];
-       if(strlen(_PATH_SERVICE)+strlen(label)+50 >= sizeof(cmd))
-               return -1;
-       sprintf(cmd, _PATH_SERVICE " down '%s'", label);
-       return system(cmd);
-}
-
-PUBLIC int mount(special, name, mountflags, type, args)
-char *name, *special, *type, *args;
-int mountflags;
-{
-  int r;
-  message m;
-  struct stat statbuf;
-  char label[16];
-  char path[PATH_MAX];
-  char cmd[200];
-  char *p;
-  int reuse = 0;
-  int use_existing = 0;
-
-  /* Default values. */
-  if (type == NULL) type = FSDEFAULT;
-  if (args == NULL) args = "";
-  reuse = 0;
-  memset(path, '\0', sizeof(path));
-
-  /* Check mount flags */
-  if(mountflags & MS_REUSE) {
-       reuse = 1;
-       mountflags &= ~MS_REUSE; /* Temporary: turn off to not confuse VFS */
-  }
-  
-  if(mountflags & MS_EXISTING) {
-       use_existing = 1;
-       mountflags &= ~MS_EXISTING; /* Temporary: turn off to not confuse VFS */
-  }
-
-  /* Make a label for the file system process. This label must be unique and
-   * may currently not exceed 16 characters including terminating null. For
-   * requests with an associated block device, we use the last path component
-   * name of the block special file (truncated to 12 characters, which is
-   * hopefully enough). For requests with no associated block device, we use
-   * the device number and inode of the mount point, in hexadecimal form.
-   */
-  if (!use_existing) {
-       if (special) {
-               p = strrchr(special, '/');
-               p = p ? p + 1 : special;
-               if (strchr(p, '\'')) {
-                       errno = EINVAL;
-                       return -1;
-               }
-               sprintf(label, "fs_%.12s", p);
-       } else {
-               if (stat(name, &statbuf) < 0) return -1;
-               sprintf(label, "fs_%04x%x", statbuf.st_dev, statbuf.st_ino);
-       }
-  } else {
-               /* label to long? */
-               if (strlen(type) < 16) {
-                       sprintf(label, "%s", type);
-               } else {
-                       errno = ENOMEM;
-                       return -1;
-               }
-  }
-
-  /* Tell VFS that we are passing in a 16-byte label. */
-  mountflags |= MS_LABEL16;
-
-  /* Sanity check on user input. */
-  if(strchr(args, '\'')) {
-       errno = EINVAL;
-       return -1;
-  }
-  /* start the fs-server if not using existing one */
-  if (!use_existing) {
-       /* See if the given type is even remotely valid. */
-
-       char *testpath;
-       testpath = strtok(fspath, ":");
-
-       do {
-               if (strlen(testpath) + strlen(type) >= sizeof(path)) {
-                       errno = E2BIG;
-                       return(-1);
-               }
-
-               strcpy(path, testpath);
-               strcat(path, type);
-
-               if (access(path, F_OK) == 0) break;
-
-       } while ((testpath = strtok(NULL, ":")) != NULL);
-
-       if (testpath == NULL) {
-               /* We were not able to find type somewhere in "fspath" */
-               errno = EINVAL;
-               return(-1);
-       }
-
-       if (strlen(_PATH_SERVICE) + strlen(path) + strlen(label) +
-           strlen(args) + 50 >= sizeof(cmd)) {
-               errno = E2BIG;
-               return -1;
-       }
-
-       sprintf(cmd, _PATH_SERVICE " %sup %s -label '%s' -args '%s %s %s%s'",
-               reuse ? "-r ": "", path, label, special, name,
-               args[0] ? "-o " : "", args);
-
-       if ((r = system(cmd)) != 0) {
-               fprintf(stderr, "mount: couldn't run %s\n", cmd);
-               errno = r;
-               return -1;
-       }
-  }
-  
-  /* Now perform mount(). */
-  m.m1_i1 = special ? strlen(special) + 1 : 0;
-  m.m1_i2 = strlen(name) + 1;
-  m.m1_i3 = mountflags;
-  m.m1_p1 = special;
-  m.m1_p2 = name;
-  m.m1_p3 = label;
-  r = _syscall(VFS_PROC_NR, MOUNT, &m);
-
-  if (r != OK && !use_existing) {
-       /* If mount() failed, tell RS to shutdown FS process.
-        * No error check - won't do anything with this error anyway.
-        */
-       rs_down(label);
-  }
-
-  return r;
-}
-
-PUBLIC int umount(name)
-_CONST char *name;
-{
-       return umount2(name, 0);
-}
-
-PUBLIC int umount2(name, flags)
-_CONST char *name;
-int flags;
-{
-  message m;
-  int r;
-
-
-  _loadname(name, &m);
-  r = _syscall(VFS_PROC_NR, UMOUNT, &m);
-
-  /* don't shut down the driver when exist flag is set */      
-  if (!(flags & MS_EXISTING)) {
-         if (r == OK) {
-               /* VFS returns the label of the unmounted file system in the reply.
-               * As of writing, the size of the m3_ca1 field is 16 bytes.
-               */
-               rs_down(m.m3_ca1);
-       }
-  }
-
-  return r;
-}
diff --git a/lib/libc/other/_reboot.c b/lib/libc/other/_reboot.c
deleted file mode 100644 (file)
index 39273ba..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* reboot.c - Systemcall interface to mm/signal.c::do_reboot()
-
-   author: Edvard Tuinder  v892231@si.hhs.NL
- */
-
-#include <lib.h>
-#define reboot _reboot
-#include <unistd.h>
-#include <stdarg.h>
-
-int reboot(int how, ...)
-{
-  message m;
-  va_list ap;
-
-  va_start(ap, how);
-  if ((m.m1_i1 = how) == RBT_MONITOR) {
-       m.m1_p1 = va_arg(ap, char *);
-       m.m1_i2 = va_arg(ap, size_t);
-  }
-  va_end(ap);
-
-  return _syscall(PM_PROC_NR, REBOOT, &m);
-}
diff --git a/lib/libc/other/_sbrk.c b/lib/libc/other/_sbrk.c
deleted file mode 100644 (file)
index 9f95f58..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <lib.h>
-#define sbrk   _sbrk
-#include <unistd.h>
-
-extern char *_brksize;
-
-PUBLIC char *sbrk(incr)
-int incr;
-{
-  char *newsize, *oldsize;
-
-  oldsize = _brksize;
-  newsize = _brksize + incr;
-  if ((incr > 0 && newsize < oldsize) || (incr < 0 && newsize > oldsize))
-       return( (char *) -1);
-  if (brk(newsize) == 0)
-       return(oldsize);
-  else
-       return( (char *) -1);
-}
diff --git a/lib/libc/other/_seekdir.c b/lib/libc/other/_seekdir.c
deleted file mode 100644 (file)
index 7c4159c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*     seekdir()                                       Author: Kees J. Bot
- *                                                             24 Apr 1989
- */
-#include <lib.h>
-#define lseek  _lseek
-#define readdir        _readdir
-#define seekdir        _seekdir
-#include <sys/types.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <errno.h>
-
-int seekdir(DIR *dp, off_t pos)
-/* Seek to position pos in a directory. */
-{
-       if (dp == NULL) { errno= EBADF; return -1; }
-
-       dp->_count= 0;
-
-       if (lseek(dp->_fd, pos, SEEK_SET) == -1) return -1;
-
-       return 0;
-}
diff --git a/lib/libc/other/_setgroups.c b/lib/libc/other/_setgroups.c
deleted file mode 100644 (file)
index 71548dc..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-setgroups.c
-*/
-
-#include <lib.h>
-#define setgroups _setgroups
-#include <unistd.h>
-
-int setgroups(int ngroups, const gid_t *gidset)
-{
-  message m;
-
-  m.m1_p1 = (char *) gidset;
-  m.m1_i1 = ngroups;
-
-  return(_syscall(PM_PROC_NR, SETGROUPS, &m));
-}
-
-
diff --git a/lib/libc/other/_sprofile.c b/lib/libc/other/_sprofile.c
deleted file mode 100644 (file)
index 8d119a5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <lib.h>
-
-#define sprofile _sprofile
-
-PUBLIC int sprofile(int action,
-               int size,
-               int freq,
-               int type,
-               char *ctl_ptr,
-               int *mem_ptr)
-{
-  message m;
-
-  m.PROF_ACTION         = action;
-  m.PROF_MEM_SIZE       = size;
-  m.PROF_FREQ           = freq;
-  m.PROF_INTR_TYPE      = type;
-  m.PROF_CTL_PTR        = (void *) ctl_ptr;
-  m.PROF_MEM_PTR        = (void *) mem_ptr;
-
-  return _syscall(PM_PROC_NR, SPROF, &m);
-}
-
diff --git a/lib/libc/other/_svrctl.c b/lib/libc/other/_svrctl.c
deleted file mode 100644 (file)
index 200e289..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*     svrctl() - special server control functions.    Author: Kees J. Bot
- *                                                             24 Apr 1994
- */
-#include <lib.h>
-#include <stdio.h>
-#define svrctl _svrctl
-#include <sys/svrctl.h>
-
-int svrctl(int request, void *argp)
-{
-       message m;
-
-       m.m2_i1 = request;
-       m.m2_p1 = argp;
-
-       switch ((request >> 8) & 0xFF) {
-       case 'M':
-       case 'S':
-               /* PM handles calls for itself and the kernel. */
-               return _syscall(PM_PROC_NR, SVRCTL, &m);
-       case 'F':
-       case 'I':
-               /* VFS handles calls for itself and inet. */
-               return _syscall(VFS_PROC_NR, SVRCTL, &m);
-       default:
-               errno = EINVAL;
-               return -1;
-       }
-}
diff --git a/lib/libc/other/_sysuname.c b/lib/libc/other/_sysuname.c
deleted file mode 100644 (file)
index 04f85cd..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*     sysuname(2) - transfer uname(3) strings.        Author: Kees J. Bot
- *                                                             5 Dec 1992
- */
-
-#define sysuname _sysuname
-#include <lib.h>
-
-int sysuname(int req, int field, char *value, size_t len)
-{
-       message m;
-
-       m.m1_i1 = req;
-       m.m1_i2 = field;
-       m.m1_i3 = len;
-       m.m1_p1 = value;
-
-       /* Clear unused fields */
-       m.m1_p2 = NULL;
-       m.m1_p3 = NULL;
-
-       return _syscall(PM_PROC_NR, SYSUNAME, &m);
-}
-
-/*
- * $PchId: _sysuname.c,v 1.4 1995/11/27 19:42:09 philip Exp $
- */
diff --git a/lib/libc/other/_vm_memctl.c b/lib/libc/other/_vm_memctl.c
deleted file mode 100644 (file)
index 13822f4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define vm_memctl _vm_memctl
-#include <unistd.h>
-
-PUBLIC int vm_memctl(endpoint_t ep, int req)
-{
-       message m;
-       m.VM_RS_CTL_ENDPT = ep;
-       m.VM_RS_CTL_REQ = req;
-
-       return _syscall(VM_PROC_NR, VM_RS_MEMCTL, &m);
-}
diff --git a/lib/libc/other/_vm_query_exit.c b/lib/libc/other/_vm_query_exit.c
deleted file mode 100644 (file)
index 6d07617..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#define _SYSTEM 1
-#include <lib.h>
-#define vm_query_exit _vm_query_exit
-#include <unistd.h>
-
-/* return -1, when the query itself or the processing of query has errors.
- * return 1, when there are more processes waiting to be queried.
- * return 0, when there are no more processes.
- * note that for the return value of 0 and 1, the 'endpt' is set accordingly.
- */
-PUBLIC int vm_query_exit(int *endpt)
-{
-       message m;
-       int r;
-
-       r = _syscall(VM_PROC_NR, VM_QUERY_EXIT, &m);
-       if (r != OK)
-               return -1;
-       if (endpt == NULL)
-               return -1;
-
-       *endpt = m.VM_QUERY_RET_PT;
-       return (m.VM_QUERY_IS_MORE ? 1 : 0);
-}
-
-PUBLIC int vm_watch_exit(endpoint_t ep)
-{
-       message m;
-       int r;
-
-       memset(&m, 0, sizeof(m));
-       m.VM_WE_EP = ep;
-       return _syscall(VM_PROC_NR, VM_WATCH_EXIT, &m);
-}
-
diff --git a/lib/libc/other/_vm_set_priv.c b/lib/libc/other/_vm_set_priv.c
deleted file mode 100644 (file)
index 3c4d9c9..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define vm_set_priv _vm_set_priv
-#include <unistd.h>
-
-PUBLIC int vm_set_priv(int nr, void *buf)
-{
-       message m;
-       m.VM_RS_NR = nr;
-       m.VM_RS_BUF = (long) buf;
-       return _syscall(VM_PROC_NR, VM_RS_SET_PRIV, &m);
-}
-
diff --git a/lib/libc/other/_vm_update.c b/lib/libc/other/_vm_update.c
deleted file mode 100644 (file)
index 12b6231..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define vm_update _vm_update
-#include <unistd.h>
-
-PUBLIC int vm_update(endpoint_t src_e, endpoint_t dst_e)
-{
-       message m;
-       m.VM_RS_SRC_ENDPT = src_e;
-       m.VM_RS_DST_ENDPT = dst_e;
-
-       return _syscall(VM_PROC_NR, VM_RS_UPDATE, &m);
-}
diff --git a/lib/libc/other/basename.c b/lib/libc/other/basename.c
deleted file mode 100644 (file)
index 5de8f7a..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-basename.c
-*/
-
-#include <libgen.h>
-#include <string.h>
-
-char *basename(path)
-char *path;
-{
-       size_t len;
-       char *cp;
-
-       if (path == NULL)
-               return ".";
-       len= strlen(path);
-       if (len == 0)
-               return ".";
-       while (path[len-1] == '/')
-       {
-               if (len == 1)
-                       return path;    /* just "/" */
-               len--;
-               path[len]= '\0';
-       }
-       cp= strrchr(path, '/');
-       if (cp != NULL)
-               return cp+1;
-       return path;
-}
diff --git a/lib/libc/other/bcmp.c b/lib/libc/other/bcmp.c
deleted file mode 100644 (file)
index e9b5f0f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-/* bcmp - Berklix equivalent of memcmp  */
-
-#include <string.h>
-
-int bcmp(s1, s2, length)       /* == 0 or != 0 for equality and inequality */ 
-_CONST void *s1;
-_CONST void *s2;
-size_t length;
-{
-  return(memcmp(s1, s2, length));
-}
diff --git a/lib/libc/other/bcopy.c b/lib/libc/other/bcopy.c
deleted file mode 100644 (file)
index e8f4f7a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-/* bcopy - Berklix equivalent of memcpy  */
-
-#include <string.h>
-
-void bcopy(src, dst, length)
-_CONST void *src;
-void *dst;
-size_t length;
-{
-  (void) memcpy(dst, src, length);
-}
diff --git a/lib/libc/other/bzero.c b/lib/libc/other/bzero.c
deleted file mode 100644 (file)
index fc84249..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <lib.h>
-/* bzero - Berklix subset of memset  */
-
-#include <string.h>
-
-void bzero(dst, length)
-void *dst;
-size_t length;
-{
-  (void) memset(dst, 0, length);
-}
diff --git a/lib/libc/other/ctermid.c b/lib/libc/other/ctermid.c
deleted file mode 100644 (file)
index 8d92d9e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*  ctermid(3)
- *
- *  Author: Terrence Holm          Aug. 1988
- *
- *
- *  Ctermid(3) returns a pointer to a string naming the controlling
- *  terminal. If <name_space> is NULL then local PRIVATE storage
- *  is used, otherwise <name_space> must point to storage of at
- *  least L_ctermid characters.
- *
- *  Returns a pointer to "/dev/tty".
- */
-
-#include <lib.h>
-#include <string.h>
-#include <stdio.h>
-
-_PROTOTYPE( char *ctermid, (char *name_space));
-
-#ifndef L_ctermid
-#define L_ctermid  9
-#endif
-
-char *ctermid(name_space)
-char *name_space;
-{
-  PRIVATE char termid[L_ctermid];
-
-  if (name_space == (char *)NULL) name_space = termid;
-  strcpy(name_space, "/dev/tty");
-  return(name_space);
-}
diff --git a/lib/libc/other/dirname.c b/lib/libc/other/dirname.c
deleted file mode 100755 (executable)
index 1a578ae..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <libgen.h>
-#include <string.h>
-
-/* based on http://www.opengroup.org/onlinepubs/009695399/functions/dirname.html */
-char *dirname(char *path)
-{
-       char *pathend;
-
-       /* remove leading slash(es) except root */
-       pathend = path + strlen(path) - 1;
-       while (pathend > path && *pathend == '/')
-               pathend--;
-       
-       /* remove last path component */
-       while (pathend >= path && *pathend != '/')
-               pathend--;
-
-       /* remove slash(es) before last path component except root */
-       while (pathend > path && *pathend == '/')
-               pathend--;
-
-       /* special case: no slashes */
-       if (pathend < path)
-               return ".";
-
-       /* truncate and return string */
-       pathend[1] = 0;
-       return path;
-}
diff --git a/lib/libc/other/errno.c b/lib/libc/other/errno.c
deleted file mode 100644 (file)
index 538fd57..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#include <lib.h>
-/* errno.c - declare variable errno             Author: F. Meulenbroeks */
-
-int errno = 0;
diff --git a/lib/libc/other/fdopen.c b/lib/libc/other/fdopen.c
deleted file mode 100644 (file)
index 3a72099..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * fdopen - convert a (UNIX) file descriptor into a FILE pointer
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-#include       "../stdio/loc_incl.h"
-#include       <stdio.h>
-#include       <sys/stat.h>
-
-FILE *
-fdopen(fd, mode)
-int fd;
-_CONST char *mode;
-{
-       register int i;
-       struct stat st;
-       FILE *stream;
-       int flags = 0;
-
-       if (fd < 0) return (FILE *)NULL;
-       for (i = 0; __iotab[i] != 0 ; i++) 
-               if (i >= FOPEN_MAX-1)
-                       return (FILE *)NULL;
-
-       switch(*mode++) {
-       case 'r':
-               flags |= _IOREAD | _IOREADING;
-               break;
-       case 'a':
-               flags |= _IOAPPEND;
-       case 'w':
-               flags |= _IOWRITE | _IOWRITING;
-               break;
-       default:
-               return (FILE *)NULL;
-       }
-       while(*mode) {
-               switch(*mode++) {
-               case 'b':
-                       continue;
-               case '+':
-                       flags |= _IOREAD | _IOWRITE;
-                       continue;
-               /* The sequence may be followed by aditional characters */
-               default:
-                       break;
-               }
-               break;
-       }
-
-       if ( fstat( fd, &st ) < 0 ) {
-               return (FILE *)NULL;
-       }
-       
-       if ( st.st_mode & S_IFIFO ) {
-               flags |= _IOFIFO;
-       }
-       
-       if ((stream = (FILE *) malloc(sizeof(FILE))) == NULL) {
-               return (FILE *)NULL;
-       }
-
-       if ((flags & _IOREAD) && (flags & _IOWRITE))
-               flags &= ~(_IOREADING | _IOWRITING);
-
-       stream->_count = 0;
-       stream->_fd = fd;
-       stream->_flags = flags;
-       stream->_buf = NULL;
-       __iotab[i] = stream;
-       return stream;
-}
diff --git a/lib/libc/other/ffs.c b/lib/libc/other/ffs.c
deleted file mode 100644 (file)
index bae6947..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <lib.h>
-/*  ffs(3)
- *
- *  Author: Terrence W. Holm          Sep. 1988
- */
-_PROTOTYPE( int ffs, (int word));
-
-int ffs(word)
-int word;
-{
-  int i;
-
-  if (word == 0) return(0);
-
-  for (i = 1;; ++i, word >>= 1)
-       if (word & 1) return(i);
-}
diff --git a/lib/libc/other/fgetln.c b/lib/libc/other/fgetln.c
deleted file mode 100644 (file)
index 8b9415e..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*     $NetBSD: fgetln.c,v 1.5 2008/04/29 05:46:08 martin Exp $        */
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-/*
- * XXX: This implementation doesn't quite conform to the specification
- * in the man page, in that it only manages one buffer at all, not one
- * per stdio stream. Since the previous implementation did the same,
- * this won't break anything new.
- */
-char *
-fgetln(fp, len)
-       FILE *fp;
-       size_t *len;
-{
-       static char *buf = NULL;
-       static size_t bufsiz = 0;
-       static size_t buflen = 0;
-       int c;
-
-       if (buf == NULL) {
-               bufsiz = BUFSIZ;
-               if ((buf = malloc(bufsiz)) == NULL)
-                       return NULL;
-       }
-
-       buflen = 0;
-       while ((c = fgetc(fp)) != EOF) {
-               if (buflen >= bufsiz) {
-                       size_t nbufsiz = bufsiz + BUFSIZ;
-                       char *nbuf = realloc(buf, nbufsiz);
-
-                       if (nbuf == NULL) {
-                               int oerrno = errno;
-                               free(buf);
-                               errno = oerrno;
-                               buf = NULL;
-                               return NULL;
-                       }
-
-                       buf = nbuf;
-                       bufsiz = nbufsiz;
-               }
-               buf[buflen++] = c;
-               if (c == '\n')
-                       break;
-       }
-       *len = buflen;
-       return buflen == 0 ? NULL : buf;
-}
diff --git a/lib/libc/other/flock.c b/lib/libc/other/flock.c
deleted file mode 100644 (file)
index 20605ef..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-
-/* Library routines
- *
- * Porting to Minix 2.0.0
- * Author:     Giovanni Falzoni <gfalzoni@pointest.com>
- */
-#include <sys/types.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-
-/*
- *     Name:           int flock(int fd, int mode);
- *     Function:       Implements the flock function in Minix.
- */
-int flock(int fd, int mode)
-{
-  struct flock lck;
-  register int retcode;
-
-  memset((void *) &lck, 0, sizeof(struct flock));
-  lck.l_type = mode & ~LOCK_NB;
-  lck.l_pid = getpid();
-  if ((retcode = fcntl(fd, mode & LOCK_NB ? F_SETLK : F_SETLKW, &lck)) < 0 && errno == EAGAIN)
-       errno = EWOULDBLOCK;
-  return retcode;
-}
-
-/** flock.c **/
diff --git a/lib/libc/other/fts.c b/lib/libc/other/fts.c
deleted file mode 100644 (file)
index 843925e..0000000
+++ /dev/null
@@ -1,1212 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     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.
- *
- * $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
- */
-
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fts.c      8.6 (Berkeley) 8/14/94";
-#endif /* LIBC_SCCS and not lint */
-#endif
-
-#define _POSIX_SOURCE 1
-#define _MINIX 1
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <dirent.h>
-#include <limits.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <fts.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include "un-namespace.h"
-
-static FTSENT  *fts_alloc(FTS *, char *, int);
-static FTSENT  *fts_build(FTS *, int);
-static void     fts_lfree(FTSENT *);
-static void     fts_load(FTS *, FTSENT *);
-static size_t   fts_maxarglen(char * const *);
-static void     fts_padjust(FTS *, FTSENT *);
-static int      fts_palloc(FTS *, size_t);
-static FTSENT  *fts_sort(FTS *, FTSENT *, int);
-static u_short  fts_stat(FTS *, FTSENT *, int);
-static int      fts_safe_changedir(FTS *, FTSENT *, int, char *);
-static int      fts_ufslinks(FTS *, const FTSENT *);
-
-#define        ISDOT(a)        (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
-
-#define        CLR(opt)        (sp->fts_options &= ~(opt))
-#define        ISSET(opt)      (sp->fts_options & (opt))
-#define        SET(opt)        (sp->fts_options |= (opt))
-
-#define        FCHDIR(sp, fd)  (!ISSET(FTS_NOCHDIR) && fchdir(fd))
-
-/* fts_build flags */
-#define        BCHILD          1               /* fts_children */
-#define        BNAMES          2               /* fts_children, names only */
-#define        BREAD           3               /* fts_read */
-
-/*
- * Internal representation of an FTS, including extra implementation
- * details.  The FTS returned from fts_open points to this structure's
- * ftsp_fts member (and can be cast to an _fts_private as required)
- */
-struct _fts_private {
-       FTS             ftsp_fts;
-       dev_t           ftsp_dev;
-       int             ftsp_linksreliable;
-};
-
-/*
- * The "FTS_NOSTAT" option can avoid a lot of calls to stat(2) if it
- * knows that a directory could not possibly have subdirectories.  This
- * is decided by looking at the link count: a subdirectory would
- * increment its parent's link count by virtue of its own ".." entry.
- * This assumption only holds for UFS-like filesystems that implement
- * links and directories this way, so we must punt for others.
- */
-
-static const char *ufslike_filesystems[] = {
-       "ufs",
-       "nfs",
-       "nfs4",
-       "ext2fs",
-       0
-};
-
-static void *reallocf(void *ptr, size_t size)
-{
-       void *p;
-       if((p = realloc(ptr, size))) return p;
-       if(ptr) free(ptr);
-       return NULL;
-}
-
-FTS *
-fts_open(argv, options, compar)
-       char * const *argv;
-       int options;
-       int (*compar)(const FTSENT * const *, const FTSENT * const *);
-{
-       struct _fts_private *priv;
-       FTS *sp;
-       FTSENT *p, *root;
-       int nitems;
-       FTSENT *parent, *tmp;
-       int len;
-
-       /* Options check. */
-       if (options & ~FTS_OPTIONMASK) {
-               errno = EINVAL;
-               return (NULL);
-       }
-
-       /* Allocate/initialize the stream. */
-       if ((priv = malloc(sizeof(*priv))) == NULL)
-               return (NULL);
-       memset(priv, 0, sizeof(*priv));
-       sp = &priv->ftsp_fts;
-       sp->fts_compar = compar;
-       sp->fts_options = options;
-
-       /* Shush, GCC. */
-       tmp = NULL;
-
-       /* Logical walks turn on NOCHDIR; symbolic links are too hard. */
-       if (ISSET(FTS_LOGICAL))
-               SET(FTS_NOCHDIR);
-
-       /*
-        * Start out with 1K of path space, and enough, in any case,
-        * to hold the user's paths.
-        */
-       if (fts_palloc(sp, MAX(fts_maxarglen(argv), PATH_MAX)))
-               goto mem1;
-
-       /* Allocate/initialize root's parent. */
-       if ((parent = fts_alloc(sp, "", 0)) == NULL)
-               goto mem2;
-       parent->fts_level = FTS_ROOTPARENTLEVEL;
-
-       /* Allocate/initialize root(s). */
-       for (root = NULL, nitems = 0; *argv != NULL; ++argv, ++nitems) {
-               /* Don't allow zero-length paths. */
-               if ((len = strlen(*argv)) == 0) {
-                       errno = ENOENT;
-                       goto mem3;
-               }
-
-               p = fts_alloc(sp, *argv, len);
-               p->fts_level = FTS_ROOTLEVEL;
-               p->fts_parent = parent;
-               p->fts_accpath = p->fts_name;
-               p->fts_info = fts_stat(sp, p, ISSET(FTS_COMFOLLOW));
-
-               /* Command-line "." and ".." are real directories. */
-               if (p->fts_info == FTS_DOT)
-                       p->fts_info = FTS_D;
-
-               /*
-                * If comparison routine supplied, traverse in sorted
-                * order; otherwise traverse in the order specified.
-                */
-               if (compar) {
-                       p->fts_link = root;
-                       root = p;
-               } else {
-                       p->fts_link = NULL;
-                       if (root == NULL)
-                               tmp = root = p;
-                       else {
-                               tmp->fts_link = p;
-                               tmp = p;
-                       }
-               }
-       }
-       if (compar && nitems > 1)
-               root = fts_sort(sp, root, nitems);
-
-       /*
-        * Allocate a dummy pointer and make fts_read think that we've just
-        * finished the node before the root(s); set p->fts_info to FTS_INIT
-        * so that everything about the "current" node is ignored.
-        */
-       if ((sp->fts_cur = fts_alloc(sp, "", 0)) == NULL)
-               goto mem3;
-       sp->fts_cur->fts_link = root;
-       sp->fts_cur->fts_info = FTS_INIT;
-
-       /*
-        * If using chdir(2), grab a file descriptor pointing to dot to ensure
-        * that we can get back here; this could be avoided for some paths,
-        * but almost certainly not worth the effort.  Slashes, symbolic links,
-        * and ".." are all fairly nasty problems.  Note, if we can't get the
-        * descriptor we run anyway, just more slowly.
-        */
-       if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = _open(".", O_RDONLY, 0)) < 0)
-               SET(FTS_NOCHDIR);
-
-       return (sp);
-
-mem3:  fts_lfree(root);
-       free(parent);
-mem2:  free(sp->fts_path);
-mem1:  free(sp);
-       return (NULL);
-}
-
-static void
-fts_load(sp, p)
-       FTS *sp;
-       FTSENT *p;
-{
-       int len;
-       char *cp;
-
-       /*
-        * Load the stream structure for the next traversal.  Since we don't
-        * actually enter the directory until after the preorder visit, set
-        * the fts_accpath field specially so the chdir gets done to the right
-        * place and the user can access the first node.  From fts_open it's
-        * known that the path will fit.
-        */
-       len = p->fts_pathlen = p->fts_namelen;
-       memmove(sp->fts_path, p->fts_name, len + 1);
-       if ((cp = strrchr(p->fts_name, '/')) && (cp != p->fts_name || cp[1])) {
-               len = strlen(++cp);
-               memmove(p->fts_name, cp, len + 1);
-               p->fts_namelen = len;
-       }
-       p->fts_accpath = p->fts_path = sp->fts_path;
-       sp->fts_dev = p->fts_dev;
-}
-
-int
-fts_close(sp)
-       FTS *sp;
-{
-       FTSENT *freep, *p;
-       int saved_errno;
-
-       /*
-        * This still works if we haven't read anything -- the dummy structure
-        * points to the root list, so we step through to the end of the root
-        * list which has a valid parent pointer.
-        */
-       if (sp->fts_cur) {
-               for (p = sp->fts_cur; p->fts_level >= FTS_ROOTLEVEL;) {
-                       freep = p;
-                       p = p->fts_link != NULL ? p->fts_link : p->fts_parent;
-                       free(freep);
-               }
-               free(p);
-       }
-
-       /* Free up child linked list, sort array, path buffer. */
-       if (sp->fts_child)
-               fts_lfree(sp->fts_child);
-       if (sp->fts_array)
-               free(sp->fts_array);
-       free(sp->fts_path);
-
-       /* Return to original directory, save errno if necessary. */
-       if (!ISSET(FTS_NOCHDIR)) {
-               saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
-               (void)_close(sp->fts_rfd);
-
-               /* Set errno and return. */
-               if (saved_errno != 0) {
-                       /* Free up the stream pointer. */
-                       free(sp);
-                       errno = saved_errno;
-                       return (-1);
-               }
-       }
-
-       /* Free up the stream pointer. */
-       free(sp);
-       return (0);
-}
-
-/*
- * Special case of "/" at the end of the path so that slashes aren't
- * appended which would cause paths to be written as "....//foo".
- */
-#define        NAPPEND(p)                                                      \
-       (p->fts_path[p->fts_pathlen - 1] == '/'                         \
-           ? p->fts_pathlen - 1 : p->fts_pathlen)
-
-FTSENT *
-fts_read(sp)
-       FTS *sp;
-{
-       FTSENT *p, *tmp;
-       int instr;
-       char *t;
-       int saved_errno;
-
-       /* If finished or unrecoverable error, return NULL. */
-       if (sp->fts_cur == NULL || ISSET(FTS_STOP))
-               return (NULL);
-
-       /* Set current node pointer. */
-       p = sp->fts_cur;
-
-       /* Save and zero out user instructions. */
-       instr = p->fts_instr;
-       p->fts_instr = FTS_NOINSTR;
-
-       /* Any type of file may be re-visited; re-stat and re-turn. */
-       if (instr == FTS_AGAIN) {
-               p->fts_info = fts_stat(sp, p, 0);
-               return (p);
-       }
-
-       /*
-        * Following a symlink -- SLNONE test allows application to see
-        * SLNONE and recover.  If indirecting through a symlink, have
-        * keep a pointer to current location.  If unable to get that
-        * pointer, follow fails.
-        */
-       if (instr == FTS_FOLLOW &&
-           (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
-               p->fts_info = fts_stat(sp, p, 1);
-               if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
-                       if ((p->fts_symfd = _open(".", O_RDONLY, 0)) < 0) {
-                               p->fts_errno = errno;
-                               p->fts_info = FTS_ERR;
-                       } else
-                               p->fts_flags |= FTS_SYMFOLLOW;
-               }
-               return (p);
-       }
-
-       /* Directory in pre-order. */
-       if (p->fts_info == FTS_D) {
-               /* If skipped or crossed mount point, do post-order visit. */
-               if (instr == FTS_SKIP ||
-                   (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
-                       if (p->fts_flags & FTS_SYMFOLLOW)
-                               (void)_close(p->fts_symfd);
-                       if (sp->fts_child) {
-                               fts_lfree(sp->fts_child);
-                               sp->fts_child = NULL;
-                       }
-                       p->fts_info = FTS_DP;
-                       return (p);
-               }
-
-               /* Rebuild if only read the names and now traversing. */
-               if (sp->fts_child != NULL && ISSET(FTS_NAMEONLY)) {
-                       CLR(FTS_NAMEONLY);
-                       fts_lfree(sp->fts_child);
-                       sp->fts_child = NULL;
-               }
-
-               /*
-                * Cd to the subdirectory.
-                *
-                * If have already read and now fail to chdir, whack the list
-                * to make the names come out right, and set the parent errno
-                * so the application will eventually get an error condition.
-                * Set the FTS_DONTCHDIR flag so that when we logically change
-                * directories back to the parent we don't do a chdir.
-                *
-                * If haven't read do so.  If the read fails, fts_build sets
-                * FTS_STOP or the fts_info field of the node.
-                */
-               if (sp->fts_child != NULL) {
-                       if (fts_safe_changedir(sp, p, -1, p->fts_accpath)) {
-                               p->fts_errno = errno;
-                               p->fts_flags |= FTS_DONTCHDIR;
-                               for (p = sp->fts_child; p != NULL;
-                                   p = p->fts_link)
-                                       p->fts_accpath =
-                                           p->fts_parent->fts_accpath;
-                       }
-               } else if ((sp->fts_child = fts_build(sp, BREAD)) == NULL) {
-                       if (ISSET(FTS_STOP))
-                               return (NULL);
-                       return (p);
-               }
-               p = sp->fts_child;
-               sp->fts_child = NULL;
-               goto name;
-       }
-
-       /* Move to the next node on this level. */
-next:  tmp = p;
-       if ((p = p->fts_link) != NULL) {
-               free(tmp);
-
-               /*
-                * If reached the top, return to the original directory (or
-                * the root of the tree), and load the paths for the next root.
-                */
-               if (p->fts_level == FTS_ROOTLEVEL) {
-                       if (FCHDIR(sp, sp->fts_rfd)) {
-                               SET(FTS_STOP);
-                               return (NULL);
-                       }
-                       fts_load(sp, p);
-                       return (sp->fts_cur = p);
-               }
-
-               /*
-                * User may have called fts_set on the node.  If skipped,
-                * ignore.  If followed, get a file descriptor so we can
-                * get back if necessary.
-                */
-               if (p->fts_instr == FTS_SKIP)
-                       goto next;
-               if (p->fts_instr == FTS_FOLLOW) {
-                       p->fts_info = fts_stat(sp, p, 1);
-                       if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
-                               if ((p->fts_symfd =
-                                   _open(".", O_RDONLY, 0)) < 0) {
-                                       p->fts_errno = errno;
-                                       p->fts_info = FTS_ERR;
-                               } else
-                                       p->fts_flags |= FTS_SYMFOLLOW;
-                       }
-                       p->fts_instr = FTS_NOINSTR;
-               }
-
-name:          t = sp->fts_path + NAPPEND(p->fts_parent);
-               *t++ = '/';
-               memmove(t, p->fts_name, p->fts_namelen + 1);
-               return (sp->fts_cur = p);
-       }
-
-       /* Move up to the parent node. */
-       p = tmp->fts_parent;
-       free(tmp);
-
-       if (p->fts_level == FTS_ROOTPARENTLEVEL) {
-               /*
-                * Done; free everything up and set errno to 0 so the user
-                * can distinguish between error and EOF.
-                */
-               free(p);
-               errno = 0;
-               return (sp->fts_cur = NULL);
-       }
-
-       /* NUL terminate the pathname. */
-       sp->fts_path[p->fts_pathlen] = '\0';
-
-       /*
-        * Return to the parent directory.  If at a root node or came through
-        * a symlink, go back through the file descriptor.  Otherwise, cd up
-        * one directory.
-        */
-       if (p->fts_level == FTS_ROOTLEVEL) {
-               if (FCHDIR(sp, sp->fts_rfd)) {
-                       SET(FTS_STOP);
-                       return (NULL);
-               }
-       } else if (p->fts_flags & FTS_SYMFOLLOW) {
-               if (FCHDIR(sp, p->fts_symfd)) {
-                       saved_errno = errno;
-                       (void)_close(p->fts_symfd);
-                       errno = saved_errno;
-                       SET(FTS_STOP);
-                       return (NULL);
-               }
-               (void)_close(p->fts_symfd);
-       } else if (!(p->fts_flags & FTS_DONTCHDIR) &&
-           fts_safe_changedir(sp, p->fts_parent, -1, "..")) {
-               SET(FTS_STOP);
-               return (NULL);
-       }
-       p->fts_info = p->fts_errno ? FTS_ERR : FTS_DP;
-       return (sp->fts_cur = p);
-}
-
-/*
- * Fts_set takes the stream as an argument although it's not used in this
- * implementation; it would be necessary if anyone wanted to add global
- * semantics to fts using fts_set.  An error return is allowed for similar
- * reasons.
- */
-/* ARGSUSED */
-int
-fts_set(sp, p, instr)
-       FTS *sp;
-       FTSENT *p;
-       int instr;
-{
-       if (instr != 0 && instr != FTS_AGAIN && instr != FTS_FOLLOW &&
-           instr != FTS_NOINSTR && instr != FTS_SKIP) {
-               errno = EINVAL;
-               return (1);
-       }
-       p->fts_instr = instr;
-       return (0);
-}
-
-FTSENT *
-fts_children(sp, instr)
-       FTS *sp;
-       int instr;
-{
-       FTSENT *p;
-       int fd;
-
-       if (instr != 0 && instr != FTS_NAMEONLY) {
-               errno = EINVAL;
-               return (NULL);
-       }
-
-       /* Set current node pointer. */
-       p = sp->fts_cur;
-
-       /*
-        * Errno set to 0 so user can distinguish empty directory from
-        * an error.
-        */
-       errno = 0;
-
-       /* Fatal errors stop here. */
-       if (ISSET(FTS_STOP))
-               return (NULL);
-
-       /* Return logical hierarchy of user's arguments. */
-       if (p->fts_info == FTS_INIT)
-               return (p->fts_link);
-
-       /*
-        * If not a directory being visited in pre-order, stop here.  Could
-        * allow FTS_DNR, assuming the user has fixed the problem, but the
-        * same effect is available with FTS_AGAIN.
-        */
-       if (p->fts_info != FTS_D /* && p->fts_info != FTS_DNR */)
-               return (NULL);
-
-       /* Free up any previous child list. */
-       if (sp->fts_child != NULL)
-               fts_lfree(sp->fts_child);
-
-       if (instr == FTS_NAMEONLY) {
-               SET(FTS_NAMEONLY);
-               instr = BNAMES;
-       } else
-               instr = BCHILD;
-
-       /*
-        * If using chdir on a relative path and called BEFORE fts_read does
-        * its chdir to the root of a traversal, we can lose -- we need to
-        * chdir into the subdirectory, and we don't know where the current
-        * directory is, so we can't get back so that the upcoming chdir by
-        * fts_read will work.
-        */
-       if (p->fts_level != FTS_ROOTLEVEL || p->fts_accpath[0] == '/' ||
-           ISSET(FTS_NOCHDIR))
-               return (sp->fts_child = fts_build(sp, instr));
-
-       if ((fd = _open(".", O_RDONLY, 0)) < 0)
-               return (NULL);
-       sp->fts_child = fts_build(sp, instr);
-       if (fchdir(fd))
-               return (NULL);
-       (void)_close(fd);
-       return (sp->fts_child);
-}
-
-#ifndef fts_get_clientptr
-#error "fts_get_clientptr not defined"
-#endif
-
-void *
-(fts_get_clientptr)(FTS *sp)
-{
-
-       return (fts_get_clientptr(sp));
-}
-
-#ifndef fts_get_stream
-#error "fts_get_stream not defined"
-#endif
-
-FTS *
-(fts_get_stream)(FTSENT *p)
-{
-       return (fts_get_stream(p));
-}
-
-void
-fts_set_clientptr(FTS *sp, void *clientptr)
-{
-
-       sp->fts_clientptr = clientptr;
-}
-
-/*
- * This is the tricky part -- do not casually change *anything* in here.  The
- * idea is to build the linked list of entries that are used by fts_children
- * and fts_read.  There are lots of special cases.
- *
- * The real slowdown in walking the tree is the stat calls.  If FTS_NOSTAT is
- * set and it's a physical walk (so that symbolic links can't be directories),
- * we can do things quickly.  First, if it's a 4.4BSD file system, the type
- * of the file is in the directory entry.  Otherwise, we assume that the number
- * of subdirectories in a node is equal to the number of links to the parent.
- * The former skips all stat calls.  The latter skips stat calls in any leaf
- * directories and for any files after the subdirectories in the directory have
- * been found, cutting the stat calls by about 2/3.
- */
-static FTSENT *
-fts_build(sp, type)
-       FTS *sp;
-       int type;
-{
-       struct dirent *dp;
-       FTSENT *p, *head;
-       int nitems;
-       FTSENT *cur, *tail;
-       DIR *dirp;
-       void *oldaddr;
-       size_t dnamlen;
-       int cderrno, descend, len, level, maxlen, nlinks, oflag, saved_errno,
-           nostat, doadjust;
-       char *cp;
-
-       /* Set current node pointer. */
-       cur = sp->fts_cur;
-
-       /*
-        * Open the directory for reading.  If this fails, we're done.
-        * If being called from fts_read, set the fts_info field.
-        */
-#ifdef FTS_WHITEOUT
-       if (ISSET(FTS_WHITEOUT))
-               oflag = DTF_NODUP | DTF_REWIND;
-       else
-               oflag = DTF_HIDEW | DTF_NODUP | DTF_REWIND;
-#else
-#define __opendir2(path, flag) opendir(path)
-#endif
-       if ((dirp = __opendir2(cur->fts_accpath, oflag)) == NULL) {
-               if (type == BREAD) {
-                       cur->fts_info = FTS_DNR;
-                       cur->fts_errno = errno;
-               }
-               return (NULL);
-       }
-
-       /*
-        * Nlinks is the number of possible entries of type directory in the
-        * directory if we're cheating on stat calls, 0 if we're not doing
-        * any stat calls at all, -1 if we're doing stats on everything.
-        */
-       if (type == BNAMES) {
-               nlinks = 0;
-               /* Be quiet about nostat, GCC. */
-               nostat = 0;
-       } else if (ISSET(FTS_NOSTAT) && ISSET(FTS_PHYSICAL)) {
-               if (fts_ufslinks(sp, cur))
-                       nlinks = cur->fts_nlink - (ISSET(FTS_SEEDOT) ? 0 : 2);
-               else
-                       nlinks = -1;
-               nostat = 1;
-       } else {
-               nlinks = -1;
-               nostat = 0;
-       }
-
-#ifdef notdef
-       (void)printf("nlinks == %d (cur: %d)\n", nlinks, cur->fts_nlink);
-       (void)printf("NOSTAT %d PHYSICAL %d SEEDOT %d\n",
-           ISSET(FTS_NOSTAT), ISSET(FTS_PHYSICAL), ISSET(FTS_SEEDOT));
-#endif
-       /*
-        * If we're going to need to stat anything or we want to descend
-        * and stay in the directory, chdir.  If this fails we keep going,
-        * but set a flag so we don't chdir after the post-order visit.
-        * We won't be able to stat anything, but we can still return the
-        * names themselves.  Note, that since fts_read won't be able to
-        * chdir into the directory, it will have to return different path
-        * names than before, i.e. "a/b" instead of "b".  Since the node
-        * has already been visited in pre-order, have to wait until the
-        * post-order visit to return the error.  There is a special case
-        * here, if there was nothing to stat then it's not an error to
-        * not be able to stat.  This is all fairly nasty.  If a program
-        * needed sorted entries or stat information, they had better be
-        * checking FTS_NS on the returned nodes.
-        */
-       cderrno = 0;
-       if (nlinks || type == BREAD) {
-               if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) {
-                       if (nlinks && type == BREAD)
-                               cur->fts_errno = errno;
-                       cur->fts_flags |= FTS_DONTCHDIR;
-                       descend = 0;
-                       cderrno = errno;
-               } else
-                       descend = 1;
-       } else
-               descend = 0;
-
-       /*
-        * Figure out the max file name length that can be stored in the
-        * current path -- the inner loop allocates more path as necessary.
-        * We really wouldn't have to do the maxlen calculations here, we
-        * could do them in fts_read before returning the path, but it's a
-        * lot easier here since the length is part of the dirent structure.
-        *
-        * If not changing directories set a pointer so that can just append
-        * each new name into the path.
-        */
-       len = NAPPEND(cur);
-       if (ISSET(FTS_NOCHDIR)) {
-               cp = sp->fts_path + len;
-               *cp++ = '/';
-       } else {
-               /* GCC, you're too verbose. */
-               cp = NULL;
-       }
-       len++;
-       maxlen = sp->fts_pathlen - len;
-
-       level = cur->fts_level + 1;
-
-       /* Read the directory, attaching each entry to the `link' pointer. */
-       doadjust = 0;
-       for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) {
-               dnamlen = strlen(dp->d_name);
-               if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
-                       continue;
-
-               if ((p = fts_alloc(sp, dp->d_name, (int)dnamlen)) == NULL)
-                       goto mem1;
-               if (dnamlen >= maxlen) {        /* include space for NUL */
-                       oldaddr = sp->fts_path;
-                       if (fts_palloc(sp, dnamlen + len + 1)) {
-                               /*
-                                * No more memory for path or structures.  Save
-                                * errno, free up the current structure and the
-                                * structures already allocated.
-                                */
-mem1:                          saved_errno = errno;
-                               if (p)
-                                       free(p);
-                               fts_lfree(head);
-                               (void)closedir(dirp);
-                               cur->fts_info = FTS_ERR;
-                               SET(FTS_STOP);
-                               errno = saved_errno;
-                               return (NULL);
-                       }
-                       /* Did realloc() change the pointer? */
-                       if (oldaddr != sp->fts_path) {
-                               doadjust = 1;
-                               if (ISSET(FTS_NOCHDIR))
-                                       cp = sp->fts_path + len;
-                       }
-                       maxlen = sp->fts_pathlen - len;
-               }
-
-               if (len + dnamlen >= USHRT_MAX) {
-                       /*
-                        * In an FTSENT, fts_pathlen is a u_short so it is
-                        * possible to wraparound here.  If we do, free up
-                        * the current structure and the structures already
-                        * allocated, then error out with ENAMETOOLONG.
-                        */
-                       free(p);
-                       fts_lfree(head);
-                       (void)closedir(dirp);
-                       cur->fts_info = FTS_ERR;
-                       SET(FTS_STOP);
-                       errno = ENAMETOOLONG;
-                       return (NULL);
-               }
-               p->fts_level = level;
-               p->fts_parent = sp->fts_cur;
-               p->fts_pathlen = len + dnamlen;
-
-#ifdef FTS_WHITEOUT
-               if (dp->d_type == DT_WHT)
-                       p->fts_flags |= FTS_ISW;
-#endif
-
-               if (cderrno) {
-                       if (nlinks) {
-                               p->fts_info = FTS_NS;
-                               p->fts_errno = cderrno;
-                       } else
-                               p->fts_info = FTS_NSOK;
-                       p->fts_accpath = cur->fts_accpath;
-               } else if (nlinks == 0
-#ifdef DT_DIR
-                   || (nostat &&
-                   dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
-#endif
-                   ) {
-                       p->fts_accpath =
-                           ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name;
-                       p->fts_info = FTS_NSOK;
-               } else {
-                       /* Build a file name for fts_stat to stat. */
-                       if (ISSET(FTS_NOCHDIR)) {
-                               p->fts_accpath = p->fts_path;
-                               memmove(cp, p->fts_name, p->fts_namelen + 1);
-                       } else
-                               p->fts_accpath = p->fts_name;
-                       /* Stat it. */
-                       p->fts_info = fts_stat(sp, p, 0);
-
-                       /* Decrement link count if applicable. */
-                       if (nlinks > 0 && (p->fts_info == FTS_D ||
-                           p->fts_info == FTS_DC || p->fts_info == FTS_DOT))
-                               --nlinks;
-               }
-
-               /* We walk in directory order so "ls -f" doesn't get upset. */
-               p->fts_link = NULL;
-               if (head == NULL)
-                       head = tail = p;
-               else {
-                       tail->fts_link = p;
-                       tail = p;
-               }
-               ++nitems;
-       }
-       if (dirp)
-               (void)closedir(dirp);
-
-       /*
-        * If realloc() changed the address of the path, adjust the
-        * addresses for the rest of the tree and the dir list.
-        */
-       if (doadjust)
-               fts_padjust(sp, head);
-
-       /*
-        * If not changing directories, reset the path back to original
-        * state.
-        */
-       if (ISSET(FTS_NOCHDIR)) {
-               if (len == sp->fts_pathlen || nitems == 0)
-                       --cp;
-               *cp = '\0';
-       }
-
-       /*
-        * If descended after called from fts_children or after called from
-        * fts_read and nothing found, get back.  At the root level we use
-        * the saved fd; if one of fts_open()'s arguments is a relative path
-        * to an empty directory, we wind up here with no other way back.  If
-        * can't get back, we're done.
-        */
-       if (descend && (type == BCHILD || !nitems) &&
-           (cur->fts_level == FTS_ROOTLEVEL ?
-           FCHDIR(sp, sp->fts_rfd) :
-           fts_safe_changedir(sp, cur->fts_parent, -1, ".."))) {
-               cur->fts_info = FTS_ERR;
-               SET(FTS_STOP);
-               return (NULL);
-       }
-
-       /* If didn't find anything, return NULL. */
-       if (!nitems) {
-               if (type == BREAD)
-                       cur->fts_info = FTS_DP;
-               return (NULL);
-       }
-
-       /* Sort the entries. */
-       if (sp->fts_compar && nitems > 1)
-               head = fts_sort(sp, head, nitems);
-       return (head);
-}
-
-static u_short
-fts_stat(sp, p, follow)
-       FTS *sp;
-       FTSENT *p;
-       int follow;
-{
-       FTSENT *t;
-       dev_t dev;
-       ino_t ino;
-       struct stat *sbp, sb;
-       int saved_errno;
-
-       /* If user needs stat info, stat buffer already allocated. */
-       sbp = ISSET(FTS_NOSTAT) ? &sb : p->fts_statp;
-
-#ifdef FTS_WHITEOUT
-       /* Check for whiteout. */
-       if (p->fts_flags & FTS_ISW) {
-               if (sbp != &sb) {
-                       memset(sbp, '\0', sizeof(*sbp));
-                       sbp->st_mode = S_IFWHT;
-               }
-               return (FTS_W);
-       }
-#endif
-
-       /*
-        * If doing a logical walk, or application requested FTS_FOLLOW, do
-        * a stat(2).  If that fails, check for a non-existent symlink.  If
-        * fail, set the errno from the stat call.
-        */
-       if (ISSET(FTS_LOGICAL) || follow) {
-               if (stat(p->fts_accpath, sbp)) {
-                       saved_errno = errno;
-                       if (!lstat(p->fts_accpath, sbp)) {
-                               errno = 0;
-                               return (FTS_SLNONE);
-                       }
-                       p->fts_errno = saved_errno;
-                       goto err;
-               }
-       } else if (lstat(p->fts_accpath, sbp)) {
-               p->fts_errno = errno;
-err:           memset(sbp, 0, sizeof(struct stat));
-               return (FTS_NS);
-       }
-
-       if (S_ISDIR(sbp->st_mode)) {
-               /*
-                * Set the device/inode.  Used to find cycles and check for
-                * crossing mount points.  Also remember the link count, used
-                * in fts_build to limit the number of stat calls.  It is
-                * understood that these fields are only referenced if fts_info
-                * is set to FTS_D.
-                */
-               dev = p->fts_dev = sbp->st_dev;
-               ino = p->fts_ino = sbp->st_ino;
-               p->fts_nlink = sbp->st_nlink;
-
-               if (ISDOT(p->fts_name))
-                       return (FTS_DOT);
-
-               /*
-                * Cycle detection is done by brute force when the directory
-                * is first encountered.  If the tree gets deep enough or the
-                * number of symbolic links to directories is high enough,
-                * something faster might be worthwhile.
-                */
-               for (t = p->fts_parent;
-                   t->fts_level >= FTS_ROOTLEVEL; t = t->fts_parent)
-                       if (ino == t->fts_ino && dev == t->fts_dev) {
-                               p->fts_cycle = t;
-                               return (FTS_DC);
-                       }
-               return (FTS_D);
-       }
-       if (S_ISLNK(sbp->st_mode))
-               return (FTS_SL);
-       if (S_ISREG(sbp->st_mode))
-               return (FTS_F);
-       return (FTS_DEFAULT);
-}
-
-/*
- * The comparison function takes pointers to pointers to FTSENT structures.
- * Qsort wants a comparison function that takes pointers to void.
- * (Both with appropriate levels of const-poisoning, of course!)
- * Use a trampoline function to deal with the difference.
- */
-static int
-fts_compar(const void *a, const void *b)
-{
-       FTS *parent;
-
-       parent = (*(const FTSENT * const *)a)->fts_fts;
-       return (*parent->fts_compar)(a, b);
-}
-
-static FTSENT *
-fts_sort(sp, head, nitems)
-       FTS *sp;
-       FTSENT *head;
-       int nitems;
-{
-       FTSENT **ap, *p;
-
-       /*
-        * Construct an array of pointers to the structures and call qsort(3).
-        * Reassemble the array in the order returned by qsort.  If unable to
-        * sort for memory reasons, return the directory entries in their
-        * current order.  Allocate enough space for the current needs plus
-        * 40 so don't realloc one entry at a time.
-        */
-       if (nitems > sp->fts_nitems) {
-               sp->fts_nitems = nitems + 40;
-               if ((sp->fts_array = reallocf(sp->fts_array,
-                   sp->fts_nitems * sizeof(FTSENT *))) == NULL) {
-                       sp->fts_nitems = 0;
-                       return (head);
-               }
-       }
-       for (ap = sp->fts_array, p = head; p; p = p->fts_link)
-               *ap++ = p;
-       qsort(sp->fts_array, nitems, sizeof(FTSENT *), fts_compar);
-       for (head = *(ap = sp->fts_array); --nitems; ++ap)
-               ap[0]->fts_link = ap[1];
-       ap[0]->fts_link = NULL;
-       return (head);
-}
-
-static FTSENT *
-fts_alloc(sp, name, namelen)
-       FTS *sp;
-       char *name;
-       int namelen;
-{
-       FTSENT *p;
-       size_t len;
-
-       struct ftsent_withstat {
-               FTSENT  ent;
-               struct  stat statbuf;
-       };
-
-       /*
-        * The file name is a variable length array and no stat structure is
-        * necessary if the user has set the nostat bit.  Allocate the FTSENT
-        * structure, the file name and the stat structure in one chunk, but
-        * be careful that the stat structure is reasonably aligned.
-        */
-       if (ISSET(FTS_NOSTAT))
-               len = sizeof(FTSENT) + namelen + 1;
-       else
-               len = sizeof(struct ftsent_withstat) + namelen + 1;
-
-       if ((p = malloc(len)) == NULL)
-               return (NULL);
-
-       if (ISSET(FTS_NOSTAT)) {
-               p->fts_name = (char *)(p + 1);
-               p->fts_statp = NULL;
-       } else {
-               p->fts_name = (char *)((struct ftsent_withstat *)p + 1);
-               p->fts_statp = &((struct ftsent_withstat *)p)->statbuf;
-       }
-
-       /* Copy the name and guarantee NUL termination. */
-       memcpy(p->fts_name, name, namelen);
-       p->fts_name[namelen] = '\0';
-       p->fts_namelen = namelen;
-       p->fts_path = sp->fts_path;
-       p->fts_errno = 0;
-       p->fts_flags = 0;
-       p->fts_instr = FTS_NOINSTR;
-       p->fts_number = 0;
-       p->fts_pointer = NULL;
-       p->fts_fts = sp;
-       return (p);
-}
-
-static void
-fts_lfree(head)
-       FTSENT *head;
-{
-       FTSENT *p;
-
-       /* Free a linked list of structures. */
-       while ((p = head)) {
-               head = head->fts_link;
-               free(p);
-       }
-}
-
-/*
- * Allow essentially unlimited paths; find, rm, ls should all work on any tree.
- * Most systems will allow creation of paths much longer than PATH_MAX, even
- * though the kernel won't resolve them.  Add the size (not just what's needed)
- * plus 256 bytes so don't realloc the path 2 bytes at a time.
- */
-static int
-fts_palloc(sp, more)
-       FTS *sp;
-       size_t more;
-{
-
-       sp->fts_pathlen += more + 256;
-       /*
-        * Check for possible wraparound.  In an FTS, fts_pathlen is
-        * a signed int but in an FTSENT it is an unsigned short.
-        * We limit fts_pathlen to USHRT_MAX to be safe in both cases.
-        */
-       if (sp->fts_pathlen < 0 || sp->fts_pathlen >= USHRT_MAX) {
-               if (sp->fts_path)
-                       free(sp->fts_path);
-               sp->fts_path = NULL;
-               errno = ENAMETOOLONG;
-               return (1);
-       }
-       sp->fts_path = reallocf(sp->fts_path, sp->fts_pathlen);
-       return (sp->fts_path == NULL);
-}
-
-/*
- * When the path is realloc'd, have to fix all of the pointers in structures
- * already returned.
- */
-static void
-fts_padjust(sp, head)
-       FTS *sp;
-       FTSENT *head;
-{
-       FTSENT *p;
-       char *addr = sp->fts_path;
-
-#define        ADJUST(p) do {                                                  \
-       if ((p)->fts_accpath != (p)->fts_name) {                        \
-               (p)->fts_accpath =                                      \
-                   (char *)addr + ((p)->fts_accpath - (p)->fts_path);  \
-       }                                                               \
-       (p)->fts_path = addr;                                           \
-} while (0)
-       /* Adjust the current set of children. */
-       for (p = sp->fts_child; p; p = p->fts_link)
-               ADJUST(p);
-
-       /* Adjust the rest of the tree, including the current level. */
-       for (p = head; p->fts_level >= FTS_ROOTLEVEL;) {
-               ADJUST(p);
-               p = p->fts_link ? p->fts_link : p->fts_parent;
-       }
-}
-
-static size_t
-fts_maxarglen(argv)
-       char * const *argv;
-{
-       size_t len, max;
-
-       for (max = 0; *argv; ++argv)
-               if ((len = strlen(*argv)) > max)
-                       max = len;
-       return (max + 1);
-}
-
-/*
- * Change to dir specified by fd or p->fts_accpath without getting
- * tricked by someone changing the world out from underneath us.
- * Assumes p->fts_dev and p->fts_ino are filled in.
- */
-static int
-fts_safe_changedir(sp, p, fd, path)
-       FTS *sp;
-       FTSENT *p;
-       int fd;
-       char *path;
-{
-       int ret, oerrno, newfd;
-       struct stat sb;
-
-       newfd = fd;
-       if (ISSET(FTS_NOCHDIR))
-               return (0);
-       if (fd < 0 && (newfd = _open(path, O_RDONLY, 0)) < 0)
-               return (-1);
-       if (_fstat(newfd, &sb)) {
-               ret = -1;
-               goto bail;
-       }
-       if (p->fts_dev != sb.st_dev || p->fts_ino != sb.st_ino) {
-               errno = ENOENT;         /* disinformation */
-               ret = -1;
-               goto bail;
-       }
-       ret = fchdir(newfd);
-bail:
-       oerrno = errno;
-       if (fd < 0)
-               (void)_close(newfd);
-       errno = oerrno;
-       return (ret);
-}
-
-/*
- * Check if the filesystem for "ent" has UFS-style links.
- */
-static int
-fts_ufslinks(FTS *sp, const FTSENT *ent)
-{
-       struct _fts_private *priv;
-
-       priv = (struct _fts_private *)sp;
-       priv->ftsp_linksreliable = 0;
-       return 0;
-}
diff --git a/lib/libc/other/getgrent.c b/lib/libc/other/getgrent.c
deleted file mode 100644 (file)
index b2095e2..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/*     getgrent(), getgrgid(), getgrnam() - group file routines
- *
- *                                                     Author: Kees J. Bot
- *                                                             31 Jan 1994
- */
-#define open _open
-#define fcntl _fcntl
-#define read _read
-#define close _close
-#include <sys/types.h>
-#include <grp.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#define arraysize(a)   (sizeof(a) / sizeof((a)[0]))
-#define arraylimit(a)  ((a) + arraysize(a))
-
-static char GROUP[]= "/etc/group";     /* The group file. */
-static const char *grfile;             /* Current group file. */
-
-static char buf[1024];                 /* Read buffer. */
-static char grline[512];               /* One line from the group file. */
-static struct group entry;             /* Entry to fill and return. */
-static char *members[64];              /* Group members with the entry. */
-static int grfd= -1;                   /* Filedescriptor to the file. */
-static char *bufptr;                   /* Place in buf. */
-static ssize_t buflen= 0;              /* Remaining characters in buf. */
-static char *lineptr;                  /* Place in the line. */
-
-void endgrent(void)
-/* Close the group file. */
-{
-       if (grfd >= 0) {
-               (void) close(grfd);
-               grfd= -1;
-               buflen= 0;
-       }
-}
-
-int setgrent(void)
-/* Open the group file. */
-{
-       if (grfd >= 0) endgrent();
-
-       if (grfile == NULL) grfile= GROUP;
-
-       if ((grfd= open(grfile, O_RDONLY)) < 0) return -1;
-       (void) fcntl(grfd, F_SETFD, fcntl(grfd, F_GETFD) | FD_CLOEXEC);
-       return 0;
-}
-
-void setgrfile(const char *file)
-/* Prepare for reading an alternate group file. */
-{
-       endgrent();
-       grfile= file;
-}
-
-static int getline(void)
-/* Get one line from the group file, return 0 if bad or EOF. */
-{
-       lineptr= grline;
-
-       do {
-               if (buflen == 0) {
-                       if ((buflen= read(grfd, buf, sizeof(buf))) <= 0)
-                               return 0;
-                       bufptr= buf;
-               }
-
-               if (lineptr == arraylimit(grline)) return 0;
-               buflen--;
-       } while ((*lineptr++ = *bufptr++) != '\n');
-
-       lineptr= grline;
-       return 1;
-}
-
-static char *scan_punct(int punct)
-/* Scan for a field separator in a line, return the start of the field. */
-{
-       char *field= lineptr;
-       char *last;
-
-       for (;;) {
-               last= lineptr;
-               if (*lineptr == 0) return NULL;
-               if (*lineptr == '\n') break;
-               if (*lineptr++ == punct) break;
-               if (lineptr[-1] == ':') return NULL;    /* :::,,,:,,,? */
-       }
-       *last= 0;
-       return field;
-}
-
-struct group *getgrent(void)
-/* Read one entry from the group file. */
-{
-       char *p;
-       char **mem;
-
-       /* Open the file if not yet open. */
-       if (grfd < 0 && setgrent() < 0) return NULL;
-
-       /* Until a good line is read. */
-       for (;;) {
-               if (!getline()) return NULL;    /* EOF or corrupt. */
-
-               if ((entry.gr_name= scan_punct(':')) == NULL) continue;
-               if ((entry.gr_passwd= scan_punct(':')) == NULL) continue;
-               if ((p= scan_punct(':')) == NULL) continue;
-               entry.gr_gid= strtol(p, NULL, 0);
-
-               entry.gr_mem= mem= members;
-               if (*lineptr != '\n') {
-                       do {
-                               if ((*mem= scan_punct(',')) == NULL) goto again;
-                               if (mem < arraylimit(members) - 1) mem++;
-                       } while (*lineptr != 0);
-               }
-               *mem= NULL;
-               return &entry;
-       again:;
-       }
-}
-
-struct group *getgrgid(gid_t gid)
-/* Return the group file entry belonging to the user-id. */
-{
-       struct group *gr;
-
-       endgrent();
-       while ((gr= getgrent()) != NULL && gr->gr_gid != gid) {}
-       endgrent();
-       return gr;
-}
-
-struct group *getgrnam(const char *name)
-/* Return the group file entry belonging to the user name. */
-{
-       struct group *gr;
-
-       endgrent();
-       while ((gr= getgrent()) != NULL && strcmp(gr->gr_name, name) != 0) {}
-       endgrent();
-       return gr;
-}
diff --git a/lib/libc/other/getlogin.c b/lib/libc/other/getlogin.c
deleted file mode 100644 (file)
index fe0a34e..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*  getlogin(3)
- *
- *  Author: Terrence W. Holm          Aug. 1988
- */
-
-#include <lib.h>
-#include <pwd.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-
-#ifndef  L_cuserid
-#define  L_cuserid   9
-#endif
-
-char *getlogin()
-{
-  PRIVATE char userid[L_cuserid];
-  struct passwd *pw_entry;
-
-  pw_entry = getpwuid(getuid());
-
-  if (pw_entry == (struct passwd *)NULL) return((char *)NULL);
-
-  strcpy(userid, pw_entry->pw_name);
-
-  return(userid);
-}
diff --git a/lib/libc/other/getopt_long.c b/lib/libc/other/getopt_long.c
deleted file mode 100644 (file)
index aaa53a5..0000000
+++ /dev/null
@@ -1,501 +0,0 @@
-/*     $NetBSD: getopt_long.c,v 1.24 2007/11/09 03:29:20 christos Exp $        */
-
-/*-
- * Copyright (c) 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Dieter Baron and Thomas Klausner.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifdef __minix
-#define _DIAGASSERT assert
-#else
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getopt_long.c,v 1.24 2007/11/09 03:29:20 christos Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#endif
-
-#include <assert.h>
-#include <err.h>
-#include <errno.h>
-#if HAVE_NBTOOL_CONFIG_H
-#include "compat_getopt.h"
-#else
-#include <getopt.h>
-#endif
-#include <stdlib.h>
-#include <string.h>
-
-#if HAVE_NBTOOL_CONFIG_H && !HAVE_GETOPT_LONG && !HAVE_DECL_OPTIND
-#define REPLACE_GETOPT
-#endif
-
-#ifdef REPLACE_GETOPT
-#ifdef __weak_alias
-__weak_alias(getopt,_getopt)
-#endif
-int    opterr = 1;             /* if error message should be printed */
-int    optind = 1;             /* index into parent argv vector */
-int    optopt = '?';           /* character checked for validity */
-int    optreset;               /* reset getopt */
-char    *optarg;               /* argument associated with option */
-#elif HAVE_NBTOOL_CONFIG_H && !HAVE_DECL_OPTRESET
-static int optreset;
-#endif
-
-#ifdef __weak_alias
-__weak_alias(getopt_long,_getopt_long)
-#endif
-
-#define IGNORE_FIRST   (*options == '-' || *options == '+')
-#define PRINT_ERROR    ((opterr) && ((*options != ':') \
-                                     || (IGNORE_FIRST && options[1] != ':')))
-#define IS_POSIXLY_CORRECT (getenv("POSIXLY_CORRECT") != NULL)
-#define PERMUTE         (!IS_POSIXLY_CORRECT && !IGNORE_FIRST)
-/* XXX: GNU ignores PC if *options == '-' */
-#define IN_ORDER        (!IS_POSIXLY_CORRECT && *options == '-')
-
-/* return values */
-#define        BADCH   (int)'?'
-#define        BADARG          ((IGNORE_FIRST && options[1] == ':') \
-                        || (*options == ':') ? (int)':' : (int)'?')
-#define INORDER (int)1
-
-#define        EMSG    ""
-
-static int getopt_internal __P((int, char **, const char *));
-static int gcd __P((int, int));
-static void permute_args __P((int, int, int, char **));
-
-static const char *place = EMSG; /* option letter processing */
-
-/* XXX: set optreset to 1 rather than these two */
-static int nonopt_start = -1; /* first non option argument (for permute) */
-static int nonopt_end = -1;   /* first option after non options (for permute) */
-
-/* Error messages */
-static const char recargchar[] = "option requires an argument -- %c";
-static const char recargstring[] = "option requires an argument -- %s";
-static const char ambig[] = "ambiguous option -- %.*s";
-static const char noarg[] = "option doesn't take an argument -- %.*s";
-static const char illoptchar[] = "unknown option -- %c";
-static const char illoptstring[] = "unknown option -- %s";
-
-
-/*
- * Compute the greatest common divisor of a and b.
- */
-static int
-gcd(a, b)
-       int a;
-       int b;
-{
-       int c;
-
-       c = a % b;
-       while (c != 0) {
-               a = b;
-               b = c;
-               c = a % b;
-       }
-          
-       return b;
-}
-
-/*
- * Exchange the block from nonopt_start to nonopt_end with the block
- * from nonopt_end to opt_end (keeping the same order of arguments
- * in each block).
- */
-static void
-permute_args(panonopt_start, panonopt_end, opt_end, nargv)
-       int panonopt_start;
-       int panonopt_end;
-       int opt_end;
-       char **nargv;
-{
-       int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
-       char *swap;
-
-       _DIAGASSERT(nargv != NULL);
-
-       /*
-        * compute lengths of blocks and number and size of cycles
-        */
-       nnonopts = panonopt_end - panonopt_start;
-       nopts = opt_end - panonopt_end;
-       ncycle = gcd(nnonopts, nopts);
-       cyclelen = (opt_end - panonopt_start) / ncycle;
-
-       for (i = 0; i < ncycle; i++) {
-               cstart = panonopt_end+i;
-               pos = cstart;
-               for (j = 0; j < cyclelen; j++) {
-                       if (pos >= panonopt_end)
-                               pos -= nnonopts;
-                       else
-                               pos += nopts;
-                       swap = nargv[pos];
-                       nargv[pos] = nargv[cstart];
-                       nargv[cstart] = swap;
-               }
-       }
-}
-
-/*
- * getopt_internal --
- *     Parse argc/argv argument vector.  Called by user level routines.
- *  Returns -2 if -- is found (can be long option or end of options marker).
- */
-static int
-getopt_internal(nargc, nargv, options)
-       int nargc;
-       char **nargv;
-       const char *options;
-{
-       char *oli;                              /* option letter list index */
-       int optchar;
-
-       _DIAGASSERT(nargv != NULL);
-       _DIAGASSERT(options != NULL);
-
-       optarg = NULL;
-
-       /*
-        * XXX Some programs (like rsyncd) expect to be able to
-        * XXX re-initialize optind to 0 and have getopt_long(3)
-        * XXX properly function again.  Work around this braindamage.
-        */
-       if (optind == 0)
-               optind = 1;
-
-       if (optreset)
-               nonopt_start = nonopt_end = -1;
-start:
-       if (optreset || !*place) {              /* update scanning pointer */
-               optreset = 0;
-               if (optind >= nargc) {          /* end of argument vector */
-                       place = EMSG;
-                       if (nonopt_end != -1) {
-                               /* do permutation, if we have to */
-                               permute_args(nonopt_start, nonopt_end,
-                                   optind, nargv);
-                               optind -= nonopt_end - nonopt_start;
-                       }
-                       else if (nonopt_start != -1) {
-                               /*
-                                * If we skipped non-options, set optind
-                                * to the first of them.
-                                */
-                               optind = nonopt_start;
-                       }
-                       nonopt_start = nonopt_end = -1;
-                       return -1;
-               }
-               if ((*(place = nargv[optind]) != '-')
-                   || (place[1] == '\0')) {    /* found non-option */
-                       place = EMSG;
-                       if (IN_ORDER) {
-                               /*
-                                * GNU extension: 
-                                * return non-option as argument to option 1
-                                */
-                               optarg = nargv[optind++];
-                               return INORDER;
-                       }
-                       if (!PERMUTE) {
-                               /*
-                                * if no permutation wanted, stop parsing
-                                * at first non-option
-                                */
-                               return -1;
-                       }
-                       /* do permutation */
-                       if (nonopt_start == -1)
-                               nonopt_start = optind;
-                       else if (nonopt_end != -1) {
-                               permute_args(nonopt_start, nonopt_end,
-                                   optind, nargv);
-                               nonopt_start = optind -
-                                   (nonopt_end - nonopt_start);
-                               nonopt_end = -1;
-                       }
-                       optind++;
-                       /* process next argument */
-                       goto start;
-               }
-               if (nonopt_start != -1 && nonopt_end == -1)
-                       nonopt_end = optind;
-               if (place[1] && *++place == '-') {      /* found "--" */
-                       place++;
-                       return -2;
-               }
-       }
-       if ((optchar = (int)*place++) == (int)':' ||
-           (oli = strchr(options + (IGNORE_FIRST ? 1 : 0), optchar)) == NULL) {
-               /* option letter unknown or ':' */
-               if (!*place)
-                       ++optind;
-               if (PRINT_ERROR)
-                       warnx(illoptchar, optchar);
-               optopt = optchar;
-               return BADCH;
-       }
-       if (optchar == 'W' && oli[1] == ';') {          /* -W long-option */
-               /* XXX: what if no long options provided (called by getopt)? */
-               if (*place) 
-                       return -2;
-
-               if (++optind >= nargc) {        /* no arg */
-                       place = EMSG;
-                       if (PRINT_ERROR)
-                               warnx(recargchar, optchar);
-                       optopt = optchar;
-                       return BADARG;
-               } else                          /* white space */
-                       place = nargv[optind];
-               /*
-                * Handle -W arg the same as --arg (which causes getopt to
-                * stop parsing).
-                */
-               return -2;
-       }
-       if (*++oli != ':') {                    /* doesn't take argument */
-               if (!*place)
-                       ++optind;
-       } else {                                /* takes (optional) argument */
-               optarg = NULL;
-               if (*place)                     /* no white space */
-                       optarg = __UNCONST(place);
-               /* XXX: disable test for :: if PC? (GNU doesn't) */
-               else if (oli[1] != ':') {       /* arg not optional */
-                       if (++optind >= nargc) {        /* no arg */
-                               place = EMSG;
-                               if (PRINT_ERROR)
-                                       warnx(recargchar, optchar);
-                               optopt = optchar;
-                               return BADARG;
-                       } else
-                               optarg = nargv[optind];
-               }
-               place = EMSG;
-               ++optind;
-       }
-       /* dump back option letter */
-       return optchar;
-}
-
-#ifdef REPLACE_GETOPT
-/*
- * getopt --
- *     Parse argc/argv argument vector.
- *
- * [eventually this will replace the real getopt]
- */
-int
-getopt(nargc, nargv, options)
-       int nargc;
-       char * const *nargv;
-       const char *options;
-{
-       int retval;
-
-       _DIAGASSERT(nargv != NULL);
-       _DIAGASSERT(options != NULL);
-
-       retval = getopt_internal(nargc, __UNCONST(nargv), options);
-       if (retval == -2) {
-               ++optind;
-               /*
-                * We found an option (--), so if we skipped non-options,
-                * we have to permute.
-                */
-               if (nonopt_end != -1) {
-                       permute_args(nonopt_start, nonopt_end, optind,
-                                      nargv);
-                       optind -= nonopt_end - nonopt_start;
-               }
-               nonopt_start = nonopt_end = -1;
-               retval = -1;
-       }
-       return retval;
-}
-#endif
-
-/*
- * getopt_long --
- *     Parse argc/argv argument vector.
- */
-int
-getopt_long(nargc, nargv, options, long_options, idx)
-       int nargc;
-       char * const *nargv;
-       const char *options;
-       const struct option *long_options;
-       int *idx;
-{
-       int retval;
-
-#define IDENTICAL_INTERPRETATION(_x, _y)                               \
-       (long_options[(_x)].has_arg == long_options[(_y)].has_arg &&    \
-        long_options[(_x)].flag == long_options[(_y)].flag &&          \
-        long_options[(_x)].val == long_options[(_y)].val)
-
-       _DIAGASSERT(nargv != NULL);
-       _DIAGASSERT(options != NULL);
-       _DIAGASSERT(long_options != NULL);
-       /* idx may be NULL */
-
-       retval = getopt_internal(nargc, __UNCONST(nargv), options);
-       if (retval == -2) {
-               char *current_argv, *has_equal;
-               size_t current_argv_len;
-               int i, ambiguous, match;
-
-               current_argv = __UNCONST(place);
-               match = -1;
-               ambiguous = 0;
-
-               optind++;
-               place = EMSG;
-
-               if (*current_argv == '\0') {            /* found "--" */
-                       /*
-                        * We found an option (--), so if we skipped
-                        * non-options, we have to permute.
-                        */
-                       if (nonopt_end != -1) {
-                               permute_args(nonopt_start, nonopt_end,
-                                   optind, __UNCONST(nargv));
-                               optind -= nonopt_end - nonopt_start;
-                       }
-                       nonopt_start = nonopt_end = -1;
-                       return -1;
-               }
-               if ((has_equal = strchr(current_argv, '=')) != NULL) {
-                       /* argument found (--option=arg) */
-                       current_argv_len = has_equal - current_argv;
-                       has_equal++;
-               } else
-                       current_argv_len = strlen(current_argv);
-           
-               for (i = 0; long_options[i].name; i++) {
-                       /* find matching long option */
-                       if (strncmp(current_argv, long_options[i].name,
-                           current_argv_len))
-                               continue;
-
-                       if (strlen(long_options[i].name) ==
-                           (unsigned)current_argv_len) {
-                               /* exact match */
-                               match = i;
-                               ambiguous = 0;
-                               break;
-                       }
-                       if (match == -1)                /* partial match */
-                               match = i;
-                       else if (!IDENTICAL_INTERPRETATION(i, match))
-                               ambiguous = 1;
-               }
-               if (ambiguous) {
-                       /* ambiguous abbreviation */
-                       if (PRINT_ERROR)
-                               warnx(ambig, (int)current_argv_len,
-                                    current_argv);
-                       optopt = 0;
-                       return BADCH;
-               }
-               if (match != -1) {                      /* option found */
-                       if (long_options[match].has_arg == no_argument
-                           && has_equal) {
-                               if (PRINT_ERROR)
-                                       warnx(noarg, (int)current_argv_len,
-                                            current_argv);
-                               /*
-                                * XXX: GNU sets optopt to val regardless of
-                                * flag
-                                */
-                               if (long_options[match].flag == NULL)
-                                       optopt = long_options[match].val;
-                               else
-                                       optopt = 0;
-                               return BADARG;
-                       }
-                       if (long_options[match].has_arg == required_argument ||
-                           long_options[match].has_arg == optional_argument) {
-                               if (has_equal)
-                                       optarg = has_equal;
-                               else if (long_options[match].has_arg ==
-                                   required_argument) {
-                                       /*
-                                        * optional argument doesn't use
-                                        * next nargv
-                                        */
-                                       optarg = nargv[optind++];
-                               }
-                       }
-                       if ((long_options[match].has_arg == required_argument)
-                           && (optarg == NULL)) {
-                               /*
-                                * Missing argument; leading ':'
-                                * indicates no error should be generated
-                                */
-                               if (PRINT_ERROR)
-                                       warnx(recargstring, current_argv);
-                               /*
-                                * XXX: GNU sets optopt to val regardless
-                                * of flag
-                                */
-                               if (long_options[match].flag == NULL)
-                                       optopt = long_options[match].val;
-                               else
-                                       optopt = 0;
-                               --optind;
-                               return BADARG;
-                       }
-               } else {                        /* unknown option */
-                       if (PRINT_ERROR)
-                               warnx(illoptstring, current_argv);
-                       optopt = 0;
-                       return BADCH;
-               }
-               if (long_options[match].flag) {
-                       *long_options[match].flag = long_options[match].val;
-                       retval = 0;
-               } else 
-                       retval = long_options[match].val;
-               if (idx)
-                       *idx = match;
-       }
-       return retval;
-#undef IDENTICAL_INTERPRETATION
-}
diff --git a/lib/libc/other/getpagesize.c b/lib/libc/other/getpagesize.c
deleted file mode 100644 (file)
index fd0f625..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-getpagesize.c
-*/
-
-#include <unistd.h>
-
-int getpagesize(void)
-{
-       /* We don't have paging. Pretend that we do. */
-       return 4096;
-}
diff --git a/lib/libc/other/getpass.c b/lib/libc/other/getpass.c
deleted file mode 100644 (file)
index 0a9be0c..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*     getpass() - read a password             Author: Kees J. Bot
- *                                                     Feb 16 1993
- */
-#define open _open
-#define sigaction _sigaction
-#define sigemptyset _sigemptyset
-#define tcgetattr _tcgetattr
-#define tcsetattr _tcsetattr
-#define write _write
-#define read _read
-#define close _close
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <signal.h>
-#include <termios.h>
-#include <string.h>
-
-static int intr;
-
-static void catch(int sig)
-{
-       intr= 1;
-}
-
-char *getpass(const char *prompt)
-{
-       struct sigaction osa, sa;
-       struct termios cooked, raw;
-       static char password[32+1];
-       int fd, n= 0;
-
-       /* Try to open the controlling terminal. */
-       if ((fd= open("/dev/tty", O_RDONLY)) < 0) return NULL;
-
-       /* Trap interrupts unless ignored. */
-       intr= 0;
-       sigaction(SIGINT, NULL, &osa);
-       if (osa.sa_handler != SIG_IGN) {
-               sigemptyset(&sa.sa_mask);
-               sa.sa_flags= 0;
-               sa.sa_handler= catch;
-               sigaction(SIGINT, &sa, &osa);
-       }
-
-       /* Set the terminal to non-echo mode. */
-       tcgetattr(fd, &cooked);
-       raw= cooked;
-       raw.c_iflag|= ICRNL;
-       raw.c_lflag&= ~ECHO;
-       raw.c_lflag|= ECHONL;
-       raw.c_oflag|= OPOST | ONLCR;
-       tcsetattr(fd, TCSANOW, &raw);
-
-       /* Print the prompt.  (After setting non-echo!) */
-       write(2, prompt, strlen(prompt));
-
-       /* Read the password, 32 characters max. */
-       while (read(fd, password+n, 1) > 0) {
-               if (password[n] == '\n') break;
-               if (n < 32) n++;
-       }
-       password[n]= 0;
-
-       /* Terminal back to cooked mode. */
-       tcsetattr(fd, TCSANOW, &cooked);
-
-       close(fd);
-
-       /* Interrupt? */
-       sigaction(SIGINT, &osa, NULL);
-       if (intr) raise(SIGINT);
-
-       return password;
-}
diff --git a/lib/libc/other/getprogname.c b/lib/libc/other/getprogname.c
deleted file mode 100644 (file)
index 78fc96a..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/* $NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $ */
-
-/*
- * Copyright (c) 2001 Christopher G. Demetriou
- * 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.  See http://www.NetBSD.org/ for
- *          information about NetBSD.
- * 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.
- * 
- * <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#if defined(__ELF__)
-extern const char *__progname;
-
-const char *
-getprogname(void)
-{
-
-        return (__progname);
-}
-
-void
-setprogname(const char *progname)
-{
-        const char *p;
-
-        p = strrchr(progname, '/');
-        if (p != NULL)
-                __progname = p + 1;
-        else
-                __progname = progname;
-}
-#else
-static const char *theprogname = NULL;
-extern const char **__prognamep;       /* Copy of argv[]. */
-extern int __argc;                     /* Copy of argc. */
-
-const char *
-getprogname(void)
-{
-       const char *pn = NULL, *component;
-       if(theprogname)
-               return theprogname;
-       if(__argc > 0 && __prognamep)
-               pn = __prognamep[0];
-       else
-               return NULL;
-
-       if((component=strrchr(pn, '/')))
-               return component+1;
-       return pn;
-}
-
-void
-setprogname(const char *newprogname)
-{
-       theprogname = newprogname;
-}
-#endif
diff --git a/lib/libc/other/getpwent.c b/lib/libc/other/getpwent.c
deleted file mode 100644 (file)
index d5a7e9b..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*     getpwent(), getpwuid(), getpwnam() - password file routines
- *
- *                                                     Author: Kees J. Bot
- *                                                             31 Jan 1994
- */
-#define open _open
-#define fcntl _fcntl
-#define read _read
-#define close _close
-#include <sys/types.h>
-#include <pwd.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#define arraysize(a)   (sizeof(a) / sizeof((a)[0]))
-#define arraylimit(a)  ((a) + arraysize(a))
-
-static char PASSWD[]= "/etc/passwd";   /* The password file. */
-static const char *pwfile;             /* Current password file. */
-
-static char buf[1024];                 /* Read buffer. */
-static char pwline[256];               /* One line from the password file. */
-static struct passwd entry;            /* Entry to fill and return. */
-static int pwfd= -1;                   /* Filedescriptor to the file. */
-static char *bufptr;                   /* Place in buf. */
-static ssize_t buflen= 0;              /* Remaining characters in buf. */
-static char *lineptr;                  /* Place in the line. */
-
-void endpwent(void)
-/* Close the password file. */
-{
-       if (pwfd >= 0) {
-               (void) close(pwfd);
-               pwfd= -1;
-               buflen= 0;
-       }
-}
-
-int setpwent(void)
-/* Open the password file. */
-{
-       if (pwfd >= 0) endpwent();
-
-       if (pwfile == NULL) pwfile= PASSWD;
-
-       if ((pwfd= open(pwfile, O_RDONLY)) < 0) return -1;
-       (void) fcntl(pwfd, F_SETFD, fcntl(pwfd, F_GETFD) | FD_CLOEXEC);
-       return 0;
-}
-
-void setpwfile(const char *file)
-/* Prepare for reading an alternate password file. */
-{
-       endpwent();
-       pwfile= file;
-}
-
-static int getline(void)
-/* Get one line from the password file, return 0 if bad or EOF. */
-{
-       lineptr= pwline;
-
-       do {
-               if (buflen == 0) {
-                       if ((buflen= read(pwfd, buf, sizeof(buf))) <= 0)
-                               return 0;
-                       bufptr= buf;
-               }
-
-               if (lineptr == arraylimit(pwline)) return 0;
-               buflen--;
-       } while ((*lineptr++ = *bufptr++) != '\n');
-
-       lineptr= pwline;
-       return 1;
-}
-
-static char *scan_colon(void)
-/* Scan for a field separator in a line, return the start of the field. */
-{
-       char *field= lineptr;
-       char *last;
-
-       for (;;) {
-               last= lineptr;
-               if (*lineptr == 0) return NULL;
-               if (*lineptr == '\n') break;
-               if (*lineptr++ == ':') break;
-       }
-       *last= 0;
-       return field;
-}
-
-struct passwd *getpwent(void)
-/* Read one entry from the password file. */
-{
-       char *p;
-
-       /* Open the file if not yet open. */
-       if (pwfd < 0 && setpwent() < 0) return NULL;
-
-       /* Until a good line is read. */
-       for (;;) {
-               if (!getline()) return NULL;    /* EOF or corrupt. */
-
-               if ((entry.pw_name= scan_colon()) == NULL) continue;
-               if ((entry.pw_passwd= scan_colon()) == NULL) continue;
-               if ((p= scan_colon()) == NULL) continue;
-               entry.pw_uid= strtol(p, NULL, 0);
-               if ((p= scan_colon()) == NULL) continue;
-               entry.pw_gid= strtol(p, NULL, 0);
-               if ((entry.pw_gecos= scan_colon()) == NULL) continue;
-               if ((entry.pw_dir= scan_colon()) == NULL) continue;
-               if ((entry.pw_shell= scan_colon()) == NULL) continue;
-
-               if (*lineptr == 0) return &entry;
-       }
-}
-
-struct passwd *getpwuid(uid_t uid)
-/* Return the password file entry belonging to the user-id. */
-{
-       struct passwd *pw;
-
-       endpwent();
-       while ((pw= getpwent()) != NULL && pw->pw_uid != uid) {}
-       endpwent();
-       return pw;
-}
-
-struct passwd *getpwnam(const char *name)
-/* Return the password file entry belonging to the user name. */
-{
-       struct passwd *pw;
-
-       endpwent();
-       while ((pw= getpwent()) != NULL && strcmp(pw->pw_name, name) != 0) {}
-       endpwent();
-       return pw;
-}
diff --git a/lib/libc/other/getsubopt.c b/lib/libc/other/getsubopt.c
deleted file mode 100644 (file)
index b50ee66..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*     $NetBSD: getsubopt.c,v 1.8 2004/05/09 19:34:11 kleink Exp $     */
-
-/*-
- * Copyright (c) 1990, 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. 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/cdefs.h>
-
-#include "namespace.h"
-
-#include <assert.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-/*
- * The SVID interface to getsubopt provides no way of figuring out which
- * part of the suboptions list wasn't matched.  This makes error messages
- * tricky...  The extern variable suboptarg is a pointer to the token
- * which didn't match.
- */
-char *suboptarg;
-
-int
-getsubopt(optionp, tokens, valuep)
-       char **optionp, **valuep;
-       char * const *tokens;
-{
-       int cnt;
-       char *p;
-
-       assert(tokens != NULL);
-       assert(valuep != NULL);
-       /* optionp is tested below */
-
-       suboptarg = *valuep = NULL;
-
-       if (!optionp || !*optionp)
-               return(-1);
-
-       /* skip leading white-space, commas */
-       for (p = *optionp; *p && (*p == ',' || *p == ' ' || *p == '\t'); ++p);
-
-       if (!*p) {
-               *optionp = p;
-               return(-1);
-       }
-
-       /* save the start of the token, and skip the rest of the token. */
-       for (suboptarg = p;
-           *++p && *p != ',' && *p != '=' && *p != ' ' && *p != '\t';);
-
-       if (*p) {
-               /*
-                * If there's an equals sign, set the value pointer, and
-                * skip over the value part of the token.  Terminate the
-                * token.
-                */
-               if (*p == '=') {
-                       *p = '\0';
-                       for (*valuep = ++p;
-                           *p && *p != ',' && *p != ' ' && *p != '\t'; ++p);
-                       if (*p) 
-                               *p++ = '\0';
-               } else
-                       *p++ = '\0';
-               /* Skip any whitespace or commas after this token. */
-               for (; *p && (*p == ',' || *p == ' ' || *p == '\t'); ++p);
-       }
-
-       /* set optionp for next round. */
-       *optionp = p;
-
-       for (cnt = 0; *tokens; ++tokens, ++cnt)
-               if (!strcmp(suboptarg, *tokens))
-                       return(cnt);
-       return(-1);
-}
diff --git a/lib/libc/other/getttyent.c b/lib/libc/other/getttyent.c
deleted file mode 100644 (file)
index f262162..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*     getttyent(3) - get a ttytab entry               Author: Kees J. Bot
- *                                                             28 Oct 1995
- */
-#define nil 0
-#define open _open
-#define close _close
-#define fcntl _fcntl
-#define read _read
-#include <string.h>
-#include <sys/types.h>
-#include <ttyent.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#define arraysize(a)   (sizeof(a) / sizeof((a)[0]))
-#define arraylimit(a)  ((a) + arraysize(a))
-
-static char TTYTAB[]= "/etc/ttytab";   /* The table of terminal devices. */
-
-static char buf[512];                  /* Read buffer. */
-static char ttline[256];               /* One line from the ttytab file. */
-static char *ttargv[32];               /* Compound arguments. */
-static struct ttyent entry;            /* Entry to fill and return. */
-static int ttfd= -1;                   /* Filedescriptor to the file. */
-static char *bufptr;                   /* Place in buf. */
-static ssize_t buflen= 0;              /* Remaining characters in buf. */
-static char *lineptr;                  /* Place in the line. */
-static char **argvptr;                 /* Place in word lists. */
-
-void endttyent(void)
-/* Close the ttytab file. */
-{
-       if (ttfd >= 0) {
-               (void) close(ttfd);
-               ttfd= -1;
-               buflen= 0;
-       }
-}
-
-int setttyent(void)
-/* Open the ttytab file. */
-{
-       if (ttfd >= 0) endttyent();
-
-       if ((ttfd= open(TTYTAB, O_RDONLY)) < 0) return -1;
-       (void) fcntl(ttfd, F_SETFD, fcntl(ttfd, F_GETFD) | FD_CLOEXEC);
-       return 0;
-}
-
-static int getline(void)
-/* Get one line from the ttytab file, return 0 if bad or EOF. */
-{
-       lineptr= ttline;
-       argvptr= ttargv;
-
-       do {
-               if (buflen == 0) {
-                       if ((buflen= read(ttfd, buf, sizeof(buf))) <= 0)
-                               return 0;
-                       bufptr= buf;
-               }
-
-               if (lineptr == arraylimit(ttline)) return 0;
-               buflen--;
-       } while ((*lineptr++ = *bufptr++) != '\n');
-
-       lineptr= ttline;
-       return 1;
-}
-
-static int white(int c)
-/* Whitespace? */
-{
-       return c == ' ' || c == '\t';
-}
-
-static char *scan_white(int quoted)
-/* Scan for a field separator in a line, return the start of the field.
- * "quoted" is set if we have to watch out for double quotes.
- */
-{
-       char *field, *last;
-
-       while (white(*lineptr)) lineptr++;
-       if (!quoted && *lineptr == '#') return nil;
-
-       field= lineptr;
-       for (;;) {
-               last= lineptr;
-               if (*lineptr == 0) return nil;
-               if (*lineptr == '\n') break;
-               if (quoted && *lineptr == '"') return field;
-               if (white(*lineptr++)) break;
-       }
-       *last= 0;
-       return *field == 0 ? nil : field;
-}
-
-static char **scan_quoted(void)
-/* Read a field that may be a quoted list of words. */
-{
-       char *p, **field= argvptr;
-
-       while (white(*lineptr)) lineptr++;
-
-       if (*lineptr == '"') {
-               /* Quoted list of words. */
-               lineptr++;
-               while ((p= scan_white(1)) != nil && *p != '"') {
-                       if (argvptr == arraylimit(ttargv)) return nil;
-                       *argvptr++= p;
-               }
-               if (*lineptr == '"') *lineptr++= 0;
-       } else {
-               /* Just one word. */
-               if ((p= scan_white(0)) == nil) return nil;
-               if (argvptr == arraylimit(ttargv)) return nil;
-               *argvptr++= p;
-       }
-       if (argvptr == arraylimit(ttargv)) return nil;
-       *argvptr++= nil;
-       return field;
-}
-
-struct ttyent *getttyent(void)
-/* Read one entry from the ttytab file. */
-{
-       /* Open the file if not yet open. */
-       if (ttfd < 0 && setttyent() < 0) return nil;
-
-       /* Look for a line with something on it. */
-       for (;;) {
-               if (!getline()) return nil;     /* EOF or corrupt. */
-
-               if ((entry.ty_name= scan_white(0)) == nil) continue;
-               entry.ty_type= scan_white(0);
-               entry.ty_getty= scan_quoted();
-               entry.ty_init= scan_quoted();
-
-               return &entry;
-       }
-}
-
-struct ttyent *getttynam(const char *name)
-/* Return the ttytab file entry for a given tty. */
-{
-       struct ttyent *tty;
-
-       endttyent();
-       while ((tty= getttyent()) != nil && strcmp(tty->ty_name, name) != 0) {}
-       endttyent();
-       return tty;
-}
diff --git a/lib/libc/other/getw.c b/lib/libc/other/getw.c
deleted file mode 100644 (file)
index 324a9f1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * getw - read a word from a stream
- */
-/* $Header$ */
-
-#include       <stdio.h>
-
-_PROTOTYPE(int getw, (FILE *stream ));
-
-int getw(stream)
-register FILE *stream;
-{
-       register int cnt = sizeof(int);
-       int w;
-       register char *p = (char *) &w;
-
-       while (cnt--) {
-               *p++ = getc(stream);
-       }
-       if (feof(stream) || ferror(stream)) return EOF;
-       return w;
-}
diff --git a/lib/libc/other/hypot.c b/lib/libc/other/hypot.c
deleted file mode 100644 (file)
index 2d9e992..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- *
- * Author: Ceriel J.H. Jacobs
- */
-
-#include <math.h>
-
-struct complex {
-       double r,i;
-};
-
-_PROTOTYPE(double hypot, (double x, double y ));
-
-/* $Header$ */
-
-double
-hypot(double x, double y)
-{
-       /*      Computes sqrt(x*x+y*y), avoiding overflow */
-
-       if (x < 0) x = -x;
-       if (y < 0) y = -y;
-       if (x > y) {
-               double t = y;
-               y = x;
-               x = t;
-       }
-       /* sqrt(x*x+y*y) = sqrt(y*y*(x*x/(y*y)+1.0)) = y*sqrt(x*x/(y*y)+1.0) */
-       if (y == 0.0) return 0.0;
-       x /= y;
-       return y*sqrt(x*x+1.0);
-}
-
-#if 0
-
-_PROTOTYPE(double cabs, (struct complex p_compl ));
-
-double
-cabs(p_compl)
-struct complex p_compl;
-{
-       return hypot(p_compl.r, p_compl.i);
-}
-#endif
diff --git a/lib/libc/other/index.c b/lib/libc/other/index.c
deleted file mode 100644 (file)
index 4c648de..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <lib.h>
-/* index - find first occurrence of a character in a string */
-
-#include <string.h>
-
-char *index(s, charwanted)     /* found char, or NULL if none */
-_CONST char *s;
-char charwanted;
-{
-  return(strchr(s, charwanted));
-}
diff --git a/lib/libc/other/initgroups.c b/lib/libc/other/initgroups.c
deleted file mode 100644 (file)
index 3f45579..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-initgroups.c
-*/
-#include <sys/param.h>
-#define setgroups _setgroups
-#include <unistd.h>
-#include <string.h>
-#include <grp.h>
-
-
-int initgroups(const char *name, gid_t basegid)
-{
-  struct group *gr;
-  int r, n = 0;
-  gid_t groups[NGROUPS];
-
-  if((r = setgid(basegid)) < 0)
-       return(r);
-
-  setgrent();
-  while ((gr = getgrent()) != NULL && (n + 1) <= NGROUPS) {
-       char **mem;
-       for(mem = gr->gr_mem; mem && *mem; mem++) {
-               if(!strcmp(name, *mem)) {
-                       groups[n++] = gr->gr_gid;
-                       break;
-               }
-       }
-  }
-
-  endgrent();
-
-  return setgroups(n, groups);
-}
-
diff --git a/lib/libc/other/issetugid.c b/lib/libc/other/issetugid.c
deleted file mode 100644 (file)
index bb40379..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <sys/cdefs.h>
-#include <lib.h>
-
-#include <unistd.h>
-
-int issetugid(void)
-{
-       int r;
-       message m;
-
-       r = _syscall(PM_PROC_NR, ISSETUGID, &m);
-       if (r == -1) return 0;  /* Default to old behavior */
-       return(r);
-}
diff --git a/lib/libc/other/loadname.c b/lib/libc/other/loadname.c
deleted file mode 100644 (file)
index 77ff26c..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <lib.h>
-#include <string.h>
-
-PUBLIC void _loadname(name, msgptr)
-_CONST char *name;
-message *msgptr;
-{
-/* This function is used to load a string into a type m3 message. If the
- * string fits in the message, it is copied there.  If not, a pointer to
- * it is passed.
- */
-
-  register size_t k;
-
-  k = strlen(name) + 1;
-  msgptr->m3_i1 = k;
-  msgptr->m3_p1 = (char *) name;
-  if (k <= M3_STRING) strcpy(msgptr->m3_ca1, name);
-}
diff --git a/lib/libc/other/lock.c b/lib/libc/other/lock.c
deleted file mode 100644 (file)
index 94b6010..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <lib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <stdio.h>
-#if _ANSI
-#include <stdlib.h>
-#endif
-
-typedef enum {
-  False, True
-} BOOLEAN;
-
-#define LOCKDIR "/tmp/"                /* or /usr/tmp/ as the case may be */
-#define MAXTRIES 3
-#define NAPTIME (unsigned int)5
-
-PRIVATE _PROTOTYPE( char *lockpath, (char *name));
-_PROTOTYPE( void syserr, (char *errstring));
-_PROTOTYPE( BOOLEAN lock, (char *name));
-_PROTOTYPE( void unlock, (char *name));
-
-void
-syserr(errstring)
-char *errstring;
-{
-       fprintf(stderr,"couldn't %s\n", errstring);
-       exit(1);
-}
-
-BOOLEAN lock(name)             /* acquire lock */
-char *name;
-{
-  char *path;
-  int fd, tries;
-
-  path = lockpath(name);
-  tries = 0;
-  while ((fd = creat(path, 0)) == -1 && errno == EACCES) {
-       if (++tries >= MAXTRIES) return(False);
-       sleep(NAPTIME);
-  }
-  if (fd == -1 || close(fd) == -1) syserr("lock");
-  return(True);
-}
-
-void unlock(name)              /* free lock */
-char *name;
-{
-  if (unlink(lockpath(name)) == -1) syserr("unlock");
-}
-
-PRIVATE char *lockpath(name)   /* generate lock file path */
-char *name;
-{
-  PRIVATE char path[20];
-
-  strcpy(path, LOCKDIR);
-  return(strcat(path, name));
-}
diff --git a/lib/libc/other/lrand.c b/lib/libc/other/lrand.c
deleted file mode 100644 (file)
index ff475db..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*  lrand(3)
- *
- *  Author: Terrence W. Holm          Nov. 1988
- *
- *
- *  A prime modulus multiplicative linear congruential
- *  generator (PMMLCG), or "Lehmer generator".
- *  Implementation directly derived from the article:
- *
- *     S. K. Park and K. W. Miller
- *     Random Number Generators: Good Ones are Hard to Find
- *     CACM vol 31, #10. Oct. 1988. pp 1192-1201.
- *
- *
- *  Using the following multiplier and modulus, we obtain a
- *  generator which:
- *
- *     1)  Has a full period: 1 to 2^31 - 2.
- *     2)  Is testably "random" (see the article).
- *     3)  Has a known implementation by E. L. Schrage.
- */
-
-#include <lib.h>
-
-_PROTOTYPE( long seed, (long lseed));
-_PROTOTYPE( long lrand, (void));
-
-#define  A       16807L        /* A "good" multiplier    */
-#define  M   2147483647L       /* Modulus: 2^31 - 1      */
-#define  Q       127773L       /* M / A                  */
-#define  R         2836L       /* M % A                  */
-
-PRIVATE long _lseed = 1L;
-
-long seed(lseed)
-long lseed;
-{
-  long previous_seed = _lseed;
-
-  _lseed = lseed;
-
-  return(previous_seed);
-}
-
-
-long lrand()
-{
-  _lseed = A * (_lseed % Q) - R * (_lseed / Q);
-
-  if (_lseed < 0) _lseed += M;
-
-  return(_lseed);
-}
diff --git a/lib/libc/other/lsearch.c b/lib/libc/other/lsearch.c
deleted file mode 100644 (file)
index 8f834ce..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <lib.h>
-#include <string.h>
-/*  lsearch(3)  and  lfind(3)
- *
- *  Author: Terrence W. Holm          Sep. 1988
- */
-
-#include <stddef.h>
-
-_PROTOTYPE( char *lsearch, (char *key, char *base,
-                           unsigned *count, unsigned width,
-                           int (*keycmp)(const void *, const void *)));
-_PROTOTYPE( char *lfind, (char *key, char *base,
-                           unsigned *count, unsigned width,
-                           int (*keycmp)(const void *, const void *)));
-
-char *lsearch(key, base, count, width, keycmp)
-char *key;
-char *base;
-unsigned *count;
-unsigned width;
-_PROTOTYPE( int (*keycmp), (const void *, const void *));
-{
-  char *entry;
-  char *last = base + *count * width;
-
-  for (entry = base; entry < last; entry += width)
-       if (keycmp(key, entry) == 0) return(entry);
-
-  bcopy(key, last, width);
-  *count += 1;
-  return(last);
-}
-
-
-char *lfind(key, base, count, width, keycmp)
-char *key;
-char *base;
-unsigned *count;
-unsigned width;
-_PROTOTYPE( int (*keycmp), (const void *, const void *));
-{
-  char *entry;
-  char *last = base + *count * width;
-
-  for (entry = base; entry < last; entry += width)
-       if (keycmp(key, entry) == 0) return(entry);
-
-  return((char *)NULL);
-}
diff --git a/lib/libc/other/memccpy.c b/lib/libc/other/memccpy.c
deleted file mode 100644 (file)
index 1991d81..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <lib.h>
-/* memccpy - copy bytes up to a certain char
- *
- * CHARBITS should be defined only if the compiler lacks "unsigned char".
- * It should be a mask, e.g. 0377 for an 8-bit machine.
- */
-
-#include <minix/ansi.h>
-#include <stddef.h>
-
-_PROTOTYPE( void *memccpy, (void *dst, const void *src,
-                           int ucharstop, size_t size));
-#ifndef CHARBITS
-#      define  UNSCHAR(c)      ((unsigned char)(c))
-#else
-#      define  UNSCHAR(c)      ((c)&CHARBITS)
-#endif
-
-void *memccpy(dst, src, ucharstop, size)
-void * dst;
-_CONST void * src;
-int ucharstop;
-_SIZET size;
-{
-  register char *d;
-  register _CONST char *s;
-  register _SIZET n;
-  register int uc;
-
-  if (size <= 0) return( (void *) NULL);
-
-  s = (char *) src;
-  d = (char *) dst;
-  uc = UNSCHAR(ucharstop);
-  for (n = size; n > 0; n--)
-       if (UNSCHAR(*d++ = *s++) == (char) uc) return( (void *) d);
-
-  return( (void *) NULL);
-}
diff --git a/lib/libc/other/minix_rs.c b/lib/libc/other/minix_rs.c
deleted file mode 100644 (file)
index 0e847fc..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#define _SYSTEM        1
-#define _MINIX 1
-
-#include <minix/callnr.h>
-#include <minix/com.h>
-#include <minix/config.h>
-#include <minix/ipc.h>
-#include <minix/endpoint.h>
-#include <minix/sysutil.h>
-#include <minix/syslib.h>
-#include <minix/const.h>
-#include <minix/type.h>
-#include <minix/ds.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <lib.h>
-
-int minix_rs_lookup(const char *name, endpoint_t *value)
-{
-       message m;
-       size_t len_key;
-
-       len_key = strlen(name)+1;
-
-       m.RS_NAME = (char *) name;
-       m.RS_NAME_LEN = len_key;
-
-       if (_syscall(RS_PROC_NR, RS_LOOKUP, &m) != -1) {
-               *value = m.RS_ENDPOINT;
-               return OK;
-       }
-
-       return -1;
-}
-
diff --git a/lib/libc/other/mtab.c b/lib/libc/other/mtab.c
deleted file mode 100644 (file)
index 69b91b8..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/* This package consists of 4 routines for handling the /etc/mtab file.
- * The /etc/mtab file contains information about the root and mounted file
- * systems as a series of lines, each one with exactly four fields separated 
- * by one space as follows:
- *
- *     special mounted_on version rw_flag
- *
- * where 
- *     special is the name of the block special file
- *     mounted_on is the directory on which it is mounted
- *     version is either 1 or 2 for MINIX V1 and V2 file systems
- *     rw_flag is rw or ro for read/write or read only
- *
- * An example /etc/mtab:
- *
- *     /dev/ram / 2 rw
- *     /dev/hd1 /usr 2 rw
- *     /dev/fd0 /user 1 ro
- *
- *
- * The four routines for handling /etc/mtab are as follows.  They use two
- * (hidden) internal buffers, mtab_in for input and mtab_out for output.
- *
- *     load_mtab(&prog_name)              - read /etc/mtab into mtab_in
- *     get_mtab_entry(&s1, &s2, &s3, &s4) - arrays that are filled in
- *     put_mtab_entry(&s1, &s2, &s3, &s4) - append a line to mtab_out
- *     rewrite_mtab(&prog_name)           - write mtab_out to /etc/mtab
- *
- * If load_mtab and rewrite_mtab work, they return 0.  If they fail, they
- * print their own error messages on stderr and return -1.  When get_mtab_entry
- * runs out of entries to return, it sets the first pointer to NULL and returns
- * -1 instead of 0.  Also, rewrite_mtab returns -1 if it fails.
- */
-#include <sys/types.h>
-#include <minix/minlib.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#define BUF_SIZE   512           /* size of the /etc/mtab buffer */
-
-char *etc_mtab = "/etc/mtab";    /* name of the /etc/mtab file */
-static char mtab_in[BUF_SIZE+1];  /* holds /etc/mtab when it is read in */
-static char mtab_out[BUF_SIZE+1]; /* buf to build /etc/mtab for output later */
-static char *iptr = mtab_in;     /* pointer to next line to feed out. */
-static char *optr = mtab_out;    /* pointer to place where next line goes */
-
-_PROTOTYPE(int load_mtab, (char *prog_name ));
-_PROTOTYPE(int rewrite_mtab, (char *prog_name ));
-_PROTOTYPE(int get_mtab_entry, (char *special, char *mounted_on, 
-                                       char *version, char *rw_flag));
-_PROTOTYPE(int put_mtab_entry, (char *special, char *mounted_on, 
-                                       char *version, char *rw_flag));
-_PROTOTYPE(void err, (char *prog_name, char *str ));
-
-
-int load_mtab(prog_name)
-char *prog_name;
-{
-/* Read in /etc/mtab and store it in /etc/mtab. */
-
-  int fd, n;
-  char *ptr;
-
-  /* Open the file. */
-  fd = open(etc_mtab, O_RDONLY);
-  if (fd < 0) {
-       err(prog_name, ": cannot open ");
-       return(-1);
-  }
-
-  /* File opened.  Read it in. */
-  n = read(fd, mtab_in, BUF_SIZE);
-  if (n <= 0) {
-       /* Read failed. */
-       err(prog_name, ": cannot read ");
-       return(-1);
-  }
-  if (n == BUF_SIZE) {
-       /* Some nut has mounted 50 file systems or something like that. */
-       std_err(prog_name);
-       std_err(": file too large: ");
-       std_err(etc_mtab);
-       return(-1);
-  }
-
-  close(fd);
-
-  /* Replace all the whitespace by '\0'. */
-  ptr = mtab_in;
-  while (*ptr != '\0') {
-       if (isspace(*ptr)) *ptr = '\0';
-       ptr++;
-  }
-  return(0);
-}
-
-
-int rewrite_mtab(prog_name)
-char *prog_name;
-{
-/* Write mtab_out to /etc/mtab. */
-
-  int fd, n;
-
-  /* Do a creat to truncate the file. */
-  fd = creat(etc_mtab, 0777);
-  if (fd < 0) {
-       err(prog_name, ": cannot overwrite ");
-       return(-1);
-  }
-
-  /* File created.  Write it. */
-  n = write(fd, mtab_out, (unsigned int)(optr - mtab_out));
-  if (n <= 0) {
-       /* Write failed. */
-       err(prog_name, " could not write ");
-       return(-1);
-  }
-
-  close(fd);
-  return(0);
-}
-
-
-int get_mtab_entry(special, mounted_on, version, rw_flag)
-char *special;
-char *mounted_on;
-char *version;
-char *rw_flag;
-{
-/* Return the next entry from mtab_in. */
-
-  if (iptr >= &mtab_in[BUF_SIZE]) {
-       special[0] = '\0';
-       return(-1);
-  }
-
-  strcpy(special, iptr);
-  while (isprint(*iptr)) iptr++;
-  while (*iptr == '\0'&& iptr < &mtab_in[BUF_SIZE]) iptr++;
-
-  strcpy(mounted_on, iptr);
-  while (isprint(*iptr)) iptr++;
-  while (*iptr == '\0'&& iptr < &mtab_in[BUF_SIZE]) iptr++;
-
-  strcpy(version, iptr);
-  while (isprint(*iptr)) iptr++;
-  while (*iptr == '\0'&& iptr < &mtab_in[BUF_SIZE]) iptr++;
-
-  strcpy(rw_flag, iptr);
-  while (isprint(*iptr)) iptr++;
-  while (*iptr == '\0'&& iptr < &mtab_in[BUF_SIZE]) iptr++;
-  return(0);
-}
-
-
-int put_mtab_entry(special, mounted_on, version, rw_flag)
-char *special;
-char *mounted_on;
-char *version;
-char *rw_flag;
-{
-/* Append an entry to the mtab_out buffer. */
-
-  int n1, n2, n3, n4;
-
-  n1 = strlen(special);
-  n2 = strlen(mounted_on);
-  n3 = strlen(version);
-  n4 = strlen(rw_flag);
-
-  if (optr + n1 + n2 + n3 + n4 + 5 >= &mtab_out[BUF_SIZE]) return(-1);
-  strcpy(optr, special);
-  optr += n1;
-  *optr++ = ' ';
-
-  strcpy(optr, mounted_on);
-  optr += n2;
-  *optr++ = ' ';
-
-  strcpy(optr, version);
-  optr += n3;
-  *optr++ = ' ';
-
-  strcpy(optr, rw_flag);
-  optr += n4;
-  *optr++ = '\n';
-  return(0);
-}
-
-
-void
-err(prog_name, str)
-char *prog_name, *str;
-{
-  std_err(prog_name); 
-  std_err(str);
-  std_err(etc_mtab);
-  perror(" ");
-}
diff --git a/lib/libc/other/namespace.h b/lib/libc/other/namespace.h
deleted file mode 100644 (file)
index 4831f2a..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 2001 Daniel Eischen <deischen@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.
- *
- * 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 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.
- *
- * $FreeBSD: src/lib/libc/include/namespace.h,v 1.16 2003/05/01 19:03:13 nectar Exp $
- */
-
-#ifndef _NAMESPACE_H_
-#define _NAMESPACE_H_
-
-/*
- * Adjust names so that headers declare "hidden" names.
- *
- * README: When modifying this file don't forget to make the appropriate
- *         changes in un-namespace.h!!!
- */
-
-/*
- * ISO C (C90) section.  Most names in libc aren't in ISO C, so they
- * should be here.  Most aren't here...
- */
-#define                nsdispatch                      _nsdispatch
-
-/*
- * Prototypes for syscalls/functions that need to be overridden
- * in libc_r/libpthread.
- */
-#define                accept                          _accept
-#define                __acl_aclcheck_fd               ___acl_aclcheck_fd
-#define                __acl_delete_fd                 ___acl_delete_fd
-#define                __acl_get_fd                    ___acl_get_fd
-#define                __acl_set_fd                    ___acl_set_fd
-#define                bind                            _bind
-#define                __cap_get_fd                    ___cap_get_fd
-#define                __cap_set_fd                    ___cap_set_fd
-#define                close                           _close
-#define                connect                         _connect
-#define                dup                             _dup
-#define                dup2                            _dup2
-#define                execve                          _execve
-#define                fcntl                           _fcntl
-/*#define              flock                           _flock */
-#define                flockfile                       _flockfile
-#define                fpathconf                       _fpathconf
-#define                fstat                           _fstat
-#define                fstatfs                         _fstatfs
-#define                fsync                           _fsync
-#define                funlockfile                     _funlockfile
-#define                getdirentries                   _getdirentries
-#define                getlogin                        _getlogin
-#define                getpeername                     _getpeername
-#define                getsockname                     _getsockname
-#define                getsockopt                      _getsockopt
-#define                ioctl                           _ioctl
-/* #define             kevent                          _kevent */
-#define                listen                          _listen
-#define                nanosleep                       _nanosleep
-#define                open                            _open
-#define                poll                            _poll
-#define                pthread_cond_broadcast          _pthread_cond_broadcast
-#define                pthread_cond_destroy            _pthread_cond_destroy
-#define                pthread_cond_init               _pthread_cond_init
-#define                pthread_cond_signal             _pthread_cond_signal
-#define                pthread_cond_timedwait          _pthread_cond_timedwait
-#define                pthread_cond_wait               _pthread_cond_wait
-#define                pthread_exit                    _pthread_exit
-#define                pthread_getspecific             _pthread_getspecific
-#define                pthread_key_create              _pthread_key_create
-#define                pthread_key_delete              _pthread_key_delete
-#define                pthread_main_np                 _pthread_main_np
-#define                pthread_mutex_destroy           _pthread_mutex_destroy
-#define                pthread_mutex_init              _pthread_mutex_init
-#define                pthread_mutex_lock              _pthread_mutex_lock
-#define                pthread_mutex_trylock           _pthread_mutex_trylock
-#define                pthread_mutex_unlock            _pthread_mutex_unlock
-#define                pthread_mutexattr_destroy       _pthread_mutexattr_destroy
-#define                pthread_mutexattr_init          _pthread_mutexattr_init
-#define                pthread_mutexattr_settype       _pthread_mutexattr_settype
-#define                pthread_once                    _pthread_once
-#define                pthread_rwlock_destroy          _pthread_rwlock_destroy
-#define                pthread_rwlock_init             _pthread_rwlock_init
-#define                pthread_rwlock_rdlock           _pthread_rwlock_rdlock
-#define                pthread_rwlock_wrlock           _pthread_rwlock_wrlock
-#define                pthread_rwlock_tryrdlock        _pthread_rwlock_tryrdlock
-#define                pthread_rwlock_trywrlock        _pthread_rwlock_trywrlock
-#define                pthread_rwlock_unlock           _pthread_rwlock_unlock
-#define                pthread_self                    _pthread_self
-#define                pthread_setspecific             _pthread_setspecific
-#define                pthread_sigmask                 _pthread_sigmask
-#define                read                            _read
-#define                readv                           _readv
-#define                recvfrom                        _recvfrom
-#define                recvmsg                         _recvmsg
-#define                select                          _select
-#define                sendmsg                         _sendmsg
-#define                sendto                          _sendto
-#define                setsockopt                      _setsockopt
-/*#define              sigaction                       _sigaction*/
-#define                sigprocmask                     _sigprocmask
-#define                sigsuspend                      _sigsuspend
-#define                socket                          _socket
-#define                socketpair                      _socketpair
-#define                wait4                           _wait4
-#define                waitpid                         _waitpid
-#define                write                           _write
-#define                writev                          _writev
-
-
-/*
- * Other hidden syscalls/functions that libc_r needs to override
- * but are not used internally by libc.
- *
- * XXX - When modifying libc to use one of the following, remove
- * the prototype from below and place it in the list above.
- */
-#if 0
-#define                creat                           _creat
-#define                fchflags                        _fchflags
-#define                fchmod                          _fchmod
-#define                ftrylockfile                    _ftrylockfile
-#define                msync                           _msync
-#define                nfssvc                          _nfssvc
-#define                pause                           _pause
-#define                pthread_rwlockattr_init         _pthread_rwlockattr_init
-#define                pthread_rwlockattr_destroy      _pthread_rwlockattr_destroy
-#define                sched_yield                     _sched_yield
-#define                sendfile                        _sendfile
-#define                shutdown                        _shutdown
-#define                sigaltstack                     _sigaltstack
-#define                sigpending                      _sigpending
-#define                sigreturn                       _sigreturn
-#define                sigsetmask                      _sigsetmask
-#define                sleep                           _sleep
-#define                system                          _system
-#define                tcdrain                         _tcdrain
-#define                wait                            _wait
-#define                minix_mmap                      _minix_mmap
-#define                minix_munmap                    _minix_munmap
-#define                minix_munmap_text               _minix_munmap_text
-#endif
-
-#endif /* _NAMESPACE_H_ */
diff --git a/lib/libc/other/peekpoke.c b/lib/libc/other/peekpoke.c
deleted file mode 100644 (file)
index d311a12..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Peek and poke using /dev/mem.
- *
- * Callers now ought to check the return values.
- *
- * Calling peek() requires read permission on /dev/mem, and consumes
- * a file descriptor.  Calling poke() requires write permission, and
- * consumes another file descriptor.
- */
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-_PROTOTYPE( int peek, (unsigned segment, unsigned offset));
-_PROTOTYPE( int poke, (unsigned segment, unsigned offset, unsigned value));
-
-#define SEGSIZE 0x10
-
-int peek(segment, offset)
-unsigned segment;
-unsigned offset;
-{
-  unsigned char chvalue;
-  static int infd = -1;
-
-  if (infd < 0) infd = open("/dev/mem", O_RDONLY);
-  if (infd < 0 ||
-      lseek(infd, (unsigned long) segment * SEGSIZE + offset, SEEK_SET) < 0 ||
-      read(infd, (char *) &chvalue, (unsigned) 1) != 1)
-       return(-1);
-  return(chvalue);
-}
-
-int poke(segment, offset, value)
-unsigned segment;
-unsigned offset;
-unsigned value;
-{
-  unsigned char chvalue;
-  static int outfd = -1;
-
-  chvalue = value;
-  if (outfd < 0) outfd = open("/dev/mem", O_WRONLY);
-  if (outfd < 0 ||
-      lseek(outfd, (unsigned long) segment * SEGSIZE + offset, SEEK_SET) < 0 ||
-      write(outfd, (char *) &chvalue, (unsigned) 1) != 1)
-       return(-1);
-  return(chvalue);
-}
diff --git a/lib/libc/other/popen.c b/lib/libc/other/popen.c
deleted file mode 100644 (file)
index 7f11732..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * popen - open a pipe
- */
-/* $Header$ */
-
-#include       <sys/types.h>
-#include       <limits.h>
-#include       <errno.h>
-#include       <signal.h>
-#include       <stdio.h>
-
-#if    defined(__BSD4_2)
-union wait {
-       int     w_status;
-};
-typedef union wait wait_arg;
-#else
-typedef int wait_arg;
-#endif /* __BSD4_2 */
-
-#include       "../stdio/loc_incl.h"
-
-#ifdef _ANSI
-int _close(int d);
-int _dup2(int oldd, int newd);         /* not present in System 5 */
-int _execl(const char *name, const char *_arg, ... );
-pid_t _fork(void);
-int _pipe(int fildes[2]);
-pid_t _wait(wait_arg *status);
-void _exit(int status);
-#endif
-
-static int pids[OPEN_MAX];
-
-FILE *
-popen(command, type)
-_CONST char *command;
-_CONST char *type;
-{
-       int piped[2];
-       int Xtype = *type == 'r' ? 0 : *type == 'w' ? 1 : 2;
-       int pid;
-
-       if (Xtype == 2 ||
-           _pipe(piped) < 0 ||
-           (pid = _fork()) < 0) return 0;
-       
-       if (pid == 0) {
-               /* child */
-               register int *p;
-
-               for (p = pids; p < &pids[OPEN_MAX]; p++) {
-                       if (*p) _close((int)(p - pids));
-               }
-               _close(piped[Xtype]);
-               _dup2(piped[!Xtype], !Xtype);
-               _close(piped[!Xtype]);
-               _execl("/bin/sh", "sh", "-c", command, (char *) 0);
-               _exit(127);     /* like system() ??? */
-       }
-
-       pids[piped[Xtype]] = pid;
-       _close(piped[!Xtype]);
-       return fdopen(piped[Xtype], type);
-}
-
-#if    defined(__BSD4_2)
-#define        ret_val status.w_status
-#else
-#define        ret_val status
-#endif
-
-int
-pclose(stream)
-FILE *stream;
-{
-       int fd = fileno(stream);
-       wait_arg status;
-       int wret;
-
-#ifdef _ANSI
-       void (*intsave)(int) = signal(SIGINT, SIG_IGN);
-       void (*quitsave)(int) = signal(SIGQUIT, SIG_IGN);
-#else
-       void (*intsave)() = signal(SIGINT, SIG_IGN);
-       void (*quitsave)() = signal(SIGQUIT, SIG_IGN);
-#endif
-       fclose(stream);
-       while ((wret = _wait(&status)) != -1) {
-               if (wret == pids[fd]) break;
-       }
-       if (wret == -1) ret_val = -1;
-       signal(SIGINT, intsave);
-       signal(SIGQUIT, quitsave);
-       pids[fd] = 0;
-       return ret_val;
-}
-
-#if    defined(__USG)
-int _dup(int fildes);
-
-static int
-_dup2(oldd, newd)
-int oldd, newd;
-{
-       int i = 0, fd, tmp;
-       int fdbuf[_NFILES];
-
-       /* ignore the error on the close() */
-       tmp = errno; (void) _close(newd); errno = tmp;
-       while ((fd = _dup(oldd)) != newd) {
-               if (fd == -1) break;
-               fdbuf[i++] = fd;
-       }
-       tmp = errno;
-       while (--i >= 0) {
-               _close(fdbuf[i]);
-       }
-       errno = tmp;
-       return -(fd == -1);
-}
-#endif /* __USG */
diff --git a/lib/libc/other/putenv.c b/lib/libc/other/putenv.c
deleted file mode 100644 (file)
index 1b9cefc..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * (c) copyright 1989 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-#include       <string.h>
-
-#define        ENTRY_INC       10
-#define        rounded(x)      (((x / ENTRY_INC) + 1) * ENTRY_INC)
-
-extern _CONST char ***_penviron;
-
-int
-putenv(name)
-char *name;
-{
-       register _CONST char **v = *_penviron;
-       register char *r;
-       static int size = 0;
-       /* When size != 0, it contains the number of entries in the
-        * table (including the final NULL pointer). This means that the
-        * last non-null entry  is environ[size - 2].
-        */
-
-       if (!name) return 0;
-       if (*_penviron == NULL) return 1;
-       if ((r = strchr(name, '='))) {
-               register _CONST char *p, *q;
-
-               *r = '\0';
-
-               if (v != NULL) {
-                       while ((p = *v) != NULL) {
-                               q = name;
-                               while (*q && (*q++ == *p++))
-                                       /* EMPTY */ ;
-                               if (*q || (*p != '=')) {
-                                       v++;
-                               } else {
-                                       /* The name was already in the
-                                        * environment.
-                                        */
-                                       *r = '=';
-                                       *v = name;
-                                       return 0;
-                               }
-                       }
-               }
-               *r = '=';
-               v = *_penviron;
-       }
-
-       if (!size) {
-               register _CONST char **p;
-               register int i = 0;
-
-               if (v)
-                       do {
-                               i++;
-                       } while (*v++);
-               if (!(v = malloc(rounded(i) * sizeof(char **))))
-                       return 1;
-               size = i;
-               p = *_penviron;
-               *_penviron = v;
-               while ((*v++ = *p++));          /* copy the environment */
-               v = *_penviron;
-       } else if (!(size % ENTRY_INC)) {
-               if (!(v = realloc(*_penviron, rounded(size) * sizeof(char **))))
-                       return 1;
-               *_penviron = v;
-       }
-       v[size - 1] = name;
-       v[size] = NULL;
-       size++;
-       return 0;
-}
diff --git a/lib/libc/other/putw.c b/lib/libc/other/putw.c
deleted file mode 100644 (file)
index a7686e9..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* 
- * putw - write an word on a stream
- */
-/* $Header$ */
-
-#include       <stdio.h>
-
-_PROTOTYPE(int putw, (int w, FILE *stream ));
-
-int
-putw(w, stream)
-int w;
-register FILE *stream;
-{
-       register int cnt = sizeof(int);
-       register char *p = (char *) &w;
-
-       while (cnt--) {
-               (void) putc(*p++, stream);
-       }
-       if (ferror(stream)) return EOF;
-       return w;
-}
diff --git a/lib/libc/other/pwcache.c b/lib/libc/other/pwcache.c
deleted file mode 100644 (file)
index 0505e46..0000000
+++ /dev/null
@@ -1,661 +0,0 @@
-/*     $NetBSD: pwcache.c,v 1.30 2008/04/28 20:22:59 martin Exp $      */
-
-/*-
- * Copyright (c) 1992 Keith Muller.
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Keith Muller of the University of California, San Diego.
- *
- * 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. 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.
- */
-
-/*-
- * Copyright (c) 2002 The NetBSD Foundation, Inc.
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-/*
- * XXX Undefine the renames of these functions so that we don't
- * XXX rename the versions found in the host's <pwd.h> by mistake!
- */
-#undef group_from_gid
-#undef user_from_uid
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)cache.c    8.1 (Berkeley) 5/31/93";
-#else
-__RCSID("$NetBSD: pwcache.c,v 1.30 2008/04/28 20:22:59 martin Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <sys/types.h>
-#include <sys/param.h>
-
-#include <assert.h>
-#include <grp.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#if HAVE_NBTOOL_CONFIG_H
-/* XXX Now, re-apply the renaming that we undid above. */
-#define        group_from_gid  __nbcompat_group_from_gid
-#define        user_from_uid   __nbcompat_user_from_uid
-#endif
-
-#ifdef __weak_alias
-__weak_alias(user_from_uid,_user_from_uid)
-__weak_alias(group_from_gid,_group_from_gid)
-__weak_alias(pwcache_userdb,_pwcache_userdb)
-__weak_alias(pwcache_groupdb,_pwcache_groupdb)
-#endif
-
-#if !HAVE_PWCACHE_USERDB || HAVE_NBTOOL_CONFIG_H
-#include "pwcache.h"
-
-/*
- * routines that control user, group, uid and gid caches (for the archive
- * member print routine).
- * IMPORTANT:
- * these routines cache BOTH hits and misses, a major performance improvement
- */
-
-/*
- * function pointers to various name lookup routines.
- * these may be changed as necessary.
- */
-#ifndef __minix
-static int             (*_pwcache_setgroupent)(int)            = setgroupent;
-static int             (*_pwcache_setpassent)(int)             = setpassent;
-#else
-static int             (*_pwcache_setgroupent)(int)            = NULL;
-static int             (*_pwcache_setpassent)(int)             = NULL;
-#endif
-static void            (*_pwcache_endgrent)(void)              = endgrent;
-static struct group *  (*_pwcache_getgrnam)(const char *)      = getgrnam;
-static struct group *  (*_pwcache_getgrgid)(gid_t)             = getgrgid;
-static void            (*_pwcache_endpwent)(void)              = endpwent;
-static struct passwd * (*_pwcache_getpwnam)(const char *)      = getpwnam;
-static struct passwd * (*_pwcache_getpwuid)(uid_t)             = getpwuid;
-
-/*
- * internal state
- */
-static int     pwopn;          /* is password file open */
-static int     gropn;          /* is group file open */
-static UIDC    **uidtb;        /* uid to name cache */
-static GIDC    **gidtb;        /* gid to name cache */
-static UIDC    **usrtb;        /* user name to uid cache */
-static GIDC    **grptb;        /* group name to gid cache */
-
-static int     uidtb_fail;     /* uidtb_start() failed ? */
-static int     gidtb_fail;     /* gidtb_start() failed ? */
-static int     usrtb_fail;     /* usrtb_start() failed ? */
-static int     grptb_fail;     /* grptb_start() failed ? */
-
-
-static u_int   st_hash(const char *, size_t, int);
-static int     uidtb_start(void);
-static int     gidtb_start(void);
-static int     usrtb_start(void);
-static int     grptb_start(void);
-
-#define _DIAGASSERT assert
-
-static u_int
-st_hash(const char *name, size_t len, int tabsz)
-{
-       u_int key = 0;
-
-       _DIAGASSERT(name != NULL);
-
-       while (len--) {
-               key += *name++;
-               key = (key << 8) | (key >> 24);
-       }
-
-       return (key % tabsz);
-}
-
-/*
- * uidtb_start
- *     creates an an empty uidtb
- * Return:
- *     0 if ok, -1 otherwise
- */
-static int
-uidtb_start(void)
-{
-
-       if (uidtb != NULL)
-               return (0);
-       if (uidtb_fail)
-               return (-1);
-       if ((uidtb = (UIDC **)calloc(UID_SZ, sizeof(UIDC *))) == NULL) {
-               ++uidtb_fail;
-               return (-1);
-       }
-       return (0);
-}
-
-/*
- * gidtb_start
- *     creates an an empty gidtb
- * Return:
- *     0 if ok, -1 otherwise
- */
-static int
-gidtb_start(void)
-{
-
-       if (gidtb != NULL)
-               return (0);
-       if (gidtb_fail)
-               return (-1);
-       if ((gidtb = (GIDC **)calloc(GID_SZ, sizeof(GIDC *))) == NULL) {
-               ++gidtb_fail;
-               return (-1);
-       }
-       return (0);
-}
-
-/*
- * usrtb_start
- *     creates an an empty usrtb
- * Return:
- *     0 if ok, -1 otherwise
- */
-static int
-usrtb_start(void)
-{
-
-       if (usrtb != NULL)
-               return (0);
-       if (usrtb_fail)
-               return (-1);
-       if ((usrtb = (UIDC **)calloc(UNM_SZ, sizeof(UIDC *))) == NULL) {
-               ++usrtb_fail;
-               return (-1);
-       }
-       return (0);
-}
-
-/*
- * grptb_start
- *     creates an an empty grptb
- * Return:
- *     0 if ok, -1 otherwise
- */
-static int
-grptb_start(void)
-{
-
-       if (grptb != NULL)
-               return (0);
-       if (grptb_fail)
-               return (-1);
-       if ((grptb = (GIDC **)calloc(GNM_SZ, sizeof(GIDC *))) == NULL) {
-               ++grptb_fail;
-               return (-1);
-       }
-       return (0);
-}
-
-/*
- * user_from_uid()
- *     caches the name (if any) for the uid. If noname clear, we always
- *     return the stored name (if valid or invalid match).
- *     We use a simple hash table.
- * Return
- *     Pointer to stored name (or a empty string)
- */
-const char *
-user_from_uid(uid_t uid, int noname)
-{
-       struct passwd *pw;
-       UIDC *ptr, **pptr;
-
-       if ((uidtb == NULL) && (uidtb_start() < 0))
-               return (NULL);
-       if (uid < 0)
-               return NULL;
-       /*
-        * see if we have this uid cached
-        */
-       pptr = uidtb + (uid % UID_SZ);
-       ptr = *pptr;
-
-       if ((ptr != NULL) && (ptr->valid > 0) && (ptr->uid == uid)) {
-               /*
-                * have an entry for this uid
-                */
-               if (!noname || (ptr->valid == VALID))
-                       return (ptr->name);
-               return (NULL);
-       }
-
-       /*
-        * No entry for this uid, we will add it
-        */
-       if (!pwopn) {
-               if (_pwcache_setpassent != NULL)
-                       (*_pwcache_setpassent)(1);
-               else
-                       setpwent();
-               ++pwopn;
-       }
-
-       if (ptr == NULL)
-               *pptr = ptr = (UIDC *)malloc(sizeof(UIDC));
-
-       if ((pw = (*_pwcache_getpwuid)(uid)) == NULL) {
-               /*
-                * no match for this uid in the local password file
-                * a string that is the uid in numeric format
-                */
-               if (ptr == NULL)
-                       return (NULL);
-               ptr->uid = uid;
-               (void)snprintf(ptr->name, UNMLEN, "%lu", (long) uid);
-               ptr->valid = INVALID;
-               if (noname)
-                       return (NULL);
-       } else {
-               /*
-                * there is an entry for this uid in the password file
-                */
-               if (ptr == NULL)
-                       return (pw->pw_name);
-               ptr->uid = uid;
-               (void)strlcpy(ptr->name, pw->pw_name, UNMLEN);
-               ptr->valid = VALID;
-       }
-       return (ptr->name);
-}
-
-/*
- * group_from_gid()
- *     caches the name (if any) for the gid. If noname clear, we always
- *     return the stored name (if valid or invalid match).
- *     We use a simple hash table.
- * Return
- *     Pointer to stored name (or a empty string)
- */
-const char *
-group_from_gid(gid_t gid, int noname)
-{
-       struct group *gr;
-       GIDC *ptr, **pptr;
-
-       if ((gidtb == NULL) && (gidtb_start() < 0))
-               return (NULL);
-       if (gid < 0)
-               return NULL;
-
-       /*
-        * see if we have this gid cached
-        */
-       pptr = gidtb + (gid % GID_SZ);
-       ptr = *pptr;
-
-       if ((ptr != NULL) && (ptr->valid > 0) && (ptr->gid == gid)) {
-               /*
-                * have an entry for this gid
-                */
-               if (!noname || (ptr->valid == VALID))
-                       return (ptr->name);
-               return (NULL);
-       }
-
-       /*
-        * No entry for this gid, we will add it
-        */
-       if (!gropn) {
-               if (_pwcache_setgroupent != NULL)
-                       (*_pwcache_setgroupent)(1);
-               else
-                       setgrent();
-               ++gropn;
-       }
-
-       if (ptr == NULL)
-               *pptr = ptr = (GIDC *)malloc(sizeof(GIDC));
-
-       if ((gr = (*_pwcache_getgrgid)(gid)) == NULL) {
-               /*
-                * no match for this gid in the local group file, put in
-                * a string that is the gid in numberic format
-                */
-               if (ptr == NULL)
-                       return (NULL);
-               ptr->gid = gid;
-               (void)snprintf(ptr->name, GNMLEN, "%lu", (long) gid);
-               ptr->valid = INVALID;
-               if (noname)
-                       return (NULL);
-       } else {
-               /*
-                * there is an entry for this group in the group file
-                */
-               if (ptr == NULL)
-                       return (gr->gr_name);
-               ptr->gid = gid;
-               (void)strlcpy(ptr->name, gr->gr_name, GNMLEN);
-               ptr->valid = VALID;
-       }
-       return (ptr->name);
-}
-
-/*
- * uid_from_user()
- *     caches the uid for a given user name. We use a simple hash table.
- * Return
- *     the uid (if any) for a user name, or a -1 if no match can be found
- */
-int
-uid_from_user(const char *name, uid_t *uid)
-{
-       struct passwd *pw;
-       UIDC *ptr, **pptr;
-       size_t namelen;
-
-       /*
-        * return -1 for mangled names
-        */
-       if (name == NULL || ((namelen = strlen(name)) == 0))
-               return (-1);
-       if ((usrtb == NULL) && (usrtb_start() < 0))
-               return (-1);
-
-       /*
-        * look up in hash table, if found and valid return the uid,
-        * if found and invalid, return a -1
-        */
-       pptr = usrtb + st_hash(name, namelen, UNM_SZ);
-       ptr = *pptr;
-
-       if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) {
-               if (ptr->valid == INVALID)
-                       return (-1);
-               *uid = ptr->uid;
-               return (0);
-       }
-
-       if (!pwopn) {
-               if (_pwcache_setpassent != NULL)
-                       (*_pwcache_setpassent)(1);
-               else
-                       setpwent();
-               ++pwopn;
-       }
-
-       if (ptr == NULL)
-               *pptr = ptr = (UIDC *)malloc(sizeof(UIDC));
-
-       /*
-        * no match, look it up, if no match store it as an invalid entry,
-        * or store the matching uid
-        */
-       if (ptr == NULL) {
-               if ((pw = (*_pwcache_getpwnam)(name)) == NULL)
-                       return (-1);
-               *uid = pw->pw_uid;
-               return (0);
-       }
-       (void)strlcpy(ptr->name, name, UNMLEN);
-       if ((pw = (*_pwcache_getpwnam)(name)) == NULL) {
-               ptr->valid = INVALID;
-               return (-1);
-       }
-       ptr->valid = VALID;
-       *uid = ptr->uid = pw->pw_uid;
-       return (0);
-}
-
-/*
- * gid_from_group()
- *     caches the gid for a given group name. We use a simple hash table.
- * Return
- *     the gid (if any) for a group name, or a -1 if no match can be found
- */
-int
-gid_from_group(const char *name, gid_t *gid)
-{
-       struct group *gr;
-       GIDC *ptr, **pptr;
-       size_t namelen;
-
-       /*
-        * return -1 for mangled names
-        */
-       if (name == NULL || ((namelen = strlen(name)) == 0))
-               return (-1);
-       if ((grptb == NULL) && (grptb_start() < 0))
-               return (-1);
-
-       /*
-        * look up in hash table, if found and valid return the uid,
-        * if found and invalid, return a -1
-        */
-       pptr = grptb + st_hash(name, namelen, GID_SZ);
-       ptr = *pptr;
-
-       if ((ptr != NULL) && (ptr->valid > 0) && !strcmp(name, ptr->name)) {
-               if (ptr->valid == INVALID)
-                       return (-1);
-               *gid = ptr->gid;
-               return (0);
-       }
-
-       if (!gropn) {
-               if (_pwcache_setgroupent != NULL)
-                       (*_pwcache_setgroupent)(1);
-               else
-                       setgrent();
-               ++gropn;
-       }
-
-       if (ptr == NULL)
-               *pptr = ptr = (GIDC *)malloc(sizeof(GIDC));
-
-       /*
-        * no match, look it up, if no match store it as an invalid entry,
-        * or store the matching gid
-        */
-       if (ptr == NULL) {
-               if ((gr = (*_pwcache_getgrnam)(name)) == NULL)
-                       return (-1);
-               *gid = gr->gr_gid;
-               return (0);
-       }
-
-       (void)strlcpy(ptr->name, name, GNMLEN);
-       if ((gr = (*_pwcache_getgrnam)(name)) == NULL) {
-               ptr->valid = INVALID;
-               return (-1);
-       }
-       ptr->valid = VALID;
-       *gid = ptr->gid = gr->gr_gid;
-       return (0);
-}
-
-#define FLUSHTB(arr, len, fail)                                \
-       do {                                            \
-               if (arr != NULL) {                      \
-                       for (i = 0; i < len; i++)       \
-                               if (arr[i] != NULL)     \
-                                       free(arr[i]);   \
-                       arr = NULL;                     \
-               }                                       \
-               fail = 0;                               \
-       } while (/* CONSTCOND */0);
-
-int
-pwcache_userdb(
-       int             (*a_setpassent)(int),
-       void            (*a_endpwent)(void),
-       struct passwd * (*a_getpwnam)(const char *),
-       struct passwd * (*a_getpwuid)(uid_t))
-{
-       int i;
-
-               /* a_setpassent and a_endpwent may be NULL */
-       if (a_getpwnam == NULL || a_getpwuid == NULL)
-               return (-1);
-
-       if (_pwcache_endpwent != NULL)
-               (*_pwcache_endpwent)();
-       FLUSHTB(uidtb, UID_SZ, uidtb_fail);
-       FLUSHTB(usrtb, UNM_SZ, usrtb_fail);
-       pwopn = 0;
-       _pwcache_setpassent = a_setpassent;
-       _pwcache_endpwent = a_endpwent;
-       _pwcache_getpwnam = a_getpwnam;
-       _pwcache_getpwuid = a_getpwuid;
-
-       return (0);
-}
-
-int
-pwcache_groupdb(
-       int             (*a_setgroupent)(int),
-       void            (*a_endgrent)(void),
-       struct group *  (*a_getgrnam)(const char *),
-       struct group *  (*a_getgrgid)(gid_t))
-{
-       int i;
-
-               /* a_setgroupent and a_endgrent may be NULL */
-       if (a_getgrnam == NULL || a_getgrgid == NULL)
-               return (-1);
-
-       if (_pwcache_endgrent != NULL)
-               (*_pwcache_endgrent)();
-       FLUSHTB(gidtb, GID_SZ, gidtb_fail);
-       FLUSHTB(grptb, GNM_SZ, grptb_fail);
-       gropn = 0;
-       _pwcache_setgroupent = a_setgroupent;
-       _pwcache_endgrent = a_endgrent;
-       _pwcache_getgrnam = a_getgrnam;
-       _pwcache_getgrgid = a_getgrgid;
-
-       return (0);
-}
-
-
-#ifdef TEST_PWCACHE
-
-struct passwd *
-test_getpwnam(const char *name)
-{
-       static struct passwd foo;
-
-       memset(&foo, 0, sizeof(foo));
-       if (strcmp(name, "toor") == 0) {
-               foo.pw_uid = 666;
-               return &foo;
-       }
-       return (getpwnam(name));
-}
-
-int
-main(int argc, char *argv[])
-{
-       uid_t   u;
-       int     r, i;
-
-       printf("pass 1 (default userdb)\n");
-       for (i = 1; i < argc; i++) {
-               printf("i: %d, pwopn %d usrtb_fail %d usrtb %p\n",
-                   i, pwopn, usrtb_fail, usrtb);
-               r = uid_from_user(argv[i], &u);
-               if (r == -1)
-                       printf("  uid_from_user %s: failed\n", argv[i]);
-               else
-                       printf("  uid_from_user %s: %d\n", argv[i], u);
-       }
-       printf("pass 1 finish: pwopn %d usrtb_fail %d usrtb %p\n",
-                   pwopn, usrtb_fail, usrtb);
-
-       puts("");
-       printf("pass 2 (replacement userdb)\n");
-       printf("pwcache_userdb returned %d\n",
-           pwcache_userdb(setpassent, test_getpwnam, getpwuid));
-       printf("pwopn %d usrtb_fail %d usrtb %p\n", pwopn, usrtb_fail, usrtb);
-
-       for (i = 1; i < argc; i++) {
-               printf("i: %d, pwopn %d usrtb_fail %d usrtb %p\n",
-                   i, pwopn, usrtb_fail, usrtb);
-               u = -1;
-               r = uid_from_user(argv[i], &u);
-               if (r == -1)
-                       printf("  uid_from_user %s: failed\n", argv[i]);
-               else
-                       printf("  uid_from_user %s: %d\n", argv[i], u);
-       }
-       printf("pass 2 finish: pwopn %d usrtb_fail %d usrtb %p\n",
-                   pwopn, usrtb_fail, usrtb);
-
-       puts("");
-       printf("pass 3 (null pointers)\n");
-       printf("pwcache_userdb returned %d\n",
-           pwcache_userdb(NULL, NULL, NULL));
-
-       return (0);
-}
-#endif /* TEST_PWCACHE */
-#endif /* !HAVE_PWCACHE_USERDB */
diff --git a/lib/libc/other/random.c b/lib/libc/other/random.c
deleted file mode 100644 (file)
index ef8df6e..0000000
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)random.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-/*
- * random.c:
- *
- * An improved random number generation package.  In addition to the standard
- * rand()/srand() like interface, this package also has a special state info
- * interface.  The initstate() routine is called with a seed, an array of
- * bytes, and a count of how many bytes are being passed in; this array is
- * then initialized to contain information for random number generation with
- * that much state information.  Good sizes for the amount of state
- * information are 32, 64, 128, and 256 bytes.  The state can be switched by
- * calling the setstate() routine with the same array as was initiallized
- * with initstate().  By default, the package runs with 128 bytes of state
- * information and generates far better random numbers than a linear
- * congruential generator.  If the amount of state information is less than
- * 32 bytes, a simple linear congruential R.N.G. is used.
- *
- * Internally, the state information is treated as an array of longs; the
- * zeroeth element of the array is the type of R.N.G. being used (small
- * integer); the remainder of the array is the state information for the
- * R.N.G.  Thus, 32 bytes of state information will give 7 longs worth of
- * state information, which will allow a degree seven polynomial.  (Note:
- * the zeroeth word of state information also has some other information
- * stored in it -- see setstate() for details).
- * 
- * The random number generation technique is a linear feedback shift register
- * approach, employing trinomials (since there are fewer terms to sum up that
- * way).  In this approach, the least significant bit of all the numbers in
- * the state table will act as a linear feedback shift register, and will
- * have period 2^deg - 1 (where deg is the degree of the polynomial being
- * used, assuming that the polynomial is irreducible and primitive).  The
- * higher order bits will have longer periods, since their values are also
- * influenced by pseudo-random carries out of the lower bits.  The total
- * period of the generator is approximately deg*(2**deg - 1); thus doubling
- * the amount of state information has a vast influence on the period of the
- * generator.  Note: the deg*(2**deg - 1) is an approximation only good for
- * large deg, when the period of the shift register is the dominant factor.
- * With deg equal to seven, the period is actually much longer than the
- * 7*(2**7 - 1) predicted by this formula.
- */
-
-/*
- * For each of the currently supported random number generators, we have a
- * break value on the amount of state information (you need at least this
- * many bytes of state info to support this random number generator), a degree
- * for the polynomial (actually a trinomial) that the R.N.G. is based on, and
- * the separation between the two lower order coefficients of the trinomial.
- */
-#define        TYPE_0          0               /* linear congruential */
-#define        BREAK_0         8
-#define        DEG_0           0
-#define        SEP_0           0
-
-#define        TYPE_1          1               /* x**7 + x**3 + 1 */
-#define        BREAK_1         32
-#define        DEG_1           7
-#define        SEP_1           3
-
-#define        TYPE_2          2               /* x**15 + x + 1 */
-#define        BREAK_2         64
-#define        DEG_2           15
-#define        SEP_2           1
-
-#define        TYPE_3          3               /* x**31 + x**3 + 1 */
-#define        BREAK_3         128
-#define        DEG_3           31
-#define        SEP_3           3
-
-#define        TYPE_4          4               /* x**63 + x + 1 */
-#define        BREAK_4         256
-#define        DEG_4           63
-#define        SEP_4           1
-
-/*
- * Array versions of the above information to make code run faster --
- * relies on fact that TYPE_i == i.
- */
-#define        MAX_TYPES       5               /* max number of types above */
-
-static int degrees[MAX_TYPES] =        { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 };
-static int seps [MAX_TYPES] =  { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
-
-/*
- * Initially, everything is set up as if from:
- *
- *     initstate(1, &randtbl, 128);
- *
- * Note that this initialization takes advantage of the fact that srandom()
- * advances the front and rear pointers 10*rand_deg times, and hence the
- * rear pointer which starts at 0 will also end up at zero; thus the zeroeth
- * element of the state information, which contains info about the current
- * position of the rear pointer is just
- *
- *     MAX_TYPES * (rptr - state) + TYPE_3 == TYPE_3.
- */
-
-static long randtbl[DEG_3 + 1] = {
-       TYPE_3,
-       0x9a319039, 0x32d9c024, 0x9b663182, 0x5da1f342, 0xde3b81e0, 0xdf0a6fb5,
-       0xf103bc02, 0x48f340fb, 0x7449e56b, 0xbeb1dbb0, 0xab5c5918, 0x946554fd,
-       0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, 0x2d436b86, 0xda672e2a, 0x1588ca88,
-       0xe369735d, 0x904f35f7, 0xd7158fd6, 0x6fa6f051, 0x616e6b96, 0xac94efdc,
-       0x36413f93, 0xc622c298, 0xf5a42ab8, 0x8a88d77b, 0xf5ad9d0e, 0x8999220b,
-       0x27fb47b9,
-};
-
-/*
- * fptr and rptr are two pointers into the state info, a front and a rear
- * pointer.  These two pointers are always rand_sep places aparts, as they
- * cycle cyclically through the state information.  (Yes, this does mean we
- * could get away with just one pointer, but the code for random() is more
- * efficient this way).  The pointers are left positioned as they would be
- * from the call
- *
- *     initstate(1, randtbl, 128);
- *
- * (The position of the rear pointer, rptr, is really 0 (as explained above
- * in the initialization of randtbl) because the state table pointer is set
- * to point to randtbl[1] (as explained below).
- */
-static long *fptr = &randtbl[SEP_3 + 1];
-static long *rptr = &randtbl[1];
-
-/*
- * The following things are the pointer to the state information table, the
- * type of the current generator, the degree of the current polynomial being
- * used, and the separation between the two pointers.  Note that for efficiency
- * of random(), we remember the first location of the state information, not
- * the zeroeth.  Hence it is valid to access state[-1], which is used to
- * store the type of the R.N.G.  Also, we remember the last location, since
- * this is more efficient than indexing every time to find the address of
- * the last element to see if the front and rear pointers have wrapped.
- */
-static long *state = &randtbl[1];
-static int rand_type = TYPE_3;
-static int rand_deg = DEG_3;
-static int rand_sep = SEP_3;
-static long *end_ptr = &randtbl[DEG_3 + 1];
-
-/*
- * srandom:
- *
- * Initialize the random number generator based on the given seed.  If the
- * type is the trivial no-state-information type, just remember the seed.
- * Otherwise, initializes state[] based on the given "seed" via a linear
- * congruential generator.  Then, the pointers are set to known locations
- * that are exactly rand_sep places apart.  Lastly, it cycles the state
- * information a given number of times to get rid of any initial dependencies
- * introduced by the L.C.R.N.G.  Note that the initialization of randtbl[]
- * for default usage relies on values produced by this routine.
- */
-void
-srandom(x)
-       u_int x;
-{
-       register int i, j;
-
-       if (rand_type == TYPE_0)
-               state[0] = x;
-       else {
-               j = 1;
-               state[0] = x;
-               for (i = 1; i < rand_deg; i++)
-                       state[i] = 1103515245 * state[i - 1] + 12345;
-               fptr = &state[rand_sep];
-               rptr = &state[0];
-               for (i = 0; i < 10 * rand_deg; i++)
-                       (void)random();
-       }
-}
-
-/*
- * initstate:
- *
- * Initialize the state information in the given array of n bytes for future
- * random number generation.  Based on the number of bytes we are given, and
- * the break values for the different R.N.G.'s, we choose the best (largest)
- * one we can and set things up for it.  srandom() is then called to
- * initialize the state information.
- * 
- * Note that on return from srandom(), we set state[-1] to be the type
- * multiplexed with the current value of the rear pointer; this is so
- * successive calls to initstate() won't lose this information and will be
- * able to restart with setstate().
- * 
- * Note: the first thing we do is save the current state, if any, just like
- * setstate() so that it doesn't matter when initstate is called.
- *
- * Returns a pointer to the old state.
- */
-char *
-initstate(seed, arg_state, n)
-       u_int seed;                     /* seed for R.N.G. */
-       char *arg_state;                /* pointer to state array */
-       size_t n;                       /* # bytes of state info */
-{
-       register char *ostate = (char *)(&state[-1]);
-
-       if (rand_type == TYPE_0)
-               state[-1] = rand_type;
-       else
-               state[-1] = MAX_TYPES * (rptr - state) + rand_type;
-       if (n < BREAK_0) {
-               (void)fprintf(stderr,
-                   "random: not enough state (%d bytes); ignored.\n", n);
-               return(0);
-       }
-       if (n < BREAK_1) {
-               rand_type = TYPE_0;
-               rand_deg = DEG_0;
-               rand_sep = SEP_0;
-       } else if (n < BREAK_2) {
-               rand_type = TYPE_1;
-               rand_deg = DEG_1;
-               rand_sep = SEP_1;
-       } else if (n < BREAK_3) {
-               rand_type = TYPE_2;
-               rand_deg = DEG_2;
-               rand_sep = SEP_2;
-       } else if (n < BREAK_4) {
-               rand_type = TYPE_3;
-               rand_deg = DEG_3;
-               rand_sep = SEP_3;
-       } else {
-               rand_type = TYPE_4;
-               rand_deg = DEG_4;
-               rand_sep = SEP_4;
-       }
-       state = &(((long *)arg_state)[1]);      /* first location */
-       end_ptr = &state[rand_deg];     /* must set end_ptr before srandom */
-       srandom(seed);
-       if (rand_type == TYPE_0)
-               state[-1] = rand_type;
-       else
-               state[-1] = MAX_TYPES*(rptr - state) + rand_type;
-       return(ostate);
-}
-
-/*
- * setstate:
- *
- * Restore the state from the given state array.
- *
- * Note: it is important that we also remember the locations of the pointers
- * in the current state information, and restore the locations of the pointers
- * from the old state information.  This is done by multiplexing the pointer
- * location into the zeroeth word of the state information.
- *
- * Note that due to the order in which things are done, it is OK to call
- * setstate() with the same state as the current state.
- *
- * Returns a pointer to the old state information.
- */
-char *
-setstate(arg_state)
-       const char *arg_state;
-{
-       register long *new_state = (long *)arg_state;
-       register int type = new_state[0] % MAX_TYPES;
-       register int rear = new_state[0] / MAX_TYPES;
-       char *ostate = (char *)(&state[-1]);
-
-       if (rand_type == TYPE_0)
-               state[-1] = rand_type;
-       else
-               state[-1] = MAX_TYPES * (rptr - state) + rand_type;
-       switch(type) {
-       case TYPE_0:
-       case TYPE_1:
-       case TYPE_2:
-       case TYPE_3:
-       case TYPE_4:
-               rand_type = type;
-               rand_deg = degrees[type];
-               rand_sep = seps[type];
-               break;
-       default:
-               (void)fprintf(stderr,
-                   "random: state info corrupted; not changed.\n");
-       }
-       state = &new_state[1];
-       if (rand_type != TYPE_0) {
-               rptr = &state[rear];
-               fptr = &state[(rear + rand_sep) % rand_deg];
-       }
-       end_ptr = &state[rand_deg];             /* set end_ptr too */
-       return(ostate);
-}
-
-/*
- * random:
- *
- * If we are using the trivial TYPE_0 R.N.G., just do the old linear
- * congruential bit.  Otherwise, we do our fancy trinomial stuff, which is
- * the same in all the other cases due to all the global variables that have
- * been set up.  The basic operation is to add the number at the rear pointer
- * into the one at the front pointer.  Then both pointers are advanced to
- * the next location cyclically in the table.  The value returned is the sum
- * generated, reduced to 31 bits by throwing away the "least random" low bit.
- *
- * Note: the code takes advantage of the fact that both the front and
- * rear pointers can't wrap on the same call by not testing the rear
- * pointer if the front one has wrapped.
- *
- * Returns a 31-bit random number.
- */
-long
-random()
-{
-       long i;
-
-       if (rand_type == TYPE_0)
-               i = state[0] = (state[0] * 1103515245 + 12345) & 0x7fffffff;
-       else {
-               *fptr += *rptr;
-               i = (*fptr >> 1) & 0x7fffffff;  /* chucking least random bit */
-               if (++fptr >= end_ptr) {
-                       fptr = state;
-                       ++rptr;
-               } else if (++rptr >= end_ptr)
-                       rptr = state;
-       }
-       return(i);
-}
diff --git a/lib/libc/other/realpath.c b/lib/libc/other/realpath.c
deleted file mode 100644 (file)
index 3a43445..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/*     realpath() - resolve absolute path        Author: Erik van der Kouwe
- *                                            4 December 2009
- *
- * Based on this specification:
- * http://www.opengroup.org/onlinepubs/000095399/functions/realpath.html 
- */
-#include <errno.h>
-#include <limits.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-static char *append_path_component(char *path, const char *component, 
-       size_t component_length);
-static char *process_path_component(const char *component, 
-       size_t component_length, char *resolved_name, int last_part, int max_depth);
-static char *realpath_recurse(const char *file_name, char *resolved_name, 
-       int max_depth);
-static char *remove_last_path_component(char *path);
-
-static char *append_path_component(char *path, const char *component, 
-       size_t component_length)
-{
-       size_t path_length, slash_length;
-
-       /* insert or remove a slash? */
-       path_length = strlen(path);
-       slash_length = 
-               ((path[path_length - 1] == '/') ? 0 : 1) + 
-               ((component[0] == '/') ? 0 : 1) - 1;
-
-       /* check whether this fits */
-       if (path_length + slash_length + component_length >= PATH_MAX)
-       {
-               errno = ENAMETOOLONG;
-               return NULL;
-       }
-
-       /* insert slash if needed */
-       if (slash_length > 0)
-               path[path_length] = '/';
-
-       /* copy the bytes */
-       memcpy(path + path_length + slash_length, component, component_length);
-       path[path_length + slash_length + component_length] = 0;
-
-       return path;
-}
-
-static char *process_path_component(const char *component, 
-       size_t component_length, char *resolved_name, int last_part, int max_depth)
-{
-       char readlink_buffer[PATH_MAX + 1];
-       ssize_t readlink_buffer_length;
-       struct stat stat_buffer;
-
-       /* handle zero-length components */
-       if (!component_length)
-       {
-               if (last_part)
-                       return resolved_name;
-               else
-               {
-                       errno = ENOENT;
-                       return NULL;
-               }
-       }
-
-       /* ignore current directory components */
-       if (component_length == 1 && component[0] == '.')
-               return resolved_name;
-
-       /* process parent directory components */
-       if (component_length == 2 && component[0] == '.' && component[1] == '.')
-               return remove_last_path_component(resolved_name);
-
-       /* not a special case, so just add the component */
-       if (!append_path_component(resolved_name, component, component_length))
-               return NULL;
-
-       /* stat partially resolved file */
-       if (lstat(resolved_name, &stat_buffer) < 0)
-       {
-               if (last_part && errno == ENOENT)
-                       return resolved_name;
-               else
-                       return NULL;
-       }
-
-       if (S_ISLNK(stat_buffer.st_mode))
-       {
-               /* resolve symbolic link */
-               readlink_buffer_length = readlink(resolved_name, 
-                       readlink_buffer, 
-                       sizeof(readlink_buffer) - 1);
-               if (readlink_buffer_length < 0)
-                       return NULL;
-
-               readlink_buffer[readlink_buffer_length] = 0;
-               
-               /* recurse to resolve path in link */
-               remove_last_path_component(resolved_name);
-               if (!realpath_recurse(readlink_buffer, resolved_name, 
-                       max_depth - 1))
-                       return NULL;
-
-               /* stat symlink target */
-               if (lstat(resolved_name, &stat_buffer) < 0)
-               {
-                       if (last_part && errno == ENOENT)
-                               return resolved_name;
-                       else
-                               return NULL;
-               }
-       }
-       
-       /* non-directories may appear only as the last component */
-       if (!last_part && !S_ISDIR(stat_buffer.st_mode))
-       {
-               errno = ENOTDIR;
-               return NULL;
-       }
-       
-       return resolved_name;
-}
-
-static char *realpath_recurse(const char *file_name, char *resolved_name, 
-       int max_depth)
-{
-       const char *file_name_component;
-
-       /* avoid infinite recursion */
-       if (max_depth <= 0)
-       {
-               errno = ELOOP;
-               return NULL;
-       }
-
-       /* relative to root or to current? */
-       if (file_name[0] == '/')
-       {
-               /* relative to root */
-               resolved_name[0] = '/';
-               resolved_name[1] = '\0';
-               file_name++;
-       }
-
-       /* process the path component by component */
-       while (*file_name)
-       {
-               /* extract a slash-delimited component */
-               file_name_component = file_name;
-               while (*file_name && *file_name != '/')
-                       file_name++;
-
-               /* check length of component */
-               if (file_name - file_name_component > PATH_MAX)
-               {
-                       errno = ENAMETOOLONG;
-                       return NULL;
-               }
-
-               /* add the component to the current result */
-               if (!process_path_component(
-                       file_name_component, 
-                       file_name - file_name_component,
-                       resolved_name,
-                       !*file_name,
-                       max_depth))
-                       return NULL;
-
-               /* skip the slash(es) */
-               while (*file_name == '/')
-                       file_name++;
-       }
-
-       return resolved_name;
-}
-
-static char *remove_last_path_component(char *path)
-{
-       char *current, *slash;
-
-       /* find the last slash */
-       slash = NULL;
-       for (current = path; *current; current++)
-               if (*current == '/')
-                       slash = current;
-
-       /* truncate after the last slash, but do not remove the root */
-       if (slash > path)
-               *slash = 0;
-       else if (slash == path)
-               slash[1] = 0;
-
-       return path;
-}
-
-char *realpath(const char *file_name, char *resolved_name)
-{
-       /* check parameters */
-       if (!file_name || !resolved_name)
-       {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       if (strlen(file_name) > PATH_MAX)
-       {
-               errno = ENAMETOOLONG;
-               return NULL;
-       }
-
-       /* basis to resolve against: root or CWD */
-       if (file_name[0] == '/')
-               *resolved_name = 0;
-       else if (!getcwd(resolved_name, PATH_MAX))
-               return NULL;
-
-       /* do the actual work */
-       return realpath_recurse(file_name, resolved_name, SYMLOOP_MAX);
-}
diff --git a/lib/libc/other/rindex.c b/lib/libc/other/rindex.c
deleted file mode 100644 (file)
index 0c2896c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <lib.h>
-/* rindex - find last occurrence of a character in a string  */
-
-#include <string.h>
-
-char *rindex(s, charwanted)    /* found char, or NULL if none */
-_CONST char *s;
-char charwanted;
-{
-  return(strrchr(s, charwanted));
-}
diff --git a/lib/libc/other/rlimit.c b/lib/libc/other/rlimit.c
deleted file mode 100644 (file)
index 77fd8c2..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*     getdtablesize, getrlimit              Author: Erik van der Kouwe
- *      query resource consumtion limits      4 December 2009
- *
- * Based on these specifications:
- * http://www.opengroup.org/onlinepubs/007908775/xsh/getdtablesize.html 
- * http://www.opengroup.org/onlinepubs/007908775/xsh/getrlimit.html 
- */
-#include <errno.h>
-#include <limits.h>
-#include <sys/resource.h>
-#include <unistd.h>
-
-int getdtablesize(void)
-{
-       return OPEN_MAX;
-}
-
-int getrlimit(int resource, struct rlimit *rlp)
-{
-       rlim_t limit;
-       
-       switch (resource)
-       {
-               case RLIMIT_CORE:
-                       /* no core currently produced */
-                       limit = 0;
-                       break;
-
-               case RLIMIT_CPU:
-               case RLIMIT_DATA:
-               case RLIMIT_FSIZE:
-               case RLIMIT_STACK:
-               case RLIMIT_AS:
-                       /* no limit enforced (however architectural limits 
-                        * may apply) 
-                        */     
-                       limit = RLIM_INFINITY;
-                       break;
-
-               case RLIMIT_NOFILE:
-                       limit = OPEN_MAX;
-                       break;
-
-               default:
-                       errno = EINVAL;
-                       return -1;
-       }               
-
-       /* return limit */
-       rlp->rlim_cur = limit;
-       rlp->rlim_max = limit;
-       return 0;
-}
-
diff --git a/lib/libc/other/setenv.c b/lib/libc/other/setenv.c
deleted file mode 100644 (file)
index a04076f..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 1987, 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setenv.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-char *__findenv(const char *, int *);
-
-/*
- * setenv --
- *     Set the value of the environmental variable "name" to be
- *     "value".  If rewrite is set, replace any current value.
- */
-int
-setenv(name, value, rewrite)
-       register const char *name;
-       register const char *value;
-       int rewrite;
-{
-       extern char **environ;
-       static int alloced;                     /* if allocated space before */
-       register char *c;
-       int l_value, offset;
-
-       if (*value == '=')                      /* no `=' in value */
-               ++value;
-       l_value = strlen(value);
-       if ((c = __findenv(name, &offset))) {   /* find if already exists */
-               if (!rewrite)
-                       return (0);
-               if (strlen(c) >= l_value) {     /* old larger; copy over */
-                       while ((*c++ = *value++));
-                       return (0);
-               }
-       } else {                                        /* create new slot */
-               register int cnt;
-               register char **p;
-
-               for (p = environ, cnt = 0; *p; ++p, ++cnt);
-               if (alloced) {                  /* just increase size */
-                       environ = (char **)realloc((char *)environ,
-                           (size_t)(sizeof(char *) * (cnt + 2)));
-                       if (!environ)
-                               return (-1);
-               }
-               else {                          /* get new space */
-                       alloced = 1;            /* copy old entries into it */
-                       p = malloc((size_t)(sizeof(char *) * (cnt + 2)));
-                       if (!p)
-                               return (-1);
-                       memcpy(p, environ, cnt * sizeof(char *));
-                       environ = p;
-               }
-               environ[cnt + 1] = NULL;
-               offset = cnt;
-       }
-       for (c = (char *)name; *c && *c != '='; ++c);   /* no `=' in name */
-       if (!(environ[offset] =                 /* name + `=' + value */
-           malloc((size_t)((int)(c - name) + l_value + 2))))
-               return (-1);
-       for (c = environ[offset]; (*c = *name++) && *c != '='; ++c);
-       for (*c++ = '='; (*c++ = *value++););
-       return (0);
-}
-
-/*
- * unsetenv(name) --
- *     Delete environmental variable "name".
- */
-int
-unsetenv(name)
-       const char *name;
-{
-       extern char **environ;
-       register char **p;
-       int offset;
-
-       if (name == NULL || strlen(name) == 0 || strchr(name, '=') != 0)
-       {
-               errno= EINVAL;
-               return -1;
-       }
-
-       while (__findenv(name, &offset))        /* if set multiple times */
-               for (p = &environ[offset];; ++p)
-                       if (!(*p = *(p + 1)))
-                               break;
-       return 0;
-}
-
-/*
- * __findenv --
- *     Returns pointer to value associated with name, if any, else NULL.
- *     Sets offset to be the offset of the name/value combination in the
- *     environmental array, for use by setenv(3) and unsetenv(3).
- *     Explicitly removes '=' in argument name.
- *
- *     This routine *should* be a static; don't use it.
- */
-char *
-__findenv(name, offset)
-       register const char *name;
-       int *offset;
-{
-       extern char **environ;
-       register int len;
-       register const char *np;
-       register char **p, *c;
-
-       if (name == NULL || environ == NULL)
-               return (NULL);
-       for (np = name; *np && *np != '='; ++np)
-               continue;
-       len = np - name;
-       for (p = environ; (c = *p) != NULL; ++p)
-               if (strncmp(c, name, len) == 0 && c[len] == '=') {
-                       *offset = p - environ;
-                       return (c + len + 1);
-               }
-       return (NULL);
-}
-/*
- * $PchId: setenv.c,v 1.3 1996/05/09 20:43:02 philip Exp philip $
- */
diff --git a/lib/libc/other/setmode.c b/lib/libc/other/setmode.c
deleted file mode 100644 (file)
index 1c4c4bf..0000000
+++ /dev/null
@@ -1,505 +0,0 @@
-/*     $NetBSD: setmode.c,v 1.31 2005/10/01 20:08:01 christos Exp $    */
-
-/*
- * Copyright (c) 1989, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Dave Borman at Cray Research, Inc.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)setmode.c  8.2 (Berkeley) 3/25/94";
-#else
-__RCSID("$NetBSD: setmode.c,v 1.31 2005/10/01 20:08:01 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <limits.h>
-#include <unistd.h>
-
-#ifdef SETMODE_DEBUG
-#include <stdio.h>
-#endif
-
-#ifdef __weak_alias
-__weak_alias(getmode,_getmode)
-__weak_alias(setmode,_setmode)
-#endif
-
-#define        SET_LEN 6               /* initial # of bitcmd struct to malloc */
-#define        SET_LEN_INCR 4          /* # of bitcmd structs to add as needed */
-
-typedef struct bitcmd {
-       char    cmd;
-       char    cmd2;
-       mode_t  bits;
-} BITCMD;
-
-#define        CMD2_CLR        0x01
-#define        CMD2_SET        0x02
-#define        CMD2_GBITS      0x04
-#define        CMD2_OBITS      0x08
-#define        CMD2_UBITS      0x10
-
-#define _DIAGASSERT assert
-
-static BITCMD  *addcmd (BITCMD *, mode_t, mode_t, mode_t, mode_t);
-static void     compress_mode (BITCMD *);
-#ifdef SETMODE_DEBUG
-static void     dumpmode (BITCMD *);
-#endif
-
-/*
- * Given the old mode and an array of bitcmd structures, apply the operations
- * described in the bitcmd structures to the old mode, and return the new mode.
- * Note that there is no '=' command; a strict assignment is just a '-' (clear
- * bits) followed by a '+' (set bits).
- */
-mode_t
-getmode(const void *bbox, mode_t omode)
-{
-       const BITCMD *set;
-       mode_t clrval, newmode, value;
-
-       _DIAGASSERT(bbox != NULL);
-
-       set = (const BITCMD *)bbox;
-       newmode = omode;
-       for (value = 0;; set++)
-               switch(set->cmd) {
-               /*
-                * When copying the user, group or other bits around, we "know"
-                * where the bits are in the mode so that we can do shifts to
-                * copy them around.  If we don't use shifts, it gets real
-                * grundgy with lots of single bit checks and bit sets.
-                */
-               case 'u':
-                       value = (newmode & S_IRWXU) >> 6;
-                       goto common;
-
-               case 'g':
-                       value = (newmode & S_IRWXG) >> 3;
-                       goto common;
-
-               case 'o':
-                       value = newmode & S_IRWXO;
-common:                        if (set->cmd2 & CMD2_CLR) {
-                               clrval =
-                                   (set->cmd2 & CMD2_SET) ?  S_IRWXO : value;
-                               if (set->cmd2 & CMD2_UBITS)
-                                       newmode &= ~((clrval<<6) & set->bits);
-                               if (set->cmd2 & CMD2_GBITS)
-                                       newmode &= ~((clrval<<3) & set->bits);
-                               if (set->cmd2 & CMD2_OBITS)
-                                       newmode &= ~(clrval & set->bits);
-                       }
-                       if (set->cmd2 & CMD2_SET) {
-                               if (set->cmd2 & CMD2_UBITS)
-                                       newmode |= (value<<6) & set->bits;
-                               if (set->cmd2 & CMD2_GBITS)
-                                       newmode |= (value<<3) & set->bits;
-                               if (set->cmd2 & CMD2_OBITS)
-                                       newmode |= value & set->bits;
-                       }
-                       break;
-
-               case '+':
-                       newmode |= set->bits;
-                       break;
-
-               case '-':
-                       newmode &= ~set->bits;
-                       break;
-
-               case 'X':
-                       if (omode & (S_IFDIR|S_IXUSR|S_IXGRP|S_IXOTH))
-                               newmode |= set->bits;
-                       break;
-
-               case '\0':
-               default:
-#ifdef SETMODE_DEBUG
-                       (void)printf("getmode:%04o -> %04o\n", omode, newmode);
-#endif
-                       return (newmode);
-               }
-}
-
-#define        ADDCMD(a, b, c, d) do {                                         \
-       if (set >= endset) {                                            \
-               BITCMD *newset;                                         \
-               setlen += SET_LEN_INCR;                                 \
-               newset = realloc(saveset, sizeof(BITCMD) * setlen);     \
-               if (newset == NULL)                                     \
-                       goto out;                                       \
-               set = newset + (set - saveset);                         \
-               saveset = newset;                                       \
-               endset = newset + (setlen - 2);                         \
-       }                                                               \
-       set = addcmd(set, (mode_t)(a), (mode_t)(b), (mode_t)(c), (d));  \
-} while (/*CONSTCOND*/0)
-
-#define        STANDARD_BITS   (S_ISUID|S_ISGID|S_IRWXU|S_IRWXG|S_IRWXO)
-
-void *
-setmode(p)
-       const char *p;
-{
-       int serrno;
-       char op, *ep;
-       BITCMD *set, *saveset, *endset;
-       sigset_t signset, sigoset;
-       mode_t mask, perm, permXbits, who;
-       long lval;
-       int equalopdone = 0;    /* pacify gcc */
-       int setlen;
-
-       if (!*p) {
-               errno = EINVAL;
-               return NULL;
-       }
-
-       /*
-        * Get a copy of the mask for the permissions that are mask relative.
-        * Flip the bits, we want what's not set.  Since it's possible that
-        * the caller is opening files inside a signal handler, protect them
-        * as best we can.
-        */
-       sigfillset(&signset);
-       (void)sigprocmask(SIG_BLOCK, &signset, &sigoset);
-       (void)umask(mask = umask(0));
-       mask = ~mask;
-       (void)sigprocmask(SIG_SETMASK, &sigoset, NULL);
-
-       setlen = SET_LEN + 2;
-       
-       if ((set = malloc((u_int)(sizeof(BITCMD) * setlen))) == NULL)
-               return (NULL);
-       saveset = set;
-       endset = set + (setlen - 2);
-
-       /*
-        * If an absolute number, get it and return; disallow non-octal digits
-        * or illegal bits.
-        */
-       if (isdigit((unsigned char)*p)) {
-               errno = 0;
-               lval = strtol(p, &ep, 8);
-               if (*ep) {
-                       errno = EINVAL;
-                       goto out;
-               }
-               if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN))
-                       goto out;
-               if (lval & ~(STANDARD_BITS
-#ifdef S_ISTXT
-               |S_ISTXT
-#endif
-               )) {
-                       errno = EINVAL;
-                       goto out;
-               }
-               perm = (mode_t)lval;
-#ifdef S_ISTXT
-               ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask);
-#else
-               ADDCMD('=', (STANDARD_BITS), perm, mask);
-#endif
-               set->cmd = 0;
-               return (saveset);
-       }
-
-       /*
-        * Build list of structures to set/clear/copy bits as described by
-        * each clause of the symbolic mode.
-        */
-       for (;;) {
-
-               /* First, find out which bits might be modified. */
-               for (who = 0;; ++p) {
-                       switch (*p) {
-                       case 'a':
-                               who |= STANDARD_BITS;
-                               break;
-                       case 'u':
-                               who |= S_ISUID|S_IRWXU;
-                               break;
-                       case 'g':
-                               who |= S_ISGID|S_IRWXG;
-                               break;
-                       case 'o':
-                               who |= S_IRWXO;
-                               break;
-                       default:
-                               goto getop;
-                       }
-               }
-getop:
-               op = *p;
-               p++;
-               if (op != '+' && op != '-' && op != '=') {
-                       errno = EINVAL;
-                       goto out;
-               }
-               if (op == '=')
-                       equalopdone = 0;
-
-#ifdef S_ISTXT
-               who &= ~S_ISTXT;
-#endif
-               for (perm = 0, permXbits = 0;; ++p) {
-                       switch (*p) {
-                       case 'r':
-                               perm |= S_IRUSR|S_IRGRP|S_IROTH;
-                               break;
-                       case 's':
-                               /*
-                                * If specific bits where requested and 
-                                * only "other" bits ignore set-id. 
-                                */
-                               if (who == 0 || (who & ~S_IRWXO))
-                                       perm |= S_ISUID|S_ISGID;
-                               break;
-#ifdef S_ISTXT
-                       case 't':
-                               /*
-                                * If specific bits where requested and 
-                                * only "other" bits ignore set-id. 
-                                */
-                               if (who == 0 || (who & ~S_IRWXO)) {
-                                       who |= S_ISTXT;
-                                       perm |= S_ISTXT;
-                               }
-#endif
-                               break;
-                       case 'w':
-                               perm |= S_IWUSR|S_IWGRP|S_IWOTH;
-                               break;
-                       case 'X':
-                               permXbits = S_IXUSR|S_IXGRP|S_IXOTH;
-                               break;
-                       case 'x':
-                               perm |= S_IXUSR|S_IXGRP|S_IXOTH;
-                               break;
-                       case 'u':
-                       case 'g':
-                       case 'o':
-                               /*
-                                * When ever we hit 'u', 'g', or 'o', we have
-                                * to flush out any partial mode that we have,
-                                * and then do the copying of the mode bits.
-                                */
-                               if (perm) {
-                                       ADDCMD(op, who, perm, mask);
-                                       perm = 0;
-                               }
-                               if (op == '=')
-                                       equalopdone = 1;
-                               if (op == '+' && permXbits) {
-                                       ADDCMD('X', who, permXbits, mask);
-                                       permXbits = 0;
-                               }
-                               ADDCMD(*p, who, op, mask);
-                               break;
-
-                       default:
-                               /*
-                                * Add any permissions that we haven't already
-                                * done.
-                                */
-                               if (perm || (op == '=' && !equalopdone)) {
-                                       if (op == '=')
-                                               equalopdone = 1;
-                                       ADDCMD(op, who, perm, mask);
-                                       perm = 0;
-                               }
-                               if (permXbits) {
-                                       ADDCMD('X', who, permXbits, mask);
-                                       permXbits = 0;
-                               }
-                               goto apply;
-                       }
-               }
-
-apply:         if (!*p)
-                       break;
-               if (*p != ',')
-                       goto getop;
-               ++p;
-       }
-       set->cmd = 0;
-#ifdef SETMODE_DEBUG
-       (void)printf("Before compress_mode()\n");
-       dumpmode(saveset);
-#endif
-       compress_mode(saveset);
-#ifdef SETMODE_DEBUG
-       (void)printf("After compress_mode()\n");
-       dumpmode(saveset);
-#endif
-       return (saveset);
-out:
-       serrno = errno;
-       free(saveset);
-       errno = serrno;
-       return NULL;
-}
-
-static BITCMD *
-addcmd(BITCMD *set, mode_t op, mode_t who, mode_t oparg, mode_t mask)
-{
-
-       _DIAGASSERT(set != NULL);
-
-       switch (op) {
-       case '=':
-               set->cmd = '-';
-               set->bits = who ? who : STANDARD_BITS;
-               set++;
-
-               op = '+';
-               /* FALLTHROUGH */
-       case '+':
-       case '-':
-       case 'X':
-               set->cmd = op;
-               set->bits = (who ? who : mask) & oparg;
-               break;
-
-       case 'u':
-       case 'g':
-       case 'o':
-               set->cmd = op;
-               if (who) {
-                       set->cmd2 = ((who & S_IRUSR) ? CMD2_UBITS : 0) |
-                                   ((who & S_IRGRP) ? CMD2_GBITS : 0) |
-                                   ((who & S_IROTH) ? CMD2_OBITS : 0);
-                       set->bits = (mode_t)~0;
-               } else {
-                       set->cmd2 = CMD2_UBITS | CMD2_GBITS | CMD2_OBITS;
-                       set->bits = mask;
-               }
-       
-               if (oparg == '+')
-                       set->cmd2 |= CMD2_SET;
-               else if (oparg == '-')
-                       set->cmd2 |= CMD2_CLR;
-               else if (oparg == '=')
-                       set->cmd2 |= CMD2_SET|CMD2_CLR;
-               break;
-       }
-       return (set + 1);
-}
-
-#ifdef SETMODE_DEBUG
-static void
-dumpmode(set)
-       BITCMD *set;
-{
-
-       _DIAGASSERT(set != NULL);
-
-       for (; set->cmd; ++set)
-               (void)printf("cmd: '%c' bits %04o%s%s%s%s%s%s\n",
-                   set->cmd, set->bits, set->cmd2 ? " cmd2:" : "",
-                   set->cmd2 & CMD2_CLR ? " CLR" : "",
-                   set->cmd2 & CMD2_SET ? " SET" : "",
-                   set->cmd2 & CMD2_UBITS ? " UBITS" : "",
-                   set->cmd2 & CMD2_GBITS ? " GBITS" : "",
-                   set->cmd2 & CMD2_OBITS ? " OBITS" : "");
-}
-#endif
-
-/*
- * Given an array of bitcmd structures, compress by compacting consecutive
- * '+', '-' and 'X' commands into at most 3 commands, one of each.  The 'u',
- * 'g' and 'o' commands continue to be separate.  They could probably be 
- * compacted, but it's not worth the effort.
- */
-static void
-compress_mode(set)
-       BITCMD *set;
-{
-       BITCMD *nset;
-       int setbits, clrbits, Xbits, op;
-
-       _DIAGASSERT(set != NULL);
-
-       for (nset = set;;) {
-               /* Copy over any 'u', 'g' and 'o' commands. */
-               while ((op = nset->cmd) != '+' && op != '-' && op != 'X') {
-                       *set++ = *nset++;
-                       if (!op)
-                               return;
-               }
-
-               for (setbits = clrbits = Xbits = 0;; nset++) {
-                       if ((op = nset->cmd) == '-') {
-                               clrbits |= nset->bits;
-                               setbits &= ~nset->bits;
-                               Xbits &= ~nset->bits;
-                       } else if (op == '+') {
-                               setbits |= nset->bits;
-                               clrbits &= ~nset->bits;
-                               Xbits &= ~nset->bits;
-                       } else if (op == 'X')
-                               Xbits |= nset->bits & ~setbits;
-                       else
-                               break;
-               }
-               if (clrbits) {
-                       set->cmd = '-';
-                       set->cmd2 = 0;
-                       set->bits = clrbits;
-                       set++;
-               }
-               if (setbits) {
-                       set->cmd = '+';
-                       set->cmd2 = 0;
-                       set->bits = setbits;
-                       set++;
-               }
-               if (Xbits) {
-                       set->cmd = 'X';
-                       set->cmd2 = 0;
-                       set->bits = Xbits;
-                       set++;
-               }
-       }
-}
diff --git a/lib/libc/other/settimeofday.c b/lib/libc/other/settimeofday.c
deleted file mode 100644 (file)
index eed953b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
-settimeofday.c
-*/
-
-#define stime _stime
-
-#include <sys/time.h>
-#include <time.h>
-
-int settimeofday(const struct timeval *tp, const void *tzp)
-{
-       /* Use intermediate variable because stime param is not const */
-       time_t sec = tp->tv_sec;
-       
-       /* Ignore time zones */
-       return stime(&sec);
-}
diff --git a/lib/libc/other/shquote.c b/lib/libc/other/shquote.c
deleted file mode 100644 (file)
index 29e5a31..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/* $NetBSD: shquote.c,v 1.1 2008/10/06 12:36:20 joerg Exp $ */
-
-/*
- * Copyright (c) 2001 Christopher G. Demetriou
- * 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.  See http://www.NetBSD.org/ for
- *          information about NetBSD.
- * 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.
- * 
- * <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
- */
-
-
-/*
- * Define SHQUOTE_USE_MULTIBYTE if you want shquote() to handle multibyte
- * characters using mbrtowc().
- *
- * Please DO NOT rip this #ifdef out of the code.  It's also here to help
- * portability.
- */
-#undef SHQUOTE_USE_MULTIBYTE
-
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#ifdef SHQUOTE_USE_MULTIBYTE
-#include <limits.h>
-#include <stdio.h>
-#include <wchar.h>
-#endif
-
-/*
- * shquote():
- *
- * Requotes arguments so that they'll be interpreted properly by the
- * shell (/bin/sh).
- *
- * Wraps single quotes around the string, and replaces single quotes
- * in the string with the sequence:
- *     '\''
- *
- * Returns the number of characters required to hold the resulting quoted
- * argument.
- *
- * The buffer supplied is filled in and NUL-terminated.  If 'bufsize'
- * indicates that the buffer is too short to hold the output string, the
- * first (bufsize - 1) bytes of quoted argument are filled in and the
- * buffer is NUL-terminated.
- *
- * Changes could be made to optimize the length of strings output by this
- * function:
- *
- *     * if there are no metacharacters or whitespace in the input,
- *       the output could be the input string.
- */
-
-#ifdef SHQUOTE_USE_MULTIBYTE
-
-#define        XLATE_OUTCH(x)          wcrtomb(outch, (x), &mbso)
-#define        XLATE_INCH()                                            \
-    do {                                                       \
-       n = mbrtowc(&c, arg, MB_CUR_MAX, &mbsi);                \
-    } while (/*LINTED const cond*/0)
-
-#else
-
-#define        XLATE_OUTCH(x)          (outch[0] = (x), 1)
-#define        XLATE_INCH()                                            \
-    do {                                                       \
-       n = ((c = *arg) != '\0') ? 1 : 0;                       \
-    } while (/*LINTED const cond*/0)
-
-#endif
-
-#define        PUT(x)                                                  \
-    do {                                                       \
-       outchlen = XLATE_OUTCH(x);                              \
-       if (outchlen == (size_t)-1)                             \
-               goto bad;                                       \
-       rv += outchlen;                                         \
-       if (bufsize != 0) {                                     \
-               if (bufsize < outchlen ||                       \
-                   (bufsize == outchlen &&                     \
-                    outch[outchlen - 1] != '\0')) {            \
-                       *buf = '\0';                            \
-                       bufsize = 0;                            \
-               } else {                                        \
-                       memcpy(buf, outch, outchlen);           \
-                       buf += outchlen;                        \
-                       bufsize -= outchlen;                    \
-               }                                               \
-       }                                                       \
-    } while (/*LINTED const cond*/0)
-
-size_t
-shquote(const char *arg, char *buf, size_t bufsize)
-{
-#ifdef SHQUOTE_USE_MULTIBYTE
-       char outch[MB_LEN_MAX];
-       mbstate_t mbsi, mbso;
-       wchar_t c, lastc;
-       size_t outchlen;
-#else
-       char outch[1];
-       char c, lastc;
-       size_t outchlen;
-#endif
-       size_t rv;
-       int n;
-
-       rv = 0;
-       lastc = 0;
-#ifdef SHQUOTE_USE_MULTIBYTE
-       memset(&mbsi, 0, sizeof mbsi);
-       memset(&mbso, 0, sizeof mbso);
-#endif
-
-       if (*arg != '\'')
-               PUT('\'');
-       for (;;) {
-               XLATE_INCH();
-               if (n <= 0)
-                       break;
-               arg += n;
-               lastc = c;
-
-               if (c == '\'') {
-                       if (rv != 0)
-                               PUT('\'');
-                       PUT('\\');
-                       PUT('\'');
-                       for (;;) {
-                               XLATE_INCH();
-                               if (n <= 0 || c != '\'')
-                                       break;
-                               PUT('\\');
-                               PUT('\'');
-                               arg += n;
-                       }
-                       if (n > 0)
-                               PUT('\'');
-               } else
-                       PUT(c);
-       }
-       if (lastc != '\'')
-               PUT('\'');
-
-       /* Put multibyte or NUL terminator, but don't count the NUL. */
-       PUT('\0');
-       rv--;
-
-       return rv;
-
-bad:
-       /* A multibyte character encoding or decoding error occurred. */
-       return (size_t)-1;
-}
diff --git a/lib/libc/other/strcasestr.c b/lib/libc/other/strcasestr.c
deleted file mode 100644 (file)
index 4fc54fc..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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.
- * 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/cdefs.h>
-
-#include <ctype.h>
-#include <string.h>
-
-/*
- * Find the first occurrence of find in s, ignore case.
- */
-char *
-strcasestr(const char *s, const char *find)
-{
-       char c, sc;
-       size_t len;
-
-       if ((c = *find++) != 0) {
-               c = tolower((unsigned char)c);
-               len = strlen(find);
-               do {
-                       do {
-                               if ((sc = *s++) == 0)
-                                       return (NULL);
-                       } while ((char)tolower((unsigned char)sc) != c);
-               } while (strncasecmp(s, find, len) != 0);
-               s--;
-       }
-       return ((char *)s);
-}
diff --git a/lib/libc/other/strdup.c b/lib/libc/other/strdup.c
deleted file mode 100644 (file)
index 62969cb..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-lib/other/strdup.c
-*/
-
-#include <stdlib.h>
-#include <string.h>
-
-char *strdup(s1)
-const char *s1;
-{
-       size_t len;
-       char *s2;
-
-       len= strlen(s1)+1;
-
-       s2= malloc(len);
-       if (s2 == NULL)
-               return NULL;
-       strcpy(s2, s1);
-
-       return s2;
-}
-
diff --git a/lib/libc/other/strlcat.c b/lib/libc/other/strlcat.c
deleted file mode 100644 (file)
index cadce9b..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * 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. 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 ``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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlcat.c,v 1.2 1999/06/17 16:28:58 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-#ifndef lint
-static const char rcsid[] =
-  "$FreeBSD: src/lib/libc/string/strlcat.c,v 1.2.4.2 2001/07/09 23:30:06 obrien Exp $";
-#endif
-
-#define _MINIX_SOURCE
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Appends src to string dst of size siz (unlike strncat, siz is the
- * full size of dst, not space left).  At most siz-1 characters
- * will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
- * Returns strlen(initial dst) + strlen(src); if retval >= siz,
- * truncation occurred.
- */
-size_t strlcat(dst, src, siz)
-       char *dst;
-       const char *src;
-       size_t siz;
-{
-       register char *d = dst;
-       register const char *s = src;
-       register size_t n = siz;
-       size_t dlen;
-
-       /* Find the end of dst and adjust bytes left but don't go past end */
-       while (n-- != 0 && *d != '\0')
-               d++;
-       dlen = d - dst;
-       n = siz - dlen;
-
-       if (n == 0)
-               return(dlen + strlen(s));
-       while (*s != '\0') {
-               if (n != 1) {
-                       *d++ = *s;
-                       n--;
-               }
-               s++;
-       }
-       *d = '\0';
-
-       return(dlen + (s - src));       /* count does not include NUL */
-}
-
-/*
- * $PchId: strlcat.c,v 1.1 2004/11/02 12:29:23 philip Exp philip $
- */
diff --git a/lib/libc/other/strlcpy.c b/lib/libc/other/strlcpy.c
deleted file mode 100644 (file)
index f4e9b00..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*     $OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $     */
-
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * 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. 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 ``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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char *rcsid = "$OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp $";
-#endif
-#endif /* LIBC_SCCS and not lint */
-#ifndef lint
-static const char rcsid[] =
-  "$FreeBSD: src/lib/libc/string/strlcpy.c,v 1.2.4.1 2001/07/09 23:30:06 obrien Exp $";
-#endif
-
-#define _MINIX_SOURCE
-
-#include <sys/types.h>
-#include <string.h>
-
-/*
- * Copy src to string dst of size siz.  At most siz-1 characters
- * will be copied.  Always NUL terminates (unless siz == 0).
- * Returns strlen(src); if retval >= siz, truncation occurred.
- */
-size_t strlcpy(dst, src, siz)
-       char *dst;
-       const char *src;
-       size_t siz;
-{
-       register char *d = dst;
-       register const char *s = src;
-       register size_t n = siz;
-
-       /* Copy as many bytes as will fit */
-       if (n != 0 && --n != 0) {
-               do {
-                       if ((*d++ = *s++) == 0)
-                               break;
-               } while (--n != 0);
-       }
-
-       /* Not enough room in dst, add NUL and traverse rest of src */
-       if (n == 0) {
-               if (siz != 0)
-                       *d = '\0';              /* NUL-terminate dst */
-               while (*s++)
-                       ;
-       }
-
-       return(s - src - 1);    /* count does not include NUL */
-}
-
-/*
- * $PchId: strlcpy.c,v 1.1 2004/11/02 12:29:53 philip Exp $
- */
diff --git a/lib/libc/other/strmode.c b/lib/libc/other/strmode.c
deleted file mode 100644 (file)
index f85875a..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*     $NetBSD: strmode.c,v 1.18 2006/10/07 22:04:18 apb Exp $ */
-
-/*-
- * Copyright (c) 1990, 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)strmode.c  8.3 (Berkeley) 8/15/94";
-#else
-__RCSID("$NetBSD: strmode.c,v 1.18 2006/10/07 22:04:18 apb Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <unistd.h>
-
-#define _DIAGASSERT assert
-
-#if !HAVE_STRMODE
-void
-strmode(mode_t mode, char *p)
-{
-
-       _DIAGASSERT(p != NULL);
-
-        /* print type */
-       switch (mode & S_IFMT) {
-       case S_IFDIR:                   /* directory */
-               *p++ = 'd';
-               break;
-       case S_IFCHR:                   /* character special */
-               *p++ = 'c';
-               break;
-       case S_IFBLK:                   /* block special */
-               *p++ = 'b';
-               break;
-       case S_IFREG:                   /* regular */
-#ifdef S_ARCH2
-               if ((mode & S_ARCH2) != 0) {
-                       *p++ = 'A';
-               } else if ((mode & S_ARCH1) != 0) {
-                       *p++ = 'a';
-               } else {
-#endif
-                       *p++ = '-';
-#ifdef S_ARCH2
-               }
-#endif
-               break;
-       case S_IFLNK:                   /* symbolic link */
-               *p++ = 'l';
-               break;
-#ifdef S_IFSOCK
-       case S_IFSOCK:                  /* socket */
-               *p++ = 's';
-               break;
-#endif
-#ifdef S_IFIFO
-       case S_IFIFO:                   /* fifo */
-               *p++ = 'p';
-               break;
-#endif
-#ifdef S_IFWHT
-       case S_IFWHT:                   /* whiteout */
-               *p++ = 'w';
-               break;
-#endif
-#ifdef S_IFDOOR
-       case S_IFDOOR:                  /* door */
-               *p++ = 'D';
-               break;
-#endif
-       default:                        /* unknown */
-               *p++ = '?';
-               break;
-       }
-       /* usr */
-       if (mode & S_IRUSR)
-               *p++ = 'r';
-       else
-               *p++ = '-';
-       if (mode & S_IWUSR)
-               *p++ = 'w';
-       else
-               *p++ = '-';
-       switch (mode & (S_IXUSR | S_ISUID)) {
-       case 0:
-               *p++ = '-';
-               break;
-       case S_IXUSR:
-               *p++ = 'x';
-               break;
-       case S_ISUID:
-               *p++ = 'S';
-               break;
-       case S_IXUSR | S_ISUID:
-               *p++ = 's';
-               break;
-       }
-       /* group */
-       if (mode & S_IRGRP)
-               *p++ = 'r';
-       else
-               *p++ = '-';
-       if (mode & S_IWGRP)
-               *p++ = 'w';
-       else
-               *p++ = '-';
-       switch (mode & (S_IXGRP | S_ISGID)) {
-       case 0:
-               *p++ = '-';
-               break;
-       case S_IXGRP:
-               *p++ = 'x';
-               break;
-       case S_ISGID:
-               *p++ = 'S';
-               break;
-       case S_IXGRP | S_ISGID:
-               *p++ = 's';
-               break;
-       }
-       /* other */
-       if (mode & S_IROTH)
-               *p++ = 'r';
-       else
-               *p++ = '-';
-       if (mode & S_IWOTH)
-               *p++ = 'w';
-       else
-               *p++ = '-';
-       switch (mode & (S_IXOTH | S_ISVTX)) {
-       case 0:
-               *p++ = '-';
-               break;
-       case S_IXOTH:
-               *p++ = 'x';
-               break;
-       case S_ISVTX:
-               *p++ = 'T';
-               break;
-       case S_IXOTH | S_ISVTX:
-               *p++ = 't';
-               break;
-       }
-       *p++ = ' ';             /* will be a '+' if ACL's implemented */
-       *p = '\0';
-}
-#endif /* !HAVE_STRMODE */
diff --git a/lib/libc/other/strnstr.c b/lib/libc/other/strnstr.c
deleted file mode 100644 (file)
index ee198fa..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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.
- * 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strstr.c   8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-
-#include <string.h>
-
-/*
- * Find the first occurrence of find in s, where the search is limited to the
- * first slen characters of s.
- */
-char *
-strnstr(const char *s, const char *find, size_t slen)
-{
-       char c, sc;
-       size_t len;
-
-       if ((c = *find++) != '\0') {
-               len = strlen(find);
-               do {
-                       do {
-                               if (slen-- < 1 || (sc = *s++) == '\0')
-                                       return (NULL);
-                       } while (sc != c);
-                       if (len > slen)
-                               return (NULL);
-               } while (strncmp(s, find, len) != 0);
-               s--;
-       }
-       return ((char *)s);
-}
diff --git a/lib/libc/other/strsep.c b/lib/libc/other/strsep.c
deleted file mode 100644 (file)
index b6a75eb..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*     $NetBSD: strsep.c,v 1.4 2004/08/23 03:32:12 jlam Exp $  */
-
-/*-
- * Copyright (c) 1990, 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)strsep.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: strsep.c,v 1.4 2004/08/23 03:32:12 jlam Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#if 0
-#include "namespace.h"
-#endif
-
-#include <assert.h>
-#include <string.h>
-
-#if 0
-#ifdef __weak_alias
-__weak_alias(strsep,_strsep)
-#endif
-#endif
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT assert
-#endif
-
-#if !HAVE_STRSEP
-/*
- * Get next token from string *stringp, where tokens are possibly-empty
- * strings separated by characters from delim.  
- *
- * Writes NULs into the string at *stringp to end tokens.
- * delim need not remain constant from call to call.
- * On return, *stringp points past the last NUL written (if there might
- * be further tokens), or is NULL (if there are definitely no more tokens).
- *
- * If *stringp is NULL, strsep returns NULL.
- */
-char *
-strsep(stringp, delim)
-       char **stringp;
-       const char *delim;
-{
-       char *s;
-       const char *spanp;
-       int c, sc;
-       char *tok;
-
-       _DIAGASSERT(stringp != NULL);
-       _DIAGASSERT(delim != NULL);
-
-       if ((s = *stringp) == NULL)
-               return (NULL);
-       for (tok = s;;) {
-               c = *s++;
-               spanp = delim;
-               do {
-                       if ((sc = *spanp++) == c) {
-                               if (c == 0)
-                                       s = NULL;
-                               else
-                                       s[-1] = 0;
-                               *stringp = s;
-                               return (tok);
-                       }
-               } while (sc != 0);
-       }
-       /* NOTREACHED */
-}
-#endif
diff --git a/lib/libc/other/strtok_r.c b/lib/libc/other/strtok_r.c
deleted file mode 100644 (file)
index bcfbc6b..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 1998 Softweyr LLC.  All rights reserved.
- *
- * strtok_r, from Berkeley strtok
- * Oct 13, 1998 by Wes Peters <wes@softweyr.com>
- *
- * 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
- *    notices, this list of conditions and the following disclaimer.
- * 
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notices, 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 Softweyr LLC, 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 SOFTWEYR LLC, 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 SOFTWEYR LLC, 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.
- */
-
-#ifndef lint
-static const char rcsid[] =
-  "$FreeBSD: src/lib/libc/string/strtok.c,v 1.2.6.1 2001/07/09 23:30:07 obrien Exp $";
-#endif
-
-#include <stddef.h>
-#include <string.h>
-
-char *
-strtok_r(char *s, const char *delim, char **last)
-{
-    char *spanp;
-    int c, sc;
-    char *tok;
-
-    if (s == NULL && (s = *last) == NULL)
-    {
-       return NULL;
-    }
-
-    /*
-     * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
-     */
-cont:
-    c = *s++;
-    for (spanp = (char *)delim; (sc = *spanp++) != 0; )
-    {
-       if (c == sc)
-       {
-           goto cont;
-       }
-    }
-
-    if (c == 0)                /* no non-delimiter characters */
-    {
-       *last = NULL;
-       return NULL;
-    }
-    tok = s - 1;
-
-    /*
-     * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
-     * Note that delim must have one NUL; we stop if we see that, too.
-     */
-    for (;;)
-    {
-       c = *s++;
-       spanp = (char *)delim;
-       do
-       {
-           if ((sc = *spanp++) == c)
-           {
-               if (c == 0)
-               {
-                   s = NULL;
-               }
-               else
-               {
-                   char *w = s - 1;
-                   *w = '\0';
-               }
-               *last = s;
-               return tok;
-           }
-       }
-       while (sc != 0);
-    }
-    /* NOTREACHED */
-}
-
-
-#if 0
-char *
-strtok(char *s, const char *delim)
-{
-    static char *last;
-
-    return strtok_r(s, delim, &last);
-}
-#endif
-
-#if defined(DEBUG_STRTOK)
-
-/*
- * Test the tokenizer.
- */
-int
-main()
-{
-    char test[80], blah[80];
-    char *sep = "\\/:;=-";
-    char *word, *phrase, *brkt, *brkb;
-
-    printf("String tokenizer test:\n");
-
-    strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function.");
-
-    for (word = strtok(test, sep);
-        word;
-        word = strtok(NULL, sep))
-    {
-       printf("Next word is \"%s\".\n", word);
-    }
-
-    phrase = "foo";
-
-    strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function.");
-
-    for (word = strtok_r(test, sep, &brkt);
-        word;
-        word = strtok_r(NULL, sep, &brkt))
-    {
-       strcpy(blah, "blah:blat:blab:blag");
-
-       for (phrase = strtok_r(blah, sep, &brkb);
-            phrase;
-            phrase = strtok_r(NULL, sep, &brkb))
-       {
-           printf("So far we're at %s:%s\n", word, phrase);
-       }
-    }
-
-    return 0;
-}
-
-#endif /* DEBUG_STRTOK */
diff --git a/lib/libc/other/strtoll.c b/lib/libc/other/strtoll.c
deleted file mode 100644 (file)
index b679a45..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Erik van der Kouwe, 8 December 2009, based on lib/ansi/strtol.c */
-
-#include       <ctype.h>
-#include       <errno.h>
-#include       <limits.h>
-#include       <stdint.h>
-#include       <stdlib.h>
-
-#ifdef __LONG_LONG_SUPPORTED
-
-static unsigned long long string2long(const char *nptr, char **endptr,
-       int base, int is_signed);
-
-long long strtoll(const char *nptr, char **endptr, int base)
-{
-       return (long long) string2long(nptr, endptr, base, 1);
-}
-
-unsigned long long strtoull(const char *nptr, char **endptr, int base)
-{
-       return (unsigned long long) string2long(nptr, endptr, base, 0);
-}
-
-#define between(a, c, z) \
-       ((unsigned long) ((c) - (a)) <= (unsigned long) ((z) - (a)))
-
-static unsigned long long string2long(const char *nptr, char **const endptr,
-       int base, int is_signed)
-{
-       unsigned int v;
-       unsigned long long val = 0;
-       int c;
-       int ovfl = 0, sign = 1;
-       const char *startnptr = nptr, *nrstart;
-
-       if (endptr) *endptr = (char *)nptr;
-       while (isspace(*nptr)) nptr++;
-       c = *nptr;
-
-       if (c == '-' || c == '+') {
-               if (c == '-') sign = -1;
-               nptr++;
-       }
-       nrstart = nptr;                 /* start of the number */
-
-       /* When base is 0, the syntax determines the actual base */
-       if (base == 0)
-               if (*nptr == '0')
-                       if (*++nptr == 'x' || *nptr == 'X') {
-                               base = 16;
-                               nptr++;
-                       }
-                       else    base = 8;
-               else    base = 10;
-       else if (base==16 && *nptr=='0' && (*++nptr =='x' || *nptr =='X'))
-               nptr++;
-
-       for (;;) {
-               c = *nptr;
-               if (between('0', c, '9')) {
-                       v = c - '0';
-               } else
-               if (between('a', c, 'z')) {
-                       v = c - 'a' + 0xa;
-               } else
-               if (between('A', c, 'Z')) {
-                       v = c - 'A' + 0xA;
-               } else {
-                       break;
-               }
-               if (v >= base) break;
-               if (val > (ULLONG_MAX - v) / base) ovfl++;
-               val = (val * base) + v;
-               nptr++;
-       }
-       if (endptr) {
-               if (nrstart == nptr) *endptr = (char *)startnptr;
-               else *endptr = (char *)nptr;
-       }
-
-       if (!ovfl) {
-               /* Overflow is only possible when converting a signed long. */
-               if (is_signed
-                   && ((sign < 0 && val > -(unsigned long long)LLONG_MIN)
-                       || (sign > 0 && val > LLONG_MAX)))
-                   ovfl++;
-       }
-
-       if (ovfl) {
-               errno = ERANGE;
-               if (is_signed)
-                       if (sign < 0) return LLONG_MIN;
-                       else return LLONG_MAX;
-               else return ULLONG_MAX;
-       }
-       return (long) sign * val;
-}
-
-#endif /* defined(__LONG_LONG_SUPPORTED) */
diff --git a/lib/libc/other/swab.c b/lib/libc/other/swab.c
deleted file mode 100644 (file)
index 8f02161..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <lib.h>
-/*  swab(3)
- *
- *  Author: Terrence W. Holm          Sep. 1988
- */
-_PROTOTYPE( void swab, (char *from, char *to, int count));
-
-void swab(from, to, count)
-char *from;
-char *to;
-int count;
-{
-  register char temp;
-
-  count >>= 1;
-
-  while (--count >= 0) {
-       temp = *from++;
-       *to++ = *from++;
-       *to++ = temp;
-  }
-}
diff --git a/lib/libc/other/syscall.c b/lib/libc/other/syscall.c
deleted file mode 100644 (file)
index d647cfb..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <lib.h>
-
-PUBLIC int _syscall(endpoint_t who, int syscallnr, message *msgptr)
-{
-  int status;
-
-  msgptr->m_type = syscallnr;
-  status = _sendrec(who, msgptr);
-  if (status != 0) {
-       /* 'sendrec' itself failed. */
-       /* XXX - strerror doesn't know all the codes */
-       msgptr->m_type = status;
-  }
-  if (msgptr->m_type < 0) {
-       errno = -msgptr->m_type;
-       return(-1);
-  }
-  return(msgptr->m_type);
-}
diff --git a/lib/libc/other/sysconf.c b/lib/libc/other/sysconf.c
deleted file mode 100644 (file)
index ac01241..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/* sysconf.c                                           POSIX 4.8.1
- *     long int sysconf(int name);
- *
- *     POSIX allows some of the values in <limits.h> to be increased at
- *     run time.  The sysconf() function allows such values to be checked
- *     at run time.  MINIX does not use this facility - the run time
- *     limits are those given in <limits.h>.
- */
-
-#include <lib.h>
-#include <unistd.h>
-#include <time.h>
-#include <stdio.h>
-#include <paths.h>
-
-PRIVATE u32_t get_hz(void)
-{
-  FILE *fp;
-  u32_t hz;
-  int r;
-
-  if ((fp = fopen(_PATH_PROC "hz", "r")) != NULL)
-  {
-       r = fscanf(fp, "%lu", &hz);
-
-       fclose(fp);
-
-       if (r == 1)
-               return hz;
-  }
-
-  return DEFAULT_HZ;
-}
-
-PUBLIC long int sysconf(name)
-int name;                      /* property being inspected */
-{
-  switch(name) {
-       case _SC_ARG_MAX:
-               return (long) ARG_MAX;
-
-       case _SC_CHILD_MAX:
-               return (long) CHILD_MAX;
-
-       case _SC_CLK_TCK:
-               return (long) get_hz();
-
-       case _SC_NGROUPS_MAX:
-               return (long) NGROUPS_MAX;
-
-       case _SC_OPEN_MAX:
-               return (long) OPEN_MAX;
-
-       case _SC_JOB_CONTROL:
-               return -1L;                     /* no job control */
-
-       case _SC_SAVED_IDS:
-               return -1L;                     /* no saved uid/gid */
-
-       case _SC_VERSION:
-               return (long) _POSIX_VERSION;
-
-       case _SC_STREAM_MAX:
-               return (long) STREAM_MAX;
-
-       case _SC_TZNAME_MAX:
-               return (long) TZNAME_MAX;
-
-       case _SC_PAGESIZE:
-               return getpagesize();
-
-       default:
-               errno = EINVAL;
-               return -1L;
-  }
-}
diff --git a/lib/libc/other/syslog.c b/lib/libc/other/syslog.c
deleted file mode 100644 (file)
index 8c7fc90..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-/* Copyright (c) 1983, 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.
- *
- * #if defined(LIBC_SCCS) && !defined(lint)
- * static char sccsid[] = "@(#)syslog.c    8.4 (Berkeley) 3/18/94";
- * #endif
- *
- * Author: Eric Allman
- * Modified to use UNIX domain IPC by Ralph Campbell
- * Patched March 12, 1996 by A. Ian Vogelesang <vogelesang@hdshq.com>
- * Rewritten by Martin Mares <mj@atrey.karlin.mff.cuni.cz> on May 14, 1997
- * Rewritten by G. Falzoni <gfalzoni@inwind.it> for porting to Minix
- */
-#include <sys/types.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdarg.h>
-#include <time.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <syslog.h>
-#include <sys/ioctl.h>
-#include <net/netlib.h>
-#include <net/hton.h>
-#include <net/gen/in.h>
-#include <net/gen/udp.h>
-#include <net/gen/udp_io.h>
-#include <net/gen/netdb.h>
-#include <errno.h>
-#include <net/gen/inet.h>
-
-static int LogPid = (-1);
-static int nfd = (-1);
-static int LogFacility = LOG_USER;
-static int LogFlags = 0;
-static char TagBuffer[40] = "syslog";
-
-/*
-** OPENLOG -- open system log
-**     - establishes a channel to syslogd using UDP device
-**       (port 514 is used _ syslog/udp)
-**     - stores program tag (if not NULL) and other options
-**       for use by syslog
-*/
-void openlog(const char *ident, int option, int facility)
-{
-  struct nwio_udpopt udpopt;
-
-  /* Stores logging flags */
-  LogFlags = option & (LOG_PID | LOG_PERROR | LOG_CONS);
-  /* Stores process id. if LOG_PID was specified */
-  if (option & LOG_PID) LogPid = getpid();
-  /* Stores the requested facility */
-  LogFacility = facility;
-  /* Stores log tag if supplied */
-  if (ident != NULL && *ident != '0' && ident != TagBuffer) {
-       strncpy(TagBuffer, ident, sizeof(TagBuffer));
-       TagBuffer[sizeof(TagBuffer) - 1] = '0';
-  }
-
-  /* Opens channel to syslog daemon via UDP device */
-  /* Static values used to minimize code */
-  if (option & LOG_NDELAY) {
-       /* Opens UDP device */
-       if ((nfd = open(UDP_DEVICE, O_RDWR)) < 0) {
-                /* Report error */ ;
-       }
-       /* Sets options for UDP device */
-       udpopt.nwuo_flags = NWUO_SHARED | NWUO_LP_SET | NWUO_DI_LOC |
-               NWUO_DI_BROAD | NWUO_RP_SET | NWUO_RA_SET |
-               NWUO_RWDATONLY | NWUO_DI_IPOPT;
-       udpopt.nwuo_locaddr = udpopt.nwuo_remaddr = htonl(0x7F000001L);
-       udpopt.nwuo_locport = udpopt.nwuo_remport = htons(514);
-       if (ioctl(nfd, NWIOSUDPOPT, &udpopt) < 0 ||
-           ioctl(nfd, NWIOGUDPOPT, &udpopt) < 0) {
-                /* Report error */ ;
-       }
-  }
-  return;
-}
-
-/*
-**  SYSLOG -- print message on log file
-**
-**  This routine looks a lot like printf, except that it outputs to the
-**  log file instead of the standard output.  Also:
-**     - adds a timestamp,
-**     - prints the module name in front of the message,
-**     - has some other formatting types (or will sometime),
-**     - adds a newline on the end of the message.
-**
-** The output of this routine is intended to be read by syslogd(8).
-*/
-void syslog(int lprty, const char *msg,...)
-{
-  time_t now;
-  char buff[512];
-  int len, rc;
-  va_list ap;
-
-  /* First log message open chnnel to syslog */
-  if (nfd < 0) openlog(TagBuffer, LogFlags | LOG_NDELAY, LogFacility);
-  time(&now);
-  len = sprintf(buff, "<%d>%.15s %s: ",
-               LogFacility | lprty, ctime(&now) + 4, TagBuffer);
-  if (LogFlags & LOG_PID) {
-       len -= 2;
-       len += sprintf(buff + len, "[%d]: ", LogPid);
-  }
-  va_start(ap, msg);
-  len += vsnprintf(buff + len, sizeof(buff) - len, msg, ap);
-  va_end(ap);
-  rc = write(nfd, buff, len);
-  if ((rc != len && LogFlags & LOG_CONS) || LogFlags & LOG_PERROR) {
-       write(STDERR_FILENO, buff, len);
-       write(STDERR_FILENO, "\n", 1);
-  }
-  return;
-}
-
-/*
-**  CLOSELOG -- close access to syslogd
-**     - closes UDP channel
-**     - restores default values
-*/
-void closelog(void)
-{
-
-  close(nfd);
-  LogPid = nfd = -1;
-  LogFacility = LOG_USER;
-  LogFlags = 0;
-  return;
-}
-
-/** syslog.c **/
diff --git a/lib/libc/other/telldir.c b/lib/libc/other/telldir.c
deleted file mode 100644 (file)
index c6e7c3f..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*     telldir()                                       Author: Kees J. Bot
- *                                                             24 Apr 1989
- */
-#define nil 0
-#include <lib.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <errno.h>
-#include <unistd.h>
-
-off_t telldir(DIR *dp)
-/* Return the current read position in a directory. */
-{
-       struct dirent *dep;
-
-       if (dp == nil) { errno= EBADF; return -1; }
-
-       if (dp->_pos < dp->_count)
-       {
-               /* Use position in next entry */
-               dep= (struct dirent *)&dp->_buf[dp->_pos];
-               return dep->d_off;
-       }
-
-       /* Get current offset in directory */
-       return lseek(dp->_fd, 0, SEEK_CUR);
-}
diff --git a/lib/libc/other/termcap.c b/lib/libc/other/termcap.c
deleted file mode 100644 (file)
index 0ddd9c8..0000000
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- *     termcap.c       V1.1    20/7/87         agc     Joypace Ltd
- *
- *     Copyright Joypace Ltd, London, UK, 1987. All rights reserved.
- *     This file may be freely distributed provided that this notice
- *     remains attached.
- *
- *     A public domain implementation of the termcap(3) routines.
- *
- *
- *
- *      Klamer Schutte       V1.2    Nov. 1988
- *
- *   - Can match multiple terminal names                [tgetent]
- *   - Removal of **area assignments                    [tgetstr]
- *
- *      Terrence W. Holm     V1.3    May, Sep, Oct.  1988
- *
- *   - Correct when TERM != name and TERMCAP is defined         [tgetent]
- *   - Correct the comparison for the terminal name     [tgetent]
- *   - Correct the value of ^x escapes                  [tgetstr]
- *   - Added %r to reverse row/column                   [tgoto]
- *   - Fixed end of definition test                     [tgetnum/flag/str]
- *
- *      Terrence W. Holm     V1.4    Jan. 1989
- *
- *   - Incorporated Klamer's V1.2 fixes into V1.3
- *   - Added %d, (old %d is now %2)                     [tgoto]
- *   - Allow '#' comments in definition file            [tgetent]
- */
-
-#include <lib.h>
-#include <termcap.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-char *capab = (char *)NULL;            /* the capability itself */
-
-#if 0
-/*  The following are not yet used.  */
-extern short ospeed;           /* output speed */
-extern char PC;                        /* padding character */
-extern char *BC;               /* back cursor movement */
-extern char *UP;               /* up cursor movement */
-#endif
-
-/*
- *     tgetent - get the termcap entry for terminal name, and put it
- *     in bp (which must be an array of 1024 chars). Returns 1 if
- *     termcap entry found, 0 if not found, and -1 if file not found.
- */
-
-int tgetent(bp, name)
-char *bp;
-char *name;
-{
-  FILE *fp;
-  char *file;
-  char *term;
-  short len = strlen(name);
-
-  capab = bp;
-
-  /* If TERMCAP begins with a '/' then use TERMCAP as the path  */
-  /* Name of the termcap definitions file. If TERMCAP is a      */
-  /* Definition and TERM equals "name" then use TERMCAP as the  */
-  /* Definition. Otherwise use "/etc/termcap" as the path name.         */
-
-  if ((file = getenv("TERMCAP")) == (char *)NULL)
-       file = "/etc/termcap";
-  else if (*file != '/')
-       if ((term = getenv("TERM")) != (char *)NULL && strcmp(term, name) == 0) {
-               *bp = '\0';
-               strncat(bp, file, 1023);
-               return(1);
-       } else
-               file = "/etc/termcap";
-
-  if ((fp = fopen(file, "r")) == (FILE *) NULL) {
-       capab = (char *)NULL;           /* no valid termcap  */
-       return(-1);
-  }
-  for (;;) {
-       /* Read in each definition */
-       int def_len = 0;
-       char *cp = bp;
-
-       do {
-               if (fgets(&bp[def_len], (unsigned int)(1024 - def_len), fp) == (char *)NULL) {
-                       fclose(fp);
-                       capab = (char *)NULL;   /* no valid termcap */
-                       return(0);
-               }
-               def_len = strlen(bp) - 2;
-       } while (bp[def_len] == '\\');
-
-       while (isspace((unsigned char) *cp)) cp++;
-
-       /* Comment lines start with a '#'  */
-       if (*cp == '#') continue;
-
-       /* See if any of the terminal names in this definition */
-       /* Match "name".                                                 */
-
-       do {
-               if (strncmp(name, cp, len) == 0 &&
-                   (cp[len] == '|' || cp[len] == ':')) {
-                       fclose(fp);
-                       return(1);
-               }
-               while ((*cp) && (*cp != '|') && (*cp != ':')) cp++;
-       } while (*cp++ == '|');
-  }
-}
-
-
-/*
- *     tgetnum - get the numeric terminal capability corresponding
- *     to id. Returns the value, -1 if invalid.
- */
-
-int tgetnum(id)
-char *id;
-{
-  register char *cp = capab;
-
-  if (cp == (char *)NULL || id == (char *)NULL) return(-1);
-
-  for (;;) {
-       while (*cp++ != ':')
-               if (cp[-1] == '\0') return(-1);
-
-       while (isspace((unsigned char) *cp)) cp++;
-
-       if (strncmp(cp, id, 2) == 0 && cp[2] == '#') return(atoi(cp + 3));
-  }
-}
-
-
-/*
- *     tgetflag - get the boolean flag corresponding to id. Returns -1
- *     if invalid, 0 if the flag is not in termcap entry, or 1 if it is
- *     present.
- */
-
-int tgetflag(id)
-char *id;
-{
-  register char *cp = capab;
-
-  if (cp == (char *)NULL || id == (char *)NULL) return(-1);
-
-  for (;;) {
-       while (*cp++ != ':')
-               if (cp[-1] == '\0') return(0);
-
-       while (isspace((unsigned char) *cp)) cp++;
-
-       if (strncmp(cp, id, 2) == 0) return(1);
-  }
-}
-
-
-/*
- *     tgetstr - get the string capability corresponding to id and place
- *     it in area (advancing area at same time). Expand escape sequences
- *     etc. Returns the string, or NULL if it can't do it.
- */
-
-char *tgetstr(id, area)
-char *id;
-char **area;
-{
-  register char *cp = capab;
-  register char *wsp = *area;  /* workspace pointer  */
-
-  if (cp == (char *)NULL || id == (char *)NULL) return((char *)NULL);
-
-  for (;;) {
-       while (*cp++ != ':')
-               if (cp[-1] == '\0') return((char *)NULL);
-
-       while (isspace((unsigned char) *cp)) cp++;
-
-       if (strncmp(cp, id, 2) == 0 && cp[2] == '=') {
-               for (cp += 3; *cp && *cp != ':'; wsp++, cp++) switch (*cp) {
-                           case '^':
-                               *wsp = *++cp - '@';
-                               break;
-
-                           case '\\':
-                               switch (*++cp) {
-                                   case 'E':
-                                       *wsp = '\033';
-                                       break;
-                                   case 'n':
-                                       *wsp = '\n';
-                                       break;
-                                   case 'r':
-                                       *wsp = '\r';
-                                       break;
-                                   case 't':
-                                       *wsp = '\t';
-                                       break;
-                                   case 'b':
-                                       *wsp = '\b';
-                                       break;
-                                   case 'f':
-                                       *wsp = '\f';
-                                       break;
-                                   case '0':
-                                   case '1':
-                                   case '2':
-                                   case '3':
-                                       {
-                                               int i;
-                                               int t = 0;
-                                               for (i = 0; i < 3 &&
-                                                    isdigit(*cp); ++i, ++cp)
-                                                       t = t * 8 + *cp - '0';
-                                               *wsp = t;
-                                               cp--;
-                                               break;
-                                       }
-                                   default:
-                                       *wsp = *cp;
-                               }
-                               break;
-
-                           default:    *wsp = *cp;
-                       }
-
-               *wsp++ = '\0';
-
-               {
-                       char *ret = *area;
-                       *area = wsp;
-                       return(ret);
-               }
-       }
-  }                            /* end for(;;) */
-}
-
-
-
-/*
- *     tgoto - given the cursor motion string cm, make up the string
- *     for the cursor to go to (destcol, destline), and return the string.
- *     Returns "OOPS" if something's gone wrong, or the string otherwise.
- */
-
-char *tgoto(cm, destcol, destline)
-char *cm;
-int destcol;
-int destline;
-{
-  PRIVATE char ret[24];
-  char *rp = ret;
-  int incr = 0;
-  int argno = 0;
-  int numval;
-
-  for (; *cm; cm++) {
-       if (*cm == '%') {
-               switch (*++cm) {
-                   case 'i':   incr = 1;                               break;
-
-                   case 'r':   argno = 1;                              break;
-
-                   case '+':
-                       numval = (argno == 0 ? destline : destcol);
-                       *rp++ = numval + incr + *++cm;
-                       argno = 1 - argno;
-                       break;
-
-                   case '2':
-                       numval = (argno == 0 ? destline : destcol);
-                       numval = (numval + incr) % 100;
-                       *rp++ = '0' + (numval / 10);
-                       *rp++ = '0' + (numval % 10);
-                       argno = 1 - argno;
-                       break;
-
-                   case 'd':
-                       numval = (argno == 0 ? destline : destcol);
-                       numval = (numval + incr) % 1000;
-                       if (numval > 99) *rp++ = '0' + (numval / 100);
-                       if (numval > 9) *rp++ = '0' + (numval / 10) % 10;
-                       *rp++ = '0' + (numval % 10);
-                       argno = 1 - argno;
-                       break;
-
-                   case '%':   *rp++ = '%';                            break;
-
-                   default:    return("OOPS");
-               }
-
-       } else
-               *rp++ = *cm;
-  }
-
-  *rp = '\0';
-  return(ret);
-}
-
-
-
-/*
- *     tputs - put the string cp out onto the terminal, using the function
- *     outc. This should do padding for the terminal, but I can't find a
- *     terminal that needs padding at the moment...
- */
-
-int tputs(cp, affcnt, outc)
-register char *cp;
-int affcnt;
-_PROTOTYPE( void (*outc), (int ch));
-{
-  if (cp == (char *)NULL) return(1);
-  /* Do any padding interpretation - left null for MINIX just now */
-  while (*cp) (*outc) (*cp++);
-  return(1);
-}
diff --git a/lib/libc/other/ttyname.c b/lib/libc/other/ttyname.c
deleted file mode 100644 (file)
index 16b421c..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ttyname.c                                           POSIX 4.7.2
- *     char *ttyname(int fildes);
- *
- *     Determines name of a terminal device.
- */
-
-#include <lib.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <stddef.h>
-#include <string.h>
-#include <unistd.h>
-
-PRIVATE char base[] = "/dev";
-PRIVATE char path[sizeof(base) + 1 + NAME_MAX];        /* extra 1 for '/' */
-
-PUBLIC char *ttyname(fildes)
-int fildes;
-{
-  DIR *devices;
-  struct dirent *entry;
-  struct stat tty_stat;
-  struct stat dev_stat;
-
-  /* Simple first test: file descriptor must be a character device */
-  if (fstat(fildes, &tty_stat) < 0 || !S_ISCHR(tty_stat.st_mode))
-       return (char *) NULL;
-
-  /* Open device directory for reading  */
-  if ((devices = opendir(base)) == (DIR *) NULL)
-       return (char *) NULL;
-
-  /* Scan the entries for one that matches perfectly */
-  while ((entry = readdir(devices)) != (struct dirent *) NULL) {
-       if (tty_stat.st_ino != entry->d_ino)
-               continue;
-       strcpy(path, base);
-       strcat(path, "/");
-       strcat(path, entry->d_name);
-       if (stat(path, &dev_stat) < 0 || !S_ISCHR(dev_stat.st_mode))
-               continue;
-       if (tty_stat.st_ino == dev_stat.st_ino &&
-           tty_stat.st_dev == dev_stat.st_dev &&
-           tty_stat.st_rdev == dev_stat.st_rdev) {
-               closedir(devices);
-               return path;
-       }
-  }
-
-  closedir(devices);
-  return (char *) NULL;
-}
diff --git a/lib/libc/other/ttyslot.c b/lib/libc/other/ttyslot.c
deleted file mode 100644 (file)
index a3e9c98..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-ttyslot.c
-
-Return the index in the utmp file for the current user's terminal. The 
-current user's terminal is the first file descriptor in the range 0..2
-for which ttyname() returns a name. The index is the line number in the
-/etc/ttytab file. 0 will be returned in case of an error.
-
-Created:       Oct 11, 1992 by Philip Homburg
-*/
-
-#define _MINIX_SOURCE
-
-#include <sys/types.h>
-#include <ttyent.h>
-#include <string.h>
-#include <unistd.h>
-
-int ttyslot()
-{
-       int slot;
-
-       slot= fttyslot(0);
-       if (slot == 0) slot= fttyslot(1);
-       if (slot == 0) slot= fttyslot(2);
-       return slot;
-}
-
-int fttyslot(fd)
-int fd;
-{
-       char *tname;
-       int lineno;
-       struct ttyent *ttyp;
-
-       tname= ttyname(fd);
-       if (tname == NULL) return 0;
-
-       /* Assume that tty devices are in /dev */
-       if (strncmp(tname, "/dev/", 5) != 0)
-               return 0;       /* Malformed tty name. */
-       tname += 5;
-
-       /* Scan /etc/ttytab. */
-       lineno= 1;
-       while ((ttyp= getttyent()) != NULL)
-       {
-               if (strcmp(tname, ttyp->ty_name) == 0)
-               {
-                       endttyent();
-                       return lineno;
-               }
-               lineno++;
-       }
-       /* No match */
-       endttyent();
-       return 0;
-}
-
-/*
- * $PchHeader: /mount/hd2/minix/lib/misc/RCS/ttyslot.c,v 1.3 1994/12/22 13:49:12 philip Exp $
- */
diff --git a/lib/libc/other/un-namespace.h b/lib/libc/other/un-namespace.h
deleted file mode 100644 (file)
index 5d2c0fe..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2001 Daniel Eischen <deischen@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.
- *
- * 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 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.
- *
- * $FreeBSD: src/lib/libc/include/un-namespace.h,v 1.13 2003/05/01 19:03:13 nectar Exp $
- */
-
-#ifndef _UN_NAMESPACE_H_
-#define _UN_NAMESPACE_H_
-
-#undef         accept
-#undef         __acl_aclcheck_fd
-#undef         __acl_delete_fd
-#undef         __acl_get_fd
-#undef         __acl_set_fd
-#undef         bind
-#undef         __cap_get_fd
-#undef         __cap_set_fd
-#undef         close
-#undef         connect
-#undef         dup
-#undef         dup2
-#undef         execve
-#undef         fcntl
-#undef         flock
-#undef         flockfile
-#undef         fpathconf
-#undef         fstat
-#undef         fstatfs
-#undef         fsync
-#undef         funlockfile
-#undef         getdirentries
-#undef         getlogin
-#undef         getpeername
-#undef         getsockname
-#undef         getsockopt
-#undef         ioctl
-#undef         kevent
-#undef         listen
-#undef         nanosleep
-#undef         open
-#undef         poll
-#undef         pthread_cond_broadcast
-#undef         pthread_cond_destroy
-#undef         pthread_cond_init
-#undef         pthread_cond_signal
-#undef         pthread_cond_timedwait
-#undef         pthread_cond_wait
-#undef         pthread_exit
-#undef         pthread_getspecific
-#undef         pthread_key_create
-#undef         pthread_key_delete
-#undef         pthread_main_np
-#undef         pthread_mutex_destroy
-#undef         pthread_mutex_init
-#undef         pthread_mutex_lock
-#undef         pthread_mutex_trylock
-#undef         pthread_mutex_unlock
-#undef         pthread_mutexattr_init
-#undef         pthread_mutexattr_destroy
-#undef         pthread_mutexattr_settype
-#undef         pthread_once
-#undef         pthread_rwlock_destroy
-#undef         pthread_rwlock_init
-#undef         pthread_rwlock_rdlock
-#undef         pthread_rwlock_wrlock
-#undef         pthread_rwlock_tryrdlock
-#undef         pthread_rwlock_trywrlock
-#undef         pthread_rwlock_unlock
-#undef         pthread_self
-#undef         pthread_setspecific
-#undef         pthread_sigmask
-#undef         read
-#undef         readv
-#undef         recvfrom
-#undef         recvmsg
-#undef         select
-#undef         sendmsg
-#undef         sendto
-#undef         setsockopt
-#undef         sigaction
-#undef         sigprocmask
-#undef         sigsuspend
-#undef         socket
-#undef         socketpair
-#undef         wait4
-#undef         waitpid
-#undef         write
-#undef         writev
-
-#if 0
-#undef         creat
-#undef         fchflags
-#undef         fchmod
-#undef         ftrylockfile
-#undef         msync
-#undef         nfssvc
-#undef         pause
-#undef         pthread_rwlockattr_init
-#undef         pthread_rwlockattr_destroy
-#undef         sched_yield
-#undef         sendfile
-#undef         shutdown
-#undef         sigaltstack
-#undef         sigpending
-#undef         sigreturn
-#undef         sigsetmask
-#undef         sleep
-#undef         system
-#undef         tcdrain
-#undef         wait
-#endif /* 0 */
-
-#ifdef _SIGNAL_H_
-int            _sigaction(int, const struct sigaction *, struct sigaction *);
-#endif
-
-#ifdef _SYS_EVENT_H_
-int            _kevent(int, const struct kevent *, int, struct kevent *,
-                   int, const struct timespec *);
-#endif
-
-#ifdef _SYS_FCNTL_H_
-int            _flock(int, int);
-#endif
-
-#undef         nsdispatch
-
-#endif /* _UN_NAMESPACE_H_ */
diff --git a/lib/libc/other/v8regerror.c b/lib/libc/other/v8regerror.c
deleted file mode 100644 (file)
index 71a1490..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*     regerror() - Default regexp error report        Author: Kees J. Bot
- *                                                             12 Jun 1999
- *
- * A better version of this routine should be supplied by the user in
- * the program using regexps.
- */
-#include <stdio.h>
-#define const          /* avoid "const poisoning" */
-#include <regexp.h>
-#undef const
-
-void regerror(char *message)
-{
-       fprintf(stderr, "regexp error: %s\n", message);
-}
diff --git a/lib/libc/other/v8regexp.c b/lib/libc/other/v8regexp.c
deleted file mode 100644 (file)
index c4a7d41..0000000
+++ /dev/null
@@ -1,1075 +0,0 @@
-/* regcomp and regexec -- regsub and regerror are elsewhere
- *
- *     Copyright (c) 1986 by University of Toronto.
- *     Written by Henry Spencer.  Not derived from licensed software.
- *
- *     Permission is granted to anyone to use this software for any
- *     purpose on any computer system, and to redistribute it freely,
- *     subject to the following restrictions:
- *
- *     1. The author is not responsible for the consequences of use of
- *             this software, no matter how awful, even if they arise
- *             from defects in it.
- *
- *     2. The origin of this software must not be misrepresented, either
- *             by explicit claim or by omission.
- *
- *     3. Altered versions must be plainly marked as such, and must not
- *             be misrepresented as being the original software.
- *
- * Beware that some of this code is subtly aware of the way operator
- * precedence is structured in regular expressions.  Serious changes in
- * regular-expression syntax might require a total rethink.
- *
- *     The third parameter to regexec was added by Martin C. Atkins.
- *     Andy Tanenbaum also made some changes.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#define const          /* avoid "const poisoning" */
-#include <regexp.h>
-#undef const
-
-/* The first byte of the regexp internal "program" is actually this magic
- * number; the start node begins in the second byte.
- */
-#define        MAGIC   0234
-
-/* The "internal use only" fields in regexp.h are present to pass info from
- * compile to execute that permits the execute phase to run lots faster on
- * simple cases.  They are:
- *
- * regstart    char that must begin a match; '\0' if none obvious
- * reganch     is the match anchored (at beginning-of-line only)?
- * regmust     string (pointer into program) that match must include, or NULL
- * regmlen     length of regmust string
- *
- * Regstart and reganch permit very fast decisions on suitable starting points
- * for a match, cutting down the work a lot.  Regmust permits fast rejection
- * of lines that cannot possibly match.  The regmust tests are costly enough
- * that regcomp() supplies a regmust only if the r.e. contains something
- * potentially expensive (at present, the only such thing detected is * or +
- * at the start of the r.e., which can involve a lot of backup).  Regmlen is
- * supplied because the test in regexec() needs it and regcomp() is computing
- * it anyway.
- */
-
-/* Structure for regexp "program".  This is essentially a linear encoding
- * of a nondeterministic finite-state machine (aka syntax charts or
- * "railroad normal form" in parsing technology).  Each node is an opcode
- * plus a "next" pointer, possibly plus an operand.  "Next" pointers of
- * all nodes except BRANCH implement concatenation; a "next" pointer with
- * a BRANCH on both ends of it is connecting two alternatives.  (Here we
- * have one of the subtle syntax dependencies:  an individual BRANCH (as
- * opposed to a collection of them) is never concatenated with anything
- * because of operator precedence.)  The operand of some types of node is
- * a literal string; for others, it is a node leading into a sub-FSM.  In
- * particular, the operand of a BRANCH node is the first node of the branch.
- * (NB this is *not* a tree structure:  the tail of the branch connects
- * to the thing following the set of BRANCHes.)  The opcodes are:
- */
-
-/* Definition  number  opnd?   meaning */
-#define        END     0               /* no   End of program. */
-#define        BOL     1               /* no   Match "" at beginning of line. */
-#define        EOL     2               /* no   Match "" at end of line. */
-#define        ANY     3               /* no   Match any one character. */
-#define        ANYOF   4               /* str  Match any character in this string. */
-#define        ANYBUT  5               /* str  Match any character not in this
-                        * string. */
-#define        BRANCH  6               /* node Match this alternative, or the
-                        * next... */
-#define        BACK    7               /* no   Match "", "next" ptr points backward. */
-#define        EXACTLY 8               /* str  Match this string. */
-#define        NOTHING 9               /* no   Match empty string. */
-#define        STAR    10              /* node Match this (simple) thing 0 or more
-                        * times. */
-#define        PLUS    11              /* node Match this (simple) thing 1 or more
-                        * times. */
-#define        OPEN    20              /* no   Mark this point in input as start of
-                        * #n. */
- /* OPEN+1 is number 1, etc. */
-#define        CLOSE   30              /* no   Analogous to OPEN. */
-
-/* Opcode notes:
- *
- * BRANCH      The set of branches constituting a single choice are hooked
- *             together with their "next" pointers, since precedence prevents
- *             anything being concatenated to any individual branch.  The
- *             "next" pointer of the last BRANCH in a choice points to the
- *             thing following the whole choice.  This is also where the
- *             final "next" pointer of each individual branch points; each
- *             branch starts with the operand node of a BRANCH node.
- *
- * BACK                Normal "next" pointers all implicitly point forward; BACK
- *             exists to make loop structures possible.
- *
- * STAR,PLUS   '?', and complex '*' and '+', are implemented as circular
- *             BRANCH structures using BACK.  Simple cases (one character
- *             per match) are implemented with STAR and PLUS for speed
- *             and to minimize recursive plunges.
- *
- * OPEN,CLOSE  ...are numbered at compile time.
- */
-
-/* A node is one char of opcode followed by two chars of "next" pointer.
- * "Next" pointers are stored as two 8-bit pieces, high order first.  The
- * value is a positive offset from the opcode of the node containing it.
- * An operand, if any, simply follows the node.  (Note that much of the
- * code generation knows about this implicit relationship.)
- *
- * Using two bytes for the "next" pointer is vast overkill for most things,
- * but allows patterns to get big without disasters.
- */
-#define        OP(p)   (*(p))
-#define        NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377))
-#define        OPERAND(p)      ((p) + 3)
-
-/* Utility definitions.
- */
-#ifndef CHARBITS
-#define        UCHARAT(p)      ((int)*(unsigned char *)(p))
-#else
-#define        UCHARAT(p)      ((int)*(p)&CHARBITS)
-#endif
-
-#define        CFAIL(m)        { regerror(m); return((char *)NULL); }
-#define        RFAIL(m)        { regerror(m); return((regexp *)NULL); }
-#define        ISMULT(c)       ((c) == '*' || (c) == '+' || (c) == '?')
-#define        META    "^$.[()|?+*\\"
-
-/* Flags to be passed up and down.
- */
-#define        HASWIDTH        01      /* Known never to match null string. */
-#define        SIMPLE          02      /* Simple enough to be STAR/PLUS operand. */
-#define        SPSTART         04      /* Starts with * or +. */
-#define        WORST           0       /* Worst case. */
-
-/* Global work variables for regcomp().
- */
-static char *regparse;         /* Input-scan pointer. */
-static int regnpar;            /* () count. */
-static char regdummy;
-static char *regcode;          /* Code-emit pointer; &regdummy = don't. */
-static long regsize;           /* Code size. */
-
-/* Forward declarations for regcomp()'s friends.
- */
-static char *reg(int paren, int *flagp);
-static char *regbranch(int *flagp);
-static char *regpiece(int *flagp);
-static char *regatom(int *flagp);
-static char *regnode(int op);
-static char *regnext(char *p);
-static void regc(int b);
-static void reginsert(int op, char *opnd);
-static void regtail(char *p, char *val);
-static void regoptail(char *p, char *val);
-
-/*
- - regcomp - compile a regular expression into internal code
- *
- * We can't allocate space until we know how big the compiled form will be,
- * but we can't compile it (and thus know how big it is) until we've got a
- * place to put the code.  So we cheat:  we compile it twice, once with code
- * generation turned off and size counting turned on, and once "for real".
- * This also means that we don't allocate space until we are sure that the
- * thing really will compile successfully, and we never have to move the
- * code and thus invalidate pointers into it.  (Note that it has to be in
- * one piece because free() must be able to free it all.)
- *
- * Beware that the optimization-preparation code in here knows about some
- * of the structure of the compiled regexp.
- */
-regexp *regcomp(exp)
-char *exp;
-{
-  register regexp *r;
-  register char *scan;
-  register char *longest;
-  register int len;
-  int flags;
-
-  if (exp == (char *)NULL) RFAIL("NULL argument");
-
-  /* First pass: determine size, legality. */
-  regparse = exp;
-  regnpar = 1;
-  regsize = 0L;
-  regcode = &regdummy;
-  regc(MAGIC);
-  if (reg(0, &flags) == (char *)NULL) return((regexp *)NULL);
-
-  /* Small enough for pointer-storage convention? */
-  if (regsize >= 32767L)       /* Probably could be 65535L. */
-       RFAIL("regexp too big");
-
-  /* Allocate space. */
-  r = (regexp *) malloc(sizeof(regexp) + (unsigned) regsize);
-  if (r == (regexp *)NULL) RFAIL("out of space");
-
-  /* Second pass: emit code. */
-  regparse = exp;
-  regnpar = 1;
-  regcode = r->program;
-  regc(MAGIC);
-  if (reg(0, &flags) == (char *)NULL) return((regexp *)NULL);
-
-  /* Dig out information for optimizations. */
-  r->regstart = '\0';          /* Worst-case defaults. */
-  r->reganch = 0;
-  r->regmust = (char *)NULL;
-  r->regmlen = 0;
-  scan = r->program + 1;       /* First BRANCH. */
-  if (OP(regnext(scan)) == END) {      /* Only one top-level choice. */
-       scan = OPERAND(scan);
-
-       /* Starting-point info. */
-       if (OP(scan) == EXACTLY)
-               r->regstart = *OPERAND(scan);
-       else if (OP(scan) == BOL)
-               r->reganch++;
-
-       /* If there's something expensive in the r.e., find the
-        * longest literal string that must appear and make it the
-        * regmust.  Resolve ties in favor of later strings, since
-        * the regstart check works with the beginning of the r.e.
-        * and avoiding duplication strengthens checking.  Not a
-        * strong reason, but sufficient in the absence of others. */
-       if (flags & SPSTART) {
-               longest = (char *)NULL;
-               len = 0;
-               for (; scan != (char *)NULL; scan = regnext(scan))
-                       if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
-                               longest = OPERAND(scan);
-                               len = strlen(OPERAND(scan));
-                       }
-               r->regmust = longest;
-               r->regmlen = len;
-       }
-  }
-  return(r);
-}
-
-/*
- - reg - regular expression, i.e. main body or parenthesized thing
- *
- * Caller must absorb opening parenthesis.
- *
- * Combining parenthesis handling with the base level of regular expression
- * is a trifle forced, but the need to tie the tails of the branches to what
- * follows makes it hard to avoid.
- */
-static char *reg(paren, flagp)
-int paren;                     /* Parenthesized? */
-int *flagp;
-{
-  register char *ret;
-  register char *br;
-  register char *ender;
-  register int parno;
-  int flags;
-
-  *flagp = HASWIDTH;           /* Tentatively. */
-
-  /* Make an OPEN node, if parenthesized. */
-  if (paren) {
-       if (regnpar >= NSUBEXP) CFAIL("too many ()");
-       parno = regnpar;
-       regnpar++;
-       ret = regnode(OPEN + parno);
-  } else {
-       parno = 0;              /* not actually used, keep compiler quiet */
-       ret = (char *)NULL;
-  }
-
-  /* Pick up the branches, linking them together. */
-  br = regbranch(&flags);
-  if (br == (char *)NULL) return((char *)NULL);
-  if (ret != (char *)NULL)
-       regtail(ret, br);       /* OPEN -> first. */
-  else
-       ret = br;
-  if (!(flags & HASWIDTH)) *flagp &= ~HASWIDTH;
-  *flagp |= flags & SPSTART;
-  while (*regparse == '|') {
-       regparse++;
-       br = regbranch(&flags);
-       if (br == (char *)NULL) return((char *)NULL);
-       regtail(ret, br);       /* BRANCH -> BRANCH. */
-       if (!(flags & HASWIDTH)) *flagp &= ~HASWIDTH;
-       *flagp |= flags & SPSTART;
-  }
-
-  /* Make a closing node, and hook it on the end. */
-  ender = regnode((paren) ? CLOSE + parno : END);
-  regtail(ret, ender);
-
-  /* Hook the tails of the branches to the closing node. */
-  for (br = ret; br != (char *)NULL; br = regnext(br)) regoptail(br, ender);
-
-  /* Check for proper termination. */
-  if (paren && *regparse++ != ')') {
-       CFAIL("unmatched ()");
-  } else if (!paren && *regparse != '\0') {
-       if (*regparse == ')') {
-               CFAIL("unmatched ()");
-       } else
-               CFAIL("junk on end");   /* "Can't happen". */
-       /* NOTREACHED */
-  }
-  return(ret);
-}
-
-/*
- - regbranch - one alternative of an | operator
- *
- * Implements the concatenation operator.
- */
-static char *regbranch(flagp)
-int *flagp;
-{
-  register char *ret;
-  register char *chain;
-  register char *latest;
-  int flags;
-
-  *flagp = WORST;              /* Tentatively. */
-
-  ret = regnode(BRANCH);
-  chain = (char *)NULL;
-  while (*regparse != '\0' && *regparse != '|' && *regparse != ')') {
-       latest = regpiece(&flags);
-       if (latest == (char *)NULL) return((char *)NULL);
-       *flagp |= flags & HASWIDTH;
-       if (chain == (char *)NULL)      /* First piece. */
-               *flagp |= flags & SPSTART;
-       else
-               regtail(chain, latest);
-       chain = latest;
-  }
-  if (chain == (char *)NULL)           /* Loop ran zero times. */
-       regnode(NOTHING);
-
-  return(ret);
-}
-
-/*
- - regpiece - something followed by possible [*+?]
- *
- * Note that the branching code sequences used for ? and the general cases
- * of * and + are somewhat optimized:  they use the same NOTHING node as
- * both the endmarker for their branch list and the body of the last branch.
- * It might seem that this node could be dispensed with entirely, but the
- * endmarker role is not redundant.
- */
-static char *regpiece(flagp)
-int *flagp;
-{
-  register char *ret;
-  register char op;
-  register char *next;
-  int flags;
-
-  ret = regatom(&flags);
-  if (ret == (char *)NULL) return((char *)NULL);
-
-  op = *regparse;
-  if (!ISMULT(op)) {
-       *flagp = flags;
-       return(ret);
-  }
-  if (!(flags & HASWIDTH) && op != '?') CFAIL("*+ operand could be empty");
-  *flagp = (op != '+') ? (WORST | SPSTART) : (WORST | HASWIDTH);
-
-  if (op == '*' && (flags & SIMPLE))
-       reginsert(STAR, ret);
-  else if (op == '*') {
-       /* Emit x* as (x&|), where & means "self". */
-       reginsert(BRANCH, ret); /* Either x */
-       regoptail(ret, regnode(BACK));  /* and loop */
-       regoptail(ret, ret);    /* back */
-       regtail(ret, regnode(BRANCH));  /* or */
-       regtail(ret, regnode(NOTHING)); /* null. */
-  } else if (op == '+' && (flags & SIMPLE))
-       reginsert(PLUS, ret);
-  else if (op == '+') {
-       /* Emit x+ as x(&|), where & means "self". */
-       next = regnode(BRANCH); /* Either */
-       regtail(ret, next);
-       regtail(regnode(BACK), ret);    /* loop back */
-       regtail(next, regnode(BRANCH)); /* or */
-       regtail(ret, regnode(NOTHING)); /* null. */
-  } else if (op == '?') {
-       /* Emit x? as (x|) */
-       reginsert(BRANCH, ret); /* Either x */
-       regtail(ret, regnode(BRANCH));  /* or */
-       next = regnode(NOTHING);/* null. */
-       regtail(ret, next);
-       regoptail(ret, next);
-  }
-  regparse++;
-  if (ISMULT(*regparse)) CFAIL("nested *?+");
-
-  return(ret);
-}
-
-/*
- - regatom - the lowest level
- *
- * Optimization:  gobbles an entire sequence of ordinary characters so that
- * it can turn them into a single node, which is smaller to store and
- * faster to run.  Backslashed characters are exceptions, each becoming a
- * separate node; the code is simpler that way and it's not worth fixing.
- */
-static char *regatom(flagp)
-int *flagp;
-{
-  register char *ret;
-  int flags;
-
-  *flagp = WORST;              /* Tentatively. */
-
-  switch (*regparse++) {
-      case '^':        ret = regnode(BOL);             break;
-      case '$':        ret = regnode(EOL);             break;
-      case '.':
-       ret = regnode(ANY);
-       *flagp |= HASWIDTH | SIMPLE;
-       break;
-      case '[':{
-               register int class;
-               register int classend;
-
-               if (*regparse == '^') { /* Complement of range. */
-                       ret = regnode(ANYBUT);
-                       regparse++;
-               } else
-                       ret = regnode(ANYOF);
-               if (*regparse == ']' || *regparse == '-') regc(*regparse++);
-               while (*regparse != '\0' && *regparse != ']') {
-                       if (*regparse == '-') {
-                               regparse++;
-                               if (*regparse == ']' || *regparse == '\0')
-                                       regc('-');
-                               else {
-                                       class = UCHARAT(regparse - 2) + 1;
-                                       classend = UCHARAT(regparse);
-                                       if (class > classend + 1)
-                                               CFAIL("invalid [] range");
-                                       for (; class <= classend; class++)
-                                               regc(class);
-                                       regparse++;
-                               }
-                       } else
-                               regc(*regparse++);
-               }
-               regc('\0');
-               if (*regparse != ']') CFAIL("unmatched []");
-               regparse++;
-               *flagp |= HASWIDTH | SIMPLE;
-       }
-       break;
-      case '(':
-       ret = reg(1, &flags);
-       if (ret == (char *)NULL) return((char *)NULL);
-       *flagp |= flags & (HASWIDTH | SPSTART);
-       break;
-      case '\0':
-      case '|':
-      case ')':
-       CFAIL("internal urp");  /* Supposed to be caught earlier. */
-       break;
-      case '?':
-      case '+':
-      case '*':        CFAIL("?+* follows nothing");           break;
-      case '\\':
-       if (*regparse == '\0') CFAIL("trailing \\");
-       ret = regnode(EXACTLY);
-       regc(*regparse++);
-       regc('\0');
-       *flagp |= HASWIDTH | SIMPLE;
-       break;
-      default:{
-               register int len;
-               register char ender;
-
-               regparse--;
-               len = strcspn(regparse, META);
-               if (len <= 0) CFAIL("internal disaster");
-               ender = *(regparse + len);
-               if (len > 1 && ISMULT(ender))
-                       len--;  /* Back off clear of ?+* operand. */
-               *flagp |= HASWIDTH;
-               if (len == 1) *flagp |= SIMPLE;
-               ret = regnode(EXACTLY);
-               while (len > 0) {
-                       regc(*regparse++);
-                       len--;
-               }
-               regc('\0');
-       }
-       break;
-  }
-
-  return(ret);
-}
-
-/*
- - regnode - emit a node
- */
-static char *regnode(op)
-char op;
-{
-  register char *ret;
-  register char *ptr;
-
-  ret = regcode;
-  if (ret == &regdummy) {
-       regsize += 3;
-       return(ret);
-  }
-  ptr = ret;
-  *ptr++ = op;
-  *ptr++ = '\0';               /* Null "next" pointer. */
-  *ptr++ = '\0';
-  regcode = ptr;
-
-  return(ret);
-}
-
-/*
- - regc - emit (if appropriate) a byte of code
- */
-static void regc(b)
-char b;
-{
-  if (regcode != &regdummy)
-       *regcode++ = b;
-  else
-       regsize++;
-}
-
-/*
- - reginsert - insert an operator in front of already-emitted operand
- *
- * Means relocating the operand.
- */
-static void reginsert(op, opnd)
-char op;
-char *opnd;
-{
-  register char *src;
-  register char *dst;
-  register char *place;
-
-  if (regcode == &regdummy) {
-       regsize += 3;
-       return;
-  }
-  src = regcode;
-  regcode += 3;
-  dst = regcode;
-  while (src > opnd) *--dst = *--src;
-
-  place = opnd;                        /* Op node, where operand used to be. */
-  *place++ = op;
-  *place++ = '\0';
-  *place++ = '\0';
-}
-
-/*
- - regtail - set the next-pointer at the end of a node chain
- */
-static void regtail(p, val)
-char *p;
-char *val;
-{
-  register char *scan;
-  register char *temp;
-  register int offset;
-
-  if (p == &regdummy) return;
-
-  /* Find last node. */
-  scan = p;
-  for (;;) {
-       temp = (char *)regnext(scan);
-       if (temp == (char *)NULL) break;
-       scan = temp;
-  }
-
-  if (OP(scan) == BACK)
-       offset = scan - val;
-  else
-       offset = val - scan;
-  *(scan + 1) = (offset >> 8) & 0377;
-  *(scan + 2) = offset & 0377;
-}
-
-/*
- - regoptail - regtail on operand of first argument; nop if operandless
- */
-static void regoptail(p, val)
-char *p;
-char *val;
-{
-  /* "Operandless" and "op != BRANCH" are synonymous in practice. */
-  if (p == (char *)NULL || p == &regdummy || OP(p) != BRANCH) return;
-  regtail(OPERAND(p), val);
-}
-
-/* regexec and friends
- */
-
-/* Global work variables for regexec().
- */
-static char *reginput;         /* String-input pointer. */
-static char *regbol;           /* Beginning of input, for ^ check. */
-static char **regstartp;       /* Pointer to startp array. */
-static char **regendp;         /* Ditto for endp. */
-
-/* Forwards.
- */
-static int regtry(regexp *prog, char *string);
-static int regmatch(char *prog);
-static int regrepeat(char *p);
-
-#ifdef DEBUG
-int regnarrate = 0;
-void regdump();
-static char *regprop(char *op);
-#endif
-
-/*
- - regexec - match a regexp against a string
- */
-int regexec(prog, string, bolflag)
-register regexp *prog;
-register char *string;
-int bolflag;
-{
-  register char *s;
-
-  /* Be paranoid... */
-  if (prog == (regexp *)NULL || string == (char *)NULL) {
-       regerror("NULL parameter");
-       return(0);
-  }
-
-  /* Check validity of program. */
-  if (UCHARAT(prog->program) != MAGIC) {
-       regerror("corrupted program");
-       return(0);
-  }
-
-  /* If there is a "must appear" string, look for it. */
-  if (prog->regmust != (char *)NULL) {
-       s = string;
-       while ((s = strchr(s, prog->regmust[0])) != (char *)NULL) {
-               if (strncmp(s, prog->regmust, prog->regmlen) == 0)
-                       break;  /* Found it. */
-               s++;
-       }
-       if (s == (char *)NULL)          /* Not present. */
-               return(0);
-  }
-
-  /* Mark beginning of line for ^ . */
-  if (bolflag)
-       regbol = string;
-  else
-       regbol = (char *)NULL;
-
-  /* Simplest case:  anchored match need be tried only once. */
-  if (prog->reganch) return(regtry(prog, string));
-
-  /* Messy cases:  unanchored match. */
-  s = string;
-  if (prog->regstart != '\0')  /* We know what char it must start with. */
-       while ((s = strchr(s, prog->regstart)) != (char *)NULL) {
-               if (regtry(prog, s)) return(1);
-               s++;
-       }
-  else
-       /* We don't -- general case. */
-       do {
-               if (regtry(prog, s)) return(1);
-       } while (*s++ != '\0');
-
-  /* Failure. */
-  return(0);
-}
-
-/*
- - regtry - try match at specific point
- */
-static int regtry(prog, string)   /* 0 failure, 1 success */
-regexp *prog;
-char *string;
-{
-  register int i;
-  register char **sp;
-  register char **ep;
-
-  reginput = string;
-  regstartp = prog->startp;
-  regendp = prog->endp;
-
-  sp = prog->startp;
-  ep = prog->endp;
-  for (i = NSUBEXP; i > 0; i--) {
-       *sp++ = (char *)NULL;
-       *ep++ = (char *)NULL;
-  }
-  if (regmatch(prog->program + 1)) {
-       prog->startp[0] = string;
-       prog->endp[0] = reginput;
-       return(1);
-  } else
-       return(0);
-}
-
-/*
- - regmatch - main matching routine
- *
- * Conceptually the strategy is simple:  check to see whether the current
- * node matches, call self recursively to see whether the rest matches,
- * and then act accordingly.  In practice we make some effort to avoid
- * recursion, in particular by going through "ordinary" nodes (that don't
- * need to know whether the rest of the match failed) by a loop instead of
- * by recursion.
- */
-static int regmatch(prog)      /* 0 failure, 1 success */ 
-char *prog;
-{
-  register char *scan;         /* Current node. */
-  char *next;                  /* Next node. */
-
-  scan = prog;
-#ifdef DEBUG
-  if (scan != (char *)NULL && regnarrate) fprintf(stderr, "%s(\n", regprop(scan));
-#endif
-  while (scan != (char *)NULL) {
-#ifdef DEBUG
-       if (regnarrate) fprintf(stderr, "%s...\n", regprop(scan));
-#endif
-       next = regnext(scan);
-
-       switch (OP(scan)) {
-           case BOL:
-               if (reginput != regbol) return(0);
-               break;
-           case EOL:
-               if (*reginput != '\0') return(0);
-               break;
-           case ANY:
-               if (*reginput == '\0') return(0);
-               reginput++;
-               break;
-           case EXACTLY:{
-                       register int len;
-                       register char *opnd;
-
-                       opnd = OPERAND(scan);
-                       /* Inline the first character, for speed. */
-                       if (*opnd != *reginput) return(0);
-                       len = strlen(opnd);
-                       if (len > 1 && strncmp(opnd, reginput, len) != 0)
-                               return(0);
-                       reginput += len;
-               }
-               break;
-           case ANYOF:
-               if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == (char *)NULL)
-                       return(0);
-               reginput++;
-               break;
-           case ANYBUT:
-               if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != (char *)NULL)
-                       return(0);
-               reginput++;
-               break;
-           case NOTHING:
-               break;
-           case BACK:
-               break;
-           case OPEN + 1:
-           case OPEN + 2:
-           case OPEN + 3:
-           case OPEN + 4:
-           case OPEN + 5:
-           case OPEN + 6:
-           case OPEN + 7:
-           case OPEN + 8:
-           case OPEN + 9:{
-                       register int no;
-                       register char *save;
-
-                       no = OP(scan) - OPEN;
-                       save = reginput;
-
-                       if (regmatch(next)) {
-                               /* Don't set startp if some later
-                                * invocation of the same parentheses
-                                * already has. */
-                               if (regstartp[no] == (char *)NULL)
-                                       regstartp[no] = save;
-                               return(1);
-                       } else
-                               return(0);
-               }
-               break;
-           case CLOSE + 1:
-           case CLOSE + 2:
-           case CLOSE + 3:
-           case CLOSE + 4:
-           case CLOSE + 5:
-           case CLOSE + 6:
-           case CLOSE + 7:
-           case CLOSE + 8:
-           case CLOSE + 9:{
-                       register int no;
-                       register char *save;
-
-                       no = OP(scan) - CLOSE;
-                       save = reginput;
-
-                       if (regmatch(next)) {
-                               /* Don't set endp if some later
-                                * invocation of the same parentheses
-                                * already has. */
-                               if (regendp[no] == (char *)NULL) regendp[no] = save;
-                               return(1);
-                       } else
-                               return(0);
-               }
-               break;
-           case BRANCH:{
-                       register char *save;
-
-                       if (OP(next) != BRANCH) /* No choice. */
-                               next = OPERAND(scan);   /* Avoid recursion. */
-                       else {
-                               do {
-                                       save = reginput;
-                                       if (regmatch(OPERAND(scan)))
-                                               return(1);
-                                       reginput = save;
-                                       scan = regnext(scan);
-                               } while (scan != (char *)NULL && OP(scan) == BRANCH);
-                               return(0);
-                               /* NOTREACHED */
-                       }
-               }
-               break;
-           case STAR:
-           case PLUS:{
-                       register char nextch;
-                       register int no;
-                       register char *save;
-                       register int min;
-
-                       /* Lookahead to avoid useless match attempts
-                        * when we know what character comes next. */
-                       nextch = '\0';
-                       if (OP(next) == EXACTLY) nextch = *OPERAND(next);
-                       min = (OP(scan) == STAR) ? 0 : 1;
-                       save = reginput;
-                       no = regrepeat(OPERAND(scan));
-                       while (no >= min) {
-                               /* If it could work, try it. */
-                               if (nextch == '\0' || *reginput == nextch)
-                                       if (regmatch(next)) return(1);
-                               /* Couldn't or didn't -- back up. */
-                               no--;
-                               reginput = save + no;
-                       }
-                       return(0);
-               }
-               break;
-           case END:
-               return(1);      /* Success! */
-               break;
-           default:
-               regerror("memory corruption");
-               return(0);
-               break;
-       }
-
-       scan = next;
-  }
-
-  /* We get here only if there's trouble -- normally "case END" is the
-   * terminating point. */
-  regerror("corrupted pointers");
-  return(0);
-}
-
-/*
- - regrepeat - repeatedly match something simple, report how many
- */
-static int regrepeat(p)
-char *p;
-{
-  register int count = 0;
-  register char *scan;
-  register char *opnd;
-
-  scan = reginput;
-  opnd = OPERAND(p);
-  switch (OP(p)) {
-      case ANY:
-       count = strlen(scan);
-       scan += count;
-       break;
-      case EXACTLY:
-       while (*opnd == *scan) {
-               count++;
-               scan++;
-       }
-       break;
-      case ANYOF:
-       while (*scan != '\0' && strchr(opnd, *scan) != (char *)NULL) {
-               count++;
-               scan++;
-       }
-       break;
-      case ANYBUT:
-       while (*scan != '\0' && strchr(opnd, *scan) == (char *)NULL) {
-               count++;
-               scan++;
-       }
-       break;
-      default:                 /* Oh dear.  Called inappropriately. */
-       regerror("internal foulup");
-       count = 0;              /* Best compromise. */
-       break;
-  }
-  reginput = scan;
-
-  return(count);
-}
-
-/*
- - regnext - dig the "next" pointer out of a node
- */
-static char *regnext(p)
-register char *p;
-{
-  register int offset;
-
-  if (p == &regdummy) return((char *)NULL);
-
-  offset = NEXT(p);
-  if (offset == 0) return((char *)NULL);
-
-  if (OP(p) == BACK)
-       return(p - offset);
-  else
-       return(p + offset);
-}
-
-#ifdef DEBUG
-
-static char *regprop();
-
-/*
- - regdump - dump a regexp onto stdout in vaguely comprehensible form
- */
-void regdump(r)
-regexp *r;
-{
-  register char *s;
-  register char op = EXACTLY;  /* Arbitrary non-END op. */
-  register char *next;
-
-  s = r->program + 1;
-  while (op != END) {          /* While that wasn't END last time... */
-       op = OP(s);
-       printf("%2d%s", (int) (s - r->program), regprop(s));    /* Where, what. */
-       next = regnext(s);
-       if (next == (char *)NULL)       /* Next ptr. */
-               printf("(0)");
-       else
-               printf("(%d)", (int) (s - r->program) + (int) (next - s));
-       s += 3;
-       if (op == ANYOF || op == ANYBUT || op == EXACTLY) {
-               /* Literal string, where present. */
-               while (*s != '\0') {
-                       putchar(*s);
-                       s++;
-               }
-               s++;
-       }
-       putchar('\n');
-  }
-
-  /* Header fields of interest. */
-  if (r->regstart != '\0') printf("start `%c' ", r->regstart);
-  if (r->reganch) printf("anchored ");
-  if (r->regmust != (char *)NULL) printf("must have \"%s\"", r->regmust);
-  printf("\n");
-}
-
-/*
- - regprop - printable representation of opcode
- */
-static char *regprop(op)
-char *op;
-{
-  register char *p;
-  static char buf[50];
-
-  (void) strcpy(buf, ":");
-
-  switch (OP(op)) {
-      case BOL:        p = "BOL";              break;
-      case EOL:        p = "EOL";              break;
-      case ANY:        p = "ANY";              break;
-      case ANYOF:      p = "ANYOF";            break;
-      case ANYBUT:     p = "ANYBUT";           break;
-      case BRANCH:     p = "BRANCH";           break;
-      case EXACTLY:    p = "EXACTLY";          break;
-      case NOTHING:    p = "NOTHING";          break;
-      case BACK:       p = "BACK";             break;
-      case END:        p = "END";              break;
-      case OPEN + 1:
-      case OPEN + 2:
-      case OPEN + 3:
-      case OPEN + 4:
-      case OPEN + 5:
-      case OPEN + 6:
-      case OPEN + 7:
-      case OPEN + 8:
-      case OPEN + 9:
-       sprintf(buf + strlen(buf), "OPEN%d", OP(op) - OPEN);
-       p = (char *)NULL;
-       break;
-      case CLOSE + 1:
-      case CLOSE + 2:
-      case CLOSE + 3:
-      case CLOSE + 4:
-      case CLOSE + 5:
-      case CLOSE + 6:
-      case CLOSE + 7:
-      case CLOSE + 8:
-      case CLOSE + 9:
-       sprintf(buf + strlen(buf), "CLOSE%d", OP(op) - CLOSE);
-       p = (char *)NULL;
-       break;
-      case STAR:       p = "STAR";             break;
-      case PLUS:       p = "PLUS";             break;
-      default: regerror("corrupted opcode"); p = (char *) NULL; break;
-  }
-  if (p != (char *)NULL) (void) strcat(buf, p);
-  return(buf);
-}
-
-#endif
-
-/*
- * $PchId: regexp.c,v 1.4 1996/02/22 09:03:07 philip Exp $
- */
diff --git a/lib/libc/other/v8regsub.c b/lib/libc/other/v8regsub.c
deleted file mode 100644 (file)
index c2b7819..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/* regsub
- *
- *     Copyright (c) 1986 by University of Toronto.
- *     Written by Henry Spencer.  Not derived from licensed software.
- *
- *     Permission is granted to anyone to use this software for any
- *     purpose on any computer system, and to redistribute it freely,
- *     subject to the following restrictions:
- *
- *     1. The author is not responsible for the consequences of use of
- *             this software, no matter how awful, even if they arise
- *             from defects in it.
- *
- *     2. The origin of this software must not be misrepresented, either
- *             by explicit claim or by omission.
- *
- *     3. Altered versions must be plainly marked as such, and must not
- *             be misrepresented as being the original software.
- */
-
-#include <string.h>
-#include <stdio.h>
-#define const          /* avoid "const poisoning" */
-#include <regexp.h>
-#undef const
-
-/* The first byte of the regexp internal "program" is actually this magic
- * number; the start node begins in the second byte.
- */
-#define        MAGIC   0234
-
-#define CHARBITS 0377
-#ifndef CHARBITS
-#define        UCHARAT(p)      ((int)*(unsigned char *)(p))
-#else
-#define        UCHARAT(p)      ((int)*(p)&CHARBITS)
-#endif
-
-/*
- - regsub - perform substitutions after a regexp match
- */
-void regsub(prog, source, dest)
-regexp *prog;
-char *source;
-char *dest;
-{
-  register char *src;
-  register char *dst;
-  register char c;
-  register int no;
-  register int len;
-
-  if (prog == (regexp *)NULL || source == (char *)NULL || dest == (char *)NULL) {
-       regerror("NULL parm to regsub");
-       return;
-  }
-  if (UCHARAT(prog->program) != MAGIC) {
-       regerror("damaged regexp fed to regsub");
-       return;
-  }
-  src = source;
-  dst = dest;
-  while ((c = *src++) != '\0') {
-       if (c == '&')
-               no = 0;
-       else if (c == '\\' && '0' <= *src && *src <= '9')
-               no = *src++ - '0';
-       else
-               no = -1;
-
-       if (no < 0) {           /* Ordinary character. */
-               if (c == '\\' && (*src == '\\' || *src == '&')) c = *src++;
-               *dst++ = c;
-       } else
-       if (prog->startp[no] != (char *)NULL && prog->endp[no] != (char *)NULL) {
-               len = (int) (prog->endp[no] - prog->startp[no]);
-               strncpy(dst, prog->startp[no], len);
-               dst += len;
-               if (len != 0 && *(dst - 1) == '\0') {   /* strncpy hit NUL. */
-                       regerror("damaged match string");
-                       return;
-               }
-       }
-  }
-  *dst++ = '\0';
-}
-
-/*
- * $PchId: regsub.c,v 1.3 1995/11/27 20:18:16 philip Exp $
- */
diff --git a/lib/libc/other/vectorio.c b/lib/libc/other/vectorio.c
deleted file mode 100644 (file)
index 3b3d5b1..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-#include <assert.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <sys/uio.h>
-#include <unistd.h>
-
-#define VECTORIO_READ  1
-#define VECTORIO_WRITE 2
-
-static ssize_t vectorio_buffer(int fildes, const struct iovec *iov, 
-       int iovcnt, int readwrite, ssize_t totallen)
-{
-       char *buffer;
-       int iovidx, errno_saved;
-       ssize_t copied, len, r;
-
-       /* allocate buffer */
-       buffer = (char *) malloc(totallen);
-       if (!buffer)
-               return -1;
-
-       /* perform the actual read/write for the entire buffer */
-       switch (readwrite)
-       {
-               case VECTORIO_READ:
-                       /* first read, then copy buffers (only part read) */
-                       r = read(fildes, buffer, totallen);
-
-                       copied = 0;
-                       iovidx = 0;
-                       while (copied < r)
-                       {
-                               assert(iovidx < iovcnt);
-                               len = MIN(r - copied, iov[iovidx].iov_len);
-                               memcpy(iov[iovidx++].iov_base, buffer + copied, len);
-                               copied += len;
-                       }
-                       assert(r < 0 || r == copied);
-                       break;
-
-               case VECTORIO_WRITE: 
-                       /* first copy buffers, then write */
-                       copied = 0;
-                       for (iovidx = 0; iovidx < iovcnt; iovidx++)
-                       {
-                               memcpy(buffer + copied, iov[iovidx].iov_base, 
-                                       iov[iovidx].iov_len);
-                               copied += iov[iovidx].iov_len;
-                       }
-                       assert(copied == totallen);
-
-                       r = write(fildes, buffer, totallen);
-                       break;
-
-               default:        
-                       assert(0);
-                       errno = EINVAL;
-                       r = -1;
-       }
-
-       /* free the buffer, keeping errno unchanged */
-       errno_saved = errno;
-       free(buffer);
-       errno = errno_saved;
-
-       return r;
-}
-
-static ssize_t vectorio(int fildes, const struct iovec *iov, 
-       int iovcnt, int readwrite)
-{
-       int i;
-       ssize_t totallen;
-
-       /* parameter sanity checks */
-       if (iovcnt > IOV_MAX)
-       {
-               errno = EINVAL;
-               return -1;
-       }
-
-       totallen = 0;
-       for (i = 0; i < iovcnt; i++)
-       {
-               /* don't read/write anything in case of possible overflow */
-               if ((ssize_t) (totallen + iov[i].iov_len) < totallen)
-               {
-                       errno = EINVAL;
-                       return -1;
-               }
-               totallen += iov[i].iov_len;
-
-               /* report on NULL pointers */
-               if (iov[i].iov_len && !iov[i].iov_base)
-               {
-                       errno = EFAULT;
-                       return -1;
-               }
-       }
-
-       /* anything to do? */
-       if (totallen == 0)
-               return 0;
-
-       /* 
-        * there aught to be a system call here; instead we use an intermediate 
-        * buffer; this is preferred over multiple read/write calls because 
-        * this function has to be atomic
-        */
-       return vectorio_buffer(fildes, iov, iovcnt, readwrite, totallen);
-}
-
-ssize_t readv(int fildes, const struct iovec *iov, int iovcnt)
-{
-       return vectorio(fildes, iov, iovcnt, VECTORIO_READ);    
-}
-
-ssize_t writev(int fildes, const struct iovec *iov, int iovcnt)
-{
-       return vectorio(fildes, iov, iovcnt, VECTORIO_WRITE);   
-}
-
diff --git a/lib/libc/other/vwarnx.c b/lib/libc/other/vwarnx.c
deleted file mode 100644 (file)
index 63a6cc3..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*     $NetBSD: vwarnx.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $     */
-
-/*-
- * Copyright (c) 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. 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.
- */
-
-#ifndef __minix
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)err.c      8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: vwarnx.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#endif
-#include <err.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef __weak_alias
-__weak_alias(vwarnx, _vwarnx)
-#endif
-
-#if !HAVE_ERR_H
-void
-vwarnx(const char *fmt, _BSD_VA_LIST_ ap)
-{
-#ifndef __minix
-       (void)fprintf(stderr, "%s: ", getprogname());
-#endif
-       if (fmt != NULL)
-               (void)vfprintf(stderr, fmt, ap);
-       (void)fprintf(stderr, "\n");
-}
-#endif
diff --git a/lib/libc/other/warnx.c b/lib/libc/other/warnx.c
deleted file mode 100644 (file)
index d0f0d7b..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*     $NetBSD: warnx.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $      */
-
-/*-
- * Copyright (c) 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. 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.
- */
-
-#ifndef __minix
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)err.c      8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: warnx.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#endif
-#include <err.h>
-#include <stdarg.h>
-
-#ifdef __weak_alias
-__weak_alias(warnx, _warnx)
-#endif
-
-#if !HAVE_ERR_H
-void
-warnx(const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       vwarnx(fmt, ap);
-       va_end(ap);
-}
-#endif
diff --git a/lib/libc/posix/Makefile.inc b/lib/libc/posix/Makefile.inc
deleted file mode 100644 (file)
index e5d5bf9..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-# posix sources
-.PATH: ${.CURDIR}/posix
-
-SRCS+=          \
-       __exit.c \
-       _access.c \
-       _alarm.c \
-       _cfgetispeed.c \
-       _cfgetospeed.c \
-       _cfsetispeed.c \
-       _cfsetospeed.c \
-       _chdir.c \
-       _chmod.c \
-       _chown.c \
-       _chroot.c \
-       _close.c \
-       _closedir.c \
-       _creat.c \
-       _dup.c \
-       _dup2.c \
-       _execl.c \
-       _execle.c \
-       _execlp.c \
-       _execv.c \
-       _execve.c \
-       _execvp.c \
-       _fchmod.c \
-       _fchown.c \
-       _fcntl.c \
-       _fork.c \
-       _fpathconf.c \
-       _fstat.c \
-       _fstatfs.c \
-       _fstatvfs.c \
-       _fsync.c \
-       _getcwd.c \
-       _getegid.c \
-       _geteuid.c \
-       _getgid.c \
-       _getgroups.c \
-       _getitimer.c \
-       _getpgrp.c \
-       _getpid.c \
-       _getppid.c \
-       _getuid.c \
-       _ioctl.c \
-       _isatty.c \
-       _kill.c \
-       _killpg.c \
-       _link.c \
-       _lseek.c \
-       _lstat.c \
-       _mkdir.c \
-       _mkfifo.c \
-       _mknod.c \
-       _mmap.c \
-       _nanosleep.c \
-       _open.c \
-       _opendir.c \
-       _pathconf.c \
-       _pause.c \
-       _pipe.c \
-       _ptrace.c \
-       _read.c \
-       _readdir.c \
-       _readlink.c \
-       _rename.c \
-       _rewinddir.c \
-       _rmdir.c \
-       _select.c \
-       _setgid.c \
-       _setitimer.c \
-       _setsid.c \
-       _setuid.c \
-       _sigaction.c \
-       _sigpending.c \
-       _sigprocmask.c \
-       _sigreturn.c \
-       _sigset.c \
-       _sigsuspend.c \
-       _sleep.c \
-       _stat.c \
-       _statvfs.c \
-       _stime.c \
-       _symlink.c \
-       _sync.c \
-       _tcdrain.c \
-       _tcflow.c \
-       _tcflush.c \
-       _tcgetattr.c \
-       _tcsendbreak.c \
-       _tcsetattr.c \
-       _time.c \
-       _times.c \
-       _truncate.c \
-       _ucontext.c \
-       _umask.c \
-       _uname.c \
-       _unlink.c \
-       _utime.c \
-       _wait.c \
-       _waitpid.c \
-       _write.c \
-       fnmatch.c \
-       getloadavg.c \
-       getopt.c \
-       gettimeofday.c \
-       glob.c \
-       nice.c \
-       priority.c \
-       pread.c \
-       pwrite.c \
-       usleep.c \
-       poll.c
diff --git a/lib/libc/posix/__exit.c b/lib/libc/posix/__exit.c
deleted file mode 100644 (file)
index 601d815..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#define _exit  __exit
-#include <lib.h>
-#include <unistd.h>
-
-PUBLIC void _exit(status)
-int status;
-{
-  void (*suicide)(void);
-  message m;
-
-  m.m1_i1 = status;
-  _syscall(PM_PROC_NR, EXIT, &m);
-
-  /* If exiting nicely through PM fails for some reason, try to
-   * commit suicide. E.g., message to PM might fail due to deadlock.
-   */
-  suicide = (void (*)(void)) -1;
-  suicide();
-
-  /* If committing suicide fails for some reason, hang. */
-  for(;;) { }
-}
-
diff --git a/lib/libc/posix/_access.c b/lib/libc/posix/_access.c
deleted file mode 100644 (file)
index 7b43df5..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <lib.h>
-#define access _access
-#include <unistd.h>
-
-PUBLIC int access(name, mode)
-_CONST char *name;
-int mode;
-{
-  message m;
-
-  m.m3_i2 = mode;
-  _loadname(name, &m);
-  return(_syscall(VFS_PROC_NR, ACCESS, &m));
-}
diff --git a/lib/libc/posix/_alarm.c b/lib/libc/posix/_alarm.c
deleted file mode 100644 (file)
index 3216692..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define alarm  _alarm
-#include <unistd.h>
-
-PUBLIC unsigned int alarm(sec)
-unsigned int sec;
-{
-  message m;
-
-  m.m1_i1 = (int) sec;
-  return( (unsigned) _syscall(PM_PROC_NR, ALARM, &m));
-}
diff --git a/lib/libc/posix/_cfgetispeed.c b/lib/libc/posix/_cfgetispeed.c
deleted file mode 100644 (file)
index 7bdaa63..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
-posix/_cfgetispeed
-
-Created:       June 11, 1993 by Philip Homburg
-*/
-
-#include <termios.h>
-
-speed_t _cfgetispeed(const struct termios *termios_p)
-{
-  return termios_p->c_ispeed;
-}
diff --git a/lib/libc/posix/_cfgetospeed.c b/lib/libc/posix/_cfgetospeed.c
deleted file mode 100644 (file)
index 10bbda9..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
-posix/_cfgetospeed
-
-Created:       June 11, 1993 by Philip Homburg
-*/
-
-#include <termios.h>
-
-speed_t _cfgetospeed(const struct termios *termios_p)
-{
-  return termios_p->c_ospeed;
-}
diff --git a/lib/libc/posix/_cfsetispeed.c b/lib/libc/posix/_cfsetispeed.c
deleted file mode 100644 (file)
index 76b4974..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-posix/_cfsetispeed
-
-Created:       June 11, 1993 by Philip Homburg
-*/
-
-#include <termios.h>
-
-int _cfsetispeed(struct termios *termios_p, speed_t speed)
-{
-  termios_p->c_ispeed= speed;
-  return 0;
-}
diff --git a/lib/libc/posix/_cfsetospeed.c b/lib/libc/posix/_cfsetospeed.c
deleted file mode 100644 (file)
index ddc162d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
-posix/_cfsetospeed
-
-Created:       June 11, 1993 by Philip Homburg
-*/
-
-#include <termios.h>
-
-int _cfsetospeed(struct termios *termios_p, speed_t speed)
-{
-  termios_p->c_ospeed= speed;
-  return 0;
-}
diff --git a/lib/libc/posix/_chdir.c b/lib/libc/posix/_chdir.c
deleted file mode 100644 (file)
index e489a2a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <lib.h>
-#define chdir  _chdir
-#define fchdir _fchdir
-#include <unistd.h>
-
-PUBLIC int chdir(name)
-_CONST char *name;
-{
-  message m;
-
-  _loadname(name, &m);
-  return(_syscall(VFS_PROC_NR, CHDIR, &m));
-}
-
-PUBLIC int fchdir(fd)
-int fd;
-{
-  message m;
-
-  m.m1_i1 = fd;
-  return(_syscall(VFS_PROC_NR, FCHDIR, &m));
-}
diff --git a/lib/libc/posix/_chmod.c b/lib/libc/posix/_chmod.c
deleted file mode 100644 (file)
index 95ac37f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define chmod  _chmod
-#include <sys/stat.h>
-
-PUBLIC int chmod(const char *name, mode_t mode)
-{
-  message m;
-
-  m.m3_i2 = mode;
-  _loadname(name, &m);
-  return(_syscall(VFS_PROC_NR, CHMOD, &m));
-}
diff --git a/lib/libc/posix/_chown.c b/lib/libc/posix/_chown.c
deleted file mode 100644 (file)
index 703d55d..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <lib.h>
-#define chown  _chown
-#include <string.h>
-#include <unistd.h>
-
-PUBLIC int chown(const char *name, uid_t owner, gid_t grp)
-{
-  message m;
-
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_i2 = owner;
-  m.m1_i3 = grp;
-  m.m1_p1 = (char *) name;
-  return(_syscall(VFS_PROC_NR, CHOWN, &m));
-}
diff --git a/lib/libc/posix/_chroot.c b/lib/libc/posix/_chroot.c
deleted file mode 100644 (file)
index 392a857..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define chroot _chroot
-#include <unistd.h>
-
-PUBLIC int chroot(name)
-_CONST char *name;
-{
-  message m;
-
-  _loadname(name, &m);
-  return(_syscall(VFS_PROC_NR, CHROOT, &m));
-}
diff --git a/lib/libc/posix/_close.c b/lib/libc/posix/_close.c
deleted file mode 100644 (file)
index 8d09dcd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define close  _close
-#include <unistd.h>
-
-PUBLIC int close(fd)
-int fd;
-{
-  message m;
-
-  m.m1_i1 = fd;
-  return(_syscall(VFS_PROC_NR, CLOSE, &m));
-}
diff --git a/lib/libc/posix/_closedir.c b/lib/libc/posix/_closedir.c
deleted file mode 100644 (file)
index 50fcec2..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*     closedir()                                      Author: Kees J. Bot
- *                                                             24 Apr 1989
- */
-#define nil 0
-#include <lib.h>
-#define close  _close
-#define closedir _closedir
-#include <sys/types.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-
-int closedir(DIR *dp)
-/* Finish reading a directory. */
-{
-       int d;
-
-       if (dp == nil) { errno= EBADF; return -1; }
-
-       d= dp->_fd;
-       free((void *) dp);
-       return close(d);
-}
diff --git a/lib/libc/posix/_creat.c b/lib/libc/posix/_creat.c
deleted file mode 100644 (file)
index d3539e6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define creat  _creat
-#include <fcntl.h>
-
-PUBLIC int creat(const char *name, mode_t mode)
-{
-  message m;
-
-  m.m3_i2 = mode;
-  _loadname(name, &m);
-  return(_syscall(VFS_PROC_NR, CREAT, &m));
-}
diff --git a/lib/libc/posix/_dup.c b/lib/libc/posix/_dup.c
deleted file mode 100644 (file)
index 2150415..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <lib.h>
-#define dup    _dup
-#define fcntl  _fcntl
-#include <fcntl.h>
-#include <unistd.h>
-
-PUBLIC int dup(fd)
-int fd;
-{
-  return(fcntl(fd, F_DUPFD, 0));
-}
diff --git a/lib/libc/posix/_dup2.c b/lib/libc/posix/_dup2.c
deleted file mode 100644 (file)
index e630a51..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <lib.h>
-#define close  _close
-#define dup2   _dup2
-#define fcntl  _fcntl
-#include <fcntl.h>
-#include <unistd.h>
-
-PUBLIC int dup2(fd, fd2)
-int fd, fd2;
-{
-/* The behavior of dup2 is defined by POSIX in 6.2.1.2 as almost, but not
- * quite the same as fcntl.
- */
-
-  if (fd2 < 0 || fd2 > OPEN_MAX) {
-       errno = EBADF;
-       return(-1);
-  }
-
-  /* Check to see if fildes is valid. */
-  if (fcntl(fd, F_GETFL) < 0) {
-       /* 'fd' is not valid. */
-       return(-1);
-  } else {
-       /* 'fd' is valid. */
-       if (fd == fd2) return(fd2);
-       close(fd2);
-       return(fcntl(fd, F_DUPFD, fd2));
-  }
-}
diff --git a/lib/libc/posix/_execl.c b/lib/libc/posix/_execl.c
deleted file mode 100644 (file)
index ba30019..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*-
- * Copyright (c) 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. 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.
- */
-
-#define execl _execl
-#define execve _execve
-#include <unistd.h>
-#include <minix/compiler.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <alloca.h>
-#include <lib.h>
-
-#ifndef __UNCONST
-#define __UNCONST(x) ((void *) (x))
-#endif
-
-extern char * const **_penviron;       /* The default environment. */
-
-int
-execl(const char *path, const char *arg, ...)
-/* execl("/bin/sh", "sh", "-c", "example", (char *) 0); */
-{
-#if FUNC_ARGS_ARRAY
-       /* 
-    * Assumption:  The C-implementation for this machine pushes
-        * function arguments downwards on the stack making a perfect
-        * argument array.  Luckily this is almost always so.
-        *
-        * execl() - execute     Author: Kees J. Bot, 21 Jan 1994
-        */
-       return execve(path, (char * const *) &arg, *_penviron);
-#else
-   /*
-    * Indeed, GCC (4.4.1) behaves similarly to ACK. Nonetheless, let's
-    * stay the safe side. LLVM (llvm-gcc) doesn't make the aforementioned
-        * assumption.
-        */
-       va_list ap;
-       char **argv;
-       int i;
-
-       va_start(ap, arg);
-       for (i = 2; va_arg(ap, char *) != NULL; i++)
-         continue;
-       va_end(ap);
-
-       if ((argv = alloca(i * sizeof (char *))) == NULL) {
-               errno = ENOMEM;
-               return -1;
-       }
-       
-       va_start(ap, arg);
-       argv[0] = __UNCONST(arg);
-       for (i = 1; (argv[i] = va_arg(ap, char *)) != NULL; i++) 
-               continue;
-       va_end(ap);
-       
-       return execve(path, (char * const *) argv, *_penviron);
-#endif
-}
-
diff --git a/lib/libc/posix/_execle.c b/lib/libc/posix/_execle.c
deleted file mode 100644 (file)
index 235fac9..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-
- * Copyright (c) 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. 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.
- */
-
-#define execle _execle
-#define execve _execve
-#include <unistd.h>
-#include <minix/compiler.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <alloca.h>
-#include <lib.h>
-
-#ifndef __UNCONST
-#define __UNCONST(x) ((void *) (x))
-#endif
-
-int execle(const char *path, const char *arg1, ...)
-/* execle("/bin/sh", "sh", "-c", "example", (char *) 0, my_env_array); */
-{
-  char * const * envp;
-  va_list ap;
-#if FUNC_ARGS_ARRAY
-  /* 
-       * execle() - execute with a custom environment  
-       * Author: Kees J. Bot, 21 Jan 1994
-       */
-       va_start(ap, arg1);
-
-       /* Find the end of the argument array. */
-       if (arg1 != NULL) while (va_arg(ap, const char *) != NULL) {}
-
-       envp = va_arg(ap, char * const *);
-       va_end(ap);
-
-       return execve(path, (char * const *) &arg1, envp);
-#else
-       char **argv;
-       int i;
-
-       va_start(ap, arg1);
-       for (i = 2; va_arg(ap, char *) != NULL; i++)
-               continue;
-       va_end(ap);
-
-       if ((argv = alloca(i * sizeof (char *))) == NULL) {
-               errno = ENOMEM;
-               return -1;
-       }
-       
-       va_start(ap, arg1);
-       argv[0] = __UNCONST(arg1);
-       for (i = 1; (argv[i] = va_arg(ap, char *)) != NULL; i++) 
-               continue;
-       envp = va_arg(ap, char **);
-       va_end(ap);
-
-       return execve(path, (char * const *)argv, envp);
-#endif
-}
diff --git a/lib/libc/posix/_execlp.c b/lib/libc/posix/_execlp.c
deleted file mode 100644 (file)
index 9965223..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*-
- * Copyright (c) 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. 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.
- */
-
-#define execlp _execlp
-#define execvp _execvp
-#include <unistd.h>
-#include <minix/compiler.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <alloca.h>
-#include <lib.h>
-
-#ifndef __UNCONST
-#define __UNCONST(x) ((void *) (x))
-#endif
-
-int execlp(const char *file, const char *arg1, ...)
-/* execlp("sh", "sh", "-c", "example", (char *) 0); */
-{
-#if FUNC_ARGS_ARRAY
-  /*   
-       * execlp() - execute with PATH search
-       * Author: Kees J. Bot, 22 Jan 1994
-       */
-       return execvp(file, (char * const *) &arg1);
-#else
-       va_list ap;
-       char **argv;
-       int i;
-
-       va_start(ap, arg1);
-       for (i = 2; va_arg(ap, char *) != NULL; i++)
-               continue;
-       va_end(ap);
-
-       if ((argv = alloca(i * sizeof (char *))) == NULL) {
-               errno = ENOMEM;
-               return -1;
-       }
-       
-       va_start(ap, arg1);
-       argv[0] = __UNCONST(arg1);
-       for (i = 1; (argv[i] = va_arg(ap, char *)) != NULL; i++) 
-               continue;
-       va_end(ap);
-       
-       return execvp(file, (char * const *)argv);
-#endif
-}
diff --git a/lib/libc/posix/_execv.c b/lib/libc/posix/_execv.c
deleted file mode 100644 (file)
index 9f8f377..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*     execv() - execute with prepared arguments       Author: Kees J. Bot
- *                                                             21 Jan 1994
- */
-#define execv _execv
-#define execve _execve
-#include <unistd.h>
-
-extern char * const **_penviron;       /* The default environment. */
-
-int execv(const char *path, char * const *argv)
-{
-       return execve(path, argv, *_penviron);
-}
diff --git a/lib/libc/posix/_execve.c b/lib/libc/posix/_execve.c
deleted file mode 100644 (file)
index 8306fe1..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*     execve() - basic program execution call         Author: Kees J. Bot
- *                                                             21 Jan 1994
- */
-
-#define _MINIX_SOURCE
-
-#define execve _execve
-#define sbrk _sbrk
-#include <lib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stddef.h>
-
-int execve(const char *path, char * const *argv, char * const *envp)
-{
-       char * const *ap;
-       char * const *ep;
-       char *frame;
-       char **vp;
-       char *sp;
-       size_t argc;
-       size_t frame_size;
-       size_t string_off;
-       size_t n;
-       int ov;
-       message m;
-
-       /* Assumptions: size_t and char *, it's all the same thing. */
-
-       /* Create a stack image that only needs to be patched up slightly
-        * by the kernel to be used for the process to be executed.
-        */
-
-       ov= 0;                  /* No overflow yet. */
-       frame_size= 0;          /* Size of the new initial stack. */
-       string_off= 0;          /* Offset to start of the strings. */
-       argc= 0;                /* Argument count. */
-
-       for (ap= argv; *ap != NULL; ap++) {
-               n = sizeof(*ap) + strlen(*ap) + 1;
-               frame_size+= n;
-               if (frame_size < n) ov= 1;
-               string_off+= sizeof(*ap);
-               argc++;
-       }
-
-       for (ep= envp; *ep != NULL; ep++) {
-               n = sizeof(*ep) + strlen(*ep) + 1;
-               frame_size+= n;
-               if (frame_size < n) ov= 1;
-               string_off+= sizeof(*ap);
-       }
-
-       /* Add an argument count and two terminating nulls. */
-       frame_size+= sizeof(argc) + sizeof(*ap) + sizeof(*ep);
-       string_off+= sizeof(argc) + sizeof(*ap) + sizeof(*ep);
-
-       /* Align. */
-       frame_size= (frame_size + sizeof(char *) - 1) & ~(sizeof(char *) - 1);
-
-       /* The party is off if there is an overflow. */
-       if (ov || frame_size < 3 * sizeof(char *)) {
-               errno= E2BIG;
-               return -1;
-       }
-
-       /* Allocate space for the stack frame. */
-       if ((frame = (char *) sbrk(frame_size)) == (char *) -1) {
-               errno = E2BIG;
-               return -1;
-       }
-
-       /* Set arg count, init pointers to vector and string tables. */
-       * (size_t *) frame = argc;
-       vp = (char **) (frame + sizeof(argc));
-       sp = frame + string_off;
-
-       /* Load the argument vector and strings. */
-       for (ap= argv; *ap != NULL; ap++) {
-               *vp++= (char *) (sp - frame);
-               n= strlen(*ap) + 1;
-               memcpy(sp, *ap, n);
-               sp+= n;
-       }
-       *vp++= NULL;
-
-       /* Load the environment vector and strings. */
-       for (ep= envp; *ep != NULL; ep++) {
-               *vp++= (char *) (sp - frame);
-               n= strlen(*ep) + 1;
-               memcpy(sp, *ep, n);
-               sp+= n;
-       }
-       *vp++= NULL;
-
-       /* Padding. */
-       while (sp < frame + frame_size) *sp++= 0;
-
-       /* We can finally make the system call. */
-       m.m1_i1 = strlen(path) + 1;
-       m.m1_i2 = frame_size;
-       m.m1_p1 = (char *) path;
-       m.m1_p2 = frame;
-
-       /* Clear unused fields */
-       m.m1_i3 = 0;
-       m.m1_p3 = NULL;
-
-       (void) _syscall(PM_PROC_NR, EXEC, &m);
-
-       /* Failure, return the memory used for the frame and exit. */
-       (void) sbrk(-frame_size);
-       return -1;
-}
diff --git a/lib/libc/posix/_execvp.c b/lib/libc/posix/_execvp.c
deleted file mode 100644 (file)
index fecb080..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*     execvp() - execute with PATH search and prepared arguments
- *                                                     Author: Kees J. Bot
- *                                                             21 Jan 1994
- */
-
-#define _MINIX_SOURCE
-
-#define execve _execve
-#define execvp _execvp
-#define sbrk _sbrk
-#define stat _stat
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/stat.h>
-#include <lib.h>
-
-extern char * const **_penviron;       /* The default environment. */
-
-int execvp(const char *file, char * const *argv)
-/* Execute the file with a path search on $PATH, just like the shell.  The
- * search continues on the errors ENOENT (not there), and EACCES (file not
- * executable or leading directories protected.)
- * Unlike other execvp implementations there is no default path, and no shell
- * is started for scripts.  One is supposed to define $PATH, and use #!/bin/sh.
- */
-{
-       struct stat sb;
-       const char *path;               /* $PATH */
-       char *full;                     /* Full name to try. */
-       char *f;
-       size_t full_size;
-       int err= ENOENT;                /* Error return on failure. */
-
-       if (strchr(file, '/') != NULL || (path= getenv("PATH")) == NULL)
-               path= "";
-
-       /* Compute the maximum length the full name may have, and align. */
-       full_size= strlen(path) + 1 + strlen(file) + 1 + sizeof(char *) - 1;
-       full_size&= ~(sizeof(char *) - 1);
-
-       /* Claim space. */
-       if ((full= (char *) sbrk(full_size)) == (char *) -1) {
-               errno= E2BIG;
-               return -1;
-       }
-
-       /* For each directory in the path... */
-       do {
-               f= full;
-               while (*path != 0 && *path != ':') *f++= *path++;
-
-               if (f > full) *f++= '/';
-
-               strcpy(f, file);
-
-               /* Stat first, small speed-up, better for ptrace. */
-               if (stat(full, &sb) == -1) continue;
-
-               (void) execve(full, argv, *_penviron);
-
-               /* Prefer more interesting errno values then "not there". */
-               if (errno != ENOENT) err= errno;
-
-               /* Continue only on some errors. */
-               if (err != ENOENT && err != EACCES) break;
-       } while (*path++ != 0);
-
-       (void) sbrk(-full_size);
-       errno= err;
-       return -1;
-}
diff --git a/lib/libc/posix/_fchmod.c b/lib/libc/posix/_fchmod.c
deleted file mode 100644 (file)
index 8e66d5f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define fchmod _fchmod
-#include <sys/stat.h>
-
-PUBLIC int fchmod(int fd, mode_t mode)
-{
-  message m;
-
-  m.m1_i1 = fd;
-  m.m1_i2 = mode;
-  return(_syscall(VFS_PROC_NR, FCHMOD, &m));
-}
diff --git a/lib/libc/posix/_fchown.c b/lib/libc/posix/_fchown.c
deleted file mode 100644 (file)
index b6f707a..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <lib.h>
-#define fchown _fchown
-#include <string.h>
-#include <unistd.h>
-
-PUBLIC int fchown(int fd, uid_t owner, gid_t grp)
-{
-  message m;
-
-  m.m1_i1 = fd;
-  m.m1_i2 = owner;
-  m.m1_i3 = grp;
-  return(_syscall(VFS_PROC_NR, FCHOWN, &m));
-}
diff --git a/lib/libc/posix/_fcntl.c b/lib/libc/posix/_fcntl.c
deleted file mode 100644 (file)
index 9ef65b5..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <lib.h>
-#define fcntl _fcntl
-#include <fcntl.h>
-#include <stdarg.h>
-
-#if _ANSI
-PUBLIC int fcntl(int fd, int cmd, ...)
-#else
-PUBLIC int fcntl(fd, cmd)
-int fd;
-int cmd;
-#endif
-{
-  va_list argp;
-  message m;
-
-  va_start(argp, cmd);
-
-  /* Set up for the sensible case where there is no variable parameter.  This
-   * covers F_GETFD, F_GETFL and invalid commands.
-   */
-  m.m1_i3 = 0;
-  m.m1_p1 = NULL;
-
-  /* Adjust for the stupid cases. */
-  switch(cmd) {
-     case F_DUPFD:
-     case F_SETFD:
-     case F_SETFL:
-       m.m1_i3 = va_arg(argp, int);
-       break;
-     case F_GETLK:
-     case F_SETLK:
-     case F_SETLKW:
-     case F_FREESP:
-       m.m1_p1 = (char *) va_arg(argp, struct flock *);
-       break;
-  }
-
-  /* Clean up and make the system call. */
-  va_end(argp);
-  m.m1_i1 = fd;
-  m.m1_i2 = cmd;
-  return(_syscall(VFS_PROC_NR, FCNTL, &m));
-}
diff --git a/lib/libc/posix/_fork.c b/lib/libc/posix/_fork.c
deleted file mode 100644 (file)
index 63fe9fb..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <lib.h>
-#define fork   _fork
-#include <unistd.h>
-
-PUBLIC pid_t fork()
-{
-  message m;
-
-  return(_syscall(PM_PROC_NR, FORK, &m));
-}
diff --git a/lib/libc/posix/_fpathconf.c b/lib/libc/posix/_fpathconf.c
deleted file mode 100644 (file)
index 72c4507..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* POSIX fpathconf (Sec. 5.7.1)                Author: Andy Tanenbaum */
-
-#include <lib.h>
-#define fstat          _fstat
-#define fpathconf      _fpathconf
-#include <sys/stat.h>
-#include <errno.h>
-#include <limits.h>
-#include <unistd.h>
-#include <termios.h>
-
-PUBLIC long fpathconf(fd, name)
-int fd;                                /* file descriptor being interrogated */
-int name;                      /* property being inspected */
-{
-/* POSIX allows some of the values in <limits.h> to be increased at
- * run time.  The pathconf and fpathconf functions allow these values
- * to be checked at run time.  MINIX does not use this facility.
- * The run-time limits are those given in <limits.h>.
- */
-
-  struct stat stbuf;
-
-  switch(name) {
-       case _PC_LINK_MAX:
-               /* Fstat the file.  If that fails, return -1. */
-               if (fstat(fd, &stbuf) != 0) return(-1);
-               if (S_ISDIR(stbuf.st_mode))
-                       return(1L);     /* no links to directories */
-               else
-                       return( (long) LINK_MAX);
-
-       case _PC_MAX_CANON:
-               return( (long) MAX_CANON);
-
-       case _PC_MAX_INPUT:
-               return( (long) MAX_INPUT);
-
-       case _PC_NAME_MAX:
-               return( (long) NAME_MAX);
-
-       case _PC_PATH_MAX:
-               return( (long) PATH_MAX);
-
-       case _PC_PIPE_BUF:
-               return( (long) PIPE_BUF);
-
-       case _PC_CHOWN_RESTRICTED:
-               return( (long) _POSIX_CHOWN_RESTRICTED);
-
-       case _PC_NO_TRUNC:
-               return( (long) _POSIX_NO_TRUNC);
-
-       case _PC_VDISABLE:
-               return( (long) _POSIX_VDISABLE);
-
-       default:
-               errno = EINVAL;
-               return(-1);
-  }
-}
diff --git a/lib/libc/posix/_fstat.c b/lib/libc/posix/_fstat.c
deleted file mode 100644 (file)
index 1b29fdf..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#include <lib.h>
-#define fstat  _fstat
-#include <sys/stat.h>
-#include <string.h>
-
-PUBLIC int fstat(fd, buffer)
-int fd;
-struct stat *buffer;
-{
-  message m;
-  int r;
-  struct minix_prev_stat old_sb;
-
-  m.m1_i1 = fd;
-  m.m1_p1 = (char *) buffer;
-
-  if((r = _syscall(VFS_PROC_NR, FSTAT, &m)) >= 0 || errno != ENOSYS)
-       return r;
-
-  errno = 0;
-
-  /* ENOSYS: new binary and old VFS, fallback to PREV_STAT.
-   * User has struct stat (buffer), VFS still fills minix_prev_stat.
-   */
-  m.m1_i1 = fd;
-  m.m1_p1 = (char *) &old_sb;
-
-  if((r = _syscall(VFS_PROC_NR, PREV_FSTAT, &m)) < 0)
-       return r;
-
-  memset(buffer, 0, sizeof(struct stat));
-  COPY_PREV_STAT_TO_NEW(buffer, &old_sb);
-
-  return r;
-}
diff --git a/lib/libc/posix/_fstatfs.c b/lib/libc/posix/_fstatfs.c
deleted file mode 100644 (file)
index 7255155..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <lib.h>
-#define fstatfs        _fstatfs
-#include <sys/stat.h>
-#include <sys/statfs.h>
-
-PUBLIC int fstatfs(int fd, struct statfs *buffer)
-{
-  message m;
-
-  m.m1_i1 = fd;
-  m.m1_p1 = (char *) buffer;
-  return(_syscall(VFS_PROC_NR, FSTATFS, &m));
-}
diff --git a/lib/libc/posix/_fstatvfs.c b/lib/libc/posix/_fstatvfs.c
deleted file mode 100644 (file)
index dc8aee8..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <lib.h>
-#define fstatvfs       _fstatvfs
-#include <sys/statvfs.h>
-#include <minix/com.h>
-
-PUBLIC int fstatvfs(int fd, struct statvfs *buffer)
-{
-  message m;
-
-  m.FSTATVFS_FD = fd;
-  m.FSTATVFS_BUF = (char *) buffer;
-  return(_syscall(VFS_PROC_NR, FSTATVFS, &m));
-}
diff --git a/lib/libc/posix/_fsync.c b/lib/libc/posix/_fsync.c
deleted file mode 100644 (file)
index 1f187cd..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define sync   _sync
-#include <unistd.h>
-
-PUBLIC int fsync(int fd)
-{
-  message m;
-
-  m.m1_i1 = fd;
-
-  return(_syscall(VFS_PROC_NR, FSYNC, &m));
-}
diff --git a/lib/libc/posix/_getcwd.c b/lib/libc/posix/_getcwd.c
deleted file mode 100644 (file)
index 17117ca..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*     getcwd() - get the name of the current working directory.
- *                                                     Author: Kees J. Bot
- *                                                             30 Apr 1989
- */
-#define chdir _chdir
-#define closedir _closedir
-#define getcwd _getcwd
-#define opendir _opendir
-#define readdir _readdir
-#define rewinddir _rewinddir
-#define stat _stat
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <limits.h>
-#include <string.h>
-
-static int addpath(const char *path, char **ap, const char *entry)
-/* Add the name of a directory entry at the front of the path being built.
- * Note that the result always starts with a slash.
- */
-{
-       const char *e= entry;
-       char *p= *ap;
-
-       while (*e != 0) e++;
-
-       while (e > entry && p > path) *--p = *--e;
-
-       if (p == path) return -1;
-       *--p = '/';
-       *ap= p;
-       return 0;
-}
-
-static int recover(char *p)
-/* Undo all those chdir("..")'s that have been recorded by addpath.  This
- * has to be done entry by entry, because the whole pathname may be too long.
- */
-{
-       int e= errno, slash;
-       char *p0;
-
-       while (*p != 0) {
-               p0= ++p;
-
-               do p++; while (*p != 0 && *p != '/');
-               slash= *p; *p= 0;
-
-               if (chdir(p0) < 0) return -1;
-               *p= slash;
-       }
-       errno= e;
-       return 0;
-}
-
-char *getcwd(char *path, size_t size)
-{
-       struct stat above, current, tmp;
-       struct dirent *entry;
-       DIR *d;
-       char *p, *up, *dotdot;
-       int cycle;
-
-       if (path == NULL || size <= 1) { errno= EINVAL; return NULL; }
-
-       p= path + size;
-       *--p = 0;
-
-       if (stat(".", &current) < 0) return NULL;
-
-       while (1) {
-               dotdot= "..";
-               if (stat(dotdot, &above) < 0) { recover(p); return NULL; }
-
-               if (above.st_dev == current.st_dev
-                                       && above.st_ino == current.st_ino)
-                       break;  /* Root dir found */
-
-               if ((d= opendir(dotdot)) == NULL) { recover(p); return NULL; }
-
-               /* Cycle is 0 for a simple inode nr search, or 1 for a search
-                * for inode *and* device nr.
-                */
-               cycle= above.st_dev == current.st_dev ? 0 : 1;
-
-               do {
-                       char name[3 + NAME_MAX + 1];
-
-                       tmp.st_ino= 0;
-                       if ((entry= readdir(d)) == NULL) {
-                               switch (++cycle) {
-                               case 1:
-                                       rewinddir(d);
-                                       continue;
-                               case 2:
-                                       closedir(d);
-                                       errno= ENOENT;
-                                       recover(p);
-                                       return NULL;
-                               }
-                       }
-                       if (strcmp(entry->d_name, ".") == 0) continue;
-                       if (strcmp(entry->d_name, "..") == 0) continue;
-
-                       switch (cycle) {
-                       case 0:
-                               /* Simple test on inode nr. */
-                               if (entry->d_ino != current.st_ino) continue;
-                               /*FALL THROUGH*/
-
-                       case 1:
-                               /* Current is mounted. */
-                               strcpy(name, "../");
-                               strcpy(name+3, entry->d_name);
-                               if (stat(name, &tmp) < 0) continue;
-                               break;
-                       }
-               } while (tmp.st_ino != current.st_ino
-                                       || tmp.st_dev != current.st_dev);
-
-               up= p;
-               if (addpath(path, &up, entry->d_name) < 0) {
-                       closedir(d);
-                       errno = ERANGE;
-                       recover(p);
-                       return NULL;
-               }
-               closedir(d);
-
-               if (chdir(dotdot) < 0) { recover(p); return NULL; }
-               p= up;
-
-               current= above;
-       }
-       if (recover(p) < 0) return NULL;        /* Undo all those chdir("..")'s. */
-       if (*p == 0) *--p = '/';        /* Cwd is "/" if nothing added */
-       if (p > path) strcpy(path, p);  /* Move string to start of path. */
-       return path;
-}
diff --git a/lib/libc/posix/_getegid.c b/lib/libc/posix/_getegid.c
deleted file mode 100644 (file)
index fc2c361..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <lib.h>
-#define getegid        _getegid
-#include <unistd.h>
-
-PUBLIC gid_t getegid()
-{
-  message m;
-
-  /* POSIX says that this function is always successful and that no
-   * return value is reserved to indicate an error.  Minix syscalls
-   * are not always successful and Minix returns the unreserved value
-   * (gid_t) -1 when there is an error.
-   */
-  if (_syscall(PM_PROC_NR, GETGID, &m) < 0) return ( (gid_t) -1);
-  return( (gid_t) m.m2_i1);
-}
diff --git a/lib/libc/posix/_geteuid.c b/lib/libc/posix/_geteuid.c
deleted file mode 100644 (file)
index 7ac0694..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <lib.h>
-#define geteuid        _geteuid
-#include <unistd.h>
-
-PUBLIC uid_t geteuid()
-{
-  message m;
-
-  /* POSIX says that this function is always successful and that no
-   * return value is reserved to indicate an error.  Minix syscalls
-   * are not always successful and Minix returns the unreserved value
-   * (uid_t) -1 when there is an error.
-   */
-  if (_syscall(PM_PROC_NR, GETUID, &m) < 0) return ( (uid_t) -1);
-  return( (uid_t) m.m2_i1);
-}
diff --git a/lib/libc/posix/_getgid.c b/lib/libc/posix/_getgid.c
deleted file mode 100644 (file)
index 1cd3a6b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <lib.h>
-#define getgid _getgid
-#include <unistd.h>
-
-PUBLIC gid_t getgid()
-{
-  message m;
-
-  return( (gid_t) _syscall(PM_PROC_NR, GETGID, &m));
-}
diff --git a/lib/libc/posix/_getgroups.c b/lib/libc/posix/_getgroups.c
deleted file mode 100644 (file)
index 39a7c63..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
-getgroups.c
-*/
-
-#include <lib.h>
-#define getgroups _getgroups
-#include <unistd.h>
-
-PUBLIC int getgroups(int ngroups, gid_t *arr)
-{
-  message m;
-  m.m1_i1 = ngroups;
-  m.m1_p1 = (char *) arr;
-
-  return(_syscall(PM_PROC_NR, GETGROUPS, &m));
-}
-
diff --git a/lib/libc/posix/_getitimer.c b/lib/libc/posix/_getitimer.c
deleted file mode 100644 (file)
index a01c344..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <lib.h>
-#define getitimer _getitimer
-#include <sys/time.h>
-
-/*
- * This is the implementation for the function to
- * invoke the interval timer retrieval system call.
- */
-int getitimer(int which, struct itimerval *value)
-{
-  message m;
-
-  m.m1_i1 = which;
-  m.m1_p1 = NULL;              /* only retrieve the timer */
-  m.m1_p2 = (char *) value;
-
-  return _syscall(PM_PROC_NR, ITIMER, &m);
-}
diff --git a/lib/libc/posix/_getpgrp.c b/lib/libc/posix/_getpgrp.c
deleted file mode 100644 (file)
index 71dc8eb..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <lib.h>
-#define getpgrp        _getpgrp
-#include <unistd.h>
-
-PUBLIC pid_t getpgrp()
-{
-  message m;
-
-  return(_syscall(PM_PROC_NR, GETPGRP, &m));
-}
diff --git a/lib/libc/posix/_getpid.c b/lib/libc/posix/_getpid.c
deleted file mode 100644 (file)
index 1dfc150..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <lib.h>
-#define getpid _getpid
-#include <unistd.h>
-
-PUBLIC pid_t getpid()
-{
-  message m;
-
-  return(_syscall(PM_PROC_NR, MINIX_GETPID, &m));
-}
diff --git a/lib/libc/posix/_getppid.c b/lib/libc/posix/_getppid.c
deleted file mode 100644 (file)
index 5335bd6..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <lib.h>
-#define getppid        _getppid
-#include <unistd.h>
-
-PUBLIC pid_t getppid()
-{
-  message m;
-
-  /* POSIX says that this function is always successful and that no
-   * return value is reserved to indicate an error.  Minix syscalls
-   * are not always successful and Minix returns the reserved value
-   * (pid_t) -1 when there is an error.
-   */
-  if (_syscall(PM_PROC_NR, MINIX_GETPID, &m) < 0) return ( (pid_t) -1);
-  return( (pid_t) m.m2_i1);
-}
diff --git a/lib/libc/posix/_getuid.c b/lib/libc/posix/_getuid.c
deleted file mode 100644 (file)
index 1ee2886..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <lib.h>
-#define getuid _getuid
-#include <unistd.h>
-
-PUBLIC uid_t getuid()
-{
-  message m;
-
-  return( (uid_t) _syscall(PM_PROC_NR, GETUID, &m));
-}
diff --git a/lib/libc/posix/_ioctl.c b/lib/libc/posix/_ioctl.c
deleted file mode 100644 (file)
index 4ceb740..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <lib.h>
-#define ioctl  _ioctl
-#include <minix/com.h>
-#include <sys/ioctl.h>
-
-PUBLIC int ioctl(fd, request, data)
-int fd;
-int request;
-void *data;
-{
-  message m;
-
-  m.TTY_LINE = fd;
-  m.TTY_REQUEST = request;
-  m.ADDRESS = (char *) data;
-  return(_syscall(VFS_PROC_NR, IOCTL, &m));
-}
diff --git a/lib/libc/posix/_isatty.c b/lib/libc/posix/_isatty.c
deleted file mode 100644 (file)
index 39d0069..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <lib.h>
-#define isatty _isatty
-#define tcgetattr _tcgetattr
-#include <termios.h>
-#include <unistd.h>
-
-PUBLIC int isatty(fd)
-int fd;
-{
-  struct termios dummy;
-
-  return(tcgetattr(fd, &dummy) == 0);
-}
diff --git a/lib/libc/posix/_kill.c b/lib/libc/posix/_kill.c
deleted file mode 100644 (file)
index 80250a1..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <lib.h>
-#define kill   _kill
-#include <signal.h>
-
-PUBLIC int kill(proc, sig)
-int proc;                      /* which process is to be sent the signal */
-int sig;                       /* signal number */
-{
-  message m;
-
-  m.m1_i1 = proc;
-  m.m1_i2 = sig;
-  return(_syscall(PM_PROC_NR, KILL, &m));
-}
diff --git a/lib/libc/posix/_killpg.c b/lib/libc/posix/_killpg.c
deleted file mode 100644 (file)
index ed511b6..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <lib.h>
-#define killpg _killpg
-#define kill   _kill
-#include <signal.h>
-
-PUBLIC int killpg(pgrp, sig)
-int pgrp;                      /* which process group is to be sent the
-                                * signal
-                                */
-int sig;                       /* signal number */
-{
-  return kill(-pgrp, sig);
-}
diff --git a/lib/libc/posix/_link.c b/lib/libc/posix/_link.c
deleted file mode 100644 (file)
index 0973434..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <lib.h>
-#define link   _link
-#include <string.h>
-#include <unistd.h>
-
-PUBLIC int link(name, name2)
-_CONST char *name, *name2;
-{
-  message m;
-
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_i2 = strlen(name2) + 1;
-  m.m1_p1 = (char *) name;
-  m.m1_p2 = (char *) name2;
-  return(_syscall(VFS_PROC_NR, LINK, &m));
-}
diff --git a/lib/libc/posix/_lseek.c b/lib/libc/posix/_lseek.c
deleted file mode 100644 (file)
index 574bba9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <lib.h>
-#define lseek  _lseek
-#include <unistd.h>
-
-PUBLIC off_t lseek(fd, offset, whence)
-int fd;
-off_t offset;
-int whence;
-{
-  message m;
-
-  m.m2_i1 = fd;
-  m.m2_l1 = offset;
-  m.m2_i2 = whence;
-  if (_syscall(VFS_PROC_NR, LSEEK, &m) < 0) return( (off_t) -1);
-  return( (off_t) m.m2_l1);
-}
diff --git a/lib/libc/posix/_lstat.c b/lib/libc/posix/_lstat.c
deleted file mode 100644 (file)
index e0b0ba3..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <lib.h>
-#define lstat  _lstat
-#include <sys/stat.h>
-#include <string.h>
-
-PUBLIC int lstat(name, buffer)
-_CONST char *name;
-struct stat *buffer;
-{
-  message m;
-  int r;
-  struct minix_prev_stat old_sb;
-
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_p1 = (char *) name;
-  m.m1_p2 = (char *) buffer;
-
-  if((r = _syscall(VFS_PROC_NR, LSTAT, &m)) >= 0 || errno != ENOSYS)
-       return r;
-
-  errno = 0;
-
-  /* ENOSYS: new binary and old VFS, fallback to PREV_STAT.
-   * User has struct stat (buffer), VFS still fills minix_prev_stat.
-   */
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_p1 = (char *) name;
-  m.m1_p2 = (char *) &old_sb;
-
-  if((r = _syscall(VFS_PROC_NR, PREV_LSTAT, &m)) < 0)
-       return r;
-
-  memset(buffer, 0, sizeof(struct stat));
-  COPY_PREV_STAT_TO_NEW(buffer, &old_sb);
-
-  return r;
-}
diff --git a/lib/libc/posix/_mkdir.c b/lib/libc/posix/_mkdir.c
deleted file mode 100644 (file)
index fb43239..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <lib.h>
-#define mkdir  _mkdir
-#include <sys/stat.h>
-#include <string.h>
-
-PUBLIC int mkdir(const char *name, mode_t mode)
-{
-  message m;
-
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_i2 = mode;
-  m.m1_p1 = (char *) name;
-  return(_syscall(VFS_PROC_NR, MKDIR, &m));
-}
diff --git a/lib/libc/posix/_mkfifo.c b/lib/libc/posix/_mkfifo.c
deleted file mode 100644 (file)
index 07cf530..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <lib.h>
-#define mkfifo _mkfifo
-#define mknod  _mknod
-#include <sys/stat.h>
-#include <unistd.h>
-
-PUBLIC int mkfifo(const char *name, mode_t mode)
-{
-  return mknod(name, mode | S_IFIFO, (dev_t) 0);
-}
diff --git a/lib/libc/posix/_mknod.c b/lib/libc/posix/_mknod.c
deleted file mode 100644 (file)
index b65ac18..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <lib.h>
-#define mknod  _mknod
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-PUBLIC int mknod(const char *name, mode_t mode, dev_t dev)
-{
-  message m;
-
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_i2 = mode;
-  m.m1_i3 = dev;
-  m.m1_p1 = (char *) name;
-  m.m1_p2 = (char *) ((int) 0);                /* obsolete size field */
-  return(_syscall(VFS_PROC_NR, MKNOD, &m));
-}
diff --git a/lib/libc/posix/_mmap.c b/lib/libc/posix/_mmap.c
deleted file mode 100644 (file)
index 42605be..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-#define _SYSTEM 1
-#include <lib.h>
-#define minix_mmap     _minix_mmap
-#define minix_munmap   _minix_munmap
-#define minix_munmap_text      _minix_munmap_text
-#define vm_remap _vm_remap
-#define vm_unmap _vm_unmap
-#define vm_getphys _vm_getphys
-#define vm_getrefcount _vm_getrefcount
-#include <sys/mman.h>
-#include <stdarg.h>
-#include <string.h>
-#include <errno.h>
-
-PUBLIC void *minix_mmap(void *addr, size_t len, int prot, int flags,
-       int fd, off_t offset)
-{
-       message m;
-       int r;
-
-       m.VMM_ADDR = (vir_bytes) addr;
-       m.VMM_LEN = len;
-       m.VMM_PROT = prot;
-       m.VMM_FLAGS = flags;
-       m.VMM_FD = fd;
-       m.VMM_OFFSET = offset;
-
-       r = _syscall(VM_PROC_NR, VM_MMAP, &m);
-
-       if(r != OK) {
-               return MAP_FAILED;
-       }
-
-       return (void *) m.VMM_RETADDR;
-}
-
-PUBLIC int minix_munmap(void *addr, size_t len)
-{
-       message m;
-
-       m.VMUM_ADDR = addr;
-       m.VMUM_LEN = len;
-
-       return _syscall(VM_PROC_NR, VM_MUNMAP, &m);
-}
-
-
-PUBLIC int minix_munmap_text(void *addr, size_t len)
-{
-       message m;
-
-       m.VMUM_ADDR = addr;
-       m.VMUM_LEN = len;
-
-       return _syscall(VM_PROC_NR, VM_MUNMAP_TEXT, &m);
-}
-
-PUBLIC void *vm_remap(endpoint_t d,
-                       endpoint_t s,
-                       void *da,
-                       void *sa,
-                       size_t size)
-{
-       message m;
-       int r;
-
-       m.VMRE_D = d;
-       m.VMRE_S = s;
-       m.VMRE_DA = (char *) da;
-       m.VMRE_SA = (char *) sa;
-       m.VMRE_SIZE = size;
-
-       r = _syscall(VM_PROC_NR, VM_REMAP, &m);
-       if (r != OK)
-               return MAP_FAILED;
-       return (void *) m.VMRE_RETA;
-}
-
-PUBLIC void *vm_remap_ro(endpoint_t d,
-                       endpoint_t s,
-                       void *da,
-                       void *sa,
-                       size_t size)
-{
-       message m;
-       int r;
-
-       m.VMRE_D = d;
-       m.VMRE_S = s;
-       m.VMRE_DA = (char *) da;
-       m.VMRE_SA = (char *) sa;
-       m.VMRE_SIZE = size;
-
-       r = _syscall(VM_PROC_NR, VM_REMAP_RO, &m);
-       if (r != OK)
-               return MAP_FAILED;
-       return (void *) m.VMRE_RETA;
-}
-
-
-PUBLIC int vm_unmap(endpoint_t endpt, void *addr)
-{
-       message m;
-
-       m.VMUN_ENDPT = endpt;
-       m.VMUN_ADDR = (long) addr;
-
-       return _syscall(VM_PROC_NR, VM_SHM_UNMAP, &m);
-}
-
-PUBLIC unsigned long vm_getphys(int endpt, void *addr)
-{
-       message m;
-       int r;
-
-       m.VMPHYS_ENDPT = endpt;
-       m.VMPHYS_ADDR = (long) addr;
-
-       r = _syscall(VM_PROC_NR, VM_GETPHYS, &m);
-       if (r != OK)
-               return 0;
-       return m.VMPHYS_RETA;
-}
-
-PUBLIC u8_t vm_getrefcount(endpoint_t endpt, void *addr)
-{
-       message m;
-       int r;
-
-       m.VMREFCNT_ENDPT = endpt;
-       m.VMREFCNT_ADDR = (long) addr;
-
-       r = _syscall(VM_PROC_NR, VM_GETREF, &m);
-       if (r != OK)
-               return (u8_t) -1;
-       return (u8_t) m.VMREFCNT_RETC;
-}
-
diff --git a/lib/libc/posix/_nanosleep.c b/lib/libc/posix/_nanosleep.c
deleted file mode 100644 (file)
index 0bd33c8..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*     nanosleep() - Sleep for a number of seconds.    Author: Erik van der Kouwe
- *                                                             25 July 2009
- */
-
-#include <lib.h>
-#define nanosleep _nanosleep
-#include <unistd.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/select.h>
-#include <sys/time.h>
-
-#define MSEC_PER_SEC 1000
-#define USEC_PER_MSEC 1000
-#define NSEC_PER_USEC 1000
-
-#define USEC_PER_SEC (USEC_PER_MSEC * MSEC_PER_SEC)
-#define NSEC_PER_SEC (NSEC_PER_USEC * USEC_PER_SEC)
-
-int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
-{
-       struct timeval timeout, timestart = { 0, 0 }, timeend;
-       int errno_select, r;
-       struct timespec rqt;
-
-       /* check parameters */
-       if (!rqtp)
-               return EFAULT;
-
-       if (rqtp->tv_sec < 0 || 
-               rqtp->tv_nsec < 0 ||
-               rqtp->tv_nsec >= NSEC_PER_SEC)
-               return EINVAL;
-
-       /* store *rqtp to make sure it is not overwritten */
-       rqt = *rqtp;
-       
-       /* keep track of start time if needed */
-       if (rmtp)
-       {
-               rmtp->tv_sec = 0;
-               rmtp->tv_nsec = 0;
-               if (gettimeofday(&timestart, NULL) < 0)
-                       return -1;
-       }
-
-       /* use select to wait */
-       timeout.tv_sec = rqt.tv_sec;
-       timeout.tv_usec = (rqt.tv_nsec + NSEC_PER_USEC - 1) / NSEC_PER_USEC;
-       r = select(0, NULL, NULL, NULL, &timeout);
-
-       /* return remaining time only if requested */
-       /* if select succeeded then we slept all time */
-       if (!rmtp || r >= 0)
-               return r;
-
-       /* measure end time; preserve errno */
-       errno_select = errno;
-       if (gettimeofday(&timeend, NULL) < 0)
-               return -1;
-
-       errno = errno_select;
-
-       /* compute remaining time */
-       rmtp->tv_sec = rqt.tv_sec - (timeend.tv_sec - timestart.tv_sec);
-       rmtp->tv_nsec = rqt.tv_nsec - (timeend.tv_usec - timestart.tv_usec) * NSEC_PER_USEC;
-
-       /* bring remaining time into canonical form */
-       while (rmtp->tv_nsec < 0)
-       {
-               rmtp->tv_sec -= 1;
-               rmtp->tv_nsec += NSEC_PER_SEC;
-       }
-
-       while (rmtp->tv_nsec > NSEC_PER_SEC)
-       {
-               rmtp->tv_sec += 1;
-               rmtp->tv_nsec -= NSEC_PER_SEC;
-       }
-
-       /* remaining time must not be negative */
-       if (rmtp->tv_sec < 0)
-       {
-               rmtp->tv_sec = 0;
-               rmtp->tv_nsec = 0;
-       }
-
-       return r;
-}
-
diff --git a/lib/libc/posix/_open.c b/lib/libc/posix/_open.c
deleted file mode 100644 (file)
index f0d2fe9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#include <lib.h>
-#define open   _open
-#include <fcntl.h>
-#include <stdarg.h>
-#include <string.h>
-
-#if _ANSI
-PUBLIC int open(const char *name, int flags, ...)
-#else
-PUBLIC int open(const char *name, int flags)
-#endif
-{
-  va_list argp;
-  message m;
-
-  va_start(argp, flags);
-  if (flags & O_CREAT) {
-       m.m1_i1 = strlen(name) + 1;
-       m.m1_i2 = flags;
-       /* Since it's a vararg parameter that is smaller than
-        * an int, the mode was passed as an int.
-        */
-       m.m1_i3 = va_arg(argp, int);
-       m.m1_p1 = (char *) name;
-  } else {
-       _loadname(name, &m);
-       m.m3_i2 = flags;
-  }
-  va_end(argp);
-  return (_syscall(VFS_PROC_NR, OPEN, &m));
-}
diff --git a/lib/libc/posix/_opendir.c b/lib/libc/posix/_opendir.c
deleted file mode 100644 (file)
index efae29f..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*     opendir()                                       Author: Kees J. Bot
- *                                                             24 Apr 1989
- */
-#define nil 0
-#include <lib.h>
-#define close  _close
-#define fcntl  _fcntl
-#define fstat  _fstat
-#define open   _open
-#define opendir        _opendir
-#define stat   _stat
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <errno.h>
-
-DIR *opendir(const char *name)
-/* Open a directory for reading. */
-{
-       int d, f;
-       DIR *dp;
-       struct stat st;
-
-       /* Only read directories. */
-       if (stat(name, &st) < 0) return nil;
-       if (!S_ISDIR(st.st_mode)) { errno= ENOTDIR; return nil; }
-
-       if ((d= open(name, O_RDONLY | O_NONBLOCK)) < 0) return nil;
-
-       /* Check the type again, mark close-on-exec, get a buffer. */
-       if (fstat(d, &st) < 0
-               || !S_ISDIR(st.st_mode)
-               || (f= fcntl(d, F_GETFD)) < 0
-               || fcntl(d, F_SETFD, f | FD_CLOEXEC) < 0
-               || (dp= (DIR *) malloc(sizeof(*dp))) == nil
-       ) {
-               int err= errno;
-               if (!S_ISDIR(st.st_mode)) err= ENOTDIR;
-               (void) close(d);
-               errno= err;
-               return nil;
-       }
-
-       dp->_fd= d;
-       dp->_count= 0;
-       dp->_pos= 0;
-
-       return dp;
-}
-
diff --git a/lib/libc/posix/_pathconf.c b/lib/libc/posix/_pathconf.c
deleted file mode 100644 (file)
index ba8797c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/* POSIX pathconf (Sec. 5.7.1)                 Author: Andy Tanenbaum */
-
-#include <lib.h>
-#define close          _close
-#define open           _open
-#define pathconf       _pathconf
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
-
-PUBLIC long pathconf(path, name)
-_CONST char *path;             /* name of file being interrogated */
-int name;                      /* property being inspected */
-{
-/* POSIX allows some of the values in <limits.h> to be increased at
- * run time.  The pathconf and fpathconf functions allow these values
- * to be checked at run time.  MINIX does not use this facility.
- * The run-time limits are those given in <limits.h>.
- */
-
-  int fd;
-  long val;
-
-  if ( (fd = open(path, O_RDONLY)) < 0) return(-1L);
-  val = fpathconf(fd, name);
-  close(fd);
-  return(val);
-}
diff --git a/lib/libc/posix/_pause.c b/lib/libc/posix/_pause.c
deleted file mode 100644 (file)
index 7e0b2a2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <lib.h>
-#define pause  _pause
-#include <unistd.h>
-
-PUBLIC int pause()
-{
-  message m;
-
-  return(_syscall(PM_PROC_NR, PAUSE, &m));
-}
diff --git a/lib/libc/posix/_pipe.c b/lib/libc/posix/_pipe.c
deleted file mode 100644 (file)
index 918fb19..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <lib.h>
-#define pipe   _pipe
-#include <unistd.h>
-
-PUBLIC int pipe(fild)
-int fild[2];
-{
-  message m;
-
-  if (_syscall(VFS_PROC_NR, PIPE, &m) < 0) return(-1);
-  fild[0] = m.m1_i1;
-  fild[1] = m.m1_i2;
-  return(0);
-}
diff --git a/lib/libc/posix/_ptrace.c b/lib/libc/posix/_ptrace.c
deleted file mode 100644 (file)
index 7c57fb3..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <lib.h>
-#define ptrace _ptrace
-#include <unistd.h>
-
-PUBLIC long ptrace(int req, pid_t pid, long addr, long data)
-{
-  message m;
-
-  m.m2_i1 = pid;
-  m.m2_i2 = req;
-  m.PMTRACE_ADDR = addr;
-  m.m2_l2 = data;
-  if (_syscall(PM_PROC_NR, PTRACE, &m) < 0) return(-1);
-
-  /* There was no error, but -1 is a legal return value.  Clear errno if
-   * necessary to distinguish this case.  _syscall has set errno to nonzero
-   * for the error case.
-   */
-  if (m.m2_l2 == -1) errno = 0;
-  return(m.m2_l2);
-}
diff --git a/lib/libc/posix/_read.c b/lib/libc/posix/_read.c
deleted file mode 100644 (file)
index 8138c00..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <lib.h>
-#define read   _read
-#include <unistd.h>
-
-PUBLIC ssize_t read(fd, buffer, nbytes)
-int fd;
-void *buffer;
-size_t nbytes;
-{
-  message m;
-
-  m.m1_i1 = fd;
-  m.m1_i2 = nbytes;
-  m.m1_p1 = (char *) buffer;
-  return(_syscall(VFS_PROC_NR, READ, &m));
-}
diff --git a/lib/libc/posix/_readdir.c b/lib/libc/posix/_readdir.c
deleted file mode 100644 (file)
index 48b7160..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*     readdir()                                       Author: Kees J. Bot
- *                                                             24 Apr 1989
- */
-#define nil 0
-#define readdir _readdir
-#define getdents _getdents
-#include <sys/types.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-
-struct dirent *readdir(DIR *dp)
-/* Return the next entry in a directory. */
-{
-       struct dirent *entp;
-       int count, pos, reclen;
-
-       if (dp == nil) { errno= EBADF; return nil; }
-
-       count= dp->_count;
-       pos= dp->_pos;
-       if (count == 0 || pos >= count)
-       {
-               count= getdents(dp->_fd, (struct dirent *)dp->_buf,
-                       sizeof(dp->_buf));
-               if (count <= 0) return nil;
-               dp->_count= count;
-               dp->_pos= pos= 0;
-       }
-       entp= (struct dirent *)&((char *)dp->_buf)[pos];
-       reclen= entp->d_reclen;
-       dp->_pos= pos+reclen;
-
-       return entp;
-}
-
-/*
- * $PchId: _readdir.c,v 1.6 2005/01/27 21:46:42 philip Exp $
- */
diff --git a/lib/libc/posix/_readlink.c b/lib/libc/posix/_readlink.c
deleted file mode 100644 (file)
index 2148d2f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <lib.h>
-#define readlink _readlink
-#include <unistd.h>
-#include <string.h>
-
-PUBLIC int readlink(name, buffer, bufsiz)
-_CONST char *name;
-char *buffer;
-size_t bufsiz;
-{
-  message m;
-
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_i2 = bufsiz;
-  m.m1_p1 = (char *) name;
-  m.m1_p2 = (char *) buffer;
-
-  return(_syscall(VFS_PROC_NR, RDLNK, &m));
-}
diff --git a/lib/libc/posix/_rename.c b/lib/libc/posix/_rename.c
deleted file mode 100644 (file)
index 755627e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <lib.h>
-#define rename _rename
-#include <string.h>
-#include <stdio.h>
-
-PUBLIC int rename(name, name2)
-_CONST char *name, *name2;
-{
-  message m;
-
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_i2 = strlen(name2) + 1;
-  m.m1_p1 = (char *) name;
-  m.m1_p2 = (char *) name2;
-  return(_syscall(VFS_PROC_NR, RENAME, &m));
-}
diff --git a/lib/libc/posix/_rewinddir.c b/lib/libc/posix/_rewinddir.c
deleted file mode 100644 (file)
index b2f65f1..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*     rewinddir()                                     Author: Kees J. Bot
- *                                                             24 Apr 1989
- */
-#define nil 0
-#include <lib.h>
-#define rewinddir _rewinddir
-#define seekdir        _seekdir
-#include <sys/types.h>
-#include <dirent.h>
-
-void rewinddir(DIR *dp)
-{
-       (void) seekdir(dp, 0);
-}
diff --git a/lib/libc/posix/_rmdir.c b/lib/libc/posix/_rmdir.c
deleted file mode 100644 (file)
index 6e33879..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define rmdir  _rmdir
-#include <unistd.h>
-
-PUBLIC int rmdir(name)
-_CONST char *name;
-{
-  message m;
-
-  _loadname(name, &m);
-  return(_syscall(VFS_PROC_NR, RMDIR, &m));
-}
diff --git a/lib/libc/posix/_select.c b/lib/libc/posix/_select.c
deleted file mode 100644 (file)
index 810fbb1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-
-#define select _select
-
-#include <lib.h>
-#include <sys/time.h>
-#include <sys/select.h>
-
-PUBLIC int select(int nfds,
-       fd_set *readfds, fd_set *writefds, fd_set *errorfds,
-       struct timeval *timeout)
-{
-  message m;
-
-  m.SEL_NFDS = nfds;
-  m.SEL_READFDS = (char *) readfds;
-  m.SEL_WRITEFDS = (char *) writefds;
-  m.SEL_ERRORFDS = (char *) errorfds;
-  m.SEL_TIMEOUT = (char *) timeout;
-
-  return (_syscall(VFS_PROC_NR, SELECT, &m));
-}
-
diff --git a/lib/libc/posix/_setgid.c b/lib/libc/posix/_setgid.c
deleted file mode 100644 (file)
index 9e9f97d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <lib.h>
-#define setgid _setgid
-#define setegid        _setegid
-#include <unistd.h>
-
-PUBLIC int setgid(gid_t grp)
-{
-  message m;
-
-  m.m1_i1 = (int) grp;
-  return(_syscall(PM_PROC_NR, SETGID, &m));
-}
-
-PUBLIC int setegid(gid_t grp)
-{
-  message m;
-
-  m.m1_i1 = (int) grp;
-  return(_syscall(PM_PROC_NR, SETEGID, &m));
-}
diff --git a/lib/libc/posix/_setitimer.c b/lib/libc/posix/_setitimer.c
deleted file mode 100644 (file)
index 8c487ab..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <lib.h>
-#define setitimer _setitimer
-#include <sys/time.h>
-
-/*
- * This is the implementation of the function to
- * invoke the interval timer setting system call.
- */
-int setitimer(int which, const struct itimerval *_RESTRICT value,
-               struct itimerval *_RESTRICT ovalue)
-{
-  message m;
-
-  /* A null pointer for 'value' would make setitimer behave like getitimer,
-   * which is not according to the specification, so disallow null pointers.
-   */
-  if (value == NULL) return(EINVAL);
-
-  m.m1_i1 = which;
-  m.m1_p1 = (char *) value;
-  m.m1_p2 = (char *) ovalue;
-
-  return _syscall(PM_PROC_NR, ITIMER, &m);
-}
diff --git a/lib/libc/posix/_setsid.c b/lib/libc/posix/_setsid.c
deleted file mode 100644 (file)
index df3b7ec..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <lib.h>
-#define setsid _setsid
-#include <unistd.h>
-
-PUBLIC pid_t setsid()
-{
-  message m;
-
-  return(_syscall(PM_PROC_NR, SETSID, &m));
-}
diff --git a/lib/libc/posix/_setuid.c b/lib/libc/posix/_setuid.c
deleted file mode 100644 (file)
index 4d85a6d..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#include <lib.h>
-#define setuid _setuid
-#define seteuid        _seteuid
-#include <unistd.h>
-
-PUBLIC int setuid(uid_t usr)
-{
-  message m;
-
-  m.m1_i1 = usr;
-  return(_syscall(PM_PROC_NR, SETUID, &m));
-}
-
-PUBLIC int seteuid(uid_t usr)
-{
-  message m;
-
-  m.m1_i1 = usr;
-  return(_syscall(PM_PROC_NR, SETEUID, &m));
-}
diff --git a/lib/libc/posix/_sigaction.c b/lib/libc/posix/_sigaction.c
deleted file mode 100644 (file)
index 0ba020c..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <lib.h>
-#define sigaction _sigaction
-#include <signal.h>
-
-_PROTOTYPE(int __sigreturn, (void));
-
-PUBLIC int sigaction(sig, act, oact)
-int sig;
-_CONST struct sigaction *act;
-struct sigaction *oact;
-{
-  message m;
-
-  m.m1_i2 = sig;
-
-  /* XXX - yet more type puns because message struct is short of types. */
-  m.m1_p1 = (char *) act;
-  m.m1_p2 = (char *) oact;
-  m.m1_p3 = (char *) __sigreturn;
-
-  return(_syscall(PM_PROC_NR, SIGACTION, &m));
-}
diff --git a/lib/libc/posix/_sigpending.c b/lib/libc/posix/_sigpending.c
deleted file mode 100644 (file)
index 95760f3..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <lib.h>
-#define sigpending _sigpending
-#include <signal.h>
-
-PUBLIC int sigpending(set)
-sigset_t *set;
-{
-  message m;
-
-  if (_syscall(PM_PROC_NR, SIGPENDING, &m) < 0) return(-1);
-  *set = (sigset_t) m.m2_l1;
-  return(m.m_type);
-}
diff --git a/lib/libc/posix/_sigprocmask.c b/lib/libc/posix/_sigprocmask.c
deleted file mode 100644 (file)
index 51c25f1..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#include <lib.h>
-#define sigprocmask _sigprocmask
-#include <signal.h>
-
-PUBLIC int sigprocmask(how, set, oset)
-int how;
-_CONST sigset_t *set;
-sigset_t *oset;
-{
-  message m;
-
-  if (set == (sigset_t *) NULL) {
-       m.m2_i1 = SIG_INQUIRE;
-       m.m2_l1 = 0;
-  } else {
-       m.m2_i1 = how;
-       m.m2_l1 = (long) *set;
-  }
-  if (_syscall(PM_PROC_NR, SIGPROCMASK, &m) < 0) return(-1);
-  if (oset != (sigset_t *) NULL) *oset = (sigset_t) (m.m2_l1);
-  return(m.m_type);
-}
diff --git a/lib/libc/posix/_sigreturn.c b/lib/libc/posix/_sigreturn.c
deleted file mode 100644 (file)
index a9024f2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <lib.h>
-#define sigfillset     _sigfillset
-#define sigprocmask    _sigprocmask
-#define sigreturn      _sigreturn
-#include <sys/sigcontext.h>
-#include <signal.h>
-
-PUBLIC int sigreturn(scp)
-register struct sigcontext *scp;
-{
-  sigset_t set;
-
-  /* The message can't be on the stack, because the stack will vanish out
-   * from under us.  The send part of sendrec will succeed, but when
-   * a message is sent to restart the current process, who knows what will
-   * be in the place formerly occupied by the message?
-   */
-  static message m;
-
-  /* Protect against race conditions by blocking all interrupts. */
-  sigfillset(&set);            /* splhi */
-  sigprocmask(SIG_SETMASK, &set, (sigset_t *) NULL);
-
-  m.m2_l1 = scp->sc_mask;
-  m.m2_i2 = scp->sc_flags;
-  m.m2_p1 = (char *) scp;
-  return(_syscall(PM_PROC_NR, SIGRETURN, &m)); /* normally this doesn't return */
-}
diff --git a/lib/libc/posix/_sigset.c b/lib/libc/posix/_sigset.c
deleted file mode 100644 (file)
index a1813cf..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <lib.h>
-/* System processes use simpler macros with no range error checking (defined in
- * signal.h). The ANSI signal() implementation now also uses the macro
- * versions, which makes hiding of the functions here a historical remains.
- *
- * _NSIG is supposed to be the highest signal number plus one.
- */
-#define sigaddset      _sigaddset
-#define sigdelset      _sigdelset
-#define sigemptyset    _sigemptyset
-#define sigfillset     _sigfillset
-#define sigismember    _sigismember
-#include <signal.h>
-
-/* Low bit of signal masks. */
-#define SIGBIT_0       ((sigset_t) 1)
-
-/* Mask of valid signals (0 - (_NSIG-1)). */
-#define SIGMASK                ((SIGBIT_0 << _NSIG) - 1)
-
-#define sigisvalid(signo) ((unsigned) (signo) < _NSIG)
-
-PUBLIC int sigaddset(set, signo)
-sigset_t *set;
-int signo;
-{
-  if (!sigisvalid(signo)) {
-       errno = EINVAL;
-       return -1;
-  }
-  *set |= SIGBIT_0 << signo;
-  return 0;
-}
-
-PUBLIC int sigdelset(set, signo)
-sigset_t *set;
-int signo;
-{
-  if (!sigisvalid(signo)) {
-       errno = EINVAL;
-       return -1;
-  }
-  *set &= ~(SIGBIT_0 << signo);
-  return 0;
-}
-
-PUBLIC int sigemptyset(set)
-sigset_t *set;
-{
-  *set = 0;
-  return 0;
-}
-
-PUBLIC int sigfillset(set)
-sigset_t *set;
-{
-  *set = SIGMASK;
-  return 0;
-}
-
-PUBLIC int sigismember(set, signo)
-_CONST sigset_t *set;
-int signo;
-{
-  if (!sigisvalid(signo)) {
-       errno = EINVAL;
-       return -1;
-  }
-  if (*set & (SIGBIT_0 << signo))
-       return 1;
-  return 0;
-}
diff --git a/lib/libc/posix/_sigsuspend.c b/lib/libc/posix/_sigsuspend.c
deleted file mode 100644 (file)
index 84ddf47..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define sigsuspend _sigsuspend
-#include <signal.h>
-
-PUBLIC int sigsuspend(set)
-_CONST sigset_t *set;
-{
-  message m;
-
-  m.m2_l1 = (long) *set;
-  return(_syscall(PM_PROC_NR, SIGSUSPEND, &m));
-}
diff --git a/lib/libc/posix/_sleep.c b/lib/libc/posix/_sleep.c
deleted file mode 100644 (file)
index fe90429..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*     sleep() - Sleep for a number of seconds.        Author: Erik van der Kouwe
- *                                                             25 July 2009
- * (Avoids interfering with alarm/setitimer by using select, like usleep)
- */
-
-#include <lib.h>
-#define sleep _sleep
-#include <unistd.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/select.h>
-#include <sys/time.h>
-
-unsigned sleep(unsigned sleep_seconds)
-{
-       struct timespec rqtp, rmtp;
-
-       /* nanosleep implements this call; ignore failure, it cannot be reported */
-       rqtp.tv_sec = sleep_seconds;
-       rqtp.tv_nsec = 0;
-       nanosleep(&rqtp, &rmtp);
-
-       /* round remainder up to seconds */
-       return rmtp.tv_sec + ((rmtp.tv_nsec > 0) ? 1 : 0);
-}
diff --git a/lib/libc/posix/_stat.c b/lib/libc/posix/_stat.c
deleted file mode 100644 (file)
index 1886081..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#include <lib.h>
-#define stat   _stat
-#include <sys/stat.h>
-#include <string.h>
-
-PUBLIC int stat(name, buffer)
-_CONST char *name;
-struct stat *buffer;
-{
-  message m;
-  int r;
-  struct minix_prev_stat old_sb;
-
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_p1 = (char *) name;
-  m.m1_p2 = (char *) buffer;
-
-  if((r = _syscall(VFS_PROC_NR, STAT, &m)) >= 0 || errno != ENOSYS)
-       return r;
-
-  errno = 0;
-
-  /* ENOSYS: new binary and old VFS, fallback to PREV_STAT.
-   * User has struct stat (buffer), VFS still fills minix_prev_stat.
-   */
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_p1 = (char *) name;
-  m.m1_p2 = (char *) &old_sb;
-
-  if((r = _syscall(VFS_PROC_NR, PREV_STAT, &m)) < 0)
-       return r;
-
-  memset(buffer, 0, sizeof(struct stat));
-  COPY_PREV_STAT_TO_NEW(buffer, &old_sb);
-
-  return r;
-}
diff --git a/lib/libc/posix/_statvfs.c b/lib/libc/posix/_statvfs.c
deleted file mode 100644 (file)
index 4d56efd..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <lib.h>
-#define statvfs        _statvfs
-#include <sys/statvfs.h>
-#include <string.h>
-#include <minix/com.h>
-
-PUBLIC int statvfs(name, buffer)
-_CONST char *name;
-struct statvfs *buffer;
-{
-  message m;
-
-  m.STATVFS_LEN = strlen(name) + 1;
-  m.STATVFS_NAME = (char *) name;
-  m.STATVFS_BUF = (char *) buffer;
-  return(_syscall(VFS_PROC_NR, STATVFS, &m));
-}
diff --git a/lib/libc/posix/_stime.c b/lib/libc/posix/_stime.c
deleted file mode 100644 (file)
index 8a53b63..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define stime  _stime
-#include <time.h>
-
-PUBLIC int stime(top)
-long *top;
-{
-  message m;
-
-  m.m2_l1 = *top;
-  return(_syscall(PM_PROC_NR, STIME, &m));
-}
diff --git a/lib/libc/posix/_symlink.c b/lib/libc/posix/_symlink.c
deleted file mode 100644 (file)
index 5046f51..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <lib.h>
-#define symlink        _symlink
-#include <string.h>
-#include <unistd.h>
-
-PUBLIC int symlink(name, name2)
-_CONST char *name, *name2;
-{
-  message m;
-
-  m.m1_i1 = strlen(name) + 1;
-  m.m1_i2 = strlen(name2) + 1;
-  m.m1_p1 = (char *) name;
-  m.m1_p2 = (char *) name2;
-  return(_syscall(VFS_PROC_NR, SYMLINK, &m));
-}
diff --git a/lib/libc/posix/_sync.c b/lib/libc/posix/_sync.c
deleted file mode 100644 (file)
index 536504b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <lib.h>
-#define sync   _sync
-#include <unistd.h>
-
-PUBLIC int sync()
-{
-  message m;
-
-  return(_syscall(VFS_PROC_NR, SYNC, &m));
-}
diff --git a/lib/libc/posix/_tcdrain.c b/lib/libc/posix/_tcdrain.c
deleted file mode 100644 (file)
index f708527..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
-posix/_tcdrain.c
-
-Created:       July 26, 1994 by Philip Homburg
-*/
-
-#define tcdrain _tcdrain
-#define ioctl _ioctl
-#include <termios.h>
-#include <sys/ioctl.h>
-
-int tcdrain(fd)
-int fd;
-{
-  return(ioctl(fd, TCDRAIN, (void *)0));
-}
diff --git a/lib/libc/posix/_tcflow.c b/lib/libc/posix/_tcflow.c
deleted file mode 100644 (file)
index c85e206..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
-posix/_tcflow.c
-
-Created:       June 8, 1993 by Philip Homburg
-*/
-
-#define tcflow _tcflow
-#define ioctl _ioctl
-#include <termios.h>
-#include <sys/ioctl.h>
-
-int tcflow(fd, action)
-int fd;
-int action;
-{
-  return(ioctl(fd, TCFLOW, &action));
-}
diff --git a/lib/libc/posix/_tcflush.c b/lib/libc/posix/_tcflush.c
deleted file mode 100644 (file)
index 84a6663..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*     tcflush() - flush buffered characters           Author: Kees J. Bot
- *                                                             13 Jan 1994
- */
-#define tcflush _tcflush
-#define ioctl _ioctl
-#include <termios.h>
-#include <sys/ioctl.h>
-
-int tcflush(int fd, int queue_selector)
-{
-  return(ioctl(fd, TCFLSH, &queue_selector));
-}
diff --git a/lib/libc/posix/_tcgetattr.c b/lib/libc/posix/_tcgetattr.c
deleted file mode 100644 (file)
index cb1942b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#define tcgetattr _tcgetattr
-#define ioctl _ioctl
-#include <sys/ioctl.h>
-#include <errno.h>
-#include <termios.h>
-
-int tcgetattr(fd, termios_p)
-int fd;
-struct termios *termios_p;
-{
-  return(ioctl(fd, TCGETS, termios_p));
-}
diff --git a/lib/libc/posix/_tcsendbreak.c b/lib/libc/posix/_tcsendbreak.c
deleted file mode 100644 (file)
index 6052e2b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*     tcsendbreak() - send a break                    Author: Kees J. Bot
- *                                                             13 Jan 1994
- */
-#define tcsendbreak _tcsendbreak
-#define ioctl _ioctl
-#include <termios.h>
-#include <sys/ioctl.h>
-
-int tcsendbreak(int fd, int duration)
-{
-  return(ioctl(fd, TCSBRK, &duration));
-}
diff --git a/lib/libc/posix/_tcsetattr.c b/lib/libc/posix/_tcsetattr.c
deleted file mode 100644 (file)
index d43088f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-posix/_tcsetattr.c
-
-Created:       June 11, 1993 by Philip Homburg
-*/
-
-#define tcsetattr _tcsetattr
-#define ioctl _ioctl
-#include <errno.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-
-int tcsetattr(fd, opt_actions, termios_p)
-int fd;
-int opt_actions;
-_CONST struct termios *termios_p;
-{
-  int request;
-
-  switch(opt_actions)
-  {
-    case TCSANOW:      request = TCSETS;       break;
-    case TCSADRAIN:    request = TCSETSW;      break;
-    case TCSAFLUSH:    request = TCSETSF;      break;
-    default:           errno = EINVAL;         return(-1);
-  };
-  return(ioctl(fd, request, (void *) termios_p));
-}
diff --git a/lib/libc/posix/_time.c b/lib/libc/posix/_time.c
deleted file mode 100644 (file)
index 6a576ca..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <lib.h>
-#define time   _time
-#include <time.h>
-
-PUBLIC time_t time(tp)
-time_t *tp;
-{
-  message m;
-
-  if (_syscall(PM_PROC_NR, TIME, &m) < 0) return( (time_t) -1);
-  if (tp != (time_t *) 0) *tp = m.m2_l1;
-  return(m.m2_l1);
-}
diff --git a/lib/libc/posix/_times.c b/lib/libc/posix/_times.c
deleted file mode 100644 (file)
index bbf4cdc..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <lib.h>
-#define times  _times
-#include <sys/times.h>
-
-PUBLIC clock_t times(buf)
-struct tms *buf;
-{
-  message m;
-
-  m.m4_l5 = 0;                 /* return this if system is pre-1.6 */
-  if (_syscall(PM_PROC_NR, TIMES, &m) < 0) return( (clock_t) -1);
-  buf->tms_utime = m.m4_l1;
-  buf->tms_stime = m.m4_l2;
-  buf->tms_cutime = m.m4_l3;
-  buf->tms_cstime = m.m4_l4;
-  return(m.m4_l5);
-}
diff --git a/lib/libc/posix/_truncate.c b/lib/libc/posix/_truncate.c
deleted file mode 100644 (file)
index b3d49dd..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <lib.h>
-#include <string.h>
-#define truncate       _truncate
-#define ftruncate      _ftruncate
-#include <unistd.h>
-
-PUBLIC int truncate(const char *_path, off_t _length)
-{
-  message m;
-  m.m2_p1 = (char *) _path;
-  m.m2_i1 = strlen(_path)+1;
-  m.m2_l1 = _length;
-
-  return(_syscall(VFS_PROC_NR, TRUNCATE, &m));
-}
-
-PUBLIC int ftruncate(int _fd, off_t _length)
-{
-  message m;
-  m.m2_l1 = _length;
-  m.m2_i1 = _fd;
-
-  return(_syscall(VFS_PROC_NR, FTRUNCATE, &m));
-}
diff --git a/lib/libc/posix/_ucontext.c b/lib/libc/posix/_ucontext.c
deleted file mode 100644 (file)
index d7930e6..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-#include <lib.h>
-#include <machine/stackframe.h>
-#include <ucontext.h>
-#include <signal.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <stdio.h>
-
-_PROTOTYPE( void ctx_start, (void (*)(void), int, ...)                 );
-
-/*===========================================================================*
- *                             setuctx                                      *
- *===========================================================================*/
-PUBLIC int setuctx(const ucontext_t *ucp)
-{
-  int r;
-
-  if (ucp == NULL) {
-       errno = EFAULT;
-       return(-1);
-  }
-
-  if (!(ucp->uc_flags & UCF_IGNSIGM)) {
-       /* Set signal mask */
-       if ((r = sigprocmask(SIG_SETMASK, &ucp->uc_sigmask, NULL)) == -1)
-               return(r);
-  }
-
-  if (!(ucp->uc_flags & UCF_IGNFPU)) {
-       if ((r = setmcontext(&(ucp->uc_mcontext))) == -1)
-               return(r);
-  }
-
-  return(0);
-}
-
-
-/*===========================================================================*
- *                             getuctx                                      *
- *===========================================================================*/
-PUBLIC int getuctx(ucontext_t *ucp) 
-{
-  int r;
-
-  if (ucp == NULL) {
-       errno = EFAULT;
-       return(-1);
-  }
-
-  if (!(ucp->uc_flags & UCF_IGNSIGM)) {
-       /* Get signal mask */
-       if ((r = sigprocmask(0, NULL, &ucp->uc_sigmask)) == -1)
-               return(r);
-  }
-
-  if (!(ucp->uc_flags & UCF_IGNFPU)) {
-       if ((r = getmcontext(&(ucp->uc_mcontext))) != 0)
-               return(r);
-  }
-
-  return(0);
-}
-
-
-/*===========================================================================*
- *                             makecontext                                  *
- *===========================================================================*/
-PUBLIC void makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
-{
-  va_list ap;
-  unsigned int *stack_top;
-
-  /* There are a number of situations that are erroneous, but we can't actually
-     tell the caller something is wrong, because this is a void function.
-     Instead, mcontext_t contains a magic field that has to be set
-     properly before it can be used. */
-  if (ucp == NULL) {
-       return;
-  } else if ((ucp->uc_stack.ss_sp == NULL) || 
-            (ucp->uc_stack.ss_size < MINSIGSTKSZ)) {
-       ucp->uc_mcontext.mc_magic = 0; 
-       ucp->uc_mcontext.mc_p_reg.sp = 0;
-       return;
-  }
-
-  if (ucp->uc_mcontext.mc_magic == MCF_MAGIC) {
-#if (_MINIX_CHIP == _CHIP_INTEL)
-       /* The caller provides a pointer to a stack that we can use to run our
-          context on. When the context starts, control is given to a wrapped 
-          start routine, which calls a function and cleans up the stack
-          afterwards. The wrapper needs the address of that function on the
-          stack.
-          The stack will be prepared as follows:
-               func()       - start routine
-               arg1         - first argument
-               ...
-               argn         - last argument
-               ucp          - context, esp points here when `func' returns
-          _ctx_start pops the address of `func' from the stack and calls it. 
-          The stack will then be setup with all arguments for `func'. When
-          `func' returns, _ctx_start cleans up the stack such that ucp is at
-          the top of the stack, ready to be used by resumecontext.
-          Resumecontext, in turn, checks whether another context is ready to
-          be executed (i.e., uc_link != NULL) or exit(2)s the process. */
-
-       /* Find the top of the stack from which we grow downwards. */
-       stack_top = (unsigned int *) ((uintptr_t ) ucp->uc_stack.ss_sp +
-                                                  ucp->uc_stack.ss_size);
-
-       /* Align the arguments to 16 bytes (we might lose a few bytes of stack
-          space here).*/
-       stack_top = (unsigned int *) ((uintptr_t) stack_top & ~0xf);
-       
-       /* Make room for 'func', the `func' routine arguments, and ucp. */
-       stack_top -= (1 + argc + 1);
-
-       /* Adjust the machine context to point to the top of this stack and the
-          program counter to the context start wrapper. */
-       ucp->uc_mcontext.mc_p_reg.fp = 0; /* Clear frame pointer */
-       ucp->uc_mcontext.mc_p_reg.sp = (reg_t) stack_top;
-       ucp->uc_mcontext.mc_p_reg.pc = (reg_t) ctx_start;
-
-       *stack_top++ = (uintptr_t) func;
-
-       /* Copy arguments to the stack. */
-       va_start(ap, argc);
-       while (argc-- > 0) {
-               *stack_top++ = va_arg(ap, uintptr_t);
-       }
-       va_end(ap);
-
-       /* Store ucp on the stack */
-       *stack_top = (uintptr_t) ucp;
-
-       /* Set ESI to point to the base of the stack where ucp is stored, so
-          that the wrapper function knows how to clean up the stack after
-          calling `func' (i.e., how to adjust ESP). */
-       ucp->uc_mcontext.mc_p_reg.si = (reg_t) stack_top;
-       
-
-       /* If we ran out of stack space, invalidate stack pointer. Eventually,
-          swapcontext will choke on this and return ENOMEM. */
-       if (stack_top == ucp->uc_stack.ss_sp)
-               ucp->uc_mcontext.mc_p_reg.sp = 0;
-
-#else
-# error "Unsupported platform"
-#endif
-  }    
-}
-
-
-/*===========================================================================*
- *                             swapcontext                                  *
- *===========================================================================*/
-PUBLIC int swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
-{
-  int r;
-
-  if ((oucp == NULL) || (ucp == NULL)) {
-       errno = EFAULT;
-       return(-1);
-  }
-
-  if (ucp->uc_mcontext.mc_p_reg.sp == 0) {
-       /* No stack space. Bail out. */
-       errno = ENOMEM;
-       return(-1);
-  } 
-
-  oucp->uc_flags &= ~UCF_SWAPPED;
-  r = getcontext(oucp);
-  if ((r == 0) && !(oucp->uc_flags & UCF_SWAPPED)) {
-       oucp->uc_flags |= UCF_SWAPPED;
-       r = setcontext(ucp);
-  }
-
-  return(r);
-}
-
-
-/*===========================================================================*
- *                             resumecontext                                *
- *===========================================================================*/
-PUBLIC void resumecontext(ucontext_t *ucp)
-{
-  if (ucp->uc_link == NULL) exit(0);
-
-  /* Error handling? Where should the error go to? */
-  (void) setcontext((const ucontext_t *) ucp->uc_link);
-
-  exit(1); /* Never reached */
-}
-
diff --git a/lib/libc/posix/_umask.c b/lib/libc/posix/_umask.c
deleted file mode 100644 (file)
index fbe56c2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <lib.h>
-#define umask  _umask
-#include <sys/stat.h>
-
-PUBLIC mode_t umask(mode_t complmode)
-{
-  message m;
-
-  m.m1_i1 = complmode;
-  return( (mode_t) _syscall(VFS_PROC_NR, UMASK, &m));
-}
diff --git a/lib/libc/posix/_uname.c b/lib/libc/posix/_uname.c
deleted file mode 100644 (file)
index 5ee45dc..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*     uname(3) - describe the machine.                Author: Kees J. Bot
- *                                                             5 Dec 1992
- */
-
-#define uname _uname
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-
-#define uts_get(field, string) \
-       if (sysuname(_UTS_GET, field, name->string, sizeof(name->string)) < 0) \
-               return -1; \
-       name->string[sizeof(name->string)-1]= 0;
-
-int uname(name)
-struct utsname *name;
-{
-       int hf, n, err;
-       char *nl;
-
-       /* Get each of the strings with a sysuname call.  Null terminate them,
-        * because the buffers in the kernel may grow before this and the
-        * programs are recompiled.
-        */
-       uts_get(_UTS_SYSNAME, sysname);
-       uts_get(_UTS_NODENAME, nodename);
-       uts_get(_UTS_RELEASE, release);
-       uts_get(_UTS_VERSION, version);
-       uts_get(_UTS_MACHINE, machine);
-       uts_get(_UTS_ARCH, arch);
-#if 0
-       uts_get(_UTS_KERNEL, kernel);
-       uts_get(_UTS_HOSTNAME, hostname);
-       uts_get(_UTS_BUS, bus);
-#endif
-
-       /* Try to read the node name from /etc/hostname.file. This information
-        * should be stored in the kernel.
-        */
-       if ((hf = open("/etc/hostname.file", O_RDONLY)) < 0) {
-               if (errno != ENOENT) return(-1);
-       } else {
-               n = read(hf, name->nodename, sizeof(name->nodename) - 1);
-               err = errno;
-               close(hf);
-               errno = err;
-               if (n < 0) return(-1);
-               name->nodename[n] = 0;
-               if ((nl = strchr(name->nodename, '\n')) != NULL) {
-                       memset(nl, 0, (name->nodename +
-                               sizeof(name->nodename)) - nl);
-               }
-       }
-       return 0;
-}
-
-/*
- * $PchId: _uname.c,v 1.4 1995/11/27 20:09:08 philip Exp $
- */
diff --git a/lib/libc/posix/_unlink.c b/lib/libc/posix/_unlink.c
deleted file mode 100644 (file)
index a44b6d7..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <lib.h>
-#define unlink _unlink
-#include <unistd.h>
-
-PUBLIC int unlink(name)
-_CONST char *name;
-{
-  message m;
-
-  _loadname(name, &m);
-  return(_syscall(VFS_PROC_NR, UNLINK, &m));
-}
diff --git a/lib/libc/posix/_utime.c b/lib/libc/posix/_utime.c
deleted file mode 100644 (file)
index c9ad8bf..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* utime(2) for POSIX          Authors: Terrence W. Holm & Edwin L. Froese */
-
-#include <lib.h>
-#define utime  _utime
-#include <string.h>
-#include <utime.h>
-
-PUBLIC int utime(name, timp)
-_CONST char *name;
-_CONST struct utimbuf *timp;
-{
-  message m;
-
-  if (timp == NULL) {
-       m.m2_i1 = 0;            /* name size 0 means NULL `timp' */
-       m.m2_i2 = strlen(name) + 1;     /* actual size here */
-  } else {
-       m.m2_l1 = timp->actime;
-       m.m2_l2 = timp->modtime;
-       m.m2_i1 = strlen(name) + 1;
-  }
-  m.m2_p1 = (char *) name;
-  return(_syscall(VFS_PROC_NR, UTIME, &m));
-}
diff --git a/lib/libc/posix/_wait.c b/lib/libc/posix/_wait.c
deleted file mode 100644 (file)
index 9e5764d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <lib.h>
-#define wait   _wait
-#include <sys/wait.h>
-
-PUBLIC pid_t wait(status)
-int *status;
-{
-  message m;
-
-  if (_syscall(PM_PROC_NR, WAIT, &m) < 0) return(-1);
-  if (status != 0) *status = m.m2_i1;
-  return(m.m_type);
-}
diff --git a/lib/libc/posix/_waitpid.c b/lib/libc/posix/_waitpid.c
deleted file mode 100644 (file)
index 9f2e55b..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <lib.h>
-#define waitpid        _waitpid
-#include <sys/wait.h>
-
-PUBLIC pid_t waitpid(pid, status, options)
-pid_t pid;
-int *status;
-int options;
-{
-  message m;
-
-  m.m1_i1 = pid;
-  m.m1_i2 = options;
-  if (_syscall(PM_PROC_NR, WAITPID, &m) < 0) return(-1);
-  if (status != 0) *status = m.m2_i1;
-  return m.m_type;
-}
diff --git a/lib/libc/posix/_write.c b/lib/libc/posix/_write.c
deleted file mode 100644 (file)
index 0330d7b..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#include <lib.h>
-#define write  _write
-#include <unistd.h>
-
-PUBLIC ssize_t write(fd, buffer, nbytes)
-int fd;
-_CONST void *buffer;
-size_t nbytes;
-{
-  message m;
-
-  m.m1_i1 = fd;
-  m.m1_i2 = nbytes;
-  m.m1_p1 = (char *) buffer;
-  return(_syscall(VFS_PROC_NR, WRITE, &m));
-}
diff --git a/lib/libc/posix/charclass.h b/lib/libc/posix/charclass.h
deleted file mode 100644 (file)
index c780f16..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Public domain, 2008, Todd C. Miller <Todd.Miller@courtesan.com>
- *
- * $OpenBSD: charclass.h,v 1.1 2008/10/01 23:04:13 millert Exp $
- */
-
-/*
- * POSIX character class support for fnmatch() and glob().
- */
-static struct cclass {
-       const char *name;
-       int (*isctype)(int);
-} cclasses[] = {
-       { "alnum",      isalnum },
-       { "alpha",      isalpha },
-#ifndef _MINIX
-       { "blank",      isblank },
-#endif
-       { "cntrl",      iscntrl },
-       { "digit",      isdigit },
-       { "graph",      isgraph },
-       { "lower",      islower },
-       { "print",      isprint },
-       { "punct",      ispunct },
-       { "space",      isspace },
-       { "upper",      isupper },
-       { "xdigit",     isxdigit },
-       { NULL,         NULL }
-};
-
-#define NCCLASSES      (sizeof(cclasses) / sizeof(cclasses[0]) - 1)
diff --git a/lib/libc/posix/fnmatch.c b/lib/libc/posix/fnmatch.c
deleted file mode 100644 (file)
index 2388f82..0000000
+++ /dev/null
@@ -1,251 +0,0 @@
-/*     $OpenBSD: fnmatch.c,v 1.14 2008/10/01 23:04:13 millert Exp $    */
-
-/*
- * Copyright (c) 1989, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * 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. 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.
- */
-
-/*
- * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
- * Compares a filename or pathname to a pattern.
- */
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-#include <fnmatch.h>
-
-#include "charclass.h"
-
-#define        EOS     '\0'
-
-#define        RANGE_MATCH     1
-#define        RANGE_NOMATCH   0
-#define        RANGE_ERROR     (-1)
-
-static int rangematch(const char *, char, int, char **);
-static int classmatch(const char *, char, int, const char **);
-
-int
-fnmatch(const char *pattern, const char *string, int flags)
-{
-       const char *stringstart;
-       char *newp;
-       char c, test;
-
-       for (stringstart = string;;)
-               switch (c = *pattern++) {
-               case EOS:
-                       if ((flags & FNM_LEADING_DIR) && *string == '/')
-                               return (0);
-                       return (*string == EOS ? 0 : FNM_NOMATCH);
-               case '?':
-                       if (*string == EOS)
-                               return (FNM_NOMATCH);
-                       if (*string == '/' && (flags & FNM_PATHNAME))
-                               return (FNM_NOMATCH);
-                       if (*string == '.' && (flags & FNM_PERIOD) &&
-                           (string == stringstart ||
-                           ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
-                               return (FNM_NOMATCH);
-                       ++string;
-                       break;
-               case '*':
-                       c = *pattern;
-                       /* Collapse multiple stars. */
-                       while (c == '*')
-                               c = *++pattern;
-
-                       if (*string == '.' && (flags & FNM_PERIOD) &&
-                           (string == stringstart ||
-                           ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
-                               return (FNM_NOMATCH);
-
-                       /* Optimize for pattern with * at end or before /. */
-                       if (c == EOS) {
-                               if (flags & FNM_PATHNAME)
-                                       return ((flags & FNM_LEADING_DIR) ||
-                                           strchr(string, '/') == NULL ?
-                                           0 : FNM_NOMATCH);
-                               else
-                                       return (0);
-                       } else if (c == '/' && (flags & FNM_PATHNAME)) {
-                               if ((string = strchr(string, '/')) == NULL)
-                                       return (FNM_NOMATCH);
-                               break;
-                       }
-
-                       /* General case, use recursion. */
-                       while ((test = *string) != EOS) {
-                               if (!fnmatch(pattern, string, flags & ~FNM_PERIOD))
-                                       return (0);
-                               if (test == '/' && (flags & FNM_PATHNAME))
-                                       break;
-                               ++string;
-                       }
-                       return (FNM_NOMATCH);
-               case '[':
-                       if (*string == EOS)
-                               return (FNM_NOMATCH);
-                       if (*string == '/' && (flags & FNM_PATHNAME))
-                               return (FNM_NOMATCH);
-                       if (*string == '.' && (flags & FNM_PERIOD) &&
-                           (string == stringstart ||
-                           ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
-                               return (FNM_NOMATCH);
-
-                       switch (rangematch(pattern, *string, flags, &newp)) {
-                       case RANGE_ERROR:
-                               /* not a good range, treat as normal text */
-                               goto normal;
-                       case RANGE_MATCH:
-                               pattern = newp;
-                               break;
-                       case RANGE_NOMATCH:
-                               return (FNM_NOMATCH);
-                       }
-                       ++string;
-                       break;
-               case '\\':
-                       if (!(flags & FNM_NOESCAPE)) {
-                               if ((c = *pattern++) == EOS) {
-                                       c = '\\';
-                                       --pattern;
-                               }
-                       }
-                       /* FALLTHROUGH */
-               default:
-               normal:
-                       if (c != *string && !((flags & FNM_CASEFOLD) &&
-                                (tolower((unsigned char)c) ==
-                                tolower((unsigned char)*string))))
-                               return (FNM_NOMATCH);
-                       ++string;
-                       break;
-               }
-       /* NOTREACHED */
-}
-
-static int
-rangematch(const char *pattern, char test, int flags, char **newp)
-{
-       int negate, ok, rv;
-       char c, c2;
-
-       /*
-        * A bracket expression starting with an unquoted circumflex
-        * character produces unspecified results (IEEE 1003.2-1992,
-        * 3.13.2).  This implementation treats it like '!', for
-        * consistency with the regular expression syntax.
-        * J.T. Conklin (conklin@ngai.kaleida.com)
-        */
-       if ((negate = (*pattern == '!' || *pattern == '^')))
-               ++pattern;
-
-       if (flags & FNM_CASEFOLD)
-               test = (char)tolower((unsigned char)test);
-
-       /*
-        * A right bracket shall lose its special meaning and represent
-        * itself in a bracket expression if it occurs first in the list.
-        * -- POSIX.2 2.8.3.2
-        */
-       ok = 0;
-       c = *pattern++;
-       do {
-               if (c == '[' && *pattern == ':') {
-                       do {
-                               rv = classmatch(pattern + 1, test,
-                                   (flags & FNM_CASEFOLD), &pattern);
-                               if (rv == RANGE_MATCH)
-                                       ok = 1;
-                               c = *pattern++;
-                       } while (rv != RANGE_ERROR && c == '[' && *pattern == ':');
-                       if (c == ']')
-                               break;
-               }
-               if (c == '\\' && !(flags & FNM_NOESCAPE))
-                       c = *pattern++;
-               if (c == EOS)
-                       return (RANGE_ERROR);
-               if (c == '/' && (flags & FNM_PATHNAME))
-                       return (RANGE_NOMATCH);
-               if ((flags & FNM_CASEFOLD))
-                       c = (char)tolower((unsigned char)c);
-               if (*pattern == '-'
-                   && (c2 = *(pattern+1)) != EOS && c2 != ']') {
-                       pattern += 2;
-                       if (c2 == '\\' && !(flags & FNM_NOESCAPE))
-                               c2 = *pattern++;
-                       if (c2 == EOS)
-                               return (RANGE_ERROR);
-                       if (flags & FNM_CASEFOLD)
-                               c2 = (char)tolower((unsigned char)c2);
-                       if (c <= test && test <= c2)
-                               ok = 1;
-               } else if (c == test)
-                       ok = 1;
-       } while ((c = *pattern++) != ']');
-
-       *newp = (char *)pattern;
-       return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH);
-}
-
-static int
-classmatch(const char *pattern, char test, int foldcase, const char **ep)
-{
-       struct cclass *cc;
-       const char *colon;
-       size_t len;
-       int rval = RANGE_NOMATCH;
-
-       if ((colon = strchr(pattern, ':')) == NULL || colon[1] != ']') {
-               *ep = pattern - 2;
-               return(RANGE_ERROR);
-       }
-       *ep = colon + 2;
-       len = (size_t)(colon - pattern);
-
-       if (foldcase && strncmp(pattern, "upper:]", 7) == 0)
-               pattern = "lower:]";
-       for (cc = cclasses; cc->name != NULL; cc++) {
-               if (!strncmp(pattern, cc->name, len) && cc->name[len] == '\0') {
-                       if (cc->isctype((unsigned char)test))
-                               rval = RANGE_MATCH;
-                       break;
-               }
-       }
-       if (cc->name == NULL) {
-               /* invalid character class, return EOS */
-               *ep = colon + strlen(colon);
-               rval = RANGE_ERROR;
-       }
-       return(rval);
-}
diff --git a/lib/libc/posix/getloadavg.c b/lib/libc/posix/getloadavg.c
deleted file mode 100644 (file)
index 7debfca..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-
-#include <sys/types.h>
-#include <paths.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <lib.h>
-
-/* Retrieve system load average information. */
-int getloadavg(double *loadavg, int nelem)
-{
-  FILE *fp;
-  int i;
-
-  if(nelem < 1) {
-       errno = ENOSPC;
-       return -1;
-  }
-
-  if((fp = fopen(_PATH_PROC "loadavg", "r")) == NULL)
-       return -1;
-
-  for(i = 0; i < nelem; i++)
-       if(fscanf(fp, "%lf", &loadavg[i]) != 1)
-               break;
-
-  fclose(fp);
-
-  if (i == 0) {
-       errno = ENOENT;
-       return -1;
-  }
-
-  return i;
-}
diff --git a/lib/libc/posix/getopt.c b/lib/libc/posix/getopt.c
deleted file mode 100644 (file)
index 11b661a..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 1987, 1993, 1994
- *     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 <string.h>
-#include <stdio.h>
-
-int    opterr = 1,             /* if error message should be printed */
-       optind = 1,             /* index into parent argv vector */
-       optopt,                 /* character checked for validity */
-       optreset;               /* reset getopt */
-char   *optarg;                /* argument associated with option */
-
-#define        BADCH   (int)'?'
-#define        BADARG  (int)':'
-#define        EMSG    ""
-
-/*
- * getopt --
- *     Parse argc/argv argument vector.
- */
-int
-getopt(int nargc, char * const nargv[], const char *ostr)
-{
-       static char *place = EMSG;              /* option letter processing */
-       char *oli;                              /* option letter list index */
-
-       if (optreset || !*place) {              /* update scanning pointer */
-               optreset = 0;
-               if (optind >= nargc || *(place = nargv[optind]) != '-') {
-                       place = EMSG;
-                       return (-1);
-               }
-               if (place[1] && *++place == '-') {      /* found "--" */
-                       ++optind;
-                       place = EMSG;
-                       return (-1);
-               }
-       }                                       /* option letter okay? */
-       if ((optopt = (int)*place++) == (int)':' ||
-           !(oli = strchr(ostr, optopt))) {
-               /*
-                * if the user didn't specify '-' as an option,
-                * assume it means -1.
-                */
-               if (optopt == (int)'-')
-                       return (-1);
-               if (!*place)
-                       ++optind;
-               if (opterr && *ostr != ':')
-                       (void)printf("illegal option -- %c\n", optopt);
-               return (BADCH);
-       }
-       if (*++oli != ':') {                    /* don't need argument */
-               optarg = NULL;
-               if (!*place)
-                       ++optind;
-       }
-       else {                                  /* need an argument */
-               if (*place)                     /* no white space */
-                       optarg = place;
-               else if (nargc <= ++optind) {   /* no arg */
-                       place = EMSG;
-                       if (*ostr == ':')
-                               return (BADARG);
-                       if (opterr)
-                               (void)printf("option requires an argument -- %c\n", optopt);
-                       return (BADCH);
-               }
-               else                            /* white space */
-                       optarg = nargv[optind];
-               place = EMSG;
-               ++optind;
-       }
-       return (optopt);                        /* dump back option letter */
-}
diff --git a/lib/libc/posix/gettimeofday.c b/lib/libc/posix/gettimeofday.c
deleted file mode 100644 (file)
index 35a7943..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-gettimeofday.c
-*/
-
-#include <sys/time.h>
-#include <lib.h>
-
-int gettimeofday(struct timeval *_RESTRICT tp, void *_RESTRICT tzp)
-{
-  message m;
-
-  if (_syscall(PM_PROC_NR, GETTIMEOFDAY, &m) < 0)
-       return -1;
-
-  tp->tv_sec = m.m2_l1;
-  tp->tv_usec = m.m2_l2;
-
-  return 0;
-}
-
diff --git a/lib/libc/posix/glob.c b/lib/libc/posix/glob.c
deleted file mode 100644 (file)
index 5cb0b1a..0000000
+++ /dev/null
@@ -1,843 +0,0 @@
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * 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. 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.
- */
-
-/*
- * glob(3) -- a superset of the one defined in POSIX 1003.2.
- *
- * The [!...] convention to negate a range is supported (SysV, Posix, ksh).
- *
- * Optional extra services, controlled by flags not defined by POSIX:
- *
- * GLOB_QUOTE:
- *     Escaping convention: \ inhibits any special meaning the following
- *     character might have (except \ at end of string is retained).
- * GLOB_MAGCHAR:
- *     Set in gl_flags if pattern contained a globbing character.
- * GLOB_NOMAGIC:
- *     Same as GLOB_NOCHECK, but it will only append pattern if it did
- *     not contain any magic characters.  [Used in csh style globbing]
- * GLOB_ALTDIRFUNC:
- *     Use alternately specified directory access functions.
- * GLOB_TILDE:
- *     expand ~user/foo to the /home/dir/of/user/foo
- * GLOB_BRACE:
- *     expand {1,2}{a,b} to 1a 1b 2a 2b
- * gl_matchc:
- *     Number of matches in the current invocation of glob.
- */
-
-#include <sys/stat.h>
-
-#include <dirent.h>
-#include <errno.h>
-#include <glob.h>
-#include <limits.h>
-#include <pwd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#define        DOLLAR          '$'
-#define        DOT             '.'
-#define        EOS             '\0'
-#define        LBRACKET        '['
-#define        NOT             '!'
-#define        QUESTION        '?'
-#define        QUOTE           '\\'
-#define        RANGE           '-'
-#define        RBRACKET        ']'
-#define        SEP             '/'
-#define        STAR            '*'
-#define        TILDE           '~'
-#define        UNDERSCORE      '_'
-#define        LBRACE          '{'
-#define        RBRACE          '}'
-#define        SLASH           '/'
-#define        COMMA           ','
-
-#ifndef DEBUG
-
-#define        M_QUOTE         0x8000
-#define        M_PROTECT       0x4000
-#define        M_MASK          0xffff
-#define        M_ASCII         0x00ff
-
-typedef u_short Char;
-
-#else
-
-#define        M_QUOTE         0x80
-#define        M_PROTECT       0x40
-#define        M_MASK          0xff
-#define        M_ASCII         0x7f
-
-typedef char Char;
-
-#endif
-
-
-#define        CHAR(c)         ((Char)((c)&M_ASCII))
-#define        META(c)         ((Char)((c)|M_QUOTE))
-#define        M_ALL           META('*')
-#define        M_END           META(']')
-#define        M_NOT           META('!')
-#define        M_ONE           META('?')
-#define        M_RNG           META('-')
-#define        M_SET           META('[')
-#define        ismeta(c)       (((c)&M_QUOTE) != 0)
-
-static int      compare(const void *, const void *);
-static int      g_Ctoc(const Char *, char *, u_int);
-static int      g_lstat(Char *, struct stat *, glob_t *);
-static DIR     *g_opendir(Char *, glob_t *);
-static Char    *g_strchr(Char *, int);
-static int      g_stat(Char *, struct stat *, glob_t *);
-static int      glob0(const Char *, glob_t *);
-static int      glob1(Char *, Char *, glob_t *, size_t *);
-static int      glob2(Char *, Char *, Char *, Char *, Char *, Char *,
-                   glob_t *, size_t *);
-static int      glob3(Char *, Char *, Char *, Char *, Char *,
-                   Char *, Char *, glob_t *, size_t *);
-static int      globextend(const Char *, glob_t *, size_t *);
-static const Char *
-                globtilde(const Char *, Char *, size_t, glob_t *);
-static int      globexp1(const Char *, glob_t *);
-static int      globexp2(const Char *, const Char *, glob_t *, int *);
-static int      match(Char *, Char *, Char *);
-#ifdef DEBUG
-static void     qprintf(const char *, Char *);
-#endif
-
-int
-glob(const char *pattern, int flags, int (*errfunc)(const char *, int),
-    glob_t *pglob)
-{
-       const u_char *patnext;
-       int c;
-       Char *bufnext, *bufend, patbuf[PATH_MAX];
-
-       patnext = (u_char *) pattern;
-       if (!(flags & GLOB_APPEND)) {
-               pglob->gl_pathc = 0;
-               pglob->gl_pathv = NULL;
-               if (!(flags & GLOB_DOOFFS))
-                       pglob->gl_offs = 0;
-       }
-       pglob->gl_flags = flags & ~GLOB_MAGCHAR;
-       pglob->gl_errfunc = errfunc;
-       pglob->gl_matchc = 0;
-
-       bufnext = patbuf;
-       bufend = bufnext + PATH_MAX - 1;
-       if (flags & GLOB_NOESCAPE)
-               while (bufnext < bufend && (c = *patnext++) != EOS)
-                       *bufnext++ = c;
-       else {
-               /* Protect the quoted characters. */
-               while (bufnext < bufend && (c = *patnext++) != EOS)
-                       if (c == QUOTE) {
-                               if ((c = *patnext++) == EOS) {
-                                       c = QUOTE;
-                                       --patnext;
-                               }
-                               *bufnext++ = c | M_PROTECT;
-                       } else
-                               *bufnext++ = c;
-       }
-       *bufnext = EOS;
-
-       if (flags & GLOB_BRACE)
-               return globexp1(patbuf, pglob);
-       else
-               return glob0(patbuf, pglob);
-}
-
-/*
- * Expand recursively a glob {} pattern. When there is no more expansion
- * invoke the standard globbing routine to glob the rest of the magic
- * characters
- */
-static int
-globexp1(const Char *pattern, glob_t *pglob)
-{
-       const Char* ptr = pattern;
-       int rv;
-
-       /* Protect a single {}, for find(1), like csh */
-       if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
-               return glob0(pattern, pglob);
-
-       while ((ptr = (const Char *) g_strchr((Char *) ptr, LBRACE)) != NULL)
-               if (!globexp2(ptr, pattern, pglob, &rv))
-                       return rv;
-
-       return glob0(pattern, pglob);
-}
-
-
-/*
- * Recursive brace globbing helper. Tries to expand a single brace.
- * If it succeeds then it invokes globexp1 with the new pattern.
- * If it fails then it tries to glob the rest of the pattern and returns.
- */
-static int
-globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv)
-{
-       int     i;
-       Char   *lm, *ls;
-       const Char *pe, *pm, *pl;
-       Char    patbuf[PATH_MAX];
-
-       /* copy part up to the brace */
-       for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
-               ;
-       *lm = EOS;
-       ls = lm;
-
-       /* Find the balanced brace */
-       for (i = 0, pe = ++ptr; *pe; pe++)
-               if (*pe == LBRACKET) {
-                       /* Ignore everything between [] */
-                       for (pm = pe++; *pe != RBRACKET && *pe != EOS; pe++)
-                               ;
-                       if (*pe == EOS) {
-                               /*
-                                * We could not find a matching RBRACKET.
-                                * Ignore and just look for RBRACE
-                                */
-                               pe = pm;
-                       }
-               } else if (*pe == LBRACE)
-                       i++;
-               else if (*pe == RBRACE) {
-                       if (i == 0)
-                               break;
-                       i--;
-               }
-
-       /* Non matching braces; just glob the pattern */
-       if (i != 0 || *pe == EOS) {
-               *rv = glob0(patbuf, pglob);
-               return 0;
-       }
-
-       for (i = 0, pl = pm = ptr; pm <= pe; pm++) {
-               switch (*pm) {
-               case LBRACKET:
-                       /* Ignore everything between [] */
-                       for (pl = pm++; *pm != RBRACKET && *pm != EOS; pm++)
-                               ;
-                       if (*pm == EOS) {
-                               /*
-                                * We could not find a matching RBRACKET.
-                                * Ignore and just look for RBRACE
-                                */
-                               pm = pl;
-                       }
-                       break;
-
-               case LBRACE:
-                       i++;
-                       break;
-
-               case RBRACE:
-                       if (i) {
-                               i--;
-                               break;
-                       }
-                       /* FALLTHROUGH */
-               case COMMA:
-                       if (i && *pm == COMMA)
-                               break;
-                       else {
-                               /* Append the current string */
-                               for (lm = ls; (pl < pm); *lm++ = *pl++)
-                                       ;
-
-                               /*
-                                * Append the rest of the pattern after the
-                                * closing brace
-                                */
-                               for (pl = pe + 1; (*lm++ = *pl++) != EOS; )
-                                       ;
-
-                               /* Expand the current pattern */
-#ifdef DEBUG
-                               qprintf("globexp2:", patbuf);
-#endif
-                               *rv = globexp1(patbuf, pglob);
-
-                               /* move after the comma, to the next string */
-                               pl = pm + 1;
-                       }
-                       break;
-
-               default:
-                       break;
-               }
-       }
-       *rv = 0;
-       return 0;
-}
-
-
-
-/*
- * expand tilde from the passwd file.
- */
-static const Char *
-globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
-{
-       struct passwd *pwd;
-       char *h;
-       const Char *p;
-       Char *b, *eb;
-
-       if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE))
-               return pattern;
-
-       /* Copy up to the end of the string or / */
-       eb = &patbuf[patbuf_len - 1];
-       for (p = pattern + 1, h = (char *) patbuf;
-           h < (char *)eb && *p && *p != SLASH; *h++ = *p++)
-               ;
-
-       *h = EOS;
-
-#if 0
-       if (h == (char *)eb)
-               return what;
-#endif
-
-       if (((char *) patbuf)[0] == EOS) {
-               /*
-                * handle a plain ~ or ~/ by expanding $HOME
-                * first and then trying the password file
-                */
-               if ((h = getenv("HOME")) == NULL) {
-                       if ((pwd = getpwuid(getuid())) == NULL)
-                               return pattern;
-                       else
-                               h = pwd->pw_dir;
-               }
-       } else {
-               /*
-                * Expand a ~user
-                */
-               if ((pwd = getpwnam((char*) patbuf)) == NULL)
-                       return pattern;
-               else
-                       h = pwd->pw_dir;
-       }
-
-       /* Copy the home directory */
-       for (b = patbuf; b < eb && *h; *b++ = *h++)
-               ;
-
-       /* Append the rest of the pattern */
-       while (b < eb && (*b++ = *p++) != EOS)
-               ;
-       *b = EOS;
-
-       return patbuf;
-}
-
-
-/*
- * The main glob() routine: compiles the pattern (optionally processing
- * quotes), calls glob1() to do the real pattern matching, and finally
- * sorts the list (unless unsorted operation is requested).  Returns 0
- * if things went well, nonzero if errors occurred.  It is not an error
- * to find no matches.
- */
-static int
-glob0(const Char *pattern, glob_t *pglob)
-{
-       const Char *qpatnext;
-       int c, err, oldpathc;
-       Char *bufnext, patbuf[PATH_MAX];
-       size_t limit = 0;
-
-       qpatnext = globtilde(pattern, patbuf, PATH_MAX, pglob);
-       oldpathc = pglob->gl_pathc;
-       bufnext = patbuf;
-
-       /* We don't need to check for buffer overflow any more. */
-       while ((c = *qpatnext++) != EOS) {
-               switch (c) {
-               case LBRACKET:
-                       c = *qpatnext;
-                       if (c == NOT)
-                               ++qpatnext;
-                       if (*qpatnext == EOS ||
-                           g_strchr((Char *) qpatnext+1, RBRACKET) == NULL) {
-                               *bufnext++ = LBRACKET;
-                               if (c == NOT)
-                                       --qpatnext;
-                               break;
-                       }
-                       *bufnext++ = M_SET;
-                       if (c == NOT)
-                               *bufnext++ = M_NOT;
-                       c = *qpatnext++;
-                       do {
-                               *bufnext++ = CHAR(c);
-                               if (*qpatnext == RANGE &&
-                                   (c = qpatnext[1]) != RBRACKET) {
-                                       *bufnext++ = M_RNG;
-                                       *bufnext++ = CHAR(c);
-                                       qpatnext += 2;
-                               }
-                       } while ((c = *qpatnext++) != RBRACKET);
-                       pglob->gl_flags |= GLOB_MAGCHAR;
-                       *bufnext++ = M_END;
-                       break;
-               case QUESTION:
-                       pglob->gl_flags |= GLOB_MAGCHAR;
-                       *bufnext++ = M_ONE;
-                       break;
-               case STAR:
-                       pglob->gl_flags |= GLOB_MAGCHAR;
-                       /* collapse adjacent stars to one,
-                        * to avoid exponential behavior
-                        */
-                       if (bufnext == patbuf || bufnext[-1] != M_ALL)
-                               *bufnext++ = M_ALL;
-                       break;
-               default:
-                       *bufnext++ = CHAR(c);
-                       break;
-               }
-       }
-       *bufnext = EOS;
-#ifdef DEBUG
-       qprintf("glob0:", patbuf);
-#endif
-
-       if ((err = glob1(patbuf, patbuf+PATH_MAX-1, pglob, &limit)) != 0)
-               return(err);
-
-       /*
-        * If there was no match we are going to append the pattern
-        * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
-        * and the pattern did not contain any magic characters
-        * GLOB_NOMAGIC is there just for compatibility with csh.
-        */
-       if (pglob->gl_pathc == oldpathc) {
-               if ((pglob->gl_flags & GLOB_NOCHECK) ||
-                   ((pglob->gl_flags & GLOB_NOMAGIC) &&
-                   !(pglob->gl_flags & GLOB_MAGCHAR)))
-                       return(globextend(pattern, pglob, &limit));
-               else
-                       return(GLOB_NOMATCH);
-       }
-       if (!(pglob->gl_flags & GLOB_NOSORT))
-               qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
-                   pglob->gl_pathc - oldpathc, sizeof(char *), compare);
-       return(0);
-}
-
-static int
-compare(const void *p, const void *q)
-{
-       return(strcmp(*(char **)p, *(char **)q));
-}
-
-static int
-glob1(Char *pattern, Char *pattern_last, glob_t *pglob, size_t *limitp)
-{
-       Char pathbuf[PATH_MAX];
-
-       /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
-       if (*pattern == EOS)
-               return(0);
-       return(glob2(pathbuf, pathbuf+PATH_MAX-1,
-           pathbuf, pathbuf+PATH_MAX-1,
-           pattern, pattern_last, pglob, limitp));
-}
-
-/*
- * The functions glob2 and glob3 are mutually recursive; there is one level
- * of recursion for each segment in the pattern that contains one or more
- * meta characters.
- */
-static int
-glob2(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
-    Char *pattern, Char *pattern_last, glob_t *pglob, size_t *limitp)
-{
-       struct stat sb;
-       Char *p, *q;
-       int anymeta;
-
-       /*
-        * Loop over pattern segments until end of pattern or until
-        * segment with meta character found.
-        */
-       for (anymeta = 0;;) {
-               if (*pattern == EOS) {          /* End of pattern? */
-                       *pathend = EOS;
-                       if (g_lstat(pathbuf, &sb, pglob))
-                               return(0);
-
-                       if (((pglob->gl_flags & GLOB_MARK) &&
-                           pathend[-1] != SEP) && (S_ISDIR(sb.st_mode) ||
-                           (S_ISLNK(sb.st_mode) &&
-                           (g_stat(pathbuf, &sb, pglob) == 0) &&
-                           S_ISDIR(sb.st_mode)))) {
-                               if (pathend+1 > pathend_last)
-                                       return (1);
-                               *pathend++ = SEP;
-                               *pathend = EOS;
-                       }
-                       ++pglob->gl_matchc;
-                       return(globextend(pathbuf, pglob, limitp));
-               }
-
-               /* Find end of next segment, copy tentatively to pathend. */
-               q = pathend;
-               p = pattern;
-               while (*p != EOS && *p != SEP) {
-                       if (ismeta(*p))
-                               anymeta = 1;
-                       if (q+1 > pathend_last)
-                               return (1);
-                       *q++ = *p++;
-               }
-
-               if (!anymeta) {         /* No expansion, do next segment. */
-                       pathend = q;
-                       pattern = p;
-                       while (*pattern == SEP) {
-                               if (pathend+1 > pathend_last)
-                                       return (1);
-                               *pathend++ = *pattern++;
-                       }
-               } else
-                       /* Need expansion, recurse. */
-                       return(glob3(pathbuf, pathbuf_last, pathend,
-                           pathend_last, pattern, p, pattern_last,
-                           pglob, limitp));
-       }
-       /* NOTREACHED */
-}
-
-static int
-glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
-    Char *pattern, Char *restpattern, Char *restpattern_last, glob_t *pglob,
-    size_t *limitp)
-{
-       struct dirent *dp;
-       DIR *dirp;
-       int err;
-       char buf[PATH_MAX];
-
-       /*
-        * The readdirfunc declaration can't be prototyped, because it is
-        * assigned, below, to two functions which are prototyped in glob.h
-        * and dirent.h as taking pointers to differently typed opaque
-        * structures.
-        */
-       struct dirent *(*readdirfunc)(void *);
-
-       if (pathend > pathend_last)
-               return (1);
-       *pathend = EOS;
-       errno = 0;
-
-       if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
-               /* TODO: don't call for ENOENT or ENOTDIR? */
-               if (pglob->gl_errfunc) {
-                       if (g_Ctoc(pathbuf, buf, sizeof(buf)))
-                               return(GLOB_ABORTED);
-                       if (pglob->gl_errfunc(buf, errno) ||
-                           pglob->gl_flags & GLOB_ERR)
-                               return(GLOB_ABORTED);
-               }
-               return(0);
-       }
-
-       err = 0;
-
-       /* Search directory for matching names. */
-       if (pglob->gl_flags & GLOB_ALTDIRFUNC)
-               readdirfunc = pglob->gl_readdir;
-       else
-               readdirfunc = (struct dirent *(*)(void *))readdir;
-       while ((dp = (*readdirfunc)(dirp))) {
-               u_char *sc;
-               Char *dc;
-
-               /* Initial DOT must be matched literally. */
-               if (dp->d_name[0] == DOT && *pattern != DOT)
-                       continue;
-               dc = pathend;
-               sc = (u_char *) dp->d_name;
-               while (dc < pathend_last && (*dc++ = *sc++) != EOS)
-                       ;
-               if (dc >= pathend_last) {
-                       *dc = EOS;
-                       err = 1;
-                       break;
-               }
-
-               if (!match(pathend, pattern, restpattern)) {
-                       *pathend = EOS;
-                       continue;
-               }
-               err = glob2(pathbuf, pathbuf_last, --dc, pathend_last,
-                   restpattern, restpattern_last, pglob, limitp);
-               if (err)
-                       break;
-       }
-
-       if (pglob->gl_flags & GLOB_ALTDIRFUNC)
-               (*pglob->gl_closedir)(dirp);
-       else
-               closedir(dirp);
-       return(err);
-}
-
-
-/*
- * Extend the gl_pathv member of a glob_t structure to accommodate a new item,
- * add the new item, and update gl_pathc.
- *
- * This assumes the BSD realloc, which only copies the block when its size
- * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
- * behavior.
- *
- * Return 0 if new item added, error code if memory couldn't be allocated.
- *
- * Invariant of the glob_t structure:
- *     Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
- *     gl_pathv points to (gl_offs + gl_pathc + 1) items.
- */
-static int
-globextend(const Char *path, glob_t *pglob, size_t *limitp)
-{
-       char **pathv;
-       int i;
-       u_int newsize, len;
-       char *copy;
-       const Char *p;
-
-       newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
-       pathv = pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) :
-           malloc(newsize);
-       if (pathv == NULL) {
-               if (pglob->gl_pathv) {
-                       free(pglob->gl_pathv);
-                       pglob->gl_pathv = NULL;
-               }
-               return(GLOB_NOSPACE);
-       }
-
-       if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
-               /* first time around -- clear initial gl_offs items */
-               pathv += pglob->gl_offs;
-               for (i = pglob->gl_offs; --i >= 0; )
-                       *--pathv = NULL;
-       }
-       pglob->gl_pathv = pathv;
-
-       for (p = path; *p++;)
-               ;
-       len = (size_t)(p - path);
-       *limitp += len;
-       if ((copy = malloc(len)) != NULL) {
-               if (g_Ctoc(path, copy, len)) {
-                       free(copy);
-                       return(GLOB_NOSPACE);
-               }
-               pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
-       }
-       pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
-
-       if ((pglob->gl_flags & GLOB_LIMIT) &&
-           newsize + *limitp >= ARG_MAX) {
-               errno = 0;
-               return(GLOB_NOSPACE);
-       }
-
-       return(copy == NULL ? GLOB_NOSPACE : 0);
-}
-
-
-/*
- * pattern matching function for filenames.  Each occurrence of the *
- * pattern causes a recursion level.
- */
-static int
-match(Char *name, Char *pat, Char *patend)
-{
-       int ok, negate_range;
-       Char c, k;
-
-       while (pat < patend) {
-               c = *pat++;
-               switch (c & M_MASK) {
-               case M_ALL:
-                       if (pat == patend)
-                               return(1);
-                       do {
-                           if (match(name, pat, patend))
-                                   return(1);
-                       } while (*name++ != EOS);
-                       return(0);
-               case M_ONE:
-                       if (*name++ == EOS)
-                               return(0);
-                       break;
-               case M_SET:
-                       ok = 0;
-                       if ((k = *name++) == EOS)
-                               return(0);
-                       if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
-                               ++pat;
-                       while (((c = *pat++) & M_MASK) != M_END)
-                               if ((*pat & M_MASK) == M_RNG) {
-                                       if (c <= k && k <= pat[1])
-                                               ok = 1;
-                                       pat += 2;
-                               } else if (c == k)
-                                       ok = 1;
-                       if (ok == negate_range)
-                               return(0);
-                       break;
-               default:
-                       if (*name++ != c)
-                               return(0);
-                       break;
-               }
-       }
-       return(*name == EOS);
-}
-
-/* Free allocated data belonging to a glob_t structure. */
-void
-globfree(glob_t *pglob)
-{
-       int i;
-       char **pp;
-
-       if (pglob->gl_pathv != NULL) {
-               pp = pglob->gl_pathv + pglob->gl_offs;
-               for (i = pglob->gl_pathc; i--; ++pp)
-                       if (*pp)
-                               free(*pp);
-               free(pglob->gl_pathv);
-               pglob->gl_pathv = NULL;
-       }
-}
-
-static DIR *
-g_opendir(Char *str, glob_t *pglob)
-{
-       char buf[PATH_MAX];
-
-       if (!*str)
-               strlcpy(buf, ".", sizeof buf);
-       else {
-               if (g_Ctoc(str, buf, sizeof(buf)))
-                       return(NULL);
-       }
-
-       if (pglob->gl_flags & GLOB_ALTDIRFUNC)
-               return((*pglob->gl_opendir)(buf));
-
-       return(opendir(buf));
-}
-
-static int
-g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
-{
-       char buf[PATH_MAX];
-
-       if (g_Ctoc(fn, buf, sizeof(buf)))
-               return(-1);
-       if (pglob->gl_flags & GLOB_ALTDIRFUNC)
-               return((*pglob->gl_lstat)(buf, sb));
-       return(lstat(buf, sb));
-}
-
-static int
-g_stat(Char *fn, struct stat *sb, glob_t *pglob)
-{
-       char buf[PATH_MAX];
-
-       if (g_Ctoc(fn, buf, sizeof(buf)))
-               return(-1);
-       if (pglob->gl_flags & GLOB_ALTDIRFUNC)
-               return((*pglob->gl_stat)(buf, sb));
-       return(stat(buf, sb));
-}
-
-static Char *
-g_strchr(Char *str, int ch)
-{
-       do {
-               if (*str == ch)
-                       return (str);
-       } while (*str++);
-       return (NULL);
-}
-
-static int
-g_Ctoc(const Char *str, char *buf, u_int len)
-{
-
-       while (len--) {
-               if ((*buf++ = *str++) == EOS)
-                       return (0);
-       }
-       return (1);
-}
-
-#ifdef DEBUG
-static void
-qprintf(const char *str, Char *s)
-{
-       Char *p;
-
-       (void)printf("%s:\n", str);
-       for (p = s; *p; p++)
-               (void)printf("%c", CHAR(*p));
-       (void)printf("\n");
-       for (p = s; *p; p++)
-               (void)printf("%c", *p & M_PROTECT ? '"' : ' ');
-       (void)printf("\n");
-       for (p = s; *p; p++)
-               (void)printf("%c", ismeta(*p) ? '_' : ' ');
-       (void)printf("\n");
-}
-#endif
diff --git a/lib/libc/posix/nice.c b/lib/libc/posix/nice.c
deleted file mode 100644 (file)
index 4f750f9..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
-nice.c
-*/
-
-#include <errno.h>
-#include <unistd.h>
-#include <sys/resource.h>
-
-int nice(incr)
-int incr;
-{
-       int r;
-
-       errno= 0;
-       r= getpriority(PRIO_PROCESS, 0);
-       if (r == -1 && errno != 0)
-               return r;
-       return setpriority(PRIO_PROCESS, 0, r+incr);
-}
diff --git a/lib/libc/posix/poll.c b/lib/libc/posix/poll.c
deleted file mode 100644 (file)
index bd99b95..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*     $NetBSD: poll.c,v 1.3 2008/04/29 05:46:08 martin Exp $  */
-
-/*-
- * Copyright (c) 2003 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles Blundell.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <sys/poll.h>
-#include <errno.h>
-
-int
-poll(struct pollfd *p, nfds_t nfds, int timout)
-{
-       fd_set read, write, except;
-       struct timeval tv;
-       nfds_t i;
-       int highfd, rval;
-
-       /*
-        * select cannot tell us much wrt POLL*BAND, POLLPRI, POLLHUP or
-        * POLLNVAL.
-        */
-       FD_ZERO(&read);
-       FD_ZERO(&write);
-       FD_ZERO(&except);
-
-       highfd = -1;
-       for (i = 0; i < nfds; i++) {
-               if (p[i].fd < 0)
-                       continue;
-               if (p[i].fd >= FD_SETSIZE) {
-                       errno = EINVAL;
-                       return -1;
-               }
-               if (p[i].fd > highfd)
-                       highfd = p[i].fd;
-
-               if (p[i].events & (POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI))
-                       FD_SET(p[i].fd, &read);
-               if (p[i].events & (POLLOUT|POLLWRNORM|POLLWRBAND))
-                       FD_SET(p[i].fd, &write);
-               FD_SET(p[i].fd, &except);
-       }
-
-       tv.tv_sec = timout / 1000;
-       tv.tv_usec = (timout % 1000) * 1000;
-
-       rval = select(highfd + 1, &read, &write, &except,
-               timout == -1 ? NULL : &tv);
-       if (rval <= 0)
-               return rval;
-
-       rval = 0;
-       for (i = 0; i < nfds; i++) {
-               p[i].revents = 0;
-               if (FD_ISSET(p[i].fd, &read))
-                       p[i].revents |= POLLIN|POLLRDNORM|POLLRDBAND|POLLPRI;
-               if (FD_ISSET(p[i].fd, &write))
-                       p[i].revents |= POLLOUT|POLLWRNORM|POLLWRBAND;
-               if (FD_ISSET(p[i].fd, &except))
-                       p[i].revents |= POLLERR;
-               /* XXX: POLLHUP/POLLNVAL? */
-               if (p[i].revents != 0)
-                       rval++;
-       }
-       return rval;
-}
diff --git a/lib/libc/posix/pread.c b/lib/libc/posix/pread.c
deleted file mode 100644 (file)
index 4ef6b57..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <lib.h>
-#include <unistd.h>
-#include <minix/u64.h>
-
-ssize_t pread64(int fd, void *buffer, size_t nbytes, u64_t where)
-{
-       u64_t here;
-       ssize_t r;
-
-       if (lseek64(fd, make64(0,0), SEEK_CUR, &here) < 0) return(-1);
-       if (lseek64(fd, where, SEEK_SET, NULL) < 0) return(-1);
-       if ((r = read(fd, buffer, nbytes)) < 0) {
-               int e ; errno;
-               lseek64(fd, here, SEEK_SET, NULL);
-               errno = e;
-               return(-1);
-       }
-
-       if (lseek64(fd, here, SEEK_SET, NULL) < 0) return(-1);
-
-       return(r);
-}
-
-ssize_t pread(int fd, void *buffer, size_t nbytes, off_t where)
-{
-       off_t here;
-       ssize_t r;
-
-       if((here = lseek(fd, 0, SEEK_CUR)) < 0)
-               return -1;
-
-       if(lseek(fd, where, SEEK_SET) < 0)
-               return -1;
-
-       if((r=read(fd, buffer, nbytes)) < 0) {
-               int e = errno;
-               lseek(fd, here, SEEK_SET);
-               errno = e;
-               return -1;
-       }
-
-       if(lseek(fd, here, SEEK_SET) < 0)
-               return -1;
-
-       return r;
-}
-
diff --git a/lib/libc/posix/priority.c b/lib/libc/posix/priority.c
deleted file mode 100644 (file)
index 6f90880..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-priority.c
-*/
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/resource.h>
-#include <lib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stddef.h>
-
-
-int getpriority(int which, int who)
-{
-       int v;
-       message m;
-
-       m.m1_i1 = which;
-       m.m1_i2 = who;
-
-       /* GETPRIORITY returns negative for error.
-        * Otherwise, it returns the priority plus the minimum
-        * priority, to distiginuish from error. We have to
-        * correct for this. (The user program has to check errno
-        * to see if something really went wrong.)
-        */
-
-       if((v = _syscall(PM_PROC_NR, GETPRIORITY, &m)) < 0) {
-               return v;
-       }
-
-       return v + PRIO_MIN;
-}
-
-int setpriority(int which, int who, int prio)
-{
-       message m;
-
-       m.m1_i1 = which;
-       m.m1_i2 = who;
-       m.m1_i3 = prio;
-
-       return _syscall(PM_PROC_NR, SETPRIORITY, &m);
-}
-
diff --git a/lib/libc/posix/pwrite.c b/lib/libc/posix/pwrite.c
deleted file mode 100644 (file)
index 94b1d4a..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-#include <lib.h>
-#include <unistd.h>
-#include <minix/u64.h>
-
-ssize_t pwrite64(int fd, const void *buffer, size_t nbytes, u64_t where)
-{
-       u64_t here;
-       ssize_t w;
-
-       if (lseek64(fd, make64(0,0), SEEK_CUR, &here) < 0) return(-1);
-       if (lseek64(fd, where, SEEK_SET, NULL) < 0) return(-1);
-       if ((w = write(fd, buffer, nbytes)) < 0) {
-               int e = errno;
-               lseek64(fd, here, SEEK_SET, NULL);
-               errno = e;
-               return(-1);
-       }
-
-       if (lseek64(fd, here, SEEK_SET, NULL) < 0) return(-1);
-
-       return(w);
-}
-
-ssize_t pwrite(int fd, const void *buffer, size_t nbytes, off_t where)
-{
-       off_t here;
-       ssize_t w;
-
-       if((here = lseek(fd, 0, SEEK_CUR)) < 0)
-               return -1;
-
-       if(lseek(fd, where, SEEK_SET) < 0)
-               return -1;
-
-       if((w=write(fd, buffer, nbytes)) < 0) {
-               int e = errno;
-               lseek(fd, here, SEEK_SET);
-               errno = e;
-               return -1;
-       }
-
-       if(lseek(fd, here, SEEK_SET) < 0)
-               return -1;
-
-       return w;
-}
diff --git a/lib/libc/posix/usleep.c b/lib/libc/posix/usleep.c
deleted file mode 100644 (file)
index 964e2aa..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-lib/posix/usleep.c
-*/
-
-#include <unistd.h>
-#include <sys/select.h>
-#include <sys/time.h>
-
-int usleep(useconds_t useconds)
-{
-       int r;
-       struct timeval tv;
-
-       tv.tv_sec= useconds/1000000;
-       tv.tv_usec= useconds % 1000000;
-       r= select(0, NULL, NULL, NULL, &tv);
-       return r;
-}
index 574f6bcec6c76247f516c1a8dc1b9ee4111e7954..f7a8f20c3b210523661cad86bcaff39f89d1618b 100644 (file)
@@ -1,3 +1,5 @@
+$NetBSD: COPYRIGHT,v 1.5 2003/08/07 16:43:19 agc Exp $
+
 Copyright 1992, 1993, 1994 Henry Spencer.  All rights reserved.
 This software is not subject to any license of the American Telephone
 and Telegraph Company or of the Regents of the University of California.
@@ -32,11 +34,7 @@ to the following restrictions:
  * 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
+ * 3. 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.
  *
index d330cf6f70cdfaf8915d10147fb97bf8f59f9330..4dd74cf8494dee1a5b71558420f3a8455c2beed4 100644 (file)
@@ -1,8 +1,14 @@
+#      $NetBSD: Makefile.inc,v 1.7 1997/11/14 02:04:46 mrg Exp $
+#      @(#)Makefile.inc        8.1 (Berkeley) 6/4/93
+
 # regex sources
 .PATH: ${.CURDIR}/regex
 
-SRCS+=  \
-       regcomp.c \
-       regerror.c \
-       regexec.c \
-       regfree.c
+CPPFLAGS+=-DPOSIX_MISTAKE
+
+SRCS+= regcomp.c regerror.c regexec.c regfree.c
+
+MAN+=  regex.3 re_format.7
+
+MLINKS+=regex.3 regcomp.3 regex.3 regexec.3 regex.3 regerror.3 \
+       regex.3 regfree.3
old mode 100755 (executable)
new mode 100644 (file)
index f4301d3..93eb936
@@ -1,3 +1,4 @@
+#      $NetBSD: WHATSNEW,v 1.6 1995/02/27 13:28:25 cgd Exp $
 # @(#)WHATSNEW 8.3 (Berkeley) 3/18/94
 
 New in alpha3.4:  The complex bug alluded to below has been fixed (in a
index c351c7c1c97a40c0303970055fd52b0181a1bb43..3ab2ccba47c3e97a40a3f1fdcba21b66deaa45f6 100644 (file)
@@ -1,5 +1,6 @@
+/*     $NetBSD: cclass.h,v 1.7 2003/08/07 16:43:19 agc Exp $   */
+
 /*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * 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. 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.
+ *
+ *     @(#)cclass.h    8.3 (Berkeley) 3/20/94
+ */
+
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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
  */
 
 /* character-class table */
-static struct cclass {
-       char *name;
-       char *chars;
-       char *multis;
+static const struct cclass {
+       const char *name;
+       const char *chars;
+       const char *multis;
 } cclasses[] = {
-       {       "alnum",        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "" },
-       {       "alpha",        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "" },
-       {       "blank",        " \t",          "" },
-       {       "cntrl",        "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177", "" },
-       {       "digit",        "0123456789",   "" },
-       {       "graph",        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" },
-       {       "lower",        "abcdefghijklmnopqrstuvwxyz", "" },
-       {       "print",        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ", "" },
-       {       "punct",        "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", "" },
-       {       "space",        "\t\n\v\f\r ",  "" },
-       {       "upper",        "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "" },
-       {       "xdigit",       "0123456789ABCDEFabcdef", "" },
-       {       NULL,           0,              "" }
+       { "alnum",      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
+0123456789",                           "" },
+       { "alpha",      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
+                                       "" },
+       { "blank",      " \t",          "" },
+       { "cntrl",      "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
+\25\26\27\30\31\32\33\34\35\36\37\177",        "" },
+       { "digit",      "0123456789",   "" },
+       { "graph",      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
+0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
+                                       "" },
+       { "lower",      "abcdefghijklmnopqrstuvwxyz",
+                                       "" },
+       { "print",      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
+0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
+                                       "" },
+       { "punct",      "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
+                                       "" },
+       { "space",      "\t\n\v\f\r ",  "" },
+       { "upper",      "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
+                                       "" },
+       { "xdigit",     "0123456789ABCDEFabcdef",
+                                       "" },
+       { NULL,         0,              "" }
 };
index 4af7134fccc5ca99612e29c4adb5b7b0e34f207a..4b9ef3919da4325e78897c6e33e5532af59bee97 100644 (file)
@@ -1,5 +1,6 @@
+/*     $NetBSD: cname.h,v 1.7 2003/08/07 16:43:19 agc Exp $    */
+
 /*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * 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. 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.
+ *
+ *     @(#)cname.h     8.3 (Berkeley) 3/20/94
+ */
+
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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
  */
 
 /* character-name table */
-static struct cname {
-       char *name;
+static const struct cname {
+       const char *name;
        char code;
 } cnames[] = {
-       {       "NUL",  '\0' },
-       {       "SOH",  '\001' },
-       {       "STX",  '\002' },
-       {       "ETX",  '\003' },
-       {       "EOT",  '\004' },
-       {       "ENQ",  '\005' },
-       {       "ACK",  '\006' },
-       {       "BEL",  '\007' },
-       {       "alert",        '\007' },
-       {       "BS",           '\010' },
-       {       "backspace",    '\b' },
-       {       "HT",           '\011' },
-       {       "tab",          '\t' },
-       {       "LF",           '\012' },
-       {       "newline",      '\n' },
-       {       "VT",           '\013' },
-       {       "vertical-tab", '\v' },
-       {       "FF",           '\014' },
-       {       "form-feed",    '\f' },
-       {       "CR",           '\015' },
-       {       "carriage-return",      '\r' },
-       {       "SO",   '\016' },
-       {       "SI",   '\017' },
-       {       "DLE",  '\020' },
-       {       "DC1",  '\021' },
-       {       "DC2",  '\022' },
-       {       "DC3",  '\023' },
-       {       "DC4",  '\024' },
-       {       "NAK",  '\025' },
-       {       "SYN",  '\026' },
-       {       "ETB",  '\027' },
-       {       "CAN",  '\030' },
-       {       "EM",   '\031' },
-       {       "SUB",  '\032' },
-       {       "ESC",  '\033' },
-       {       "IS4",  '\034' },
-       {       "FS",   '\034' },
-       {       "IS3",  '\035' },
-       {       "GS",   '\035' },
-       {       "IS2",  '\036' },
-       {       "RS",   '\036' },
-       {       "IS1",  '\037' },
-       {       "US",   '\037' },
-       {       "space",                ' ' },
-       {       "exclamation-mark",     '!' },
-       {       "quotation-mark",       '"' },
-       {       "number-sign",          '#' },
-       {       "dollar-sign",          '$' },
-       {       "percent-sign",         '%' },
-       {       "ampersand",            '&' },
-       {       "apostrophe",           '\'' },
-       {       "left-parenthesis",     '(' },
-       {       "right-parenthesis",    ')' },
-       {       "asterisk",     '*' },
-       {       "plus-sign",    '+' },
-       {       "comma",        ',' },
-       {       "hyphen",       '-' },
-       {       "hyphen-minus", '-' },
-       {       "period",       '.' },
-       {       "full-stop",    '.' },
-       {       "slash",        '/' },
-       {       "solidus",      '/' },
-       {       "zero",         '0' },
-       {       "one",          '1' },
-       {       "two",          '2' },
-       {       "three",        '3' },
-       {       "four",         '4' },
-       {       "five",         '5' },
-       {       "six",          '6' },
-       {       "seven",        '7' },
-       {       "eight",        '8' },
-       {       "nine",         '9' },
-       {       "colon",        ':' },
-       {       "semicolon",    ';' },
-       {       "less-than-sign",       '<' },
-       {       "equals-sign",          '=' },
-       {       "greater-than-sign",    '>' },
-       {       "question-mark",        '?' },
-       {       "commercial-at",        '@' },
-       {       "left-square-bracket",  '[' },
-       {       "backslash",            '\\' },
-       {       "reverse-solidus",      '\\' },
-       {       "right-square-bracket", ']' },
-       {       "circumflex",           '^' },
-       {       "circumflex-accent",    '^' },
-       {       "underscore",           '_' },
-       {       "low-line",             '_' },
-       {       "grave-accent",         '`' },
-       {       "left-brace",           '{' },
-       {       "left-curly-bracket",   '{' },
-       {       "vertical-line",        '|' },
-       {       "right-brace",          '}' },
-       {       "right-curly-bracket",  '}' },
-       {       "tilde",                '~' },
-       {       "DEL",  '\177' },
-       {       NULL,   0 }
+       { "NUL",                        '\0' },
+       { "SOH",                        '\001' },
+       { "STX",                        '\002' },
+       { "ETX",                        '\003' },
+       { "EOT",                        '\004' },
+       { "ENQ",                        '\005' },
+       { "ACK",                        '\006' },
+       { "BEL",                        '\007' },
+       { "alert",                      '\007' },
+       { "BS",                         '\010' },
+       { "backspace",                  '\b' },
+       { "HT",                         '\011' },
+       { "tab",                        '\t' },
+       { "LF",                         '\012' },
+       { "newline",                    '\n' },
+       { "VT",                         '\013' },
+       { "vertical-tab",               '\v' },
+       { "FF",                         '\014' },
+       { "form-feed",                  '\f' },
+       { "CR",                         '\015' },
+       { "carriage-return",            '\r' },
+       { "SO",                         '\016' },
+       { "SI",                         '\017' },
+       { "DLE",                        '\020' },
+       { "DC1",                        '\021' },
+       { "DC2",                        '\022' },
+       { "DC3",                        '\023' },
+       { "DC4",                        '\024' },
+       { "NAK",                        '\025' },
+       { "SYN",                        '\026' },
+       { "ETB",                        '\027' },
+       { "CAN",                        '\030' },
+       { "EM",                         '\031' },
+       { "SUB",                        '\032' },
+       { "ESC",                        '\033' },
+       { "IS4",                        '\034' },
+       { "FS",                         '\034' },
+       { "IS3",                        '\035' },
+       { "GS",                         '\035' },
+       { "IS2",                        '\036' },
+       { "RS",                         '\036' },
+       { "IS1",                        '\037' },
+       { "US",                         '\037' },
+       { "space",                      ' ' },
+       { "exclamation-mark",           '!' },
+       { "quotation-mark",             '"' },
+       { "number-sign",                '#' },
+       { "dollar-sign",                '$' },
+       { "percent-sign",               '%' },
+       { "ampersand",                  '&' },
+       { "apostrophe",                 '\'' },
+       { "left-parenthesis",           '(' },
+       { "right-parenthesis",          ')' },
+       { "asterisk",                   '*' },
+       { "plus-sign",                  '+' },
+       { "comma",                      ',' },
+       { "hyphen",                     '-' },
+       { "hyphen-minus",               '-' },
+       { "period",                     '.' },
+       { "full-stop",                  '.' },
+       { "slash",                      '/' },
+       { "solidus",                    '/' },
+       { "zero",                       '0' },
+       { "one",                        '1' },
+       { "two",                        '2' },
+       { "three",                      '3' },
+       { "four",                       '4' },
+       { "five",                       '5' },
+       { "six",                        '6' },
+       { "seven",                      '7' },
+       { "eight",                      '8' },
+       { "nine",                       '9' },
+       { "colon",                      ':' },
+       { "semicolon",                  ';' },
+       { "less-than-sign",             '<' },
+       { "equals-sign",                '=' },
+       { "greater-than-sign",          '>' },
+       { "question-mark",              '?' },
+       { "commercial-at",              '@' },
+       { "left-square-bracket",        '[' },
+       { "backslash",                  '\\' },
+       { "reverse-solidus",            '\\' },
+       { "right-square-bracket",       ']' },
+       { "circumflex",                 '^' },
+       { "circumflex-accent",          '^' },
+       { "underscore",                 '_' },
+       { "low-line",                   '_' },
+       { "grave-accent",               '`' },
+       { "left-brace",                 '{' },
+       { "left-curly-bracket",         '{' },
+       { "vertical-line",              '|' },
+       { "right-brace",                '}' },
+       { "right-curly-bracket",        '}' },
+       { "tilde",                      '~' },
+       { "DEL",                        '\177' },
+       { NULL,                         0 },
 };
index 14f6c067792d1fb1be566b9b5e8403aed1685dfc..f51ff9cc3972b5f4c1d5b0f60550cd47f2dda829 100644 (file)
@@ -1,5 +1,6 @@
+/*     $NetBSD: engine.c,v 1.22 2009/02/12 05:06:54 lukem Exp $        */
+
 /*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * 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. 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.
+ *
+ *     @(#)engine.c    8.5 (Berkeley) 3/20/94
+ */
+
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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
@@ -54,6 +88,7 @@
 #define        print   sprint
 #define        at      sat
 #define        match   smat
+#define        nope    snope
 #endif
 #ifdef LNAMES
 #define        matcher lmatcher
 #define        print   lprint
 #define        at      lat
 #define        match   lmat
+#define        nope    lnope
 #endif
 
 /* another structure passed up and down to avoid zillions of parameters */
@@ -72,11 +108,11 @@ struct match {
        struct re_guts *g;
        int eflags;
        regmatch_t *pmatch;     /* [nsub+1] (0 element unused) */
-       char *offp;             /* offsets work from here */
-       char *beginp;           /* start of string -- virtual NUL precedes */
-       char *endp;             /* end of string -- virtual NUL here */
-       char *coldp;            /* can be no match starting before here */
-       char **lastpos;         /* [nplus+1] */
+       const char *offp;       /* offsets work from here */
+       const char *beginp;     /* start of string -- virtual NUL precedes */
+       const char *endp;       /* end of string -- virtual NUL here */
+       const char *coldp;      /* can be no match starting before here */
+       const char **lastpos;   /* [nplus+1] */
        STATEVARS;
        states st;              /* current states */
        states fresh;           /* states for a fresh start */
@@ -90,11 +126,11 @@ extern "C" {
 #endif
 
 /* === engine.c === */
-static int matcher(struct re_guts *g, char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
-static char *dissect(struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *backref(struct match *m, char *start, char *stop, sopno startst, sopno stopst, sopno lev);
-static char *fast(struct match *m, char *start, char *stop, sopno startst, sopno stopst);
-static char *slow(struct match *m, char *start, char *stop, sopno startst, sopno stopst);
+static int matcher(struct re_guts *g, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
+static const char *dissect(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev);
+static const char *fast(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
+static const char *slow(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
 static states step(struct re_guts *g, sopno start, sopno stop, states bef, int ch, states aft);
 #define        BOL     (OUT+1)
 #define        EOL     (BOL+1)
@@ -124,6 +160,7 @@ static char *pchar(int ch);
 #define        SP(t, s, c)     print(m, t, s, c, stdout)
 #define        AT(t, p1, p2, s1, s2)   at(m, t, p1, p2, s1, s2)
 #define        NOTE(str)       { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
+static int nope = 0;
 #else
 #define        SP(t, s, c)     /* nothing */
 #define        AT(t, p1, p2, s1, s2)   /* nothing */
@@ -132,33 +169,39 @@ static char *pchar(int ch);
 
 /*
  - matcher - the actual matching engine
- == static int matcher(register struct re_guts *g, char *string, \
+ == static int matcher(struct re_guts *g, char *string, \
  ==    size_t nmatch, regmatch_t pmatch[], int eflags);
  */
 static int                     /* 0 success, REG_NOMATCH failure */
-matcher(g, string, nmatch, pmatch, eflags)
-register struct re_guts *g;
-char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
+matcher(
+    struct re_guts *g,
+    const char *string,
+    size_t nmatch,
+    regmatch_t pmatch[],
+    int eflags)
 {
-       register char *endp;
-       register int i;
+       const char *endp;
+       size_t i;
        struct match mv;
-       register struct match *m = &mv;
-       register char *dp;
-       const register sopno gf = g->firststate+1;      /* +1 for OEND */
-       const register sopno gl = g->laststate;
-       char *start;
-       char *stop;
+       struct match *m = &mv;
+       const char *dp;
+       const sopno gf = g->firststate+1;       /* +1 for OEND */
+       const sopno gl = g->laststate;
+       const char *start;
+       const char *stop;
+       int error = 0;
+
+       _DIAGASSERT(g != NULL);
+       _DIAGASSERT(string != NULL);
+       /* pmatch checked below */
 
        /* simplify the situation where possible */
        if (g->cflags&REG_NOSUB)
                nmatch = 0;
        if (eflags&REG_STARTEND) {
-               start = string + pmatch[0].rm_so;
-               stop = string + pmatch[0].rm_eo;
+               _DIAGASSERT(pmatch != NULL);
+               start = string + (size_t)pmatch[0].rm_so;
+               stop = string + (size_t)pmatch[0].rm_eo;
        } else {
                start = string;
                stop = start + strlen(start);
@@ -195,8 +238,8 @@ int eflags;
        for (;;) {
                endp = fast(m, start, stop, gf, gl);
                if (endp == NULL) {             /* a miss */
-                       STATETEARDOWN(m);
-                       return(REG_NOMATCH);
+                       error = REG_NOMATCH;
+                       goto done;
                }
                if (nmatch == 0 && !g->backrefs)
                        break;          /* no further info needed */
@@ -219,22 +262,21 @@ int eflags;
                        m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
                                                        sizeof(regmatch_t));
                if (m->pmatch == NULL) {
-                       STATETEARDOWN(m);
-                       return(REG_ESPACE);
+                       error = REG_ESPACE;
+                       goto done;
                }
                for (i = 1; i <= m->g->nsub; i++)
-                       m->pmatch[i].rm_so = m->pmatch[i].rm_eo = -1;
+                       m->pmatch[i].rm_so = m->pmatch[i].rm_eo = (regoff_t)-1;
                if (!g->backrefs && !(m->eflags&REG_BACKR)) {
                        NOTE("dissecting");
                        dp = dissect(m, m->coldp, endp, gf, gl);
                } else {
                        if (g->nplus > 0 && m->lastpos == NULL)
-                               m->lastpos = (char **)malloc((g->nplus+1) *
-                                                       sizeof(char *));
+                               m->lastpos = malloc((g->nplus+1) *
+                                                       sizeof(const char *));
                        if (g->nplus > 0 && m->lastpos == NULL) {
-                               free(m->pmatch);
-                               STATETEARDOWN(m);
-                               return(REG_ESPACE);
+                               error = REG_ESPACE;
+                               goto done;
                        }
                        NOTE("backref dissect");
                        dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
@@ -255,8 +297,8 @@ int eflags;
                        /* try it on a shorter possibility */
 #ifndef NDEBUG
                        for (i = 1; i <= m->g->nsub; i++) {
-                               assert(m->pmatch[i].rm_so == -1);
-                               assert(m->pmatch[i].rm_eo == -1);
+                               assert(m->pmatch[i].rm_so == (regoff_t)-1);
+                               assert(m->pmatch[i].rm_eo == (regoff_t)-1);
                        }
 #endif
                        NOTE("backoff dissect");
@@ -274,6 +316,7 @@ int eflags;
 
        /* fill in the details if requested */
        if (nmatch > 0) {
+               _DIAGASSERT(pmatch != NULL);
                pmatch[0].rm_so = m->coldp - m->offp;
                pmatch[0].rm_eo = endp - m->offp;
        }
@@ -283,45 +326,56 @@ int eflags;
                        if (i <= m->g->nsub)
                                pmatch[i] = m->pmatch[i];
                        else {
-                               pmatch[i].rm_so = -1;
-                               pmatch[i].rm_eo = -1;
+                               pmatch[i].rm_so = (regoff_t)-1;
+                               pmatch[i].rm_eo = (regoff_t)-1;
                        }
        }
 
-       if (m->pmatch != NULL)
-               free((char *)m->pmatch);
-       if (m->lastpos != NULL)
-               free((char *)m->lastpos);
+done:
+       if (m->pmatch != NULL) {
+               free(m->pmatch);
+               m->pmatch = NULL;
+       }
+       if (m->lastpos != NULL) {
+               free(m->lastpos);
+               m->lastpos = NULL;
+       }
        STATETEARDOWN(m);
-       return(0);
+       return error;
 }
 
 /*
  - dissect - figure out what matched what, no back references
- == static char *dissect(register struct match *m, char *start, \
- ==    char *stop, sopno startst, sopno stopst);
+ == static const char *dissect(struct match *m, const char *start, \
+ ==    const char *stop, sopno startst, sopno stopst);
  */
-static char *                  /* == stop (success) always */
-dissect(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
+static const char *                    /* == stop (success) always */
+dissect(
+    struct match *m,
+    const char *start,
+    const char *stop,
+    sopno startst,
+    sopno stopst)
 {
-       register int i;
-       register sopno ss;      /* start sop of current subRE */
-       register sopno es;      /* end sop of current subRE */
-       register char *sp;      /* start of string matched by it */
-       register char *stp;     /* string matched by it cannot pass here */
-       register char *rest;    /* start of rest of string */
-       register char *tail;    /* string unmatched by rest of RE */
-       register sopno ssub;    /* start sop of subsubRE */
-       register sopno esub;    /* end sop of subsubRE */
-       register char *ssp;     /* start of string matched by subsubRE */
-       register char *sep;     /* end of string matched by subsubRE */
-       register char *oldssp;  /* previous ssp */
-       register char *dp;
+       int i;
+       sopno ss;       /* start sop of current subRE */
+       sopno es;       /* end sop of current subRE */
+       const char *sp; /* start of string matched by it */
+       const char *stp; /* string matched by it cannot pass here */
+       const char *rest; /* start of rest of string */
+       const char *tail; /* string unmatched by rest of RE */
+       sopno ssub;     /* start sop of subsubRE */
+       sopno esub;     /* end sop of subsubRE */
+       const char *ssp; /* start of string matched by subsubRE */
+       const char *sep; /* end of string matched by subsubRE */
+       const char *oldssp; /* previous ssp */
+#ifndef NDEBUG
+       const char *dp;
+#endif
+
+       _DIAGASSERT(m != NULL);
+       _DIAGASSERT(start != NULL);
+       _DIAGASSERT(stop != NULL);
 
        AT("diss", start, stop, startst, stopst);
        sp = start;
@@ -380,7 +434,12 @@ sopno stopst;
                        esub = es - 1;
                        /* did innards match? */
                        if (slow(m, sp, rest, ssub, esub) != NULL) {
-                               dp = dissect(m, sp, rest, ssub, esub);
+#ifdef NDEBUG
+                               (void)
+#else
+                               dp = 
+#endif
+                                   dissect(m, sp, rest, ssub, esub);
                                assert(dp == rest);
                        } else          /* no */
                                assert(sp == rest);
@@ -418,7 +477,12 @@ sopno stopst;
                        }
                        assert(sep == rest);    /* must exhaust substring */
                        assert(slow(m, ssp, sep, ssub, esub) == rest);
-                       dp = dissect(m, ssp, sep, ssub, esub);
+#ifdef NDEBUG
+                       (void)
+#else
+                       dp =
+#endif
+                           dissect(m, ssp, sep, ssub, esub);
                        assert(dp == sep);
                        sp = rest;
                        break;
@@ -453,7 +517,12 @@ sopno stopst;
                                else
                                        assert(OP(m->g->strip[esub]) == O_CH);
                        }
-                       dp = dissect(m, sp, rest, ssub, esub);
+#ifdef NDEBUG
+                       (void)
+#else
+                       dp =
+#endif
+                           dissect(m, sp, rest, ssub, esub);
                        assert(dp == rest);
                        sp = rest;
                        break;
@@ -486,30 +555,34 @@ sopno stopst;
 
 /*
  - backref - figure out what matched what, figuring in back references
- == static char *backref(register struct match *m, char *start, \
- ==    char *stop, sopno startst, sopno stopst, sopno lev);
+ == static const char *backref(struct match *m, const char *start, \
+ ==    const char *stop, sopno startst, sopno stopst, sopno lev);
  */
-static char *                  /* == stop (success) or NULL (failure) */
-backref(m, start, stop, startst, stopst, lev)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
-sopno lev;                     /* PLUS nesting level */
+static const char *            /* == stop (success) or NULL (failure) */
+backref(
+    struct match *m,
+    const char *start,
+    const char *stop,
+    sopno startst,
+    sopno stopst,
+    sopno lev)                 /* PLUS nesting level */
 {
-       register int i;
-       register sopno ss;      /* start sop of current subRE */
-       register char *sp;      /* start of string matched by it */
-       register sopno ssub;    /* start sop of subsubRE */
-       register sopno esub;    /* end sop of subsubRE */
-       register char *ssp;     /* start of string matched by subsubRE */
-       register char *dp;
-       register size_t len;
-       register int hard;
-       register sop s;
-       register regoff_t offsave;
-       register cset *cs;
+       int i;
+       sopno ss;       /* start sop of current subRE */
+       const char *sp; /* start of string matched by it */
+       sopno ssub;     /* start sop of subsubRE */
+       sopno esub;     /* end sop of subsubRE */
+       const char *ssp; /* start of string matched by subsubRE */
+       const char *dp;
+       size_t len;
+       int hard;
+       sop s;
+       regoff_t offsave;
+       cset *cs;
+
+       _DIAGASSERT(m != NULL);
+       _DIAGASSERT(start != NULL);
+       _DIAGASSERT(stop != NULL);
 
        AT("back", start, stop, startst, stopst);
        sp = start;
@@ -598,32 +671,34 @@ sopno lev;                        /* PLUS nesting level */
        case OBACK_:            /* the vilest depths */
                i = OPND(s);
                assert(0 < i && i <= m->g->nsub);
-               if (m->pmatch[i].rm_eo == -1)
+               if (m->pmatch[i].rm_eo == (regoff_t)-1)
+                       return(NULL);
+               assert(m->pmatch[i].rm_so != (regoff_t)-1);
+               len = (size_t)(m->pmatch[i].rm_eo - m->pmatch[i].rm_so);
+               if (len == 0)
                        return(NULL);
-               assert(m->pmatch[i].rm_so != -1);
-               len = m->pmatch[i].rm_eo - m->pmatch[i].rm_so;
                assert(stop - m->beginp >= len);
                if (sp > stop - len)
                        return(NULL);   /* not enough left to match */
-               ssp = m->offp + m->pmatch[i].rm_so;
+               ssp = m->offp + (size_t)m->pmatch[i].rm_so;
                if (memcmp(sp, ssp, len) != 0)
                        return(NULL);
                while (m->g->strip[ss] != SOP(O_BACK, i))
                        ss++;
                return(backref(m, sp+len, stop, ss+1, stopst, lev));
-               break;
+
        case OQUEST_:           /* to null or not */
                dp = backref(m, sp, stop, ss+1, stopst, lev);
                if (dp != NULL)
                        return(dp);     /* not */
                return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
-               break;
+
        case OPLUS_:
                assert(m->lastpos != NULL);
                assert(lev+1 <= m->g->nplus);
                m->lastpos[lev+1] = sp;
                return(backref(m, sp, stop, ss+1, stopst, lev+1));
-               break;
+
        case O_PLUS:
                if (sp == m->lastpos[lev])      /* last pass matched null */
                        return(backref(m, sp, stop, ss+1, stopst, lev-1));
@@ -631,10 +706,9 @@ sopno lev;                 /* PLUS nesting level */
                m->lastpos[lev] = sp;
                dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
                if (dp == NULL)
-                       return(backref(m, sp, stop, ss+1, stopst, lev-1));
-               else
-                       return(dp);
-               break;
+                       dp = backref(m, sp, stop, ss+1, stopst, lev-1);
+               return(dp);
+
        case OCH_:              /* find the right one, if any */
                ssub = ss + 1;
                esub = ss + OPND(s) - 1;
@@ -655,7 +729,7 @@ sopno lev;                  /* PLUS nesting level */
                        else
                                assert(OP(m->g->strip[esub]) == O_CH);
                }
-               break;
+
        case OLPAREN:           /* must undo assignment if rest fails */
                i = OPND(s);
                assert(0 < i && i <= m->g->nsub);
@@ -666,7 +740,7 @@ sopno lev;                  /* PLUS nesting level */
                        return(dp);
                m->pmatch[i].rm_so = offsave;
                return(NULL);
-               break;
+
        case ORPAREN:           /* must undo assignment if rest fails */
                i = OPND(s);
                assert(0 < i && i <= m->g->nsub);
@@ -677,7 +751,7 @@ sopno lev;                  /* PLUS nesting level */
                        return(dp);
                m->pmatch[i].rm_eo = offsave;
                return(NULL);
-               break;
+
        default:                /* uh oh */
                assert(nope);
                break;
@@ -686,31 +760,35 @@ sopno lev;                        /* PLUS nesting level */
        /* "can't happen" */
        assert(nope);
        /* NOTREACHED */
-       _exit(1);
+       return NULL;
 }
 
 /*
  - fast - step through the string at top speed
- == static char *fast(register struct match *m, char *start, \
- ==    char *stop, sopno startst, sopno stopst);
+ == static const char *fast(struct match *m, const char *start, \
+ ==    const char *stop, sopno startst, sopno stopst);
  */
-static char *                  /* where tentative match ended, or NULL */
-fast(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
+static const char *            /* where tentative match ended, or NULL */
+fast(
+    struct match *m,
+    const char *start,
+    const char *stop,
+    sopno startst,
+    sopno stopst)
 {
-       register states st = m->st;
-       register states fresh = m->fresh;
-       register states tmp = m->tmp;
-       register char *p = start;
-       register int c = (start == m->beginp) ? OUT : *(start-1);
-       register int lastc;     /* previous c */
-       register int flagch;
-       register int i;
-       register char *coldp;   /* last p after which no match was underway */
+       states st = m->st;
+       states fresh = m->fresh;
+       states tmp = m->tmp;
+       const char *p = start;
+       int c = (start == m->beginp) ? OUT : *(start-1);
+       int lastc;      /* previous c */
+       int flagch;
+       int i;
+       const char *coldp; /* last p after which no match was underway */
+
+       _DIAGASSERT(m != NULL);
+       _DIAGASSERT(start != NULL);
+       _DIAGASSERT(stop != NULL);
 
        CLEAR(st);
        SET1(st, startst);
@@ -782,26 +860,30 @@ sopno stopst;
 
 /*
  - slow - step through the string more deliberately
- == static char *slow(register struct match *m, char *start, \
- ==    char *stop, sopno startst, sopno stopst);
+ == static const char *slow(struct match *m, const char *start, \
+ ==    const char *stop, sopno startst, sopno stopst);
  */
-static char *                  /* where it ended */
-slow(m, start, stop, startst, stopst)
-register struct match *m;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
+static const char *                    /* where it ended */
+slow(
+    struct match *m,
+    const char *start,
+    const char *stop,
+    sopno startst,
+    sopno stopst)
 {
-       register states st = m->st;
-       register states empty = m->empty;
-       register states tmp = m->tmp;
-       register char *p = start;
-       register int c = (start == m->beginp) ? OUT : *(start-1);
-       register int lastc;     /* previous c */
-       register int flagch;
-       register int i;
-       register char *matchp;  /* last p at which a match ended */
+       states st = m->st;
+       states empty = m->empty;
+       states tmp = m->tmp;
+       const char *p = start;
+       int c = (start == m->beginp) ? OUT : *(start-1);
+       int lastc;      /* previous c */
+       int flagch;
+       int i;
+       const char *matchp;     /* last p at which a match ended */
+
+       _DIAGASSERT(m != NULL);
+       _DIAGASSERT(start != NULL);
+       _DIAGASSERT(stop != NULL);
 
        AT("slow", start, stop, startst, stopst);
        CLEAR(st);
@@ -869,8 +951,8 @@ sopno stopst;
 
 /*
  - step - map set of states reachable before char to set reachable after
- == static states step(register struct re_guts *g, sopno start, sopno stop, \
- ==    register states bef, int ch, register states aft);
+ == static states step(struct re_guts *g, sopno start, sopno stop, \
+ ==    states bef, int ch, states aft);
  == #define    BOL     (OUT+1)
  == #define    EOL     (BOL+1)
  == #define    BOLEOL  (BOL+2)
@@ -882,20 +964,22 @@ sopno stopst;
  == #define    NNONCHAR        (CODEMAX-CHAR_MAX)
  */
 static states
-step(g, start, stop, bef, ch, aft)
-register struct re_guts *g;
-sopno start;                   /* start state within strip */
-sopno stop;                    /* state after stop state within strip */
-register states bef;           /* states reachable before */
-int ch;                                /* character or NONCHAR code */
-register states aft;           /* states already known reachable after */
+step(
+    struct re_guts *g,
+    sopno start,               /* start state within strip */
+    sopno stop,                        /* state after stop state within strip */
+    states bef,                        /* states reachable before */
+    int ch,                    /* character or NONCHAR code */
+    states aft)                        /* states already known reachable after */
 {
-       register cset *cs;
-       register sop s;
-       register sopno pc;
-       register onestate here;         /* note, macros know this name */
-       register sopno look;
-       register int i;
+       cset *cs;
+       sop s;
+       sopno pc;
+       onestate here;          /* note, macros know this name */
+       sopno look;
+       int i;
+
+       _DIAGASSERT(g != NULL);
 
        for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
                s = g->strip[pc];
@@ -1004,20 +1088,25 @@ register states aft;            /* states already known reachable after */
  == #endif
  */
 static void
-print(m, caption, st, ch, d)
-struct match *m;
-char *caption;
-states st;
-int ch;
-FILE *d;
+print(
+    struct match *m,
+    char *caption,
+    states st,
+    int ch,
+    FILE *d)
 {
-       register struct re_guts *g = m->g;
-       register int i;
-       register int first = 1;
+       struct re_guts *g = m->g;
+       int i;
+       int first = 1;
+
+       _DIAGASSERT(m != NULL);
+       _DIAGASSERT(caption != NULL);
 
        if (!(m->eflags&REG_TRACE))
                return;
 
+       _DIAGASSERT(d != NULL);
+
        fprintf(d, "%s", caption);
        if (ch != '\0')
                fprintf(d, " %s", pchar(ch));
@@ -1037,14 +1126,20 @@ FILE *d;
  == #endif
  */
 static void
-at(m, title, start, stop, startst, stopst)
-struct match *m;
-char *title;
-char *start;
-char *stop;
-sopno startst;
-sopno stopst;
+at(
+    struct match *m,
+    char *title,
+    char *start,
+    char *stop,
+    sopno startst,
+    sopno stopst)
 {
+
+       _DIAGASSERT(m != NULL);
+       _DIAGASSERT(title != NULL);
+       _DIAGASSERT(start != NULL);
+       _DIAGASSERT(stop != NULL);
+
        if (!(m->eflags&REG_TRACE))
                return;
 
@@ -1067,15 +1162,15 @@ sopno stopst;
  * the non-debug compilation anyway, so it doesn't matter much.
  */
 static char *                  /* -> representation */
-pchar(ch)
-int ch;
+pchar(
+    int ch)
 {
        static char pbuf[10];
 
        if (isprint(ch) || ch == ' ')
-               sprintf(pbuf, "%c", ch);
+               (void)snprintf(pbuf, sizeof pbuf, "%c", ch);
        else
-               sprintf(pbuf, "\\%o", ch);
+               (void)snprintf(pbuf, sizeof pbuf, "\\%o", ch);
        return(pbuf);
 }
 #endif
@@ -1090,3 +1185,4 @@ int ch;
 #undef print
 #undef at
 #undef match
+#undef nope
old mode 100755 (executable)
new mode 100644 (file)
index c02c93f..2b1ced5
@@ -1,4 +1,5 @@
-.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
+.\"    $NetBSD: re_format.7,v 1.9 2009/04/21 14:46:02 joerg Exp $
+.\"
 .\" Copyright (c) 1992, 1993, 1994
 .\"    The Regents of the University of California.  All rights reserved.
 .\"
 .\" 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. 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.
+.\"
+.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Henry Spencer.
+.\"
+.\" 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
 .\"
 .\"    @(#)re_format.7 8.3 (Berkeley) 3/20/94
 .\"
-.TH RE_FORMAT 7 "March 20, 1994"
-.SH NAME
-re_format \- POSIX 1003.2 regular expressions
-.SH DESCRIPTION
+.Dd March 20, 1994
+.Dt RE_FORMAT 7
+.Os
+.Sh NAME
+.Nm re_format
+.Nd POSIX 1003.2 regular expressions
+.Sh DESCRIPTION
 Regular expressions (``RE''s),
 as defined in POSIX 1003.2, come in two forms:
 modern REs (roughly those of
-.BR egrep ;
+.Xr egrep 1 ;
 1003.2 calls these ``extended'' REs)
 and obsolete REs (roughly those of
-.BR ed ;
+.Xr ed 1 ;
 1003.2 ``basic'' REs).
 Obsolete REs mostly exist for backward compatibility in some old programs;
 they will be discussed at the end.
 1003.2 leaves some aspects of RE syntax and semantics open;
 `\(dg' marks decisions on these aspects that
 may not be fully portable to other 1003.2 implementations.
-.PP
-A (modern) RE is one\(dg or more non-empty\(dg \fIbranches\fR,
+.Pp
+A (modern) RE is one\(dg or more non-empty\(dg
+.Em branches ,
 separated by `|'.
 It matches anything that matches one of the branches.
-.PP
-A branch is one\(dg or more \fIpieces\fR, concatenated.
+.Pp
+A branch is one\(dg or more
+.Em pieces ,
+concatenated.
 It matches a match for the first, followed by a match for the second, etc.
-.PP
-A piece is an \fIatom\fR possibly followed
-by a single\(dg `*', `+', `?', or \fIbound\fR.
+.Pp
+A piece is an
+.Em atom
+possibly followed
+by a single\(dg `*', `+', `?', or
+.Em bound .
 An atom followed by `*' matches a sequence of 0 or more matches of the atom.
 An atom followed by `+' matches a sequence of 1 or more matches of the atom.
 An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
-.PP
-A \fIbound\fR is `{' followed by an unsigned decimal integer,
-possibly followed by `,'
+.Pp
+A
+.Em bound
+is `{' followed by an unsigned decimal integer, possibly followed by `,'
 possibly followed by another unsigned decimal integer,
 always followed by `}'.
 The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
 and if there are two of them, the first may not exceed the second.
-An atom followed by a bound containing one integer \fIi\fR
-and no comma matches
-a sequence of exactly \fIi\fR matches of the atom.
-An atom followed by a bound
-containing one integer \fIi\fR and a comma matches
-a sequence of \fIi\fR or more matches of the atom.
-An atom followed by a bound
-containing two integers \fIi\fR and \fIj\fR matches
-a sequence of \fIi\fR through \fIj\fR (inclusive) matches of the atom.
-.PP
+An atom followed by a bound containing one integer
+.Em i
+and no comma matches a sequence of exactly
+.Em i
+matches of the atom.
+An atom followed by a bound containing one integer
+.Em i
+and a comma matches a sequence of
+.Em i
+or more matches of the atom.
+An atom followed by a bound containing two integers
+.Em i
+and
+.Em j
+matches a sequence of
+.Em i
+through
+.Em j
+(inclusive) matches of the atom.
+.Pp
 An atom is a regular expression enclosed in `()' (matching a match for the
-regular expression),
-an empty set of `()' (matching the null string)\(dg,
-a \fIbracket expression\fR (see below), `.'
-(matching any single character), `^' (matching the null string at the
-beginning of a line), `$' (matching the null string at the
-end of a line), a `\e' followed by one of the characters
-`^.[$()|*+?{\e'
+regular expression), an empty set of `()' (matching the null string)\(dg, a
+.Em bracket expression
+(see below), `.' (matching any single character),
+`^' (matching the null string at the beginning of a line),
+`$' (matching the null string at the end of a line),
+a `\e' followed by one of the characters `^.[$()|*+?{\e'
 (matching that character taken as an ordinary character),
 a `\e' followed by any other character\(dg
 (matching that character taken as an ordinary character,
@@ -98,21 +147,24 @@ or a single character with no other significance (matching that character).
 A `{' followed by a character other than a digit is an ordinary
 character, not the beginning of a bound\(dg.
 It is illegal to end an RE with `\e'.
-.PP
-A \fIbracket expression\fR is a list of characters enclosed in `[]'.
+.Pp
+A
+.Em bracket expression
+is a list of characters enclosed in `[]'.
 It normally matches any single character from the list (but see below).
 If the list begins with `^',
-it matches any single character
-(but see below) \fInot\fR from the rest of the list.
+it matches any single character (but see below)
+.Em not
+from the rest of the list.
 If two characters in the list are separated by `\-', this is shorthand
-for the full \fIrange\fR of characters between those two (inclusive) in the
-collating sequence,
+for the full
+.Em range
+of characters between those two (inclusive) in the collating sequence,
 e.g. `[0-9]' in ASCII matches any decimal digit.
-It is illegal\(dg for two ranges to share an
-endpoint, e.g. `a-c-e'.
+It is illegal\(dg for two ranges to share an endpoint, e.g. `a-c-e'.
 Ranges are very collating-sequence-dependent,
 and portable programs should avoid relying on them.
-.PP
+.Pp
 To include a literal `]' in the list, make it the first character
 (following a possible `^').
 To include a literal `\-', make it the first or last character,
@@ -122,69 +174,62 @@ enclose it in `[.' and `.]' to make it a collating element (see below).
 With the exception of these and some combinations using `[' (see next
 paragraphs), all other special characters, including `\e', lose their
 special significance within a bracket expression.
-.PP
+.Pp
 Within a bracket expression, a collating element (a character,
 a multi-character sequence that collates as if it were a single character,
 or a collating-sequence name for either)
 enclosed in `[.' and `.]' stands for the
 sequence of characters of that collating element.
 The sequence is a single element of the bracket expression's list.
-A bracket expression containing a multi-character collating element 
+A bracket expression containing a multi-character collating element
 can thus match more than one character,
 e.g. if the collating sequence includes a `ch' collating element,
 then the RE `[[.ch.]]*c' matches the first five characters
 of `chchcc'.
-.PP
+.Pp
 Within a bracket expression, a collating element enclosed in `[=' and
 `=]' is an equivalence class, standing for the sequences of characters
 of all collating elements equivalent to that one, including itself.
 (If there are no other equivalent collating elements,
 the treatment is as if the enclosing delimiters were `[.' and `.]'.)
-For example, if o and \o'o^' are the members of an equivalence class,
-then `[[=o=]]', `[[=\o'o^'=]]', and `[o\o'o^']' are all synonymous.
+For example, if o and '\(^o' are the members of an equivalence class,
+then `[[=o=]]', `[[=\(^o'=]]', and `[o\(^o']' are all synonymous.
 An equivalence class may not\(dg be an endpoint
 of a range.
-.PP
-Within a bracket expression, the name of a \fIcharacter class\fR enclosed
-in `[:' and `:]' stands for the list of all characters belonging to that
-class.
+.Pp
+Within a bracket expression, the name of a
+.Em character class
+enclosed in `[:' and `:]' stands for the list of all characters
+belonging to that class.
 Standard character class names are:
-.PP
-.RS
-.nf
-.ta 3c 6c 9c
-alnum  digit   punct
-alpha  graph   space
-blank  lower   upper
-cntrl  print   xdigit
-.fi
-.RE
-.PP
+.Bl -column "alnum" "digit" "xdigit"
+.It alnum      digit   punct
+.It alpha      graph   space
+.It blank      lower   upper
+.It cntrl      print   xdigit
+.El
+.Pp
 These stand for the character classes defined in
-.BR ctype (3).
+.Xr ctype 3 .
 A locale may provide others.
 A character class may not be used as an endpoint of a range.
-.PP
+.Pp
 There are two special cases\(dg of bracket expressions:
-the bracket expressions `[[:<:]]' and `[[:>:]]' match the null string at
-the beginning and end of a word respectively.
-A word is defined as a sequence of
-word characters
-which is neither preceded nor followed by
-word characters.
+the bracket expressions `[[:\*[Lt]:]]' and `[[:\*[Gt]:]]' match
+the null string at the beginning and end of a word respectively.
+A word is defined as a sequence of word characters
+which is neither preceded nor followed by word characters.
 A word character is an
-.B alnum
+.Em alnum
 character (as defined by
-.BR ctype (3))
+.Xr ctype 3 )
 or an underscore.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
+This is an extension, compatible with but not specified by POSIX 1003.2,
+and should be used with caution in software intended to be portable
+to other systems.
+.Pp
 In the event that an RE could match more than one substring of a given
-string,
-the RE matches the one starting earliest in the string.
+string, the RE matches the one starting earliest in the string.
 If the RE could match more than one substring starting at that point,
 it matches the longest.
 Subexpressions also match the longest possible substrings, subject to
@@ -193,7 +238,7 @@ with subexpressions starting earlier in the RE taking priority over
 ones starting later.
 Note that higher-level subexpressions thus take priority over
 their lower-level component subexpressions.
-.PP
+.Pp
 Match lengths are measured in characters, not collating elements.
 A null string is considered longer than no match at all.
 For example,
@@ -203,7 +248,7 @@ when `(.*).*' is matched against `abc' the parenthesized subexpression
 matches all three characters, and
 when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
 subexpression match the null string.
-.PP
+.Pp
 If case-independent matching is specified,
 the effect is much as if all case distinctions had vanished from the
 alphabet.
@@ -214,13 +259,13 @@ e.g. `x' becomes `[xX]'.
 When it appears inside a bracket expression, all case counterparts
 of it are added to the bracket expression, so that (e.g.) `[x]'
 becomes `[xX]' and `[^x]' becomes `[^xX]'.
-.PP
+.Pp
 No particular limit is imposed on the length of REs\(dg.
 Programs intended to be portable should not employ REs longer
 than 256 bytes,
 as an implementation can refuse to accept such REs and remain
 POSIX-compliant.
-.PP
+.Pp
 Obsolete (``basic'') regular expressions differ in several respects.
 `|', `+', and `?' are ordinary characters and there is no equivalent
 for their functionality.
@@ -235,35 +280,36 @@ RE or\(dg the end of a parenthesized subexpression,
 and `*' is an ordinary character if it appears at the beginning of the
 RE or the beginning of a parenthesized subexpression
 (after a possible leading `^').
-Finally, there is one new type of atom, a \fIback reference\fR:
-`\e' followed by a non-zero decimal digit \fId\fR
+Finally, there is one new type of atom, a
+.Em back reference :
+`\e' followed by a non-zero decimal digit
+.Em d
 matches the same sequence of characters
-matched by the \fId\fRth parenthesized subexpression
+matched by the
+.Em d Ns th parenthesized subexpression
 (numbering subexpressions by the positions of their opening parentheses,
 left to right),
 so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
-.SH SEE ALSO
-regex(3)
-.PP
+.Sh SEE ALSO
+.Xr regex 3
+.Pp
 POSIX 1003.2, section 2.8 (Regular Expression Notation).
-.SH BUGS
+.Sh BUGS
 Having two kinds of REs is a botch.
-.PP
+.Pp
 The current 1003.2 spec says that `)' is an ordinary character in
 the absence of an unmatched `(';
-this was an unintentional result of a wording error,
-and change is likely.
+this was an unintentional result of a wording error, and change is likely.
 Avoid relying on it.
-.PP
+.Pp
 Back references are a dreadful botch,
 posing major problems for efficient implementations.
 They are also somewhat vaguely defined
-(does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
+(does `a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
 Avoid using them.
-.PP
+.Pp
 1003.2's specification of case-independent matching is vague.
 The ``one case implies all cases'' definition given above
 is current consensus among implementors as to the right interpretation.
-.PP
+.Pp
 The syntax for word boundaries is incredibly ugly.
index 9b616a8b5500714d7cb53ea42c53288eec22a304..fdaa6ac6f987730467c2eb73eb96cc65c0a753c8 100644 (file)
@@ -1,5 +1,6 @@
+/*     $NetBSD: regcomp.c,v 1.29 2009/02/12 05:06:54 lukem Exp $       */
+
 /*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * 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. 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.
+ *
+ *     @(#)regcomp.c   8.5 (Berkeley) 3/20/94
+ */
+
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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
  *     @(#)regcomp.c   8.5 (Berkeley) 3/20/94
  */
 
+#include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
+#if 0
 static char sccsid[] = "@(#)regcomp.c  8.5 (Berkeley) 3/20/94";
+#else
+__RCSID("$NetBSD: regcomp.c,v 1.29 2009/02/12 05:06:54 lukem Exp $");
+#endif
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
 #include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef __minix_vmd
-#include <bsd/asciictype.h>
-#else
+
+#include <assert.h>
 #include <ctype.h>
-#endif
 #include <limits.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <regex.h>
 
+#ifdef __weak_alias
+__weak_alias(regcomp,_regcomp)
+#endif
+
 #include "utils.h"
 #include "regex2.h"
 
@@ -64,8 +106,8 @@ static char sccsid[] = "@(#)regcomp.c        8.5 (Berkeley) 3/20/94";
  * other clumsinesses
  */
 struct parse {
-       char *next;             /* next character in RE */
-       char *end;              /* end of string (-> NUL normally) */
+       const char *next;       /* next character in RE */
+       const char *end;        /* end of string (-> NUL normally) */
        int error;              /* has an error been seen? */
        sop *strip;             /* malloced strip */
        sopno ssize;            /* malloced strip size (allocated) */
@@ -95,7 +137,7 @@ static void p_b_cclass(struct parse *p, cset *cs);
 static void p_b_eclass(struct parse *p, cset *cs);
 static char p_b_symbol(struct parse *p);
 static char p_b_coll_elem(struct parse *p, int endc);
-static char othercase(int ch);
+static int othercase(int ch);
 static void bothcases(struct parse *p, int ch);
 static void ordinary(struct parse *p, int ch);
 static void nonnewline(struct parse *p);
@@ -106,16 +148,21 @@ static void freeset(struct parse *p, cset *cs);
 static int freezeset(struct parse *p, cset *cs);
 static int firstch(struct parse *p, cset *cs);
 static int nch(struct parse *p, cset *cs);
-static void mcadd(struct parse *p, cset *cs, char *cp);
+static void mcadd(struct parse *p, cset *cs, const char *cp);
+#if 0
+static void mcsub(cset *cs, char *cp);
+static int mcin(cset *cs, char *cp);
+static char *mcfind(cset *cs, char *cp);
+#endif
 static void mcinvert(struct parse *p, cset *cs);
 static void mccase(struct parse *p, cset *cs);
 static int isinsets(struct re_guts *g, int c);
 static int samesets(struct re_guts *g, int c1, int c2);
 static void categorize(struct parse *p, struct re_guts *g);
 static sopno dupl(struct parse *p, sopno start, sopno finish);
-static void doemit(struct parse *p, sop op, size_t opnd);
-static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
-static void dofwd(struct parse *p, sopno pos, sop value);
+static void doemit(struct parse *p, sop op, sopno opnd);
+static void doinsert(struct parse *p, sop op, sopno opnd, sopno pos);
+static void dofwd(struct parse *p, sopno pos, sopno value);
 static void enlarge(struct parse *p, sopno size);
 static void stripsnug(struct parse *p, struct re_guts *g);
 static void findmust(struct parse *p, struct re_guts *g);
@@ -145,11 +192,11 @@ static char nuls[10];             /* place to point scanner in event of error */
 #define        NEXTn(n)        (p->next += (n))
 #define        GETNEXT()       (*p->next++)
 #define        SETERROR(e)     seterr(p, (e))
-#define        REQUIRE(co, e)  ((co) || SETERROR(e))
+#define        REQUIRE(co, e)  (void) ((co) || SETERROR(e))
 #define        MUSTSEE(c, e)   (REQUIRE(MORE() && PEEK() == (c), e))
-#define        MUSTEAT(c, e)   (REQUIRE(MORE() && GETNEXT() == (c), e))
+#define        MUSTEAT(c, e)   (void) (REQUIRE(MORE() && GETNEXT() == (c), e))
 #define        MUSTNOTSEE(c, e)        (REQUIRE(!MORE() || PEEK() != (c), e))
-#define        EMIT(op, sopnd) doemit(p, (sop)(op), (size_t)(sopnd))
+#define        EMIT(op, sopnd) doemit(p, (sop)(op), sopnd)
 #define        INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
 #define        AHEAD(pos)              dofwd(p, pos, HERE()-(pos))
 #define        ASTERN(sop, pos)        EMIT(sop, HERE()-pos)
@@ -177,22 +224,25 @@ static int never = 0;             /* for use in asserts; shuts lint up */
  = #define     REG_DUMP        0200
  */
 int                            /* 0 success, otherwise REG_something */
-regcomp(preg, pattern, cflags)
-regex_t *preg;
-const char *pattern;
-int cflags;
+regcomp(
+    regex_t *preg,
+    const char *pattern,
+    int cflags)
 {
        struct parse pa;
-       register struct re_guts *g;
-       register struct parse *p = &pa;
-       register int i;
-       register size_t len;
+       struct re_guts *g;
+       struct parse *p = &pa;
+       int i;
+       size_t len;
 #ifdef REDEBUG
 #      define  GOODFLAGS(f)    (f)
 #else
 #      define  GOODFLAGS(f)    ((f)&~REG_DUMP)
 #endif
 
+       _DIAGASSERT(preg != NULL);
+       _DIAGASSERT(pattern != NULL);
+
        cflags = GOODFLAGS(cflags);
        if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
                return(REG_INVARG);
@@ -202,7 +252,7 @@ int cflags;
                        return(REG_INVARG);
                len = preg->re_endp - pattern;
        } else
-               len = strlen((char *)pattern);
+               len = strlen(pattern);
 
        /* do the mallocs early so failure handling is easy */
        g = (struct re_guts *)malloc(sizeof(struct re_guts) +
@@ -213,13 +263,13 @@ int cflags;
        p->strip = (sop *)malloc(p->ssize * sizeof(sop));
        p->slen = 0;
        if (p->strip == NULL) {
-               free((char *)g);
+               free(g);
                return(REG_ESPACE);
        }
 
        /* set things up */
        p->g = g;
-       p->next = (char *)pattern;      /* convenience; we do not modify it */
+       p->next = pattern;
        p->end = p->next + len;
        p->error = 0;
        p->ncsalloc = 0;
@@ -278,18 +328,20 @@ int cflags;
 
 /*
  - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(register struct parse *p, int stop);
+ == static void p_ere(struct parse *p, int stop);
  */
 static void
-p_ere(p, stop)
-register struct parse *p;
-int stop;                      /* character this ERE should end at */
+p_ere(
+    struct parse *p,
+    int stop)                  /* character this ERE should end at */
 {
-       register char c;
-       register sopno prevback;
-       register sopno prevfwd;
-       register sopno conc;
-       register int first = 1;         /* is this the first alternative? */
+       char c;
+       sopno prevback = 0;     /* pacify gcc */
+       sopno prevfwd = 0;      /* pacify gcc */
+       sopno conc;
+       int first = 1;          /* is this the first alternative? */
+
+       _DIAGASSERT(p != NULL);
 
        for (;;) {
                /* do a bunch of concatenated expressions */
@@ -324,19 +376,21 @@ int stop;                 /* character this ERE should end at */
 
 /*
  - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(register struct parse *p);
+ == static void p_ere_exp(struct parse *p);
  */
 static void
-p_ere_exp(p)
-register struct parse *p;
+p_ere_exp(
+    struct parse *p)
 {
-       register char c;
-       register sopno pos;
-       register int count;
-       register int count2;
-       register sopno subno;
+       char c;
+       sopno pos;
+       int count;
+       int count2;
+       sopno subno;
        int wascaret = 0;
 
+       _DIAGASSERT(p != NULL);
+
        assert(MORE());         /* caller should have ensured this */
        c = GETNEXT();
 
@@ -404,7 +458,7 @@ register struct parse *p;
                ordinary(p, c);
                break;
        case '{':               /* okay as ordinary except if digit follows */
-               REQUIRE(!MORE() || !isdigit(PEEK()), REG_BADRPT);
+               REQUIRE(!MORE() || !isdigit((unsigned char)PEEK()), REG_BADRPT);
                /* FALLTHROUGH */
        default:
                ordinary(p, c);
@@ -416,7 +470,7 @@ register struct parse *p;
        c = PEEK();
        /* we call { a repetition if followed by a digit */
        if (!( c == '*' || c == '+' || c == '?' ||
-                               (c == '{' && MORE2() && isdigit(PEEK2())) ))
+           (c == '{' && MORE2() && isdigit((unsigned char)PEEK2())) ))
                return;         /* no repetition, we're done */
        NEXT();
 
@@ -445,7 +499,7 @@ register struct parse *p;
        case '{':
                count = p_count(p);
                if (EAT(',')) {
-                       if (isdigit(PEEK())) {
+                       if (isdigit((unsigned char)PEEK())) {
                                count2 = p_count(p);
                                REQUIRE(count <= count2, REG_BADBR);
                        } else          /* single number with comma */
@@ -466,19 +520,22 @@ register struct parse *p;
                return;
        c = PEEK();
        if (!( c == '*' || c == '+' || c == '?' ||
-                               (c == '{' && MORE2() && isdigit(PEEK2())) ) )
+           (c == '{' && MORE2() && isdigit((unsigned char)PEEK2())) ) )
                return;
        SETERROR(REG_BADRPT);
 }
 
 /*
  - p_str - string (no metacharacters) "parser"
- == static void p_str(register struct parse *p);
+ == static void p_str(struct parse *p);
  */
 static void
-p_str(p)
-register struct parse *p;
+p_str(
+    struct parse *p)
 {
+
+       _DIAGASSERT(p != NULL);
+
        REQUIRE(MORE(), REG_EMPTY);
        while (MORE())
                ordinary(p, GETNEXT());
@@ -486,8 +543,8 @@ register struct parse *p;
 
 /*
  - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(register struct parse *p, register int end1, \
- ==    register int end2);
+ == static void p_bre(struct parse *p, int end1, \
+ ==    int end2);
  * Giving end1 as OUT essentially eliminates the end1/end2 check.
  *
  * This implementation is a bit of a kludge, in that a trailing $ is first
@@ -497,14 +554,18 @@ register struct parse *p;
  * The amount of lookahead needed to avoid this kludge is excessive.
  */
 static void
-p_bre(p, end1, end2)
-register struct parse *p;
-register int end1;             /* first terminating character */
-register int end2;             /* second terminating character */
+p_bre(
+    struct parse *p,
+    int end1,          /* first terminating character */
+    int end2)          /* second terminating character */
 {
-       register sopno start = HERE();
-       register int first = 1;                 /* first subexpression? */
-       register int wasdollar = 0;
+       sopno start;
+       int first = 1;                  /* first subexpression? */
+       int wasdollar = 0;
+
+       _DIAGASSERT(p != NULL);
+
+       start = HERE();
 
        if (EAT('^')) {
                EMIT(OBOL, 0);
@@ -527,21 +588,23 @@ register int end2;                /* second terminating character */
 
 /*
  - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(register struct parse *p, int starordinary);
+ == static int p_simp_re(struct parse *p, int starordinary);
  */
 static int                     /* was the simple RE an unbackslashed $? */
-p_simp_re(p, starordinary)
-register struct parse *p;
-int starordinary;              /* is a leading * an ordinary character? */
+p_simp_re(
+    struct parse *p,
+    int starordinary)          /* is a leading * an ordinary character? */
 {
-       register int c;
-       register int count;
-       register int count2;
-       register sopno pos;
-       register int i;
-       register sopno subno;
+       int c;
+       int count;
+       int count2;
+       sopno pos;
+       int i;
+       sopno subno;
 #      define  BACKSL  (1<<CHAR_BIT)
 
+       _DIAGASSERT(p != NULL);
+
        pos = HERE();           /* repetion op, if any, covers from here */
 
        assert(MORE());         /* caller should have ensured this */
@@ -623,7 +686,7 @@ int starordinary;           /* is a leading * an ordinary character? */
        } else if (EATTWO('\\', '{')) {
                count = p_count(p);
                if (EAT(',')) {
-                       if (MORE() && isdigit(PEEK())) {
+                       if (MORE() && isdigit((unsigned char)PEEK())) {
                                count2 = p_count(p);
                                REQUIRE(count <= count2, REG_BADBR);
                        } else          /* single number with comma */
@@ -645,16 +708,18 @@ int starordinary;         /* is a leading * an ordinary character? */
 
 /*
  - p_count - parse a repetition count
- == static int p_count(register struct parse *p);
+ == static int p_count(struct parse *p);
  */
 static int                     /* the value */
-p_count(p)
-register struct parse *p;
+p_count(
+    struct parse *p)
 {
-       register int count = 0;
-       register int ndigits = 0;
+       int count = 0;
+       int ndigits = 0;
 
-       while (MORE() && isdigit(PEEK()) && count <= DUPMAX) {
+       _DIAGASSERT(p != NULL);
+
+       while (MORE() && isdigit((unsigned char)PEEK()) && count <= DUPMAX) {
                count = count*10 + (GETNEXT() - '0');
                ndigits++;
        }
@@ -665,25 +730,31 @@ register struct parse *p;
 
 /*
  - p_bracket - parse a bracketed character list
- == static void p_bracket(register struct parse *p);
+ == static void p_bracket(struct parse *p);
  *
  * Note a significant property of this code:  if the allocset() did SETERROR,
  * no set operations are done.
  */
 static void
-p_bracket(p)
-register struct parse *p;
+p_bracket(
+    struct parse *p)
 {
-       register cset *cs = allocset(p);
-       register int invert = 0;
+       cset *cs;
+       int invert = 0;
+
+       _DIAGASSERT(p != NULL);
+
+       cs = allocset(p);
 
        /* Dept of Truly Sickening Special-Case Kludges */
-       if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]", 6) == 0) {
+       if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]",
+                                           (size_t)6) == 0) {
                EMIT(OBOW, 0);
                NEXTn(6);
                return;
        }
-       if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]", 6) == 0) {
+       if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]",
+                                           (size_t)6) == 0) {
                EMIT(OEOW, 0);
                NEXTn(6);
                return;
@@ -705,8 +776,8 @@ register struct parse *p;
                return;
 
        if (p->g->cflags&REG_ICASE) {
-               register int i;
-               register int ci;
+               int i;
+               int ci;
 
                for (i = p->g->csetsize - 1; i >= 0; i--)
                        if (CHIN(cs, i) && isalpha(i)) {
@@ -718,7 +789,7 @@ register struct parse *p;
                        mccase(p, cs);
        }
        if (invert) {
-               register int i;
+               int i;
 
                for (i = p->g->csetsize - 1; i >= 0; i--)
                        if (CHIN(cs, i))
@@ -742,26 +813,30 @@ register struct parse *p;
 
 /*
  - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(register struct parse *p, register cset *cs);
+ == static void p_b_term(struct parse *p, cset *cs);
  */
 static void
-p_b_term(p, cs)
-register struct parse *p;
-register cset *cs;
+p_b_term(
+    struct parse *p,
+    cset *cs)
 {
-       register char c;
-       register char start, finish;
-       register int i;
+       char c;
+       char start, finish;
+       int i;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(cs != NULL);
 
        /* classify what we've got */
        switch ((MORE()) ? PEEK() : '\0') {
        case '[':
                c = (MORE2()) ? PEEK2() : '\0';
                break;
+
        case '-':
                SETERROR(REG_ERANGE);
                return;                 /* NOTE RETURN */
-               break;
+
        default:
                c = '\0';
                break;
@@ -808,20 +883,25 @@ register cset *cs;
 
 /*
  - p_b_cclass - parse a character-class name and deal with it
- == static void p_b_cclass(register struct parse *p, register cset *cs);
+ == static void p_b_cclass(struct parse *p, cset *cs);
  */
 static void
-p_b_cclass(p, cs)
-register struct parse *p;
-register cset *cs;
+p_b_cclass(
+    struct parse *p,
+    cset *cs)
 {
-       register char *sp = p->next;
-       register struct cclass *cp;
-       register size_t len;
-       register char *u;
-       register char c;
+       const char *sp;
+       const struct cclass *cp;
+       size_t len;
+       const char *u;
+       char c;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(cs != NULL);
+
+       sp = p->next;
 
-       while (MORE() && isalpha((unsigned char) (PEEK())))
+       while (MORE() && isalpha((unsigned char)PEEK()))
                NEXT();
        len = p->next - sp;
        for (cp = cclasses; cp->name != NULL; cp++)
@@ -842,16 +922,19 @@ register cset *cs;
 
 /*
  - p_b_eclass - parse an equivalence-class name and deal with it
- == static void p_b_eclass(register struct parse *p, register cset *cs);
+ == static void p_b_eclass(struct parse *p, cset *cs);
  *
  * This implementation is incomplete. xxx
  */
 static void
-p_b_eclass(p, cs)
-register struct parse *p;
-register cset *cs;
+p_b_eclass(
+    struct parse *p,
+    cset *cs)
 {
-       register char c;
+       char c;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(cs != NULL);
 
        c = p_b_coll_elem(p, '=');
        CHadd(cs, c);
@@ -859,13 +942,15 @@ register cset *cs;
 
 /*
  - p_b_symbol - parse a character or [..]ed multicharacter collating symbol
- == static char p_b_symbol(register struct parse *p);
+ == static char p_b_symbol(struct parse *p);
  */
 static char                    /* value of symbol */
-p_b_symbol(p)
-register struct parse *p;
+p_b_symbol(
+    struct parse *p)
 {
-       register char value;
+       char value;
+
+       _DIAGASSERT(p != NULL);
 
        REQUIRE(MORE(), REG_EBRACK);
        if (!EATTWO('[', '.'))
@@ -879,16 +964,20 @@ register struct parse *p;
 
 /*
  - p_b_coll_elem - parse a collating-element name and look it up
- == static char p_b_coll_elem(register struct parse *p, int endc);
+ == static char p_b_coll_elem(struct parse *p, int endc);
  */
 static char                    /* value of collating element */
-p_b_coll_elem(p, endc)
-register struct parse *p;
-int endc;                      /* name ended by endc,']' */
+p_b_coll_elem(
+    struct parse *p,
+    int endc)                  /* name ended by endc,']' */
 {
-       register char *sp = p->next;
-       register struct cname *cp;
-       register int len;
+       const char *sp;
+       const struct cname *cp;
+       size_t len;
+
+       _DIAGASSERT(p != NULL);
+
+       sp = p->next;
 
        while (MORE() && !SEETWO(endc, ']'))
                NEXT();
@@ -908,11 +997,11 @@ int endc;                 /* name ended by endc,']' */
 
 /*
  - othercase - return the case counterpart of an alphabetic
- == static char othercase(int ch);
+ == static int othercase(int ch);
  */
-static char                    /* if no counterpart, return ch */
-othercase(ch)
-int ch;
+static int                     /* if no counterpart, return ch */
+othercase(
+    int ch)
 {
        assert(isalpha(ch));
        if (isupper(ch))
@@ -925,19 +1014,24 @@ int ch;
 
 /*
  - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(register struct parse *p, int ch);
+ == static void bothcases(struct parse *p, int ch);
  *
  * Boy, is this implementation ever a kludge...
  */
 static void
-bothcases(p, ch)
-register struct parse *p;
-int ch;
+bothcases(
+    struct parse *p,
+    int ch)
 {
-       register char *oldnext = p->next;
-       register char *oldend = p->end;
+       const char *oldnext;
+       const char *oldend;
        char bracket[3];
 
+       _DIAGASSERT(p != NULL);
+
+       oldnext = p->next;
+       oldend = p->end;
+
        assert(othercase(ch) != ch);    /* p_bracket() would recurse */
        p->next = bracket;
        p->end = bracket+2;
@@ -952,17 +1046,21 @@ int ch;
 
 /*
  - ordinary - emit an ordinary character
- == static void ordinary(register struct parse *p, register int ch);
+ == static void ordinary(struct parse *p, int ch);
  */
 static void
-ordinary(p, ch)
-register struct parse *p;
-register int ch;
+ordinary(
+    struct parse *p,
+    int ch)
 {
-       register cat_t *cap = p->g->categories;
+       cat_t *cap;
+
+       _DIAGASSERT(p != NULL);
 
-       if ((p->g->cflags&REG_ICASE) && isalpha(ch) && othercase(ch) != ch)
-               bothcases(p, ch);
+       cap = p->g->categories;
+       if ((p->g->cflags&REG_ICASE) && isalpha((unsigned char) ch)
+           && othercase((unsigned char) ch) != (unsigned char) ch)
+               bothcases(p, (unsigned char) ch);
        else {
                EMIT(OCHAR, (unsigned char)ch);
                if (cap[ch] == 0)
@@ -972,18 +1070,23 @@ register int ch;
 
 /*
  - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(register struct parse *p);
+ == static void nonnewline(struct parse *p);
  *
  * Boy, is this implementation ever a kludge...
  */
 static void
-nonnewline(p)
-register struct parse *p;
+nonnewline(
+    struct parse *p)
 {
-       register char *oldnext = p->next;
-       register char *oldend = p->end;
+       const char *oldnext;
+       const char *oldend;
        char bracket[4];
 
+       _DIAGASSERT(p != NULL);
+
+       oldnext = p->next;
+       oldend = p->end;
+
        p->next = bracket;
        p->end = bracket+3;
        bracket[0] = '^';
@@ -998,21 +1101,25 @@ register struct parse *p;
 
 /*
  - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(register struct parse *p, sopno start, int from, int to);
+ == static void repeat(struct parse *p, sopno start, int from, int to);
  */
 static void
-repeat(p, start, from, to)
-register struct parse *p;
-sopno start;                   /* operand from here to end of strip */
-int from;                      /* repeated from this number */
-int to;                                /* to this number of times (maybe INFINITY) */
+repeat(
+    struct parse *p,
+    sopno start,               /* operand from here to end of strip */
+    int from,                  /* repeated from this number */
+    int to)                    /* to this number of times (maybe INFINITY) */
 {
-       register sopno finish = HERE();
+       sopno finish;
 #      define  N       2
 #      define  INF     3
 #      define  REP(f, t)       ((f)*8 + (t))
 #      define  MAP(n)  (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
-       register sopno copy;
+       sopno copy;
+
+       _DIAGASSERT(p != NULL);
+
+       finish = HERE();
 
        if (p->error != 0)      /* head off possible runaway recursion */
                return;
@@ -1070,13 +1177,16 @@ int to;                         /* to this number of times (maybe INFINITY) */
 
 /*
  - seterr - set an error condition
- == static int seterr(register struct parse *p, int e);
+ == static int seterr(struct parse *p, int e);
  */
 static int                     /* useless but makes type checking happy */
-seterr(p, e)
-register struct parse *p;
-int e;
+seterr(
+    struct parse *p,
+    int e)
 {
+
+       _DIAGASSERT(p != NULL);
+
        if (p->error == 0)      /* keep earliest error condition */
                p->error = e;
        p->next = nuls;         /* try to bring things to a halt */
@@ -1086,34 +1196,36 @@ int e;
 
 /*
  - allocset - allocate a set of characters for []
- == static cset *allocset(register struct parse *p);
+ == static cset *allocset(struct parse *p);
  */
 static cset *
-allocset(p)
-register struct parse *p;
+allocset(
+    struct parse *p)
 {
-       register int no = p->g->ncsets++;
-       register size_t nc;
-       register size_t nbytes;
-       register cset *cs;
-       register size_t css = (size_t)p->g->csetsize;
-       register int i;
+       int no;
+       size_t nc;
+       size_t nbytes;
+       cset *cs;
+       size_t css;
+       int i;
+
+       _DIAGASSERT(p != NULL);
 
+       no = p->g->ncsets++;
+       css = (size_t)p->g->csetsize;
        if (no >= p->ncsalloc) {        /* need another column of space */
                p->ncsalloc += CHAR_BIT;
                nc = p->ncsalloc;
                assert(nc % CHAR_BIT == 0);
                nbytes = nc / CHAR_BIT * css;
                if (p->g->sets == NULL)
-                       p->g->sets = (cset *)malloc(nc * sizeof(cset));
+                       p->g->sets = malloc(nc * sizeof(cset));
                else
-                       p->g->sets = (cset *)realloc((char *)p->g->sets,
-                                                       nc * sizeof(cset));
+                       p->g->sets = realloc(p->g->sets, nc * sizeof(cset));
                if (p->g->setbits == NULL)
-                       p->g->setbits = (uch *)malloc(nbytes);
+                       p->g->setbits = malloc(nbytes);
                else {
-                       p->g->setbits = (uch *)realloc((char *)p->g->setbits,
-                                                               nbytes);
+                       p->g->setbits = realloc(p->g->setbits, nbytes);
                        /* xxx this isn't right if setbits is now NULL */
                        for (i = 0; i < no; i++)
                                p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
@@ -1141,16 +1253,22 @@ register struct parse *p;
 
 /*
  - freeset - free a now-unused set
- == static void freeset(register struct parse *p, register cset *cs);
+ == static void freeset(struct parse *p, cset *cs);
  */
 static void
-freeset(p, cs)
-register struct parse *p;
-register cset *cs;
+freeset(
+    struct parse *p,
+    cset *cs)
 {
-       register int i;
-       register cset *top = &p->g->sets[p->g->ncsets];
-       register size_t css = (size_t)p->g->csetsize;
+       size_t i;
+       cset *top;
+       size_t css;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(cs != NULL);
+
+       top = &p->g->sets[p->g->ncsets];
+       css = (size_t)p->g->csetsize;
 
        for (i = 0; i < css; i++)
                CHsub(cs, i);
@@ -1160,7 +1278,7 @@ register cset *cs;
 
 /*
  - freezeset - final processing on a set of characters
- == static int freezeset(register struct parse *p, register cset *cs);
+ == static int freezeset(struct parse *p, cset *cs);
  *
  * The main task here is merging identical sets.  This is usually a waste
  * of time (although the hash code minimizes the overhead), but can win
@@ -1169,15 +1287,22 @@ register cset *cs;
  * the same value!
  */
 static int                     /* set number */
-freezeset(p, cs)
-register struct parse *p;
-register cset *cs;
+freezeset(
+    struct parse *p,
+    cset *cs)
 {
-       register uch h = cs->hash;
-       register int i;
-       register cset *top = &p->g->sets[p->g->ncsets];
-       register cset *cs2;
-       register size_t css = (size_t)p->g->csetsize;
+       uch h;
+       size_t i;
+       cset *top;
+       cset *cs2;
+       size_t css;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(cs != NULL);
+
+       h = cs->hash;
+       top = &p->g->sets[p->g->ncsets];
+       css = (size_t)p->g->csetsize;
 
        /* look for an earlier one which is the same */
        for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
@@ -1200,15 +1325,20 @@ register cset *cs;
 
 /*
  - firstch - return first character in a set (which must have at least one)
- == static int firstch(register struct parse *p, register cset *cs);
+ == static int firstch(struct parse *p, cset *cs);
  */
 static int                     /* character; there is no "none" value */
-firstch(p, cs)
-register struct parse *p;
-register cset *cs;
+firstch(
+    struct parse *p,
+    cset *cs)
 {
-       register int i;
-       register size_t css = (size_t)p->g->csetsize;
+       size_t i;
+       size_t css;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(cs != NULL);
+
+       css = (size_t)p->g->csetsize;
 
        for (i = 0; i < css; i++)
                if (CHIN(cs, i))
@@ -1219,16 +1349,21 @@ register cset *cs;
 
 /*
  - nch - number of characters in a set
- == static int nch(register struct parse *p, register cset *cs);
+ == static int nch(struct parse *p, cset *cs);
  */
 static int
-nch(p, cs)
-register struct parse *p;
-register cset *cs;
+nch(
+    struct parse *p,
+    cset *cs)
 {
-       register int i;
-       register size_t css = (size_t)p->g->csetsize;
-       register int n = 0;
+       size_t i;
+       size_t css;
+       int n = 0;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(cs != NULL);
+
+       css = (size_t)p->g->csetsize;
 
        for (i = 0; i < css; i++)
                if (CHIN(cs, i))
@@ -1238,16 +1373,22 @@ register cset *cs;
 
 /*
  - mcadd - add a collating element to a cset
- == static void mcadd(register struct parse *p, register cset *cs, \
- ==    register char *cp);
+ == static void mcadd(struct parse *p, cset *cs, \
+ ==    char *cp);
  */
 static void
-mcadd(p, cs, cp)
-register struct parse *p;
-register cset *cs;
-register char *cp;
+mcadd(
+    struct parse *p,
+    cset *cs,
+    const char *cp)
 {
-       register size_t oldend = cs->smultis;
+       size_t oldend;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(cs != NULL);
+       _DIAGASSERT(cp != NULL);
+
+       oldend = cs->smultis;
 
        cs->smultis += strlen(cp) + 1;
        if (cs->multis == NULL)
@@ -1263,49 +1404,136 @@ register char *cp;
        cs->multis[cs->smultis - 1] = '\0';
 }
 
+#if 0
+/*
+ - mcsub - subtract a collating element from a cset
+ == static void mcsub(cset *cs, char *cp);
+ */
+static void
+mcsub(
+    cset *cs,
+    char *cp)
+{
+       char *fp;
+       size_t len;
+
+       _DIAGASSERT(cs != NULL);
+       _DIAGASSERT(cp != NULL);
+
+       fp = mcfind(cs, cp);
+       len = strlen(fp);
+
+       assert(fp != NULL);
+       (void) memmove(fp, fp + len + 1,
+                               cs->smultis - (fp + len + 1 - cs->multis));
+       cs->smultis -= len;
+
+       if (cs->smultis == 0) {
+               free(cs->multis);
+               cs->multis = NULL;
+               return;
+       }
+
+       cs->multis = realloc(cs->multis, cs->smultis);
+       assert(cs->multis != NULL);
+}
+
+/*
+ - mcin - is a collating element in a cset?
+ == static int mcin(cset *cs, char *cp);
+ */
+static int
+mcin(
+    cset *cs,
+    char *cp)
+{
+
+       _DIAGASSERT(cs != NULL);
+       _DIAGASSERT(cp != NULL);
+
+       return(mcfind(cs, cp) != NULL);
+}
+
+/*
+ - mcfind - find a collating element in a cset
+ == static char *mcfind(cset *cs, char *cp);
+ */
+static char *
+mcfind(
+    cset *cs,
+    char *cp)
+{
+       char *p;
+
+       _DIAGASSERT(cs != NULL);
+       _DIAGASSERT(cp != NULL);
+
+       if (cs->multis == NULL)
+               return(NULL);
+       for (p = cs->multis; *p != '\0'; p += strlen(p) + 1)
+               if (strcmp(cp, p) == 0)
+                       return(p);
+       return(NULL);
+}
+#endif
+
 /*
  - mcinvert - invert the list of collating elements in a cset
- == static void mcinvert(register struct parse *p, register cset *cs);
+ == static void mcinvert(struct parse *p, cset *cs);
  *
  * This would have to know the set of possibilities.  Implementation
  * is deferred.
  */
+/* ARGSUSED */
 static void
-mcinvert(p, cs)
-register struct parse *p;
-register cset *cs;
+mcinvert(
+    struct parse *p,
+    cset *cs)
 {
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(cs != NULL);
+
        assert(cs->multis == NULL);     /* xxx */
 }
 
 /*
  - mccase - add case counterparts of the list of collating elements in a cset
- == static void mccase(register struct parse *p, register cset *cs);
+ == static void mccase(struct parse *p, cset *cs);
  *
  * This would have to know the set of possibilities.  Implementation
  * is deferred.
  */
+/* ARGSUSED */
 static void
-mccase(p, cs)
-register struct parse *p;
-register cset *cs;
+mccase(
+    struct parse *p,
+    cset *cs)
 {
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(cs != NULL);
+
        assert(cs->multis == NULL);     /* xxx */
 }
 
 /*
  - isinsets - is this character in any sets?
- == static int isinsets(register struct re_guts *g, int c);
+ == static int isinsets(struct re_guts *g, int c);
  */
 static int                     /* predicate */
-isinsets(g, c)
-register struct re_guts *g;
-int c;
+isinsets(
+    struct re_guts *g,
+    int c)
 {
-       register uch *col;
-       register int i;
-       register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
-       register unsigned uc = (unsigned char)c;
+       uch *col;
+       int i;
+       int ncols;
+       unsigned uc = (unsigned char)c;
+
+       _DIAGASSERT(g != NULL);
+
+       ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
 
        for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
                if (col[uc] != 0)
@@ -1315,19 +1543,23 @@ int c;
 
 /*
  - samesets - are these two characters in exactly the same sets?
- == static int samesets(register struct re_guts *g, int c1, int c2);
+ == static int samesets(struct re_guts *g, int c1, int c2);
  */
 static int                     /* predicate */
-samesets(g, c1, c2)
-register struct re_guts *g;
-int c1;
-int c2;
+samesets(
+    struct re_guts *g,
+    int c1,
+    int c2)
 {
-       register uch *col;
-       register int i;
-       register int ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
-       register unsigned uc1 = (unsigned char)c1;
-       register unsigned uc2 = (unsigned char)c2;
+       uch *col;
+       int i;
+       int ncols;
+       unsigned uc1 = (unsigned char)c1;
+       unsigned uc2 = (unsigned char)c2;
+
+       _DIAGASSERT(g != NULL);
+
+       ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
 
        for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
                if (col[uc1] != col[uc2])
@@ -1337,17 +1569,22 @@ int c2;
 
 /*
  - categorize - sort out character categories
- == static void categorize(struct parse *p, register struct re_guts *g);
+ == static void categorize(struct parse *p, struct re_guts *g);
  */
 static void
-categorize(p, g)
-struct parse *p;
-register struct re_guts *g;
+categorize(
+    struct parse *p,
+    struct re_guts *g)
 {
-       register cat_t *cats = g->categories;
-       register int c;
-       register int c2;
-       register cat_t cat;
+       cat_t *cats;
+       int c;
+       int c2;
+       cat_t cat;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(g != NULL);
+
+       cats = g->categories;
 
        /* avoid making error situations worse */
        if (p->error != 0)
@@ -1365,42 +1602,49 @@ register struct re_guts *g;
 
 /*
  - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(register struct parse *p, sopno start, sopno finish);
+ == static sopno dupl(struct parse *p, sopno start, sopno finish);
  */
 static sopno                   /* start of duplicate */
-dupl(p, start, finish)
-register struct parse *p;
-sopno start;                   /* from here */
-sopno finish;                  /* to this less one */
+dupl(
+    struct parse *p,
+    sopno start,                       /* from here */
+    sopno finish)                      /* to this less one */
 {
-       register sopno ret = HERE();
-       register sopno len = finish - start;
+       sopno ret;
+       sopno len = finish - start;
+
+       _DIAGASSERT(p != NULL);
+
+       ret = HERE();
 
        assert(finish >= start);
        if (len == 0)
                return(ret);
        enlarge(p, p->ssize + len);     /* this many unexpected additions */
        assert(p->ssize >= p->slen + len);
-       (void) memcpy((char *)(p->strip + p->slen),
-               (char *)(p->strip + start), (size_t)len*sizeof(sop));
+       (void)memcpy(p->strip + p->slen, p->strip + start,
+           (size_t)len * sizeof(sop));
        p->slen += len;
        return(ret);
 }
 
 /*
  - doemit - emit a strip operator
- == static void doemit(register struct parse *p, sop op, size_t opnd);
+ == static void doemit(struct parse *p, sop op, size_t opnd);
  *
  * It might seem better to implement this as a macro with a function as
  * hard-case backup, but it's just too big and messy unless there are
  * some changes to the data structures.  Maybe later.
  */
 static void
-doemit(p, op, opnd)
-register struct parse *p;
-sop op;
-size_t opnd;
+doemit(
+    struct parse *p,
+    sop op,
+    sopno opnd)
 {
+
+       _DIAGASSERT(p != NULL);
+
        /* avoid making error situations worse */
        if (p->error != 0)
                return;
@@ -1419,18 +1663,20 @@ size_t opnd;
 
 /*
  - doinsert - insert a sop into the strip
- == static void doinsert(register struct parse *p, sop op, size_t opnd, sopno pos);
+ == static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
  */
 static void
-doinsert(p, op, opnd, pos)
-register struct parse *p;
-sop op;
-size_t opnd;
-sopno pos;
+doinsert(
+    struct parse *p,
+    sop op,
+    sopno opnd,
+    sopno pos)
 {
-       register sopno sn;
-       register sop s;
-       register int i;
+       sopno sn;
+       sop s;
+       int i;
+
+       _DIAGASSERT(p != NULL);
 
        /* avoid making error situations worse */
        if (p->error != 0)
@@ -1452,21 +1698,23 @@ sopno pos;
                }
        }
 
-       memmove((char *)&p->strip[pos+1], (char *)&p->strip[pos],
-                                               (HERE()-pos-1)*sizeof(sop));
+       memmove(&p->strip[pos+1], &p->strip[pos], (HERE()-pos-1)*sizeof(sop));
        p->strip[pos] = s;
 }
 
 /*
  - dofwd - complete a forward reference
- == static void dofwd(register struct parse *p, sopno pos, sop value);
+ == static void dofwd(struct parse *p, sopno pos, sop value);
  */
 static void
-dofwd(p, pos, value)
-register struct parse *p;
-register sopno pos;
-sop value;
+dofwd(
+    struct parse *p,
+    sopno pos,
+    sopno value)
 {
+
+       _DIAGASSERT(p != NULL);
+
        /* avoid making error situations worse */
        if (p->error != 0)
                return;
@@ -1477,14 +1725,16 @@ sop value;
 
 /*
  - enlarge - enlarge the strip
- == static void enlarge(register struct parse *p, sopno size);
+ == static void enlarge(struct parse *p, sopno size);
  */
 static void
-enlarge(p, size)
-register struct parse *p;
-register sopno size;
+enlarge(
+    struct parse *p,
+    sopno size)
 {
-       register sop *sp;
+       sop *sp;
+
+       _DIAGASSERT(p != NULL);
 
        if (p->ssize >= size)
                return;
@@ -1500,15 +1750,19 @@ register sopno size;
 
 /*
  - stripsnug - compact the strip
- == static void stripsnug(register struct parse *p, register struct re_guts *g);
+ == static void stripsnug(struct parse *p, struct re_guts *g);
  */
 static void
-stripsnug(p, g)
-register struct parse *p;
-register struct re_guts *g;
+stripsnug(
+    struct parse *p,
+    struct re_guts *g)
 {
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(g != NULL);
+
        g->nstates = p->slen;
-       g->strip = (sop *)realloc((char *)p->strip, p->slen * sizeof(sop));
+       g->strip = realloc(p->strip, p->slen * sizeof(sop));
        if (g->strip == NULL) {
                SETERROR(REG_ESPACE);
                g->strip = p->strip;
@@ -1517,7 +1771,7 @@ register struct re_guts *g;
 
 /*
  - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(register struct parse *p, register struct re_guts *g);
+ == static void findmust(struct parse *p, struct re_guts *g);
  *
  * This algorithm could do fancy things like analyzing the operands of |
  * for common subsequences.  Someday.  This code is simple and finds most
@@ -1526,17 +1780,20 @@ register struct re_guts *g;
  * Note that must and mlen got initialized during setup.
  */
 static void
-findmust(p, g)
-struct parse *p;
-register struct re_guts *g;
+findmust(
+    struct parse *p,
+    struct re_guts *g)
 {
-       register sop *scan;
-       sop *start;
-       register sop *newstart;
-       register sopno newlen;
-       register sop s;
-       register char *cp;
-       register sopno i;
+       sop *scan;
+       sop *start = NULL;
+       sop *newstart = NULL;
+       sopno newlen;
+       sop s;
+       char *cp;
+       sopno i;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(g != NULL);
 
        /* avoid making error situations worse */
        if (p->error != 0)
@@ -1570,7 +1827,7 @@ register struct re_guts *g;
                                        return;
                                }
                        } while (OP(s) != O_QUEST && OP(s) != O_CH);
-                       /* fallthrough */
+                       /* FALLTHROUGH */
                default:                /* things that break a sequence */
                        if (newlen > g->mlen) {         /* ends one */
                                start = newstart;
@@ -1581,7 +1838,10 @@ register struct re_guts *g;
                }
        } while (OP(s) != OEND);
 
-       if (g->mlen == 0)               /* there isn't one */
+       if (start == NULL)
+               g->mlen = 0;
+
+       if (g->mlen == 0)       /* there isn't one */
                return;
 
        /* turn it into a character string */
@@ -1604,17 +1864,20 @@ register struct re_guts *g;
 
 /*
  - pluscount - count + nesting
- == static sopno pluscount(register struct parse *p, register struct re_guts *g);
+ == static sopno pluscount(struct parse *p, struct re_guts *g);
  */
 static sopno                   /* nesting depth */
-pluscount(p, g)
-struct parse *p;
-register struct re_guts *g;
+pluscount(
+    struct parse *p,
+    struct re_guts *g)
 {
-       register sop *scan;
-       register sop s;
-       register sopno plusnest = 0;
-       register sopno maxnest = 0;
+       sop *scan;
+       sop s;
+       sopno plusnest = 0;
+       sopno maxnest = 0;
+
+       _DIAGASSERT(p != NULL);
+       _DIAGASSERT(g != NULL);
 
        if (p->error != 0)
                return(0);      /* there may not be an OEND */
@@ -1637,7 +1900,3 @@ register struct re_guts *g;
                g->iflags |= BAD;
        return(maxnest);
 }
-
-/*
- * $PchId: regcomp.c,v 1.2 1996/03/12 19:10:15 philip Exp $
- */
index c207cb1e82bdd978e15ff8af3ebfc39e68d15eec..e00d7c035f4ae5272355700e591eec1c0f70ec17 100644 (file)
@@ -1,5 +1,6 @@
+/*     $NetBSD: regerror.c,v 1.23 2007/02/09 23:44:18 junyoung Exp $   */
+
 /*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * 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. 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.
+ *
+ *     @(#)regerror.c  8.4 (Berkeley) 3/20/94
+ */
+
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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
  *     @(#)regerror.c  8.4 (Berkeley) 3/20/94
  */
 
+#include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
+#if 0
 static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
+#else
+__RCSID("$NetBSD: regerror.c,v 1.23 2007/02/09 23:44:18 junyoung Exp $");
+#endif
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
 #include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#ifdef __minix_vmd
-#include <bsd/asciictype.h>
-#else
+
+#include <assert.h>
 #include <ctype.h>
-#endif
+#include <limits.h>
+#include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <regex.h>
 
+#ifdef __weak_alias
+__weak_alias(regerror,_regerror)
+#endif
+
 #include "utils.h"
 
 /* ========= begin header generated by ./mkh ========= */
@@ -60,7 +103,7 @@ extern "C" {
 #endif
 
 /* === regerror.c === */
-static char *regatoi(const regex_t *preg, char *localbuf);
+static const char *regatoi(const regex_t *preg, char *localbuf, size_t buflen);
 
 #ifdef __cplusplus
 }
@@ -86,100 +129,95 @@ static char *regatoi(const regex_t *preg, char *localbuf);
  = #define     REG_ATOI        255     // convert name to number (!)
  = #define     REG_ITOA        0400    // convert number to name (!)
  */
-static struct rerr {
+static const struct rerr {
        int code;
-       char *name;
-       char *explain;
+       const char *name;
+       const char *explain;
 } rerrs[] = {
-       {       REG_NOMATCH,    "REG_NOMATCH",  "regexec() failed to match" },
-       {       REG_BADPAT,     "REG_BADPAT",   "invalid regular expression" },
-       {       REG_ECOLLATE,   "REG_ECOLLATE", "invalid collating element" },
-       {       REG_ECTYPE,     "REG_ECTYPE",   "invalid character class" },
-       {       REG_EESCAPE,    "REG_EESCAPE",  "trailing backslash (\\)" },
-       {       REG_ESUBREG,    "REG_ESUBREG",  "invalid backreference number" },
-       {       REG_EBRACK,     "REG_EBRACK",   "brackets ([ ]) not balanced" },
-       {       REG_EPAREN,     "REG_EPAREN",   "parentheses not balanced" },
-       {       REG_EBRACE,     "REG_EBRACE",   "braces not balanced" },
-       {       REG_BADBR,      "REG_BADBR",    "invalid repetition count(s)" },
-       {       REG_ERANGE,     "REG_ERANGE",   "invalid character range" },
-       {       REG_ESPACE,     "REG_ESPACE",   "out of memory" },
-       {       REG_BADRPT,     "REG_BADRPT",   "repetition-operator operand invalid" },
-       {       REG_EMPTY,      "REG_EMPTY",    "empty (sub)expression" },
-       {       REG_ASSERT,     "REG_ASSERT",   "\"can't happen\" -- you found a bug" },
-       {       REG_INVARG,     "REG_INVARG",   "invalid argument to regex routine" },
-       {       0,              "",             "*** unknown regexp error code ***" }
+       { REG_NOMATCH,  "REG_NOMATCH",  "regexec() failed to match" },
+       { REG_BADPAT,   "REG_BADPAT",   "invalid regular expression" },
+       { REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" },
+       { REG_ECTYPE,   "REG_ECTYPE",   "invalid character class" },
+       { REG_EESCAPE,  "REG_EESCAPE",  "trailing backslash (\\)" },
+       { REG_ESUBREG,  "REG_ESUBREG",  "invalid backreference number" },
+       { REG_EBRACK,   "REG_EBRACK",   "brackets ([ ]) not balanced" },
+       { REG_EPAREN,   "REG_EPAREN",   "parentheses not balanced" },
+       { REG_EBRACE,   "REG_EBRACE",   "braces not balanced" },
+       { REG_BADBR,    "REG_BADBR",    "invalid repetition count(s)" },
+       { REG_ERANGE,   "REG_ERANGE",   "invalid character range" },
+       { REG_ESPACE,   "REG_ESPACE",   "out of memory" },
+       { REG_BADRPT,   "REG_BADRPT",   "repetition-operator operand invalid" },
+       { REG_EMPTY,    "REG_EMPTY",    "empty (sub)expression" },
+       { REG_ASSERT,   "REG_ASSERT",   "\"can't happen\" -- you found a bug" },
+       { REG_INVARG,   "REG_INVARG",   "invalid argument to regex routine" },
+       { 0,            "",             "*** unknown regexp error code ***" }
 };
 
 /*
- regerror - the interface to error numbers
= extern size_t regerror(int, const regex_t *, char *, size_t);
* regerror - the interface to error numbers
* extern size_t regerror(int, const regex_t *, char *, size_t);
  */
 /* ARGSUSED */
 size_t
-regerror(errcode, preg, errbuf, errbuf_size)
-int errcode;
-const regex_t *preg;
-char *errbuf;
-size_t errbuf_size;
+regerror(
+    int errcode,
+    const regex_t *preg,
+    char *errbuf,
+    size_t errbuf_size)
 {
-       register struct rerr *r;
-       register size_t len;
-       register int target = errcode &~ REG_ITOA;
-       register char *s;
+       const struct rerr *r;
+       size_t len;
+       int target = errcode &~ REG_ITOA;
+       const char *s;
        char convbuf[50];
 
+       _DIAGASSERT(errcode != REG_ATOI || preg != NULL);
+       _DIAGASSERT(errbuf != NULL);
+
        if (errcode == REG_ATOI)
-               s = regatoi(preg, convbuf);
+               s = regatoi(preg, convbuf, sizeof convbuf);
        else {
                for (r = rerrs; r->code != 0; r++)
                        if (r->code == target)
                                break;
        
-               if (errcode&REG_ITOA) {
-                       if (r->code != 0)
-                               (void) strcpy(convbuf, r->name);
-                       else
-                               sprintf(convbuf, "REG_0x%x", target);
-                       assert(strlen(convbuf) < sizeof(convbuf));
+               if (errcode & REG_ITOA) {
+                       if (r->code != 0) {
+                               (void)strlcpy(convbuf, r->name, sizeof convbuf);
+                       else
+                               (void)snprintf(convbuf, sizeof convbuf,
+                                   "REG_0x%x", target);
                        s = convbuf;
                } else
                        s = r->explain;
        }
 
        len = strlen(s) + 1;
-       if (errbuf_size > 0) {
-               if (errbuf_size > len)
-                       (void) strcpy(errbuf, s);
-               else {
-                       (void) strncpy(errbuf, s, errbuf_size-1);
-                       errbuf[errbuf_size-1] = '\0';
-               }
-       }
+       if (errbuf_size > 0)
+               (void)strlcpy(errbuf, s, errbuf_size);
 
        return(len);
 }
 
 /*
- - regatoi - internal routine to implement REG_ATOI
- == static char *regatoi(const regex_t *preg, char *localbuf);
+ * regatoi - internal routine to implement REG_ATOI
+ * static const char *regatoi(const regex_t *preg, char *localbuf,
+ * size_t buflen);
  */
-static char *
-regatoi(preg, localbuf)
-const regex_t *preg;
-char *localbuf;
+static const char *
+regatoi(
+    const regex_t *preg,
+    char *localbuf,
+    size_t buflen)
 {
-       register struct rerr *r;
+       const struct rerr *r;
 
        for (r = rerrs; r->code != 0; r++)
                if (strcmp(r->name, preg->re_endp) == 0)
                        break;
        if (r->code == 0)
-               return("0");
+               return "0";
 
-       sprintf(localbuf, "%d", r->code);
-       return(localbuf);
+       (void)snprintf(localbuf, buflen, "%d", r->code);
+       return localbuf;
 }
-
-/*
- * $PchId: regerror.c,v 1.2 1996/03/12 19:10:15 philip Exp $
- */
old mode 100755 (executable)
new mode 100644 (file)
index fbe2eca..dae8e17
@@ -1,4 +1,5 @@
-.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
+.\"    $NetBSD: regex.3,v 1.21 2010/03/22 19:30:54 joerg Exp $
+.\"
 .\" Copyright (c) 1992, 1993, 1994
 .\"    The Regents of the University of California.  All rights reserved.
 .\"
 .\" 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. 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.
+.\"
+.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Henry Spencer.
+.\"
+.\" 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
 .\"
 .\"    @(#)regex.3     8.4 (Berkeley) 3/20/94
 .\"
-.TH REGEX 3 "March 20, 1994"
-.de ZR
-.\" one other place knows this name:  the SEE ALSO section
-.BR re_format (7) \\$1
-..
-.SH NAME
-regex, regcomp, regexec, regerror, regfree \- regular-expression library
-.SH SYNOPSIS
-.ft B
-.\".na
-#include <sys/types.h>
-.br
-#include <regex.h>
-.sp
-.in +.5i
-.ti -.5i
-int regcomp(regex_t *\fIpreg\fP, const char *\fIpattern\fP, int \fIcflags\fP);
-.ti -.5i
-int regexec(const regex_t *\fIpreg\fP, const char *\fIstring\fP,
-size_t \fInmatch\fP, regmatch_t \fIpmatch\fP[], int \fIeflags\fP);
-.ti -.5i
-size_t regerror(int \fIerrcode\fP, const regex_t *\fIpreg\fP,
-char *\fIerrbuf\fP, size_t \fIerrbuf_size\fP);
-.ti -.5i
-void regfree(regex_t *\fIpreg\fP);
-.in -.5i
-.ft R
-.SH DESCRIPTION
-These routines implement POSIX 1003.2 regular expressions (``RE''s);
+.Dd December 29, 2003
+.Dt REGEX 3
+.Os
+.Sh NAME
+.Nm regex ,
+.Nm regcomp ,
+.Nm regexec ,
+.Nm regerror ,
+.Nm regfree
+.Nd regular-expression library
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In regex.h
+.Ft int
+.Fn regcomp "regex_t * restrict preg" "const char * restrict pattern" "int cflags"
+.Ft int
+.Fn regexec "const regex_t * restrict preg" "const char * restrict string" "size_t nmatch" "regmatch_t pmatch[]" "int eflags"
+.Ft size_t
+.Fn regerror "int errcode" "const regex_t * restrict preg" "char * restrict errbuf" "size_t errbuf_size"
+.Ft void
+.Fn regfree "regex_t *preg"
+.Sh DESCRIPTION
+These routines implement
+.St -p1003.2-92
+regular expressions (``RE''s);
 see
-.ZR .
-.B Regcomp
+.Xr re_format 7 .
+.Fn regcomp
 compiles an RE written as a string into an internal form,
-.B regexec
+.Fn regexec
 matches that internal form against a string and reports results,
-.B regerror
+.Fn regerror
 transforms error codes from either into human-readable messages,
 and
-.B regfree
+.Fn regfree
 frees any dynamically-allocated storage used by the internal form
 of an RE.
-.PP
+.Pp
 The header
-.I <regex.h>
+.In regex.h
 declares two structure types,
-.B regex_t
+.Fa regex_t
 and
-.BR regmatch_t ,
+.Fa regmatch_t ,
 the former for compiled internal forms and the latter for match reporting.
 It also declares the four functions,
 a type
-.BR regoff_t ,
+.Fa regoff_t ,
 and a number of constants with names starting with ``REG_''.
-.PP
-.B Regcomp
+.Pp
+.Fn regcomp
 compiles the regular expression contained in the
-.I pattern
+.Fa pattern
 string,
 subject to the flags in
-.IR cflags ,
+.Fa cflags ,
 and places the results in the
-.B regex_t
+.Fa regex_t
 structure pointed to by
-.IR preg .
-.I Cflags
+.Fa preg .
+.Fa cflags
 is the bitwise OR of zero or more of the following flags:
-.IP REG_EXTENDED \w'REG_EXTENDED'u+2n
-Compile modern (``extended'') REs,
-rather than the obsolete (``basic'') REs that
-are the default.
-.IP REG_BASIC
+.Bl -tag -width XXXREG_EXTENDED
+.It Dv REG_EXTENDED
+Compile modern (``extended'') REs, rather than the obsolete
+(``basic'') REs that are the default.
+.It Dv REG_BASIC
 This is a synonym for 0,
 provided as a counterpart to REG_EXTENDED to improve readability.
-.IP REG_NOSPEC
+.It Dv REG_NOSPEC
 Compile with recognition of all special characters turned off.
-All characters are thus considered ordinary,
-so the ``RE'' is a literal string.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-REG_EXTENDED and REG_NOSPEC may not be used
-in the same call to
-.IR regcomp .
-.IP REG_ICASE
+All characters are thus considered ordinary, so the ``RE'' is a literal
+string.
+This is an extension, compatible with but not specified by
+.St -p1003.2-92 ,
+and should be used with caution in software intended to be portable to
+other systems.
+.Dv REG_EXTENDED
+and
+.Dv REG_NOSPEC
+may not be used in the same call to
+.Fn regcomp .
+.It Dv REG_ICASE
 Compile for matching that ignores upper/lower case distinctions.
 See
-.ZR .
-.IP REG_NOSUB
-Compile for matching that need only report success or failure,
-not what was matched.
-.IP REG_NEWLINE
+.Xr re_format 7 .
+.It Dv REG_NOSUB
+Compile for matching that need only report success or failure, not
+what was matched.
+.It Dv REG_NEWLINE
 Compile for newline-sensitive matching.
 By default, newline is a completely ordinary character with no special
 meaning in either REs or strings.
@@ -136,219 +165,245 @@ a `^' anchor matches the null string after any newline in the string
 in addition to its normal function,
 and the `$' anchor matches the null string before any newline in the
 string in addition to its normal function.
-.IP REG_PEND
-The regular expression ends,
-not at the first NUL,
-but just before the character pointed to by the
-.B re_endp
+.It Dv REG_PEND
+The regular expression ends, not at the first NUL, but just before the
+character pointed to by the
+.Fa re_endp
 member of the structure pointed to by
-.IR preg .
+.Fa preg .
 The
-.B re_endp
+.Fa re_endp
 member is of type
-.BR "const\ char\ *" .
-This flag permits inclusion of NULs in the RE;
-they are considered ordinary characters.
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-.PP
+.Fa "const\ char\ *" .
+This flag permits inclusion of NULs in the RE; they are considered
+ordinary characters.
+This is an extension, compatible with but not specified by
+.St -p1003.2-92 ,
+and should be used with caution in software intended to be portable to
+other systems.
+.El
+.Pp
 When successful,
-.B regcomp
+.Fn regcomp
 returns 0 and fills in the structure pointed to by
-.IR preg .
-One member of that structure
-(other than
-.BR re_endp )
+.Fa preg .
+One member of that structure (other than
+.Fa re_endp )
 is publicized:
-.BR re_nsub ,
+.Fa re_nsub ,
 of type
-.BR size_t ,
+.Fa size_t ,
 contains the number of parenthesized subexpressions within the RE
 (except that the value of this member is undefined if the
-REG_NOSUB flag was used).
+.Dv REG_NOSUB
+flag was used).
 If
-.B regcomp
+.Fn regcomp
 fails, it returns a non-zero error code;
-see DIAGNOSTICS.
-.PP
-.B Regexec
+see
+.Sx DIAGNOSTICS .
+.Pp
+.Fn regexec
 matches the compiled RE pointed to by
-.I preg
+.Fa preg
 against the
-.IR string ,
+.Fa string ,
 subject to the flags in
-.IR eflags ,
+.Fa eflags ,
 and reports results using
-.IR nmatch ,
-.IR pmatch ,
+.Fa nmatch ,
+.Fa pmatch ,
 and the returned value.
 The RE must have been compiled by a previous invocation of
-.BR regcomp .
+.Fn regcomp .
 The compiled form is not altered during execution of
-.BR regexec ,
+.Fn regexec ,
 so a single compiled RE can be used simultaneously by multiple threads.
-.PP
+.Pp
 By default,
 the NUL-terminated string pointed to by
-.I string
+.Fa string
 is considered to be the text of an entire line, minus any terminating
 newline.
 The
-.I eflags
+.Fa eflags
 argument is the bitwise OR of zero or more of the following flags:
-.IP REG_NOTBOL \w'REG_STARTEND'u+2n
-The first character of
-the string
+.Bl -tag -width XXXREG_NOTBOL
+.It Dv REG_NOTBOL
+The first character of the string
 is not the beginning of a line, so the `^' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_NOTEOL
-The NUL terminating
-the string
-does not end a line, so the `$' anchor should not match before it.
-This does not affect the behavior of newlines under REG_NEWLINE.
-.IP REG_STARTEND
+This does not affect the behavior of newlines under
+.Dv REG_NEWLINE .
+.It Dv REG_NOTEOL
+The NUL terminating the string does not end a line, so the `$' anchor
+should not match before it.
+This does not affect the behavior of newlines under
+.Dv REG_NEWLINE .
+.It Dv REG_STARTEND
 The string is considered to start at
-\fIstring\fR\ + \fIpmatch\fR[0].\fBrm_so\fR
+.Fa string
++
+.Fa pmatch[0].rm_so
 and to have a terminating NUL located at
-\fIstring\fR\ + \fIpmatch\fR[0].\fBrm_eo\fR
+.Fa string
++
+.Fa pmatch[0].rm_eo
 (there need not actually be a NUL at that location),
 regardless of the value of
-.IR nmatch .
+.Fa nmatch .
 See below for the definition of
-.IR pmatch
+.Fa pmatch
 and
-.IR nmatch .
-This is an extension,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
-Note that a non-zero \fBrm_so\fR does not imply REG_NOTBOL;
-REG_STARTEND affects only the location of the string,
-not how it is matched.
-.PP
+.Fa nmatch .
+This is an extension, compatible with but not specified by
+.St -p1003.2-92 ,
+and should be used with caution in software intended to be portable to
+other systems.
+Note that a non-zero
+.Fa rm_so
+does not imply
+.Dv REG_NOTBOL ;
+.Dv REG_STARTEND
+affects only the location of the string, not how it is matched.
+.El
+.Pp
 See
-.ZR
+.Xr re_format 7
 for a discussion of what is matched in situations where an RE or a
 portion thereof could match any of several substrings of
-.IR string .
-.PP
+.Fa string .
+.Pp
 Normally,
-.B regexec
-returns 0 for success and the non-zero code REG_NOMATCH for failure.
+.Fn regexec
+returns 0 for success and the non-zero code
+.Dv REG_NOMATCH
+for failure.
 Other non-zero error codes may be returned in exceptional situations;
-see DIAGNOSTICS.
-.PP
-If REG_NOSUB was specified in the compilation of the RE,
-or if
-.I nmatch
+see
+.Sx DIAGNOSTICS .
+.Pp
+If
+.Dv REG_NOSUB
+was specified in the compilation of the RE, or if
+.Fa nmatch
 is 0,
-.B regexec
+.Fn regexec
 ignores the
-.I pmatch
-argument (but see below for the case where REG_STARTEND is specified).
+.Fa pmatch
+argument (but see below for the case where
+.Dv REG_STARTEND
+is specified).
 Otherwise,
-.I pmatch
+.Fa pmatch
 points to an array of
-.I nmatch
+.Fa nmatch
 structures of type
-.BR regmatch_t .
+.Fa regmatch_t .
 Such a structure has at least the members
-.B rm_so
+.Fa rm_so
 and
-.BR rm_eo ,
+.Fa rm_eo ,
 both of type
-.B regoff_t
+.Fa regoff_t
 (a signed arithmetic type at least as large as an
-.B off_t
+.Fa off_t
 and a
-.BR ssize_t ),
+.Fa ssize_t ) ,
 containing respectively the offset of the first character of a substring
 and the offset of the first character after the end of the substring.
 Offsets are measured from the beginning of the
-.I string
+.Fa string
 argument given to
-.BR regexec .
+.Fn regexec .
 An empty substring is denoted by equal offsets,
 both indicating the character following the empty substring.
-.PP
+.Pp
 The 0th member of the
-.I pmatch
+.Fa pmatch
 array is filled in to indicate what substring of
-.I string
+.Fa string
 was matched by the entire RE.
 Remaining members report what substring was matched by parenthesized
 subexpressions within the RE;
 member
-.I i
+.Fa i
 reports subexpression
-.IR i ,
-with subexpressions counted (starting at 1) by the order of their opening
-parentheses in the RE, left to right.
+.Fa i ,
+with subexpressions counted (starting at 1) by the order of their
+opening parentheses in the RE, left to right.
 Unused entries in the array\(emcorresponding either to subexpressions that
 did not participate in the match at all, or to subexpressions that do not
-exist in the RE (that is, \fIi\fR\ > \fIpreg\fR\->\fBre_nsub\fR)\(emhave both
-.B rm_so
+exist in the RE (that is,
+.Fa i
+\*[Gt]
+.Fa preg-\*[Gt]re_nsub )
+\(emhave both
+.Fa rm_so
 and
-.B rm_eo
-set to \-1.
+.Fa rm_eo
+set to -1.
 If a subexpression participated in the match several times,
 the reported substring is the last one it matched.
 (Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
 the parenthesized subexpression matches each of the three `b's and then
 an infinite number of empty strings following the last `b',
 so the reported substring is one of the empties.)
-.PP
-If REG_STARTEND is specified,
-.I pmatch
+.Pp
+If
+.Dv REG_STARTEND
+is specified,
+.Fa pmatch
 must point to at least one
-.B regmatch_t
+.Fa regmatch_t
 (even if
-.I nmatch
-is 0 or REG_NOSUB was specified),
-to hold the input offsets for REG_STARTEND.
+.Fa nmatch
+is 0 or
+.Dv REG_NOSUB
+was specified),
+to hold the input offsets for
+.Dv REG_STARTEND .
 Use for output is still entirely controlled by
-.IR nmatch ;
+.Fa nmatch ;
 if
-.I nmatch
-is 0 or REG_NOSUB was specified,
+.Fa nmatch
+is 0 or
+.Dv REG_NOSUB
+was specified,
 the value of
-.IR pmatch [0]
+.Fa pmatch [0]
 will not be changed by a successful
-.BR regexec .
-.PP
-.B Regerror
+.Fn regexec .
+.Pp
+.Fn regerror
 maps a non-zero
-.I errcode
+.Fa errcode
 from either
-.B regcomp
+.Fn regcomp
 or
-.B regexec
+.Fn regexec
 to a human-readable, printable message.
 If
-.I preg
+.Fa preg
 is non-NULL,
-the error code should have arisen from use of
-the
-.B regex_t
+the error code should have arisen from use of the
+.Fa regex_t
 pointed to by
-.IR preg ,
+.Fa preg ,
 and if the error code came from
-.BR regcomp ,
+.Fn regcomp ,
 it should have been the result from the most recent
-.B regcomp
+.Fn regcomp
 using that
-.BR regex_t .
-.RI ( Regerror
+.Fa regex_t . (
+.Fn regerror
 may be able to supply a more detailed message using information
 from the
-.BR regex_t .)
-.B Regerror
+.Fa regex_t . )
+.Fn regerror
 places the NUL-terminated message into the buffer pointed to by
-.IR errbuf ,
+.Fa errbuf ,
 limiting the length (including the NUL) to at most
-.I errbuf_size
+.Fa errbuf_size
 bytes.
 If the whole message won't fit,
 as much of it as will fit before the terminating NUL is supplied.
@@ -356,186 +411,221 @@ In any case,
 the returned value is the size of buffer needed to hold the whole
 message (including terminating NUL).
 If
-.I errbuf_size
+.Fa errbuf_size
 is 0,
-.I errbuf
+.Fa errbuf
 is ignored but the return value is still correct.
-.PP
+.Pp
 If the
-.I errcode
+.Fa errcode
 given to
-.B regerror
-is first ORed with REG_ITOA,
+.Fn regerror
+is first ORed with
+.Dv REG_ITOA ,
 the ``message'' that results is the printable name of the error code,
 e.g. ``REG_NOMATCH'',
 rather than an explanation thereof.
 If
-.I errcode
-is REG_ATOI,
+.Fa errcode
+is
+.Dv REG_ATOI ,
 then
-.I preg
+.Fa preg
 shall be non-NULL and the
-.B re_endp
+.Fa re_endp
 member of the structure it points to
 must point to the printable name of an error code;
 in this case, the result in
-.I errbuf
+.Fa errbuf
 is the decimal digits of
 the numeric value of the error code
 (0 if the name is not recognized).
-REG_ITOA and REG_ATOI are intended primarily as debugging facilities;
-they are extensions,
-compatible with but not specified by POSIX 1003.2,
-and should be used with
-caution in software intended to be portable to other systems.
+.Dv REG_ITOA
+and
+.Dv REG_ATOI
+are intended primarily as debugging facilities;
+they are extensions, compatible with but not specified by
+.St -p1003.2-92 ,
+and should be used with caution in software intended to be portable to
+other systems.
 Be warned also that they are considered experimental and changes are possible.
-.PP
-.B Regfree
+.Pp
+.Fn regfree
 frees any dynamically-allocated storage associated with the compiled RE
 pointed to by
-.IR preg .
+.Fa preg .
 The remaining
-.B regex_t
+.Fa regex_t
 is no longer a valid compiled RE
 and the effect of supplying it to
-.B regexec
+.Fn regexec
 or
-.B regerror
+.Fn regerror
 is undefined.
-.PP
+.Pp
 None of these functions references global variables except for tables
 of constants;
 all are safe for use from multiple threads if the arguments are safe.
-.SH IMPLEMENTATION CHOICES
-There are a number of decisions that 1003.2 leaves up to the implementor,
+.Sh IMPLEMENTATION CHOICES
+There are a number of decisions that
+.St -p1003.2-92
+leaves up to the implementor,
 either by explicitly saying ``undefined'' or by virtue of them being
 forbidden by the RE grammar.
 This implementation treats them as follows.
-.PP
+.Pp
 See
-.ZR
+.Xr re_format 7
 for a discussion of the definition of case-independent matching.
-.PP
+.Pp
 There is no particular limit on the length of REs,
 except insofar as memory is limited.
 Memory usage is approximately linear in RE size, and largely insensitive
 to RE complexity, except for bounded repetitions.
 See BUGS for one short RE using them
 that will run almost any system out of memory.
-.PP
+.Pp
 A backslashed character other than one specifically given a magic meaning
-by 1003.2 (such magic meanings occur only in obsolete [``basic''] REs)
+by
+.St -p1003.2-92
+(such magic meanings occur only in obsolete [``basic''] REs)
 is taken as an ordinary character.
-.PP
-Any unmatched [ is a REG_EBRACK error.
-.PP
+.Pp
+Any unmatched [ is a
+.Dv REG_EBRACK
+error.
+.Pp
 Equivalence classes cannot begin or end bracket-expression ranges.
 The endpoint of one range cannot begin another.
-.PP
-RE_DUP_MAX, the limit on repetition counts in bounded repetitions, is 255.
-.PP
+.Pp
+.Dv RE_DUP_MAX ,
+the limit on repetition counts in bounded repetitions, is 255.
+.Pp
 A repetition operator (?, *, +, or bounds) cannot follow another
 repetition operator.
 A repetition operator cannot begin an expression or subexpression
 or follow `^' or `|'.
-.PP
+.Pp
 `|' cannot appear first or last in a (sub)expression or after another `|',
 i.e. an operand of `|' cannot be an empty subexpression.
 An empty parenthesized subexpression, `()', is legal and matches an
 empty (sub)string.
 An empty string is not a legal RE.
-.PP
+.Pp
 A `{' followed by a digit is considered the beginning of bounds for a
 bounded repetition, which must then follow the syntax for bounds.
-A `{' \fInot\fR followed by a digit is considered an ordinary character.
-.PP
+A `{'
+.Em not
+followed by a digit is considered an ordinary character.
+.Pp
 `^' and `$' beginning and ending subexpressions in obsolete (``basic'')
 REs are anchors, not ordinary characters.
-.SH SEE ALSO
-.BR grep (1),
-.BR re_format (7).
-.PP
-POSIX 1003.2, sections 2.8 (Regular Expression Notation)
-and
-B.5 (C Binding for Regular Expression Matching).
-.SH DIAGNOSTICS
+.Sh DIAGNOSTICS
 Non-zero error codes from
-.B regcomp
+.Fn regcomp
 and
-.B regexec
+.Fn regexec
 include the following:
-.PP
-.nf
-.ta \w'REG_ECOLLATE'u+3n
-REG_NOMATCH    regexec() failed to match
-REG_BADPAT     invalid regular expression
-REG_ECOLLATE   invalid collating element
-REG_ECTYPE     invalid character class
-REG_EESCAPE    \e applied to unescapable character
-REG_ESUBREG    invalid backreference number
-REG_EBRACK     brackets [ ] not balanced
-REG_EPAREN     parentheses ( ) not balanced
-REG_EBRACE     braces { } not balanced
-REG_BADBR      invalid repetition count(s) in { }
-REG_ERANGE     invalid character range in [ ]
-REG_ESPACE     ran out of memory
-REG_BADRPT     ?, *, or + operand invalid
-REG_EMPTY      empty (sub)expression
-REG_ASSERT     ``can't happen''\(emyou found a bug
-REG_INVARG     invalid argument, e.g. negative-length string
-.fi
-.SH HISTORY
+.Pp
+.Bl -tag -width XXXREG_ECOLLATE -compact
+.It Dv REG_NOMATCH
+.Fn regexec
+failed to match
+.It Dv REG_BADPAT
+invalid regular expression
+.It Dv REG_ECOLLATE
+invalid collating element
+.It Dv REG_ECTYPE
+invalid character class
+.It Dv REG_EESCAPE
+\e applied to unescapable character
+.It Dv REG_ESUBREG
+invalid backreference number
+.It Dv REG_EBRACK
+brackets [ ] not balanced
+.It Dv REG_EPAREN
+parentheses ( ) not balanced
+.It Dv REG_EBRACE
+braces { } not balanced
+.It Dv REG_BADBR
+invalid repetition count(s) in { }
+.It Dv REG_ERANGE
+invalid character range in [ ]
+.It Dv REG_ESPACE
+ran out of memory
+.It Dv REG_BADRPT
+?, *, or + operand invalid
+.It Dv REG_EMPTY
+empty (sub)expression
+.It Dv REG_ASSERT
+``can't happen''\(emyou found a bug
+.It Dv REG_INVARG
+invalid argument, e.g. negative-length string
+.El
+.Sh SEE ALSO
+.Xr grep 1 ,
+.Xr sed 1 ,
+.Xr re_format 7
+.Pp
+.St -p1003.2-92 ,
+sections 2.8 (Regular Expression Notation)
+and
+B.5 (C Binding for Regular Expression Matching).
+.Sh HISTORY
 Originally written by Henry Spencer.
-Altered for inclusion in the 4.4BSD distribution.
-.SH BUGS
-This is an alpha release with known defects.
-Please report problems.
-.PP
+Altered for inclusion in the
+.Bx 4.4
+distribution.
+.Sh BUGS
 There is one known functionality bug.
 The implementation of internationalization is incomplete:
-the locale is always assumed to be the default one of 1003.2,
+the locale is always assumed to be the default one of
+.St -p1003.2-92 ,
 and only the collating elements etc. of that locale are available.
-.PP
+.Pp
 The back-reference code is subtle and doubts linger about its correctness
 in complex cases.
-.PP
-.B Regexec
+.Pp
+.Fn regexec
 performance is poor.
 This will improve with later releases.
-.I Nmatch
+.Fa nmatch
 exceeding 0 is expensive;
-.I nmatch
+.Fa nmatch
 exceeding 1 is worse.
-.B Regexec
-is largely insensitive to RE complexity \fIexcept\fR that back
-references are massively expensive.
+.Fa regexec
+is largely insensitive to RE complexity
+.Em except
+that back references are massively expensive.
 RE length does matter; in particular, there is a strong speed bonus
 for keeping RE length under about 30 characters,
 with most special characters counting roughly double.
-.PP
-.B Regcomp
+.Pp
+.Fn regcomp
 implements bounded repetitions by macro expansion,
 which is costly in time and space if counts are large
 or bounded repetitions are nested.
 An RE like, say,
 `((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
 will (eventually) run almost any existing machine out of swap space.
-.PP
+.Pp
 There are suspected problems with response to obscure error conditions.
 Notably,
 certain kinds of internal overflow,
 produced only by truly enormous REs or by multiply nested bounded repetitions,
 are probably not handled well.
-.PP
-Due to a mistake in 1003.2, things like `a)b' are legal REs because `)' is
-a special character only in the presence of a previous unmatched `('.
+.Pp
+Due to a mistake in
+.St -p1003.2-92 ,
+things like `a)b' are legal REs because `)' is a special character
+only in the presence of a previous unmatched `('.
 This can't be fixed until the spec is fixed.
-.PP
+.Pp
 The standard's definition of back references is vague.
 For example, does
 `a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
-Until the standard is clarified,
-behavior in such cases should not be relied on.
-.PP
+Until the standard is clarified, behavior in such cases should not be
+relied on.
+.Pp
 The implementation of word-boundary matching is a bit of a kludge,
 and bugs may lurk in combinations of word-boundary matching and anchoring.
index 64b62121f828176316b5ba267fbecf2da481d8d8..0fdbe74c4e94014d2a0ece03250d0cfe50c5a719 100644 (file)
@@ -1,5 +1,6 @@
+/*     $NetBSD: regex2.h,v 1.12 2009/02/12 05:06:54 lukem Exp $        */
+
 /*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * 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. 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.
+ *
+ *     @(#)regex2.h    8.4 (Berkeley) 3/20/94
+ */
+
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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
  * In state representations, an operator's bit is on to signify a state
  * immediately *preceding* "execution" of that operator.
  */
-typedef unsigned long sop;     /* strip operator */
-typedef long sopno;
-#define        OPRMASK 0xf8000000
-#define        OPDMASK 0x07ffffff
+typedef u_int32_t sop; /* strip operator */
+typedef int sopno;
+#define        OPRMASK ((u_int32_t)0xf8000000UL)
+#define        OPDMASK ((u_int32_t)0x07ffffffUL)
 #define        OPSHIFT ((unsigned)27)
 #define        OP(n)   ((n)&OPRMASK)
-#define        OPND(n) ((n)&OPDMASK)
+#define        OPND(n) ((int)((n)&OPDMASK))
 #define        SOP(op, opnd)   ((op)|(opnd))
-/* operators                      meaning      operand                 */
-/*                                             (back, fwd are offsets) */
-#define        OEND    (1<<OPSHIFT)    /* endmarker    -                       */
-#define        OCHAR   (2<<OPSHIFT)    /* character    unsigned char           */
-#define        OBOL    (3<<OPSHIFT)    /* left anchor  -                       */
-#define        OEOL    (4<<OPSHIFT)    /* right anchor -                       */
-#define        OANY    (5<<OPSHIFT)    /* .            -                       */
-#define        OANYOF  (6<<OPSHIFT)    /* [...]        set number              */
-#define        OBACK_  (7<<OPSHIFT)    /* begin \d     paren number            */
-#define        O_BACK  (8<<OPSHIFT)    /* end \d       paren number            */
-#define        OPLUS_  (9<<OPSHIFT)    /* + prefix     fwd to suffix           */
-#define        O_PLUS  (10<<OPSHIFT)   /* + suffix     back to prefix          */
-#define        OQUEST_ (11<<OPSHIFT)   /* ? prefix     fwd to suffix           */
-#define        O_QUEST (12<<OPSHIFT)   /* ? suffix     back to prefix          */
-#define        OLPAREN (13<<OPSHIFT)   /* (            fwd to )                */
-#define        ORPAREN (14<<OPSHIFT)   /* )            back to (               */
-#define        OCH_    (15<<OPSHIFT)   /* begin choice fwd to OOR2             */
-#define        OOR1    (16<<OPSHIFT)   /* | pt. 1      back to OOR1 or OCH_    */
-#define        OOR2    (17<<OPSHIFT)   /* | pt. 2      fwd to OOR2 or O_CH     */
-#define        O_CH    (18<<OPSHIFT)   /* end choice   back to OOR1            */
-#define        OBOW    (19<<OPSHIFT)   /* begin word   -                       */
-#define        OEOW    (20<<OPSHIFT)   /* end word     -                       */
+
+#define OPC(n) (((u_int32_t)(n))<<OPSHIFT)
+/* operators              meaning      operand                 */
+/*                                     (back, fwd are offsets) */
+#define        OEND    OPC(1)  /* endmarker    -                       */
+#define        OCHAR   OPC(2)  /* character    unsigned char           */
+#define        OBOL    OPC(3)  /* left anchor  -                       */
+#define        OEOL    OPC(4)  /* right anchor -                       */
+#define        OANY    OPC(5)  /* .            -                       */
+#define        OANYOF  OPC(6)  /* [...]        set number              */
+#define        OBACK_  OPC(7)  /* begin \d     paren number            */
+#define        O_BACK  OPC(8)  /* end \d       paren number            */
+#define        OPLUS_  OPC(9)  /* + prefix     fwd to suffix           */
+#define        O_PLUS  OPC(10) /* + suffix     back to prefix          */
+#define        OQUEST_ OPC(11) /* ? prefix     fwd to suffix           */
+#define        O_QUEST OPC(12) /* ? suffix     back to prefix          */
+#define        OLPAREN OPC(13) /* (            fwd to )                */
+#define        ORPAREN OPC(14) /* )            back to (               */
+#define        OCH_    OPC(15) /* begin choice fwd to OOR2             */
+#define        OOR1    OPC(16) /* | pt. 1      back to OOR1 or OCH_    */
+#define        OOR2    OPC(17) /* | pt. 2      fwd to OOR2 or O_CH     */
+#define        O_CH    OPC(18) /* end choice   back to OOR1            */
+#define        OBOW    OPC(19) /* begin word   -                       */
+#define        OEOW    OPC(20) /* end word     -                       */
 
 /*
  * Structure for [] character-set representation.  Character sets are
@@ -170,4 +206,4 @@ struct re_guts {
 
 /* misc utilities */
 #define        OUT     (CHAR_MAX+1)    /* a non-character value */
-#define        ISWORD(c)       (isalnum(c) || (c) == '_')
+#define        ISWORD(c)       (isalnum((unsigned char)c) || (c) == '_')
index fe7335b1425a08e9798dd62998b510cd00d1e266..d0e10842fd83f61498a58778359a6278a0231306 100644 (file)
@@ -1,5 +1,6 @@
+/*     $NetBSD: regexec.c,v 1.21 2009/02/12 05:06:54 lukem Exp $       */
+
 /*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * 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. 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.
+ *
+ *     @(#)regexec.c   8.3 (Berkeley) 3/20/94
+ */
+
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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
  *     @(#)regexec.c   8.3 (Berkeley) 3/20/94
  */
 
+#include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
+#if 0
 static char sccsid[] = "@(#)regexec.c  8.3 (Berkeley) 3/20/94";
+#else
+__RCSID("$NetBSD: regexec.c,v 1.21 2009/02/12 05:06:54 lukem Exp $");
+#endif
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -48,46 +87,46 @@ static char sccsid[] = "@(#)regexec.c       8.3 (Berkeley) 3/20/94";
  * macros that code uses.  This lets the same code operate on two different
  * representations for state sets.
  */
+#include "namespace.h"
 #include <sys/types.h>
+
+#include <assert.h>
+#include <ctype.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <limits.h>
-#include <unistd.h>
-#ifdef __minix_vmd
-#include <bsd/asciictype.h>
-#else
-#include <ctype.h>
-#endif
 #include <regex.h>
 
+#ifdef __weak_alias
+__weak_alias(regexec,_regexec)
+#endif
+
 #include "utils.h"
 #include "regex2.h"
 
-static int nope = 0;           /* for use in asserts; shuts lint up */
-
 /* macros for manipulating states, small version */
-#define        states  long
-#define        states1 states          /* for later use in regexec() decision */
+#define        states  unsigned long
+#define        states1 unsigned long   /* for later use in regexec() decision */
 #define        CLEAR(v)        ((v) = 0)
-#define        SET0(v, n)      ((v) &= ~(1 << (n)))
-#define        SET1(v, n)      ((v) |= 1 << (n))
-#define        ISSET(v, n)     ((v) & (1 << (n)))
+#define        SET0(v, n)      ((v) &= ~((unsigned long)1 << (n)))
+#define        SET1(v, n)      ((v) |= (unsigned long)1 << (n))
+#define        ISSET(v, n)     (((v) & ((unsigned long)1 << (n))) != 0)
 #define        ASSIGN(d, s)    ((d) = (s))
 #define        EQ(a, b)        ((a) == (b))
 #define        STATEVARS       int dummy       /* dummy version */
 #define        STATESETUP(m, n)        /* nothing */
 #define        STATETEARDOWN(m)        /* nothing */
 #define        SETUP(v)        ((v) = 0)
-#define        onestate        int
-#define        INIT(o, n)      ((o) = (unsigned)1 << (n))
+#define        onestate        unsigned long
+#define        INIT(o, n)      ((o) = (unsigned long)1 << (n))
 #define        INC(o)  ((o) <<= 1)
-#define        ISSTATEIN(v, o) ((v) & (o))
+#define        ISSTATEIN(v, o) (((v) & (o)) != 0)
 /* some abbreviations; note that some of these know variable names! */
 /* do "if I'm here, I can also be there" etc without branches */
-#define        FWD(dst, src, n)        ((dst) |= ((unsigned)(src)&(here)) << (n))
-#define        BACK(dst, src, n)       ((dst) |= ((unsigned)(src)&(here)) >> (n))
-#define        ISSETBACK(v, n) ((v) & ((unsigned)here >> (n)))
+#define        FWD(dst, src, n)        ((dst) |= ((unsigned long)(src)&(here)) << (n))
+#define        BACK(dst, src, n)       ((dst) |= ((unsigned long)(src)&(here)) >> (n))
+#define        ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0)
 /* function names */
 #define SNAMES                 /* engine.c looks after details */
 
@@ -116,18 +155,21 @@ static int nope = 0;              /* for use in asserts; shuts lint up */
 
 /* macros for manipulating states, large version */
 #define        states  char *
-#define        CLEAR(v)        memset(v, 0, m->g->nstates)
+#define        CLEAR(v)        memset(v, 0, (size_t)m->g->nstates)
 #define        SET0(v, n)      ((v)[n] = 0)
 #define        SET1(v, n)      ((v)[n] = 1)
 #define        ISSET(v, n)     ((v)[n])
-#define        ASSIGN(d, s)    memcpy(d, s, m->g->nstates)
-#define        EQ(a, b)        (memcmp(a, b, m->g->nstates) == 0)
+#define        ASSIGN(d, s)    memcpy(d, s, (size_t)m->g->nstates)
+#define        EQ(a, b)        (memcmp(a, b, (size_t)m->g->nstates) == 0)
 #define        STATEVARS       int vn; char *space
-#define        STATESETUP(m, nv)       { (m)->space = malloc((nv)*(m)->g->nstates); \
-                               if ((m)->space == NULL) return(REG_ESPACE); \
-                               (m)->vn = 0; }
-#define        STATETEARDOWN(m)        { free((m)->space); }
-#define        SETUP(v)        ((v) = &m->space[m->vn++ * m->g->nstates])
+#define        STATESETUP(m, nv) \
+    if (((m)->space = malloc((size_t)((nv)*(m)->g->nstates))) == NULL) \
+       return(REG_ESPACE); \
+    else \
+       (m)->vn = 0
+
+#define        STATETEARDOWN(m)        { free((m)->space); m->space = NULL; }
+#define        SETUP(v)        ((v) = &m->space[(size_t)(m->vn++ * m->g->nstates)])
 #define        onestate        int
 #define        INIT(o, n)      ((o) = (n))
 #define        INC(o)  ((o)++)
@@ -158,20 +200,24 @@ static int nope = 0;              /* for use in asserts; shuts lint up */
  * have been prototyped.
  */
 int                            /* 0 success, REG_NOMATCH failure */
-regexec(preg, string, nmatch, pmatch, eflags)
-const regex_t *preg;
-const char *string;
-size_t nmatch;
-regmatch_t pmatch[];
-int eflags;
+regexec(
+    const regex_t *preg,
+    const char *string,
+    size_t nmatch,
+    regmatch_t pmatch[],
+    int eflags)
 {
-       register struct re_guts *g = preg->re_g;
+       struct re_guts *g = preg->re_g;
+       char *s;
 #ifdef REDEBUG
 #      define  GOODFLAGS(f)    (f)
 #else
 #      define  GOODFLAGS(f)    ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
 #endif
 
+       _DIAGASSERT(preg != NULL);
+       _DIAGASSERT(string != NULL);
+
        if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
                return(REG_BADPAT);
        assert(!(g->iflags&BAD));
@@ -179,12 +225,10 @@ int eflags;
                return(REG_BADPAT);
        eflags = GOODFLAGS(eflags);
 
-       if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags&REG_LARGE))
-               return(smatcher(g, (char *)string, nmatch, pmatch, eflags));
+       s = __UNCONST(string);
+
+       if (g->nstates <= (sopno)(CHAR_BIT*sizeof(states1)) && !(eflags&REG_LARGE))
+               return(smatcher(g, s, nmatch, pmatch, eflags));
        else
-               return(lmatcher(g, (char *)string, nmatch, pmatch, eflags));
+               return(lmatcher(g, s, nmatch, pmatch, eflags));
 }
-
-/*
- * $PchId: regexec.c,v 1.2 1996/03/12 19:10:15 philip Exp $
- */
index fe6230e928e12c714f599c7d9866b53875f92724..ce011eade6b87e613f234accb318b63b71265ecf 100644 (file)
@@ -1,5 +1,6 @@
+/*     $NetBSD: regfree.c,v 1.15 2007/02/09 23:44:18 junyoung Exp $    */
+
 /*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * 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. 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.
+ *
+ *     @(#)regfree.c   8.3 (Berkeley) 3/20/94
+ */
+
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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
  *     @(#)regfree.c   8.3 (Berkeley) 3/20/94
  */
 
+#include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
+#if 0
 static char sccsid[] = "@(#)regfree.c  8.3 (Berkeley) 3/20/94";
+#else
+__RCSID("$NetBSD: regfree.c,v 1.15 2007/02/09 23:44:18 junyoung Exp $");
+#endif
 #endif /* LIBC_SCCS and not lint */
 
+#include "namespace.h"
 #include <sys/types.h>
+
+#include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <regex.h>
 
+#ifdef __weak_alias
+__weak_alias(regfree,_regfree)
+#endif
+
 #include "utils.h"
 #include "regex2.h"
 
@@ -54,11 +100,14 @@ static char sccsid[] = "@(#)regfree.c      8.3 (Berkeley) 3/20/94";
  = extern void regfree(regex_t *);
  */
 void
-regfree(preg)
-regex_t *preg;
+regfree(
+    regex_t *preg)
 {
-       register struct re_guts *g;
+       struct re_guts *g;
+
+       _DIAGASSERT(preg != NULL);
 
+       _DIAGASSERT(preg->re_magic == MAGIC1);
        if (preg->re_magic != MAGIC1)   /* oops */
                return;                 /* nice to complain, but hard */
 
@@ -69,16 +118,12 @@ regex_t *preg;
        g->magic = 0;                   /* mark it invalid */
 
        if (g->strip != NULL)
-               free((char *)g->strip);
+               free(g->strip);
        if (g->sets != NULL)
-               free((char *)g->sets);
+               free(g->sets);
        if (g->setbits != NULL)
-               free((char *)g->setbits);
+               free(g->setbits);
        if (g->must != NULL)
                free(g->must);
-       free((char *)g);
+       free(g);
 }
-
-/*
- * $PchId: regfree.c,v 1.2 1996/03/12 19:10:15 philip Exp $
- */
index 9eae97c0fc70ed358d9373bfcf6e9da4f72a7d4d..762caeeb697ab26cfed92bb267e7c5af68c7314b 100644 (file)
@@ -1,5 +1,6 @@
+/*     $NetBSD: utils.h,v 1.6 2003/08/07 16:43:21 agc Exp $    */
+
 /*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
  *
  * 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. 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.
+ *
+ *     @(#)utils.h     8.3 (Berkeley) 3/20/94
+ */
+
+/*-
+ * Copyright (c) 1992, 1993, 1994 Henry Spencer.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Henry Spencer.
+ *
+ * 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
  */
 
 /* utility definitions */
-#ifdef _POSIX2_RE_DUP_MAX
 #define        DUPMAX          _POSIX2_RE_DUP_MAX      /* xxx is this right? */
-#else
-#define        DUPMAX          255
-#endif
 #define        INFINITY        (DUPMAX + 1)
 #define        NC              (CHAR_MAX - CHAR_MIN + 1)
 typedef unsigned char uch;
similarity index 100%
rename from lib/nbsd_libc/rpc/README
rename to lib/libc/rpc/README
similarity index 100%
rename from lib/nbsd_libc/rpc/rpc.3
rename to lib/libc/rpc/rpc.3
similarity index 100%
rename from lib/nbsd_libc/rpc/svc.c
rename to lib/libc/rpc/svc.c
similarity index 100%
rename from lib/nbsd_libc/rpc/xdr.3
rename to lib/libc/rpc/xdr.3
similarity index 100%
rename from lib/nbsd_libc/rpc/xdr.c
rename to lib/libc/rpc/xdr.c
similarity index 100%
rename from lib/nbsd_libc/ssp/ssp.3
rename to lib/libc/ssp/ssp.3
index 3e04be2765cf26ae2518372e30878827a9aa980d..23143606809f3d2ac94d1205e3903d8939da29f9 100644 (file)
@@ -1,58 +1,67 @@
+#      from: @(#)Makefile.inc  5.7 (Berkeley) 6/27/91
+#      $NetBSD: Makefile.inc,v 1.40 2010/12/22 16:59:10 christos Exp $
+
 # stdio sources
 .PATH: ${.CURDIR}/stdio
 
-SRCS+=  \
-       asprintf.c \
-       clearerr.c \
-       data.c \
-       doprnt.c \
-       doscan.c \
-       ecvt.c \
-       fclose.c \
-       feof.c \
-       ferror.c \
-       fflush.c \
-       fgetc.c \
-       fgetpos.c \
-       fgets.c \
-       fileno.c \
-       fillbuf.c \
-       flushbuf.c \
-       fopen.c \
-       fprintf.c \
-       fputc.c \
-       fputs.c \
-       fread.c \
-       freopen.c \
-       fscanf.c \
-       fseek.c \
-       fsetpos.c \
-       ftell.c \
-       fwrite.c \
-       getc.c \
-       getchar.c \
-       gets.c \
-       icompute.c \
-       mktemp.c \
-       perror.c \
-       printf.c \
-       putc.c \
-       putchar.c \
-       puts.c \
-       remove.c \
-       rewind.c \
-       scanf.c \
-       setbuf.c \
-       setvbuf.c \
-       sprintf.c \
-       snprintf.c \
-       sscanf.c \
-       tmpfile.c \
-       tmpnam.c \
-       ungetc.c \
-       vfprintf.c \
-       vprintf.c \
-       vscanf.c \
-       vsnprintf.c \
-       vsprintf.c \
-       vsscanf.c
+CPPFLAGS+=-DWIDE_DOUBLE
+
+SRCS+= asprintf.c clrerr.c dprintf.c fclose.c fdopen.c feof.c ferror.c \
+       fflush.c fgetc.c fgetln.c fgetpos.c fgets.c fgetstr.c fgetwc.c \
+       fgetwln.c fgetws.c fileno.c findfp.c flags.c flockfile.c fopen.c \
+       fparseln.c fprintf.c fpurge.c fputc.c fputs.c fputwc.c fputws.c \
+       fread.c freopen.c fscanf.c fseek.c fseeko.c fsetpos.c ftell.c ftello.c \
+       funopen.c fvwrite.c fwalk.c fwide.c fwprintf.c fwrite.c fwscanf.c \
+       getc.c getchar.c getdelim.c getline.c gettemp.c getw.c getwc.c \
+       getwchar.c makebuf.c mkdtemp.c mkstemp.c perror.c printf.c putc.c \
+       putchar.c puts.c putw.c putwc.c putwchar.c refill.c remove.c rewind.c \
+       rget.c scanf.c setbuf.c setbuffer.c setvbuf.c snprintf.c snprintf_ss.c \
+       sscanf.c stdio.c swprintf.c swscanf.c tmpfile.c ungetc.c ungetwc.c \
+       vasprintf.c vdprintf.c vfprintf.c vfscanf.c vfwprintf.c vfwscanf.c \
+       vprintf.c vscanf.c vsnprintf.c vsnprintf_ss.c vsscanf.c vswprintf.c \
+       vswscanf.c vwprintf.c vwscanf.c wbuf.c wprintf.c wscanf.c wsetup.c
+SRCS+= fmemopen.c
+
+.if !defined(AUDIT)
+SRCS+= gets.c sprintf.c vsprintf.c tempnam.c tmpnam.c mktemp.c
+.endif
+
+# namespace purity wrappers
+SRCS+= _fileno.c _fseeko.c _ftello.c
+
+MAN+=  fclose.3 ferror.3 fflush.3 fgetln.3 fgets.3 fgetwln.3 fgetws.3 \
+       flockfile.3 fmemopen.3 fopen.3 fparseln.3 fputs.3 fputws.3 fread.3 \
+       fseek.3 funopen.3 fwide.3 getc.3 getdelim.3 getwc.3 mktemp.3 printf.3 \
+       putc.3 putwc.3 remove.3 scanf.3 setbuf.3 stdio.3 tmpnam.3 \
+       ungetc.3 ungetwc.3 wprintf.3 wscanf.3
+
+MLINKS+=ferror.3 clearerr.3 ferror.3 feof.3 ferror.3 fileno.3
+MLINKS+=fflush.3 fpurge.3
+MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3
+MLINKS+=fgets.3 gets.3
+MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3
+MLINKS+=fputs.3 puts.3
+MLINKS+=fread.3 fwrite.3
+MLINKS+=fseek.3 fgetpos.3 fseek.3 fseeko.3 fseek.3 fsetpos.3 fseek.3 ftell.3 \
+       fseek.3 ftello.3 fseek.3 rewind.3
+MLINKS+=funopen.3 fropen.3 funopen.3 fwopen.3
+MLINKS+=getc.3 fgetc.3 getc.3 getc_unlocked.3 getc.3 getchar.3 \
+       getc.3 getchar_unlocked.3 getc.3 getw.3
+MLINKS+=getdelim.3 getline.3
+MLINKS+=mktemp.3 mkdtemp.3 mktemp.3 mkstemp.3
+MLINKS+=printf.3 asprintf.3 printf.3 fprintf.3 printf.3 snprintf.3 \
+       printf.3 sprintf.3 printf.3 vasprintf.3 printf.3 vfprintf.3 \
+       printf.3 vprintf.3 printf.3 vsnprintf.3 printf.3 vsprintf.3 \
+       printf.3 dprintf.3 printf.3 vdprintf.3 printf.3 vsnprintf_ss.3
+MLINKS+=putc.3 fputc.3 putc.3 putc_unlocked.3 putc.3 putchar.3 \
+       putc.3 putchar_unlocked.3 putc.3 putw.3
+MLINKS+=scanf.3 fscanf.3 scanf.3 sscanf.3 scanf.3 vfscanf.3 scanf.3 vscanf.3 \
+       scanf.3 vsscanf.3
+MLINKS+=setbuf.3 setbuffer.3 setbuf.3 setlinebuf.3 setbuf.3 setvbuf.3
+MLINKS+=tmpnam.3 tempnam.3 tmpnam.3 tmpfile.3
+MLINKS+=putwc.3 fputwc.3 putwc.3 putwchar.3
+MLINKS+=getwc.3 fgetwc.3 getwc.3 getwchar.3
+MLINKS+=wprintf.3 fwprintf.3 wprintf.3 swprintf.3
+MLINKS+=wprintf.3 vwprintf.3 wprintf.3 vfwprintf.3 wprintf.3 vswprintf.3
+MLINKS+=wscanf.3 fwscanf.3 wscanf.3 swscanf.3 wscanf.3 vwscanf.3
+MLINKS+=wscanf.3 vswscanf.3 wscanf.3 vfwscanf.3
index 7ca36dd97459a652ee821c9126ee2d0a90250040..f537637bb62c98fe120d55bc7c5734ad44e3c419 100644 (file)
@@ -1,95 +1,85 @@
-/* $NetBSD: asprintf.c,v 1.2 2007/07/20 00:10:06 tnn Exp $ */
+/*     $NetBSD: asprintf.c,v 1.18 2009/10/25 20:44:13 christos Exp $   */
 
-/*-
- * Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
+/*
+ * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
  * 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.
+ *    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 COPYRIGHT HOLDERS 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
- * COPYRIGHT HOLDERS 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.
+ * THIS SOFTWARE IS PROVIDED ``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.
  */
 
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: asprintf.c,v 1.18 2009/10/25 20:44:13 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <assert.h>
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <errno.h>
 
-#include <stdarg.h>
+#include "reentrant.h"
+#include "local.h"
+
+#ifdef __weak_alias
+__weak_alias(asprintf, _asprintf)
+#endif
 
 int
-asprintf(char **ret, const char *fmt, ...)
+asprintf(char **str, char const *fmt, ...)
 {
+       int ret;
        va_list ap;
-       int retval;
+       FILE f;
+       struct __sfileext fext;
+       unsigned char *_base;
+
+       _DIAGASSERT(str != NULL);
 
+       _FILEEXT_SETUP(&f, &fext);
+       f._file = -1;
+       f._flags = __SWR | __SSTR | __SALC;
+       f._bf._base = f._p = malloc((size_t)128);
+       if (f._bf._base == NULL)
+               goto err;
+       f._bf._size = f._w = 127;               /* Leave room for the NUL */
        va_start(ap, fmt);
-       retval = vasprintf(ret, fmt, ap);
+       ret = __vfprintf_unlocked(&f, fmt, ap);
        va_end(ap);
+       if (ret < 0)
+               goto err;
+       *f._p = '\0';
+       _base = realloc(f._bf._base, (size_t)ret + 1);
+       if (_base == NULL)
+               goto err;
+       *str = (char *)_base;
+       return (ret);
 
-       return retval;
-}
-
-int
-vasprintf(char **ret, const char *fmt, va_list ap)
-{
-       char *buf, *new_buf;
-       size_t len;
-       int retval;
-
-       len = 128;
-       buf = malloc(len);
-       if (buf == NULL) {
-               *ret = NULL;
-               return -1;
-       }
-
-       retval = vsnprintf(buf, len, fmt, ap);
-       if (retval < 0) {
-               free(buf);
-               *ret = NULL;
-               return -1;
-       }
-
-       if (retval < len) {
-               new_buf = realloc(buf, retval + 1);
-               if (new_buf == NULL)
-                       *ret = buf;
-               else
-                       *ret = new_buf;
-               return retval;
-       }
-
-       len = (size_t)retval + 1;
-       free(buf);
-       buf = malloc(len);
-       if (buf == NULL) {
-               *ret = NULL;
-               return -1;
-       }
-       retval = vsnprintf(buf, len, fmt, ap);
-       if (retval != len - 1) {
-               free(buf);
-               *ret = NULL;
-               return -1;
-       }
-       *ret = buf;
-       return retval;
+err:
+       if (f._bf._base)
+               free(f._bf._base);
+       *str = NULL;
+       errno = ENOMEM;
+       return (-1);
 }
diff --git a/lib/libc/stdio/clearerr.c b/lib/libc/stdio/clearerr.c
deleted file mode 100644 (file)
index 6379aae..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * clearerr.c - clear error and end-of-file indicators of a stream
- */
-/* $Header$ */
-
-#include       <stdio.h>
-
-void
-(clearerr)(FILE *stream)
-{
-       clearerr(stream);
-}
diff --git a/lib/libc/stdio/data.c b/lib/libc/stdio/data.c
deleted file mode 100644 (file)
index 3ca1585..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * data.c - this is the initialization for the standard streams
- */
-/* $Header$ */
-
-#include       <stdio.h>
-
-struct __iobuf __stdin = {
-       0, 0, _IOREAD, 0,
-       (unsigned char *)NULL, (unsigned char *)NULL, 
-};
-
-struct __iobuf __stdout = {
-       0, 1, _IOWRITE, 0,
-       (unsigned char *)NULL, (unsigned char *)NULL, 
-};
-
-struct __iobuf __stderr = {
-       0, 2, _IOWRITE | _IOLBF, 0,
-       (unsigned char *)NULL, (unsigned char *)NULL, 
-};
-
-FILE *__iotab[FOPEN_MAX] = {
-       &__stdin,
-       &__stdout,
-       &__stderr,
-       0
-};
diff --git a/lib/libc/stdio/doprnt.c b/lib/libc/stdio/doprnt.c
deleted file mode 100644 (file)
index 22e9785..0000000
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * doprnt.c - print formatted output
- */
-/* $Header$ */
-
-#include       <ctype.h>
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       <string.h>
-#include       "loc_incl.h"
-
-/* gnum() is used to get the width and precision fields of a format. */
-static const char *
-gnum(register const char *f, int *ip, va_list *app)
-{
-       register int    i, c;
-
-       if (*f == '*') {
-               *ip = va_arg((*app), int);
-               f++;
-       } else {
-               i = 0;
-               while ((c = *f - '0') >= 0 && c <= 9) {
-                       i = i*10 + c;
-                       f++;
-               }
-               *ip = i;
-       }
-       return f;
-}
-
-#if    _EM_WSIZE == _EM_PSIZE
-#define set_pointer(flags)                             /* nothing */
-#elif  _EM_LSIZE == _EM_PSIZE
-#define set_pointer(flags)     (flags |= FL_LONG)
-#else
-#error garbage pointer size
-#define set_pointer(flags)             /* compilation might continue */
-#endif
-
-/* print an ordinal number */
-static char *
-o_print(va_list *ap, int flags, char *s, char c, int precision, int is_signed)
-{
-       printval_s_t signed_val;
-       printval_u_t unsigned_val;
-       char *old_s = s;
-       int base;
-
-       switch (flags & (FL_SHORT | FL_LONG | FL_LONGLONG)) {
-       case FL_SHORT:
-               if (is_signed) {
-                       signed_val = (short) va_arg(*ap, int);
-               } else {
-                       unsigned_val = (unsigned short) va_arg(*ap, unsigned);
-               }
-               break;
-       case FL_LONG:
-               if (is_signed) {
-                       signed_val = va_arg(*ap, long);
-               } else {
-                       unsigned_val = va_arg(*ap, unsigned long);
-               }
-               break;
-#if defined(__LONG_LONG_SUPPORTED)
-       case FL_LONG | FL_LONGLONG:
-               if (is_signed) {
-                       signed_val = va_arg(*ap, long long);
-               } else {
-                       unsigned_val = va_arg(*ap, unsigned long long);
-               }
-               break;
-#endif
-       default:
-               if (is_signed) {
-                       signed_val = va_arg(*ap, int);
-               } else {
-                       unsigned_val = va_arg(*ap, unsigned int);
-               }
-               break;
-       }
-
-       if (is_signed) {
-               if (signed_val < 0) {
-                       *s++ = '-';
-                       signed_val = -signed_val;
-               } else if (flags & FL_SIGN) *s++ = '+';
-               else if (flags & FL_SPACE) *s++ = ' ';
-               unsigned_val = signed_val;
-       }
-       if ((flags & FL_ALT) && (c == 'o')) *s++ = '0';
-       if (!unsigned_val && c != 'p') {
-                if (!precision)
-                       return s;
-       } else if (((flags & FL_ALT) && (c == 'x' || c == 'X'))
-                   || c == 'p') {
-               *s++ = '0';
-               *s++ = (c == 'X' ? 'X' : 'x');
-       }
-
-       switch (c) {
-       case 'b':       base = 2;       break;
-       case 'o':       base = 8;       break;
-       case 'd':
-       case 'i':
-       case 'u':       base = 10;      break;
-       case 'x':
-       case 'X':
-       case 'p':       base = 16;      break;
-       default:        base = 10;      break;
-       }
-
-       s = _i_compute(unsigned_val, base, s, precision);
-
-       if (c == 'X')
-               while (old_s != s) {
-                       *old_s = toupper(*old_s);
-                       old_s++;
-               }
-
-       return s;
-}
-
-int
-_doprnt(register const char *fmt, va_list ap, FILE *stream)
-{
-       register char   *s;
-       register int    j;
-       int             i, c, width, precision, zfill, flags, between_fill;
-       int             nrchars=0;
-       const char      *oldfmt;
-       char            *s1, buf[1025];
-
-       while ((c = *fmt++)) {
-               if (c != '%') {
-#ifdef CPM
-                       if (c == '\n') {
-                               if (putc('\r', stream) == EOF)
-                                       return nrchars ? -nrchars : -1;
-                               nrchars++;
-                       }
-#endif
-                       if (putc(c, stream) == EOF)
-                               return nrchars ? -nrchars : -1;
-                       nrchars++;
-                       continue;
-               }
-               flags = 0;
-               do {
-                       switch(*fmt) {
-                       case '-':       flags |= FL_LJUST;      break;
-                       case '+':       flags |= FL_SIGN;       break;
-                       case ' ':       flags |= FL_SPACE;      break;
-                       case '#':       flags |= FL_ALT;        break;
-                       case '0':       flags |= FL_ZEROFILL;   break;
-                       default:        flags |= FL_NOMORE;     continue;
-                       }
-                       fmt++;
-               } while(!(flags & FL_NOMORE));
-
-               oldfmt = fmt;
-               fmt = gnum(fmt, &width, &ap);
-               if (fmt != oldfmt) flags |= FL_WIDTHSPEC;
-
-               if (*fmt == '.') {
-                       fmt++; oldfmt = fmt;
-                       fmt = gnum(fmt, &precision, &ap);
-                       if (precision >= 0) flags |= FL_PRECSPEC;
-               }
-
-               if ((flags & FL_WIDTHSPEC) && width < 0) {
-                       width = -width;
-                       flags |= FL_LJUST;
-               }
-               if (!(flags & FL_WIDTHSPEC)) width = 0;
-
-               if (flags & FL_SIGN) flags &= ~FL_SPACE;
-
-               if (flags & FL_LJUST) flags &= ~FL_ZEROFILL;
-
-
-               s = s1 = buf;
-
-               flags &= ~FL_NOMORE;
-               do {
-                       switch (*fmt) {
-                       case 'h':
-                               flags |= FL_SHORT;
-                               break;
-                       case 'j':       
-                               flags |= FL_LONG;
-#if defined(__LONG_LONG_SUPPORTED)
-                               flags |= FL_LONGLONG;
-#endif
-                               break;
-                       case 'l':       
-                               if(flags & FL_LONG)
-                                       flags |= FL_LONGLONG;
-                               else
-                                       flags |= FL_LONG;
-                               break;
-                       case 'L':
-                               flags |= FL_LONGDOUBLE;
-                               break;
-                       default:
-                               flags |= FL_NOMORE;
-                               continue;
-                       }
-                       fmt++;
-               } while(!(flags & FL_NOMORE));
-
-               switch (c = *fmt++) {
-               default:
-#ifdef CPM
-                       if (c == '\n') {
-                               if (putc('\r', stream) == EOF)
-                                       return nrchars ? -nrchars : -1;
-                               nrchars++;
-                       }
-#endif
-                       if (putc(c, stream) == EOF)
-                               return nrchars ? -nrchars : -1;
-                       nrchars++;
-                       continue;
-               case 'n':
-                       if (flags & FL_SHORT)
-                               *va_arg(ap, short *) = (short) nrchars;
-                       else if (flags & FL_LONG)
-                               *va_arg(ap, long *) = (long) nrchars;
-                       else
-                               *va_arg(ap, int *) = (int) nrchars;
-                       continue;
-               case 's':
-                       s1 = va_arg(ap, char *);
-                       if (s1 == NULL)
-                               s1 = "(null)";
-                       s = s1;
-                       while (precision || !(flags & FL_PRECSPEC)) {
-                               if (*s == '\0')
-                                       break;
-                               s++;
-                               precision--;
-                       }
-                       break;
-               case 'p':
-                       set_pointer(flags);
-                       /* fallthrough */
-               case 'b':
-               case 'o':
-               case 'u':
-               case 'x':
-               case 'X':
-                       if (!(flags & FL_PRECSPEC)) precision = 1;
-                       else if (c != 'p') flags &= ~FL_ZEROFILL;
-                       s = o_print(&ap, flags, s, c, precision, 0);
-                       break;
-               case 'd':
-               case 'i':
-                       flags |= FL_SIGNEDCONV;
-                       if (!(flags & FL_PRECSPEC)) precision = 1;
-                       else flags &= ~FL_ZEROFILL;
-                       s = o_print(&ap, flags, s, c, precision, 1);
-                       break;
-               case 'c':
-                       *s++ = va_arg(ap, int);
-                       break;
-#ifndef NOFLOAT
-               case 'G':
-               case 'g':
-                       if ((flags & FL_PRECSPEC) && (precision == 0))
-                               precision = 1;
-               case 'f':
-               case 'E':
-               case 'e':
-                       if (!(flags & FL_PRECSPEC)) 
-                               precision = 6;
-
-                       if (precision >= sizeof(buf))
-                               precision = sizeof(buf) - 1;
-
-                       flags |= FL_SIGNEDCONV;
-                       s = _f_print(&ap, flags, s, c, precision);
-                       break;
-#endif /* NOFLOAT */
-               case 'r':
-                       ap = va_arg(ap, va_list);
-                       fmt = va_arg(ap, char *);
-                       continue;
-               }
-               zfill = ' ';
-               if (flags & FL_ZEROFILL) zfill = '0';
-               j = s - s1;
-
-               /* between_fill is true under the following conditions:
-                * 1- the fill character is '0'
-                * and
-                * 2a- the number is of the form 0x... or 0X...
-                * or
-                * 2b- the number contains a sign or space
-                */
-               between_fill = 0;
-               if ((flags & FL_ZEROFILL)
-                   && (((c == 'x' || c == 'X') && (flags & FL_ALT) && j > 1)
-                       || (c == 'p')
-                       || ((flags & FL_SIGNEDCONV)
-                           && ( *s1 == '+' || *s1 == '-' || *s1 == ' '))))
-                       between_fill++;
-
-               if ((i = width - j) > 0)
-                       if (!(flags & FL_LJUST)) {      /* right justify */
-                               nrchars += i;
-                               if (between_fill) {
-                                   if (flags & FL_SIGNEDCONV) {
-                                       j--; nrchars++;
-                                       if (putc(*s1++, stream) == EOF)
-                                               return nrchars ? -nrchars : -1;
-                                   } else {
-                                       j -= 2; nrchars += 2;
-                                       if ((putc(*s1++, stream) == EOF)
-                                           || (putc(*s1++, stream) == EOF))
-                                               return nrchars ? -nrchars : -1;
-                                   }
-                               }
-                               do {
-                                       if (putc(zfill, stream) == EOF)
-                                               return nrchars ? -nrchars : -1;
-                               } while (--i);
-                       }
-
-               nrchars += j;
-               while (--j >= 0) {
-                       if (putc(*s1++, stream) == EOF)
-                               return nrchars ? -nrchars : -1;
-               }
-
-               if (i > 0) nrchars += i;
-               while (--i >= 0)
-                       if (putc(zfill, stream) == EOF)
-                               return nrchars ? -nrchars : -1;
-       }
-       return nrchars;
-}
diff --git a/lib/libc/stdio/doscan.c b/lib/libc/stdio/doscan.c
deleted file mode 100644 (file)
index a9386a6..0000000
+++ /dev/null
@@ -1,450 +0,0 @@
-/*
- * doscan.c - scan formatted input
- */
-/* $Header$ */
-
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       <ctype.h>
-#include       <stdarg.h>
-#include       "loc_incl.h"
-
-#if    _EM_WSIZE == _EM_PSIZE
-#define set_pointer(flags)                             /* nothing */
-#elif  _EM_LSIZE == _EM_PSIZE
-#define set_pointer(flags)     (flags |= FL_LONG)
-#else
-#error garbage pointer size
-#define set_pointer(flags)             /* compilation might continue */
-#endif
-
-#define        NUMLEN  512
-#define        NR_CHARS        256
-
-static char    Xtable[NR_CHARS];
-static char    inp_buf[NUMLEN];
-
-/* Collect a number of characters which constitite an ordinal number.
- * When the type is 'i', the base can be 8, 10, or 16, depending on the
- * first 1 or 2 characters. This means that the base must be adjusted
- * according to the format of the number. At the end of the function, base
- * is then set to 0, so strtol() will get the right argument.
- */
-static char *
-o_collect(register int c, register FILE *stream, char type,
-                       unsigned int width, int *basep)
-{
-       register char *bufp = inp_buf;
-       register int base;
-
-       switch (type) {
-       case 'i':       /* i means octal, decimal or hexadecimal */
-       case 'p':
-       case 'x':
-       case 'X':       base = 16;      break;
-       case 'd':
-       case 'u':       base = 10;      break;
-       case 'o':       base = 8;       break;
-       case 'b':       base = 2;       break;
-       default:        base = 10;      break;
-       }
-
-       if (c == '-' || c == '+') {
-               *bufp++ = c;
-               if (--width)
-                   c = getc(stream);
-       }
-
-       if (width && c == '0' && base == 16) {
-               *bufp++ = c;
-               if (--width)
-                       c = getc(stream);
-               if (c != 'x' && c != 'X') {
-                       if (type == 'i') base = 8;
-               }
-               else if (width) {
-                       *bufp++ = c;
-                       if (--width)
-                               c = getc(stream);
-               }
-       }
-       else if (type == 'i') base = 10;
-
-       while (width) {
-               if (((base == 10) && isdigit(c))
-                   || ((base == 16) && isxdigit(c))
-                   || ((base == 8) && isdigit(c) && (c < '8'))
-                   || ((base == 2) && isdigit(c) && (c < '2'))) {
-                       *bufp++ = c;
-                       if (--width)
-                               c = getc(stream);
-               }
-               else break;
-       }
-
-       if (width && c != EOF) ungetc(c, stream);
-       if (type == 'i') base = 0;
-       *basep = base;
-       *bufp = '\0';
-       return bufp - 1;
-}
-
-#ifndef        NOFLOAT
-/* The function f_collect() reads a string that has the format of a
- * floating-point number. The function returns as soon as a format-error
- * is encountered, leaving the offending character in the input. This means
- * that 1.el leaves the 'l' in the input queue. Since all detection of
- * format errors is done here, _doscan() doesn't call strtod() when it's
- * not necessary, although the use of the width field can cause incomplete
- * numbers to be passed to strtod(). (e.g. 1.3e+)
- */
-static char *
-f_collect(register int c, register FILE *stream, register unsigned int width)
-{
-       register char *bufp = inp_buf;
-       int digit_seen = 0;
-
-       if (c == '-' || c == '+') {
-               *bufp++ = c;
-               if (--width)
-                       c = getc(stream);
-       }
-
-       while (width && isdigit(c)) {
-               digit_seen++;
-               *bufp++ = c;
-               if (--width)
-                       c = getc(stream);
-       }
-       if (width && c == '.') {
-               *bufp++ = c;
-               if(--width)
-                       c = getc(stream);
-               while (width && isdigit(c)) {
-                       digit_seen++;
-                       *bufp++ = c;
-                       if (--width)
-                               c = getc(stream);
-               }
-       }
-
-       if (!digit_seen) {
-               if (width && c != EOF) ungetc(c, stream);
-               return inp_buf - 1;
-       }
-       else digit_seen = 0;
-
-       if (width && (c == 'e' || c == 'E')) {
-               *bufp++ = c;
-               if (--width)
-                       c = getc(stream);
-               if (width && (c == '+' || c == '-')) {
-                       *bufp++ = c;
-                       if (--width)
-                               c = getc(stream);
-               }
-               while (width && isdigit(c)) {
-                       digit_seen++;
-                       *bufp++ = c;
-                       if (--width)
-                               c = getc(stream);
-               }
-               if (!digit_seen) {
-                       if (width && c != EOF) ungetc(c,stream);
-                       return inp_buf - 1;
-               }
-       }
-
-       if (width && c != EOF) ungetc(c, stream);
-       *bufp = '\0';
-       return bufp - 1;
-}
-#endif /* NOFLOAT */
-
-
-/*
- * the routine that does the scanning 
- */
-
-int
-_doscan(register FILE *stream, const char *format, va_list ap)
-{
-       int             done = 0;       /* number of items done */
-       int             nrchars = 0;    /* number of characters read */
-       int             conv = 0;       /* # of conversions */
-       int             base;           /* conversion base */
-       unsigned long   val;            /* an integer value */
-       register char   *str;           /* temporary pointer */
-       char            *tmp_string;    /* ditto */
-       unsigned        width = 0;      /* width of field */
-       int             flags;          /* some flags */
-       int             reverse;        /* reverse the checking in [...] */
-       int             kind;
-       register int    ic = EOF;       /* the input character */
-#ifndef        NOFLOAT
-       long double     ld_val;
-#endif
-
-       if (!*format) return 0;
-
-       while (1) {
-               if (isspace(*format)) {
-                       while (isspace(*format))
-                               format++;       /* skip whitespace */
-                       ic = getc(stream);
-                       nrchars++;
-                       while (isspace (ic)) {
-                               ic = getc(stream);
-                               nrchars++;
-                       }
-                       if (ic != EOF) ungetc(ic,stream);
-                       nrchars--;
-               }
-               if (!*format) break;    /* end of format */
-
-               if (*format != '%') {
-                       ic = getc(stream);
-                       nrchars++;
-                       if (ic != *format++) break;     /* error */
-                       continue;
-               }
-               format++;
-               if (*format == '%') {
-                       ic = getc(stream);
-                       nrchars++;
-                       if (ic == '%') {
-                               format++;
-                               continue;
-                       }
-                       else break;
-               }
-               flags = 0;
-               if (*format == '*') {
-                       format++;
-                       flags |= FL_NOASSIGN;
-               }
-               if (isdigit (*format)) {
-                       flags |= FL_WIDTHSPEC;
-                       for (width = 0; isdigit (*format);)
-                               width = width * 10 + *format++ - '0';
-               }
-
-               switch (*format) {
-               case 'h': flags |= FL_SHORT; format++; break;
-               case 'l': flags |= FL_LONG; format++; break;
-               case 'L': flags |= FL_LONGDOUBLE; format++; break;
-               }
-               kind = *format;
-               if ((kind != 'c') && (kind != '[') && (kind != 'n')) {
-                       do {
-                               ic = getc(stream);
-                               nrchars++;
-                       } while (isspace(ic));
-                       if (ic == EOF) break;           /* outer while */
-               } else if (kind != 'n') {               /* %c or %[ */
-                       ic = getc(stream);
-                       if (ic == EOF) break;           /* outer while */
-                       nrchars++;
-               }
-               switch (kind) {
-               default:
-                       /* not recognized, like %q */
-                       return conv || (ic != EOF) ? done : EOF;
-                       break;
-               case 'n':
-                       if (!(flags & FL_NOASSIGN)) {   /* silly, though */
-                               if (flags & FL_SHORT)
-                                       *va_arg(ap, short *) = (short) nrchars;
-                               else if (flags & FL_LONG)
-                                       *va_arg(ap, long *) = (long) nrchars;
-                               else
-                                       *va_arg(ap, int *) = (int) nrchars;
-                       }
-                       break;
-               case 'p':               /* pointer */
-                       set_pointer(flags);
-                       /* fallthrough */
-               case 'b':               /* binary */
-               case 'd':               /* decimal */
-               case 'i':               /* general integer */
-               case 'o':               /* octal */
-               case 'u':               /* unsigned */
-               case 'x':               /* hexadecimal */
-               case 'X':               /* ditto */
-                       if (!(flags & FL_WIDTHSPEC) || width > NUMLEN)
-                               width = NUMLEN;
-                       if (!width) return done;
-
-                       str = o_collect(ic, stream, kind, width, &base);
-                       if (str < inp_buf
-                           || (str == inp_buf
-                                   && (*str == '-'
-                                       || *str == '+'))) return done;
-
-                       /*
-                        * Although the length of the number is str-inp_buf+1
-                        * we don't add the 1 since we counted it already
-                        */
-                       nrchars += str - inp_buf;
-
-                       if (!(flags & FL_NOASSIGN)) {
-                               if (kind == 'd' || kind == 'i')
-                                   val = strtol(inp_buf, &tmp_string, base);
-                               else
-                                   val = strtoul(inp_buf, &tmp_string, base);
-                               if (flags & FL_LONG)
-                                       *va_arg(ap, unsigned long *) = (unsigned long) val;
-                               else if (flags & FL_SHORT)
-                                       *va_arg(ap, unsigned short *) = (unsigned short) val;
-                               else
-                                       *va_arg(ap, unsigned *) = (unsigned) val;
-                       }
-                       break;
-               case 'c':
-                       if (!(flags & FL_WIDTHSPEC))
-                               width = 1;
-                       if (!(flags & FL_NOASSIGN))
-                               str = va_arg(ap, char *);
-                       if (!width) return done;
-
-                       while (width && ic != EOF) {
-                               if (!(flags & FL_NOASSIGN))
-                                       *str++ = (char) ic;
-                               if (--width) {
-                                       ic = getc(stream);
-                                       nrchars++;
-                               }
-                       }
-
-                       if (width) {
-                               if (ic != EOF) ungetc(ic,stream);
-                               nrchars--;
-                       }
-                       break;
-               case 's':
-                       if (!(flags & FL_WIDTHSPEC))
-                               width = 0xffff;
-                       if (!(flags & FL_NOASSIGN))
-                               str = va_arg(ap, char *);
-                       if (!width) return done;
-
-                       while (width && ic != EOF && !isspace(ic)) {
-                               if (!(flags & FL_NOASSIGN))
-                                       *str++ = (char) ic;
-                               if (--width) {
-                                       ic = getc(stream);
-                                       nrchars++;
-                               }
-                       }
-                       /* terminate the string */
-                       if (!(flags & FL_NOASSIGN))
-                               *str = '\0';    
-                       if (width) {
-                               if (ic != EOF) ungetc(ic,stream);
-                               nrchars--;
-                       }
-                       break;
-               case '[':
-                       if (!(flags & FL_WIDTHSPEC))
-                               width = 0xffff;
-                       if (!width) return done;
-
-                       if ( *++format == '^' ) {
-                               reverse = 1;
-                               format++;
-                       } else
-                               reverse = 0;
-
-                       for (str = Xtable; str < &Xtable[NR_CHARS]
-                                                       ; str++)
-                               *str = 0;
-
-                       if (*format == ']') Xtable[*format++] = 1;
-
-                       while (*format && *format != ']') {
-                               Xtable[*format++] = 1;
-                               if (*format == '-') {
-                                       format++;
-                                       if (*format
-                                           && *format != ']'
-                                           && *(format) >= *(format -2)) {
-                                               int c;
-
-                                               for( c = *(format -2) + 1
-                                                   ; c <= *format ; c++)
-                                                       Xtable[c] = 1;
-                                               format++;
-                                       }
-                                       else Xtable['-'] = 1;
-                               }
-                       }
-                       if (!*format) return done;
-                       
-                       if (!(Xtable[ic] ^ reverse)) {
-                       /* MAT 8/9/96 no match must return character */
-                               ungetc(ic, stream);
-                               return done;
-                       }
-
-                       if (!(flags & FL_NOASSIGN))
-                               str = va_arg(ap, char *);
-
-                       do {
-                               if (!(flags & FL_NOASSIGN))
-                                       *str++ = (char) ic;
-                               if (--width) {
-                                       ic = getc(stream);
-                                       nrchars++;
-                               }
-                       } while (width && ic != EOF && (Xtable[ic] ^ reverse));
-
-                       if (width) {
-                               if (ic != EOF) ungetc(ic, stream);
-                               nrchars--;
-                       }
-                       if (!(flags & FL_NOASSIGN)) {   /* terminate string */
-                               *str = '\0';    
-                       }
-                       break;
-#ifndef        NOFLOAT
-               case 'e':
-               case 'E':
-               case 'f':
-               case 'g':
-               case 'G':
-                       if (!(flags & FL_WIDTHSPEC) || width > NUMLEN)
-                               width = NUMLEN;
-
-                       if (!width) return done;
-                       str = f_collect(ic, stream, width);
-
-                       if (str < inp_buf
-                           || (str == inp_buf
-                               && (*str == '-'
-                                   || *str == '+'))) return done;
-
-                       /*
-                        * Although the length of the number is str-inp_buf+1
-                        * we don't add the 1 since we counted it already
-                        */
-                       nrchars += str - inp_buf;
-
-                       if (!(flags & FL_NOASSIGN)) {
-                               ld_val = strtod(inp_buf, &tmp_string);
-                               if (flags & FL_LONGDOUBLE)
-                                       *va_arg(ap, long double *) = (long double) ld_val;
-                               else
-                                   if (flags & FL_LONG)
-                                       *va_arg(ap, double *) = (double) ld_val;
-                               else
-                                       *va_arg(ap, float *) = (float) ld_val;
-                       }
-                       break;
-#endif
-               }               /* end switch */
-               conv++;
-               if (!(flags & FL_NOASSIGN) && kind != 'n') done++;
-               format++;
-       }
-       return conv || (ic != EOF) ? done : EOF;
-}
diff --git a/lib/libc/stdio/ecvt.c b/lib/libc/stdio/ecvt.c
deleted file mode 100644 (file)
index d4e0ed7..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/* $Header$ */
-
-#ifndef NOFLOAT
-
-#include       "../ansi/ext_fmt.h"
-void _dbl_ext_cvt(double value, struct EXTEND *e);
-char *_ext_str_cvt(struct EXTEND *e, int ndigit, int *decpt, int * sign, int ecvtflag);
-
-static char *
-cvt(long double value, int ndigit, int *decpt, int *sign, int ecvtflag)
-{
-       struct EXTEND e;
-
-       _dbl_ext_cvt(value, &e);
-       return _ext_str_cvt(&e, ndigit, decpt, sign, ecvtflag);
-}
-
-char *
-_ecvt(long double value, int ndigit, int *decpt, int *sign)
-{
-
-       return cvt(value, ndigit, decpt, sign, 1);
-}
-
-char *
-_fcvt(long double value, int ndigit, int *decpt, int *sign)
-{
-       return cvt(value, ndigit, decpt, sign, 0);
-}
-
-#endif /* NOFLOAT */
index 85ecb420a3ac2ae3494ba76098419e5745c5c272..c1e0d249ed0f4026e43530b308dc533ac93db4c7 100644 (file)
@@ -1,32 +1,78 @@
-/*
- * fclose.c - flush a stream and close the file
+/*     $NetBSD: fclose.c,v 1.17 2010/01/11 20:39:29 joerg Exp $        */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fclose.c   8.1 (Berkeley) 6/4/93";
+#endif
+__RCSID("$NetBSD: fclose.c,v 1.17 2010/01/11 20:39:29 joerg Exp $");
+#endif /* LIBC_SCCS and not lint */
 
-int _close(int d);
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include "reentrant.h"
+#include "local.h"
 
 int
-fclose(FILE *fp)
+fclose(fp)
+       FILE *fp;
 {
-       register int i, retval = 0;
+       int r;
+
+       _DIAGASSERT(fp != NULL);
 
-       for (i=0; i<FOPEN_MAX; i++)
-               if (fp == __iotab[i]) {
-                       __iotab[i] = 0;
-                       break;
-               }
-       if (i >= FOPEN_MAX)
-               return EOF;
-       if (fflush(fp)) retval = EOF;
-       if (_close(fileno(fp))) retval = EOF;
-       if ( io_testflag(fp,_IOMYBUF) && fp->_buf )
-               free((void *)fp->_buf);
-       fp->_buf = NULL;
-       if (fp != stdin && fp != stdout && fp != stderr)
-               free((void *)fp);
-       return retval;
+       if (fp->_flags == 0) {  /* not open! */
+               errno = EBADF;
+               return (EOF);
+       }
+       FLOCKFILE(fp);
+       WCIO_FREE(fp);
+       r = fp->_flags & __SWR ? __sflush(fp) : 0;
+       if (fp->_close != NULL && (*fp->_close)(fp->_cookie) < 0)
+               r = EOF;
+       if (fp->_flags & __SMBF)
+               free((char *)fp->_bf._base);
+       if (HASUB(fp))
+               FREEUB(fp);
+       FREELB(fp);
+       FUNLOCKFILE(fp);
+       fp->_file = -1;
+       fp->_flags = 0;         /* Release this FILE for reuse. */
+       fp->_r = fp->_w = 0;    /* Mess up if reaccessed. */
+       return (r);
 }
index 98eade6c6047829e99f12932955704bbc570075e..904b9b403facfc1ae39b89c452c6a47c59ed8e55 100644 (file)
@@ -1,12 +1,66 @@
-/*
- * feof.c - test if eof on a stream occurred
+/*     $NetBSD: feof.c,v 1.11 2003/08/07 16:43:22 agc Exp $    */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)feof.c     8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: feof.c,v 1.11 2003/08/07 16:43:22 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+
+/*
+ * A subroutine version of the macro feof.
+ */
+#undef feof
 
 int
-(feof)(FILE *stream)
+feof(fp)
+       FILE *fp;
 {
-       return feof(stream);
+       int r;
+
+       _DIAGASSERT(fp != NULL);
+
+       FLOCKFILE(fp);
+       r = __sfeof(fp);
+       FUNLOCKFILE(fp);
+       return r;
 }
index c52c84b6b695bcb279a214efc76b9f29ee309ed6..97b58a79a9fd6032b1f0c526ffadc2b32246fb6c 100644 (file)
@@ -1,12 +1,66 @@
-/*
- * ferror .c - test if an error on a stream occurred
+/*     $NetBSD: ferror.c,v 1.11 2003/08/07 16:43:22 agc Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)ferror.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: ferror.c,v 1.11 2003/08/07 16:43:22 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+
+/*
+ * A subroutine version of the macro ferror.
+ */
+#undef ferror
 
 int
-(ferror)(FILE *stream)
+ferror(fp)
+       FILE *fp;
 {
-       return ferror(stream);
+       int r;
+
+       _DIAGASSERT(fp != NULL);
+
+       FLOCKFILE(fp);
+       r = __sferror(fp);
+       FUNLOCKFILE(fp);
+       return r;
 }
index b154609d00428a17edb5229faa70a9f6ff94cab5..a78ad5e4d516c01afdd161c9c498319c38bccf5f 100644 (file)
-/*
- * fflush.c - flush stream(s)
+/*     $NetBSD: fflush.c,v 1.15 2003/08/07 16:43:22 agc Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <sys/types.h>
-#include       <stdio.h>
-#include       <errno.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fflush.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fflush.c,v 1.15 2003/08/07 16:43:22 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
 
-ssize_t _write(int d, const char *buf, size_t nbytes);
-off_t _lseek(int fildes, off_t offset, int whence);
+#ifdef _REENTRANT
+extern rwlock_t __sfp_lock;
+#endif
 
+/* Flush a single file, or (if fp is NULL) all files.  */
 int
-fflush(FILE *stream)
+fflush(fp)
+       FILE *fp;
 {
-       int count, c1, i, retval = 0;
+       int r;
 
-       if (!stream) {
-           for(i= 0; i < FOPEN_MAX; i++)
-               if (__iotab[i] && fflush(__iotab[i]))
-                       retval = EOF;
-           return retval;
+       if (fp == NULL) {
+               rwlock_rdlock(&__sfp_lock);
+               r = _fwalk(__sflush);
+               rwlock_unlock(&__sfp_lock);
+               return r;
        }
 
-       if (!stream->_buf
-           || (!io_testflag(stream, _IOREADING)
-               && !io_testflag(stream, _IOWRITING)))
-               return 0;
-       if (io_testflag(stream, _IOREADING)) {
-               /* (void) fseek(stream, 0L, SEEK_CUR); */
-               int adjust = 0;
-               if (io_testflag(stream, _IOFIFO)) {
-                       /* Can't seek in a pipe. */
-                       return 0;
-               }
-               if (stream->_buf && !io_testflag(stream,_IONBF))
-                       adjust = -stream->_count;
-               stream->_count = 0;
-               if (_lseek(fileno(stream), (off_t) adjust, SEEK_CUR) == -1 &&
-                 errno != ESPIPE) {
-                       stream->_flags |= _IOERR;
-                       return EOF;
-               }
-               errno = 0;
-               if (io_testflag(stream, _IOWRITE))
-                       stream->_flags &= ~(_IOREADING | _IOWRITING);
-               stream->_ptr = stream->_buf;
-               return 0;
-       } else if (io_testflag(stream, _IONBF)) return 0;
-
-       if (io_testflag(stream, _IOREAD))               /* "a" or "+" mode */
-               stream->_flags &= ~_IOWRITING;
-
-       count = stream->_ptr - stream->_buf;
-       stream->_ptr = stream->_buf;
+       FLOCKFILE(fp);
+       if ((fp->_flags & (__SWR | __SRW)) == 0) {
+               errno = EBADF;
+               r = EOF;
+       } else {
+               r = __sflush(fp);
+       }
+       FUNLOCKFILE(fp);
+       return r;
+}
 
-       if ( count <= 0 )
-               return 0;
+int
+__sflush(fp)
+       FILE *fp;
+{
+       unsigned char *p;
+       int n, t;
 
-       if (io_testflag(stream, _IOAPPEND)) {
-               if (_lseek(fileno(stream), 0L, SEEK_END) == -1) {
-                       stream->_flags |= _IOERR;
-                       return EOF;
-               }
-       }
-       c1 = _write(stream->_fd, (char *)stream->_buf, count);
+       _DIAGASSERT(fp != NULL);
 
-       stream->_count = 0;
+       t = fp->_flags;
+       if ((t & __SWR) == 0)
+               return (0);
 
-       if ( count == c1 )
-               return 0;
+       if ((p = fp->_bf._base) == NULL)
+               return (0);
 
-       stream->_flags |= _IOERR;
-       return EOF; 
-}
+       n = fp->_p - p;         /* write this much */
 
-void
-__cleanup(void)
-{
-       register int i;
+       /*
+        * Set these immediately to avoid problems with longjmp and to allow
+        * exchange buffering (via setvbuf) in user write function.
+        */
+       fp->_p = p;
+       fp->_w = t & (__SLBF|__SNBF) ? 0 : fp->_bf._size;
 
-       for(i= 0; i < FOPEN_MAX; i++)
-               if (__iotab[i] && io_testflag(__iotab[i], _IOWRITING))
-                       (void) fflush(__iotab[i]);
+       for (; n > 0; n -= t, p += t) {
+               t = (*fp->_write)(fp->_cookie, (char *)p, n);
+               if (t <= 0) {
+                       fp->_flags |= __SERR;
+                       return (EOF);
+               }
+       }
+       return (0);
 }
index e7a488326973f3a2becda23c777321652195a012..4783cfe78a112d9bbebfa56dce34fd56ac013798 100644 (file)
@@ -1,12 +1,62 @@
-/*
- * fgetc - get an unsigned character and return it as an int
+/*     $NetBSD: fgetc.c,v 1.11 2003/08/07 16:43:22 agc Exp $   */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fgetc.c    8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fgetc.c,v 1.11 2003/08/07 16:43:22 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
 
 int
-fgetc(FILE *stream)
+fgetc(fp)
+       FILE *fp;
 {
-       return getc(stream);
+       int r;
+
+       _DIAGASSERT(fp != NULL);
+
+       FLOCKFILE(fp);
+       r = __sgetc(fp);
+       FUNLOCKFILE(fp);
+       return r;
 }
index d92e30c00df4936aacea65ddca456a8d4a4c9dee..e0c97e97778fdc5ad38f6d704a9a08936dc08aae 100644 (file)
@@ -1,14 +1,58 @@
-/*
- * fgetpos.c - get the position in the file
+/*     $NetBSD: fgetpos.c,v 1.11 2003/08/07 16:43:23 agc Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fgetpos.c  8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fgetpos.c,v 1.11 2003/08/07 16:43:23 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
 
 int
-fgetpos(FILE *stream, fpos_t *pos)
+fgetpos(fp, pos)
+       FILE *fp;
+       fpos_t *pos;
 {
-       *pos = ftell(stream);
-       if (*pos == -1) return -1;
-       return 0;
+       _DIAGASSERT(fp != NULL);
+       _DIAGASSERT(pos != NULL);
+
+       return((*pos = (off_t)ftello(fp)) == (off_t)-1);
 }
index 1072a736b60e54aaafad8d324df01e6c463a5aa8..15a737059deeb53cd23a07c58a308e2c3b4eed7a 100644 (file)
-/*
- * fgets.c - get a string from a file
+/*     $NetBSD: fgets.c,v 1.27 2009/10/25 20:44:13 christos Exp $      */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fgets.c    8.2 (Berkeley) 12/22/93";
+#else
+__RCSID("$NetBSD: fgets.c,v 1.27 2009/10/25 20:44:13 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
 
+#include <assert.h>
+#include <stdio.h>
+#include <errno.h>
+#include <string.h>
+#include "reentrant.h"
+#include "local.h"
+#ifdef _FORTIFY_SOURCE
+#undef fgets
+#endif
+
+/*
+ * Read at most n-1 characters from the given file.
+ * Stop when a newline has been read, or the count runs out.
+ * Return first argument, or NULL if no characters were read.
+ */
 char *
-fgets(char *s, register int n, register FILE *stream)
+fgets(buf, n, fp)
+       char *buf;
+       int n;
+       FILE *fp;
 {
-       register int ch;
-       register char *ptr;
+       int len;
+       char *s;
+       unsigned char *p, *t;
+
+       _DIAGASSERT(buf != NULL);
+       _DIAGASSERT(fp != NULL);
+
+       FLOCKFILE(fp);
+       _SET_ORIENTATION(fp, -1);
+       s = buf;
+       n--;                    /* leave space for NUL */
+       do {
+               /*
+                * If the buffer is empty, refill it.
+                */
+               if (fp->_r <= 0) {
+                       if (__srefill(fp)) {
+                               /* EOF/error: stop with partial or no line */
+                               if (s == buf) {
+                                       FUNLOCKFILE(fp);
+                                       return (NULL);
+                               }
+                               break;
+                       }
+               }
+               len = fp->_r;
+               p = fp->_p;
 
-       ptr = s;
-       while (--n > 0 && (ch = getc(stream)) != EOF) {
-               *ptr++ = ch;
-               if ( ch == '\n')
-                       break;
-       }
-       if (ch == EOF) {
-               if (feof(stream)) {
-                       if (ptr == s) return NULL;
-               } else return NULL;
-       }
-       *ptr = '\0';
-       return s;
+               /*
+                * Scan through at most n bytes of the current buffer,
+                * looking for '\n'.  If found, copy up to and including
+                * newline, and stop.  Otherwise, copy entire chunk
+                * and loop.
+                */
+               if (len > n) {
+                       if (n < 0) {
+                               /*
+                                * Caller's length <= 0
+                                * We can't write into the buffer, so cannot
+                                * return a string, so must return NULL.
+                                * Set errno and __SERR so it is consistent.
+                                * TOG gives no indication of what to do here!
+                                */
+                               errno = EINVAL;
+                               fp->_flags |= __SERR;
+                               FUNLOCKFILE(fp);
+                               return NULL;
+                       }
+                       len = n;
+               }
+               t = memchr(p, '\n', (size_t)len);
+               if (t != NULL) {
+                       len = (int)(++t - p);
+                       fp->_r -= len;
+                       fp->_p = t;
+                       (void)memcpy(s, p, (size_t)len);
+                       s[len] = 0;
+                       FUNLOCKFILE(fp);
+                       return (buf);
+               }
+               fp->_r -= len;
+               fp->_p += len;
+               (void)memcpy(s, p, (size_t)len);
+               s += len;
+               n -= len;
+       } while (n != 0);
+       *s = 0;
+       FUNLOCKFILE(fp);
+       return (buf);
 }
index 1619a30954272dbe7fd43cdababf72f1dc1b8580..6550a28c8ca22758f8da7eebd8c04a50a8ef7ba6 100644 (file)
@@ -1,12 +1,71 @@
+/*     $NetBSD: fileno.c,v 1.12 2004/05/09 17:27:53 kleink Exp $       */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fileno.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fileno.c,v 1.12 2004/05/09 17:27:53 kleink Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+
 /*
- * fileno .c - map a stream to a file descriptor
+ * A subroutine version of the macro fileno.
  */
-/* $Header$ */
+#undef fileno
+int _fileno __P((FILE *));     /* XXX */
 
-#include       <stdio.h>
+__weak_alias(fileno,_fileno)
 
 int
-(fileno)(FILE *stream)
+_fileno(fp)
+       FILE *fp;
 {
-       return stream->_fd;
+       int r;
+
+       _DIAGASSERT(fp != NULL);
+
+       FLOCKFILE(fp);
+       r = __sfileno(fp);
+       FUNLOCKFILE(fp);
+       return r;
 }
diff --git a/lib/libc/stdio/fillbuf.c b/lib/libc/stdio/fillbuf.c
deleted file mode 100644 (file)
index 148f4b9..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * fillbuf.c - fill a buffer
- */
-/* $Header$ */
-
-#if    defined(_POSIX_SOURCE)
-#include       <sys/types.h>
-#endif
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       "loc_incl.h"
-
-ssize_t _read(ssize_t d, char *buf, size_t nbytes);
-
-int
-__fillbuf(register FILE *stream)
-{
-       static unsigned char ch[FOPEN_MAX];
-       register int i;
-
-       stream->_count = 0;
-       if (fileno(stream) < 0) return EOF;
-       if (io_testflag(stream, (_IOEOF | _IOERR ))) return EOF; 
-       if (!io_testflag(stream, _IOREAD))
-            { stream->_flags |= _IOERR; return EOF; }
-       if (io_testflag(stream, _IOWRITING))
-            { stream->_flags |= _IOERR; return EOF; }
-
-       if (!io_testflag(stream, _IOREADING))
-               stream->_flags |= _IOREADING;
-       
-       if (!io_testflag(stream, _IONBF) && !stream->_buf) {
-               stream->_buf = (unsigned char *) malloc(BUFSIZ);
-               if (!stream->_buf) {
-                       stream->_flags |= _IONBF;
-               }
-               else {
-                       stream->_flags |= _IOMYBUF;
-                       stream->_bufsiz = BUFSIZ;
-               }
-       }
-
-       /* flush line-buffered output when filling an input buffer */
-       for (i = 0; i < FOPEN_MAX; i++) {
-               if (__iotab[i] && io_testflag(__iotab[i], _IOLBF))
-                       if (io_testflag(__iotab[i], _IOWRITING))
-                               (void) fflush(__iotab[i]);
-       }
-
-       if (!stream->_buf) {
-               stream->_buf = &ch[fileno(stream)];
-               stream->_bufsiz = 1;
-       }
-       stream->_ptr = stream->_buf;
-       stream->_count = _read(stream->_fd, (char *)stream->_buf, stream->_bufsiz);
-
-       if (stream->_count <= 0){
-               if (stream->_count == 0) {
-                       stream->_flags |= _IOEOF;
-               }
-               else 
-                       stream->_flags |= _IOERR;
-
-               return EOF;
-       }
-       stream->_count--;
-
-       return *stream->_ptr++;
-}
diff --git a/lib/libc/stdio/flushbuf.c b/lib/libc/stdio/flushbuf.c
deleted file mode 100644 (file)
index cd3bf96..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * flushbuf.c - flush a buffer
- */
-
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       "loc_incl.h"
-
-#include       <sys/types.h>
-
-off_t _lseek(int fildes, off_t offset, int whence);
-ssize_t _write(int d, const char *buf, int nbytes);
-int _isatty(int d);
-extern void (*_clean)(void);
-
-static int
-do_write(int d, char *buf, int nbytes)
-{
-       int c;
-
-       /* POSIX actually allows write() to return a positive value less
-          than nbytes, so loop ...
-       */
-       while ((c = _write(d, buf, nbytes)) > 0 && c < nbytes) {
-               nbytes -= c;
-               buf += c;
-       }
-       return c > 0;
-}
-
-int
-__flushbuf(int c, FILE * stream)
-{
-       _clean = __cleanup;
-       if (fileno(stream) < 0) return (unsigned char) c;
-       if (!io_testflag(stream, _IOWRITE)) return EOF;
-       if (io_testflag(stream, _IOREADING) && !feof(stream)) return EOF;
-
-       stream->_flags &= ~_IOREADING;
-       stream->_flags |= _IOWRITING;
-       if (!io_testflag(stream, _IONBF)) {
-               if (!stream->_buf) {
-                       if (stream == stdout && _isatty(fileno(stdout))) {
-                               if (!(stream->_buf =
-                                           (unsigned char *) malloc(BUFSIZ))) {
-                                       stream->_flags |= _IONBF;
-                               } else {
-                                       stream->_flags |= _IOLBF|_IOMYBUF;
-                                       stream->_bufsiz = BUFSIZ;
-                                       stream->_count = -1;
-                               }
-                       } else {
-                               if (!(stream->_buf =
-                                           (unsigned char *) malloc(BUFSIZ))) {
-                                       stream->_flags |= _IONBF;
-                               } else {
-                                       stream->_flags |= _IOMYBUF;
-                                       stream->_bufsiz = BUFSIZ;
-                                       if (!io_testflag(stream, _IOLBF))
-                                               stream->_count = BUFSIZ - 1;
-                                       else    stream->_count = -1;
-                               }
-                       }
-                       stream->_ptr = stream->_buf;
-               }
-       }
-
-       if (io_testflag(stream, _IONBF)) {
-               char c1 = c;
-
-               stream->_count = 0;
-               if (io_testflag(stream, _IOAPPEND)) {
-                       if (_lseek(fileno(stream), 0L, SEEK_END) == -1) {
-                               stream->_flags |= _IOERR;
-                               return EOF;
-                       }
-               }
-               if (_write(fileno(stream), &c1, 1) != 1) {
-                       stream->_flags |= _IOERR;
-                       return EOF;
-               }
-               return (unsigned char) c;
-       } else if (io_testflag(stream, _IOLBF)) {
-               *stream->_ptr++ = c;
-               /* stream->_count has been updated in putc macro. */
-               if (c == '\n' || stream->_count == -stream->_bufsiz) {
-                       int count = -stream->_count;
-
-                       stream->_ptr  = stream->_buf;
-                       stream->_count = 0;
-
-                       if (io_testflag(stream, _IOAPPEND)) {
-                               if (_lseek(fileno(stream), 0L, SEEK_END) == -1) {
-                                       stream->_flags |= _IOERR;
-                                       return EOF;
-                               }
-                       }
-                       if (! do_write(fileno(stream), (char *)stream->_buf,
-                                       count)) {
-                               stream->_flags |= _IOERR;
-                               return EOF;
-                       }
-               }
-       } else {
-               int count = stream->_ptr - stream->_buf;
-
-               stream->_count = stream->_bufsiz - 1;
-               stream->_ptr = stream->_buf + 1;
-
-               if (count > 0) {
-                       if (io_testflag(stream, _IOAPPEND)) {
-                               if (_lseek(fileno(stream), 0L, SEEK_END) == -1) {
-                                       stream->_flags |= _IOERR;
-                                       return EOF;
-                               }
-                       }
-                       if (! do_write(fileno(stream), (char *)stream->_buf, count)) {
-                               *(stream->_buf) = c;
-                               stream->_flags |= _IOERR;
-                               return EOF;
-                       }
-               }
-               *(stream->_buf) = c;
-       }
-       return (unsigned char) c;
-}
index 27dbd9e2505105041e19d9bfb4df2dfca2bdcfcf..c75e1c03e222c545e87d8afc8767680ba7becbf3 100644 (file)
-/*
- * fopen.c - open a stream
- */
-/* $Header$ */
-
-#if    defined(_POSIX_SOURCE)
-#include       <sys/types.h>
-#endif
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       "loc_incl.h"
-#include       <sys/stat.h>
-
-#define        PMODE           0666
-
-/* The next 3 defines are true in all UNIX systems known to me.
- */
-#define        O_RDONLY        0
-#define        O_WRONLY        1
-#define        O_RDWR          2
+/*     $NetBSD: fopen.c,v 1.13 2008/03/13 15:40:00 christos Exp $      */
 
-/* Since the O_CREAT flag is not available on all systems, we can't get it
- * from the standard library. Furthermore, even if we know that <fcntl.h>
- * contains such a flag, it's not sure whether it can be used, since we
- * might be cross-compiling for another system, which may use an entirely
- * different value for O_CREAT (or not support such a mode). The safest
- * thing is to just use the Version 7 semantics for open, and use creat()
- * whenever necessary.
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
  *
- * Another problem is O_APPEND, for which the same holds. When "a"
- * open-mode is used, an lseek() to the end is done before every write()
- * system-call.
+ * 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. 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.
  *
- * The O_CREAT, O_TRUNC and O_APPEND given here, are only for convenience.
- * They are not passed to open(), so the values don't have to match a value
- * from the real world. It is enough when they are unique.
+ * 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.
  */
-#define        O_CREAT         0x010
-#define        O_TRUNC         0x020
-#define        O_APPEND        0x040
 
-int _open(const char *path, int flags);
-int _creat(const char *path, mode_t mode);
-int _close(int d);
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fopen.c    8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fopen.c,v 1.13 2008/03/13 15:40:00 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <assert.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <limits.h>
+#include "reentrant.h"
+#include "local.h"
 
 FILE *
-fopen(const char *name, const char *mode)
+fopen(file, mode)
+       const char *file;
+       const char *mode;
 {
-       register int i;
-       int rwmode = 0, rwflags = 0;
-       FILE *stream;
-       struct stat st;
-       int fd, flags = 0;
-
-       for (i = 0; __iotab[i] != 0 ; i++) 
-               if ( i >= FOPEN_MAX-1 )
-                       return (FILE *)NULL;
+       FILE *fp;
+       int f;
+       int flags, oflags;
 
-       switch(*mode++) {
-       case 'r':
-               flags |= _IOREAD | _IOREADING;  
-               rwmode = O_RDONLY;
-               break;
-       case 'w':
-               flags |= _IOWRITE | _IOWRITING;
-               rwmode = O_WRONLY;
-               rwflags = O_CREAT | O_TRUNC;
-               break;
-       case 'a': 
-               flags |= _IOWRITE | _IOWRITING | _IOAPPEND;
-               rwmode = O_WRONLY;
-               rwflags |= O_APPEND | O_CREAT;
-               break;         
-       default:
-               return (FILE *)NULL;
-       }
-
-       while (*mode) {
-               switch(*mode++) {
-               case 'b':
-                       continue;
-               case '+':
-                       rwmode = O_RDWR;
-                       flags |= _IOREAD | _IOWRITE;
-                       continue;
-               /* The sequence may be followed by additional characters */
-               default:
-                       break;
+       _DIAGASSERT(file != NULL);
+       if ((flags = __sflags(mode, &oflags)) == 0)
+               return (NULL);
+       if ((fp = __sfp()) == NULL)
+               return (NULL);
+       if ((f = open(file, oflags, DEFFILEMODE)) < 0)
+               goto release;
+       if (oflags & O_NONBLOCK) {
+               struct stat st;
+               if (fstat(f, &st) == -1) {
+                       int sverrno = errno;
+                       (void)close(f);
+                       errno = sverrno;
+                       goto release;
                }
-               break;
-       }
-
-       /* Perform a creat() when the file should be truncated or when
-        * the file is opened for writing and the open() failed.
-        */
-       if ((rwflags & O_TRUNC)
-           || (((fd = _open(name, rwmode)) < 0)
-                   && (rwflags & O_CREAT))) {
-               if (((fd = _creat(name, PMODE)) > 0) && flags  | _IOREAD) {
-                       (void) _close(fd);
-                       fd = _open(name, rwmode);
+               if (!S_ISREG(st.st_mode)) {
+                       (void)close(f);
+                       errno = EFTYPE;
+                       goto release;
                }
-                       
        }
-
-       if (fd < 0) return (FILE *)NULL;
-
-       if ( fstat( fd, &st ) < 0 ) {
-               _close(fd);
-               return (FILE *)NULL;
-       }
-       
-       if ( S_ISFIFO(st.st_mode) ) flags |= _IOFIFO;
-       
-       if (( stream = (FILE *) malloc(sizeof(FILE))) == NULL ) {
-               _close(fd);
-               return (FILE *)NULL;
+       /*
+        * File descriptors are a full int, but _file is only a short.
+        * If we get a valid file descriptor that is greater or equal to
+        * USHRT_MAX, then the fd will get sign-extended into an
+        * invalid file descriptor.  Handle this case by failing the
+        * open. (We treat the short as unsigned, and special-case -1).
+        */
+       if (f >= USHRT_MAX) {
+               errno = EMFILE;
+               goto release;
        }
 
-       if ((flags & (_IOREAD | _IOWRITE))  == (_IOREAD | _IOWRITE))
-               flags &= ~(_IOREADING | _IOWRITING);
+       fp->_file = f;
+       fp->_flags = flags;
+       fp->_cookie = fp;
+       fp->_read = __sread;
+       fp->_write = __swrite;
+       fp->_seek = __sseek;
+       fp->_close = __sclose;
 
-       stream->_count = 0;
-       stream->_fd = fd;
-       stream->_flags = flags;
-       stream->_buf = NULL;
-       __iotab[i] = stream;
-       return stream;
+       /*
+        * When opening in append mode, even though we use O_APPEND,
+        * we need to seek to the end so that ftell() gets the right
+        * answer.  If the user then alters the seek pointer, or
+        * the file extends, this will fail, but there is not much
+        * we can do about this.  (We could set __SAPP and check in
+        * fseek and ftell.)
+        */
+       if (oflags & O_APPEND)
+               (void) __sseek((void *)fp, (fpos_t)0, SEEK_END);
+       return (fp);
+release:
+       fp->_flags = 0;                 /* release */
+       return (NULL);
 }
index d4c224e80923d7fd0841fca4c8a33543e86e29e6..54e4f3338c40ec9e8038c33ea904abd51bd70bd6 100644 (file)
@@ -1,23 +1,62 @@
-/*
- * fprintf - write output on a stream
+/*     $NetBSD: fprintf.c,v 1.11 2003/08/07 16:43:24 agc Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fprintf.c  8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fprintf.c,v 1.11 2003/08/07 16:43:24 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
 
 int
-fprintf(FILE *stream, const char *format, ...)
+fprintf(FILE *fp, const char *fmt, ...)
 {
+       int ret;
        va_list ap;
-       int retval;
-       
-       va_start(ap, format);
 
-       retval = _doprnt (format, ap, stream);
+       _DIAGASSERT(fp != NULL);
+       _DIAGASSERT(fmt != NULL);
 
+       va_start(ap, fmt);
+       ret = vfprintf(fp, fmt, ap);
        va_end(ap);
-
-       return retval;
+       return (ret);
 }
index ec759144c1e94b20d8e04e3475bffcfc9ad2fee7..1bc81e3f4f6977d234636ca3dcc47a08565488ef 100644 (file)
@@ -1,12 +1,63 @@
-/*
- * fputc.c - print an unsigned character
+/*     $NetBSD: fputc.c,v 1.12 2003/08/07 16:43:24 agc Exp $   */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fputc.c    8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fputc.c,v 1.12 2003/08/07 16:43:24 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
 
 int
-fputc(int c, FILE *stream)
+fputc(c, fp)
+       int c;
+       FILE *fp;
 {
-       return putc(c, stream);
+       int r;
+
+       _DIAGASSERT(fp != NULL);
+
+       FLOCKFILE(fp); 
+       r = __sputc(c, fp);
+       FUNLOCKFILE(fp);
+       return r;
 }
index 99fe5a7129fbbf9d7795f5395e6b02c40e6fb84a..5463595966ab40856b1e9e8d831f082008dc0b5a 100644 (file)
@@ -1,18 +1,79 @@
-/*
- * fputs - print a string
+/*     $NetBSD: fputs.c,v 1.14 2005/06/22 19:45:22 christos Exp $      */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fputs.c    8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fputs.c,v 1.14 2005/06/22 19:45:22 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include "reentrant.h"
+#include "local.h"
+#include "fvwrite.h"
 
+/*
+ * Write the given string to the given file.
+ */
 int
-fputs(register const char *s, register FILE *stream)
+fputs(s, fp)
+       const char *s;
+       FILE *fp;
 {
-       register int i = 0;
+       struct __suio uio;
+       struct __siov iov;
+       int r;
+
+       _DIAGASSERT(s != NULL);
+       _DIAGASSERT(fp != NULL);
 
-       while (*s) 
-               if (putc(*s++, stream) == EOF) return EOF;
-               else i++;
+       if (s == NULL)
+               s = "(null)";
 
-       return i;
+       iov.iov_base = __UNCONST(s);
+       iov.iov_len = uio.uio_resid = strlen(s);
+       uio.uio_iov = &iov;
+       uio.uio_iovcnt = 1;
+       FLOCKFILE(fp);
+       _SET_ORIENTATION(fp, -1);
+       r = __sfvwrite(fp, &uio);
+       FUNLOCKFILE(fp);
+       return r;
 }
index a02f83ad29f4ed5584d8cc73595cb7b80533fdfa..d61fa816b356ec5ad4edc5def2978e7c22d650d9 100644 (file)
@@ -1,29 +1,95 @@
-/*
- * fread.c - read a number of members into an array
+/*     $NetBSD: fread.c,v 1.20 2009/10/25 20:44:13 christos Exp $      */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fread.c    8.2 (Berkeley) 12/11/93";
+#else
+__RCSID("$NetBSD: fread.c,v 1.20 2009/10/25 20:44:13 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include "reentrant.h"
+#include "local.h"
 
 size_t
-fread(void *ptr, size_t size, size_t nmemb, register FILE *stream)
+fread(buf, size, count, fp)
+       void *buf;
+       size_t size, count;
+       FILE *fp;
 {
-       register char *cp = ptr;
-       register int c;
-       size_t ndone = 0;
-       register size_t s;
+       size_t resid;
+       char *p;
+       int r;
+       size_t total;
 
-       if (size)
-               while ( ndone < nmemb ) {
-                       s = size;
-                       do {
-                               if ((c = getc(stream)) != EOF)
-                                       *cp++ = c;
-                               else
-                                       return ndone;
-                       } while (--s);
-                       ndone++;
-               }
+       _DIAGASSERT(fp != NULL);
+       /*
+        * The ANSI standard requires a return value of 0 for a count
+        * or a size of 0.  Whilst ANSI imposes no such requirements on
+        * fwrite, the SUSv2 does.
+        */
+       if ((resid = count * size) == 0)
+               return (0);
 
-       return ndone;
+       _DIAGASSERT(buf != NULL);
+
+       FLOCKFILE(fp);
+       if (fp->_r < 0)
+               fp->_r = 0;
+       total = resid;
+       p = buf;
+       while (resid > (size_t)(r = fp->_r)) {
+               (void)memcpy(p, fp->_p, (size_t)r);
+               fp->_p += r;
+               /* fp->_r = 0 ... done in __srefill */
+               p += r;
+               resid -= r;
+               if (__srefill(fp)) {
+                       /* no more input: return partial result */
+                       FUNLOCKFILE(fp);
+                       return ((total - resid) / size);
+               }
+       }
+       (void)memcpy(p, fp->_p, resid);
+       fp->_r -= resid;
+       fp->_p += resid;
+       FUNLOCKFILE(fp);
+       return (count);
 }
index 48549fdc7596af517b3d42dd6674301a5cf476f8..5b370faeedfd3b286895956ed6fc887c6ed4f3d0 100644 (file)
-/*
- * freopen.c - open a file and associate a stream with it
+/*     $NetBSD: freopen.c,v 1.16 2010/01/11 20:39:29 joerg Exp $       */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#if    defined(_POSIX_SOURCE)
-#include       <sys/types.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)freopen.c  8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: freopen.c,v 1.16 2010/01/11 20:39:29 joerg Exp $");
 #endif
-#include       <stdio.h>
-#include       <stdlib.h>
-#include       "loc_incl.h"
-#include       <sys/stat.h>
-
-#define        PMODE           0666
-
-/* Do not "optimize" this file to use the open with O_CREAT if the file
- * does not exist. The reason is given in fopen.c.
+#endif /* LIBC_SCCS and not lint */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <limits.h>
+#include "reentrant.h"
+#include "local.h"
+
+/* 
+ * Re-direct an existing, open (probably) file to some other file. 
+ * ANSI is written such that the original file gets closed if at
+ * all possible, no matter what.
  */
-#define        O_RDONLY        0
-#define        O_WRONLY        1
-#define        O_RDWR          2
+FILE *
+freopen(file, mode, fp)
+       const char *file, *mode;
+       FILE *fp;
+{
+       int f;
+       int flags, isopen, oflags, sverrno, wantfd;
 
-#define        O_CREAT         0x010
-#define        O_TRUNC         0x020
-#define        O_APPEND        0x040
+       _DIAGASSERT(file != NULL);
+       _DIAGASSERT(mode != NULL);
+       _DIAGASSERT(fp != NULL);
 
-int _open(const char *path, int flags);
-int _creat(const char *path, mode_t mode);
-int _close(int d);
+       if ((flags = __sflags(mode, &oflags)) == 0) {
+               (void) fclose(fp);
+               return (NULL);
+       }
 
-FILE *
-freopen(const char *name, const char *mode, FILE *stream)
-{
-       register int i;
-       struct stat st;
-       int rwmode = 0, rwflags = 0;
-       int fd, flags = stream->_flags & (_IONBF | _IOFBF | _IOLBF | _IOMYBUF);
-
-       (void) fflush(stream);                          /* ignore errors */
-       (void) _close(fileno(stream));
-
-       /* Find the slot the stream had, if any. */
-       for(i = 0; i < FOPEN_MAX; i++)
-               if (stream == __iotab[i])
-                       break;
-
-       /* If none, it might've been fclose()d; find a new slot for it. */
-       if(i >= FOPEN_MAX) {
-               for (i = 0; __iotab[i] != 0 ; i++) {
-                       if ( i >= FOPEN_MAX-1 )
-                               return (FILE *)NULL;
+       if (!__sdidinit)
+               __sinit();
+
+       /*
+        * There are actually programs that depend on being able to "freopen"
+        * descriptors that weren't originally open.  Keep this from breaking.
+        * Remember whether the stream was open to begin with, and which file
+        * descriptor (if any) was associated with it.  If it was attached to
+        * a descriptor, defer closing it; freopen("/dev/stdin", "r", stdin)
+        * should work.  This is unnecessary if it was not a Unix file.
+        */
+       if (fp->_flags == 0) {
+               fp->_flags = __SEOF;    /* hold on to it */
+               isopen = 0;
+               wantfd = -1;
+       } else {
+               /* flush the stream; ANSI doesn't require this. */
+               if (fp->_flags & __SWR)
+                       (void) __sflush(fp);
+               /* if close is NULL, closing is a no-op, hence pointless */
+               isopen = fp->_close != NULL;
+               if ((wantfd = __sfileno(fp)) == -1 && isopen) {
+                       (void) (*fp->_close)(fp->_cookie);
+                       isopen = 0;
                }
        }
 
-       /* If it was valid, it isn't any more until the freopen() succeeds. */
-       __iotab[i] = 0;
-
-       switch(*mode++) {
-       case 'r':
-               flags |= _IOREAD;       
-               rwmode = O_RDONLY;
-               break;
-       case 'w':
-               flags |= _IOWRITE;
-               rwmode = O_WRONLY;
-               rwflags = O_CREAT | O_TRUNC;
-               break;
-       case 'a': 
-               flags |= _IOWRITE | _IOAPPEND;
-               rwmode = O_WRONLY;
-               rwflags |= O_APPEND | O_CREAT;
-               break;         
-       default:
-               goto loser;
+       /* Get a new descriptor to refer to the new file. */
+       f = open(file, oflags, DEFFILEMODE);
+       if (f < 0 && isopen) {
+               /* If out of fd's close the old one and try again. */
+               if (errno == ENFILE || errno == EMFILE) {
+                       (void) (*fp->_close)(fp->_cookie);
+                       isopen = 0;
+                       f = open(file, oflags, DEFFILEMODE);
+               }
+       }
+       sverrno = errno;
+
+       /*
+        * Finish closing fp.  Even if the open succeeded above, we cannot
+        * keep fp->_base: it may be the wrong size.  This loses the effect
+        * of any setbuffer calls, but stdio has always done this before.
+        */
+       if (isopen && f != wantfd)
+               (void) (*fp->_close)(fp->_cookie);
+       if (fp->_flags & __SMBF)
+               free((char *)fp->_bf._base);
+       fp->_w = 0;
+       fp->_r = 0;
+       fp->_p = NULL;
+       fp->_bf._base = NULL;
+       fp->_bf._size = 0;
+       fp->_lbfsize = 0;
+       if (HASUB(fp))
+               FREEUB(fp);
+       WCIO_FREE(fp);
+       _UB(fp)._size = 0;
+       FREELB(fp);
+
+       if (f < 0) {                    /* did not get it after all */
+               fp->_flags = 0;         /* set it free */
+               errno = sverrno;        /* restore in case _close clobbered */
+               return (NULL);
        }
 
-       while (*mode) {
-               switch(*mode++) {
-               case 'b':
-                       continue;
-               case '+':
-                       rwmode = O_RDWR;
-                       flags |= _IOREAD | _IOWRITE;
-                       continue;
-               /* The sequence may be followed by aditional characters */
-               default:
-                       break;
+       if (oflags & O_NONBLOCK) {
+               struct stat st;
+               if (fstat(f, &st) == -1) {
+                       sverrno = errno;
+                       (void)close(f);
+                       errno = sverrno;
+                       return (NULL);
+               }
+               if (!S_ISREG(st.st_mode)) {
+                       (void)close(f);
+                       errno = EFTYPE;
+                       return (NULL);
                }
-               break;
        }
 
-       if ((rwflags & O_TRUNC)
-           || (((fd = _open(name, rwmode)) < 0)
-                   && (rwflags & O_CREAT))) {
-               if (((fd = _creat(name, PMODE)) < 0) && flags | _IOREAD) {
-                       (void) _close(fd);
-                       fd = _open(name, rwmode);
+       /*
+        * If reopening something that was open before on a real file, try
+        * to maintain the descriptor.  Various C library routines (perror)
+        * assume stderr is always fd STDERR_FILENO, even if being freopen'd.
+        */
+       if (wantfd >= 0 && f != wantfd) {
+               if (dup2(f, wantfd) >= 0) {
+                       (void) close(f);
+                       f = wantfd;
                }
        }
 
-       if (fd < 0) {
-               goto loser;
+       /*
+        * File descriptors are a full int, but _file is only a short.
+        * If we get a valid file descriptor that is greater or equal to
+        * USHRT_MAX, then the fd will get sign-extended into an
+        * invalid file descriptor.  Handle this case by failing the
+        * open. (We treat the short as unsigned, and special-case -1).
+        */
+       if (f >= USHRT_MAX) {
+               (void)close(f);
+               errno = EMFILE;
+               return NULL;
        }
 
-       if ( fstat( fd, &st ) == 0 ) {
-               if ( S_ISFIFO(st.st_mode) ) flags |= _IOFIFO;
-       } else {
-               goto loser;
-       }
-       
-       stream->_count = 0;
-       stream->_fd = fd;
-       stream->_flags = flags;
-       __iotab[i] = stream;
-       return stream;
-
-loser:
-       if (stream != stdin && stream != stdout && stream != stderr)
-               free((void *)stream);
-       return (FILE *)NULL;    
+       fp->_flags = flags;
+       fp->_file = f;
+       fp->_cookie = fp;
+       fp->_read = __sread;
+       fp->_write = __swrite;
+       fp->_seek = __sseek;
+       fp->_close = __sclose;
+
+       /*
+        * When reopening in append mode, even though we use O_APPEND,
+        * we need to seek to the end so that ftell() gets the right
+        * answer.  If the user then alters the seek pointer, or
+        * the file extends, this will fail, but there is not much
+        * we can do about this.  (We could set __SAPP and check in
+        * fseek and ftell.)
+        */
+       if (oflags & O_APPEND)
+               (void) __sseek((void *)fp, (fpos_t)0, SEEK_END);
+       return (fp);
 }
index 913a470713350877134f310d1b6e5e9f94f00ce1..817e9a143037fd38a6100f9d0119d2104aa6a4d7 100644 (file)
@@ -1,23 +1,62 @@
-/*
- * fscanf.c - read formatted input from stream
+/*     $NetBSD: fscanf.c,v 1.12 2003/08/07 16:43:25 agc Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fscanf.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fscanf.c,v 1.12 2003/08/07 16:43:25 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "reentrant.h"
+#include "local.h"
 
 int
-fscanf(FILE *stream, const char *format, ...)
+fscanf(FILE *fp, char const *fmt, ...)
 {
+       int ret;
        va_list ap;
-       int retval;
-
-       va_start(ap, format);
-
-       retval = _doscan(stream, format, ap);
 
+       va_start(ap, fmt);
+       ret = __svfscanf(fp, fmt, ap);
        va_end(ap);
-
-       return retval;
+       return (ret);
 }
index ef6d4725968770a69dc5ddcc6ae0fb63b9f61b38..bcfa5a96efb5b82185874451eeef94826677dcb8 100644 (file)
@@ -1,52 +1,63 @@
-/*
- * fseek.c - perform an fseek
+/*     $NetBSD: fseek.c,v 1.23 2008/04/29 06:53:01 martin Exp $        */
+
+/*-
+ * Copyright (c) 2005 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David Laight.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
  */
-/* $Header$ */
-
-#include       <assert.h>
-#include       <stdio.h>
-
-#if    (SEEK_CUR != 1) || (SEEK_END != 2) || (SEEK_SET != 0)
-#error SEEK_* values are wrong
-#endif
 
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: fseek.c,v 1.23 2008/04/29 06:53:01 martin Exp $");
+#endif /* LIBC_SCCS and not lint */
 
-#include       <sys/types.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 
-off_t _lseek(int fildes, off_t offset, int whence);
-
-int
-fseek(FILE *stream, long int offset, int whence)
-{
-       assert(sizeof(offset) == sizeof(off_t));
-       return fseeko(stream, (off_t) offset, whence);
-}
+#include "namespace.h"
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "reentrant.h"
+#include "local.h"
 
+/*
+ * Seek the given file to the given offset.
+ * Zero extend the offset if SEEK_SET to allow access to 4GB files
+ */
 int
-fseeko(FILE *stream, off_t offset, int whence)
+fseek(FILE *fp, long l_offset, int whence)
 {
-       int adjust = 0;
-       long pos;
-
-       stream->_flags &= ~(_IOEOF | _IOERR);
-       /* Clear both the end of file and error flags */
-
-       if (io_testflag(stream, _IOREADING)) {
-               if (whence == SEEK_CUR
-                   && stream->_buf
-                   && !io_testflag(stream,_IONBF))
-                       adjust = stream->_count;
-               stream->_count = 0;
-       } else if (io_testflag(stream,_IOWRITING)) {
-               fflush(stream);
-       } else  /* neither reading nor writing. The buffer must be empty */
-               /* EMPTY */ ;
-
-       pos = _lseek(fileno(stream), offset - adjust, whence);
-       if (io_testflag(stream, _IOREAD) && io_testflag(stream, _IOWRITE))
-               stream->_flags &= ~(_IOREADING | _IOWRITING);
+       off_t offset;
 
-       stream->_ptr = stream->_buf;
-       return ((pos == -1) ? -1 : 0);
+       if (whence == SEEK_SET)
+               offset = (unsigned long)l_offset;
+       else
+               offset = l_offset;
+       return fseeko(fp, offset, whence);
 }
index ef67ad05f83aecc0f066d635ce1c25613229a68b..6fbd3e24bf0a8b90182a439e146de19df1848383 100644 (file)
@@ -1,12 +1,61 @@
-/*
- * fsetpos.c - set the position in the file
+/*     $NetBSD: fsetpos.c,v 1.10 2003/08/07 16:43:25 agc Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fsetpos.c  8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fsetpos.c,v 1.10 2003/08/07 16:43:25 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
 
+/*
+ * fsetpos: like fseek.
+ */
 int
-fsetpos(FILE *stream, fpos_t *pos)
+fsetpos(iop, pos)
+       FILE *iop;
+       const fpos_t *pos;
 {
-       return fseek(stream, *pos, SEEK_SET);
+       _DIAGASSERT(iop != NULL);
+       _DIAGASSERT(pos != NULL);
+
+       return (fseeko(iop, (off_t)*pos, SEEK_SET));
 }
index cbfa17c5fc8ecf1ad6e09c6c1a08bfcb0fcc3451..828a23a3be1cbeeff73d9c134b4a2667303aeff7 100644 (file)
-/*
- * ftell.c - obtain the value of the file-position indicator of a stream
- */
-/* $Header$ */
+/*     $NetBSD: ftell.c,v 1.17 2010/10/24 17:44:32 tron Exp $  */
 
-#include       <assert.h>
-#include       <stdio.h>
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
+ */
 
-#if    (SEEK_CUR != 1) || (SEEK_SET != 0) || (SEEK_END != 2)
-#error SEEK_* values are wrong
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)ftell.c    8.2 (Berkeley) 5/4/95";
+#else
+__RCSID("$NetBSD: ftell.c,v 1.17 2010/10/24 17:44:32 tron Exp $");
 #endif
+#endif /* LIBC_SCCS and not lint */
 
-#include       "loc_incl.h"
-
-#include       <sys/types.h>
-
-off_t _lseek(int fildes, off_t offset, int whence);
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
 
-long ftell(FILE *stream)
+/*
+ * ftell: return current offset.
+ */
+long
+ftell(fp)
+       FILE *fp;
 {
-       assert(sizeof(long) == sizeof(off_t));
-       return (long) ftello(stream);
-}
+       fpos_t pos;
 
-off_t ftello(FILE *stream)
-{
-       long result;
-       int adjust = 0;
 
-       if (io_testflag(stream,_IOREADING))
-               adjust = -stream->_count;
-       else if (io_testflag(stream,_IOWRITING)
-                   && stream->_buf
-                   && !io_testflag(stream,_IONBF))
-               adjust = stream->_ptr - stream->_buf;
-       else adjust = 0;
+       FLOCKFILE(fp);
 
-       result = _lseek(fileno(stream), (off_t)0, SEEK_CUR);
+       if (fp->_seek == NULL) {
+               FUNLOCKFILE(fp);
+               errno = ESPIPE;                 /* historic practice */
+               return -1L;
+       }
 
-       if ( result == -1 )
-               return result;
+       /*
+        * Find offset of underlying I/O object, then
+        * adjust for buffered bytes.
+        */
+       __sflush(fp);           /* may adjust seek offset on append stream */
+       if (fp->_flags & __SOFF)
+               pos = fp->_offset;
+       else {
+               pos = (*fp->_seek)(fp->_cookie, (fpos_t)0, SEEK_CUR);
+               if (pos == -1L) {
+                       FUNLOCKFILE(fp);
+                       return (long)(pos);
+               }
+       }
+       if (fp->_flags & __SRD) {
+               /*
+                * Reading.  Any unread characters (including
+                * those from ungetc) cause the position to be
+                * smaller than that in the underlying object.
+                */
+               pos -= fp->_r;
+               if (HASUB(fp))
+                       pos -= fp->_ur;
+       } else if (fp->_flags & __SWR && fp->_p != NULL) {
+               /*
+                * Writing.  Any buffered characters cause the
+                * position to be greater than that in the
+                * underlying object.
+                */
+               pos += fp->_p - fp->_bf._base;
+       }
+       FUNLOCKFILE(fp);
 
-       result += (long) adjust;
-       return result;
+       if (__fpos_overflow(pos)) {
+               errno = EOVERFLOW;
+               return -1L;
+       }
+               
+       return (long)(pos);
 }
index f1a04452e78e0ea7ff02507b747ef4d3f7962b37..c48a47c6dad0d67b48f551051c2145fccfb25008 100644 (file)
@@ -1,29 +1,88 @@
-/*
- * fwrite.c - write a number of array elements on a file
+/*     $NetBSD: fwrite.c,v 1.16 2005/11/29 03:12:00 christos Exp $     */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fwrite.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: fwrite.c,v 1.16 2005/11/29 03:12:00 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
 
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+#include "fvwrite.h"
+
+/*
+ * Write `count' objects (each size `size') from memory to the given file.
+ * Return the number of whole objects written.
+ */
 size_t
-fwrite(const void *ptr, size_t size, size_t nmemb,
-           register FILE *stream)
+fwrite(buf, size, count, fp)
+       const void *buf;
+       size_t size, count;
+       FILE *fp;
 {
-       register const unsigned char *cp = ptr;
-       register size_t s;
-       size_t ndone = 0;
+       size_t n;
+       struct __suio uio;
+       struct __siov iov;
+
+       _DIAGASSERT(fp != NULL);
+       /*
+        * SUSv2 requires a return value of 0 for a count or a size of 0.
+        */
+       if ((n = count * size) == 0)
+               return (0);
+       _DIAGASSERT(buf != NULL);
+
+       iov.iov_base = __UNCONST(buf);
+       uio.uio_resid = iov.iov_len = n;
+       uio.uio_iov = &iov;
+       uio.uio_iovcnt = 1;
 
-       if (size)
-               while ( ndone < nmemb ) {
-                       s = size;
-                       do {
-                               if (putc((int)*cp, stream)
-                                       == EOF)
-                                       return ndone;
-                               cp++;
-                       } 
-                       while (--s);
-                       ndone++;
-               }
-       return ndone;
+       /*
+        * The usual case is success (__sfvwrite returns 0);
+        * skip the divide if this happens, since divides are
+        * generally slow and since this occurs whenever size==0.
+        */
+       FLOCKFILE(fp);
+       if (__sfvwrite(fp, &uio) != 0)
+               count = ((n - uio.uio_resid) / size);
+       FUNLOCKFILE(fp);
+       return (count);
 }
index ff8745ecfc311f58a7d4c0392491fb3c545f3eac..55bef64c9e30ff8d7e077a82eaa816de1b322cdf 100644 (file)
@@ -1,12 +1,78 @@
+/*     $NetBSD: getc.c,v 1.11 2003/08/07 16:43:26 agc Exp $    */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)getc.c     8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: getc.c,v 1.11 2003/08/07 16:43:26 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+
 /*
- * getc.c - read an unsigned character
+ * A subroutine version of the macro getc.
  */
-/* $Header$ */
+#undef getc
+#undef getc_unlocked
+
+int
+getc(fp)
+       FILE *fp;
+{
+       int r;
+
+       _DIAGASSERT(fp != NULL);
 
-#include       <stdio.h>
+       FLOCKFILE(fp);
+       r = __sgetc(fp);
+       FUNLOCKFILE(fp);
+       return r;
+}
 
 int
-(getc)(FILE *stream)
+getc_unlocked(fp)
+       FILE *fp;
 {
-       return getc(stream);
+
+       _DIAGASSERT(fp != NULL);
+
+       return (__sgetc(fp));
 }
index 759bf60bc9b250e9a8c6b9ac6e6ec04dd86e0f0f..75cae92cd2dee43e748107ec4dc114c5c0db4ee5 100644 (file)
@@ -1,12 +1,70 @@
+/*     $NetBSD: getchar.c,v 1.9 2003/08/07 16:43:27 agc Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)getchar.c  8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: getchar.c,v 1.9 2003/08/07 16:43:27 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
 /*
- * getchar.c - read a character from the standard input stream
+ * A subroutine version of the macro getchar.
  */
-/* $Header$ */
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+
+#undef getchar
+#undef getchar_unlocked
 
-#include       <stdio.h>
+int
+getchar()
+{
+       FILE *fp = stdin;
+       int r;
+
+        FLOCKFILE(fp);
+        r = __sgetc(fp);
+        FUNLOCKFILE(fp);
+        return r;
+}
 
 int
-(getchar)(void)
+getchar_unlocked()
 {
-       return getchar();
+       return (__sgetc(stdin));
 }
index 53150b0cd550f24e0bb3ec9ce0788481f458eb97..8526d8a693325454ca9d934f194cdbd5a8989c1f 100644 (file)
@@ -1,27 +1,80 @@
-/*
- * gets.c - read a line from a stream
+/*     $NetBSD: gets.c,v 1.16 2007/06/03 17:39:26 christos Exp $       */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)gets.c     8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: gets.c,v 1.16 2007/06/03 17:39:26 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+#ifdef _FORTIFY_SOURCE
+#undef gets
+#endif
+
+__warn_references(gets, "warning: this program uses gets(), which is unsafe.")
 
 char *
-gets(char *s)
+gets(buf)
+       char *buf;
 {
-       register FILE *stream = stdin;
-       register int ch;
-       register char *ptr;
+       int c;
+       char *s;
 
-       ptr = s;
-       while ((ch = getc(stream)) != EOF && ch != '\n')
-               *ptr++ = ch;
+       _DIAGASSERT(buf != NULL);
 
-       if (ch == EOF) {
-               if (feof(stream)) {
-                       if (ptr == s) return NULL;
-               } else return NULL;
+       FLOCKFILE(stdin);
+       for (s = buf; (c = getchar_unlocked()) != '\n'; ) {
+               if (c == EOF) {
+                       if (s == buf) {
+                               FUNLOCKFILE(stdin);
+                               return (NULL);
+                       } else {
+                               break;
+                       }
+               } else {
+                       *s++ = c;
+               }
        }
-
-       *ptr = '\0';
-       return s;
+       *s = 0;
+       FUNLOCKFILE(stdin);
+       return (buf);
 }
diff --git a/lib/libc/stdio/icompute.c b/lib/libc/stdio/icompute.c
deleted file mode 100644 (file)
index 6d2f330..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * icompute.c - compute an integer
- */
-/* $Header$ */
-
-#include       "loc_incl.h"
-
-/* This routine is used in doprnt.c as well as in tmpfile.c and tmpnam.c. */
-
-char *
-_i_compute(printval_u_t val, int base, char *s, int nrdigits)
-{
-       int c;
-
-       c= val % base ;
-       val /= base ;
-       if (val || nrdigits > 1)
-               s = _i_compute(val, base, s, nrdigits - 1);
-       *s++ = (c>9 ? c-10+'a' : c+'0');
-       return s;
-}
diff --git a/lib/libc/stdio/loc_incl.h b/lib/libc/stdio/loc_incl.h
deleted file mode 100644 (file)
index 49b593b..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * loc_incl.h - local include file for stdio library
- */
-/* $Header$ */
-
-#include       <stdio.h>
-#include       <minix/ansi.h>
-
-#define        io_testflag(p,x)        ((p)->_flags & (x))
-
-#include       <stdarg.h>
-
-#if defined(__LONG_LONG_SUPPORTED)
-typedef long long printval_s_t;
-typedef unsigned long long printval_u_t;
-#else
-typedef long printval_s_t;
-typedef unsigned long printval_u_t;
-#endif
-
-#ifdef _ANSI
-int _doprnt(const char *format, va_list ap, FILE *stream);
-int _doscan(FILE * stream, const char *format, va_list ap);
-char *_i_compute(printval_u_t val, int base, char *s, int nrdigits);
-char *_f_print(va_list *ap, int flags, char *s, char c, int precision);
-void __cleanup(void);
-
-FILE *popen(const char *command, const char *type);
-FILE *fdopen(int fd, const char *mode);
-
-#ifndef        NOFLOAT
-char *_ecvt(long double value, int ndigit, int *decpt, int *sign);
-char *_fcvt(long double value, int ndigit, int *decpt, int *sign);
-#endif /* NOFLOAT */
-#endif
-
-#define        FL_LJUST        0x0001          /* left-justify field */
-#define        FL_SIGN         0x0002          /* sign in signed conversions */
-#define        FL_SPACE        0x0004          /* space in signed conversions */
-#define        FL_ALT          0x0008          /* alternate form */
-#define        FL_ZEROFILL     0x0010          /* fill with zero's */
-#define        FL_SHORT        0x0020          /* optional h */
-#define        FL_LONG         0x0040          /* optional l */
-#define        FL_LONGDOUBLE   0x0080          /* optional L */
-#define        FL_WIDTHSPEC    0x0100          /* field width is specified */
-#define        FL_PRECSPEC     0x0200          /* precision is specified */
-#define FL_SIGNEDCONV  0x0400          /* may contain a sign */
-#define        FL_NOASSIGN     0x0800          /* do not assign (in scanf) */
-#define        FL_NOMORE       0x1000          /* all flags collected */
-#define        FL_LONGLONG     0x2000          /* 64-bit for ints */
index 267a765083fe7737b41343f2dea1d8eae07d9de3..6eb71b01d7da290550e05d4f6db19116ec950b50 100644 (file)
@@ -1,3 +1,5 @@
+/*     $NetBSD: mktemp.c,v 1.19 2003/08/07 16:43:28 agc Exp $  */
+
 /*
  * Copyright (c) 1987, 1993
  *     The Regents of the University of California.  All rights reserved.
  * 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
+ * 3. 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.
  *
  * SUCH DAMAGE.
  */
 
+#include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
+#if 0
 static char sccsid[] = "@(#)mktemp.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: mktemp.c,v 1.19 2003/08/07 16:43:28 agc Exp $");
+#endif
 #endif /* LIBC_SCCS and not lint */
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
+#include <assert.h>
 #include <errno.h>
 #include <stdio.h>
-#include <ctype.h>
-#include <unistd.h>
 #include <stdlib.h>
+#include <unistd.h>
+#include "reentrant.h"
+#include "local.h"
 
-static int _gettemp(char*,int*,int);
-
-int
-mkstemp(path)
+char *
+_mktemp(path)
        char *path;
 {
-       int fd;
 
-       return (_gettemp(path, &fd, 0) ? fd : -1);
-}
+       _DIAGASSERT(path != NULL);
 
-char *
-mktemp(path)
-       char *path;
-{
-       return(_gettemp(path, (int *)NULL, 0) ? path : (char *)NULL);
+       return (__gettemp(path, (int *)NULL, 0) ? path : (char *)NULL);
 }
 
-char *
-mkdtemp(path)
-       char *path;
-{
-       return(_gettemp(path, (int *)NULL, 1) ? path : (char *)NULL);
-}
+__warn_references(mktemp,
+    "warning: mktemp() possibly used unsafely, use mkstemp() or mkdtemp()")
 
-static int
-_gettemp(path, doopen, domkdir)
+char *
+mktemp(path)
        char *path;
-       register int *doopen;
-       int domkdir;
 {
-       extern int errno;
-       register char *start, *trv;
-       struct stat sbuf;
-       u_int pid;
-       static int lastnames = 0;
-       int names = 0;
-
-       pid = getpid();
-       for (trv = path; *trv; ++trv);          /* extra X's get set to 0's */
-       while (*--trv == 'X') {
-               *trv = (pid % 10) + '0';
-               pid /= 10;
-       }
-
-       /*
-        * check the target directory; if you have six X's and it
-        * doesn't exist this runs for a *very* long time.
-        */
-       for (start = trv + 1;; --trv) {
-               if (trv <= path)
-                       break;
-               if (*trv == '/') {
-                       *trv = '\0';
-                       if (stat(path, &sbuf))
-                               return(0);
-                       if (!S_ISDIR(sbuf.st_mode)) {
-                               errno = ENOTDIR;
-                               return(0);
-                       }
-                       *trv = '/';
-                       break;
-               }
-       }
-
-       for (;;) {
-               /* tricky little algorithm for backward compatibility */
-               for (trv = start;;) {
-                       if (!*trv)
-                               return(0);
-                       if (*trv == 'z')
-                               *trv++ = 'a';
-                       else {
-                               if (isdigit(*trv))
-                                       *trv = 'a';
-                               else
-                                       ++*trv;
-                               break;
-                       }
-               }
 
-               names++;
+       _DIAGASSERT(path != NULL);
 
-               if(names <= lastnames)
-                       continue;
-
-               lastnames = names;
-
-               if (doopen) {
-                       if ((*doopen =
-                           open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0) {
-                               return(1);
-                           }
-                       if (errno != EEXIST) {
-                               return(0);
-                       }
-               } else if(domkdir) {
-                       if (mkdir(path, 0700) >= 0)
-                               return (1);
-                       if (errno != EEXIST)
-                               return (0);
-               } else if (stat(path, &sbuf)) {
-                       return(errno == ENOENT ? 1 : 0);
-               }
-
-       }
-       /*NOTREACHED*/
+       return (__gettemp(path, (int *)NULL, 0) ? path : (char *)NULL);
 }
-
-/*
- * $PchId: mktemp.c,v 1.3 1995/11/20 19:10:39 philip Exp $
- */
index 1d929da93b97476ca01256975a5bb3365d7f494b..de38e884f288c8247bdd78e2fce56e2e816b8c5f 100644 (file)
@@ -1,33 +1,68 @@
+/*     $NetBSD: perror.c,v 1.24 2006/01/26 11:13:42 kleink Exp $       */
+
 /*
- * perror.c - print an error message on the standard error output
+ * 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. 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.
  */
-/* $Header$ */
 
-#if    defined(_POSIX_SOURCE)
-#include       <sys/types.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)perror.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: perror.c,v 1.24 2006/01/26 11:13:42 kleink Exp $");
 #endif
-#include       <stdio.h>
-#include       <errno.h>
-#include       <stdio.h>
-#include       <string.h>
-#include       "loc_incl.h"
+#endif /* LIBC_SCCS and not lint */
 
-ssize_t _write(int d, const char *buf, size_t nbytes);
+#include "namespace.h"
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <string.h>
+#include "extern.h"
+
+/*
+ * Since perror() is not allowed to change the contents of strerror()'s
+ * static buffer, both functions supply their own buffers to strerror_r().
+ */
 
 void
 perror(const char *s)
 {
-       char *p;
-       int fd;
+       const char *separator;
+       char buf[NL_TEXTMAX];
+
+       if (s == NULL)
+               s = "";
+       if (*s == '\0')
+               separator = "";
+       else
+               separator = ": ";
 
-       p = strerror(errno);
-       fd = fileno(stderr);
-       fflush(stdout);
-       fflush(stderr);
-       if (s && *s) {
-               _write(fd, s, strlen(s));
-               _write(fd, ": ", 2);
-       }
-       _write(fd, p, strlen(p));
-       _write(fd, "\n", 1);
+       (void)strerror_r(errno, buf, sizeof(buf));
+       (void)fprintf(stderr, "%s%s%s\n", s, separator, buf);
 }
index aeadad81ff1a555a3784d584af6ed4753f601e92..1c195ffa0d99fedb63dce239c59b6c7e6585ab3a 100644 (file)
@@ -1,23 +1,59 @@
-/*
- * printf - write on the standard output stream
+/*     $NetBSD: printf.c,v 1.11 2003/08/07 16:43:29 agc Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)printf.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: printf.c,v 1.11 2003/08/07 16:43:29 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
 
 int
-printf(const char *format, ...)
+printf(char const *fmt, ...)
 {
+       int ret;
        va_list ap;
-       int retval;
-
-       va_start(ap, format);
-
-       retval = _doprnt(format, ap, stdout);
 
+       va_start(ap, fmt);
+       ret = vfprintf(stdout, fmt, ap);
        va_end(ap);
-
-       return retval;
+       return (ret);
 }
index fc8971c3c01abdc218bbb7d6ce883544675e6da1..b3d6a5aaca7801c2fa6ede53e8b130e83c002183 100644 (file)
@@ -1,12 +1,80 @@
+/*     $NetBSD: putc.c,v 1.11 2003/08/07 16:43:29 agc Exp $    */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)putc.c     8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: putc.c,v 1.11 2003/08/07 16:43:29 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+
 /*
- * putc.c - print (or buffer) one character
+ * A subroutine version of the macro putc.
  */
-/* $Header$ */
+#undef putc
+#undef putc_unlocked
+
+int
+putc(c, fp)
+       int c;
+       FILE *fp;
+{
+       int r;
+
+       _DIAGASSERT(fp != NULL);
 
-#include       <stdio.h>
+       FLOCKFILE(fp);
+       r = __sputc(c, fp);
+       FUNLOCKFILE(fp);
+       return r;
+}
 
 int
-(putc)(int c, FILE *stream)
+putc_unlocked(c, fp)
+       int c;
+       FILE *fp;
 {
-       return putc(c, stream);
+
+       _DIAGASSERT(fp != NULL);
+
+       return (__sputc(c, fp));
 }
index 6ed2356131e255731b9b1da73edceb9d372f3438..4f7aca95f1c2f49569aed6a4fe3acfd135327fa7 100644 (file)
@@ -1,12 +1,72 @@
+/*     $NetBSD: putchar.c,v 1.9 2003/08/07 16:43:29 agc Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)putchar.c  8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: putchar.c,v 1.9 2003/08/07 16:43:29 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+
+#undef putchar
+#undef putchar_unlocked
+
 /*
- * putchar.c - print (or buffer) a character on the standard output stream
+ * A subroutine version of the macro putchar
  */
-/* $Header$ */
+int
+putchar(c)
+       int c;
+{
+       FILE *fp = stdout;
+        int r;
 
-#include       <stdio.h>
+       FLOCKFILE(fp);
+       r = __sputc(c, fp);
+       FUNLOCKFILE(fp);
+       return r;
+}
 
 int
-(putchar)(int c)
+putchar_unlocked(c)
+       int c;
 {
-       return putchar(c);
+       return (__sputc(c, stdout));
 }
index 56248b37f0416a35381111b3e927b712573bf4d2..810b96cfc2403a07562a3889656219574e7e0038 100644 (file)
@@ -1,20 +1,82 @@
-/*
- * puts.c - print a string onto the standard output stream
+/*     $NetBSD: puts.c,v 1.15 2006/03/17 02:25:23 chris Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)puts.c     8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: puts.c,v 1.15 2006/03/17 02:25:23 chris Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include "fvwrite.h"
+#include "reentrant.h"
+#include "local.h"
 
+/*
+ * Write the given string to stdout, appending a newline.
+ */
 int
-puts(register const char *s)
+puts(s)
+       char const *s;
 {
-       register FILE *file = stdout;
-       register int i = 0;
-
-       while (*s) {
-               if (putc(*s++, file) == EOF) return EOF;
-               else i++;
-       }
-       if (putc('\n', file) == EOF) return EOF;
-       return i + 1;
+       size_t c;
+       struct __suio uio;
+       struct __siov iov[2];
+       int r;
+
+       _DIAGASSERT(s != NULL);
+
+       if (s == NULL)
+               s = "(null)";
+
+       c = strlen(s);
+
+       iov[0].iov_base = __UNCONST(s);
+       iov[0].iov_len = c;
+       iov[1].iov_base = __UNCONST("\n");
+       iov[1].iov_len = 1;
+       uio.uio_resid = c + 1;
+       uio.uio_iov = &iov[0];
+       uio.uio_iovcnt = 2;
+       FLOCKFILE(stdout);
+       r = __sfvwrite(stdout, &uio);
+       FUNLOCKFILE(stdout);
+       return (r ? EOF : '\n');
 }
index 7c985ba5920b0aa9e7664f4b94359e6d47bf98b8..f006cd543a43d9d6835737e8e20e27a7c578423e 100644 (file)
@@ -1,27 +1,71 @@
-/*
- * remove.c - remove a file
- */
-/* $Header$ */
+/*     $NetBSD: remove.c,v 1.13 2003/08/07 16:43:30 agc Exp $  */
 
-#include       <stdio.h>
-#include       <errno.h>
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
+ */
 
-int _rmdir(const char *path);
-int _unlink(const char *path);
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)remove.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: remove.c,v 1.13 2003/08/07 16:43:30 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
 
-int
-remove(const char *filename) {
-       int saved_errno, retval;
+#include <sys/types.h>
+#include <sys/stat.h>
 
-       saved_errno = errno;
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <unistd.h>
 
-       retval = _rmdir(filename);
+int
+remove(file)
+       const char *file;
+{
+       struct stat sb;
 
-       if (retval == -1 && errno == ENOTDIR) {
-               errno = saved_errno;
+       _DIAGASSERT(file != NULL);
 
-               retval = _unlink(filename);
-       }
+       if (lstat(file, &sb) < 0)
+               return (-1);
 
-       return retval;
+       /*
+        * The file system may prohibit using unlink(2) on directories,
+        * so always use rmdir(2) in that case.
+        */
+       if (S_ISDIR(sb.st_mode))
+               return (rmdir(file));
+       else
+               return (unlink(file));
 }
index 5b835881b0fdaf950da025eef1826941a6356e0b..899ec58eff355fd7e5957045f96f7578ce5c6131 100644 (file)
@@ -1,14 +1,61 @@
-/*
- * rewind.c - set the file position indicator of a stream to the start
+/*     $NetBSD: rewind.c,v 1.13 2003/08/07 16:43:30 agc Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)rewind.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: rewind.c,v 1.13 2003/08/07 16:43:30 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
 
 void
-rewind(FILE *stream)
+rewind(fp)
+       FILE *fp;
 {
-       (void) fseek(stream, 0L, SEEK_SET);
-       clearerr(stream);
+
+       _DIAGASSERT(fp != NULL);
+
+       FLOCKFILE(fp);
+       (void) fseek(fp, 0L, SEEK_SET);
+       __sclearerr(fp);
+       FUNLOCKFILE(fp);
 }
index 1485d703aec970da9d49f2800f5c6d7eaa642d44..1fbf753d542b177bfc528aedce5e86d39d2ce852 100644 (file)
@@ -1,25 +1,64 @@
-/*
- * scanf.c - read formatted input from the standard input stream
+/*     $NetBSD: scanf.c,v 1.12 2003/08/07 16:43:31 agc Exp $   */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)scanf.c    8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: scanf.c,v 1.12 2003/08/07 16:43:31 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "reentrant.h"
+#include "local.h"
 
 int
-scanf(const char *format, ...)
+scanf(char const *fmt, ...)
 {
+       int ret;
        va_list ap;
-       int retval;
-
-       va_start(ap, format);
 
-       retval = _doscan(stdin, format, ap);
+       _DIAGASSERT(fmt != NULL);
 
+       va_start(ap, fmt);
+       ret = __svfscanf(stdin, fmt, ap);
        va_end(ap);
-
-       return retval;
+       return (ret);
 }
-
-
index 42fe3a2664d782632c95b2197f5c58cc095d9469..08c23c01e5af80dde6d1cca4dd73408b4eeb1f60 100644 (file)
@@ -1,13 +1,60 @@
-/*
- * setbuf.c - control buffering of a stream
+/*     $NetBSD: setbuf.c,v 1.9 2003/08/07 16:43:31 agc Exp $   */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)setbuf.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: setbuf.c,v 1.9 2003/08/07 16:43:31 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
 
 void
-setbuf(register FILE *stream, char *buf)
+setbuf(fp, buf)
+       FILE *fp;
+       char *buf;
 {
-       (void) setvbuf(stream, buf, (buf ? _IOFBF : _IONBF), (size_t) BUFSIZ);
+
+       _DIAGASSERT(fp != NULL);
+       /* buf may be NULL */
+
+       (void) setvbuf(fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
 }
index bf1a485d5c6e2a6865626bd883d66125cae9d61c..957e04366e8aa19bd7e498624de447cfa0263d7a 100644 (file)
-/*
- * setbuf.c - control buffering of a stream
+/*     $NetBSD: setvbuf.c,v 1.17 2003/08/07 16:43:31 agc Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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       <stdio.h>
-#include       <stdlib.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)setvbuf.c  8.2 (Berkeley) 11/16/93";
+#else
+__RCSID("$NetBSD: setvbuf.c,v 1.17 2003/08/07 16:43:31 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
 
-extern void (*_clean)(void);
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include "reentrant.h"
+#include "local.h"
 
+/*
+ * Set one of the three kinds of buffering, optionally including
+ * a buffer.
+ */
 int
-setvbuf(register FILE *stream, char *buf, int mode, size_t size)
+setvbuf(fp, buf, mode, size)
+       FILE *fp;
+       char *buf;
+       int mode;
+       size_t size;
 {
-       int retval = 0;
+       int ret, flags;
+       size_t iosize;
+       int ttyflag;
 
-       _clean = __cleanup;
-       if (mode != _IOFBF && mode != _IOLBF && mode != _IONBF)
-               return EOF;
+       _DIAGASSERT(fp != NULL);
+       /* buf may be NULL */
 
-       if (stream->_buf && io_testflag(stream,_IOMYBUF) )
-               free((void *)stream->_buf);
+       /*
+        * Verify arguments.  The `int' limit on `size' is due to this
+        * particular implementation.  Note, buf and size are ignored
+        * when setting _IONBF.
+        */
+       if (mode != _IONBF)
+               if ((mode != _IOFBF && mode != _IOLBF) || (int)size < 0)
+                       return (-1);
 
-       stream->_flags &= ~(_IOMYBUF | _IONBF | _IOLBF);
+       FLOCKFILE(fp);
+       /*
+        * Write current buffer, if any.  Discard unread input (including
+        * ungetc data), cancel line buffering, and free old buffer if
+        * malloc()ed.  We also clear any eof condition, as if this were
+        * a seek.
+        */
+       ret = 0;
+       (void)__sflush(fp);
+       if (HASUB(fp))
+               FREEUB(fp);
+       WCIO_FREE(fp);
+       fp->_r = fp->_lbfsize = 0;
+       flags = fp->_flags;
+       if (flags & __SMBF)
+               free((void *)fp->_bf._base);
+       flags &= ~(__SLBF | __SNBF | __SMBF | __SOPT | __SNPT | __SEOF);
 
-       if (buf && size <= 0) retval = EOF;
-       if (!buf && (mode != _IONBF)) {
-               if (size <= 0 || (buf = (char *) malloc(size)) == NULL) {
-                       retval = EOF;
-               } else {
-                       stream->_flags |= _IOMYBUF;
-               }
+       /* If setting unbuffered mode, skip all the hard work. */
+       if (mode == _IONBF)
+               goto nbf;
+
+       /*
+        * Find optimal I/O size for seek optimization.  This also returns
+        * a `tty flag' to suggest that we check isatty(fd), but we do not
+        * care since our caller told us how to buffer.
+        */
+       flags |= __swhatbuf(fp, &iosize, &ttyflag);
+       if (size == 0) {
+               buf = NULL;     /* force local allocation */
+               size = iosize;
        }
 
-       stream->_buf = (unsigned char *) buf;
+       /* Allocate buffer if needed. */
+       if (buf == NULL) {
+               if ((buf = malloc(size)) == NULL) {
+                       /*
+                        * Unable to honor user's request.  We will return
+                        * failure, but try again with file system size.
+                        */
+                       ret = -1;
+                       if (size != iosize) {
+                               size = iosize;
+                               buf = malloc(size);
+                       }
+               }
+               if (buf == NULL) {
+                       /* No luck; switch to unbuffered I/O. */
+nbf:
+                       fp->_flags = flags | __SNBF;
+                       fp->_w = 0;
+                       fp->_bf._base = fp->_p = fp->_nbuf;
+                       fp->_bf._size = 1;
+                       FUNLOCKFILE(fp);
+                       return (ret);
+               }
+               flags |= __SMBF;
+       }
 
-       stream->_count = 0;
-       stream->_flags |= mode;
-       stream->_ptr = stream->_buf;
+       /*
+        * Kill any seek optimization if the buffer is not the
+        * right size.
+        *
+        * SHOULD WE ALLOW MULTIPLES HERE (i.e., ok iff (size % iosize) == 0)?
+        */
+       if (size != iosize)
+               flags |= __SNPT;
 
-       if (!buf) {
-               stream->_bufsiz = 1;
+       /*
+        * Fix up the FILE fields, and set __cleanup for output flush on
+        * exit (since we are buffered in some way).
+        */
+       if (mode == _IOLBF)
+               flags |= __SLBF;
+       fp->_flags = flags;
+       fp->_bf._base = fp->_p = (unsigned char *)buf;
+       fp->_bf._size = size;
+       /* fp->_lbfsize is still 0 */
+       if (flags & __SWR) {
+               /*
+                * Begin or continue writing: see __swsetup().  Note
+                * that __SNBF is impossible (it was handled earlier).
+                */
+               if (flags & __SLBF) {
+                       fp->_w = 0;
+                       fp->_lbfsize = -fp->_bf._size;
+               } else
+                       fp->_w = size;
        } else {
-               stream->_bufsiz = size;
+               /* begin/continue reading, or stay in intermediate state */
+               fp->_w = 0;
        }
+       __cleanup = _cleanup;
 
-       return retval;
+       FUNLOCKFILE(fp);
+       return (ret);
 }
index efe4c4491b63010067517fc5232af8dcb8dccf05..a3f59fe4824aa40070bc4c7e6ecbfa48a58c0747 100644 (file)
@@ -1,24 +1,94 @@
-/*
- * snprintf - print limited formatted output on an array
+/*     $NetBSD: snprintf.c,v 1.22 2007/10/26 19:48:14 christos Exp $   */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       <limits.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: snprintf.c,v 1.22 2007/10/26 19:48:14 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "reentrant.h"
+#include "local.h"
+
+#if defined(_FORTIFY_SOURCE) && !defined(__lint__)
+#undef snprintf
+#define snprintf _snprintf
+#endif
+
+#ifdef __weak_alias
+__weak_alias(snprintf,_snprintf)
+#endif
 
 int
-snprintf(char *s, size_t n, const char *format, ...)
+snprintf(char *str, size_t n, char const *fmt, ...)
 {
+       int ret;
        va_list ap;
-       int retval;
+       FILE f;
+       struct __sfileext fext;
+       unsigned char dummy[1];
 
-       va_start(ap, format);
-
-       retval = vsnprintf(s, n, format, ap);
+       _DIAGASSERT(n == 0 || str != NULL);
+       _DIAGASSERT(fmt != NULL);
 
+       if ((int)n < 0) {
+               errno = EINVAL;
+               return (-1);
+       }
+       va_start(ap, fmt);
+       _FILEEXT_SETUP(&f, &fext);
+       f._file = -1;
+       f._flags = __SWR | __SSTR;
+       if (n == 0) {
+               f._bf._base = f._p = dummy;
+               f._bf._size = f._w = 0;
+       } else {
+               f._bf._base = f._p = (unsigned char *)str;
+               f._bf._size = f._w = n - 1;
+       }
+       ret = __vfprintf_unlocked(&f, fmt, ap);
+       *f._p = 0;
        va_end(ap);
-
-       return retval;
+       return (ret);
 }
index 5fe46af36ceb8869967a05c5a3bda1104cac3e63..8045e9c454a9225d36c2fd5e96635e0321ee984e 100644 (file)
@@ -1,25 +1,78 @@
-/*
- * sprintf - print formatted output on an array
+/*     $NetBSD: sprintf.c,v 1.15 2007/06/03 17:39:26 christos Exp $    */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       <limits.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)sprintf.c  8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: sprintf.c,v 1.15 2007/06/03 17:39:26 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "reentrant.h"
+#include "local.h"
+
+#ifdef _FORTIFY_SOURCE
+#undef sprintf
+#endif
 
 int
-sprintf(char *s, const char *format, ...)
+sprintf(char *str, char const *fmt, ...)
 {
+       int ret;
        va_list ap;
-       int retval;
+       FILE f;
+       struct __sfileext fext;
 
-       va_start(ap, format);
-
-       retval = vsnprintf(s, INT_MAX, format, ap);
+       _DIAGASSERT(str != NULL);
+       _DIAGASSERT(fmt != NULL);
 
+       _FILEEXT_SETUP(&f, &fext);
+       f._file = -1;
+       f._flags = __SWR | __SSTR;
+       f._bf._base = f._p = (unsigned char *)str;
+       f._bf._size = f._w = INT_MAX;
+       va_start(ap, fmt);
+       ret = __vfprintf_unlocked(&f, fmt, ap);
        va_end(ap);
-
-       return retval;
+       *f._p = 0;
+       return (ret);
 }
-
index 6e1ad56c728e755e7cfc33dbe9db4f389c8ef1b9..42463ff61238bd125c0cb14a00a151b31dda9946 100644 (file)
@@ -1,30 +1,87 @@
-/*
- * sscanf - read formatted output from a string
+/*     $NetBSD: sscanf.c,v 1.17 2010/01/11 20:39:29 joerg Exp $        */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       <string.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)sscanf.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: sscanf.c,v 1.17 2010/01/11 20:39:29 joerg Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "reentrant.h"
+#include "local.h"
 
-int sscanf(const char *s, const char *format, ...)
+static int eofread __P((void *, char *, int));
+
+/* ARGSUSED */
+static int
+eofread(cookie, buf, len)
+       void *cookie;
+       char *buf;
+       int len;
 {
-       va_list ap;
-       int retval;
-       FILE tmp_stream;
 
-       va_start(ap, format);
+       return (0);
+}
 
-       tmp_stream._fd     = -1;
-       tmp_stream._flags  = _IOREAD + _IONBF + _IOREADING;
-       tmp_stream._buf    = (unsigned char *) s;
-       tmp_stream._ptr    = (unsigned char *) s;
-       tmp_stream._count  = strlen(s);
+int
+sscanf(const char *str, char const *fmt, ...)
+{
+       int ret;
+       va_list ap;
+       FILE f;
+       struct __sfileext fext;
 
-       retval = _doscan(&tmp_stream, format, ap);
+       _DIAGASSERT(str != NULL);
+       _DIAGASSERT(fmt != NULL);
 
+       _FILEEXT_SETUP(&f, &fext);
+       f._flags = __SRD;
+       f._bf._base = f._p = __UNCONST(str);
+       f._bf._size = f._r = strlen(str);
+       f._read = eofread;
+       _UB(&f)._base = NULL;
+       va_start(ap, fmt);
+       ret = __svfscanf_unlocked(&f, fmt, ap);
        va_end(ap);
-
-       return retval;
+       return (ret);
 }
index c24dced0d7fdf8e12ba08ce28d4e2f3f680d3935..86b68536792d8f476fe57d71a7e343d5015e6ecf 100644 (file)
@@ -1,31 +1,85 @@
-/*
- * tmpfile.c - create and open a temporary file
+/*     $NetBSD: tmpfile.c,v 1.11 2003/08/07 16:43:33 agc Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#if    defined(_POSIX_SOURCE)
-#include       <sys/types.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)tmpfile.c  8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: tmpfile.c,v 1.11 2003/08/07 16:43:33 agc Exp $");
 #endif
-#include       <stdio.h>
-#include       <string.h>
-#include       "loc_incl.h"
+#endif /* LIBC_SCCS and not lint */
 
-pid_t _getpid(void);
+#include "namespace.h"
+#include <sys/types.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <paths.h>
 
 FILE *
-tmpfile(void) {
-       static char name_buffer[L_tmpnam] = "/tmp/tmp." ;
-       static char *name = NULL;
-       FILE *file;
-
-       if (!name) {
-               name = name_buffer + strlen(name_buffer);
-               name = _i_compute(_getpid(), 10, name, 5);
-               *name = '\0';
-       }
+tmpfile()
+{
+       sigset_t set, oset;
+       FILE *fp;
+       int fd, sverrno;
+#define        TRAILER "tmp.XXXXXXXXXX"
+       char buf[sizeof(_PATH_TMP) + sizeof(TRAILER)];
+
+       (void)memcpy(buf, _PATH_TMP, sizeof(_PATH_TMP) - 1);
+       (void)memcpy(buf + sizeof(_PATH_TMP) - 1, TRAILER, sizeof(TRAILER));
+
+       sigfillset(&set);
+       (void)sigprocmask(SIG_BLOCK, &set, &oset);
 
-       file = fopen(name_buffer,"wb+");
-       if (!file) return (FILE *)NULL;
-       (void) remove(name_buffer);
-       return file;
+       fd = mkstemp(buf);
+       if (fd != -1)
+               (void)unlink(buf);
+
+       (void)sigprocmask(SIG_SETMASK, &oset, NULL);
+
+       if (fd == -1)
+               return (NULL);
+
+       if ((fp = fdopen(fd, "w+")) == NULL) {
+               sverrno = errno;
+               (void)close(fd);
+               errno = sverrno;
+               return (NULL);
+       }
+       return (fp);
 }
index 71e5f13c2a73b2bd9c53afc22ed151b46b00557b..ac42baf35ce8fe712d418301859215ad2a237393 100644 (file)
@@ -1,31 +1,66 @@
-/*
- * tmpnam.c - create a unique filename
+/*     $NetBSD: tmpnam.c,v 1.14 2003/08/07 16:43:33 agc Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993, 1994
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#if    defined(_POSIX_SOURCE)
-#include       <sys/types.h>
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)tmpnam.c   8.3 (Berkeley) 3/28/94";
+#else
+__RCSID("$NetBSD: tmpnam.c,v 1.14 2003/08/07 16:43:33 agc Exp $");
 #endif
-#include       <stdio.h>
-#include       <string.h>
-#include       "loc_incl.h"
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <sys/types.h>
+#include <stdio.h>
+#include <unistd.h>
+#include "reentrant.h"
+#include "local.h"
 
-pid_t _getpid(void);
+__warn_references(tmpnam,
+    "warning: tmpnam() possibly used unsafely, use mkstemp() or mkdtemp()")
 
 char *
-tmpnam(char *s) {
-       static char name_buffer[L_tmpnam] = "/tmp/tmp.";
-       static unsigned long count = 0;
-       static char *name = NULL;
+tmpnam(s)
+       char *s;
+{
+       static u_long tmpcount;
+       static char buf[L_tmpnam];
 
-       if (!name) { 
-               name = name_buffer + strlen(name_buffer);
-               name = _i_compute((unsigned long)_getpid(), 10, name, 5);
-               *name++ = '.';
-               *name = '\0';
-       }
-       if (++count > TMP_MAX) count = 1;       /* wrap-around */
-       *_i_compute(count, 10, name, 3) = '\0';
-       if (s) return strcpy(s, name_buffer);
-       else return name_buffer;
+       if (s == NULL)
+               s = buf;
+       (void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXXXXXX", P_tmpdir, tmpcount);
+       ++tmpcount;
+       return (_mktemp(s));
 }
index e78bf265caa6464259db7ca78b5b4a0a59d371e8..10eb301bba115d7a97d69df74b78a207a8b95726 100644 (file)
+/*     $NetBSD: ungetc.c,v 1.16 2009/10/25 20:44:13 christos Exp $     */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)ungetc.c   8.2 (Berkeley) 11/3/93";
+#else
+__RCSID("$NetBSD: ungetc.c,v 1.16 2009/10/25 20:44:13 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "reentrant.h"
+#include "local.h"
+
+static int __submore __P((FILE *));
 /*
- * ungetc.c - push a character back onto an input stream
+ * Expand the ungetc buffer `in place'.  That is, adjust fp->_p when
+ * the buffer moves, so that it points the same distance from the end,
+ * and move the bytes in the buffer around as necessary so that they
+ * are all at the end (stack-style).
  */
-/* $Header$ */
+static int
+__submore(fp)
+       FILE *fp;
+{
+       int i;
+       unsigned char *p;
 
-#include       <stdio.h>
-#include       "loc_incl.h"
+       _DIAGASSERT(fp != NULL);
+
+       if (_UB(fp)._base == fp->_ubuf) {
+               /*
+                * Get a new buffer (rather than expanding the old one).
+                */
+               if ((p = malloc((size_t)BUFSIZ)) == NULL)
+                       return (EOF);
+               _UB(fp)._base = p;
+               _UB(fp)._size = BUFSIZ;
+               p += BUFSIZ - sizeof(fp->_ubuf);
+               for (i = sizeof(fp->_ubuf); --i >= 0;)
+                       p[i] = fp->_ubuf[i];
+               fp->_p = p;
+               return (0);
+       }
+       i = _UB(fp)._size;
+       p = realloc(_UB(fp)._base, (size_t)(i << 1));
+       if (p == NULL)
+               return (EOF);
+       /* no overlap (hence can use memcpy) because we doubled the size */
+       (void)memcpy((p + i), p, (size_t)i);
+       fp->_p = p + i;
+       _UB(fp)._base = p;
+       _UB(fp)._size = i << 1;
+       return (0);
+}
 
 int
-ungetc(int ch, FILE *stream)
+ungetc(c, fp)
+       int c;
+       FILE *fp;
 {
-       unsigned char *p;
 
-       if (ch == EOF  || !io_testflag(stream,_IOREADING))
-               return EOF;
-       if (stream->_ptr == stream->_buf) {
-               if (stream->_count != 0) return EOF;
-               stream->_ptr++;
+       _DIAGASSERT(fp != NULL);
+
+       if (c == EOF)
+               return (EOF);
+       if (!__sdidinit)
+               __sinit();
+       FLOCKFILE(fp);
+       _SET_ORIENTATION(fp, -1);
+       if ((fp->_flags & __SRD) == 0) {
+               /*
+                * Not already reading: no good unless reading-and-writing.
+                * Otherwise, flush any current write stuff.
+                */
+               if ((fp->_flags & __SRW) == 0) {
+                       FUNLOCKFILE(fp);
+                       return (EOF);
+               }
+               if (fp->_flags & __SWR) {
+                       if (__sflush(fp)) {
+                               FUNLOCKFILE(fp);
+                               return (EOF);
+                       }
+                       fp->_flags &= ~__SWR;
+                       fp->_w = 0;
+                       fp->_lbfsize = 0;
+               }
+               fp->_flags |= __SRD;
+       }
+       c = (unsigned char)c;
+
+       /*
+        * If we are in the middle of ungetc'ing, just continue.
+        * This may require expanding the current ungetc buffer.
+        */
+       if (HASUB(fp)) {
+               if (fp->_r >= _UB(fp)._size && __submore(fp)) {
+                       FUNLOCKFILE(fp);
+                       return (EOF);
+               }
+               *--fp->_p = c;
+               fp->_r++;
+               FUNLOCKFILE(fp);
+               return (c);
+       }
+       fp->_flags &= ~__SEOF;
+
+       /*
+        * If we can handle this by simply backing up, do so,
+        * but never replace the original character.
+        * (This makes sscanf() work when scanning `const' data.)
+        */
+       if (fp->_bf._base != NULL && fp->_p > fp->_bf._base &&
+           fp->_p[-1] == c) {
+               fp->_p--;
+               fp->_r++;
+               FUNLOCKFILE(fp);
+               return (c);
        }
-       stream->_count++;
-       p = --(stream->_ptr);           /* ??? Bloody vax assembler !!! */
-       /* ungetc() in sscanf() shouldn't write in rom */
-       if (*p != (unsigned char) ch)
-               *p = (unsigned char) ch;
-       return ch;
+
+       /*
+        * Create an ungetc buffer.
+        * Initially, we will use the `reserve' buffer.
+        */
+       fp->_ur = fp->_r;
+       fp->_up = fp->_p;
+       _UB(fp)._base = fp->_ubuf;
+       _UB(fp)._size = sizeof(fp->_ubuf);
+       fp->_ubuf[sizeof(fp->_ubuf) - 1] = c;
+       fp->_p = &fp->_ubuf[sizeof(fp->_ubuf) - 1];
+       fp->_r = 1;
+       FUNLOCKFILE(fp);
+       return (c);
 }
index e7c0e08063dc600ca095df9c72c79f2002c7bbb6..ae11e256f3b1322f59afde6376d54b3e624d6e9b 100644 (file)
@@ -1,14 +1,2 @@
-/*
- * vfprintf - formatted output without ellipsis
- */
-/* $Header$ */
-
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       "loc_incl.h"
-
-int
-vfprintf(FILE *stream, const char *format, va_list arg)
-{
-       return _doprnt (format, arg, stream);
-}
+#define NARROW
+#include "vfwprintf.c"
index a123cf24cd07c3394d67749d740ff1bf469ee59c..711884035b6b4539c4227f8ff306a92509fef464 100644 (file)
@@ -1,14 +1,57 @@
-/*
- * vprintf - formatted output without ellipsis to the standard output stream
+/*     $NetBSD: vprintf.c,v 1.10 2003/08/07 16:43:34 agc Exp $ */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)vprintf.c  8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: vprintf.c,v 1.10 2003/08/07 16:43:34 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
 
 int
-vprintf(const char *format, va_list arg)
+vprintf(fmt, ap)
+       char const *fmt;
+       _BSD_VA_LIST_ ap;
 {
-       return _doprnt(format, arg, stdout);
+
+       _DIAGASSERT(fmt != NULL);
+
+       return (vfprintf(stdout, fmt, ap));
 }
index 89ee8abd577127e0175b8d51c16afbfa7d1845df..6959b5e2c5eb0c00a17e756805c8f7f0d9e64896 100644 (file)
@@ -1,13 +1,60 @@
-/*
- * vscanf.c - read formatted input from the standard input stream
+/*     $NetBSD: vscanf.c,v 1.12 2003/08/07 16:43:35 agc Exp $  */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Donn Seeley at UUNET Technologies, Inc.
+ *
+ * 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. 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       <stdio.h>
-#include       <stdarg.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)vscanf.c   8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: vscanf.c,v 1.12 2003/08/07 16:43:35 agc Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+
+#include "reentrant.h"
+#include "local.h"
 
 int
-vscanf(const char *format, va_list ap)
+vscanf(fmt, ap)
+       const char *fmt;
+       _BSD_VA_LIST_ ap;
 {
-       return _doscan(stdin, format, ap);
+
+       _DIAGASSERT(fmt != NULL);
+
+       return (__svfscanf(stdin, fmt, ap));
 }
index 429a332845d87ff0063772cad8934def7cf3d206..e9678470eceb98e5fd56dc2e80f12564592a99dc 100644 (file)
@@ -1,28 +1,94 @@
-/* $Header$ */
+/*     $NetBSD: vsnprintf.c,v 1.22 2007/10/26 19:48:14 christos Exp $  */
 
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       <limits.h>
-#include       "loc_incl.h"
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)vsnprintf.c        8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: vsnprintf.c,v 1.22 2007/10/26 19:48:14 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+
+#if defined(_FORTIFY_SOURCE) && !defined(__lint__)
+#undef vsnprintf
+#define vsnprintf _vsnprintf
+#endif
+
+#ifdef __weak_alias
+__weak_alias(vsnprintf,_vsnprintf)
+#endif
 
 int
-vsnprintf(char *s, size_t n, const char *format, va_list arg)
+vsnprintf(str, n, fmt, ap)
+       char *str;
+       size_t n;
+       const char *fmt;
+       _BSD_VA_LIST_ ap;
 {
-       int retval;
-       FILE tmp_stream;
-
-       tmp_stream._fd     = -1;
-       tmp_stream._flags  = _IOWRITE + _IONBF + _IOWRITING;
-       tmp_stream._buf    = (unsigned char *) s;
-       tmp_stream._ptr    = (unsigned char *) s;
-       tmp_stream._count  = n-1;
-
-       retval = _doprnt(format, arg, &tmp_stream);
-       if(n > 0) {
-               tmp_stream._count  = 1;
-               (void) putc('\0',&tmp_stream);
+       int ret;
+       FILE f;
+       struct __sfileext fext;
+       unsigned char dummy[1];
+
+       _DIAGASSERT(n == 0 || str != NULL);
+       _DIAGASSERT(fmt != NULL);
+
+       if ((int)n < 0) {
+               errno = EINVAL;
+               return (-1);
        }
 
-       return retval;
+       _FILEEXT_SETUP(&f, &fext);
+       f._file = -1;
+       f._flags = __SWR | __SSTR;
+       if (n == 0) {
+               f._bf._base = f._p = dummy;
+               f._bf._size = f._w = 0;
+       } else {
+               f._bf._base = f._p = (unsigned char *)str;
+               f._bf._size = f._w = n - 1;
+       }
+       ret = __vfprintf_unlocked(&f, fmt, ap);
+       *f._p = 0;
+       return (ret);
 }
-
index 84925316c61c66a972367756b636385eb40f9e9b..ad0fb5b7364a4190ffe374693e55b815ab3a33c2 100644 (file)
@@ -1,15 +1,76 @@
-/*
- * vsprintf - print formatted output without ellipsis on an array
+/*     $NetBSD: vsprintf.c,v 1.15 2007/06/03 17:39:27 christos Exp $   */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Chris Torek.
+ *
+ * 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. 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.
  */
-/* $Header$ */
 
-#include       <stdio.h>
-#include       <stdarg.h>
-#include       <limits.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)vsprintf.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: vsprintf.c,v 1.15 2007/06/03 17:39:27 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include "reentrant.h"
+#include "local.h"
+
+#ifdef _FORTIFY_SOURCE
+#undef vsprintf
+#endif
 
 int
-vsprintf(char *s, const char *format, va_list arg)
+vsprintf(str, fmt, ap)
+       char *str;
+       const char *fmt;
+       _BSD_VA_LIST_ ap;
 {
-       return vsnprintf(s, INT_MAX, format, arg);
+       int ret;
+       FILE f;
+       struct __sfileext fext;
+
+       _DIAGASSERT(str != NULL);
+       _DIAGASSERT(fmt != NULL);
+
+       _FILEEXT_SETUP(&f, &fext);
+       f._file = -1;
+       f._flags = __SWR | __SSTR;
+       f._bf._base = f._p = (unsigned char *)str;
+       f._bf._size = f._w = INT_MAX;
+       ret = __vfprintf_unlocked(&f, fmt, ap);
+       *f._p = 0;
+       return (ret);
 }
index 52075187b2cbb3d2833d11c2b129950155e8d88c..1069fc7932f2f044e2b8b3ac6c62068d6a6e469c 100644 (file)
@@ -1,21 +1,82 @@
-/*
- * vsscanf - read formatted output from a string
+/*     $NetBSD: vsscanf.c,v 1.15 2010/01/11 20:39:29 joerg Exp $       */
+
+/*-
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Donn Seeley at UUNET Technologies, Inc.
+ *
+ * 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. 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       <stdio.h>
-#include       <stdarg.h>
-#include       <string.h>
-#include       "loc_incl.h"
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)vsscanf.c  8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: vsscanf.c,v 1.15 2010/01/11 20:39:29 joerg Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <string.h>
+#include "reentrant.h"
+#include "local.h"
+
+static int eofread __P((void *, char *, int));
+
+/* ARGSUSED */
+static int
+eofread(cookie, buf, len)
+       void *cookie;
+       char *buf;
+       int len;
+{
+       return (0);
+}
 
-int vsscanf(const char *s, const char *format, va_list ap)
+int
+vsscanf(str, fmt, ap)
+       const char *str;
+       const char *fmt;
+       _BSD_VA_LIST_ ap;
 {
-       FILE tmp_stream;
+       FILE f;
+       struct __sfileext fext;
 
-       tmp_stream._fd     = -1;
-       tmp_stream._flags  = _IOREAD + _IONBF + _IOREADING;
-       tmp_stream._buf    = (unsigned char *) s;
-       tmp_stream._ptr    = (unsigned char *) s;
-       tmp_stream._count  = strlen(s);
+       _DIAGASSERT(str != NULL);
+       _DIAGASSERT(fmt != NULL);
 
-       return _doscan(&tmp_stream, format, ap);
+       _FILEEXT_SETUP(&f, &fext);
+       f._flags = __SRD;
+       f._bf._base = f._p = __UNCONST(str);
+       f._bf._size = f._r = strlen(str);
+       f._read = eofread;
+       _UB(&f)._base = NULL;
+       return (__svfscanf_unlocked(&f, fmt, ap));
 }
similarity index 96%
rename from lib/nbsd_libc/stdlib/Makefile.inc
rename to lib/libc/stdlib/Makefile.inc
index f1abd7b2f30d46d4a02ec3f7f7c10de5922e7624..d9e95c82fb77ca3803e4e5789b9dca355423ffbc 100644 (file)
@@ -44,9 +44,9 @@ SRCS+= erand48_ieee754.c
 SRCS+= jemalloc.c
 .elif (${USE_MINIXMALLOC} != "no")
 SRCS+= \
-       ${LIBCDIR}/../libc/ansi/malloc.c        \
-       ${LIBCDIR}/../libc/ansi/calloc.c        \
-       ${LIBCDIR}/../libc/ansi/malloc-debug.c
+       minix/malloc.c  \
+       minix/calloc.c  \
+       minix/malloc-debug.c
 .else
 SRCS+= malloc.c
 .endif
diff --git a/lib/libc/stdtime/Makefile.inc b/lib/libc/stdtime/Makefile.inc
deleted file mode 100644 (file)
index 7588617..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# stdtime sources
-.PATH: ${.CURDIR}/stdtime
-
-SRCS+=  \
-       ftime.c \
-       asctime.c \
-       localtime.c \
-       strftime.c \
-       strptime.c
diff --git a/lib/libc/stdtime/asctime.c b/lib/libc/stdtime/asctime.c
deleted file mode 100644 (file)
index 957fdba..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson.
-*/
-
-/*
-** Avoid the temptation to punt entirely to strftime;
-** the output of strftime is supposed to be locale specific
-** whereas the output of asctime is supposed to be constant.
-*/
-
-#ifndef lint
-#ifndef NOID
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*LINTLIBRARY*/
-
-#include "private.h"
-#include "tzfile.h"
-
-/*
-** Some systems only handle "%.2d"; others only handle "%02d";
-** "%02.2d" makes (most) everybody happy.
-** At least some versions of gcc warn about the %02.2d; ignore the warning.
-*/
-/*
-** All years associated with 32-bit time_t values are exactly four digits long;
-** some years associated with 64-bit time_t values are not.
-** Vintage programs are coded for years that are always four digits long
-** and may assume that the newline always lands in the same place.
-** For years that are less than four digits, we pad the output with
-** leading zeroes to get the newline in the traditional place.
-** The -4 ensures that we get four characters of output even if
-** we call a strftime variant that produces fewer characters for some years.
-** The ISO C 1999 and POSIX 1003.1-2004 standards prohibit padding the year,
-** but many implementations pad anyway; most likely the standards are buggy.
-*/
-#define ASCTIME_FMT    "%.3s %.3s%3d %02.2d:%02.2d:%02.2d %-4s\n"
-/*
-** For years that are more than four digits we put extra spaces before the year
-** so that code trying to overwrite the newline won't end up overwriting
-** a digit within a year and truncating the year (operating on the assumption
-** that no output is better than wrong output).
-*/
-#define ASCTIME_FMT_B  "%.3s %.3s%3d %02.2d:%02.2d:%02.2d     %s\n"
-
-#define STD_ASCTIME_BUF_SIZE   26
-/*
-** Big enough for something such as
-** ??? ???-2147483648 -2147483648:-2147483648:-2147483648     -2147483648\n
-** (two three-character abbreviations, five strings denoting integers,
-** seven explicit spaces, two explicit colons, a newline,
-** and a trailing ASCII nul).
-** The values above are for systems where an int is 32 bits and are provided
-** as an example; the define below calculates the maximum for the system at
-** hand.
-*/
-#define MAX_ASCTIME_BUF_SIZE   (2*3+5*INT_STRLEN_MAXIMUM(int)+7+2+1+1)
-
-static char    buf_asctime[MAX_ASCTIME_BUF_SIZE];
-
-/*
-** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition.
-*/
-
-char *
-asctime_r(timeptr, buf)
-register const struct tm *     timeptr;
-char *                         buf;
-{
-       static const char       wday_name[][3] = {
-               "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-       };
-       static const char       mon_name[][3] = {
-               "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-       };
-       register const char *   wn;
-       register const char *   mn;
-       char                    year[INT_STRLEN_MAXIMUM(int) + 2];
-       char                    result[MAX_ASCTIME_BUF_SIZE];
-
-       if (timeptr->tm_wday < 0 || timeptr->tm_wday >= DAYSPERWEEK)
-               wn = "???";
-       else    wn = wday_name[timeptr->tm_wday];
-       if (timeptr->tm_mon < 0 || timeptr->tm_mon >= MONSPERYEAR)
-               mn = "???";
-       else    mn = mon_name[timeptr->tm_mon];
-       /*
-       ** Use strftime's %Y to generate the year, to avoid overflow problems
-       ** when computing timeptr->tm_year + TM_YEAR_BASE.
-       ** Assume that strftime is unaffected by other out-of-range members
-       ** (e.g., timeptr->tm_mday) when processing "%Y".
-       */
-       (void) strftime(year, sizeof year, "%Y", timeptr);
-       /*
-       ** We avoid using snprintf since it's not available on all systems.
-       */
-       (void) sprintf(result,
-               ((strlen(year) <= 4) ? ASCTIME_FMT : ASCTIME_FMT_B),
-               wn, mn,
-               timeptr->tm_mday, timeptr->tm_hour,
-               timeptr->tm_min, timeptr->tm_sec,
-               year);
-       if (strlen(result) < STD_ASCTIME_BUF_SIZE || buf == buf_asctime) {
-               (void) strcpy(buf, result);
-               return buf;
-       } else {
-#ifdef EOVERFLOW
-               errno = EOVERFLOW;
-#else /* !defined EOVERFLOW */
-               errno = EINVAL;
-#endif /* !defined EOVERFLOW */
-               return NULL;
-       }
-}
-
-/*
-** A la ISO/IEC 9945-1, ANSI/IEEE Std 1003.1, 2004 Edition.
-*/
-
-char *
-asctime(timeptr)
-register const struct tm *     timeptr;
-{
-       return asctime_r(timeptr, buf_asctime);
-}
diff --git a/lib/libc/stdtime/date.1 b/lib/libc/stdtime/date.1
deleted file mode 100644 (file)
index 22ebd01..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-.TH DATE 1
-.SH NAME
-date \- show and set date and time
-.SH SYNOPSIS
-.if n .nh
-.if n .na
-.B date
-[
-.B \-u
-] [
-.B \-c
-] [
-.B \-n
-] [
-.B \-d
-dsttype
-] [
-.B \-t
-minutes-west
-] [
-\fB\-a \fR[\fB+\fR|\fB-]\fIsss\fB.\fIfff\fR
-] [
-.BI + format
-] [
-\fR[\fIyyyy\fR]\fImmddhhmm\fR[\fIyy\fR][\fB.\fIss\fR]
-]
-.SH DESCRIPTION
-.I Date
-without arguments writes the date and time to the standard output in
-the form
-.ce 1
-Wed Mar  8 14:54:40 EST 1989
-.br
-with
-.B EST
-replaced by the local time zone's abbreviation
-(or by the abbreviation for the time zone specified in the
-.B TZ
-environment variable if set).
-The exact output format depends on the locale.
-.PP
-If a command-line argument starts with a plus sign
-.RB (` + '),
-the rest of the argument is used as a
-.I format
-that controls what appears in the output.
-In the format, when a percent sign
-.RB (` % ')
-appears,
-it and the character after it are not output,
-but rather identify part of the date or time
-to be output in a particular way
-(or identify a special character to output):
-.nf
-.sp
-.if t .in +.5i
-.if n .in +2
-.ta \w'%M\0\0'u +\w'Wed Mar  8 14:54:40 EST 1989\0\0'u
-       Sample output   Explanation
-%a     Wed     Abbreviated weekday name*
-%A     Wednesday       Full weekday name*
-%b     Mar     Abbreviated month name*
-%B     March   Full month name*
-%c     Wed Mar 08 14:54:40 1989        Date and time*
-%C     19      Century
-%d     08      Day of month (always two digits)
-%D     03/08/89        Month/day/year (eight characters)
-%e      8      Day of month (leading zero blanked)
-%h     Mar     Abbreviated month name*
-%H     14      24-hour-clock hour (two digits)
-%I     02      12-hour-clock hour (two digits)
-%j     067     Julian day number (three digits)
-%k      2      12-hour-clock hour (leading zero blanked)
-%l     14      24-hour-clock hour (leading zero blanked)
-%m     03      Month number (two digits)
-%M     54      Minute (two digits)
-%n     \\n     newline character
-%p     PM      AM/PM designation
-%r     02:54:40 PM     Hour:minute:second AM/PM designation
-%R     14:54   Hour:minute
-%S     40      Second (two digits)
-%t     \\t     tab character
-%T     14:54:40        Hour:minute:second
-%U     10      Sunday-based week number (two digits)
-%w     3       Day number (one digit, Sunday is 0)
-%W     10      Monday-based week number (two digits)
-%x     03/08/89        Date*
-%X     14:54:40        Time*
-%y     89      Last two digits of year
-%Y     1989    Year in full
-%Z     EST     Time zone abbreviation
-%+     Wed Mar  8 14:54:40 EST 1989    Default output format*
-.if t .in -.5i
-.if n .in -2
-* The exact output depends on the locale.
-.sp
-.fi
-If a character other than one of those shown above appears after
-a percent sign in the format,
-that following character is output.
-All other characters in the format are copied unchanged to the output;
-a newline character is always added at the end of the output.
-.PP
-In Sunday-based week numbering,
-the first Sunday of the year begins week 1;
-days preceding it are part of ``week 0.''
-In Monday-based week numbering,
-the first Monday of the year begins week 1.
-.PP
-To set the date, use a command line argument with one of the following forms:
-.nf
-.if t .in +.5i
-.if n .in +2
-.ta \w'198903081454\0'u
-1454   24-hour-clock hours (first two digits) and minutes
-081454 Month day (first two digits), hours, and minutes
-03081454       Month (two digits, January is 01), month day, hours, minutes
-8903081454     Year, month, month day, hours, minutes
-0308145489     Month, month day, hours, minutes, year
-       (on System V-compatible systems)
-030814541989   Month, month day, hours, minutes, four-digit year
-198903081454   Four-digit year, month, month day, hours, minutes
-.if t .in -.5i
-.if n .in -2
-.fi
-If the century, year, month, or month day is not given,
-the current value is used.
-Any of the above forms may be followed by a period and two digits that give
-the seconds part of the new time; if no seconds are given, zero is assumed.
-.PP
-These options are available:
-.TP
-.BR \-u " or " \-c
-Use UTC when setting and showing the date and time.
-.TP
-.B \-n
-Do not notify other networked systems of the time change.
-.TP
-.BI "\-d " dsttype
-Set the kernel-stored Daylight Saving Time type to the given value.
-(The kernel-stored DST type is used mostly by ``old'' binaries.)
-.TP
-.BI "\-t " minutes-west
-Set the kernel-stored ``minutes west of UTC'' value to the one given on the
-command line.
-(The kernel-stored DST type is used mostly by ``old'' binaries.)
-.TP
-.BI "\-a " adjustment
-Change the time forward (or backward) by the number of seconds
-(and fractions thereof) specified in the
-.I adjustment\^
-argument.
-Either the seconds part or the fractions part of the argument (but not both)
-may be omitted.
-On BSD-based systems,
-the adjustment is made by changing the rate at which time advances;
-on System-V-based systems, the adjustment is made by changing the time.
-.SH FILES
-.ta \w'/usr/share/zoneinfo/posixrules\0\0'u
-/usr/lib/locale/\f2L\fP/LC_TIME        description of time locale \f2L\fP
-.br
-/usr/share/zoneinfo    time zone information directory
-.br
-/usr/share/zoneinfo/localtime  local time zone file
-.br
-/usr/share/zoneinfo/posixrules used with POSIX-style TZ's
-.br
-/usr/share/zoneinfo/GMT        for UTC leap seconds
-.sp
-If
-.B /usr/share/zoneinfo/GMT
-is absent,
-UTC leap seconds are loaded from
-.BR /usr/share/zoneinfo/posixrules .
-.\" @(#)date.1 7.4
diff --git a/lib/libc/stdtime/date.c b/lib/libc/stdtime/date.c
deleted file mode 100644 (file)
index 6dcd536..0000000
+++ /dev/null
@@ -1,978 +0,0 @@
-#ifndef lint
-#ifndef NOID
-/*
-** Modified from the UCB version with the SCCS ID appearing below.
-*/
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*
- * Copyright (c) 1985, 1987, 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANT[A]BILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#include <fcntl.h>     /* for O_WRONLY, O_APPEND */
-
-#ifndef lint
-char copyright[] =
-"@(#) Copyright (c) 1985, 1987, 1988 The Regents of the University of California.\n\
- All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)date.c     4.23 (Berkeley) 9/20/88";
-#endif /* not lint */
-
-#include "private.h"
-#if HAVE_ADJTIME || HAVE_SETTIMEOFDAY
-#include "sys/time.h"  /* for struct timeval, struct timezone */
-#endif /* HAVE_ADJTIME || HAVE_SETTIMEOFDAY */
-#include "locale.h"
-#include "utmp.h"      /* for OLD_TIME (or its absence) */
-#if HAVE_UTMPX_H
-#include "utmpx.h"
-#endif
-
-#ifndef OTIME_MSG
-#define OTIME_MSG "old time"
-#endif
-#ifndef NTIME_MSG
-#define NTIME_MSG "new time"
-#endif
-
-/*
-** The two things date knows about time are. . .
-*/
-
-#ifndef TM_YEAR_BASE
-#define TM_YEAR_BASE   1900
-#endif /* !defined TM_YEAR_BASE */
-
-#ifndef SECSPERMIN
-#define SECSPERMIN     60
-#endif /* !defined SECSPERMIN */
-
-extern char **         environ;
-#if 0
-extern double          atof();
-extern char *          getlogin();
-extern time_t          mktime();
-extern char *          optarg;
-extern int             optind;
-extern char *          strchr();
-extern time_t          time();
-extern char *          tzname[2];
-#endif
-
-static int             retval = EXIT_SUCCESS;
-
-static void            checkfinal P((const char *, int, time_t, time_t));
-static int             comptm P((const struct tm *, const struct tm *));
-static time_t          convert P((const char *, int, time_t));
-static void            display P((const char *));
-static void            dogmt P((void));
-static void            errensure P((void));
-static void            iffy P((time_t, time_t, const char *, const char *));
-int                    main P((int, char**));
-static const char *    nondigit P((const char *));
-static void            oops P((const char *));
-static void            reset P((time_t, int));
-static void            timeout P((FILE *, const char *, const struct tm *));
-static void            usage P((void));
-static void            wildinput P((const char *, const char *,
-                               const char *));
-
-int
-main(argc, argv)
-const int      argc;
-char *         argv[];
-{
-       register const char *   format;
-       register const char *   value;
-       register const char *   cp;
-       register int            ch;
-       register int            dousg;
-       register int            aflag = 0;
-       register int            dflag = 0;
-       register int            nflag = 0;
-       register int            tflag = 0;
-       register int            minuteswest;
-       register int            dsttime;
-       register double         adjust;
-       time_t                  now;
-       time_t                  t;
-
-       INITIALIZE(dousg);
-       INITIALIZE(minuteswest);
-       INITIALIZE(dsttime);
-       INITIALIZE(adjust);
-       INITIALIZE(t);
-#ifdef LC_ALL
-       (void) setlocale(LC_ALL, "");
-#endif /* defined(LC_ALL) */
-#if HAVE_GETTEXT
-#ifdef TZ_DOMAINDIR
-       (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
-#endif /* defined(TEXTDOMAINDIR) */
-       (void) textdomain(TZ_DOMAIN);
-#endif /* HAVE_GETTEXT */
-       (void) time(&now);
-       format = value = NULL;
-       while ((ch = getopt(argc, argv, "ucnd:t:a:")) != EOF && ch != -1) {
-               switch (ch) {
-               default:
-                       usage();
-               case 'u':               /* do it in UTC */
-               case 'c':
-                       dogmt();
-                       break;
-               case 'n':               /* don't set network */
-                       nflag = 1;
-                       break;
-               case 'd':               /* daylight saving time */
-                       if (dflag) {
-                               (void) fprintf(stderr,
-                                       _("date: error: multiple -d's used"));
-                               usage();
-                       }
-                       dflag = 1;
-                       cp = optarg;
-                       dsttime = atoi(cp);
-                       if (*cp == '\0' || *nondigit(cp) != '\0')
-                               wildinput(_("-t value"), optarg,
-                                       _("must be a non-negative number"));
-                       break;
-               case 't':               /* minutes west of UTC */
-                       if (tflag) {
-                               (void) fprintf(stderr,
-                                       _("date: error: multiple -t's used"));
-                               usage();
-                       }
-                       tflag = 1;
-                       cp = optarg;
-                       minuteswest = atoi(cp);
-                       if (*cp == '+' || *cp == '-')
-                               ++cp;
-                       if (*cp == '\0' || *nondigit(cp) != '\0')
-                               wildinput(_("-d value"), optarg,
-                                       _("must be a number"));
-                       break;
-               case 'a':               /* adjustment */
-                       if (aflag) {
-                               (void) fprintf(stderr,
-                                       _("date: error: multiple -a's used"));
-                               usage();
-                       }
-                       aflag = 1;
-                       cp = optarg;
-                       adjust = atof(cp);
-                       if (*cp == '+' || *cp == '-')
-                               ++cp;
-                       if (*cp == '\0' || strcmp(cp, ".") == 0)
-                               wildinput(_("-a value"), optarg,
-                                       _("must be a number"));
-                       cp = nondigit(cp);
-                       if (*cp == '.')
-                               ++cp;
-                       if (*nondigit(cp) != '\0')
-                               wildinput(_("-a value"), optarg,
-                                       _("must be a number"));
-                       break;
-               }
-       }
-       while (optind < argc) {
-               cp = argv[optind++];
-               if (*cp == '+')
-                       if (format == NULL)
-                               format = cp + 1;
-                       else {
-                               (void) fprintf(stderr,
-_("date: error: multiple formats in command line\n"));
-                               usage();
-                       }
-               else    if (value == NULL)
-                               value = cp;
-                       else {
-                               (void) fprintf(stderr,
-_("date: error: multiple values in command line\n"));
-                               usage();
-                       }
-       }
-       if (value != NULL) {
-               /*
-               ** This order ensures that "reasonable" twelve-digit inputs
-               ** (such as 120203042006) won't be misinterpreted
-               ** even if time_t's range all the way back to the thirteenth
-               ** century.  Do not change the order.
-               */
-               t = convert(value, (dousg = TRUE), now);
-               if (t == -1)
-                       t = convert(value, (dousg = FALSE), now);
-               if (t == -1) {
-                       /*
-                       ** Out of range values,
-                       ** or time that falls in a DST transition hole?
-                       */
-                       if ((cp = strchr(value, '.')) != NULL) {
-                               /*
-                               ** Ensure that the failure of
-                               **      TZ=America/New_York date 8712312359.60
-                               ** doesn't get misdiagnosed.  (It was
-                               **      TZ=America/New_York date 8712311859.60
-                               ** when the leap second was inserted.)
-                               ** The normal check won't work since
-                               ** the given time is valid in UTC.
-                               */
-                               if (atoi(cp + 1) >= SECSPERMIN)
-                                       wildinput(_("time"), value,
-                                           _("out of range seconds given"));
-                       }
-                       dogmt();
-                       t = convert(value, FALSE, now);
-                       if (t == -1)
-                               t = convert(value, TRUE, now);
-                       wildinput(_("time"), value,
-                               (t == -1) ?
-                               _("out of range value given") :
-                               _("time skipped when clock springs forward"));
-               }
-       }
-       /*
-       ** Entire command line has now been checked.
-       */
-       if (aflag) {
-#if HAVE_ADJTIME
-               struct timeval  tv;
-
-               tv.tv_sec = (int) adjust;
-               tv.tv_usec = (int) ((adjust - tv.tv_sec) * 1000000L);
-               if (adjtime(&tv, (struct timeval *) NULL) != 0)
-                       oops("adjtime");
-#endif /* HAVE_ADJTIME */
-#if !HAVE_ADJTIME
-               reset((time_t) (now + adjust), nflag);
-#endif /* !HAVE_ADJTIME */
-               /*
-               ** Sun silently ignores everything else; we follow suit.
-               */
-               exit(retval);
-       }
-       if (dflag || tflag) {
-#if HAVE_SETTIMEOFDAY == 2
-               struct timezone tz;
-
-               if (!dflag || !tflag)
-                       if (gettimeofday((struct timeval *) NULL, &tz) != 0)
-                               oops("gettimeofday");
-               if (dflag)
-                       tz.tz_dsttime = dsttime;
-               if (tflag)
-                       tz.tz_minuteswest = minuteswest;
-               if (settimeofday((struct timeval *) NULL, &tz) != 0)
-                       oops("settimeofday");
-#endif /* HAVE_SETTIMEOFDAY == 2 */
-#if HAVE_SETTIMEOFDAY != 2
-               (void) fprintf(stderr,
-_("date: warning: kernel doesn't keep -d/-t information, option ignored\n"));
-#endif /* HAVE_SETTIMEOFDAY != 2 */
-       }
-
-       if (value == NULL)
-               display(format);
-
-       reset(t, nflag);
-
-       checkfinal(value, dousg, t, now);
-
-#ifdef EBUG
-       {
-               struct tm       tm;
-
-               tm = *localtime(&t);
-               timeout(stdout, "%c\n", &tm);
-               exit(retval);
-       }
-#endif /* defined EBUG */
-
-       display(format);
-
-       /* gcc -Wall pacifier */
-       for ( ; ; )
-               continue;
-}
-
-static void
-dogmt()
-{
-       static char **  fakeenv;
-
-       if (fakeenv == NULL) {
-               register int    from;
-               register int    to;
-               register int    n;
-               static char     tzegmt0[] = "TZ=GMT0";
-
-               for (n = 0;  environ[n] != NULL;  ++n)
-                       continue;
-               fakeenv = (char **) malloc((size_t) (n + 2) * sizeof *fakeenv);
-               if (fakeenv == NULL) {
-                       (void) perror(_("Memory exhausted"));
-                       errensure();
-                       exit(retval);
-               }
-               to = 0;
-               fakeenv[to++] = tzegmt0;
-               for (from = 1; environ[from] != NULL; ++from)
-                       if (strncmp(environ[from], "TZ=", 3) != 0)
-                               fakeenv[to++] = environ[from];
-               fakeenv[to] = NULL;
-               environ = fakeenv;
-       }
-}
-
-#ifdef OLD_TIME
-
-/*
-** We assume we're on a System-V-based system,
-** should use stime,
-** should write System-V-format utmp entries,
-** and don't have network notification to worry about.
-*/
-
-/*ARGSUSED*/
-static void
-#if __STDC__
-reset(const time_t newt, const int nflag)
-#else /* !__STDC__ */
-reset(newt, nflag)
-const time_t   newt;
-const int      nflag;
-#endif /* !__STDC__ */
-{
-       register int            fid;
-       time_t                  oldt;
-       static struct {
-               struct utmp     before;
-               struct utmp     after;
-       } s;
-#if HAVE_UTMPX_H
-       static struct {
-               struct utmpx    before;
-               struct utmpx    after;
-       } sx;
-#endif
-
-       /*
-       ** Wouldn't it be great if stime returned the old time?
-       */
-       (void) time(&oldt);
-       if (stime(&newt) != 0)
-               oops("stime");
-       s.before.ut_type = OLD_TIME;
-       s.before.ut_time = oldt;
-       (void) strcpy(s.before.ut_line, OTIME_MSG);
-       s.after.ut_type = NEW_TIME;
-       s.after.ut_time = newt;
-       (void) strcpy(s.after.ut_line, NTIME_MSG);
-       fid = open(WTMP_FILE, O_WRONLY | O_APPEND);
-       if (fid < 0)
-               oops(_("log file open"));
-       if (write(fid, (char *) &s, sizeof s) != sizeof s)
-               oops(_("log file write"));
-       if (close(fid) != 0)
-               oops(_("log file close"));
-#if !HAVE_UTMPX_H
-       pututline(&s.before);
-       pututline(&s.after);
-#endif /* !HAVE_UTMPX_H */
-#if HAVE_UTMPX_H
-       sx.before.ut_type = OLD_TIME;
-       sx.before.ut_tv.tv_sec = oldt;
-       (void) strcpy(sx.before.ut_line, OTIME_MSG);
-       sx.after.ut_type = NEW_TIME;
-       sx.after.ut_tv.tv_sec = newt;
-       (void) strcpy(sx.after.ut_line, NTIME_MSG);
-#if !SUPPRESS_WTMPX_FILE_UPDATE
-       /* In Solaris 2.5 (and presumably other systems),
-          `date' does not update /var/adm/wtmpx.
-          This must be a bug.  If you'd like to reproduce the bug,
-          define SUPPRESS_WTMPX_FILE_UPDATE to be nonzero.  */
-       fid = open(WTMPX_FILE, O_WRONLY | O_APPEND);
-       if (fid < 0)
-               oops(_("log file open"));
-       if (write(fid, (char *) &sx, sizeof sx) != sizeof sx)
-               oops(_("log file write"));
-       if (close(fid) != 0)
-               oops(_("log file close"));
-#endif /* !SUPPRESS_WTMPX_FILE_UPDATE */
-       pututxline(&sx.before);
-       pututxline(&sx.after);
-#endif /* HAVE_UTMPX_H */
-}
-
-#endif /* defined OLD_TIME */
-#ifndef OLD_TIME
-
-/*
-** We assume we're on a BSD-based system,
-** should use settimeofday,
-** should write BSD-format utmp entries (using logwtmp),
-** and may get to worry about network notification.
-** The "time name" changes between 4.3-tahoe and 4.4;
-** we include sys/param.h to determine which we should use.
-*/
-
-#ifndef TIME_NAME
-#include "sys/param.h"
-#ifdef BSD4_4
-#define TIME_NAME      "date"
-#endif /* defined BSD4_4 */
-#ifndef BSD4_4
-#define TIME_NAME      ""
-#endif /* !defined BSD4_4 */
-#endif /* !defined TIME_NAME */
-
-#include "syslog.h"
-#include "sys/socket.h"
-#include "netinet/in.h"
-#include "netdb.h"
-#define TSPTYPES
-
-#if 0
-extern int             logwtmp();
-#endif
-
-#if HAVE_SETTIMEOFDAY == 1
-#define settimeofday(t, tz) (settimeofday)(t)
-#endif /* HAVE_SETTIMEOFDAY == 1 */
-
-#ifndef TSP_SETDATE
-/*ARGSUSED*/
-#endif /* !defined TSP_SETDATE */
-static void
-reset(newt, nflag)
-const time_t   newt;
-const int      nflag;
-{
-       register const char *   username;
-       static struct timeval   tv;     /* static so tv_usec is 0 */
-
-#ifdef EBUG
-       return;
-#endif /* defined EBUG */
-       username = getlogin();
-       if (username == NULL || *username == '\0') /* single-user or no tty */
-               username = "root";
-       tv.tv_sec = newt;
-#ifdef TSP_SETDATE
-       if (nflag || !netsettime(tv))
-#endif /* defined TSP_SETDATE */
-       {
-               /*
-               ** "old" entry is always written, for compatibility.
-               */
-               logwtmp("|", TIME_NAME, "");
-               if (settimeofday(&tv, (struct timezone *) NULL) == 0) {
-                       logwtmp("{", TIME_NAME, "");    /* } */
-                       syslog(LOG_AUTH | LOG_NOTICE, _("date set by %s"),
-                               username);
-               } else  oops("settimeofday");
-       }
-}
-
-#endif /* !defined OLD_TIME */
-
-static void
-wildinput(item, value, reason)
-const char * const     item;
-const char * const     value;
-const char * const     reason;
-{
-       (void) fprintf(stderr,
-               _("date: error: bad command line %s \"%s\", %s\n"),
-               item, value, reason);
-       usage();
-}
-
-static void
-errensure P((void))
-{
-       if (retval == EXIT_SUCCESS)
-               retval = EXIT_FAILURE;
-}
-
-static const char *
-nondigit(cp)
-register const char *  cp;
-{
-       while (is_digit(*cp))
-               ++cp;
-       return cp;
-}
-
-static void
-usage P((void))
-{
-       (void) fprintf(stderr, _("date: usage is date [-u] [-c] [-n] [-d dst] \
-[-t min-west] [-a sss.fff] [[yyyy]mmddhhmm[yyyy][.ss]] [+format]\n"));
-       errensure();
-       exit(retval);
-}
-
-static void
-oops(string)
-const char * const     string;
-{
-       int             e = errno;
-
-       (void) fprintf(stderr, _("date: error: "));
-       errno = e;
-       (void) perror(string);
-       errensure();
-       display((char *) NULL);
-}
-
-static void
-display(format)
-const char * const     format;
-{
-       struct tm       tm;
-       time_t          now;
-
-       (void) time(&now);
-       tm = *localtime(&now);
-       timeout(stdout, format ? format : "%+", &tm);
-       (void) putchar('\n');
-       (void) fflush(stdout);
-       (void) fflush(stderr);
-       if (ferror(stdout) || ferror(stderr)) {
-               (void) fprintf(stderr,
-                       _("date: error: couldn't write results\n"));
-               errensure();
-       }
-       exit(retval);
-}
-
-#if 0
-extern size_t  strftime();
-#endif
-
-#define INCR   1024
-
-static void
-timeout(fp, format, tmp)
-FILE * const           fp;
-const char * const     format;
-const struct tm * const        tmp;
-{
-       char *  cp;
-       size_t  result;
-       size_t  size;
-
-       if (*format == '\0')
-               return;
-       size = INCR;
-       cp = malloc((size_t) size);
-       for ( ; ; ) {
-               if (cp == NULL) {
-                       (void) fprintf(stderr,
-                               _("date: error: can't get memory\n"));
-                       errensure();
-                       exit(retval);
-               }
-               cp[0] = '\1';
-               result = strftime(cp, size, format, tmp);
-               if (result != 0 || cp[0] == '\0')
-                       break;
-               size += INCR;
-               cp = realloc(cp, (size_t) size);
-       }
-       (void) fwrite(cp, 1, result, fp);
-       free(cp);
-}
-
-static int
-comptm(atmp, btmp)
-register const struct tm * const atmp;
-register const struct tm * const btmp;
-{
-       register int    result;
-
-       if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
-               (result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
-               (result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
-               (result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
-               (result = (atmp->tm_min - btmp->tm_min)) == 0)
-                       result = atmp->tm_sec - btmp->tm_sec;
-       return result;
-}
-
-/*
-** convert --
-**     convert user's input into a time_t.
-*/
-
-#define ATOI2(ar)      (ar[0] - '0') * 10 + (ar[1] - '0'); ar += 2;
-
-static time_t
-#if __STDC__
-convert(register const char * const value, const int dousg, const time_t t)
-#else /* !__STDC__ */
-convert(value, dousg, t)
-register const char * const    value;
-const int                      dousg;
-const time_t                   t;
-#endif /* !__STDC__ */
-{
-       register const char *   cp;
-       register const char *   dotp;
-       register int    cent, year_in_cent, month, hour, day, mins, secs;
-       struct tm       tm, outtm;
-       time_t          outt;
-
-       tm = *localtime(&t);
-#define DIVISOR        100
-       year_in_cent = tm.tm_year % DIVISOR + TM_YEAR_BASE % DIVISOR;
-       cent = tm.tm_year / DIVISOR + TM_YEAR_BASE / DIVISOR +
-               year_in_cent / DIVISOR;
-       year_in_cent %= DIVISOR;
-       if (year_in_cent < 0) {
-               year_in_cent += DIVISOR;
-               --cent;
-       }
-       month = tm.tm_mon + 1;
-       day = tm.tm_mday;
-       hour = tm.tm_hour;
-       mins = tm.tm_min;
-       secs = 0;
-
-       dotp = strchr(value, '.');
-       for (cp = value; *cp != '\0'; ++cp)
-               if (!is_digit(*cp) && cp != dotp)
-                       wildinput(_("time"), value, _("contains a nondigit"));
-
-       if (dotp == NULL)
-               dotp = strchr(value, '\0');
-       else {
-               cp = dotp + 1;
-               if (strlen(cp) != 2)
-                       wildinput(_("time"), value,
-                               _("seconds part is not two digits"));
-               secs = ATOI2(cp);
-       }
-
-       cp = value;
-       switch (dotp - cp) {
-               default:
-                       wildinput(_("time"), value,
-                               _("main part is wrong length"));
-               case 12:
-                       if (!dousg) {
-                               cent = ATOI2(cp);
-                               year_in_cent = ATOI2(cp);
-                       }
-                       month = ATOI2(cp);
-                       day = ATOI2(cp);
-                       hour = ATOI2(cp);
-                       mins = ATOI2(cp);
-                       if (dousg) {
-                               cent = ATOI2(cp);
-                               year_in_cent = ATOI2(cp);
-                       }
-                       break;
-               case 8: /* mmddhhmm */
-                       month = ATOI2(cp);
-                       /* fall through to. . . */
-               case 6: /* ddhhmm */
-                       day = ATOI2(cp);
-                       /* fall through to. . . */
-               case 4: /* hhmm */
-                       hour = ATOI2(cp);
-                       mins = ATOI2(cp);
-                       break;
-               case 10:
-                       if (!dousg) {
-                               year_in_cent = ATOI2(cp);
-                       }
-                       month = ATOI2(cp);
-                       day = ATOI2(cp);
-                       hour = ATOI2(cp);
-                       mins = ATOI2(cp);
-                       if (dousg) {
-                               year_in_cent = ATOI2(cp);
-                       }
-                       break;
-       }
-
-       tm.tm_year = cent * 100 + year_in_cent - TM_YEAR_BASE;
-       tm.tm_mon = month - 1;
-       tm.tm_mday = day;
-       tm.tm_hour = hour;
-       tm.tm_min = mins;
-       tm.tm_sec = secs;
-       tm.tm_isdst = -1;
-       outtm = tm;
-       outt = mktime(&outtm);
-       return (comptm(&tm, &outtm) == 0) ? outt : -1;
-}
-
-/*
-** Code from here on out is either based on code provided by UCB
-** or is only called just before the program exits.
-*/
-
-/*
-** Check for iffy input.
-*/
-
-static void
-#if __STDC__
-checkfinal(const char * const  value,
-          const int            didusg,
-          const time_t         t,
-          const time_t         oldnow)
-#else /* !__STDC__ */
-checkfinal(value, didusg, t, oldnow)
-const char * const     value;
-const int              didusg;
-const time_t           t;
-const time_t           oldnow;
-#endif /* !__STDC__ */
-{
-       time_t          othert;
-       struct tm       tm;
-       struct tm       othertm;
-       register int    pass;
-       register long   offset;
-
-       /*
-       ** See if there's both a USG and a BSD interpretation.
-       */
-       othert = convert(value, !didusg, oldnow);
-       if (othert != -1 && othert != t)
-               iffy(t, othert, value, _("year could be at start or end"));
-       /*
-       ** See if there's both a DST and a STD version.
-       */
-       tm = *localtime(&t);
-       othertm = tm;
-       othertm.tm_isdst = !tm.tm_isdst;
-       othert = mktime(&othertm);
-       if (othert != -1 && othertm.tm_isdst != tm.tm_isdst &&
-               comptm(&tm, &othertm) == 0)
-                       iffy(t, othert, value,
-                           _("both standard and summer time versions exist"));
-/*
-** Final check.
-**
-** If a jurisdiction shifts time *without* shifting whether time is
-** summer or standard (as Hawaii, the United Kingdom, and Saudi Arabia
-** have done), routine checks for iffy times may not work.
-** So we perform this final check, deferring it until after the time has
-** been set--it may take a while, and we don't want to introduce an unnecessary
-** lag between the time the user enters their command and the time that
-** stime/settimeofday is called.
-**
-** We just check nearby times to see if any have the same representation
-** as the time that convert returned.  We work our way out from the center
-** for quick response in solar time situations.  We only handle common cases--
-** offsets of at most a minute, and offsets of exact numbers of minutes
-** and at most an hour.
-*/
-       for (offset = 1; offset <= 60; ++offset)
-               for (pass = 1; pass <= 4; ++pass) {
-                       if (pass == 1)
-                               othert = t + offset;
-                       else if (pass == 2)
-                               othert = t - offset;
-                       else if (pass == 3)
-                               othert = t + 60 * offset;
-                       else    othert = t - 60 * offset;
-                       othertm = *localtime(&othert);
-                       if (comptm(&tm, &othertm) == 0)
-                               iffy(t, othert, value,
-                                       _("multiple matching times exist"));
-               }
-}
-
-static void
-#if __STDC__
-iffy(const time_t thist, const time_t thatt,
-       const char * const value, const char * const reason)
-#else /* !__STDC__ */
-iffy(thist, thatt, value, reason)
-const time_t           thist;
-const time_t           thatt;
-const char * const     value;
-const char * const     reason;
-#endif /* !__STDC__ */
-{
-       struct tm       tm;
-
-       (void) fprintf(stderr, _("date: warning: ambiguous time \"%s\", %s.\n"),
-               value, reason);
-       tm = *gmtime(&thist);
-       /*
-       ** Avoid running afoul of SCCS!
-       */
-       timeout(stderr, _("Time was set as if you used\n\tdate -u %m%d%H\
-%M\
-%Y.%S\n"), &tm);
-       tm = *localtime(&thist);
-       timeout(stderr, _("to get %c"), &tm);
-       (void) fprintf(stderr, _(" (%s).  Use\n"),
-               tm.tm_isdst ? _("summer time") : _("standard time"));
-       tm = *gmtime(&thatt);
-       timeout(stderr, _("\tdate -u %m%d%H\
-%M\
-%Y.%S\n"), &tm);
-       tm = *localtime(&thatt);
-       timeout(stderr, _("to get %c"), &tm);
-       (void) fprintf(stderr, _(" (%s).\n"),
-               tm.tm_isdst ? _("summer time") : _("standard time"));
-       errensure();
-       exit(retval);
-}
-
-#ifdef TSP_SETDATE
-#define WAITACK                2       /* seconds */
-#define WAITDATEACK    5       /* seconds */
-
-/*
- * Set the date in the machines controlled by timedaemons
- * by communicating the new date to the local timedaemon.
- * If the timedaemon is in the master state, it performs the
- * correction on all slaves.  If it is in the slave state, it
- * notifies the master that a correction is needed.
- * Returns 1 on success, 0 on failure.
- */
-netsettime(ntv)
-       struct timeval ntv;
-{
-       int s, length, port, timed_ack, found, err;
-       long waittime;
-       fd_set ready;
-       char hostname[MAXHOSTNAMELEN];
-       struct timeval tout;
-       struct servent *sp;
-       struct tsp msg;
-       struct sockaddr_in sin, dest, from;
-
-       sp = getservbyname("timed", "udp");
-       if (sp == 0) {
-               fputs(_("udp/timed: unknown service\n"), stderr);
-               retval = 2;
-               return (0);
-       }
-       dest.sin_port = sp->s_port;
-       dest.sin_family = AF_INET;
-       dest.sin_addr.s_addr = htonl((u_long)INADDR_ANY);
-       s = socket(AF_INET, SOCK_DGRAM, 0);
-       if (s < 0) {
-               if (errno != EPROTONOSUPPORT)
-                       perror("date: socket");
-               goto bad;
-       }
-       bzero((char *)&sin, sizeof (sin));
-       sin.sin_family = AF_INET;
-       for (port = IPPORT_RESERVED - 1; port > IPPORT_RESERVED / 2; port--) {
-               sin.sin_port = htons((u_short)port);
-               if (bind(s, (struct sockaddr *)&sin, sizeof (sin)) >= 0)
-                       break;
-               if (errno != EADDRINUSE) {
-                       if (errno != EADDRNOTAVAIL)
-                               perror("date: bind");
-                       goto bad;
-               }
-       }
-       if (port == IPPORT_RESERVED / 2) {
-               fputs(_("date: All ports in use\n"), stderr);
-               goto bad;
-       }
-       msg.tsp_type = TSP_SETDATE;
-       msg.tsp_vers = TSPVERSION;
-       if (gethostname(hostname, sizeof (hostname))) {
-               perror("gethostname");
-               goto bad;
-       }
-       (void) strncpy(msg.tsp_name, hostname, sizeof (hostname));
-       msg.tsp_seq = htons((u_short)0);
-       msg.tsp_time.tv_sec = htonl((u_long)ntv.tv_sec);
-       msg.tsp_time.tv_usec = htonl((u_long)ntv.tv_usec);
-       length = sizeof (struct sockaddr_in);
-       if (connect(s, &dest, length) < 0) {
-               perror("date: connect");
-               goto bad;
-       }
-       if (send(s, (char *)&msg, sizeof (struct tsp), 0) < 0) {
-               if (errno != ECONNREFUSED)
-                       perror("date: send");
-               goto bad;
-       }
-       timed_ack = -1;
-       waittime = WAITACK;
-loop:
-       tout.tv_sec = waittime;
-       tout.tv_usec = 0;
-       FD_ZERO(&ready);
-       FD_SET(s, &ready);
-       found = select(FD_SETSIZE, &ready, (fd_set *)0, (fd_set *)0, &tout);
-       length = sizeof err;
-       if (getsockopt(s, SOL_SOCKET, SO_ERROR, (char *)&err, &length) == 0
-           && err) {
-               errno = err;
-               if (errno != ECONNREFUSED)
-                       perror(_("date: send (delayed error)"));
-               goto bad;
-       }
-       if (found > 0 && FD_ISSET(s, &ready)) {
-               length = sizeof (struct sockaddr_in);
-               if (recvfrom(s, (char *)&msg, sizeof (struct tsp), 0, &from,
-                   &length) < 0) {
-                       if (errno != ECONNREFUSED)
-                               perror("date: recvfrom");
-                       goto bad;
-               }
-               msg.tsp_seq = ntohs(msg.tsp_seq);
-               msg.tsp_time.tv_sec = ntohl(msg.tsp_time.tv_sec);
-               msg.tsp_time.tv_usec = ntohl(msg.tsp_time.tv_usec);
-               switch (msg.tsp_type) {
-
-               case TSP_ACK:
-                       timed_ack = TSP_ACK;
-                       waittime = WAITDATEACK;
-                       goto loop;
-
-               case TSP_DATEACK:
-                       (void)close(s);
-                       return (1);
-
-               default:
-                       fprintf(stderr,
-                               _("date: Wrong ack received from timed: %s\n"),
-                               tsptype[msg.tsp_type]);
-                       timed_ack = -1;
-                       break;
-               }
-       }
-       if (timed_ack == -1)
-               fputs(_("date: Can't reach time daemon, time set locally.\n"),
-                       stderr);
-bad:
-       (void)close(s);
-       retval = 2;
-       return (0);
-}
-#endif /* defined TSP_SETDATE */
diff --git a/lib/libc/stdtime/difftime.c b/lib/libc/stdtime/difftime.c
deleted file mode 100644 (file)
index f629527..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson.
-*/
-
-#ifndef lint
-#ifndef NOID
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*LINTLIBRARY*/
-
-#include "private.h"   /* for time_t, TYPE_INTEGRAL, and TYPE_SIGNED */
-
-double
-difftime(time1, time0)
-const time_t   time1;
-const time_t   time0;
-{
-       /*
-       ** If (sizeof (double) > sizeof (time_t)) simply convert and subtract
-       ** (assuming that the larger type has more precision).
-       ** This is the common real-world case circa 2004.
-       */
-       if (sizeof (double) > sizeof (time_t))
-               return (double) time1 - (double) time0;
-       if (!TYPE_INTEGRAL(time_t)) {
-               /*
-               ** time_t is floating.
-               */
-               return time1 - time0;
-       }
-       if (!TYPE_SIGNED(time_t)) {
-               /*
-               ** time_t is integral and unsigned.
-               ** The difference of two unsigned values can't overflow
-               ** if the minuend is greater than or equal to the subtrahend.
-               */
-               if (time1 >= time0)
-                       return time1 - time0;
-               else    return -((double) (time0 - time1));
-       }
-       /*
-       ** time_t is integral and signed.
-       ** Handle cases where both time1 and time0 have the same sign
-       ** (meaning that their difference cannot overflow).
-       */
-       if ((time1 < 0) == (time0 < 0))
-               return time1 - time0;
-       /*
-       ** time1 and time0 have opposite signs.
-       ** Punt if unsigned long is too narrow.
-       */
-       if (sizeof (unsigned long) < sizeof (time_t))
-               return (double) time1 - (double) time0;
-       /*
-       ** Stay calm...decent optimizers will eliminate the complexity below.
-       */
-       if (time1 >= 0 /* && time0 < 0 */)
-               return (unsigned long) time1 +
-                       (unsigned long) (-(time0 + 1)) + 1;
-       return -(double) ((unsigned long) time0 +
-               (unsigned long) (-(time1 + 1)) + 1);
-}
diff --git a/lib/libc/stdtime/ftime.c b/lib/libc/stdtime/ftime.c
deleted file mode 100644 (file)
index cf4c30e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Ported from glibc */
-
-#include <sys/timeb.h>
-#include <sys/time.h>
-
-int ftime(struct timeb *timebuf)
-{
-       struct timeval tv;
-       struct timezone tz;
-
-       if (gettimeofday (&tv, &tz) < 0)
-               return -1;
-
-       timebuf->time = tv.tv_sec;
-       timebuf->millitm = (tv.tv_usec + 500) / 1000;
-       if (timebuf->millitm == 1000)
-       {
-               ++timebuf->time;
-               timebuf->millitm = 0;
-       }
-       timebuf->timezone = tz.tz_minuteswest;
-       timebuf->dstflag = tz.tz_dsttime;
-       return 0;
-}
diff --git a/lib/libc/stdtime/ialloc.c b/lib/libc/stdtime/ialloc.c
deleted file mode 100644 (file)
index 074fca4..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-#
-
-/*LINTLIBRARY*/
-
-#include <string.h>
-#include <stdlib.h>
-
-#include "stdio.h"
-
-#ifndef lint
-#ifndef NOID
-static char    sccsid[] = "@(#)ialloc.c        7.14";
-#endif /* !NOID */
-#endif /* !lint */
-
-#ifndef alloc_t
-#define alloc_t        unsigned
-#endif /* !alloc_t */
-
-#ifdef MAL
-#define NULLMAL(x)     ((x) == NULL || (x) == MAL)
-#else /* !MAL */
-#define NULLMAL(x)     ((x) == NULL)
-#endif /* !MAL */
-
-#if 0
-extern char *  calloc();
-extern char *  malloc();
-extern char *  realloc();
-extern char *  strcpy();
-#endif
-
-char *
-imalloc(int n)
-{
-#ifdef MAL
-       register char * result;
-
-       if (n == 0)
-               n = 1;
-       result = malloc((alloc_t) n);
-       return (result == MAL) ? NULL : result;
-#else /* !MAL */
-       if (n == 0)
-               n = 1;
-       return malloc((alloc_t) n);
-#endif /* !MAL */
-}
-
-char *
-icalloc(int nelem, int elsize)
-{
-       if (nelem == 0 || elsize == 0)
-               nelem = elsize = 1;
-       return calloc((alloc_t) nelem, (alloc_t) elsize);
-}
-
-char *
-irealloc(char *pointer, int size)
-{
-       if (NULLMAL(pointer))
-               return imalloc(size);
-       if (size == 0)
-               size = 1;
-       return realloc(pointer, (alloc_t) size);
-}
-
-char *
-icatalloc(char *old, char *new)
-{
-       register char * result;
-       register        oldsize, newsize;
-
-       oldsize = NULLMAL(old) ? 0 : strlen(old);
-       newsize = NULLMAL(new) ? 0 : strlen(new);
-       if ((result = irealloc(old, oldsize + newsize + 1)) != NULL)
-               if (!NULLMAL(new))
-                       (void) strcpy(result + oldsize, new);
-       return result;
-}
-
-char *
-icpyalloc(char *string)
-{
-       return icatalloc((char *) NULL, string);
-}
-
-ifree(char *p)
-{
-       if (!NULLMAL(p))
-               free(p);
-}
-
-icfree(char *p)
-{
-       if (!NULLMAL(p))
-               free(p);
-}
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c
deleted file mode 100644 (file)
index 15f417e..0000000
+++ /dev/null
@@ -1,1917 +0,0 @@
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson.
-*/
-
-#ifndef lint
-#ifndef NOID
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*
-** Leap second handling from Bradley White.
-** POSIX-style TZ environment variable handling from Guy Harris.
-*/
-
-/*LINTLIBRARY*/
-
-/* Gives us offtime, timegm and a few other functions */
-#define STD_INSPIRED
-
-#include "private.h"
-#include "tzfile.h"
-#include "fcntl.h"
-#include "float.h"     /* for FLT_MAX and DBL_MAX */
-
-#ifndef TZ_ABBR_MAX_LEN
-#define TZ_ABBR_MAX_LEN        16
-#endif /* !defined TZ_ABBR_MAX_LEN */
-
-#ifndef TZ_ABBR_CHAR_SET
-#define TZ_ABBR_CHAR_SET \
-       "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 :+-._"
-#endif /* !defined TZ_ABBR_CHAR_SET */
-
-#ifndef TZ_ABBR_ERR_CHAR
-#define TZ_ABBR_ERR_CHAR       '_'
-#endif /* !defined TZ_ABBR_ERR_CHAR */
-
-/*
-** SunOS 4.1.1 headers lack O_BINARY.
-*/
-
-#ifdef O_BINARY
-#define OPEN_MODE      (O_RDONLY | O_BINARY)
-#endif /* defined O_BINARY */
-#ifndef O_BINARY
-#define OPEN_MODE      O_RDONLY
-#endif /* !defined O_BINARY */
-
-#ifndef WILDABBR
-/*
-** Someone might make incorrect use of a time zone abbreviation:
-**     1.      They might reference tzname[0] before calling tzset (explicitly
-**             or implicitly).
-**     2.      They might reference tzname[1] before calling tzset (explicitly
-**             or implicitly).
-**     3.      They might reference tzname[1] after setting to a time zone
-**             in which Daylight Saving Time is never observed.
-**     4.      They might reference tzname[0] after setting to a time zone
-**             in which Standard Time is never observed.
-**     5.      They might reference tm.TM_ZONE after calling offtime.
-** What's best to do in the above cases is open to debate;
-** for now, we just set things up so that in any of the five cases
-** WILDABBR is used. Another possibility: initialize tzname[0] to the
-** string "tzname[0] used before set", and similarly for the other cases.
-** And another: initialize tzname[0] to "ERA", with an explanation in the
-** manual page of what this "time zone abbreviation" means (doing this so
-** that tzname[0] has the "normal" length of three characters).
-*/
-#define WILDABBR       "   "
-#endif /* !defined WILDABBR */
-
-static char            wildabbr[] = WILDABBR;
-
-static const char      gmt[] = "GMT";
-
-/*
-** The DST rules to use if TZ has no rules and we can't load TZDEFRULES.
-** We default to US rules as of 1999-08-17.
-** POSIX 1003.1 section 8.1.1 says that the default DST rules are
-** implementation dependent; for historical reasons, US rules are a
-** common default.
-*/
-#ifndef TZDEFRULESTRING
-#define TZDEFRULESTRING ",M4.1.0,M10.5.0"
-#endif /* !defined TZDEFDST */
-
-struct ttinfo {                                /* time type information */
-       long            tt_gmtoff;      /* UTC offset in seconds */
-       int             tt_isdst;       /* used to set tm_isdst */
-       int             tt_abbrind;     /* abbreviation list index */
-       int             tt_ttisstd;     /* TRUE if transition is std time */
-       int             tt_ttisgmt;     /* TRUE if transition is UTC */
-};
-
-struct lsinfo {                                /* leap second information */
-       time_t          ls_trans;       /* transition time */
-       long            ls_corr;        /* correction to apply */
-};
-
-#define BIGGEST(a, b)  (((a) > (b)) ? (a) : (b))
-
-#ifdef TZNAME_MAX
-#define MY_TZNAME_MAX  TZNAME_MAX
-#endif /* defined TZNAME_MAX */
-#ifndef TZNAME_MAX
-#define MY_TZNAME_MAX  255
-#endif /* !defined TZNAME_MAX */
-
-struct state {
-       int             leapcnt;
-       int             timecnt;
-       int             typecnt;
-       int             charcnt;
-       time_t          ats[TZ_MAX_TIMES];
-       unsigned char   types[TZ_MAX_TIMES];
-       struct ttinfo   ttis[TZ_MAX_TYPES];
-       char            chars[BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt),
-                               (2 * (MY_TZNAME_MAX + 1)))];
-       struct lsinfo   lsis[TZ_MAX_LEAPS];
-};
-
-struct rule {
-       int             r_type;         /* type of rule--see below */
-       int             r_day;          /* day number of rule */
-       int             r_week;         /* week number of rule */
-       int             r_mon;          /* month number of rule */
-       long            r_time;         /* transition time of rule */
-};
-
-#define JULIAN_DAY             0       /* Jn - Julian day */
-#define DAY_OF_YEAR            1       /* n - day of year */
-#define MONTH_NTH_DAY_OF_WEEK  2       /* Mm.n.d - month, week, day of week */
-
-/*
-** Prototypes for static functions.
-*/
-
-static long            detzcode P((const char * codep));
-static const char *    getzname P((const char * strp));
-static const char *    getqzname P((const char * strp, const char delim));
-static const char *    getnum P((const char * strp, int * nump, int min,
-                               int max));
-static const char *    getsecs P((const char * strp, long * secsp));
-static const char *    getoffset P((const char * strp, long * offsetp));
-static const char *    getrule P((const char * strp, struct rule * rulep));
-static void            gmtload P((struct state * sp));
-static struct tm *     gmtsub P((const time_t * timep, long offset,
-                               struct tm * tmp));
-static struct tm *     localsub P((const time_t * timep, long offset,
-                               struct tm * tmp));
-static int             increment_overflow P((int * number, int delta));
-static int             leaps_thru_end_of P((int y));
-static int             long_increment_overflow P((long * number, int delta));
-static int             long_normalize_overflow P((long * tensptr,
-                               int * unitsptr, int base));
-static int             normalize_overflow P((int * tensptr, int * unitsptr,
-                               int base));
-static void            settzname P((void));
-static time_t          time1 P((struct tm * tmp,
-                               struct tm * (*funcp) P((const time_t *,
-                               long, struct tm *)),
-                               long offset));
-static time_t          time2 P((struct tm *tmp,
-                               struct tm * (*funcp) P((const time_t *,
-                               long, struct tm*)),
-                               long offset, int * okayp));
-static time_t          time2sub P((struct tm *tmp,
-                               struct tm * (*funcp) P((const time_t *,
-                               long, struct tm*)),
-                               long offset, int * okayp, int do_norm_secs));
-static struct tm *     timesub P((const time_t * timep, long offset,
-                               const struct state * sp, struct tm * tmp));
-static int             tmcomp P((const struct tm * atmp,
-                               const struct tm * btmp));
-static time_t          transtime P((time_t janfirst, int year,
-                               const struct rule * rulep, long offset));
-static int             tzload P((const char * name, struct state * sp));
-static int             tzparse P((const char * name, struct state * sp,
-                               int lastditch));
-
-#ifdef ALL_STATE
-static struct state *  lclptr;
-static struct state *  gmtptr;
-#endif /* defined ALL_STATE */
-
-#ifndef ALL_STATE
-static struct state    lclmem;
-static struct state    gmtmem;
-#define lclptr         (&lclmem)
-#define gmtptr         (&gmtmem)
-#endif /* State Farm */
-
-#ifndef TZ_STRLEN_MAX
-#define TZ_STRLEN_MAX 255
-#endif /* !defined TZ_STRLEN_MAX */
-
-static char            lcl_TZname[TZ_STRLEN_MAX + 1];
-static int             lcl_is_set;
-static int             gmt_is_set;
-
-char *                 tzname[2] = {
-       wildabbr,
-       wildabbr
-};
-
-/*
-** Section 4.12.3 of X3.159-1989 requires that
-**     Except for the strftime function, these functions [asctime,
-**     ctime, gmtime, localtime] return values in one of two static
-**     objects: a broken-down time structure and an array of char.
-** Thanks to Paul Eggert for noting this.
-*/
-
-static struct tm       tm;
-
-#ifdef USG_COMPAT
-time_t                 timezone = 0;
-int                    daylight = 0;
-#endif /* defined USG_COMPAT */
-
-#ifdef ALTZONE
-time_t                 altzone = 0;
-#endif /* defined ALTZONE */
-
-static long
-detzcode(codep)
-const char * const     codep;
-{
-       register long   result;
-       register int    i;
-
-       result = (codep[0] & 0x80) ? ~0L : 0L;
-       for (i = 0; i < 4; ++i)
-               result = (result << 8) | (codep[i] & 0xff);
-       return result;
-}
-
-static void
-settzname P((void))
-{
-       register struct state * const   sp = lclptr;
-       register int                    i;
-
-       tzname[0] = wildabbr;
-       tzname[1] = wildabbr;
-#ifdef USG_COMPAT
-       daylight = 0;
-       timezone = 0;
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
-       altzone = 0;
-#endif /* defined ALTZONE */
-#ifdef ALL_STATE
-       if (sp == NULL) {
-               tzname[0] = tzname[1] = gmt;
-               return;
-       }
-#endif /* defined ALL_STATE */
-       for (i = 0; i < sp->typecnt; ++i) {
-               register const struct ttinfo * const    ttisp = &sp->ttis[i];
-
-               tzname[ttisp->tt_isdst] =
-                       &sp->chars[ttisp->tt_abbrind];
-#ifdef USG_COMPAT
-               if (ttisp->tt_isdst)
-                       daylight = 1;
-               if (i == 0 || !ttisp->tt_isdst)
-                       timezone = -(ttisp->tt_gmtoff);
-#endif /* defined USG_COMPAT */
-#ifdef ALTZONE
-               if (i == 0 || ttisp->tt_isdst)
-                       altzone = -(ttisp->tt_gmtoff);
-#endif /* defined ALTZONE */
-       }
-       /*
-       ** And to get the latest zone names into tzname. . .
-       */
-       for (i = 0; i < sp->timecnt; ++i) {
-               register const struct ttinfo * const    ttisp =
-                                                       &sp->ttis[
-                                                               sp->types[i]];
-
-               tzname[ttisp->tt_isdst] =
-                       &sp->chars[ttisp->tt_abbrind];
-       }
-       /*
-       ** Finally, scrub the abbreviations.
-       ** First, replace bogus characters.
-       */
-       for (i = 0; i < sp->charcnt; ++i)
-               if (strchr(TZ_ABBR_CHAR_SET, sp->chars[i]) == NULL)
-                       sp->chars[i] = TZ_ABBR_ERR_CHAR;
-       /*
-       ** Second, truncate long abbreviations.
-       */
-       for (i = 0; i < sp->typecnt; ++i) {
-               register const struct ttinfo * const    ttisp = &sp->ttis[i];
-               register char *                         cp = &sp->chars[ttisp->tt_abbrind];
-
-               if (strlen(cp) > TZ_ABBR_MAX_LEN &&
-                       strcmp(cp, GRANDPARENTED) != 0)
-                               *(cp + TZ_ABBR_MAX_LEN) = '\0';
-       }
-}
-
-static int
-tzload(name, sp)
-register const char *          name;
-register struct state * const  sp;
-{
-       register const char *   p;
-       register int            i;
-       register int            fid;
-
-       if (name == NULL && (name = TZDEFAULT) == NULL) {
-               return -1;
-       }
-
-       {
-               register int    doaccess;
-               /*
-               ** Section 4.9.1 of the C standard says that
-               ** "FILENAME_MAX expands to an integral constant expression
-               ** that is the size needed for an array of char large enough
-               ** to hold the longest file name string that the implementation
-               ** guarantees can be opened."
-               */
-               char            fullname[FILENAME_MAX + 1];
-
-               if (name[0] == ':')
-                       ++name;
-               doaccess = name[0] == '/';
-               if (!doaccess) {
-                       if ((p = TZDIR) == NULL)
-                               return -1;
-                       if ((strlen(p) + strlen(name) + 1) >= sizeof fullname)
-                               return -1;
-                       (void) strcpy(fullname, p);
-                       (void) strcat(fullname, "/");
-                       (void) strcat(fullname, name);
-                       /*
-                       ** Set doaccess if '.' (as in "../") shows up in name.
-                       */
-                       if (strchr(name, '.') != NULL)
-                               doaccess = TRUE;
-                       name = fullname;
-               }
-               if (doaccess && access(name, R_OK) != 0)
-                       return -1;
-               if ((fid = open(name, OPEN_MODE)) == -1)
-                       return -1;
-       }
-       {
-               struct tzhead * tzhp;
-               union {
-                       struct tzhead   tzhead;
-                       char            buf[sizeof *sp + sizeof *tzhp];
-               } u;
-               int             ttisstdcnt;
-               int             ttisgmtcnt;
-
-               i = read(fid, u.buf, sizeof u.buf);
-               if (close(fid) != 0)
-                       return -1;
-               ttisstdcnt = (int) detzcode(u.tzhead.tzh_ttisstdcnt);
-               ttisgmtcnt = (int) detzcode(u.tzhead.tzh_ttisgmtcnt);
-               sp->leapcnt = (int) detzcode(u.tzhead.tzh_leapcnt);
-               sp->timecnt = (int) detzcode(u.tzhead.tzh_timecnt);
-               sp->typecnt = (int) detzcode(u.tzhead.tzh_typecnt);
-               sp->charcnt = (int) detzcode(u.tzhead.tzh_charcnt);
-               p = u.tzhead.tzh_charcnt + sizeof u.tzhead.tzh_charcnt;
-               if (sp->leapcnt < 0 || sp->leapcnt > TZ_MAX_LEAPS ||
-                       sp->typecnt <= 0 || sp->typecnt > TZ_MAX_TYPES ||
-                       sp->timecnt < 0 || sp->timecnt > TZ_MAX_TIMES ||
-                       sp->charcnt < 0 || sp->charcnt > TZ_MAX_CHARS ||
-                       (ttisstdcnt != sp->typecnt && ttisstdcnt != 0) ||
-                       (ttisgmtcnt != sp->typecnt && ttisgmtcnt != 0))
-                               return -1;
-               if (i - (p - u.buf) < sp->timecnt * 4 + /* ats */
-                       sp->timecnt +                   /* types */
-                       sp->typecnt * (4 + 2) +         /* ttinfos */
-                       sp->charcnt +                   /* chars */
-                       sp->leapcnt * (4 + 4) +         /* lsinfos */
-                       ttisstdcnt +                    /* ttisstds */
-                       ttisgmtcnt)                     /* ttisgmts */
-                               return -1;
-               for (i = 0; i < sp->timecnt; ++i) {
-                       sp->ats[i] = detzcode(p);
-                       p += 4;
-               }
-               for (i = 0; i < sp->timecnt; ++i) {
-                       sp->types[i] = (unsigned char) *p++;
-                       if (sp->types[i] >= sp->typecnt)
-                               return -1;
-               }
-               for (i = 0; i < sp->typecnt; ++i) {
-                       register struct ttinfo *        ttisp;
-
-                       ttisp = &sp->ttis[i];
-                       ttisp->tt_gmtoff = detzcode(p);
-                       p += 4;
-                       ttisp->tt_isdst = (unsigned char) *p++;
-                       if (ttisp->tt_isdst != 0 && ttisp->tt_isdst != 1)
-                               return -1;
-                       ttisp->tt_abbrind = (unsigned char) *p++;
-                       if (ttisp->tt_abbrind < 0 ||
-                               ttisp->tt_abbrind > sp->charcnt)
-                                       return -1;
-               }
-               for (i = 0; i < sp->charcnt; ++i)
-                       sp->chars[i] = *p++;
-               sp->chars[i] = '\0';    /* ensure '\0' at end */
-               for (i = 0; i < sp->leapcnt; ++i) {
-                       register struct lsinfo *        lsisp;
-
-                       lsisp = &sp->lsis[i];
-                       lsisp->ls_trans = detzcode(p);
-                       p += 4;
-                       lsisp->ls_corr = detzcode(p);
-                       p += 4;
-               }
-               for (i = 0; i < sp->typecnt; ++i) {
-                       register struct ttinfo *        ttisp;
-
-                       ttisp = &sp->ttis[i];
-                       if (ttisstdcnt == 0)
-                               ttisp->tt_ttisstd = FALSE;
-                       else {
-                               ttisp->tt_ttisstd = *p++;
-                               if (ttisp->tt_ttisstd != TRUE &&
-                                       ttisp->tt_ttisstd != FALSE)
-                                               return -1;
-                       }
-               }
-               for (i = 0; i < sp->typecnt; ++i) {
-                       register struct ttinfo *        ttisp;
-
-                       ttisp = &sp->ttis[i];
-                       if (ttisgmtcnt == 0)
-                               ttisp->tt_ttisgmt = FALSE;
-                       else {
-                               ttisp->tt_ttisgmt = *p++;
-                               if (ttisp->tt_ttisgmt != TRUE &&
-                                       ttisp->tt_ttisgmt != FALSE)
-                                               return -1;
-                       }
-               }
-               /*
-               ** Out-of-sort ats should mean we're running on a
-               ** signed time_t system but using a data file with
-               ** unsigned values (or vice versa).
-               */
-               for (i = 0; i < sp->timecnt - 2; ++i)
-                       if (sp->ats[i] > sp->ats[i + 1]) {
-                               ++i;
-                               if (TYPE_SIGNED(time_t)) {
-                                       /*
-                                       ** Ignore the end (easy).
-                                       */
-                                       sp->timecnt = i;
-                               } else {
-                                       /*
-                                       ** Ignore the beginning (harder).
-                                       */
-                                       register int    j;
-
-                                       for (j = 0; j + i < sp->timecnt; ++j) {
-                                               sp->ats[j] = sp->ats[j + i];
-                                               sp->types[j] = sp->types[j + i];
-                                       }
-                                       sp->timecnt = j;
-                               }
-                               break;
-                       }
-       }
-       return 0;
-}
-
-static const int       mon_lengths[2][MONSPERYEAR] = {
-       { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
-       { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-};
-
-static const int       year_lengths[2] = {
-       DAYSPERNYEAR, DAYSPERLYEAR
-};
-
-/*
-** Given a pointer into a time zone string, scan until a character that is not
-** a valid character in a zone name is found. Return a pointer to that
-** character.
-*/
-
-static const char *
-getzname(strp)
-register const char *  strp;
-{
-       register char   c;
-
-       while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
-               c != '+')
-                       ++strp;
-       return strp;
-}
-
-/*
-** Given a pointer into an extended time zone string, scan until the ending
-** delimiter of the zone name is located.   Return a pointer to the delimiter.
-**
-** As with getzname above, the legal character set is actually quite
-** restricted, with other characters producing undefined results.
-** We choose not to care - allowing almost anything to be in the zone abbrev.
-*/
-
-static const char *
-#if __STDC__
-getqzname(register const char *strp, const char delim)
-#else /* !__STDC__ */
-getqzname(strp, delim)
-register const char *  strp;
-const char             delim;
-#endif /* !__STDC__ */
-{
-       register char   c;
-
-       while ((c = *strp) != '\0' && c != delim)
-               ++strp;
-       return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a number from that string.
-** Check that the number is within a specified range; if it is not, return
-** NULL.
-** Otherwise, return a pointer to the first character not part of the number.
-*/
-
-static const char *
-getnum(strp, nump, min, max)
-register const char *  strp;
-int * const            nump;
-const int              min;
-const int              max;
-{
-       register char   c;
-       register int    num;
-
-       if (strp == NULL || !is_digit(c = *strp))
-               return NULL;
-       num = 0;
-       do {
-               num = num * 10 + (c - '0');
-               if (num > max)
-                       return NULL;    /* illegal value */
-               c = *++strp;
-       } while (is_digit(c));
-       if (num < min)
-               return NULL;            /* illegal value */
-       *nump = num;
-       return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a number of seconds,
-** in hh[:mm[:ss]] form, from the string.
-** If any error occurs, return NULL.
-** Otherwise, return a pointer to the first character not part of the number
-** of seconds.
-*/
-
-static const char *
-getsecs(strp, secsp)
-register const char *  strp;
-long * const           secsp;
-{
-       int     num;
-
-       /*
-       ** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
-       ** "M10.4.6/26", which does not conform to Posix,
-       ** but which specifies the equivalent of
-       ** ``02:00 on the first Sunday on or after 23 Oct''.
-       */
-       strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
-       if (strp == NULL)
-               return NULL;
-       *secsp = num * (long) SECSPERHOUR;
-       if (*strp == ':') {
-               ++strp;
-               strp = getnum(strp, &num, 0, MINSPERHOUR - 1);
-               if (strp == NULL)
-                       return NULL;
-               *secsp += num * SECSPERMIN;
-               if (*strp == ':') {
-                       ++strp;
-                       /* `SECSPERMIN' allows for leap seconds. */
-                       strp = getnum(strp, &num, 0, SECSPERMIN);
-                       if (strp == NULL)
-                               return NULL;
-                       *secsp += num;
-               }
-       }
-       return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract an offset, in
-** [+-]hh[:mm[:ss]] form, from the string.
-** If any error occurs, return NULL.
-** Otherwise, return a pointer to the first character not part of the time.
-*/
-
-static const char *
-getoffset(strp, offsetp)
-register const char *  strp;
-long * const           offsetp;
-{
-       register int    neg = 0;
-
-       if (*strp == '-') {
-               neg = 1;
-               ++strp;
-       } else if (*strp == '+')
-               ++strp;
-       strp = getsecs(strp, offsetp);
-       if (strp == NULL)
-               return NULL;            /* illegal time */
-       if (neg)
-               *offsetp = -*offsetp;
-       return strp;
-}
-
-/*
-** Given a pointer into a time zone string, extract a rule in the form
-** date[/time]. See POSIX section 8 for the format of "date" and "time".
-** If a valid rule is not found, return NULL.
-** Otherwise, return a pointer to the first character not part of the rule.
-*/
-
-static const char *
-getrule(strp, rulep)
-const char *                   strp;
-register struct rule * const   rulep;
-{
-       if (*strp == 'J') {
-               /*
-               ** Julian day.
-               */
-               rulep->r_type = JULIAN_DAY;
-               ++strp;
-               strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR);
-       } else if (*strp == 'M') {
-               /*
-               ** Month, week, day.
-               */
-               rulep->r_type = MONTH_NTH_DAY_OF_WEEK;
-               ++strp;
-               strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR);
-               if (strp == NULL)
-                       return NULL;
-               if (*strp++ != '.')
-                       return NULL;
-               strp = getnum(strp, &rulep->r_week, 1, 5);
-               if (strp == NULL)
-                       return NULL;
-               if (*strp++ != '.')
-                       return NULL;
-               strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1);
-       } else if (is_digit(*strp)) {
-               /*
-               ** Day of year.
-               */
-               rulep->r_type = DAY_OF_YEAR;
-               strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1);
-       } else  return NULL;            /* invalid format */
-       if (strp == NULL)
-               return NULL;
-       if (*strp == '/') {
-               /*
-               ** Time specified.
-               */
-               ++strp;
-               strp = getsecs(strp, &rulep->r_time);
-       } else  rulep->r_time = 2 * SECSPERHOUR;        /* default = 2:00:00 */
-       return strp;
-}
-
-/*
-** Given the Epoch-relative time of January 1, 00:00:00 UTC, in a year, the
-** year, a rule, and the offset from UTC at the time that rule takes effect,
-** calculate the Epoch-relative time that rule takes effect.
-*/
-
-static time_t
-transtime(janfirst, year, rulep, offset)
-const time_t                           janfirst;
-const int                              year;
-register const struct rule * const     rulep;
-const long                             offset;
-{
-       register int    leapyear;
-       register time_t value;
-       register int    i;
-       int             d, m1, yy0, yy1, yy2, dow;
-
-       INITIALIZE(value);
-       leapyear = isleap(year);
-       switch (rulep->r_type) {
-
-       case JULIAN_DAY:
-               /*
-               ** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap
-               ** years.
-               ** In non-leap years, or if the day number is 59 or less, just
-               ** add SECSPERDAY times the day number-1 to the time of
-               ** January 1, midnight, to get the day.
-               */
-               value = janfirst + (rulep->r_day - 1) * SECSPERDAY;
-               if (leapyear && rulep->r_day >= 60)
-                       value += SECSPERDAY;
-               break;
-
-       case DAY_OF_YEAR:
-               /*
-               ** n - day of year.
-               ** Just add SECSPERDAY times the day number to the time of
-               ** January 1, midnight, to get the day.
-               */
-               value = janfirst + rulep->r_day * SECSPERDAY;
-               break;
-
-       case MONTH_NTH_DAY_OF_WEEK:
-               /*
-               ** Mm.n.d - nth "dth day" of month m.
-               */
-               value = janfirst;
-               for (i = 0; i < rulep->r_mon - 1; ++i)
-                       value += mon_lengths[leapyear][i] * SECSPERDAY;
-
-               /*
-               ** Use Zeller's Congruence to get day-of-week of first day of
-               ** month.
-               */
-               m1 = (rulep->r_mon + 9) % 12 + 1;
-               yy0 = (rulep->r_mon <= 2) ? (year - 1) : year;
-               yy1 = yy0 / 100;
-               yy2 = yy0 % 100;
-               dow = ((26 * m1 - 2) / 10 +
-                       1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7;
-               if (dow < 0)
-                       dow += DAYSPERWEEK;
-
-               /*
-               ** "dow" is the day-of-week of the first day of the month. Get
-               ** the day-of-month (zero-origin) of the first "dow" day of the
-               ** month.
-               */
-               d = rulep->r_day - dow;
-               if (d < 0)
-                       d += DAYSPERWEEK;
-               for (i = 1; i < rulep->r_week; ++i) {
-                       if (d + DAYSPERWEEK >=
-                               mon_lengths[leapyear][rulep->r_mon - 1])
-                                       break;
-                       d += DAYSPERWEEK;
-               }
-
-               /*
-               ** "d" is the day-of-month (zero-origin) of the day we want.
-               */
-               value += d * SECSPERDAY;
-               break;
-       }
-
-       /*
-       ** "value" is the Epoch-relative time of 00:00:00 UTC on the day in
-       ** question. To get the Epoch-relative time of the specified local
-       ** time on that day, add the transition time and the current offset
-       ** from UTC.
-       */
-       return value + rulep->r_time + offset;
-}
-
-/*
-** Given a POSIX section 8-style TZ string, fill in the rule tables as
-** appropriate.
-*/
-
-static int
-tzparse(name, sp, lastditch)
-const char *                   name;
-register struct state * const  sp;
-const int                      lastditch;
-{
-       const char *                    stdname;
-       const char *                    dstname;
-       size_t                          stdlen;
-       size_t                          dstlen;
-       long                            stdoffset;
-       long                            dstoffset;
-       register time_t *               atp;
-       register unsigned char *        typep;
-       register char *                 cp;
-       register int                    load_result;
-
-       INITIALIZE(dstname);
-       stdname = name;
-       if (lastditch) {
-               stdlen = strlen(name);  /* length of standard zone name */
-               name += stdlen;
-               if (stdlen >= sizeof sp->chars)
-                       stdlen = (sizeof sp->chars) - 1;
-               stdoffset = 0;
-       } else {
-               if (*name == '<') {
-                       name++;
-                       stdname = name;
-                       name = getqzname(name, '>');
-                       if (*name != '>')
-                               return (-1);
-                       stdlen = name - stdname;
-                       name++;
-               } else {
-                       name = getzname(name);
-                       stdlen = name - stdname;
-               }
-               if (*name == '\0')
-                       return -1;
-               name = getoffset(name, &stdoffset);
-               if (name == NULL)
-                       return -1;
-       }
-       load_result = tzload(TZDEFRULES, sp);
-       if (load_result != 0)
-               sp->leapcnt = 0;                /* so, we're off a little */
-       if (*name != '\0') {
-               if (*name == '<') {
-                       dstname = ++name;
-                       name = getqzname(name, '>');
-                       if (*name != '>')
-                               return -1;
-                       dstlen = name - dstname;
-                       name++;
-               } else {
-                       dstname = name;
-                       name = getzname(name);
-                       dstlen = name - dstname; /* length of DST zone name */
-               }
-               if (*name != '\0' && *name != ',' && *name != ';') {
-                       name = getoffset(name, &dstoffset);
-                       if (name == NULL)
-                               return -1;
-               } else  dstoffset = stdoffset - SECSPERHOUR;
-               if (*name == '\0' && load_result != 0)
-                       name = TZDEFRULESTRING;
-               if (*name == ',' || *name == ';') {
-                       struct rule     start;
-                       struct rule     end;
-                       register int    year;
-                       register time_t janfirst;
-                       time_t          starttime;
-                       time_t          endtime;
-
-                       ++name;
-                       if ((name = getrule(name, &start)) == NULL)
-                               return -1;
-                       if (*name++ != ',')
-                               return -1;
-                       if ((name = getrule(name, &end)) == NULL)
-                               return -1;
-                       if (*name != '\0')
-                               return -1;
-                       sp->typecnt = 2;        /* standard time and DST */
-                       /*
-                       ** Two transitions per year, from EPOCH_YEAR to 2037.
-                       */
-                       sp->timecnt = 2 * (2037 - EPOCH_YEAR + 1);
-                       if (sp->timecnt > TZ_MAX_TIMES)
-                               return -1;
-                       sp->ttis[0].tt_gmtoff = -dstoffset;
-                       sp->ttis[0].tt_isdst = 1;
-                       sp->ttis[0].tt_abbrind = stdlen + 1;
-                       sp->ttis[1].tt_gmtoff = -stdoffset;
-                       sp->ttis[1].tt_isdst = 0;
-                       sp->ttis[1].tt_abbrind = 0;
-                       atp = sp->ats;
-                       typep = sp->types;
-                       janfirst = 0;
-                       for (year = EPOCH_YEAR; year <= 2037; ++year) {
-                               starttime = transtime(janfirst, year, &start,
-                                       stdoffset);
-                               endtime = transtime(janfirst, year, &end,
-                                       dstoffset);
-                               if (starttime > endtime) {
-                                       *atp++ = endtime;
-                                       *typep++ = 1;   /* DST ends */
-                                       *atp++ = starttime;
-                                       *typep++ = 0;   /* DST begins */
-                               } else {
-                                       *atp++ = starttime;
-                                       *typep++ = 0;   /* DST begins */
-                                       *atp++ = endtime;
-                                       *typep++ = 1;   /* DST ends */
-                               }
-                               janfirst += year_lengths[isleap(year)] *
-                                       SECSPERDAY;
-                       }
-               } else {
-                       register long   theirstdoffset;
-                       register long   theirdstoffset;
-                       register long   theiroffset;
-                       register int    isdst;
-                       register int    i;
-                       register int    j;
-
-                       if (*name != '\0')
-                               return -1;
-                       /*
-                       ** Initial values of theirstdoffset and theirdstoffset.
-                       */
-                       theirstdoffset = 0;
-                       for (i = 0; i < sp->timecnt; ++i) {
-                               j = sp->types[i];
-                               if (!sp->ttis[j].tt_isdst) {
-                                       theirstdoffset =
-                                               -sp->ttis[j].tt_gmtoff;
-                                       break;
-                               }
-                       }
-                       theirdstoffset = 0;
-                       for (i = 0; i < sp->timecnt; ++i) {
-                               j = sp->types[i];
-                               if (sp->ttis[j].tt_isdst) {
-                                       theirdstoffset =
-                                               -sp->ttis[j].tt_gmtoff;
-                                       break;
-                               }
-                       }
-                       /*
-                       ** Initially we're assumed to be in standard time.
-                       */
-                       isdst = FALSE;
-                       theiroffset = theirstdoffset;
-                       /*
-                       ** Now juggle transition times and types
-                       ** tracking offsets as you do.
-                       */
-                       for (i = 0; i < sp->timecnt; ++i) {
-                               j = sp->types[i];
-                               sp->types[i] = sp->ttis[j].tt_isdst;
-                               if (sp->ttis[j].tt_ttisgmt) {
-                                       /* No adjustment to transition time */
-                               } else {
-                                       /*
-                                       ** If summer time is in effect, and the
-                                       ** transition time was not specified as
-                                       ** standard time, add the summer time
-                                       ** offset to the transition time;
-                                       ** otherwise, add the standard time
-                                       ** offset to the transition time.
-                                       */
-                                       /*
-                                       ** Transitions from DST to DDST
-                                       ** will effectively disappear since
-                                       ** POSIX provides for only one DST
-                                       ** offset.
-                                       */
-                                       if (isdst && !sp->ttis[j].tt_ttisstd) {
-                                               sp->ats[i] += dstoffset -
-                                                       theirdstoffset;
-                                       } else {
-                                               sp->ats[i] += stdoffset -
-                                                       theirstdoffset;
-                                       }
-                               }
-                               theiroffset = -sp->ttis[j].tt_gmtoff;
-                               if (sp->ttis[j].tt_isdst)
-                                       theirdstoffset = theiroffset;
-                               else    theirstdoffset = theiroffset;
-                       }
-                       /*
-                       ** Finally, fill in ttis.
-                       ** ttisstd and ttisgmt need not be handled.
-                       */
-                       sp->ttis[0].tt_gmtoff = -stdoffset;
-                       sp->ttis[0].tt_isdst = FALSE;
-                       sp->ttis[0].tt_abbrind = 0;
-                       sp->ttis[1].tt_gmtoff = -dstoffset;
-                       sp->ttis[1].tt_isdst = TRUE;
-                       sp->ttis[1].tt_abbrind = stdlen + 1;
-                       sp->typecnt = 2;
-               }
-       } else {
-               dstlen = 0;
-               sp->typecnt = 1;                /* only standard time */
-               sp->timecnt = 0;
-               sp->ttis[0].tt_gmtoff = -stdoffset;
-               sp->ttis[0].tt_isdst = 0;
-               sp->ttis[0].tt_abbrind = 0;
-       }
-       sp->charcnt = stdlen + 1;
-       if (dstlen != 0)
-               sp->charcnt += dstlen + 1;
-       if ((size_t) sp->charcnt > sizeof sp->chars)
-               return -1;
-       cp = sp->chars;
-       (void) strncpy(cp, stdname, stdlen);
-       cp += stdlen;
-       *cp++ = '\0';
-       if (dstlen != 0) {
-               (void) strncpy(cp, dstname, dstlen);
-               *(cp + dstlen) = '\0';
-       }
-       return 0;
-}
-
-static void
-gmtload(sp)
-struct state * const   sp;
-{
-       if (tzload(gmt, sp) != 0)
-               (void) tzparse(gmt, sp, TRUE);
-}
-
-#ifndef STD_INSPIRED
-/*
-** A non-static declaration of tzsetwall in a system header file
-** may cause a warning about this upcoming static declaration...
-*/
-static
-#endif /* !defined STD_INSPIRED */
-void
-tzsetwall P((void))
-{
-       if (lcl_is_set < 0)
-               return;
-       lcl_is_set = -1;
-
-#ifdef ALL_STATE
-       if (lclptr == NULL) {
-               lclptr = (struct state *) malloc(sizeof *lclptr);
-               if (lclptr == NULL) {
-                       settzname();    /* all we can do */
-                       return;
-               }
-       }
-#endif /* defined ALL_STATE */
-       if (tzload((char *) NULL, lclptr) != 0)
-               gmtload(lclptr);
-       settzname();
-}
-
-void
-tzset P((void))
-{
-       register const char *   name;
-
-       name = getenv("TZ");
-       if (name == NULL) {
-               tzsetwall();
-               return;
-       }
-
-       if (lcl_is_set > 0 && strcmp(lcl_TZname, name) == 0) {
-               return;
-       }
-       lcl_is_set = strlen(name) < sizeof lcl_TZname;
-       if (lcl_is_set)
-               (void) strcpy(lcl_TZname, name);
-
-#ifdef ALL_STATE
-       if (lclptr == NULL) {
-               lclptr = (struct state *) malloc(sizeof *lclptr);
-               if (lclptr == NULL) {
-                       settzname();    /* all we can do */
-                       return;
-               }
-       }
-#endif /* defined ALL_STATE */
-       if (*name == '\0') {
-               /*
-               ** User wants it fast rather than right.
-               */
-               lclptr->leapcnt = 0;            /* so, we're off a little */
-               lclptr->timecnt = 0;
-               lclptr->typecnt = 0;
-               lclptr->ttis[0].tt_isdst = 0;
-               lclptr->ttis[0].tt_gmtoff = 0;
-               lclptr->ttis[0].tt_abbrind = 0;
-               (void) strcpy(lclptr->chars, gmt);
-       } else if (tzload(name, lclptr) != 0)
-               if (name[0] == ':' || tzparse(name, lclptr, FALSE) != 0)
-                       (void) gmtload(lclptr);
-       settzname();
-}
-
-/*
-** The easy way to behave "as if no library function calls" localtime
-** is to not call it--so we drop its guts into "localsub", which can be
-** freely called. (And no, the PANS doesn't require the above behavior--
-** but it *is* desirable.)
-**
-** The unused offset argument is for the benefit of mktime variants.
-*/
-
-/*ARGSUSED*/
-static struct tm *
-localsub(timep, offset, tmp)
-const time_t * const   timep;
-const long             offset;
-struct tm * const      tmp;
-{
-       register struct state *         sp;
-       register const struct ttinfo *  ttisp;
-       register int                    i;
-       register struct tm *            result;
-       const time_t                    t = *timep;
-
-       sp = lclptr;
-#ifdef ALL_STATE
-       if (sp == NULL)
-               return gmtsub(timep, offset, tmp);
-#endif /* defined ALL_STATE */
-       if (sp->timecnt == 0 || t < sp->ats[0]) {
-               i = 0;
-               while (sp->ttis[i].tt_isdst)
-                       if (++i >= sp->typecnt) {
-                               i = 0;
-                               break;
-                       }
-       } else {
-               for (i = 1; i < sp->timecnt; ++i)
-                       if (t < sp->ats[i])
-                               break;
-               i = (int) sp->types[i - 1];
-       }
-       ttisp = &sp->ttis[i];
-       /*
-       ** To get (wrong) behavior that's compatible with System V Release 2.0
-       ** you'd replace the statement below with
-       **      t += ttisp->tt_gmtoff;
-       **      timesub(&t, 0L, sp, tmp);
-       */
-       result = timesub(&t, ttisp->tt_gmtoff, sp, tmp);
-       tmp->tm_isdst = ttisp->tt_isdst;
-       tzname[tmp->tm_isdst] = &sp->chars[ttisp->tt_abbrind];
-#ifdef TM_ZONE
-       tmp->TM_ZONE = &sp->chars[ttisp->tt_abbrind];
-#endif /* defined TM_ZONE */
-       return result;
-}
-
-struct tm *
-localtime(timep)
-const time_t * const   timep;
-{
-       tzset();
-       return localsub(timep, 0L, &tm);
-}
-
-/*
-** Re-entrant version of localtime.
-*/
-
-struct tm *
-localtime_r(const time_t * const       timep, struct tm *              tmp)
-{
-       return localsub(timep, 0L, tmp);
-}
-
-/*
-** gmtsub is to gmtime as localsub is to localtime.
-*/
-
-static struct tm *
-gmtsub(timep, offset, tmp)
-const time_t * const   timep;
-const long             offset;
-struct tm * const      tmp;
-{
-       register struct tm *    result;
-
-       if (!gmt_is_set) {
-               gmt_is_set = TRUE;
-#ifdef ALL_STATE
-               gmtptr = (struct state *) malloc(sizeof *gmtptr);
-               if (gmtptr != NULL)
-#endif /* defined ALL_STATE */
-                       gmtload(gmtptr);
-       }
-       result = timesub(timep, offset, gmtptr, tmp);
-#ifdef TM_ZONE
-       /*
-       ** Could get fancy here and deliver something such as
-       ** "UTC+xxxx" or "UTC-xxxx" if offset is non-zero,
-       ** but this is no time for a treasure hunt.
-       */
-       if (offset != 0)
-               tmp->TM_ZONE = wildabbr;
-       else {
-#ifdef ALL_STATE
-               if (gmtptr == NULL)
-                       tmp->TM_ZONE = gmt;
-               else    tmp->TM_ZONE = gmtptr->chars;
-#endif /* defined ALL_STATE */
-#ifndef ALL_STATE
-               tmp->TM_ZONE = gmtptr->chars;
-#endif /* State Farm */
-       }
-#endif /* defined TM_ZONE */
-       return result;
-}
-
-struct tm *
-gmtime(timep)
-const time_t * const   timep;
-{
-       return gmtsub(timep, 0L, &tm);
-}
-
-/*
-* Re-entrant version of gmtime.
-*/
-
-struct tm *
-gmtime_r(const time_t * const  timep, struct tm *              tmp)
-{
-       return gmtsub(timep, 0L, tmp);
-}
-
-#ifdef STD_INSPIRED
-
-struct tm *
-offtime(timep, offset)
-const time_t * const   timep;
-const long             offset;
-{
-       return gmtsub(timep, offset, &tm);
-}
-
-#endif /* defined STD_INSPIRED */
-
-/*
-** Return the number of leap years through the end of the given year
-** where, to make the math easy, the answer for year zero is defined as zero.
-*/
-
-static int
-leaps_thru_end_of(y)
-register const int     y;
-{
-       return (y >= 0) ? (y / 4 - y / 100 + y / 400) :
-               -(leaps_thru_end_of(-(y + 1)) + 1);
-}
-
-static struct tm *
-timesub(timep, offset, sp, tmp)
-const time_t * const                   timep;
-const long                             offset;
-register const struct state * const    sp;
-register struct tm * const             tmp;
-{
-       register const struct lsinfo *  lp;
-       register time_t                 tdays;
-       register int                    idays;  /* unsigned would be so 2003 */
-       register long                   rem;
-       int                             y;
-       register const int *            ip;
-       register long                   corr;
-       register int                    hit;
-       register int                    i;
-
-       corr = 0;
-       hit = 0;
-#ifdef ALL_STATE
-       i = (sp == NULL) ? 0 : sp->leapcnt;
-#endif /* defined ALL_STATE */
-#ifndef ALL_STATE
-       i = sp->leapcnt;
-#endif /* State Farm */
-       while (--i >= 0) {
-               lp = &sp->lsis[i];
-               if (*timep >= lp->ls_trans) {
-                       if (*timep == lp->ls_trans) {
-                               hit = ((i == 0 && lp->ls_corr > 0) ||
-                                       lp->ls_corr > sp->lsis[i - 1].ls_corr);
-                               if (hit)
-                                       while (i > 0 &&
-                                               sp->lsis[i].ls_trans ==
-                                               sp->lsis[i - 1].ls_trans + 1 &&
-                                               sp->lsis[i].ls_corr ==
-                                               sp->lsis[i - 1].ls_corr + 1) {
-                                                       ++hit;
-                                                       --i;
-                                       }
-                       }
-                       corr = lp->ls_corr;
-                       break;
-               }
-       }
-       y = EPOCH_YEAR;
-       tdays = *timep / SECSPERDAY;
-       rem = *timep - tdays * SECSPERDAY;
-       while (tdays < 0 || tdays >= year_lengths[isleap(y)]) {
-               int             newy;
-               register time_t tdelta;
-               register int    idelta;
-               register int    leapdays;
-
-               tdelta = tdays / DAYSPERLYEAR;
-               idelta = tdelta;
-               if (tdelta - idelta >= 1 || idelta - tdelta >= 1)
-                       return NULL;
-               if (idelta == 0)
-                       idelta = (tdays < 0) ? -1 : 1;
-               newy = y;
-               if (increment_overflow(&newy, idelta))
-                       return NULL;
-               leapdays = leaps_thru_end_of(newy - 1) -
-                       leaps_thru_end_of(y - 1);
-               tdays -= ((time_t) newy - y) * DAYSPERNYEAR;
-               tdays -= leapdays;
-               y = newy;
-       }
-       {
-               register long   seconds;
-
-               seconds = tdays * SECSPERDAY + 0.5;
-               tdays = seconds / SECSPERDAY;
-               rem += seconds - tdays * SECSPERDAY;
-       }
-       /*
-       ** Given the range, we can now fearlessly cast...
-       */
-       idays = tdays;
-       rem += offset - corr;
-       while (rem < 0) {
-               rem += SECSPERDAY;
-               --idays;
-       }
-       while (rem >= SECSPERDAY) {
-               rem -= SECSPERDAY;
-               ++idays;
-       }
-       while (idays < 0) {
-               if (increment_overflow(&y, -1))
-                       return NULL;
-               idays += year_lengths[isleap(y)];
-       }
-       while (idays >= year_lengths[isleap(y)]) {
-               idays -= year_lengths[isleap(y)];
-               if (increment_overflow(&y, 1))
-                       return NULL;
-       }
-       tmp->tm_year = y;
-       if (increment_overflow(&tmp->tm_year, -TM_YEAR_BASE))
-               return NULL;
-       tmp->tm_yday = idays;
-       /*
-       ** The "extra" mods below avoid overflow problems.
-       */
-       tmp->tm_wday = EPOCH_WDAY +
-               ((y - EPOCH_YEAR) % DAYSPERWEEK) *
-               (DAYSPERNYEAR % DAYSPERWEEK) +
-               leaps_thru_end_of(y - 1) -
-               leaps_thru_end_of(EPOCH_YEAR - 1) +
-               idays;
-       tmp->tm_wday %= DAYSPERWEEK;
-       if (tmp->tm_wday < 0)
-               tmp->tm_wday += DAYSPERWEEK;
-       tmp->tm_hour = (int) (rem / SECSPERHOUR);
-       rem %= SECSPERHOUR;
-       tmp->tm_min = (int) (rem / SECSPERMIN);
-       /*
-       ** A positive leap second requires a special
-       ** representation. This uses "... ??:59:60" et seq.
-       */
-       tmp->tm_sec = (int) (rem % SECSPERMIN) + hit;
-       ip = mon_lengths[isleap(y)];
-       for (tmp->tm_mon = 0; idays >= ip[tmp->tm_mon]; ++(tmp->tm_mon))
-               idays -= ip[tmp->tm_mon];
-       tmp->tm_mday = (int) (idays + 1);
-       tmp->tm_isdst = 0;
-#ifdef TM_GMTOFF
-       tmp->TM_GMTOFF = offset;
-#endif /* defined TM_GMTOFF */
-       return tmp;
-}
-
-char *
-ctime(timep)
-const time_t * const   timep;
-{
-/*
-** Section 4.12.3.2 of X3.159-1989 requires that
-**     The ctime function converts the calendar time pointed to by timer
-**     to local time in the form of a string. It is equivalent to
-**             asctime(localtime(timer))
-*/
-       return asctime(localtime(timep));
-}
-
-char *
-ctime_r(const time_t * const   timep, char *                   buf)
-{
-       struct tm       mytm;
-
-       return asctime_r(localtime_r(timep, &mytm), buf);
-}
-
-/*
-** Adapted from code provided by Robert Elz, who writes:
-**     The "best" way to do mktime I think is based on an idea of Bob
-**     Kridle's (so its said...) from a long time ago.
-**     It does a binary search of the time_t space. Since time_t's are
-**     just 32 bits, its a max of 32 iterations (even at 64 bits it
-**     would still be very reasonable).
-*/
-
-#ifndef WRONG
-#define WRONG  (-1)
-#endif /* !defined WRONG */
-
-/*
-** Simplified normalize logic courtesy Paul Eggert.
-*/
-
-static int
-increment_overflow(number, delta)
-int *  number;
-int    delta;
-{
-       int     number0;
-
-       number0 = *number;
-       *number += delta;
-       return (*number < number0) != (delta < 0);
-}
-
-static int
-long_increment_overflow(number, delta)
-long * number;
-int    delta;
-{
-       long    number0;
-
-       number0 = *number;
-       *number += delta;
-       return (*number < number0) != (delta < 0);
-}
-
-static int
-normalize_overflow(tensptr, unitsptr, base)
-int * const    tensptr;
-int * const    unitsptr;
-const int      base;
-{
-       register int    tensdelta;
-
-       tensdelta = (*unitsptr >= 0) ?
-               (*unitsptr / base) :
-               (-1 - (-1 - *unitsptr) / base);
-       *unitsptr -= tensdelta * base;
-       return increment_overflow(tensptr, tensdelta);
-}
-
-static int
-long_normalize_overflow(tensptr, unitsptr, base)
-long * const   tensptr;
-int * const    unitsptr;
-const int      base;
-{
-       register int    tensdelta;
-
-       tensdelta = (*unitsptr >= 0) ?
-               (*unitsptr / base) :
-               (-1 - (-1 - *unitsptr) / base);
-       *unitsptr -= tensdelta * base;
-       return long_increment_overflow(tensptr, tensdelta);
-}
-
-static int
-tmcomp(atmp, btmp)
-register const struct tm * const atmp;
-register const struct tm * const btmp;
-{
-       register int    result;
-
-       if ((result = (atmp->tm_year - btmp->tm_year)) == 0 &&
-               (result = (atmp->tm_mon - btmp->tm_mon)) == 0 &&
-               (result = (atmp->tm_mday - btmp->tm_mday)) == 0 &&
-               (result = (atmp->tm_hour - btmp->tm_hour)) == 0 &&
-               (result = (atmp->tm_min - btmp->tm_min)) == 0)
-                       result = atmp->tm_sec - btmp->tm_sec;
-       return result;
-}
-
-static time_t
-time2sub(tmp, funcp, offset, okayp, do_norm_secs)
-struct tm * const      tmp;
-struct tm * (* const   funcp) P((const time_t*, long, struct tm*));
-const long             offset;
-int * const            okayp;
-const int              do_norm_secs;
-{
-       register const struct state *   sp;
-       register int                    dir;
-       register int                    i, j;
-       register int                    saved_seconds;
-       register long                   li;
-       register time_t                 lo;
-       register time_t                 hi;
-       long                            y;
-       time_t                          newt;
-       time_t                          t;
-       struct tm                       yourtm, mytm;
-
-       *okayp = FALSE;
-       yourtm = *tmp;
-       if (do_norm_secs) {
-               if (normalize_overflow(&yourtm.tm_min, &yourtm.tm_sec,
-                       SECSPERMIN))
-                               return WRONG;
-       }
-       if (normalize_overflow(&yourtm.tm_hour, &yourtm.tm_min, MINSPERHOUR))
-               return WRONG;
-       if (normalize_overflow(&yourtm.tm_mday, &yourtm.tm_hour, HOURSPERDAY))
-               return WRONG;
-       y = yourtm.tm_year;
-       if (long_normalize_overflow(&y, &yourtm.tm_mon, MONSPERYEAR))
-               return WRONG;
-       /*
-       ** Turn y into an actual year number for now.
-       ** It is converted back to an offset from TM_YEAR_BASE later.
-       */
-       if (long_increment_overflow(&y, TM_YEAR_BASE))
-               return WRONG;
-       while (yourtm.tm_mday <= 0) {
-               if (long_increment_overflow(&y, -1))
-                       return WRONG;
-               li = y + (1 < yourtm.tm_mon);
-               yourtm.tm_mday += year_lengths[isleap(li)];
-       }
-       while (yourtm.tm_mday > DAYSPERLYEAR) {
-               li = y + (1 < yourtm.tm_mon);
-               yourtm.tm_mday -= year_lengths[isleap(li)];
-               if (long_increment_overflow(&y, 1))
-                       return WRONG;
-       }
-       for ( ; ; ) {
-               i = mon_lengths[isleap(y)][yourtm.tm_mon];
-               if (yourtm.tm_mday <= i)
-                       break;
-               yourtm.tm_mday -= i;
-               if (++yourtm.tm_mon >= MONSPERYEAR) {
-                       yourtm.tm_mon = 0;
-                       if (long_increment_overflow(&y, 1))
-                               return WRONG;
-               }
-       }
-       if (long_increment_overflow(&y, -TM_YEAR_BASE))
-               return WRONG;
-       yourtm.tm_year = y;
-       if (yourtm.tm_year != y)
-               return WRONG;
-       if (yourtm.tm_sec >= 0 && yourtm.tm_sec < SECSPERMIN)
-               saved_seconds = 0;
-       else if (y + TM_YEAR_BASE < EPOCH_YEAR) {
-               /*
-               ** We can't set tm_sec to 0, because that might push the
-               ** time below the minimum representable time.
-               ** Set tm_sec to 59 instead.
-               ** This assumes that the minimum representable time is
-               ** not in the same minute that a leap second was deleted from,
-               ** which is a safer assumption than using 58 would be.
-               */
-               if (increment_overflow(&yourtm.tm_sec, 1 - SECSPERMIN))
-                       return WRONG;
-               saved_seconds = yourtm.tm_sec;
-               yourtm.tm_sec = SECSPERMIN - 1;
-       } else {
-               saved_seconds = yourtm.tm_sec;
-               yourtm.tm_sec = 0;
-       }
-       /*
-       ** Do a binary search (this works whatever time_t's type is).
-       */
-       if (!TYPE_SIGNED(time_t)) {
-               lo = 0;
-               hi = lo - 1;
-       }
-#if 0
-       else if (!TYPE_INTEGRAL(time_t)) {
-               if (sizeof(time_t) > sizeof(float))
-                       hi = (time_t) DBL_MAX;
-               else    hi = (time_t) FLT_MAX;
-               lo = -hi;
-       }
-#endif
-       else {
-               lo = 1;
-               for (i = 0; i < (int) TYPE_BIT(time_t) - 1; ++i)
-                       lo *= 2;
-               hi = -(lo + 1);
-       }
-       for ( ; ; ) {
-               t = lo / 2 + hi / 2;
-               if (t < lo)
-                       t = lo;
-               else if (t > hi)
-                       t = hi;
-               if ((*funcp)(&t, offset, &mytm) == NULL) {
-                       /*
-                       ** Assume that t is too extreme to be represented in
-                       ** a struct tm; arrange things so that it is less
-                       ** extreme on the next pass.
-                       */
-                       dir = (t > 0) ? 1 : -1;
-               } else  dir = tmcomp(&mytm, &yourtm);
-               if (dir != 0) {
-                       if (t == lo) {
-                               ++t;
-                               if (t <= lo)
-                                       return WRONG;
-                               ++lo;
-                       } else if (t == hi) {
-                               --t;
-                               if (t >= hi)
-                                       return WRONG;
-                               --hi;
-                       }
-                       if (lo > hi)
-                               return WRONG;
-                       if (dir > 0)
-                               hi = t;
-                       else    lo = t;
-                       continue;
-               }
-               if (yourtm.tm_isdst < 0 || mytm.tm_isdst == yourtm.tm_isdst)
-                       break;
-               /*
-               ** Right time, wrong type.
-               ** Hunt for right time, right type.
-               ** It's okay to guess wrong since the guess
-               ** gets checked.
-               */
-               /*
-               ** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's.
-               */
-               sp = (const struct state *)
-                       (((void *) funcp == (void *) localsub) ?
-                       lclptr : gmtptr);
-#ifdef ALL_STATE
-               if (sp == NULL)
-                       return WRONG;
-#endif /* defined ALL_STATE */
-               for (i = sp->typecnt - 1; i >= 0; --i) {
-                       if (sp->ttis[i].tt_isdst != yourtm.tm_isdst)
-                               continue;
-                       for (j = sp->typecnt - 1; j >= 0; --j) {
-                               if (sp->ttis[j].tt_isdst == yourtm.tm_isdst)
-                                       continue;
-                               newt = t + sp->ttis[j].tt_gmtoff -
-                                       sp->ttis[i].tt_gmtoff;
-                               if ((*funcp)(&newt, offset, &mytm) == NULL)
-                                       continue;
-                               if (tmcomp(&mytm, &yourtm) != 0)
-                                       continue;
-                               if (mytm.tm_isdst != yourtm.tm_isdst)
-                                       continue;
-                               /*
-                               ** We have a match.
-                               */
-                               t = newt;
-                               goto label;
-                       }
-               }
-               return WRONG;
-       }
-label:
-       newt = t + saved_seconds;
-       if ((newt < t) != (saved_seconds < 0))
-               return WRONG;
-       t = newt;
-       if ((*funcp)(&t, offset, tmp))
-               *okayp = TRUE;
-       return t;
-}
-
-static time_t
-time2(tmp, funcp, offset, okayp)
-struct tm * const      tmp;
-struct tm * (* const   funcp) P((const time_t*, long, struct tm*));
-const long             offset;
-int * const            okayp;
-{
-       time_t  t;
-
-       /*
-       ** First try without normalization of seconds
-       ** (in case tm_sec contains a value associated with a leap second).
-       ** If that fails, try with normalization of seconds.
-       */
-       t = time2sub(tmp, funcp, offset, okayp, FALSE);
-       return *okayp ? t : time2sub(tmp, funcp, offset, okayp, TRUE);
-}
-
-static time_t
-time1(tmp, funcp, offset)
-struct tm * const      tmp;
-struct tm * (* const   funcp) P((const time_t *, long, struct tm *));
-const long             offset;
-{
-       register time_t                 t;
-       register const struct state *   sp;
-       register int                    samei, otheri;
-       register int                    sameind, otherind;
-       register int                    i;
-       register int                    nseen;
-       int                             seen[TZ_MAX_TYPES];
-       int                             types[TZ_MAX_TYPES];
-       int                             okay;
-
-       if (tmp->tm_isdst > 1)
-               tmp->tm_isdst = 1;
-       t = time2(tmp, funcp, offset, &okay);
-#ifdef PCTS
-       /*
-       ** PCTS code courtesy Grant Sullivan.
-       */
-       if (okay)
-               return t;
-       if (tmp->tm_isdst < 0)
-               tmp->tm_isdst = 0;      /* reset to std and try again */
-#endif /* defined PCTS */
-#ifndef PCTS
-       if (okay || tmp->tm_isdst < 0)
-               return t;
-#endif /* !defined PCTS */
-       /*
-       ** We're supposed to assume that somebody took a time of one type
-       ** and did some math on it that yielded a "struct tm" that's bad.
-       ** We try to divine the type they started from and adjust to the
-       ** type they need.
-       */
-       /*
-       ** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's.
-       */
-       sp = (const struct state *) (((void *) funcp == (void *) localsub) ?
-               lclptr : gmtptr);
-#ifdef ALL_STATE
-       if (sp == NULL)
-               return WRONG;
-#endif /* defined ALL_STATE */
-       for (i = 0; i < sp->typecnt; ++i)
-               seen[i] = FALSE;
-       nseen = 0;
-       for (i = sp->timecnt - 1; i >= 0; --i)
-               if (!seen[sp->types[i]]) {
-                       seen[sp->types[i]] = TRUE;
-                       types[nseen++] = sp->types[i];
-               }
-       for (sameind = 0; sameind < nseen; ++sameind) {
-               samei = types[sameind];
-               if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
-                       continue;
-               for (otherind = 0; otherind < nseen; ++otherind) {
-                       otheri = types[otherind];
-                       if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
-                               continue;
-                       tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
-                                       sp->ttis[samei].tt_gmtoff;
-                       tmp->tm_isdst = !tmp->tm_isdst;
-                       t = time2(tmp, funcp, offset, &okay);
-                       if (okay)
-                               return t;
-                       tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
-                                       sp->ttis[samei].tt_gmtoff;
-                       tmp->tm_isdst = !tmp->tm_isdst;
-               }
-       }
-       return WRONG;
-}
-
-time_t
-mktime(tmp)
-struct tm * const      tmp;
-{
-       tzset();
-       return time1(tmp, localsub, 0L);
-}
-
-#ifdef STD_INSPIRED
-
-time_t
-timelocal(tmp)
-struct tm * const      tmp;
-{
-       tmp->tm_isdst = -1;     /* in case it wasn't initialized */
-       return mktime(tmp);
-}
-
-time_t
-timegm(tmp)
-struct tm * const      tmp;
-{
-       tmp->tm_isdst = 0;
-       return time1(tmp, gmtsub, 0L);
-}
-
-time_t
-timeoff(tmp, offset)
-struct tm * const      tmp;
-const long             offset;
-{
-       tmp->tm_isdst = 0;
-       return time1(tmp, gmtsub, offset);
-}
-
-#endif /* defined STD_INSPIRED */
-
-#ifdef CMUCS
-
-/*
-** The following is supplied for compatibility with
-** previous versions of the CMUCS runtime library.
-*/
-
-long
-gtime(tmp)
-struct tm * const      tmp;
-{
-       const time_t    t = mktime(tmp);
-
-       if (t == WRONG)
-               return -1;
-       return t;
-}
-
-#endif /* defined CMUCS */
-
-/*
-** XXX--is the below the right way to conditionalize??
-*/
-
-#ifdef STD_INSPIRED
-
-/*
-** IEEE Std 1003.1-1988 (POSIX) legislates that 536457599
-** shall correspond to "Wed Dec 31 23:59:59 UTC 1986", which
-** is not the case if we are accounting for leap seconds.
-** So, we provide the following conversion routines for use
-** when exchanging timestamps with POSIX conforming systems.
-*/
-
-static long
-leapcorr(timep)
-time_t *       timep;
-{
-       register struct state *         sp;
-       register struct lsinfo *        lp;
-       register int                    i;
-
-       sp = lclptr;
-       i = sp->leapcnt;
-       while (--i >= 0) {
-               lp = &sp->lsis[i];
-               if (*timep >= lp->ls_trans)
-                       return lp->ls_corr;
-       }
-       return 0;
-}
-
-time_t
-time2posix(t)
-time_t t;
-{
-       tzset();
-       return t - leapcorr(&t);
-}
-
-time_t
-posix2time(t)
-time_t t;
-{
-       time_t  x;
-       time_t  y;
-
-       tzset();
-       /*
-       ** For a positive leap second hit, the result
-       ** is not unique. For a negative leap second
-       ** hit, the corresponding time doesn't exist,
-       ** so we return an adjacent second.
-       */
-       x = t + leapcorr(&t);
-       y = x - leapcorr(&x);
-       if (y < t) {
-               do {
-                       x++;
-                       y = x - leapcorr(&x);
-               } while (y < t);
-               if (t != y)
-                       return x - 1;
-       } else if (y > t) {
-               do {
-                       --x;
-                       y = x - leapcorr(&x);
-               } while (y > t);
-               if (t != y)
-                       return x + 1;
-       }
-       return x;
-}
-
-#endif /* defined STD_INSPIRED */
diff --git a/lib/libc/stdtime/logwtmp.c b/lib/libc/stdtime/logwtmp.c
deleted file mode 100644 (file)
index d41f8e1..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#ifndef lint
-#ifndef NOID
-/* As received from UCB, with include reordering and OLD_TIME condition. */
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-/*
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that the above copyright notice and this paragraph are
- * duplicated in all such forms and that any documentation,
- * advertising materials, and other materials related to such
- * distribution and use acknowledge that the software was developed
- * by the University of California, Berkeley.  The name of the
- * University may not be used to endorse or promote products derived
- * from this software without specific prior written permission.
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
- * WARRANTIES OF MERCHANT[A]BILITY AND FITNESS FOR A PARTICULAR PURPOSE.
- */
-
-#ifndef lint
-#ifdef LIBC_SCCS
-static char sccsid[] = "@(#)logwtmp.c  5.2 (Berkeley) 9/20/88";
-#endif /* defined LIBC_SCCS */
-#endif /* !defined lint */
-
-#include <sys/types.h>
-#include <time.h>
-#include <utmp.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-
-#ifdef OLD_TIME
-
-char dummy_to_keep_linker_happy;
-
-#endif /* defined OLD_TIME */
-
-#ifndef OLD_TIME
-
-#include <sys/file.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-
-#define WTMPFILE       "/usr/adm/wtmp"
-
-void logwtmp( char *line, char *name, char *host)
-{
-       struct utmp ut;
-       struct stat buf;
-       int fd;
-
-       if ((fd = open(WTMPFILE, O_WRONLY|O_APPEND, 0)) < 0)
-               return;
-       if (!fstat(fd, &buf)) {
-               (void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
-               (void)strncpy(ut.ut_name, name, sizeof(ut.ut_name));
-               (void)strncpy(ut.ut_host, host, sizeof(ut.ut_host));
-               (void)time(&ut.ut_time);
-               if (write(fd, (char *)&ut, sizeof(struct utmp)) !=
-                       sizeof(struct utmp))
-                               (void)ftruncate(fd, buf.st_size);
-       }
-       (void)close(fd);
-}
-
-#endif /* !defined OLD_TIME */
diff --git a/lib/libc/stdtime/private.h b/lib/libc/stdtime/private.h
deleted file mode 100644 (file)
index 460e4eb..0000000
+++ /dev/null
@@ -1,317 +0,0 @@
-#ifndef PRIVATE_H
-
-#define PRIVATE_H
-
-/*
-** This file is in the public domain, so clarified as of
-** 1996-06-05 by Arthur David Olson.
-*/
-
-/*
-** This header is for use ONLY with the time conversion code.
-** There is no guarantee that it will remain unchanged,
-** or that it will remain at all.
-** Do NOT copy it to any system include directory.
-** Thank you!
-*/
-
-/*
-** ID
-*/
-
-#ifndef lint
-#ifndef NOID
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-#define GRANDPARENTED  "Local time zone must be set--see zic manual page"
-
-/*
-** Defaults for preprocessor symbols.
-** You can override these in your C compiler options, e.g. `-DHAVE_ADJTIME=0'.
-*/
-
-#ifndef HAVE_ADJTIME
-#define HAVE_ADJTIME           1
-#endif /* !defined HAVE_ADJTIME */
-
-#ifndef HAVE_GETTEXT
-#define HAVE_GETTEXT           0
-#endif /* !defined HAVE_GETTEXT */
-
-#ifndef HAVE_INCOMPATIBLE_CTIME_R
-#define HAVE_INCOMPATIBLE_CTIME_R      0
-#endif /* !defined INCOMPATIBLE_CTIME_R */
-
-#ifndef HAVE_SETTIMEOFDAY
-#define HAVE_SETTIMEOFDAY      3
-#endif /* !defined HAVE_SETTIMEOFDAY */
-
-#ifndef HAVE_STRERROR
-#define HAVE_STRERROR          1
-#endif /* !defined HAVE_STRERROR */
-
-#ifndef HAVE_SYMLINK
-#define HAVE_SYMLINK           1
-#endif /* !defined HAVE_SYMLINK */
-
-#ifndef HAVE_SYS_STAT_H
-#define HAVE_SYS_STAT_H                1
-#endif /* !defined HAVE_SYS_STAT_H */
-
-#ifndef HAVE_SYS_WAIT_H
-#define HAVE_SYS_WAIT_H                1
-#endif /* !defined HAVE_SYS_WAIT_H */
-
-#ifndef HAVE_UNISTD_H
-#define HAVE_UNISTD_H          1
-#endif /* !defined HAVE_UNISTD_H */
-
-#ifndef HAVE_UTMPX_H
-#define HAVE_UTMPX_H           0
-#endif /* !defined HAVE_UTMPX_H */
-
-#ifndef LOCALE_HOME
-#define LOCALE_HOME            "/usr/lib/locale"
-#endif /* !defined LOCALE_HOME */
-
-#if HAVE_INCOMPATIBLE_CTIME_R
-#define asctime_r _incompatible_asctime_r
-#define ctime_r _incompatible_ctime_r
-#endif /* HAVE_INCOMPATIBLE_CTIME_R */
-
-void logwtmp(char *, char *, char *);
-
-/*
-** Nested includes
-*/
-
-#include "sys/types.h" /* for time_t */
-#include "stdio.h"
-#include "errno.h"
-#include "string.h"
-#include "limits.h"    /* for CHAR_BIT */
-#include "time.h"
-#include "stdlib.h"
-
-#if HAVE_GETTEXT
-#include "libintl.h"
-#endif /* HAVE_GETTEXT */
-
-#if HAVE_SYS_WAIT_H
-#include <sys/wait.h>  /* for WIFEXITED and WEXITSTATUS */
-#endif /* HAVE_SYS_WAIT_H */
-
-#ifndef WIFEXITED
-#define WIFEXITED(status)      (((status) & 0xff) == 0)
-#endif /* !defined WIFEXITED */
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(status)    (((status) >> 8) & 0xff)
-#endif /* !defined WEXITSTATUS */
-
-#if HAVE_UNISTD_H
-#include "unistd.h"    /* for F_OK and R_OK */
-#endif /* HAVE_UNISTD_H */
-
-#if !HAVE_UNISTD_H
-#ifndef F_OK
-#define F_OK   0
-#endif /* !defined F_OK */
-#ifndef R_OK
-#define R_OK   4
-#endif /* !defined R_OK */
-#endif /* !HAVE_UNISTD_H */
-
-/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
-#define is_digit(c) ((unsigned)(c) - '0' <= 9)
-
-/*
-** Workarounds for compilers/systems.
-*/
-
-/*
-** SunOS 4.1.1 cc lacks prototypes.
-*/
-
-#ifndef P
-#if __STDC__
-#define P(x)   x
-#else /* !__STDC__ */
-#define P(x)   ()
-#endif /* !__STDC__ */
-#endif /* !defined P */
-
-/*
-** SunOS 4.1.1 headers lack EXIT_SUCCESS.
-*/
-
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS   0
-#endif /* !defined EXIT_SUCCESS */
-
-/*
-** SunOS 4.1.1 headers lack EXIT_FAILURE.
-*/
-
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE   1
-#endif /* !defined EXIT_FAILURE */
-
-/*
-** SunOS 4.1.1 headers lack FILENAME_MAX.
-*/
-
-#ifndef FILENAME_MAX
-
-#ifndef MAXPATHLEN
-#ifdef unix
-#include "sys/param.h"
-#endif /* defined unix */
-#endif /* !defined MAXPATHLEN */
-
-#ifdef MAXPATHLEN
-#define FILENAME_MAX   MAXPATHLEN
-#endif /* defined MAXPATHLEN */
-#ifndef MAXPATHLEN
-#define FILENAME_MAX   1024            /* Pure guesswork */
-#endif /* !defined MAXPATHLEN */
-
-#endif /* !defined FILENAME_MAX */
-
-/*
-** SunOS 4.1.1 libraries lack remove.
-*/
-
-#ifndef remove
-extern int     unlink P((const char * filename));
-#define remove unlink
-#endif /* !defined remove */
-
-/*
-** Some ancient errno.h implementations don't declare errno.
-** But some newer errno.h implementations define it as a macro.
-** Fix the former without affecting the latter.
-*/
-
-#ifndef errno
-extern int errno;
-#endif /* !defined errno */
-
-/*
-** Some time.h implementations don't declare asctime_r.
-** Others might define it as a macro.
-** Fix the former without affecting the latter.
-*/
-
-#ifndef asctime_r
-extern char *  asctime_r(register const struct tm *, char *);
-#endif
-
-/*
-** Private function declarations.
-*/
-
-char * icalloc P((int nelem, int elsize));
-char * icatalloc P((char * old, const char * new));
-char * icpyalloc P((const char * string));
-char * imalloc P((int n));
-void * irealloc P((void * pointer, int size));
-void   icfree P((char * pointer));
-void   ifree P((char * pointer));
-const char *scheck P((const char *string, const char *format));
-
-/*
-** Finally, some convenience items.
-*/
-
-#ifndef TRUE
-#define TRUE   1
-#endif /* !defined TRUE */
-
-#ifndef FALSE
-#define FALSE  0
-#endif /* !defined FALSE */
-
-#ifndef TYPE_BIT
-#define TYPE_BIT(type) (sizeof (type) * CHAR_BIT)
-#endif /* !defined TYPE_BIT */
-
-#ifndef TYPE_SIGNED
-#define TYPE_SIGNED(type) (((type) -1) < 0)
-#endif /* !defined TYPE_SIGNED */
-
-/*
-** Since the definition of TYPE_INTEGRAL contains floating point numbers,
-** it cannot be used in preprocessor directives.
-*/
-
-#ifndef TYPE_INTEGRAL
-#define TYPE_INTEGRAL(type) (((type) 0.5) != 0.5)
-#endif /* !defined TYPE_INTEGRAL */
-
-#ifndef INT_STRLEN_MAXIMUM
-/*
-** 302 / 1000 is log10(2.0) rounded up.
-** Subtract one for the sign bit if the type is signed;
-** add one for integer division truncation;
-** add one more for a minus sign if the type is signed.
-*/
-#define INT_STRLEN_MAXIMUM(type) \
-       ((TYPE_BIT(type) - TYPE_SIGNED(type)) * 302 / 1000 + \
-       1 + TYPE_SIGNED(type))
-#endif /* !defined INT_STRLEN_MAXIMUM */
-
-/*
-** INITIALIZE(x)
-*/
-
-#ifndef GNUC_or_lint
-#ifdef lint
-#define GNUC_or_lint
-#endif /* defined lint */
-#ifndef lint
-#ifdef __GNUC__
-#define GNUC_or_lint
-#endif /* defined __GNUC__ */
-#endif /* !defined lint */
-#endif /* !defined GNUC_or_lint */
-
-#ifndef INITIALIZE
-#ifdef GNUC_or_lint
-#define INITIALIZE(x)  ((x) = 0)
-#endif /* defined GNUC_or_lint */
-#ifndef GNUC_or_lint
-#define INITIALIZE(x)
-#endif /* !defined GNUC_or_lint */
-#endif /* !defined INITIALIZE */
-
-/*
-** For the benefit of GNU folk...
-** `_(MSGID)' uses the current locale's message library string for MSGID.
-** The default is to use gettext if available, and use MSGID otherwise.
-*/
-
-#ifndef _
-#if HAVE_GETTEXT
-#define _(msgid) gettext(msgid)
-#else /* !HAVE_GETTEXT */
-#define _(msgid) msgid
-#endif /* !HAVE_GETTEXT */
-#endif /* !defined _ */
-
-#ifndef TZ_DOMAIN
-#define TZ_DOMAIN "tz"
-#endif /* !defined TZ_DOMAIN */
-
-#if HAVE_INCOMPATIBLE_CTIME_R
-#undef asctime_r
-#undef ctime_r
-char *asctime_r P((struct tm const *, char *));
-char *ctime_r P((time_t const *, char *));
-#endif /* HAVE_INCOMPATIBLE_CTIME_R */
-
-/*
-** UNIX was a registered trademark of The Open Group in 2003.
-*/
-
-#endif /* !defined PRIVATE_H */
diff --git a/lib/libc/stdtime/scheck.c b/lib/libc/stdtime/scheck.c
deleted file mode 100644 (file)
index 9a37c2b..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-
-/*LINTLIBRARY*/
-
-#include <string.h>
-#include <stdlib.h>
-
-#include "stdio.h"
-
-#ifndef lint
-#ifndef NOID
-static char    sccsid[] = "@(#)scheck.c        7.15";
-#endif /* !NOID */
-#endif /* !lint */
-
-#include "ctype.h"
-#include "private.h"
-
-const char *
-scheck(string, format)
-const char *   string;
-const char *   format;
-{
-       register char * fbuf;
-       register char * fp;
-       register char * tp;
-       register int    c;
-       register char * result;
-       char            dummy;
-
-       result = "";
-       if (string == NULL || format == NULL)
-               return result;
-       fbuf = imalloc(2 * strlen(format) + 4);
-       if (fbuf == NULL)
-               return result;
-       fp = (char *) format;
-       tp = (char *) fbuf;
-       while ((*tp++ = c = *fp++) != '\0') {
-               if (c != '%')
-                       continue;
-               if (*fp == '%') {
-                       *tp++ = *fp++;
-                       continue;
-               }
-               *tp++ = '*';
-               if (*fp == '*')
-                       ++fp;
-               while (isascii(*fp) && isdigit(*fp))
-                       *tp++ = *fp++;
-               if (*fp == 'l' || *fp == 'h')
-                       *tp++ = *fp++;
-               else if (*fp == '[')
-                       do *tp++ = *fp++;
-                               while (*fp != '\0' && *fp != ']');
-               if ((*tp++ = *fp++) == '\0')
-                       break;
-       }
-       *(tp - 1) = '%';
-       *tp++ = 'c';
-       *tp = '\0';
-       if (sscanf(string, fbuf, &dummy) != 1)
-               result = (char *) format;
-       free(fbuf);
-       return result;
-}
diff --git a/lib/libc/stdtime/strftime.c b/lib/libc/stdtime/strftime.c
deleted file mode 100644 (file)
index 892d742..0000000
+++ /dev/null
@@ -1,760 +0,0 @@
-#ifndef lint
-#ifndef NOID
-/*
-** Based on the UCB version with the ID appearing below.
-** This is ANSIish only when "multibyte character == plain character".
-*/
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
-#include "private.h"
-
-/*
-** Copyright (c) 1989 The Regents of the University of California.
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms are permitted
-** provided that the above copyright notice and this paragraph are
-** duplicated in all such forms and that any documentation,
-** advertising materials, and other materials related to such
-** distribution and use acknowledge that the software was developed
-** by the University of California, Berkeley. The name of the
-** University may not be used to endorse or promote products derived
-** from this software without specific prior written permission.
-** THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
-** IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-*/
-
-#ifndef LIBC_SCCS
-#ifndef lint
-static const char      sccsid[] = "@(#)strftime.c      5.4 (Berkeley) 3/14/89";
-#endif /* !defined lint */
-#endif /* !defined LIBC_SCCS */
-
-#include "tzfile.h"
-#include "fcntl.h"
-#include "locale.h"
-
-struct lc_time_T {
-       const char *    mon[MONSPERYEAR];
-       const char *    month[MONSPERYEAR];
-       const char *    wday[DAYSPERWEEK];
-       const char *    weekday[DAYSPERWEEK];
-       const char *    X_fmt;
-       const char *    x_fmt;
-       const char *    c_fmt;
-       const char *    am;
-       const char *    pm;
-       const char *    date_fmt;
-};
-
-#ifdef LOCALE_HOME
-#include "sys/stat.h"
-static struct lc_time_T                localebuf;
-static struct lc_time_T *      _loc P((void));
-#define Locale _loc()
-#endif /* defined LOCALE_HOME */
-#ifndef LOCALE_HOME
-#define Locale (&C_time_locale)
-#endif /* !defined LOCALE_HOME */
-
-static const struct lc_time_T  C_time_locale = {
-       {
-               "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-       }, {
-               "January", "February", "March", "April", "May", "June",
-               "July", "August", "September", "October", "November", "December"
-       }, {
-               "Sun", "Mon", "Tue", "Wed",
-               "Thu", "Fri", "Sat"
-       }, {
-               "Sunday", "Monday", "Tuesday", "Wednesday",
-               "Thursday", "Friday", "Saturday"
-       },
-
-       /* X_fmt */
-       "%H:%M:%S",
-
-       /*
-       ** x_fmt
-       ** C99 requires this format.
-       ** Using just numbers (as here) makes Quakers happier;
-       ** it's also compatible with SVR4.
-       */
-       "%m/%d/%y",
-
-       /*
-       ** c_fmt
-       ** C99 requires this format.
-       ** Previously this code used "%D %X", but we now conform to C99.
-       ** Note that
-       **      "%a %b %d %H:%M:%S %Y"
-       ** is used by Solaris 2.3.
-       */
-       "%a %b %e %T %Y",
-
-       /* am */
-       "AM",
-
-       /* pm */
-       "PM",
-
-       /* date_fmt */
-       "%a %b %e %H:%M:%S %Z %Y"
-};
-
-static char *  _add P((const char *, char *, const char *));
-static char *  _conv P((int, const char *, char *, const char *));
-static char *  _fmt P((const char *, const struct tm *, char *, const char *,
-                       int *));
-static char *  _yconv P((int, int, int, int, char *, const char *));
-
-extern char *  tzname[];
-
-#ifndef YEAR_2000_NAME
-#define YEAR_2000_NAME "CHECK_STRFTIME_FORMATS_FOR_TWO_DIGIT_YEARS"
-#endif /* !defined YEAR_2000_NAME */
-
-#define IN_NONE        0
-#define IN_SOME        1
-#define IN_THIS        2
-#define IN_ALL 3
-
-size_t
-strftime(s, maxsize, format, t)
-char * const           s;
-const size_t           maxsize;
-const char * const     format;
-const struct tm * const        t;
-{
-       char *  p;
-       int     warn;
-
-       tzset();
-#ifdef LOCALE_HOME
-       localebuf.mon[0] = 0;
-#endif /* defined LOCALE_HOME */
-       warn = IN_NONE;
-       p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn);
-#ifndef NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU
-       if (warn != IN_NONE && getenv(YEAR_2000_NAME) != NULL) {
-               (void) fprintf(stderr, "\n");
-               if (format == NULL)
-                       (void) fprintf(stderr, "NULL strftime format ");
-               else    (void) fprintf(stderr, "strftime format \"%s\" ",
-                               format);
-               (void) fprintf(stderr, "yields only two digits of years in ");
-               if (warn == IN_SOME)
-                       (void) fprintf(stderr, "some locales");
-               else if (warn == IN_THIS)
-                       (void) fprintf(stderr, "the current locale");
-               else    (void) fprintf(stderr, "all locales");
-               (void) fprintf(stderr, "\n");
-       }
-#endif /* !defined NO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU */
-       if (p == s + maxsize)
-               return 0;
-       *p = '\0';
-       return p - s;
-}
-
-static char *
-_fmt(format, t, pt, ptlim, warnp)
-const char *           format;
-const struct tm * const        t;
-char *                 pt;
-const char * const     ptlim;
-int *                  warnp;
-{
-       for ( ; *format; ++format) {
-               if (*format == '%') {
-label:
-                       switch (*++format) {
-                       case '\0':
-                               --format;
-                               break;
-                       case 'A':
-                               pt = _add((t->tm_wday < 0 ||
-                                       t->tm_wday >= DAYSPERWEEK) ?
-                                       "?" : Locale->weekday[t->tm_wday],
-                                       pt, ptlim);
-                               continue;
-                       case 'a':
-                               pt = _add((t->tm_wday < 0 ||
-                                       t->tm_wday >= DAYSPERWEEK) ?
-                                       "?" : Locale->wday[t->tm_wday],
-                                       pt, ptlim);
-                               continue;
-                       case 'B':
-                               pt = _add((t->tm_mon < 0 ||
-                                       t->tm_mon >= MONSPERYEAR) ?
-                                       "?" : Locale->month[t->tm_mon],
-                                       pt, ptlim);
-                               continue;
-                       case 'b':
-                       case 'h':
-                               pt = _add((t->tm_mon < 0 ||
-                                       t->tm_mon >= MONSPERYEAR) ?
-                                       "?" : Locale->mon[t->tm_mon],
-                                       pt, ptlim);
-                               continue;
-                       case 'C':
-                               /*
-                               ** %C used to do a...
-                               **      _fmt("%a %b %e %X %Y", t);
-                               ** ...whereas now POSIX 1003.2 calls for
-                               ** something completely different.
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 0,
-                                       pt, ptlim);
-                               continue;
-                       case 'c':
-                               {
-                               int warn2 = IN_SOME;
-
-                               pt = _fmt(Locale->c_fmt, t, pt, ptlim, warnp);
-                               if (warn2 == IN_ALL)
-                                       warn2 = IN_THIS;
-                               if (warn2 > *warnp)
-                                       *warnp = warn2;
-                               }
-                               continue;
-                       case 'D':
-                               pt = _fmt("%m/%d/%y", t, pt, ptlim, warnp);
-                               continue;
-                       case 'd':
-                               pt = _conv(t->tm_mday, "%02d", pt, ptlim);
-                               continue;
-                       case 'E':
-                       case 'O':
-                               /*
-                               ** C99 locale modifiers.
-                               ** The sequences
-                               **      %Ec %EC %Ex %EX %Ey %EY
-                               **      %Od %oe %OH %OI %Om %OM
-                               **      %OS %Ou %OU %OV %Ow %OW %Oy
-                               ** are supposed to provide alternate
-                               ** representations.
-                               */
-                               goto label;
-                       case 'e':
-                               pt = _conv(t->tm_mday, "%2d", pt, ptlim);
-                               continue;
-                       case 'F':
-                               pt = _fmt("%Y-%m-%d", t, pt, ptlim, warnp);
-                               continue;
-                       case 'H':
-                               pt = _conv(t->tm_hour, "%02d", pt, ptlim);
-                               continue;
-                       case 'I':
-                               pt = _conv((t->tm_hour % 12) ?
-                                       (t->tm_hour % 12) : 12,
-                                       "%02d", pt, ptlim);
-                               continue;
-                       case 'j':
-                               pt = _conv(t->tm_yday + 1, "%03d", pt, ptlim);
-                               continue;
-                       case 'k':
-                               /*
-                               ** This used to be...
-                               **      _conv(t->tm_hour % 12 ?
-                               **              t->tm_hour % 12 : 12, 2, ' ');
-                               ** ...and has been changed to the below to
-                               ** match SunOS 4.1.1 and Arnold Robbins'
-                               ** strftime version 3.0. That is, "%k" and
-                               ** "%l" have been swapped.
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _conv(t->tm_hour, "%2d", pt, ptlim);
-                               continue;
-#ifdef KITCHEN_SINK
-                       case 'K':
-                               /*
-                               ** After all this time, still unclaimed!
-                               */
-                               pt = _add("kitchen sink", pt, ptlim);
-                               continue;
-#endif /* defined KITCHEN_SINK */
-                       case 'l':
-                               /*
-                               ** This used to be...
-                               **      _conv(t->tm_hour, 2, ' ');
-                               ** ...and has been changed to the below to
-                               ** match SunOS 4.1.1 and Arnold Robbin's
-                               ** strftime version 3.0. That is, "%k" and
-                               ** "%l" have been swapped.
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _conv((t->tm_hour % 12) ?
-                                       (t->tm_hour % 12) : 12,
-                                       "%2d", pt, ptlim);
-                               continue;
-                       case 'M':
-                               pt = _conv(t->tm_min, "%02d", pt, ptlim);
-                               continue;
-                       case 'm':
-                               pt = _conv(t->tm_mon + 1, "%02d", pt, ptlim);
-                               continue;
-                       case 'n':
-                               pt = _add("\n", pt, ptlim);
-                               continue;
-                       case 'p':
-                               pt = _add((t->tm_hour >= (HOURSPERDAY / 2)) ?
-                                       Locale->pm :
-                                       Locale->am,
-                                       pt, ptlim);
-                               continue;
-                       case 'R':
-                               pt = _fmt("%H:%M", t, pt, ptlim, warnp);
-                               continue;
-                       case 'r':
-                               pt = _fmt("%I:%M:%S %p", t, pt, ptlim, warnp);
-                               continue;
-                       case 'S':
-                               pt = _conv(t->tm_sec, "%02d", pt, ptlim);
-                               continue;
-                       case 's':
-                               {
-                                       struct tm       tm;
-                                       char            buf[INT_STRLEN_MAXIMUM(
-                                                               time_t) + 1];
-                                       time_t          mkt;
-
-                                       tm = *t;
-                                       mkt = mktime(&tm);
-                                       if (TYPE_SIGNED(time_t))
-                                               (void) sprintf(buf, "%ld",
-                                                       (long) mkt);
-                                       else    (void) sprintf(buf, "%lu",
-                                                       (unsigned long) mkt);
-                                       pt = _add(buf, pt, ptlim);
-                               }
-                               continue;
-                       case 'T':
-                               pt = _fmt("%H:%M:%S", t, pt, ptlim, warnp);
-                               continue;
-                       case 't':
-                               pt = _add("\t", pt, ptlim);
-                               continue;
-                       case 'U':
-                               pt = _conv((t->tm_yday + DAYSPERWEEK -
-                                       t->tm_wday) / DAYSPERWEEK,
-                                       "%02d", pt, ptlim);
-                               continue;
-                       case 'u':
-                               /*
-                               ** From Arnold Robbins' strftime version 3.0:
-                               ** "ISO 8601: Weekday as a decimal number
-                               ** [1 (Monday) - 7]"
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _conv((t->tm_wday == 0) ?
-                                       DAYSPERWEEK : t->tm_wday,
-                                       "%d", pt, ptlim);
-                               continue;
-                       case 'V':       /* ISO 8601 week number */
-                       case 'G':       /* ISO 8601 year (four digits) */
-                       case 'g':       /* ISO 8601 year (two digits) */
-/*
-** From Arnold Robbins' strftime version 3.0: "the week number of the
-** year (the first Monday as the first day of week 1) as a decimal number
-** (01-53)."
-** (ado, 1993-05-24)
-**
-** From "http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html" by Markus Kuhn:
-** "Week 01 of a year is per definition the first week which has the
-** Thursday in this year, which is equivalent to the week which contains
-** the fourth day of January. In other words, the first week of a new year
-** is the week which has the majority of its days in the new year. Week 01
-** might also contain days from the previous year and the week before week
-** 01 of a year is the last week (52 or 53) of the previous year even if
-** it contains days from the new year. A week starts with Monday (day 1)
-** and ends with Sunday (day 7). For example, the first week of the year
-** 1997 lasts from 1996-12-30 to 1997-01-05..."
-** (ado, 1996-01-02)
-*/
-                               {
-                                       int     year;
-                                       int     base;
-                                       int     yday;
-                                       int     wday;
-                                       int     w;
-
-                                       year = t->tm_year;
-                                       base = TM_YEAR_BASE;
-                                       yday = t->tm_yday;
-                                       wday = t->tm_wday;
-                                       for ( ; ; ) {
-                                               int     len;
-                                               int     bot;
-                                               int     top;
-
-                                               len = isleap_sum(year, base) ?
-                                                       DAYSPERLYEAR :
-                                                       DAYSPERNYEAR;
-                                               /*
-                                               ** What yday (-3 ... 3) does
-                                               ** the ISO year begin on?
-                                               */
-                                               bot = ((yday + 11 - wday) %
-                                                       DAYSPERWEEK) - 3;
-                                               /*
-                                               ** What yday does the NEXT
-                                               ** ISO year begin on?
-                                               */
-                                               top = bot -
-                                                       (len % DAYSPERWEEK);
-                                               if (top < -3)
-                                                       top += DAYSPERWEEK;
-                                               top += len;
-                                               if (yday >= top) {
-                                                       ++base;
-                                                       w = 1;
-                                                       break;
-                                               }
-                                               if (yday >= bot) {
-                                                       w = 1 + ((yday - bot) /
-                                                               DAYSPERWEEK);
-                                                       break;
-                                               }
-                                               --base;
-                                               yday += isleap_sum(year, base) ?
-                                                       DAYSPERLYEAR :
-                                                       DAYSPERNYEAR;
-                                       }
-#ifdef XPG4_1994_04_09
-                                       if ((w == 52 &&
-                                               t->tm_mon == TM_JANUARY) ||
-                                               (w == 1 &&
-                                               t->tm_mon == TM_DECEMBER))
-                                                       w = 53;
-#endif /* defined XPG4_1994_04_09 */
-                                       if (*format == 'V')
-                                               pt = _conv(w, "%02d",
-                                                       pt, ptlim);
-                                       else if (*format == 'g') {
-                                               *warnp = IN_ALL;
-                                               pt = _yconv(year, base, 0, 1,
-                                                       pt, ptlim);
-                                       } else  pt = _yconv(year, base, 1, 1,
-                                                       pt, ptlim);
-                               }
-                               continue;
-                       case 'v':
-                               /*
-                               ** From Arnold Robbins' strftime version 3.0:
-                               ** "date as dd-bbb-YYYY"
-                               ** (ado, 1993-05-24)
-                               */
-                               pt = _fmt("%e-%b-%Y", t, pt, ptlim, warnp);
-                               continue;
-                       case 'W':
-                               pt = _conv((t->tm_yday + DAYSPERWEEK -
-                                       (t->tm_wday ?
-                                       (t->tm_wday - 1) :
-                                       (DAYSPERWEEK - 1))) / DAYSPERWEEK,
-                                       "%02d", pt, ptlim);
-                               continue;
-                       case 'w':
-                               pt = _conv(t->tm_wday, "%d", pt, ptlim);
-                               continue;
-                       case 'X':
-                               pt = _fmt(Locale->X_fmt, t, pt, ptlim, warnp);
-                               continue;
-                       case 'x':
-                               {
-                               int     warn2 = IN_SOME;
-
-                               pt = _fmt(Locale->x_fmt, t, pt, ptlim, &warn2);
-                               if (warn2 == IN_ALL)
-                                       warn2 = IN_THIS;
-                               if (warn2 > *warnp)
-                                       *warnp = warn2;
-                               }
-                               continue;
-                       case 'y':
-                               *warnp = IN_ALL;
-                               pt = _yconv(t->tm_year, TM_YEAR_BASE, 0, 1,
-                                       pt, ptlim);
-                               continue;
-                       case 'Y':
-                               pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1,
-                                       pt, ptlim);
-                               continue;
-                       case 'Z':
-#ifdef TM_ZONE
-                               if (t->TM_ZONE != NULL)
-                                       pt = _add(t->TM_ZONE, pt, ptlim);
-                               else
-#endif /* defined TM_ZONE */
-                               if (t->tm_isdst >= 0)
-                                       pt = _add(tzname[t->tm_isdst != 0],
-                                               pt, ptlim);
-                               /*
-                               ** C99 says that %Z must be replaced by the
-                               ** empty string if the time zone is not
-                               ** determinable.
-                               */
-                               continue;
-                       case 'z':
-                               {
-                               int             diff;
-                               char const *    sign;
-
-                               if (t->tm_isdst < 0)
-                                       continue;
-#ifdef TM_GMTOFF
-                               diff = t->TM_GMTOFF;
-#else /* !defined TM_GMTOFF */
-                               /*
-                               ** C99 says that the UTC offset must
-                               ** be computed by looking only at
-                               ** tm_isdst. This requirement is
-                               ** incorrect, since it means the code
-                               ** must rely on magic (in this case
-                               ** altzone and timezone), and the
-                               ** magic might not have the correct
-                               ** offset. Doing things correctly is
-                               ** tricky and requires disobeying C99;
-                               ** see GNU C strftime for details.
-                               ** For now, punt and conform to the
-                               ** standard, even though it's incorrect.
-                               **
-                               ** C99 says that %z must be replaced by the
-                               ** empty string if the time zone is not
-                               ** determinable, so output nothing if the
-                               ** appropriate variables are not available.
-                               */
-                               if (t->tm_isdst == 0)
-#ifdef USG_COMPAT
-                                       diff = -timezone;
-#else /* !defined USG_COMPAT */
-                                       continue;
-#endif /* !defined USG_COMPAT */
-                               else
-#ifdef ALTZONE
-                                       diff = -altzone;
-#else /* !defined ALTZONE */
-                                       continue;
-#endif /* !defined ALTZONE */
-#endif /* !defined TM_GMTOFF */
-                               if (diff < 0) {
-                                       sign = "-";
-                                       diff = -diff;
-                               } else  sign = "+";
-                               pt = _add(sign, pt, ptlim);
-                               diff /= SECSPERMIN;
-                               diff = (diff / MINSPERHOUR) * 100 +
-                                       (diff % MINSPERHOUR);
-                               pt = _conv(diff, "%04d", pt, ptlim);
-                               }
-                               continue;
-                       case '+':
-                               pt = _fmt(Locale->date_fmt, t, pt, ptlim,
-                                       warnp);
-                               continue;
-                       case '%':
-                       /*
-                       ** X311J/88-090 (4.12.3.5): if conversion char is
-                       ** undefined, behavior is undefined. Print out the
-                       ** character itself as printf(3) also does.
-                       */
-                       default:
-                               break;
-                       }
-               }
-               if (pt == ptlim)
-                       break;
-               *pt++ = *format;
-       }
-       return pt;
-}
-
-static char *
-_conv(n, format, pt, ptlim)
-const int              n;
-const char * const     format;
-char * const           pt;
-const char * const     ptlim;
-{
-       char    buf[INT_STRLEN_MAXIMUM(int) + 1];
-
-       (void) sprintf(buf, format, n);
-       return _add(buf, pt, ptlim);
-}
-
-static char *
-_add(str, pt, ptlim)
-const char *           str;
-char *                 pt;
-const char * const     ptlim;
-{
-       while (pt < ptlim && (*pt = *str++) != '\0')
-               ++pt;
-       return pt;
-}
-
-/*
-** POSIX and the C Standard are unclear or inconsistent about
-** what %C and %y do if the year is negative or exceeds 9999.
-** Use the convention that %C concatenated with %y yields the
-** same output as %Y, and that %Y contains at least 4 bytes,
-** with more only if necessary.
-*/
-
-static char *
-_yconv(a, b, convert_top, convert_yy, pt, ptlim)
-const int              a;
-const int              b;
-const int              convert_top;
-const int              convert_yy;
-char *                 pt;
-const char * const     ptlim;
-{
-       register int    lead;
-       register int    trail;
-
-#define DIVISOR        100
-       trail = a % DIVISOR + b % DIVISOR;
-       lead = a / DIVISOR + b / DIVISOR + trail / DIVISOR;
-       trail %= DIVISOR;
-       if (trail < 0 && lead > 0) {
-               trail += DIVISOR;
-               --lead;
-       } else if (lead < 0 && trail > 0) {
-               trail -= DIVISOR;
-               ++lead;
-       }
-       if (convert_top) {
-               if (lead == 0 && trail < 0)
-                       pt = _add("-0", pt, ptlim);
-               else    pt = _conv(lead, "%02d", pt, ptlim);
-       }
-       if (convert_yy)
-               pt = _conv(((trail < 0) ? -trail : trail), "%02d", pt, ptlim);
-       return pt;
-}
-
-#ifdef LOCALE_HOME
-static struct lc_time_T *
-_loc P((void))
-{
-       static const char       locale_home[] = LOCALE_HOME;
-       static const char       lc_time[] = "LC_TIME";
-       static char *           locale_buf;
-
-       int                     fd;
-       int                     oldsun; /* "...ain't got nothin' to do..." */
-       char *                  lbuf;
-       char *                  name;
-       char *                  p;
-       const char **           ap;
-       const char *            plim;
-       char                    filename[FILENAME_MAX];
-       struct stat             st;
-       size_t                  namesize;
-       size_t                  bufsize;
-
-       /*
-       ** Use localebuf.mon[0] to signal whether locale is already set up.
-       */
-       if (localebuf.mon[0])
-               return &localebuf;
-       name = setlocale(LC_TIME, (char *) NULL);
-       if (name == NULL || *name == '\0')
-               goto no_locale;
-       /*
-       ** If the locale name is the same as our cache, use the cache.
-       */
-       lbuf = locale_buf;
-       if (lbuf != NULL && strcmp(name, lbuf) == 0) {
-               p = lbuf;
-               for (ap = (const char **) &localebuf;
-                       ap < (const char **) (&localebuf + 1);
-                               ++ap)
-                                       *ap = p += strlen(p) + 1;
-               return &localebuf;
-       }
-       /*
-       ** Slurp the locale file into the cache.
-       */
-       namesize = strlen(name) + 1;
-       if (sizeof filename <
-               ((sizeof locale_home) + namesize + (sizeof lc_time)))
-                       goto no_locale;
-       oldsun = 0;
-       (void) sprintf(filename, "%s/%s/%s", locale_home, name, lc_time);
-       fd = open(filename, O_RDONLY);
-       if (fd < 0) {
-               /*
-               ** Old Sun systems have a different naming and data convention.
-               */
-               oldsun = 1;
-               (void) sprintf(filename, "%s/%s/%s", locale_home,
-                       lc_time, name);
-               fd = open(filename, O_RDONLY);
-               if (fd < 0)
-                       goto no_locale;
-       }
-       if (fstat(fd, &st) != 0)
-               goto bad_locale;
-       if (st.st_size <= 0)
-               goto bad_locale;
-       bufsize = namesize + st.st_size;
-       locale_buf = NULL;
-       lbuf = (lbuf == NULL) ? malloc(bufsize) : realloc(lbuf, bufsize);
-       if (lbuf == NULL)
-               goto bad_locale;
-       (void) strcpy(lbuf, name);
-       p = lbuf + namesize;
-       plim = p + st.st_size;
-       if (read(fd, p, (size_t) st.st_size) != st.st_size)
-               goto bad_lbuf;
-       if (close(fd) != 0)
-               goto bad_lbuf;
-       /*
-       ** Parse the locale file into localebuf.
-       */
-       if (plim[-1] != '\n')
-               goto bad_lbuf;
-       for (ap = (const char **) &localebuf;
-               ap < (const char **) (&localebuf + 1);
-                       ++ap) {
-                               if (p == plim)
-                                       goto bad_lbuf;
-                               *ap = p;
-                               while (*p != '\n')
-                                       ++p;
-                               *p++ = '\0';
-       }
-       if (oldsun) {
-               /*
-               ** SunOS 4 used an obsolescent format; see localdtconv(3).
-               ** c_fmt had the ``short format for dates and times together''
-               ** (SunOS 4 date, "%a %b %e %T %Z %Y" in the C locale);
-               ** date_fmt had the ``long format for dates''
-               ** (SunOS 4 strftime %C, "%A, %B %e, %Y" in the C locale).
-               ** Discard the latter in favor of the former.
-               */
-               localebuf.date_fmt = localebuf.c_fmt;
-       }
-       /*
-       ** Record the successful parse in the cache.
-       */
-       locale_buf = lbuf;
-
-       return &localebuf;
-
-bad_lbuf:
-       free(lbuf);
-bad_locale:
-       (void) close(fd);
-no_locale:
-       localebuf = C_time_locale;
-       locale_buf = NULL;
-       return &localebuf;
-}
-#endif /* defined LOCALE_HOME */
diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c
deleted file mode 100644 (file)
index 968283a..0000000
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * Copyright (c) 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of KTH 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 KTH AND ITS 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 KTH OR ITS 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. */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <ctype.h>
-#ifdef __minix
-#include <time.h>
-#include <string.h>
-#include <stdlib.h>
-#endif
-
-#ifndef __minix
-#include "roken.h"
-
-__RCSID("$Heimdal: strptime.c,v 1.2 1999/11/12 15:29:55 assar Exp $"
-        "$NetBSD: strptime.c,v 1.1.1.3 2002/09/12 12:41:42 joda Exp $");
-#endif
-
-static const char *abb_weekdays[] = {
-    "Sun",
-    "Mon",
-    "Tue",
-    "Wed",
-    "Thu",
-    "Fri",
-    "Sat",
-    NULL
-};
-
-static const char *full_weekdays[] = {
-    "Sunday",
-    "Monday",
-    "Tuesday",
-    "Wednesday",
-    "Thursday",
-    "Friday",
-    "Saturday",
-    NULL
-};
-
-static const char *abb_month[] = {
-    "Jan",
-    "Feb",
-    "Mar",
-    "Apr",
-    "May",
-    "Jun",
-    "Jul",
-    "Aug",
-    "Sep",
-    "Oct",
-    "Nov",
-    "Dec",
-    NULL
-};
-
-static const char *full_month[] = {
-    "January",
-    "February",
-    "Mars",
-    "April",
-    "May",
-    "June",
-    "July",
-    "August",
-    "September",
-    "October",
-    "November",
-    "December",
-    NULL,
-};
-
-static const char *ampm[] = {
-    "am",
-    "pm",
-    NULL
-};
-
-/*
- * Try to match `*buf' to one of the strings in `strs'.  Return the
- * index of the matching string (or -1 if none).  Also advance buf.
- */
-
-static int
-match_string (const char **buf, const char **strs)
-{
-    int i = 0;
-
-    for (i = 0; strs[i] != NULL; ++i) {
-        int len = strlen (strs[i]);
-
-        if (strncasecmp (*buf, strs[i], len) == 0) {
-            *buf += len;
-            return i;
-        }
-    }
-    return -1;
-}
-
-/*
- * tm_year is relative this year */
-
-const int tm_year_base = 1900;
-
-/*
- * Return TRUE iff `year' was a leap year.
- */
-
-static int
-is_leap_year (int year)
-{
-    return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0);
-}
-
-/*
- * Return the weekday [0,6] (0 = Sunday) of the first day of `year'
- */
-
-static int
-first_day (int year)
-{
-    int ret = 4;
-
-    for (; year > 1970; --year)
-        ret = (ret + 365 + is_leap_year (year) ? 1 : 0) % 7;
-    return ret;
-}
-
-/*
- * Set `timeptr' given `wnum' (week number [0, 53])
- */
-
-static void
-set_week_number_sun (struct tm *timeptr, int wnum)
-{
-    int fday = first_day (timeptr->tm_year + tm_year_base);
-
-    timeptr->tm_yday = wnum * 7 + timeptr->tm_wday - fday;
-    if (timeptr->tm_yday < 0) {
-        timeptr->tm_wday = fday;
-        timeptr->tm_yday = 0;
-    }
-}
-
-/*
- * Set `timeptr' given `wnum' (week number [0, 53])
- */
-
-static void
-set_week_number_mon (struct tm *timeptr, int wnum)
-{
-    int fday = (first_day (timeptr->tm_year + tm_year_base) + 6) % 7;
-
-    timeptr->tm_yday = wnum * 7 + (timeptr->tm_wday + 6) % 7 - fday;
-    if (timeptr->tm_yday < 0) {
-        timeptr->tm_wday = (fday + 1) % 7;
-        timeptr->tm_yday = 0;
-    }
-}
-
-/*
- * Set `timeptr' given `wnum' (week number [0, 53])
- */
-
-static void
-set_week_number_mon4 (struct tm *timeptr, int wnum)
-{
-    int fday = (first_day (timeptr->tm_year + tm_year_base) + 6) % 7;
-    int offset = 0;
-
-    if (fday < 4)
-        offset += 7;
-
-    timeptr->tm_yday = offset + (wnum - 1) * 7 + timeptr->tm_wday - fday;
-    if (timeptr->tm_yday < 0) {
-        timeptr->tm_wday = fday;
-        timeptr->tm_yday = 0;
-    }
-}
-
-/*
- *
- */
-
-char *
-strptime (const char *buf, const char *format, struct tm *timeptr)
-{
-    char c;
-
-    for (; (c = *format) != '\0'; ++format) {
-        char *s;
-        int ret;
-
-        if (isspace (c)) {
-            while (isspace (*buf))
-                ++buf;
-        } else if (c == '%' && format[1] != '\0') {
-            c = *++format;
-            if (c == 'E' || c == 'O')
-                c = *++format;
-            switch (c) {
-            case 'A' :
-                ret = match_string (&buf, full_weekdays);
-                if (ret < 0)
-                    return NULL;
-                timeptr->tm_wday = ret;
-                break;
-            case 'a' :
-                ret = match_string (&buf, abb_weekdays);
-                if (ret < 0)
-                    return NULL;
-                timeptr->tm_wday = ret;
-                break;
-            case 'B' :
-                ret = match_string (&buf, full_month);
-                if (ret < 0)
-                    return NULL;
-                timeptr->tm_mon = ret;
-                break;
-            case 'b' :
-            case 'h' :
-                ret = match_string (&buf, abb_month);
-                if (ret < 0)
-                    return NULL;
-                timeptr->tm_mon = ret;
-                break;
-            case 'C' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                timeptr->tm_year = (ret * 100) - tm_year_base;
-                buf = s;
-                break;
-            case 'c' :
-                abort ();
-            case 'D' :          /* %m/%d/%y */
-                s = strptime (buf, "%m/%d/%y", timeptr);
-                if (s == NULL)
-                    return NULL;
-                buf = s;
-                break;
-            case 'd' :
-            case 'e' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                timeptr->tm_mday = ret;
-                buf = s;
-                break;
-            case 'H' :
-            case 'k' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                timeptr->tm_hour = ret;
-                buf = s;
-                break;
-            case 'I' :
-            case 'l' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                if (ret == 12)
-                    timeptr->tm_hour = 0;
-                else
-                    timeptr->tm_hour = ret;
-                buf = s;
-                break;
-            case 'j' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                timeptr->tm_yday = ret - 1;
-                buf = s;
-                break;
-            case 'm' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                timeptr->tm_mon = ret - 1;
-                buf = s;
-                break;
-            case 'M' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                timeptr->tm_min = ret;
-                buf = s;
-                break;
-            case 'n' :
-                if (*buf == '\n')
-                    ++buf;
-                else
-                    return NULL;
-                break;
-            case 'p' :
-                ret = match_string (&buf, ampm);
-                if (ret < 0)
-                    return NULL;
-                if (timeptr->tm_hour == 0) {
-                    if (ret == 1)
-                        timeptr->tm_hour = 12;
-                } else
-                    timeptr->tm_hour += 12;
-                break;
-            case 'r' :          /* %I:%M:%S %p */
-                s = strptime (buf, "%I:%M:%S %p", timeptr);
-                if (s == NULL)
-                    return NULL;
-                buf = s;
-                break;
-            case 'R' :          /* %H:%M */
-                s = strptime (buf, "%H:%M", timeptr);
-                if (s == NULL)
-                    return NULL;
-                buf = s;
-                break;
-            case 'S' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                timeptr->tm_sec = ret;
-                buf = s;
-                break;
-            case 't' :
-                if (*buf == '\t')
-                    ++buf;
-                else
-                    return NULL;
-                break;
-            case 'T' :          /* %H:%M:%S */
-            case 'X' :
-                s = strptime (buf, "%H:%M:%S", timeptr);
-                if (s == NULL)
-                    return NULL;
-                buf = s;
-                break;
-            case 'u' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                timeptr->tm_wday = ret - 1;
-                buf = s;
-                break;
-            case 'w' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                timeptr->tm_wday = ret;
-                buf = s;
-                break;
-            case 'U' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                set_week_number_sun (timeptr, ret);
-                buf = s;
-                break;
-            case 'V' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                set_week_number_mon4 (timeptr, ret);
-                buf = s;
-                break;
-            case 'W' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                set_week_number_mon (timeptr, ret);
-                buf = s;
-                break;
-            case 'x' :
-                s = strptime (buf, "%Y:%m:%d", timeptr);
-                if (s == NULL)
-                    return NULL;
-                buf = s;
-                break;
-            case 'y' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                if (ret < 70)
-                    timeptr->tm_year = 100 + ret;
-                else
-                    timeptr->tm_year = ret;
-                buf = s;
-                break;
-            case 'Y' :
-                ret = strtol (buf, &s, 10);
-                if (s == buf)
-                    return NULL;
-                timeptr->tm_year = ret - tm_year_base;
-                buf = s;
-                break;
-            case 'Z' :
-                abort ();
-            case '\0' :
-                --format;
-                /* FALLTHROUGH */
-            case '%' :
-                if (*buf == '%')
-                    ++buf;
-                else
-                    return NULL;
-                break;
-            default :
-                if (*buf == '%' || *++buf == c)
-                    ++buf;
-                else
-                    return NULL;
-                break;
-            }
-        } else {
-            if (*buf == c)
-                ++buf;
-            else
-                return NULL;
-        }
-    }
-    return (char *)buf;
-}
-
diff --git a/lib/libc/stdtime/zdump.8 b/lib/libc/stdtime/zdump.8
deleted file mode 100644 (file)
index b22a129..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-.TH ZDUMP 8
-.SH NAME
-zdump \- time zone dumper
-.SH SYNOPSIS
-.B zdump
-[
-.B \-\-version
-]
-[
-.B \-v
-] [
-.B \-c
-[loyear,]hiyear ] [ zonename ... ]
-.SH DESCRIPTION
-.I Zdump
-prints the current time in each
-.I zonename
-named on the command line.
-.PP
-These options are available:
-.TP
-.BI "\-\-version"
-Output version information and exit.
-.TP
-.B \-v
-For each
-.I zonename
-on the command line,
-print the time at the lowest possible time value,
-the time one day after the lowest possible time value,
-the times both one second before and exactly at
-each detected time discontinuity,
-the time at one day less than the highest possible time value,
-and the time at the highest possible time value,
-Each line ends with
-.B isdst=1
-if the given time is Daylight Saving Time or
-.B isdst=0
-otherwise.
-.TP
-.BI "\-c " [loyear,]hiyear
-Cut off verbose output near the start of the given year(s).
-By default,
-the program cuts off verbose output near the starts of the years -500 and 2500.
-.SH LIMITATIONS
-The
-.B \-v
-option may not be used on systems with floating-point time_t values
-that are neither float nor double.
-.PP
-Time discontinuities are found by sampling the results returned by localtime
-at twelve-hour intervals.
-This works in all real-world cases;
-one can construct artificial time zones for which this fails.
-.SH "SEE ALSO"
-newctime(3), tzfile(5), zic(8)
-.\" @(#)zdump.8        7.7
diff --git a/lib/libc/stdtime/zdump.c b/lib/libc/stdtime/zdump.c
deleted file mode 100644 (file)
index fdf622d..0000000
+++ /dev/null
@@ -1,687 +0,0 @@
-static char    elsieid[] = "@(#)zdump.c        7.77";
-
-/*
-** This code has been made independent of the rest of the time
-** conversion package to increase confidence in the verification it provides.
-** You can use this code to help in verifying other implementations.
-*/
-
-#include "stdio.h"     /* for stdout, stderr, perror */
-#include "string.h"    /* for strcpy */
-#include "sys/types.h" /* for time_t */
-#include "time.h"      /* for struct tm */
-#include "stdlib.h"    /* for exit, malloc, atoi */
-#include "float.h"     /* for FLT_MAX and DBL_MAX */
-#include "ctype.h"     /* for isalpha et al. */
-#ifndef isascii
-#define isascii(x) 1
-#endif /* !defined isascii */
-
-#ifndef ZDUMP_LO_YEAR
-#define ZDUMP_LO_YEAR  (-500)
-#endif /* !defined ZDUMP_LO_YEAR */
-
-#ifndef ZDUMP_HI_YEAR
-#define ZDUMP_HI_YEAR  2500
-#endif /* !defined ZDUMP_HI_YEAR */
-
-#ifndef MAX_STRING_LENGTH
-#define MAX_STRING_LENGTH      1024
-#endif /* !defined MAX_STRING_LENGTH */
-
-#ifndef TRUE
-#define TRUE           1
-#endif /* !defined TRUE */
-
-#ifndef FALSE
-#define FALSE          0
-#endif /* !defined FALSE */
-
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS   0
-#endif /* !defined EXIT_SUCCESS */
-
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE   1
-#endif /* !defined EXIT_FAILURE */
-
-#ifndef SECSPERMIN
-#define SECSPERMIN     60
-#endif /* !defined SECSPERMIN */
-
-#ifndef MINSPERHOUR
-#define MINSPERHOUR    60
-#endif /* !defined MINSPERHOUR */
-
-#ifndef SECSPERHOUR
-#define SECSPERHOUR    (SECSPERMIN * MINSPERHOUR)
-#endif /* !defined SECSPERHOUR */
-
-#ifndef HOURSPERDAY
-#define HOURSPERDAY    24
-#endif /* !defined HOURSPERDAY */
-
-#ifndef EPOCH_YEAR
-#define EPOCH_YEAR     1970
-#endif /* !defined EPOCH_YEAR */
-
-#ifndef TM_YEAR_BASE
-#define TM_YEAR_BASE   1900
-#endif /* !defined TM_YEAR_BASE */
-
-#ifndef DAYSPERNYEAR
-#define DAYSPERNYEAR   365
-#endif /* !defined DAYSPERNYEAR */
-
-#ifndef isleap
-#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
-#endif /* !defined isleap */
-
-#ifndef isleap_sum
-/*
-** See tzfile.h for details on isleap_sum.
-*/
-#define isleap_sum(a, b)       isleap((a) % 400 + (b) % 400)
-#endif /* !defined isleap_sum */
-
-#define SECSPERDAY     ((long) SECSPERHOUR * HOURSPERDAY)
-#define SECSPERNYEAR   (SECSPERDAY * DAYSPERNYEAR)
-#define SECSPERLYEAR   (SECSPERNYEAR + SECSPERDAY)
-
-#if HAVE_GETTEXT
-#include "locale.h"    /* for setlocale */
-#include "libintl.h"
-#endif /* HAVE_GETTEXT */
-
-#ifndef GNUC_or_lint
-#ifdef lint
-#define GNUC_or_lint
-#else /* !defined lint */
-#ifdef __GNUC__
-#define GNUC_or_lint
-#endif /* defined __GNUC__ */
-#endif /* !defined lint */
-#endif /* !defined GNUC_or_lint */
-
-#ifndef INITIALIZE
-#ifdef GNUC_or_lint
-#define INITIALIZE(x)  ((x) = 0)
-#else /* !defined GNUC_or_lint */
-#define INITIALIZE(x)
-#endif /* !defined GNUC_or_lint */
-#endif /* !defined INITIALIZE */
-
-/*
-** For the benefit of GNU folk...
-** `_(MSGID)' uses the current locale's message library string for MSGID.
-** The default is to use gettext if available, and use MSGID otherwise.
-*/
-
-#ifndef _
-#if HAVE_GETTEXT
-#define _(msgid) gettext(msgid)
-#else /* !HAVE_GETTEXT */
-#define _(msgid) msgid
-#endif /* !HAVE_GETTEXT */
-#endif /* !defined _ */
-
-#ifndef TZ_DOMAIN
-#define TZ_DOMAIN "tz"
-#endif /* !defined TZ_DOMAIN */
-
-#ifndef P
-#if __STDC__
-#define P(x)   x
-#else /* !__STDC__ */
-#define P(x)   ()
-#endif /* !__STDC__ */
-#endif /* !defined P */
-
-extern char ** environ;
-extern int     getopt P((int argc, char * const argv[],
-                       const char * options));
-extern char *  optarg;
-extern int     optind;
-extern char *  tzname[2];
-
-static time_t  absolute_min_time;
-static time_t  absolute_max_time;
-static size_t  longest;
-static char *  progname;
-static int     warned;
-
-static char *  abbr P((struct tm * tmp));
-static void    abbrok P((const char * abbrp, const char * zone));
-static long    delta P((struct tm * newp, struct tm * oldp));
-static void    dumptime P((const struct tm * tmp));
-static time_t  hunt P((char * name, time_t lot, time_t hit));
-static void    setabsolutes P((void));
-static void    show P((char * zone, time_t t, int v));
-static const char *    tformat P((void));
-static time_t  yeartot P((long y));
-
-#ifndef TYPECHECK
-#define my_localtime   localtime
-#else /* !defined TYPECHECK */
-static struct tm *
-my_localtime(tp)
-time_t *       tp;
-{
-       register struct tm *    tmp;
-
-       tmp = localtime(tp);
-       if (tp != NULL && tmp != NULL) {
-               struct tm       tm;
-               register time_t t;
-
-               tm = *tmp;
-               t = mktime(&tm);
-               if (t - *tp >= 1 || *tp - t >= 1) {
-                       (void) fflush(stdout);
-                       (void) fprintf(stderr, "\n%s: ", progname);
-                       (void) fprintf(stderr, tformat(), *tp);
-                       (void) fprintf(stderr, " ->");
-                       (void) fprintf(stderr, " year=%d", tmp->tm_year);
-                       (void) fprintf(stderr, " mon=%d", tmp->tm_mon);
-                       (void) fprintf(stderr, " mday=%d", tmp->tm_mday);
-                       (void) fprintf(stderr, " hour=%d", tmp->tm_hour);
-                       (void) fprintf(stderr, " min=%d", tmp->tm_min);
-                       (void) fprintf(stderr, " sec=%d", tmp->tm_sec);
-                       (void) fprintf(stderr, " isdst=%d", tmp->tm_isdst);
-                       (void) fprintf(stderr, " -> ");
-                       (void) fprintf(stderr, tformat(), t);
-                       (void) fprintf(stderr, "\n");
-               }
-       }
-       return tmp;
-}
-#endif /* !defined TYPECHECK */
-
-static void
-abbrok(abbrp, zone)
-const char * const     abbrp;
-const char * const     zone;
-{
-       register const char *   cp;
-       register char *         wp;
-
-       if (warned)
-               return;
-       cp = abbrp;
-       wp = NULL;
-       while (isascii((unsigned char) *cp) && isalpha((unsigned char) *cp))
-               ++cp;
-       if (cp - abbrp == 0)
-               wp = _("lacks alphabetic at start");
-       else if (cp - abbrp < 3)
-               wp = _("has fewer than 3 alphabetics");
-       else if (cp - abbrp > 6)
-               wp = _("has more than 6 alphabetics");
-       if (wp == NULL && (*cp == '+' || *cp == '-')) {
-               ++cp;
-               if (isascii((unsigned char) *cp) &&
-                       isdigit((unsigned char) *cp))
-                               if (*cp++ == '1' && *cp >= '0' && *cp <= '4')
-                                       ++cp;
-               if (*cp != '\0')
-                       wp = _("differs from POSIX standard");
-       }
-       if (wp == NULL)
-               return;
-       (void) fflush(stdout);
-       (void) fprintf(stderr,
-               _("%s: warning: zone \"%s\" abbreviation \"%s\" %s\n"),
-               progname, zone, abbrp, wp);
-       warned = TRUE;
-}
-
-int
-main( int      argc, char *    argv[])
-{
-       register int            i;
-       register int            c;
-       register int            vflag;
-       register char *         cutarg;
-       register long           cutloyear = ZDUMP_LO_YEAR;
-       register long           cuthiyear = ZDUMP_HI_YEAR;
-       register time_t         cutlotime;
-       register time_t         cuthitime;
-       register char **        fakeenv;
-       time_t                  now;
-       time_t                  t;
-       time_t                  newt;
-       struct tm               tm;
-       struct tm               newtm;
-       register struct tm *    tmp;
-       register struct tm *    newtmp;
-
-       INITIALIZE(cutlotime);
-       INITIALIZE(cuthitime);
-#if HAVE_GETTEXT
-       (void) setlocale(LC_ALL, "");
-#ifdef TZ_DOMAINDIR
-       (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
-#endif /* defined TEXTDOMAINDIR */
-       (void) textdomain(TZ_DOMAIN);
-#endif /* HAVE_GETTEXT */
-       progname = argv[0];
-       for (i = 1; i < argc; ++i)
-               if (strcmp(argv[i], "--version") == 0) {
-                       (void) printf("%s\n", elsieid);
-                       exit(EXIT_SUCCESS);
-               }
-       vflag = 0;
-       cutarg = NULL;
-       while ((c = getopt(argc, argv, "c:v")) == 'c' || c == 'v')
-               if (c == 'v')
-                       vflag = 1;
-               else    cutarg = optarg;
-       if ((c != EOF && c != -1) ||
-               (optind == argc - 1 && strcmp(argv[optind], "=") == 0)) {
-                       (void) fprintf(stderr,
-_("%s: usage is %s [ --version ] [ -v ] [ -c [loyear,]hiyear ] zonename ...\n"),
-                               progname, progname);
-                       exit(EXIT_FAILURE);
-       }
-       if (vflag) {
-               if (cutarg != NULL) {
-                       long    lo;
-                       long    hi;
-                       char    dummy;
-
-                       if (sscanf(cutarg, "%ld%c", &hi, &dummy) == 1) {
-                               cuthiyear = hi;
-                       } else if (sscanf(cutarg, "%ld,%ld%c",
-                               &lo, &hi, &dummy) == 2) {
-                                       cutloyear = lo;
-                                       cuthiyear = hi;
-                       } else {
-(void) fprintf(stderr, _("%s: wild -c argument %s\n"),
-                                       progname, cutarg);
-                               exit(EXIT_FAILURE);
-                       }
-               }
-               setabsolutes();
-               cutlotime = yeartot(cutloyear);
-               cuthitime = yeartot(cuthiyear);
-       }
-       (void) time(&now);
-       longest = 0;
-       for (i = optind; i < argc; ++i)
-               if (strlen(argv[i]) > longest)
-                       longest = strlen(argv[i]);
-       {
-               register int    from;
-               register int    to;
-
-               for (i = 0; environ[i] != NULL; ++i)
-                       continue;
-               fakeenv = (char **) malloc((size_t) ((i + 2) *
-                       sizeof *fakeenv));
-               if (fakeenv == NULL ||
-                       (fakeenv[0] = (char *) malloc(longest + 4)) == NULL) {
-                                       (void) perror(progname);
-                                       exit(EXIT_FAILURE);
-               }
-               to = 0;
-               (void) strcpy(fakeenv[to++], "TZ=");
-               for (from = 0; environ[from] != NULL; ++from)
-                       if (strncmp(environ[from], "TZ=", 3) != 0)
-                               fakeenv[to++] = environ[from];
-               fakeenv[to] = NULL;
-               environ = fakeenv;
-       }
-       for (i = optind; i < argc; ++i) {
-               static char     buf[MAX_STRING_LENGTH];
-
-               (void) strcpy(&fakeenv[0][3], argv[i]);
-               if (!vflag) {
-                       show(argv[i], now, FALSE);
-                       continue;
-               }
-               warned = FALSE;
-               t = absolute_min_time;
-               show(argv[i], t, TRUE);
-               t += SECSPERHOUR * HOURSPERDAY;
-               show(argv[i], t, TRUE);
-               if (t < cutlotime)
-                       t = cutlotime;
-               tmp = my_localtime(&t);
-               if (tmp != NULL) {
-                       tm = *tmp;
-                       (void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
-               }
-               for ( ; ; ) {
-                       if (t >= cuthitime)
-                               break;
-                       newt = t + SECSPERHOUR * 12;
-                       if (newt >= cuthitime)
-                               break;
-                       if (newt <= t)
-                               break;
-                       newtmp = localtime(&newt);
-                       if (newtmp != NULL)
-                               newtm = *newtmp;
-                       if ((tmp == NULL || newtmp == NULL) ? (tmp != newtmp) :
-                               (delta(&newtm, &tm) != (newt - t) ||
-                               newtm.tm_isdst != tm.tm_isdst ||
-                               strcmp(abbr(&newtm), buf) != 0)) {
-                                       newt = hunt(argv[i], t, newt);
-                                       newtmp = localtime(&newt);
-                                       if (newtmp != NULL) {
-                                               newtm = *newtmp;
-                                               (void) strncpy(buf,
-                                                       abbr(&newtm),
-                                                       (sizeof buf) - 1);
-                                       }
-                       }
-                       t = newt;
-                       tm = newtm;
-                       tmp = newtmp;
-               }
-               t = absolute_max_time;
-               t -= SECSPERHOUR * HOURSPERDAY;
-               show(argv[i], t, TRUE);
-               t += SECSPERHOUR * HOURSPERDAY;
-               show(argv[i], t, TRUE);
-       }
-       if (fflush(stdout) || ferror(stdout)) {
-               (void) fprintf(stderr, "%s: ", progname);
-               (void) perror(_("Error writing standard output"));
-               exit(EXIT_FAILURE);
-       }
-       exit(EXIT_SUCCESS);
-       /* If exit fails to exit... */
-       return EXIT_FAILURE;
-}
-
-static void
-setabsolutes()
-{
-#if 0
-       if (0.5 == (time_t) 0.5) {
-               /*
-               ** time_t is floating.
-               */
-               if (sizeof (time_t) == sizeof (float)) {
-                       absolute_min_time = (time_t) -FLT_MAX;
-                       absolute_max_time = (time_t) FLT_MAX;
-               } else if (sizeof (time_t) == sizeof (double)) {
-                       absolute_min_time = (time_t) -DBL_MAX;
-                       absolute_max_time = (time_t) DBL_MAX;
-               } else {
-                       (void) fprintf(stderr,
-_("%s: use of -v on system with floating time_t other than float or double\n"),
-                               progname);
-                       exit(EXIT_FAILURE);
-               }
-       } else
-#endif
-       if (0 > (time_t) -1) {
-               /*
-               ** time_t is signed.  Assume overflow wraps around.
-               */
-               time_t t = 0;
-               time_t t1 = 1;
-
-               while (t < t1) {
-                       t = t1;
-                       t1 = 2 * t1 + 1;
-               }
-                 
-               absolute_max_time = t;
-               t = -t;
-               absolute_min_time = t - 1;
-               if (t < absolute_min_time)
-                       absolute_min_time = t;
-       } else {
-               /*
-               ** time_t is unsigned.
-               */
-               absolute_min_time = 0;
-               absolute_max_time = absolute_min_time - 1;
-       }
-}
-
-static time_t
-yeartot(y)
-const long     y;
-{
-       register long   myy;
-       register long   seconds;
-       register time_t t;
-
-       myy = EPOCH_YEAR;
-       t = 0;
-       while (myy != y) {
-               if (myy < y) {
-                       seconds = isleap(myy) ? SECSPERLYEAR : SECSPERNYEAR;
-                       ++myy;
-                       if (t > absolute_max_time - seconds) {
-                               t = absolute_max_time;
-                               break;
-                       }
-                       t += seconds;
-               } else {
-                       --myy;
-                       seconds = isleap(myy) ? SECSPERLYEAR : SECSPERNYEAR;
-                       if (t < absolute_min_time + seconds) {
-                               t = absolute_min_time;
-                               break;
-                       }
-                       t -= seconds;
-               }
-       }
-       return t;
-}
-
-static time_t
-#if __STDC__
-hunt(char *name, time_t lot, time_t hit)
-#else /* !__STDC__ */
-hunt(name, lot, hit)
-char * name;
-time_t lot;
-time_t hit;
-#endif /* !__STDC__ */
-{
-       time_t                  t;
-       long                    diff;
-       struct tm               lotm;
-       register struct tm *    lotmp;
-       struct tm               tm;
-       register struct tm *    tmp;
-       char                    loab[MAX_STRING_LENGTH];
-
-       lotmp = my_localtime(&lot);
-       if (lotmp != NULL) {
-               lotm = *lotmp;
-               (void) strncpy(loab, abbr(&lotm), (sizeof loab) - 1);
-       }
-       for ( ; ; ) {
-               diff = (long) (hit - lot);
-               if (diff < 2)
-                       break;
-               t = lot;
-               t += diff / 2;
-               if (t <= lot)
-                       ++t;
-               else if (t >= hit)
-                       --t;
-               tmp = my_localtime(&t);
-               if (tmp != NULL)
-                       tm = *tmp;
-               if ((lotmp == NULL || tmp == NULL) ? (lotmp == tmp) :
-                       (delta(&tm, &lotm) == (t - lot) &&
-                       tm.tm_isdst == lotm.tm_isdst &&
-                       strcmp(abbr(&tm), loab) == 0)) {
-                               lot = t;
-                               lotm = tm;
-                               lotmp = tmp;
-               } else  hit = t;
-       }
-       show(name, lot, TRUE);
-       show(name, hit, TRUE);
-       return hit;
-}
-
-/*
-** Thanks to Paul Eggert for logic used in delta.
-*/
-
-static long
-delta(newp, oldp)
-struct tm *    newp;
-struct tm *    oldp;
-{
-       register long   result;
-       register int    tmy;
-
-       if (newp->tm_year < oldp->tm_year)
-               return -delta(oldp, newp);
-       result = 0;
-       for (tmy = oldp->tm_year; tmy < newp->tm_year; ++tmy)
-               result += DAYSPERNYEAR + isleap_sum(tmy, TM_YEAR_BASE);
-       result += newp->tm_yday - oldp->tm_yday;
-       result *= HOURSPERDAY;
-       result += newp->tm_hour - oldp->tm_hour;
-       result *= MINSPERHOUR;
-       result += newp->tm_min - oldp->tm_min;
-       result *= SECSPERMIN;
-       result += newp->tm_sec - oldp->tm_sec;
-       return result;
-}
-
-static void
-#if __STDC__
-show(char *zone, time_t t, int v)
-#else /* !__STDC__ */
-show(zone, t, v)
-char * zone;
-time_t t;
-int    v;
-#endif /* !__STDC__ */
-{
-       register struct tm *    tmp;
-
-       (void) printf("%-*s  ", (int) longest, zone);
-       if (v) {
-               tmp = gmtime(&t);
-               if (tmp == NULL) {
-                       (void) printf(tformat(), t);
-               } else {
-                       dumptime(tmp);
-                       (void) printf(" UTC");
-               }
-               (void) printf(" = ");
-       }
-       tmp = my_localtime(&t);
-       dumptime(tmp);
-       if (tmp != NULL) {
-               if (*abbr(tmp) != '\0')
-                       (void) printf(" %s", abbr(tmp));
-               if (v) {
-                       (void) printf(" isdst=%d", tmp->tm_isdst);
-#ifdef TM_GMTOFF
-                       (void) printf(" gmtoff=%ld", tmp->TM_GMTOFF);
-#endif /* defined TM_GMTOFF */
-               }
-       }
-       (void) printf("\n");
-       if (tmp != NULL && *abbr(tmp) != '\0')
-               abbrok(abbr(tmp), zone);
-}
-
-static char *
-abbr(tmp)
-struct tm *    tmp;
-{
-       register char * result;
-       static char     nada;
-
-       if (tmp->tm_isdst != 0 && tmp->tm_isdst != 1)
-               return &nada;
-       result = tzname[tmp->tm_isdst];
-       return (result == NULL) ? &nada : result;
-}
-
-/*
-** The code below can fail on certain theoretical systems;
-** it works on all known real-world systems as of 2004-12-30.
-*/
-
-static const char *
-tformat()
-{
-       if (0.5 == (time_t) 0.5) {      /* floating */
-               if (sizeof (time_t) > sizeof (double))
-                       return "%Lg";
-               return "%g";
-       }
-       if (0 > (time_t) -1) {          /* signed */
-               if (sizeof (time_t) > sizeof (long))
-                       return "%lld";
-               if (sizeof (time_t) > sizeof (int))
-                       return "%ld";
-               return "%d";
-       }
-       if (sizeof (time_t) > sizeof (unsigned long))
-               return "%llu";
-       if (sizeof (time_t) > sizeof (unsigned int))
-               return "%lu";
-       return "%u";
-}
-
-static void
-dumptime(timeptr)
-register const struct tm *     timeptr;
-{
-       static const char       wday_name[][3] = {
-               "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-       };
-       static const char       mon_name[][3] = {
-               "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-               "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
-       };
-       register const char *   wn;
-       register const char *   mn;
-       register int            lead;
-       register int            trail;
-
-       if (timeptr == NULL) {
-               (void) printf("NULL");
-               return;
-       }
-       /*
-       ** The packaged versions of localtime and gmtime never put out-of-range
-       ** values in tm_wday or tm_mon, but since this code might be compiled
-       ** with other (perhaps experimental) versions, paranoia is in order.
-       */
-       if (timeptr->tm_wday < 0 || timeptr->tm_wday >=
-               (int) (sizeof wday_name / sizeof wday_name[0]))
-                       wn = "???";
-       else            wn = wday_name[timeptr->tm_wday];
-       if (timeptr->tm_mon < 0 || timeptr->tm_mon >=
-               (int) (sizeof mon_name / sizeof mon_name[0]))
-                       mn = "???";
-       else            mn = mon_name[timeptr->tm_mon];
-       (void) printf("%.3s %.3s%3d %.2d:%.2d:%.2d ",
-               wn, mn,
-               timeptr->tm_mday, timeptr->tm_hour,
-               timeptr->tm_min, timeptr->tm_sec);
-#define DIVISOR        10
-       trail = timeptr->tm_year % DIVISOR + TM_YEAR_BASE % DIVISOR;
-       lead = timeptr->tm_year / DIVISOR + TM_YEAR_BASE / DIVISOR +
-               trail / DIVISOR;
-       trail %= DIVISOR;
-       if (trail < 0 && lead > 0) {
-               trail += DIVISOR;
-               --lead;
-       } else if (lead < 0 && trail > 0) {
-               trail -= DIVISOR;
-               ++lead;
-       }
-       if (lead == 0)
-               (void) printf("%d", trail);
-       else    (void) printf("%d%d", lead, ((trail < 0) ? -trail : trail));
-}
diff --git a/lib/libc/stdtime/zic.8 b/lib/libc/stdtime/zic.8
deleted file mode 100644 (file)
index 8bbdce8..0000000
+++ /dev/null
@@ -1,436 +0,0 @@
-.TH ZIC 8
-.SH NAME
-zic \- time zone compiler
-.SH SYNOPSIS
-.B zic
-[
-.B \-\-version
-]
-[
-.B \-v
-] [
-.B \-d
-.I directory
-] [
-.B \-l
-.I localtime
-] [
-.B \-p
-.I posixrules
-] [
-.B \-L
-.I leapsecondfilename
-] [
-.B \-s
-] [
-.B \-y
-.I command
-] [
-.I filename
-\&... ]
-.SH DESCRIPTION
-.if t .ds lq ``
-.if t .ds rq ''
-.if n .ds lq \&"\"
-.if n .ds rq \&"\"
-.de q
-\\$3\*(lq\\$1\*(rq\\$2
-..
-.I Zic
-reads text from the file(s) named on the command line
-and creates the time conversion information files specified in this input.
-If a
-.I filename
-is
-.BR \- ,
-the standard input is read.
-.PP
-These options are available:
-.TP
-.BI "\-\-version"
-Output version information and exit.
-.TP
-.BI "\-d " directory
-Create time conversion information files in the named directory rather than
-in the standard directory named below.
-.TP
-.BI "\-l " timezone
-Use the given time zone as local time.
-.I Zic
-will act as if the input contained a link line of the form
-.sp
-.ti +.5i
-Link   \fItimezone\fP          localtime
-.TP
-.BI "\-p " timezone
-Use the given time zone's rules when handling POSIX-format
-time zone environment variables.
-.I Zic
-will act as if the input contained a link line of the form
-.sp
-.ti +.5i
-Link   \fItimezone\fP          posixrules
-.TP
-.BI "\-L " leapsecondfilename
-Read leap second information from the file with the given name.
-If this option is not used,
-no leap second information appears in output files.
-.TP
-.B \-v
-Complain if a year that appears in a data file is outside the range
-of years representable by
-.IR time (2)
-values.
-Also complain if a time of 24:00
-(which cannot be handled by pre-1998 versions of
-.IR zic )
-appears in the input.
-.TP
-.B \-s
-Limit time values stored in output files to values that are the same
-whether they're taken to be signed or unsigned.
-You can use this option to generate SVVS-compatible files.
-.TP
-.BI "\-y " command
-Use the given
-.I command
-rather than
-.B yearistype
-when checking year types (see below).
-.PP
-Input lines are made up of fields.
-Fields are separated from one another by any number of white space characters.
-Leading and trailing white space on input lines is ignored.
-An unquoted sharp character (#) in the input introduces a comment which extends
-to the end of the line the sharp character appears on.
-White space characters and sharp characters may be enclosed in double quotes
-(") if they're to be used as part of a field.
-Any line that is blank (after comment stripping) is ignored.
-Non-blank lines are expected to be of one of three types:
-rule lines, zone lines, and link lines.
-.PP
-A rule line has the form
-.nf
-.ti +.5i
-.ta \w'Rule\0\0'u +\w'NAME\0\0'u +\w'FROM\0\0'u +\w'1973\0\0'u +\w'TYPE\0\0'u +\w'Apr\0\0'u +\w'lastSun\0\0'u +\w'2:00\0\0'u +\w'SAVE\0\0'u
-.sp
-Rule   NAME    FROM    TO      TYPE    IN      ON      AT      SAVE    LETTER/S
-.sp
-For example:
-.ti +.5i
-.sp
-Rule   US      1967    1973    \-      Apr     lastSun 2:00    1:00    D
-.sp
-.fi
-The fields that make up a rule line are:
-.TP "\w'LETTER/S'u"
-.B NAME
-Gives the (arbitrary) name of the set of rules this rule is part of.
-.TP
-.B FROM
-Gives the first year in which the rule applies.
-Any integer year can be supplied; the Gregorian calendar is assumed.
-The word
-.B minimum
-(or an abbreviation) means the minimum year representable as an integer.
-The word
-.B maximum
-(or an abbreviation) means the maximum year representable as an integer.
-Rules can describe times that are not representable as time values,
-with the unrepresentable times ignored; this allows rules to be portable
-among hosts with differing time value types.
-.TP
-.B TO
-Gives the final year in which the rule applies.
-In addition to
-.B minimum
-and
-.B maximum
-(as above),
-the word
-.B only
-(or an abbreviation)
-may be used to repeat the value of the
-.B FROM
-field.
-.TP
-.B TYPE
-Gives the type of year in which the rule applies.
-If
-.B TYPE
-is
-.B \-
-then the rule applies in all years between
-.B FROM
-and
-.B TO
-inclusive.
-If
-.B TYPE
-is something else, then
-.I zic
-executes the command
-.ti +.5i
-\fByearistype\fP \fIyear\fP \fItype\fP
-.br
-to check the type of a year:
-an exit status of zero is taken to mean that the year is of the given type;
-an exit status of one is taken to mean that the year is not of the given type.
-.TP
-.B IN
-Names the month in which the rule takes effect.
-Month names may be abbreviated.
-.TP
-.B ON
-Gives the day on which the rule takes effect.
-Recognized forms include:
-.nf
-.in +.5i
-.sp
-.ta \w'Sun<=25\0\0'u
-5      the fifth of the month
-lastSun        the last Sunday in the month
-lastMon        the last Monday in the month
-Sun>=8 first Sunday on or after the eighth
-Sun<=25        last Sunday on or before the 25th
-.fi
-.in -.5i
-.sp
-Names of days of the week may be abbreviated or spelled out in full.
-Note that there must be no spaces within the
-.B ON
-field.
-.TP
-.B AT
-Gives the time of day at which the rule takes effect.
-Recognized forms include:
-.nf
-.in +.5i
-.sp
-.ta \w'1:28:13\0\0'u
-2      time in hours
-2:00   time in hours and minutes
-15:00  24-hour format time (for times after noon)
-1:28:14        time in hours, minutes, and seconds
-\-     equivalent to 0
-.fi
-.in -.5i
-.sp
-where hour 0 is midnight at the start of the day,
-and hour 24 is midnight at the end of the day.
-Any of these forms may be followed by the letter
-.B w
-if the given time is local
-.q "wall clock"
-time,
-.B s
-if the given time is local
-.q standard
-time, or
-.B u
-(or
-.B g
-or
-.BR z )
-if the given time is universal time;
-in the absence of an indicator,
-wall clock time is assumed.
-.TP
-.B SAVE
-Gives the amount of time to be added to local standard time when the rule is in
-effect.
-This field has the same format as the
-.B AT
-field
-(although, of course, the
-.B w
-and
-.B s
-suffixes are not used).
-.TP
-.B LETTER/S
-Gives the
-.q "variable part"
-(for example, the
-.q S
-or
-.q D
-in
-.q EST
-or
-.q EDT )
-of time zone abbreviations to be used when this rule is in effect.
-If this field is
-.BR \- ,
-the variable part is null.
-.PP
-A zone line has the form
-.sp
-.nf
-.ti +.5i
-.ta \w'Zone\0\0'u +\w'Australia/Adelaide\0\0'u +\w'GMTOFF\0\0'u +\w'RULES/SAVE\0\0'u +\w'FORMAT\0\0'u
-Zone   NAME    GMTOFF  RULES/SAVE      FORMAT  [UNTIL]
-.sp
-For example:
-.sp
-.ti +.5i
-Zone   Australia/Adelaide      9:30    Aus     CST     1971 Oct 31 2:00
-.sp
-.fi
-The fields that make up a zone line are:
-.TP "\w'GMTOFF'u"
-.B NAME
-The name of the time zone.
-This is the name used in creating the time conversion information file for the
-zone.
-.TP
-.B GMTOFF
-The amount of time to add to UTC to get standard time in this zone.
-This field has the same format as the
-.B AT
-and
-.B SAVE
-fields of rule lines;
-begin the field with a minus sign if time must be subtracted from UTC.
-.TP
-.B RULES/SAVE
-The name of the rule(s) that apply in the time zone or,
-alternately, an amount of time to add to local standard time.
-If this field is
-.B \-
-then standard time always applies in the time zone.
-.TP
-.B FORMAT
-The format for time zone abbreviations in this time zone.
-The pair of characters
-.B %s
-is used to show where the
-.q "variable part"
-of the time zone abbreviation goes.
-Alternately,
-a slash (/)
-separates standard and daylight abbreviations.
-.TP
-.B UNTIL
-The time at which the UTC offset or the rule(s) change for a location.
-It is specified as a year, a month, a day, and a time of day.
-If this is specified,
-the time zone information is generated from the given UTC offset
-and rule change until the time specified.
-The month, day, and time of day have the same format as the IN, ON, and AT
-columns of a rule; trailing columns can be omitted, and default to the
-earliest possible value for the missing columns.
-.IP
-The next line must be a
-.q continuation
-line; this has the same form as a zone line except that the
-string
-.q Zone
-and the name are omitted, as the continuation line will
-place information starting at the time specified as the
-.B UNTIL
-field in the previous line in the file used by the previous line.
-Continuation lines may contain an
-.B UNTIL
-field, just as zone lines do, indicating that the next line is a further
-continuation.
-.PP
-A link line has the form
-.sp
-.nf
-.ti +.5i
-.ta \w'Link\0\0'u +\w'Europe/Istanbul\0\0'u
-Link   LINK-FROM       LINK-TO
-.sp
-For example:
-.sp
-.ti +.5i
-Link   Europe/Istanbul Asia/Istanbul
-.sp
-.fi
-The
-.B LINK-FROM
-field should appear as the
-.B NAME
-field in some zone line;
-the
-.B LINK-TO
-field is used as an alternate name for that zone.
-.PP
-Except for continuation lines,
-lines may appear in any order in the input.
-.PP
-Lines in the file that describes leap seconds have the following form:
-.nf
-.ti +.5i
-.ta \w'Leap\0\0'u +\w'YEAR\0\0'u +\w'MONTH\0\0'u +\w'DAY\0\0'u +\w'HH:MM:SS\0\0'u +\w'CORR\0\0'u
-.sp
-Leap   YEAR    MONTH   DAY     HH:MM:SS        CORR    R/S
-.sp
-For example:
-.ti +.5i
-.sp
-Leap   1974    Dec     31      23:59:60        +       S
-.sp
-.fi
-The
-.BR YEAR ,
-.BR MONTH ,
-.BR DAY ,
-and
-.B HH:MM:SS
-fields tell when the leap second happened.
-The
-.B CORR
-field
-should be
-.q +
-if a second was added
-or
-.q -
-if a second was skipped.
-.\" There's no need to document the following, since it's impossible for more
-.\" than one leap second to be inserted or deleted at a time.
-.\" The C Standard is in error in suggesting the possibility.
-.\" See Terry J Quinn, The BIPM and the accurate measure of time,
-.\" Proc IEEE 79, 7 (July 1991), 894-905.
-.\"    or
-.\"    .q ++
-.\"    if two seconds were added
-.\"    or
-.\"    .q --
-.\"    if two seconds were skipped.
-The
-.B R/S
-field
-should be (an abbreviation of)
-.q Stationary
-if the leap second time given by the other fields should be interpreted as UTC
-or
-(an abbreviation of)
-.q Rolling
-if the leap second time given by the other fields should be interpreted as
-local wall clock time.
-.SH NOTES
-For areas with more than two types of local time,
-you may need to use local standard time in the
-.B AT
-field of the earliest transition time's rule to ensure that
-the earliest transition time recorded in the compiled file is correct.
-.PP
-If,
-for a particular zone,
-a clock advance caused by the start of daylight saving
-coincides with and is equal to
-a clock retreat caused by a change in UTC offset,
-.IR zic
-produces a single transition to daylight saving at the new UTC offset 
-(without any change in wall clock time).
-To get separate transitions
-use multiple zone continuation lines
-specifying transition instants using universal time.
-.SH FILE
-/usr/share/zoneinfo    standard directory used for created files
-.SH "SEE ALSO"
-newctime(3), tzfile(5), zdump(8)
-.\" @(#)zic.8  7.24
diff --git a/lib/libc/stdtime/zic.c b/lib/libc/stdtime/zic.c
deleted file mode 100644 (file)
index cd2b3b7..0000000
+++ /dev/null
@@ -1,2311 +0,0 @@
-static char    elsieid[] = "@(#)zic.c  7.128";
-
-/*
-** Regardless of the type of time_t, we do our work using this type.
-*/
-
-typedef int    zic_t;
-
-#include "private.h"
-#include "locale.h"
-#include "tzfile.h"
-
-#ifndef ZIC_MAX_ABBR_LEN_WO_WARN
-#define ZIC_MAX_ABBR_LEN_WO_WARN       6
-#endif /* !defined ZIC_MAX_ABBR_LEN_WO_WARN */
-
-#if HAVE_SYS_STAT_H
-#include "sys/stat.h"
-#endif
-#ifdef S_IRUSR
-#define MKDIR_UMASK (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH)
-#else
-#define MKDIR_UMASK 0755
-#endif
-
-/*
-** On some ancient hosts, predicates like `isspace(C)' are defined
-** only if isascii(C) || C == EOF. Modern hosts obey the C Standard,
-** which says they are defined only if C == ((unsigned char) C) || C == EOF.
-** Neither the C Standard nor Posix require that `isascii' exist.
-** For portability, we check both ancient and modern requirements.
-** If isascii is not defined, the isascii check succeeds trivially.
-*/
-#include "ctype.h"
-#ifndef isascii
-#define isascii(x) 1
-#endif
-
-struct rule {
-       const char *    r_filename;
-       int             r_linenum;
-       const char *    r_name;
-
-       int             r_loyear;       /* for example, 1986 */
-       int             r_hiyear;       /* for example, 1986 */
-       const char *    r_yrtype;
-
-       int             r_month;        /* 0..11 */
-
-       int             r_dycode;       /* see below */
-       int             r_dayofmonth;
-       int             r_wday;
-
-       long            r_tod;          /* time from midnight */
-       int             r_todisstd;     /* above is standard time if TRUE */
-                                       /* or wall clock time if FALSE */
-       int             r_todisgmt;     /* above is GMT if TRUE */
-                                       /* or local time if FALSE */
-       long            r_stdoff;       /* offset from standard time */
-       const char *    r_abbrvar;      /* variable part of abbreviation */
-
-       int             r_todo;         /* a rule to do (used in outzone) */
-       zic_t           r_temp;         /* used in outzone */
-};
-
-/*
-**     r_dycode                r_dayofmonth    r_wday
-*/
-
-#define DC_DOM         0       /* 1..31 */     /* unused */
-#define DC_DOWGEQ      1       /* 1..31 */     /* 0..6 (Sun..Sat) */
-#define DC_DOWLEQ      2       /* 1..31 */     /* 0..6 (Sun..Sat) */
-
-struct zone {
-       const char *    z_filename;
-       int             z_linenum;
-
-       const char *    z_name;
-       long            z_gmtoff;
-       const char *    z_rule;
-       const char *    z_format;
-
-       long            z_stdoff;
-
-       struct rule *   z_rules;
-       int             z_nrules;
-
-       struct rule     z_untilrule;
-       zic_t           z_untiltime;
-};
-
-extern int     getopt P((int argc, char * const argv[],
-                       const char * options));
-extern int     link P((const char * fromname, const char * toname));
-extern char *  optarg;
-extern int     optind;
-
-static void    addtt P((zic_t starttime, int type));
-static int     addtype P((long gmtoff, const char * abbr, int isdst,
-                               int ttisstd, int ttisgmt));
-static void    leapadd P((zic_t t, int positive, int rolling, int count));
-static void    adjleap P((void));
-static void    associate P((void));
-static int     ciequal P((const char * ap, const char * bp));
-static void    convert P((long val, char * buf));
-static void    dolink P((const char * fromfile, const char * tofile));
-static void    doabbr P((char * abbr, const char * format,
-                       const char * letters, int isdst));
-static void    eat P((const char * name, int num));
-static void    eats P((const char * name, int num,
-                       const char * rname, int rnum));
-static long    eitol P((int i));
-static void    error P((const char * message));
-static char ** getfields P((char * buf));
-static long    gethms P((const char * string, const char * errstrng,
-                       int signable));
-static void    infile P((const char * filename));
-static void    inleap P((char ** fields, int nfields));
-static void    inlink P((char ** fields, int nfields));
-static void    inrule P((char ** fields, int nfields));
-static int     inzcont P((char ** fields, int nfields));
-static int     inzone P((char ** fields, int nfields));
-static int     inzsub P((char ** fields, int nfields, int iscont));
-static int     itsabbr P((const char * abbr, const char * word));
-static int     itsdir P((const char * name));
-static int     lowerit P((int c));
-static char *  memcheck P((char * tocheck));
-static int     mkdirs P((char * filename));
-static void    newabbr P((const char * abbr));
-static long    oadd P((long t1, long t2));
-static void    outzone P((const struct zone * zp, int ntzones));
-static void    puttzcode P((long code, FILE * fp));
-static int     rcomp P((const void * leftp, const void * rightp));
-static zic_t   rpytime P((const struct rule * rp, int wantedy));
-static void    rulesub P((struct rule * rp,
-                       const char * loyearp, const char * hiyearp,
-                       const char * typep, const char * monthp,
-                       const char * dayp, const char * timep));
-static void    setboundaries P((void));
-static zic_t   tadd P((zic_t t1, long t2));
-static void    usage P((void));
-static void    writezone P((const char * name));
-static int     yearistype P((int year, const char * type));
-
-#if !HAVE_STRERROR
-static char *  strerror P((int));
-#endif /* !HAVE_STRERROR */
-
-static int             charcnt;
-static int             errors;
-static const char *    filename;
-static int             leapcnt;
-static int             linenum;
-static zic_t           max_time;
-static int             max_year;
-static int             max_year_representable;
-static zic_t           min_time;
-static int             min_year;
-static int             min_year_representable;
-static int             noise;
-static const char *    rfilename;
-static int             rlinenum;
-static const char *    progname;
-static int             timecnt;
-static int             typecnt;
-
-/*
-** Line codes.
-*/
-
-#define LC_RULE                0
-#define LC_ZONE                1
-#define LC_LINK                2
-#define LC_LEAP                3
-
-/*
-** Which fields are which on a Zone line.
-*/
-
-#define ZF_NAME                1
-#define ZF_GMTOFF      2
-#define ZF_RULE                3
-#define ZF_FORMAT      4
-#define ZF_TILYEAR     5
-#define ZF_TILMONTH    6
-#define ZF_TILDAY      7
-#define ZF_TILTIME     8
-#define ZONE_MINFIELDS 5
-#define ZONE_MAXFIELDS 9
-
-/*
-** Which fields are which on a Zone continuation line.
-*/
-
-#define ZFC_GMTOFF     0
-#define ZFC_RULE       1
-#define ZFC_FORMAT     2
-#define ZFC_TILYEAR    3
-#define ZFC_TILMONTH   4
-#define ZFC_TILDAY     5
-#define ZFC_TILTIME    6
-#define ZONEC_MINFIELDS        3
-#define ZONEC_MAXFIELDS        7
-
-/*
-** Which files are which on a Rule line.
-*/
-
-#define RF_NAME                1
-#define RF_LOYEAR      2
-#define RF_HIYEAR      3
-#define RF_COMMAND     4
-#define RF_MONTH       5
-#define RF_DAY         6
-#define RF_TOD         7
-#define RF_STDOFF      8
-#define RF_ABBRVAR     9
-#define RULE_FIELDS    10
-
-/*
-** Which fields are which on a Link line.
-*/
-
-#define LF_FROM                1
-#define LF_TO          2
-#define LINK_FIELDS    3
-
-/*
-** Which fields are which on a Leap line.
-*/
-
-#define LP_YEAR                1
-#define LP_MONTH       2
-#define LP_DAY         3
-#define LP_TIME                4
-#define LP_CORR                5
-#define LP_ROLL                6
-#define LEAP_FIELDS    7
-
-/*
-** Year synonyms.
-*/
-
-#define YR_MINIMUM     0
-#define YR_MAXIMUM     1
-#define YR_ONLY                2
-
-static struct rule *   rules;
-static int             nrules; /* number of rules */
-
-static struct zone *   zones;
-static int             nzones; /* number of zones */
-
-struct link {
-       const char *    l_filename;
-       int             l_linenum;
-       const char *    l_from;
-       const char *    l_to;
-};
-
-static struct link *   links;
-static int             nlinks;
-
-struct lookup {
-       const char *    l_word;
-       const int       l_value;
-};
-
-static struct lookup const *   byword P((const char * string,
-                                       const struct lookup * lp));
-
-static struct lookup const     line_codes[] = {
-       { "Rule",       LC_RULE },
-       { "Zone",       LC_ZONE },
-       { "Link",       LC_LINK },
-       { "Leap",       LC_LEAP },
-       { NULL,         0}
-};
-
-static struct lookup const     mon_names[] = {
-       { "January",    TM_JANUARY },
-       { "February",   TM_FEBRUARY },
-       { "March",      TM_MARCH },
-       { "April",      TM_APRIL },
-       { "May",        TM_MAY },
-       { "June",       TM_JUNE },
-       { "July",       TM_JULY },
-       { "August",     TM_AUGUST },
-       { "September",  TM_SEPTEMBER },
-       { "October",    TM_OCTOBER },
-       { "November",   TM_NOVEMBER },
-       { "December",   TM_DECEMBER },
-       { NULL,         0 }
-};
-
-static struct lookup const     wday_names[] = {
-       { "Sunday",     TM_SUNDAY },
-       { "Monday",     TM_MONDAY },
-       { "Tuesday",    TM_TUESDAY },
-       { "Wednesday",  TM_WEDNESDAY },
-       { "Thursday",   TM_THURSDAY },
-       { "Friday",     TM_FRIDAY },
-       { "Saturday",   TM_SATURDAY },
-       { NULL,         0 }
-};
-
-static struct lookup const     lasts[] = {
-       { "last-Sunday",        TM_SUNDAY },
-       { "last-Monday",        TM_MONDAY },
-       { "last-Tuesday",       TM_TUESDAY },
-       { "last-Wednesday",     TM_WEDNESDAY },
-       { "last-Thursday",      TM_THURSDAY },
-       { "last-Friday",        TM_FRIDAY },
-       { "last-Saturday",      TM_SATURDAY },
-       { NULL,                 0 }
-};
-
-static struct lookup const     begin_years[] = {
-       { "minimum",    YR_MINIMUM },
-       { "maximum",    YR_MAXIMUM },
-       { NULL,         0 }
-};
-
-static struct lookup const     end_years[] = {
-       { "minimum",    YR_MINIMUM },
-       { "maximum",    YR_MAXIMUM },
-       { "only",       YR_ONLY },
-       { NULL,         0 }
-};
-
-static struct lookup const     leap_types[] = {
-       { "Rolling",    TRUE },
-       { "Stationary", FALSE },
-       { NULL,         0 }
-};
-
-static const int       len_months[2][MONSPERYEAR] = {
-       { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
-       { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
-};
-
-static const int       len_years[2] = {
-       DAYSPERNYEAR, DAYSPERLYEAR
-};
-
-static struct attype {
-       zic_t           at;
-       unsigned char   type;
-}                      attypes[TZ_MAX_TIMES];
-static long            gmtoffs[TZ_MAX_TYPES];
-static char            isdsts[TZ_MAX_TYPES];
-static unsigned char   abbrinds[TZ_MAX_TYPES];
-static char            ttisstds[TZ_MAX_TYPES];
-static char            ttisgmts[TZ_MAX_TYPES];
-static char            chars[TZ_MAX_CHARS];
-static zic_t           trans[TZ_MAX_LEAPS];
-static long            corr[TZ_MAX_LEAPS];
-static char            roll[TZ_MAX_LEAPS];
-
-/*
-** Memory allocation.
-*/
-
-static char *
-memcheck(ptr)
-char * const   ptr;
-{
-       if (ptr == NULL) {
-               const char *e = strerror(errno);
-
-               (void) fprintf(stderr, _("%s: Memory exhausted: %s\n"),
-                       progname, e);
-               exit(EXIT_FAILURE);
-       }
-       return ptr;
-}
-
-#define emalloc(size)          memcheck(imalloc(size))
-#define erealloc(ptr, size)    memcheck(irealloc((ptr), (size)))
-#define ecpyalloc(ptr)         memcheck(icpyalloc(ptr))
-#define ecatalloc(oldp, newp)  memcheck(icatalloc((oldp), (newp)))
-
-/*
-** Error handling.
-*/
-
-#if !HAVE_STRERROR
-static char *
-strerror(errnum)
-int    errnum;
-{
-       extern char *   sys_errlist[];
-       extern int      sys_nerr;
-
-       return (errnum > 0 && errnum <= sys_nerr) ?
-               sys_errlist[errnum] : _("Unknown system error");
-}
-#endif /* !HAVE_STRERROR */
-
-static void
-eats(name, num, rname, rnum)
-const char * const     name;
-const int              num;
-const char * const     rname;
-const int              rnum;
-{
-       filename = name;
-       linenum = num;
-       rfilename = rname;
-       rlinenum = rnum;
-}
-
-static void
-eat(name, num)
-const char * const     name;
-const int              num;
-{
-       eats(name, num, (char *) NULL, -1);
-}
-
-static void
-error(string)
-const char * const     string;
-{
-       /*
-       ** Match the format of "cc" to allow sh users to
-       **      zic ... 2>&1 | error -t "*" -v
-       ** on BSD systems.
-       */
-       (void) fprintf(stderr, _("\"%s\", line %d: %s"),
-               filename, linenum, string);
-       if (rfilename != NULL)
-               (void) fprintf(stderr, _(" (rule from \"%s\", line %d)"),
-                       rfilename, rlinenum);
-       (void) fprintf(stderr, "\n");
-       ++errors;
-}
-
-static void
-warning(const char * const     string)
-{
-       char *  cp;
-
-       cp = ecpyalloc(_("warning: "));
-       cp = ecatalloc(cp, string);
-       error(cp);
-       ifree(cp);
-       --errors;
-}
-
-static void
-usage P((void))
-{
-       (void) fprintf(stderr, _("%s: usage is %s \
-[ --version ] [ -s ] [ -v ] [ -l localtime ] [ -p posixrules ] \\\n\
-\t[ -d directory ] [ -L leapseconds ] [ -y yearistype ] [ filename ... ]\n"),
-               progname, progname);
-       exit(EXIT_FAILURE);
-}
-
-static const char *    psxrules;
-static const char *    lcltime;
-static const char *    directory;
-static const char *    leapsec;
-static const char *    yitcommand;
-static int             sflag = FALSE;
-
-int
-main( int      argc, char *    argv[])
-{
-       register int    i;
-       register int    j;
-       register int    c;
-
-#ifdef unix
-       (void) umask(umask(S_IWGRP | S_IWOTH) | (S_IWGRP | S_IWOTH));
-#endif /* defined unix */
-#if HAVE_GETTEXT
-       (void) setlocale(LC_ALL, "");
-#ifdef TZ_DOMAINDIR
-       (void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
-#endif /* defined TEXTDOMAINDIR */
-       (void) textdomain(TZ_DOMAIN);
-#endif /* HAVE_GETTEXT */
-       progname = argv[0];
-       for (i = 1; i < argc; ++i)
-               if (strcmp(argv[i], "--version") == 0) {
-                       (void) printf("%s\n", elsieid);
-                       exit(EXIT_SUCCESS);
-               }
-       while ((c = getopt(argc, argv, "d:l:p:L:vsy:")) != EOF && c != -1)
-               switch (c) {
-                       default:
-                               usage();
-                       case 'd':
-                               if (directory == NULL)
-                                       directory = optarg;
-                               else {
-                                       (void) fprintf(stderr,
-_("%s: More than one -d option specified\n"),
-                                               progname);
-                                       exit(EXIT_FAILURE);
-                               }
-                               break;
-                       case 'l':
-                               if (lcltime == NULL)
-                                       lcltime = optarg;
-                               else {
-                                       (void) fprintf(stderr,
-_("%s: More than one -l option specified\n"),
-                                               progname);
-                                       exit(EXIT_FAILURE);
-                               }
-                               break;
-                       case 'p':
-                               if (psxrules == NULL)
-                                       psxrules = optarg;
-                               else {
-                                       (void) fprintf(stderr,
-_("%s: More than one -p option specified\n"),
-                                               progname);
-                                       exit(EXIT_FAILURE);
-                               }
-                               break;
-                       case 'y':
-                               if (yitcommand == NULL)
-                                       yitcommand = optarg;
-                               else {
-                                       (void) fprintf(stderr,
-_("%s: More than one -y option specified\n"),
-                                               progname);
-                                       exit(EXIT_FAILURE);
-                               }
-                               break;
-                       case 'L':
-                               if (leapsec == NULL)
-                                       leapsec = optarg;
-                               else {
-                                       (void) fprintf(stderr,
-_("%s: More than one -L option specified\n"),
-                                               progname);
-                                       exit(EXIT_FAILURE);
-                               }
-                               break;
-                       case 'v':
-                               noise = TRUE;
-                               break;
-                       case 's':
-                               sflag = TRUE;
-                               break;
-               }
-       if (optind == argc - 1 && strcmp(argv[optind], "=") == 0)
-               usage();        /* usage message by request */
-       if (directory == NULL)
-               directory = TZDIR;
-       if (yitcommand == NULL)
-               yitcommand = "yearistype";
-
-       setboundaries();
-
-       if (optind < argc && leapsec != NULL) {
-               infile(leapsec);
-               adjleap();
-       }
-
-       for (i = optind; i < argc; ++i)
-               infile(argv[i]);
-       if (errors)
-               exit(EXIT_FAILURE);
-       associate();
-       for (i = 0; i < nzones; i = j) {
-               /*
-               ** Find the next non-continuation zone entry.
-               */
-               for (j = i + 1; j < nzones && zones[j].z_name == NULL; ++j)
-                       continue;
-               outzone(&zones[i], j - i);
-       }
-       /*
-       ** Make links.
-       */
-       for (i = 0; i < nlinks; ++i) {
-               eat(links[i].l_filename, links[i].l_linenum);
-               dolink(links[i].l_from, links[i].l_to);
-               if (noise)
-                       for (j = 0; j < nlinks; ++j)
-                               if (strcmp(links[i].l_to,
-                                       links[j].l_from) == 0)
-                                               warning(_("link to link"));
-       }
-       if (lcltime != NULL) {
-               eat("command line", 1);
-               dolink(lcltime, TZDEFAULT);
-       }
-       if (psxrules != NULL) {
-               eat("command line", 1);
-               dolink(psxrules, TZDEFRULES);
-       }
-       return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
-
-static void
-dolink(fromfile, tofile)
-const char * const     fromfile;
-const char * const     tofile;
-{
-       register char * fromname;
-       register char * toname;
-
-       if (fromfile[0] == '/')
-               fromname = ecpyalloc(fromfile);
-       else {
-               fromname = ecpyalloc(directory);
-               fromname = ecatalloc(fromname, "/");
-               fromname = ecatalloc(fromname, fromfile);
-       }
-       if (tofile[0] == '/')
-               toname = ecpyalloc(tofile);
-       else {
-               toname = ecpyalloc(directory);
-               toname = ecatalloc(toname, "/");
-               toname = ecatalloc(toname, tofile);
-       }
-       /*
-       ** We get to be careful here since
-       ** there's a fair chance of root running us.
-       */
-       if (!itsdir(toname))
-               (void) remove(toname);
-       if (link(fromname, toname) != 0) {
-               int     result;
-
-               if (mkdirs(toname) != 0)
-                       exit(EXIT_FAILURE);
-
-               result = link(fromname, toname);
-#if HAVE_SYMLINK
-               if (result != 0 &&
-                       access(fromname, F_OK) == 0 &&
-                       !itsdir(fromname)) {
-                               const char *s = tofile;
-                               register char * symlinkcontents = NULL;
-
-                               while ((s = strchr(s+1, '/')) != NULL)
-                                       symlinkcontents =
-                                               ecatalloc(symlinkcontents,
-                                               "../");
-                               symlinkcontents =
-                                       ecatalloc(symlinkcontents,
-                                       fromfile);
-                               result = symlink(symlinkcontents,
-                                       toname);
-                               if (result == 0)
-warning(_("hard link failed, symbolic link used"));
-                               ifree(symlinkcontents);
-               }
-#endif /* HAVE_SYMLINK */
-               if (result != 0) {
-                       const char *e = strerror(errno);
-
-                       (void) fprintf(stderr,
-                               _("%s: Can't link from %s to %s: %s\n"),
-                               progname, fromname, toname, e);
-                       exit(EXIT_FAILURE);
-               }
-       }
-       ifree(fromname);
-       ifree(toname);
-}
-
-#ifndef INT_MAX
-#define INT_MAX        ((int) (((unsigned)~0)>>1))
-#endif /* !defined INT_MAX */
-
-#ifndef INT_MIN
-#define INT_MIN        ((int) ~(((unsigned)~0)>>1))
-#endif /* !defined INT_MIN */
-
-/*
-** The tz file format currently allows at most 32-bit quantities.
-** This restriction should be removed before signed 32-bit values
-** wrap around in 2038, but unfortunately this will require a
-** change to the tz file format.
-*/
-
-#define MAX_BITS_IN_FILE       32
-#define TIME_T_BITS_IN_FILE    ((TYPE_BIT(zic_t) < MAX_BITS_IN_FILE) ? \
-                                       TYPE_BIT(zic_t) : MAX_BITS_IN_FILE)
-
-static void
-setboundaries P((void))
-{
-       register int    i;
-
-       if (TYPE_SIGNED(zic_t)) {
-               min_time = -1;
-               for (i = 0; i < TIME_T_BITS_IN_FILE - 1; ++i)
-                       min_time *= 2;
-               max_time = -(min_time + 1);
-               if (sflag)
-                       min_time = 0;
-       } else {
-               min_time = 0;
-               max_time = 2 - sflag;
-               for (i = 0; i < TIME_T_BITS_IN_FILE - 1; ++i)
-                       max_time *= 2;
-               --max_time;
-       }
-       {
-               time_t  t;
-
-               t = (time_t) min_time;
-               min_year = TM_YEAR_BASE + gmtime(&t)->tm_year;
-               t = (time_t) max_time;
-               max_year = TM_YEAR_BASE + gmtime(&t)->tm_year;
-       }
-       min_year_representable = min_year;
-       max_year_representable = max_year;
-}
-
-static int
-itsdir(name)
-const char * const     name;
-{
-       register char * myname;
-       register int    accres;
-
-       myname = ecpyalloc(name);
-       myname = ecatalloc(myname, "/.");
-       accres = access(myname, F_OK);
-       ifree(myname);
-       return accres == 0;
-}
-
-/*
-** Associate sets of rules with zones.
-*/
-
-/*
-** Sort by rule name.
-*/
-
-static int
-rcomp(cp1, cp2)
-const void *   cp1;
-const void *   cp2;
-{
-       return strcmp(((const struct rule *) cp1)->r_name,
-               ((const struct rule *) cp2)->r_name);
-}
-
-static void
-associate P((void))
-{
-       register struct zone *  zp;
-       register struct rule *  rp;
-       register int            base, out;
-       register int            i, j;
-
-       if (nrules != 0) {
-               (void) qsort((void *) rules, (size_t) nrules,
-                       (size_t) sizeof *rules, rcomp);
-               for (i = 0; i < nrules - 1; ++i) {
-                       if (strcmp(rules[i].r_name,
-                               rules[i + 1].r_name) != 0)
-                                       continue;
-                       if (strcmp(rules[i].r_filename,
-                               rules[i + 1].r_filename) == 0)
-                                       continue;
-                       eat(rules[i].r_filename, rules[i].r_linenum);
-                       warning(_("same rule name in multiple files"));
-                       eat(rules[i + 1].r_filename, rules[i + 1].r_linenum);
-                       warning(_("same rule name in multiple files"));
-                       for (j = i + 2; j < nrules; ++j) {
-                               if (strcmp(rules[i].r_name,
-                                       rules[j].r_name) != 0)
-                                               break;
-                               if (strcmp(rules[i].r_filename,
-                                       rules[j].r_filename) == 0)
-                                               continue;
-                               if (strcmp(rules[i + 1].r_filename,
-                                       rules[j].r_filename) == 0)
-                                               continue;
-                               break;
-                       }
-                       i = j - 1;
-               }
-       }
-       for (i = 0; i < nzones; ++i) {
-               zp = &zones[i];
-               zp->z_rules = NULL;
-               zp->z_nrules = 0;
-       }
-       for (base = 0; base < nrules; base = out) {
-               rp = &rules[base];
-               for (out = base + 1; out < nrules; ++out)
-                       if (strcmp(rp->r_name, rules[out].r_name) != 0)
-                               break;
-               for (i = 0; i < nzones; ++i) {
-                       zp = &zones[i];
-                       if (strcmp(zp->z_rule, rp->r_name) != 0)
-                               continue;
-                       zp->z_rules = rp;
-                       zp->z_nrules = out - base;
-               }
-       }
-       for (i = 0; i < nzones; ++i) {
-               zp = &zones[i];
-               if (zp->z_nrules == 0) {
-                       /*
-                       ** Maybe we have a local standard time offset.
-                       */
-                       eat(zp->z_filename, zp->z_linenum);
-                       zp->z_stdoff = gethms(zp->z_rule, _("unruly zone"),
-                               TRUE);
-                       /*
-                       ** Note, though, that if there's no rule,
-                       ** a '%s' in the format is a bad thing.
-                       */
-                       if (strchr(zp->z_format, '%') != 0)
-                               error(_("%s in ruleless zone"));
-               }
-       }
-       if (errors)
-               exit(EXIT_FAILURE);
-}
-
-static void
-infile(name)
-const char *   name;
-{
-       register FILE *                 fp;
-       register char **                fields;
-       register char *                 cp;
-       register const struct lookup *  lp;
-       register int                    nfields;
-       register int                    wantcont;
-       register int                    num;
-       char                            buf[BUFSIZ];
-
-       if (strcmp(name, "-") == 0) {
-               name = _("standard input");
-               fp = stdin;
-       } else if ((fp = fopen(name, "r")) == NULL) {
-               const char *e = strerror(errno);
-
-               (void) fprintf(stderr, _("%s: Can't open %s: %s\n"),
-                       progname, name, e);
-               exit(EXIT_FAILURE);
-       }
-       wantcont = FALSE;
-       for (num = 1; ; ++num) {
-               eat(name, num);
-               if (fgets(buf, (int) sizeof buf, fp) != buf)
-                       break;
-               cp = strchr(buf, '\n');
-               if (cp == NULL) {
-                       error(_("line too long"));
-                       exit(EXIT_FAILURE);
-               }
-               *cp = '\0';
-               fields = getfields(buf);
-               nfields = 0;
-               while (fields[nfields] != NULL) {
-                       static char     nada;
-
-                       if (strcmp(fields[nfields], "-") == 0)
-                               fields[nfields] = &nada;
-                       ++nfields;
-               }
-               if (nfields == 0) {
-                       /* nothing to do */
-               } else if (wantcont) {
-                       wantcont = inzcont(fields, nfields);
-               } else {
-                       lp = byword(fields[0], line_codes);
-                       if (lp == NULL)
-                               error(_("input line of unknown type"));
-                       else switch ((int) (lp->l_value)) {
-                               case LC_RULE:
-                                       inrule(fields, nfields);
-                                       wantcont = FALSE;
-                                       break;
-                               case LC_ZONE:
-                                       wantcont = inzone(fields, nfields);
-                                       break;
-                               case LC_LINK:
-                                       inlink(fields, nfields);
-                                       wantcont = FALSE;
-                                       break;
-                               case LC_LEAP:
-                                       if (name != leapsec)
-                                               (void) fprintf(stderr,
-_("%s: Leap line in non leap seconds file %s\n"),
-                                                       progname, name);
-                                       else    inleap(fields, nfields);
-                                       wantcont = FALSE;
-                                       break;
-                               default:        /* "cannot happen" */
-                                       (void) fprintf(stderr,
-_("%s: panic: Invalid l_value %d\n"),
-                                               progname, lp->l_value);
-                                       exit(EXIT_FAILURE);
-                       }
-               }
-               ifree((char *) fields);
-       }
-       if (ferror(fp)) {
-               (void) fprintf(stderr, _("%s: Error reading %s\n"),
-                       progname, filename);
-               exit(EXIT_FAILURE);
-       }
-       if (fp != stdin && fclose(fp)) {
-               const char *e = strerror(errno);
-
-               (void) fprintf(stderr, _("%s: Error closing %s: %s\n"),
-                       progname, filename, e);
-               exit(EXIT_FAILURE);
-       }
-       if (wantcont)
-               error(_("expected continuation line not found"));
-}
-
-/*
-** Convert a string of one of the forms
-**     h       -h      hh:mm   -hh:mm  hh:mm:ss        -hh:mm:ss
-** into a number of seconds.
-** A null string maps to zero.
-** Call error with errstring and return zero on errors.
-*/
-
-static long
-gethms(string, errstring, signable)
-const char *           string;
-const char * const     errstring;
-const int              signable;
-{
-       int     hh, mm, ss, sign;
-
-       if (string == NULL || *string == '\0')
-               return 0;
-       if (!signable)
-               sign = 1;
-       else if (*string == '-') {
-               sign = -1;
-               ++string;
-       } else  sign = 1;
-       if (sscanf(string, scheck(string, "%d"), &hh) == 1)
-               mm = ss = 0;
-       else if (sscanf(string, scheck(string, "%d:%d"), &hh, &mm) == 2)
-               ss = 0;
-       else if (sscanf(string, scheck(string, "%d:%d:%d"),
-               &hh, &mm, &ss) != 3) {
-                       error(errstring);
-                       return 0;
-       }
-       if ((hh < 0 || hh >= HOURSPERDAY ||
-               mm < 0 || mm >= MINSPERHOUR ||
-               ss < 0 || ss > SECSPERMIN) &&
-               !(hh == HOURSPERDAY && mm == 0 && ss == 0)) {
-                       error(errstring);
-                       return 0;
-       }
-       if (noise && hh == HOURSPERDAY)
-               warning(_("24:00 not handled by pre-1998 versions of zic"));
-       return eitol(sign) *
-               (eitol(hh * MINSPERHOUR + mm) *
-               eitol(SECSPERMIN) + eitol(ss));
-}
-
-static void
-inrule(fields, nfields)
-register char ** const fields;
-const int              nfields;
-{
-       static struct rule      r;
-
-       if (nfields != RULE_FIELDS) {
-               error(_("wrong number of fields on Rule line"));
-               return;
-       }
-       if (*fields[RF_NAME] == '\0') {
-               error(_("nameless rule"));
-               return;
-       }
-       r.r_filename = filename;
-       r.r_linenum = linenum;
-       r.r_stdoff = gethms(fields[RF_STDOFF], _("invalid saved time"), TRUE);
-       rulesub(&r, fields[RF_LOYEAR], fields[RF_HIYEAR], fields[RF_COMMAND],
-               fields[RF_MONTH], fields[RF_DAY], fields[RF_TOD]);
-       r.r_name = ecpyalloc(fields[RF_NAME]);
-       r.r_abbrvar = ecpyalloc(fields[RF_ABBRVAR]);
-       rules = (struct rule *) (void *) erealloc((char *) rules,
-               (int) ((nrules + 1) * sizeof *rules));
-       rules[nrules++] = r;
-}
-
-static int
-inzone(fields, nfields)
-register char ** const fields;
-const int              nfields;
-{
-       register int    i;
-       static char *   buf;
-
-       if (nfields < ZONE_MINFIELDS || nfields > ZONE_MAXFIELDS) {
-               error(_("wrong number of fields on Zone line"));
-               return FALSE;
-       }
-       if (strcmp(fields[ZF_NAME], TZDEFAULT) == 0 && lcltime != NULL) {
-               buf = erealloc(buf, (int) (132 + strlen(TZDEFAULT)));
-               (void) sprintf(buf,
-_("\"Zone %s\" line and -l option are mutually exclusive"),
-                       TZDEFAULT);
-               error(buf);
-               return FALSE;
-       }
-       if (strcmp(fields[ZF_NAME], TZDEFRULES) == 0 && psxrules != NULL) {
-               buf = erealloc(buf, (int) (132 + strlen(TZDEFRULES)));
-               (void) sprintf(buf,
-_("\"Zone %s\" line and -p option are mutually exclusive"),
-                       TZDEFRULES);
-               error(buf);
-               return FALSE;
-       }
-       for (i = 0; i < nzones; ++i)
-               if (zones[i].z_name != NULL &&
-                       strcmp(zones[i].z_name, fields[ZF_NAME]) == 0) {
-                               buf = erealloc(buf, (int) (132 +
-                                       strlen(fields[ZF_NAME]) +
-                                       strlen(zones[i].z_filename)));
-                               (void) sprintf(buf,
-_("duplicate zone name %s (file \"%s\", line %d)"),
-                                       fields[ZF_NAME],
-                                       zones[i].z_filename,
-                                       zones[i].z_linenum);
-                               error(buf);
-                               return FALSE;
-               }
-       return inzsub(fields, nfields, FALSE);
-}
-
-static int
-inzcont(fields, nfields)
-register char ** const fields;
-const int              nfields;
-{
-       if (nfields < ZONEC_MINFIELDS || nfields > ZONEC_MAXFIELDS) {
-               error(_("wrong number of fields on Zone continuation line"));
-               return FALSE;
-       }
-       return inzsub(fields, nfields, TRUE);
-}
-
-static int
-inzsub(fields, nfields, iscont)
-register char ** const fields;
-const int              nfields;
-const int              iscont;
-{
-       register char *         cp;
-       static struct zone      z;
-       register int            i_gmtoff, i_rule, i_format;
-       register int            i_untilyear, i_untilmonth;
-       register int            i_untilday, i_untiltime;
-       register int            hasuntil;
-
-       if (iscont) {
-               i_gmtoff = ZFC_GMTOFF;
-               i_rule = ZFC_RULE;
-               i_format = ZFC_FORMAT;
-               i_untilyear = ZFC_TILYEAR;
-               i_untilmonth = ZFC_TILMONTH;
-               i_untilday = ZFC_TILDAY;
-               i_untiltime = ZFC_TILTIME;
-               z.z_name = NULL;
-       } else {
-               i_gmtoff = ZF_GMTOFF;
-               i_rule = ZF_RULE;
-               i_format = ZF_FORMAT;
-               i_untilyear = ZF_TILYEAR;
-               i_untilmonth = ZF_TILMONTH;
-               i_untilday = ZF_TILDAY;
-               i_untiltime = ZF_TILTIME;
-               z.z_name = ecpyalloc(fields[ZF_NAME]);
-       }
-       z.z_filename = filename;
-       z.z_linenum = linenum;
-       z.z_gmtoff = gethms(fields[i_gmtoff], _("invalid UTC offset"), TRUE);
-       if ((cp = strchr(fields[i_format], '%')) != 0) {
-               if (*++cp != 's' || strchr(cp, '%') != 0) {
-                       error(_("invalid abbreviation format"));
-                       return FALSE;
-               }
-       }
-       z.z_rule = ecpyalloc(fields[i_rule]);
-       z.z_format = ecpyalloc(fields[i_format]);
-       hasuntil = nfields > i_untilyear;
-       if (hasuntil) {
-               z.z_untilrule.r_filename = filename;
-               z.z_untilrule.r_linenum = linenum;
-               rulesub(&z.z_untilrule,
-                       fields[i_untilyear],
-                       "only",
-                       "",
-                       (nfields > i_untilmonth) ?
-                       fields[i_untilmonth] : "Jan",
-                       (nfields > i_untilday) ? fields[i_untilday] : "1",
-                       (nfields > i_untiltime) ? fields[i_untiltime] : "0");
-               z.z_untiltime = rpytime(&z.z_untilrule,
-                       z.z_untilrule.r_loyear);
-               if (iscont && nzones > 0 &&
-                       z.z_untiltime > min_time &&
-                       z.z_untiltime < max_time &&
-                       zones[nzones - 1].z_untiltime > min_time &&
-                       zones[nzones - 1].z_untiltime < max_time &&
-                       zones[nzones - 1].z_untiltime >= z.z_untiltime) {
-                               error(_(
-"Zone continuation line end time is not after end time of previous line"
-                                       ));
-                               return FALSE;
-               }
-       }
-       zones = (struct zone *) (void *) erealloc((char *) zones,
-               (int) ((nzones + 1) * sizeof *zones));
-       zones[nzones++] = z;
-       /*
-       ** If there was an UNTIL field on this line,
-       ** there's more information about the zone on the next line.
-       */
-       return hasuntil;
-}
-
-static void
-inleap(fields, nfields)
-register char ** const fields;
-const int              nfields;
-{
-       register const char *           cp;
-       register const struct lookup *  lp;
-       register int                    i, j;
-       int                             year, month, day;
-       long                            dayoff, tod;
-       zic_t                           t;
-
-       if (nfields != LEAP_FIELDS) {
-               error(_("wrong number of fields on Leap line"));
-               return;
-       }
-       dayoff = 0;
-       cp = fields[LP_YEAR];
-       if (sscanf(cp, scheck(cp, "%d"), &year) != 1) {
-               /*
-               ** Leapin' Lizards!
-               */
-               error(_("invalid leaping year"));
-               return;
-       }
-       j = EPOCH_YEAR;
-       while (j != year) {
-               if (year > j) {
-                       i = len_years[isleap(j)];
-                       ++j;
-               } else {
-                       --j;
-                       i = -len_years[isleap(j)];
-               }
-               dayoff = oadd(dayoff, eitol(i));
-       }
-       if ((lp = byword(fields[LP_MONTH], mon_names)) == NULL) {
-               error(_("invalid month name"));
-               return;
-       }
-       month = lp->l_value;
-       j = TM_JANUARY;
-       while (j != month) {
-               i = len_months[isleap(year)][j];
-               dayoff = oadd(dayoff, eitol(i));
-               ++j;
-       }
-       cp = fields[LP_DAY];
-       if (sscanf(cp, scheck(cp, "%d"), &day) != 1 ||
-               day <= 0 || day > len_months[isleap(year)][month]) {
-                       error(_("invalid day of month"));
-                       return;
-       }
-       dayoff = oadd(dayoff, eitol(day - 1));
-       if (dayoff < 0 && !TYPE_SIGNED(zic_t)) {
-               error(_("time before zero"));
-               return;
-       }
-       if (dayoff < min_time / SECSPERDAY) {
-               error(_("time too small"));
-               return;
-       }
-       if (dayoff > max_time / SECSPERDAY) {
-               error(_("time too large"));
-               return;
-       }
-       t = (zic_t) dayoff * SECSPERDAY;
-       tod = gethms(fields[LP_TIME], _("invalid time of day"), FALSE);
-       cp = fields[LP_CORR];
-       {
-               register int    positive;
-               int             count;
-
-               if (strcmp(cp, "") == 0) { /* infile() turns "-" into "" */
-                       positive = FALSE;
-                       count = 1;
-               } else if (strcmp(cp, "--") == 0) {
-                       positive = FALSE;
-                       count = 2;
-               } else if (strcmp(cp, "+") == 0) {
-                       positive = TRUE;
-                       count = 1;
-               } else if (strcmp(cp, "++") == 0) {
-                       positive = TRUE;
-                       count = 2;
-               } else {
-                       error(_("illegal CORRECTION field on Leap line"));
-                       return;
-               }
-               if ((lp = byword(fields[LP_ROLL], leap_types)) == NULL) {
-                       error(_(
-                               "illegal Rolling/Stationary field on Leap line"
-                               ));
-                       return;
-               }
-               leapadd(tadd(t, tod), positive, lp->l_value, count);
-       }
-}
-
-static void
-inlink(fields, nfields)
-register char ** const fields;
-const int              nfields;
-{
-       struct link     l;
-
-       if (nfields != LINK_FIELDS) {
-               error(_("wrong number of fields on Link line"));
-               return;
-       }
-       if (*fields[LF_FROM] == '\0') {
-               error(_("blank FROM field on Link line"));
-               return;
-       }
-       if (*fields[LF_TO] == '\0') {
-               error(_("blank TO field on Link line"));
-               return;
-       }
-       l.l_filename = filename;
-       l.l_linenum = linenum;
-       l.l_from = ecpyalloc(fields[LF_FROM]);
-       l.l_to = ecpyalloc(fields[LF_TO]);
-       links = (struct link *) (void *) erealloc((char *) links,
-               (int) ((nlinks + 1) * sizeof *links));
-       links[nlinks++] = l;
-}
-
-static void
-rulesub(rp, loyearp, hiyearp, typep, monthp, dayp, timep)
-register struct rule * const   rp;
-const char * const             loyearp;
-const char * const             hiyearp;
-const char * const             typep;
-const char * const             monthp;
-const char * const             dayp;
-const char * const             timep;
-{
-       register const struct lookup *  lp;
-       register const char *           cp;
-       register char *                 dp;
-       register char *                 ep;
-
-       if ((lp = byword(monthp, mon_names)) == NULL) {
-               error(_("invalid month name"));
-               return;
-       }
-       rp->r_month = lp->l_value;
-       rp->r_todisstd = FALSE;
-       rp->r_todisgmt = FALSE;
-       dp = ecpyalloc(timep);
-       if (*dp != '\0') {
-               ep = dp + strlen(dp) - 1;
-               switch (lowerit(*ep)) {
-                       case 's':       /* Standard */
-                               rp->r_todisstd = TRUE;
-                               rp->r_todisgmt = FALSE;
-                               *ep = '\0';
-                               break;
-                       case 'w':       /* Wall */
-                               rp->r_todisstd = FALSE;
-                               rp->r_todisgmt = FALSE;
-                               *ep = '\0';
-                               break;
-                       case 'g':       /* Greenwich */
-                       case 'u':       /* Universal */
-                       case 'z':       /* Zulu */
-                               rp->r_todisstd = TRUE;
-                               rp->r_todisgmt = TRUE;
-                               *ep = '\0';
-                               break;
-               }
-       }
-       rp->r_tod = gethms(dp, _("invalid time of day"), FALSE);
-       ifree(dp);
-       /*
-       ** Year work.
-       */
-       cp = loyearp;
-       lp = byword(cp, begin_years);
-       if (lp != NULL) switch ((int) lp->l_value) {
-               case YR_MINIMUM:
-                       rp->r_loyear = INT_MIN;
-                       break;
-               case YR_MAXIMUM:
-                       rp->r_loyear = INT_MAX;
-                       break;
-               default:        /* "cannot happen" */
-                       (void) fprintf(stderr,
-                               _("%s: panic: Invalid l_value %d\n"),
-                               progname, lp->l_value);
-                       exit(EXIT_FAILURE);
-       } else if (sscanf(cp, scheck(cp, "%d"), &rp->r_loyear) != 1) {
-               error(_("invalid starting year"));
-               return;
-       } else if (noise) {
-               if (rp->r_loyear < min_year_representable)
-                       warning(_("starting year too low to be represented"));
-               else if (rp->r_loyear > max_year_representable)
-                       warning(_("starting year too high to be represented"));
-       }
-       cp = hiyearp;
-       if ((lp = byword(cp, end_years)) != NULL) switch ((int) lp->l_value) {
-               case YR_MINIMUM:
-                       rp->r_hiyear = INT_MIN;
-                       break;
-               case YR_MAXIMUM:
-                       rp->r_hiyear = INT_MAX;
-                       break;
-               case YR_ONLY:
-                       rp->r_hiyear = rp->r_loyear;
-                       break;
-               default:        /* "cannot happen" */
-                       (void) fprintf(stderr,
-                               _("%s: panic: Invalid l_value %d\n"),
-                               progname, lp->l_value);
-                       exit(EXIT_FAILURE);
-       } else if (sscanf(cp, scheck(cp, "%d"), &rp->r_hiyear) != 1) {
-               error(_("invalid ending year"));
-               return;
-       } else if (noise) {
-               if (rp->r_loyear < min_year_representable)
-                       warning(_("ending year too low to be represented"));
-               else if (rp->r_loyear > max_year_representable)
-                       warning(_("ending year too high to be represented"));
-       }
-       if (rp->r_loyear > rp->r_hiyear) {
-               error(_("starting year greater than ending year"));
-               return;
-       }
-       if (*typep == '\0')
-               rp->r_yrtype = NULL;
-       else {
-               if (rp->r_loyear == rp->r_hiyear) {
-                       error(_("typed single year"));
-                       return;
-               }
-               rp->r_yrtype = ecpyalloc(typep);
-       }
-       if (rp->r_loyear < min_year && rp->r_loyear > 0)
-               min_year = rp->r_loyear;
-       /*
-       ** Day work.
-       ** Accept things such as:
-       **      1
-       **      last-Sunday
-       **      Sun<=20
-       **      Sun>=7
-       */
-       dp = ecpyalloc(dayp);
-       if ((lp = byword(dp, lasts)) != NULL) {
-               rp->r_dycode = DC_DOWLEQ;
-               rp->r_wday = lp->l_value;
-               rp->r_dayofmonth = len_months[1][rp->r_month];
-       } else {
-               if ((ep = strchr(dp, '<')) != 0)
-                       rp->r_dycode = DC_DOWLEQ;
-               else if ((ep = strchr(dp, '>')) != 0)
-                       rp->r_dycode = DC_DOWGEQ;
-               else {
-                       ep = dp;
-                       rp->r_dycode = DC_DOM;
-               }
-               if (rp->r_dycode != DC_DOM) {
-                       *ep++ = 0;
-                       if (*ep++ != '=') {
-                               error(_("invalid day of month"));
-                               ifree(dp);
-                               return;
-                       }
-                       if ((lp = byword(dp, wday_names)) == NULL) {
-                               error(_("invalid weekday name"));
-                               ifree(dp);
-                               return;
-                       }
-                       rp->r_wday = lp->l_value;
-               }
-               if (sscanf(ep, scheck(ep, "%d"), &rp->r_dayofmonth) != 1 ||
-                       rp->r_dayofmonth <= 0 ||
-                       (rp->r_dayofmonth > len_months[1][rp->r_month])) {
-                               error(_("invalid day of month"));
-                               ifree(dp);
-                               return;
-               }
-       }
-       ifree(dp);
-}
-
-static void
-convert(val, buf)
-const long     val;
-char * const   buf;
-{
-       register int    i;
-       register long   shift;
-
-       for (i = 0, shift = 24; i < 4; ++i, shift -= 8)
-               buf[i] = val >> shift;
-}
-
-static void
-puttzcode(val, fp)
-const long     val;
-FILE * const   fp;
-{
-       char    buf[4];
-
-       convert(val, buf);
-       (void) fwrite((void *) buf, (size_t) sizeof buf, (size_t) 1, fp);
-}
-
-static int
-atcomp(const void *    avp, const void *       bvp)
-{
-       if (((struct attype *) avp)->at < ((struct attype *) bvp)->at)
-               return -1;
-       else if (((struct attype *) avp)->at > ((struct attype *) bvp)->at)
-               return 1;
-       else    return 0;
-}
-
-static void
-writezone(name)
-const char * const     name;
-{
-       register FILE *         fp;
-       register int            i, j;
-       static char *           fullname;
-       static struct tzhead    tzh;
-       zic_t                   ats[TZ_MAX_TIMES];
-       unsigned char           types[TZ_MAX_TIMES];
-
-       /*
-       ** Sort.
-       */
-       if (timecnt > 1)
-               (void) qsort((void *) attypes, (size_t) timecnt,
-                       (size_t) sizeof *attypes, atcomp);
-       /*
-       ** Optimize.
-       */
-       {
-               int     fromi;
-               int     toi;
-
-               toi = 0;
-               fromi = 0;
-               while (fromi < timecnt && attypes[fromi].at < min_time)
-                       ++fromi;
-               if (isdsts[0] == 0)
-                       while (fromi < timecnt && attypes[fromi].type == 0)
-                               ++fromi;        /* handled by default rule */
-               for ( ; fromi < timecnt; ++fromi) {
-                       if (toi != 0 && ((attypes[fromi].at +
-                               gmtoffs[attypes[toi - 1].type]) <=
-                               (attypes[toi - 1].at + gmtoffs[toi == 1 ? 0
-                               : attypes[toi - 2].type]))) {
-                                       attypes[toi - 1].type =
-                                               attypes[fromi].type;
-                                       continue;
-                       }
-                       if (toi == 0 ||
-                               attypes[toi - 1].type != attypes[fromi].type)
-                                       attypes[toi++] = attypes[fromi];
-               }
-               timecnt = toi;
-       }
-       /*
-       ** Transfer.
-       */
-       for (i = 0; i < timecnt; ++i) {
-               ats[i] = attypes[i].at;
-               types[i] = attypes[i].type;
-       }
-       fullname = erealloc(fullname,
-               (int) (strlen(directory) + 1 + strlen(name) + 1));
-       (void) sprintf(fullname, "%s/%s", directory, name);
-       /*
-       ** Remove old file, if any, to snap links.
-       */
-       if (!itsdir(fullname) && remove(fullname) != 0 && errno != ENOENT) {
-               const char *e = strerror(errno);
-
-               (void) fprintf(stderr, _("%s: Can't remove %s: %s\n"),
-                       progname, fullname, e);
-               exit(EXIT_FAILURE);
-       }
-       if ((fp = fopen(fullname, "wb")) == NULL) {
-               if (mkdirs(fullname) != 0)
-                       exit(EXIT_FAILURE);
-               if ((fp = fopen(fullname, "wb")) == NULL) {
-                       const char *e = strerror(errno);
-
-                       (void) fprintf(stderr, _("%s: Can't create %s: %s\n"),
-                               progname, fullname, e);
-                       exit(EXIT_FAILURE);
-               }
-       }
-       convert(eitol(typecnt), tzh.tzh_ttisgmtcnt);
-       convert(eitol(typecnt), tzh.tzh_ttisstdcnt);
-       convert(eitol(leapcnt), tzh.tzh_leapcnt);
-       convert(eitol(timecnt), tzh.tzh_timecnt);
-       convert(eitol(typecnt), tzh.tzh_typecnt);
-       convert(eitol(charcnt), tzh.tzh_charcnt);
-       (void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
-#define DO(field)      (void) fwrite((void *) tzh.field, \
-                               (size_t) sizeof tzh.field, (size_t) 1, fp)
-       DO(tzh_magic);
-       DO(tzh_reserved);
-       DO(tzh_ttisgmtcnt);
-       DO(tzh_ttisstdcnt);
-       DO(tzh_leapcnt);
-       DO(tzh_timecnt);
-       DO(tzh_typecnt);
-       DO(tzh_charcnt);
-#undef DO
-       for (i = 0; i < timecnt; ++i) {
-               j = leapcnt;
-               while (--j >= 0)
-                       if (ats[i] >= trans[j]) {
-                               ats[i] = tadd(ats[i], corr[j]);
-                               break;
-                       }
-               puttzcode((long) ats[i], fp);
-       }
-       if (timecnt > 0)
-               (void) fwrite((void *) types, (size_t) sizeof types[0],
-                       (size_t) timecnt, fp);
-       for (i = 0; i < typecnt; ++i) {
-               puttzcode((long) gmtoffs[i], fp);
-               (void) putc(isdsts[i], fp);
-               (void) putc(abbrinds[i], fp);
-       }
-       if (charcnt != 0)
-               (void) fwrite((void *) chars, (size_t) sizeof chars[0],
-                       (size_t) charcnt, fp);
-       for (i = 0; i < leapcnt; ++i) {
-               if (roll[i]) {
-                       if (timecnt == 0 || trans[i] < ats[0]) {
-                               j = 0;
-                               while (isdsts[j])
-                                       if (++j >= typecnt) {
-                                               j = 0;
-                                               break;
-                                       }
-                       } else {
-                               j = 1;
-                               while (j < timecnt && trans[i] >= ats[j])
-                                       ++j;
-                               j = types[j - 1];
-                       }
-                       puttzcode((long) tadd(trans[i], -gmtoffs[j]), fp);
-               } else  puttzcode((long) trans[i], fp);
-               puttzcode((long) corr[i], fp);
-       }
-       for (i = 0; i < typecnt; ++i)
-               (void) putc(ttisstds[i], fp);
-       for (i = 0; i < typecnt; ++i)
-               (void) putc(ttisgmts[i], fp);
-       if (ferror(fp) || fclose(fp)) {
-               (void) fprintf(stderr, _("%s: Error writing %s\n"),
-                       progname, fullname);
-               exit(EXIT_FAILURE);
-       }
-}
-
-static void
-doabbr(abbr, format, letters, isdst)
-char * const           abbr;
-const char * const     format;
-const char * const     letters;
-const int              isdst;
-{
-       if (strchr(format, '/') == NULL) {
-               if (letters == NULL)
-                       (void) strcpy(abbr, format);
-               else    (void) sprintf(abbr, format, letters);
-       } else if (isdst)
-               (void) strcpy(abbr, strchr(format, '/') + 1);
-       else {
-               (void) strcpy(abbr, format);
-               *strchr(abbr, '/') = '\0';
-       }
-}
-
-static void
-outzone(zpfirst, zonecount)
-const struct zone * const      zpfirst;
-const int                      zonecount;
-{
-       register const struct zone *    zp;
-       register struct rule *          rp;
-       register int                    i, j;
-       register int                    usestart, useuntil;
-       register zic_t                  starttime, untiltime;
-       register long                   gmtoff;
-       register long                   stdoff;
-       register int                    year;
-       register long                   startoff;
-       register int                    startttisstd;
-       register int                    startttisgmt;
-       register int                    type;
-       char                            startbuf[BUFSIZ];
-
-       INITIALIZE(untiltime);
-       INITIALIZE(starttime);
-       /*
-       ** Now. . .finally. . .generate some useful data!
-       */
-       timecnt = 0;
-       typecnt = 0;
-       charcnt = 0;
-       /*
-       ** Thanks to Earl Chew
-       ** for noting the need to unconditionally initialize startttisstd.
-       */
-       startttisstd = FALSE;
-       startttisgmt = FALSE;
-       for (i = 0; i < zonecount; ++i) {
-               /*
-               ** A guess that may well be corrected later.
-               */
-               stdoff = 0;
-               zp = &zpfirst[i];
-               usestart = i > 0 && (zp - 1)->z_untiltime > min_time;
-               useuntil = i < (zonecount - 1);
-               if (useuntil && zp->z_untiltime <= min_time)
-                       continue;
-               gmtoff = zp->z_gmtoff;
-               eat(zp->z_filename, zp->z_linenum);
-               *startbuf = '\0';
-               startoff = zp->z_gmtoff;
-               if (zp->z_nrules == 0) {
-                       stdoff = zp->z_stdoff;
-                       doabbr(startbuf, zp->z_format,
-                               (char *) NULL, stdoff != 0);
-                       type = addtype(oadd(zp->z_gmtoff, stdoff),
-                               startbuf, stdoff != 0, startttisstd,
-                               startttisgmt);
-                       if (usestart) {
-                               addtt(starttime, type);
-                               usestart = FALSE;
-                       } else if (stdoff != 0)
-                               addtt(min_time, type);
-               } else for (year = min_year; year <= max_year; ++year) {
-                       if (useuntil && year > zp->z_untilrule.r_hiyear)
-                               break;
-                       /*
-                       ** Mark which rules to do in the current year.
-                       ** For those to do, calculate rpytime(rp, year);
-                       */
-                       for (j = 0; j < zp->z_nrules; ++j) {
-                               rp = &zp->z_rules[j];
-                               eats(zp->z_filename, zp->z_linenum,
-                                       rp->r_filename, rp->r_linenum);
-                               rp->r_todo = year >= rp->r_loyear &&
-                                               year <= rp->r_hiyear &&
-                                               yearistype(year, rp->r_yrtype);
-                               if (rp->r_todo)
-                                       rp->r_temp = rpytime(rp, year);
-                       }
-                       for ( ; ; ) {
-                               register int    k;
-                               register zic_t  jtime, ktime;
-                               register long   offset;
-                               char            buf[BUFSIZ];
-
-                               INITIALIZE(ktime);
-                               if (useuntil) {
-                                       /*
-                                       ** Turn untiltime into UTC
-                                       ** assuming the current gmtoff and
-                                       ** stdoff values.
-                                       */
-                                       untiltime = zp->z_untiltime;
-                                       if (!zp->z_untilrule.r_todisgmt)
-                                               untiltime = tadd(untiltime,
-                                                       -gmtoff);
-                                       if (!zp->z_untilrule.r_todisstd)
-                                               untiltime = tadd(untiltime,
-                                                       -stdoff);
-                               }
-                               /*
-                               ** Find the rule (of those to do, if any)
-                               ** that takes effect earliest in the year.
-                               */
-                               k = -1;
-                               for (j = 0; j < zp->z_nrules; ++j) {
-                                       rp = &zp->z_rules[j];
-                                       if (!rp->r_todo)
-                                               continue;
-                                       eats(zp->z_filename, zp->z_linenum,
-                                               rp->r_filename, rp->r_linenum);
-                                       offset = rp->r_todisgmt ? 0 : gmtoff;
-                                       if (!rp->r_todisstd)
-                                               offset = oadd(offset, stdoff);
-                                       jtime = rp->r_temp;
-                                       if (jtime == min_time ||
-                                               jtime == max_time)
-                                                       continue;
-                                       jtime = tadd(jtime, -offset);
-                                       if (k < 0 || jtime < ktime) {
-                                               k = j;
-                                               ktime = jtime;
-                                       }
-                               }
-                               if (k < 0)
-                                       break;  /* go on to next year */
-                               rp = &zp->z_rules[k];
-                               rp->r_todo = FALSE;
-                               if (useuntil && ktime >= untiltime)
-                                       break;
-                               stdoff = rp->r_stdoff;
-                               if (usestart && ktime == starttime)
-                                       usestart = FALSE;
-                               if (usestart) {
-                                       if (ktime < starttime) {
-                                               startoff = oadd(zp->z_gmtoff,
-                                                       stdoff);
-                                               doabbr(startbuf, zp->z_format,
-                                                       rp->r_abbrvar,
-                                                       rp->r_stdoff != 0);
-                                               continue;
-                                       }
-                                       if (*startbuf == '\0' &&
-                                               startoff == oadd(zp->z_gmtoff,
-                                               stdoff))
-                                                       doabbr(startbuf,
-                                                               zp->z_format,
-                                                               rp->r_abbrvar,
-                                                               rp->r_stdoff !=
-                                                               0);
-                               }
-                               eats(zp->z_filename, zp->z_linenum,
-                                       rp->r_filename, rp->r_linenum);
-                               doabbr(buf, zp->z_format, rp->r_abbrvar,
-                                       rp->r_stdoff != 0);
-                               offset = oadd(zp->z_gmtoff, rp->r_stdoff);
-                               type = addtype(offset, buf, rp->r_stdoff != 0,
-                                       rp->r_todisstd, rp->r_todisgmt);
-                               addtt(ktime, type);
-                       }
-               }
-               if (usestart) {
-                       if (*startbuf == '\0' &&
-                               zp->z_format != NULL &&
-                               strchr(zp->z_format, '%') == NULL &&
-                               strchr(zp->z_format, '/') == NULL)
-                                       (void) strcpy(startbuf, zp->z_format);
-                       eat(zp->z_filename, zp->z_linenum);
-                       if (*startbuf == '\0')
-error(_("can't determine time zone abbreviation to use just after until time"));
-                       else    addtt(starttime,
-                                       addtype(startoff, startbuf,
-                                               startoff != zp->z_gmtoff,
-                                               startttisstd,
-                                               startttisgmt));
-               }
-               /*
-               ** Now we may get to set starttime for the next zone line.
-               */
-               if (useuntil) {
-                       startttisstd = zp->z_untilrule.r_todisstd;
-                       startttisgmt = zp->z_untilrule.r_todisgmt;
-                       starttime = zp->z_untiltime;
-                       if (!startttisstd)
-                               starttime = tadd(starttime, -stdoff);
-                       if (!startttisgmt)
-                               starttime = tadd(starttime, -gmtoff);
-               }
-       }
-       writezone(zpfirst->z_name);
-}
-
-static void
-addtt(starttime, type)
-const zic_t    starttime;
-int            type;
-{
-       if (starttime <= min_time ||
-               (timecnt == 1 && attypes[0].at < min_time)) {
-               gmtoffs[0] = gmtoffs[type];
-               isdsts[0] = isdsts[type];
-               ttisstds[0] = ttisstds[type];
-               ttisgmts[0] = ttisgmts[type];
-               if (abbrinds[type] != 0)
-                       (void) strcpy(chars, &chars[abbrinds[type]]);
-               abbrinds[0] = 0;
-               charcnt = strlen(chars) + 1;
-               typecnt = 1;
-               timecnt = 0;
-               type = 0;
-       }
-       if (timecnt >= TZ_MAX_TIMES) {
-               error(_("too many transitions?!"));
-               exit(EXIT_FAILURE);
-       }
-       attypes[timecnt].at = starttime;
-       attypes[timecnt].type = type;
-       ++timecnt;
-}
-
-static int
-addtype(gmtoff, abbr, isdst, ttisstd, ttisgmt)
-const long             gmtoff;
-const char * const     abbr;
-const int              isdst;
-const int              ttisstd;
-const int              ttisgmt;
-{
-       register int    i, j;
-
-       if (isdst != TRUE && isdst != FALSE) {
-               error(_("internal error - addtype called with bad isdst"));
-               exit(EXIT_FAILURE);
-       }
-       if (ttisstd != TRUE && ttisstd != FALSE) {
-               error(_("internal error - addtype called with bad ttisstd"));
-               exit(EXIT_FAILURE);
-       }
-       if (ttisgmt != TRUE && ttisgmt != FALSE) {
-               error(_("internal error - addtype called with bad ttisgmt"));
-               exit(EXIT_FAILURE);
-       }
-       /*
-       ** See if there's already an entry for this zone type.
-       ** If so, just return its index.
-       */
-       for (i = 0; i < typecnt; ++i) {
-               if (gmtoff == gmtoffs[i] && isdst == isdsts[i] &&
-                       strcmp(abbr, &chars[abbrinds[i]]) == 0 &&
-                       ttisstd == ttisstds[i] &&
-                       ttisgmt == ttisgmts[i])
-                               return i;
-       }
-       /*
-       ** There isn't one; add a new one, unless there are already too
-       ** many.
-       */
-       if (typecnt >= TZ_MAX_TYPES) {
-               error(_("too many local time types"));
-               exit(EXIT_FAILURE);
-       }
-       gmtoffs[i] = gmtoff;
-       isdsts[i] = isdst;
-       ttisstds[i] = ttisstd;
-       ttisgmts[i] = ttisgmt;
-
-       for (j = 0; j < charcnt; ++j)
-               if (strcmp(&chars[j], abbr) == 0)
-                       break;
-       if (j == charcnt)
-               newabbr(abbr);
-       abbrinds[i] = j;
-       ++typecnt;
-       return i;
-}
-
-static void
-leapadd(t, positive, rolling, count)
-const zic_t    t;
-const int      positive;
-const int      rolling;
-int            count;
-{
-       register int    i, j;
-
-       if (leapcnt + (positive ? count : 1) > TZ_MAX_LEAPS) {
-               error(_("too many leap seconds"));
-               exit(EXIT_FAILURE);
-       }
-       for (i = 0; i < leapcnt; ++i)
-               if (t <= trans[i]) {
-                       if (t == trans[i]) {
-                               error(_("repeated leap second moment"));
-                               exit(EXIT_FAILURE);
-                       }
-                       break;
-               }
-       do {
-               for (j = leapcnt; j > i; --j) {
-                       trans[j] = trans[j - 1];
-                       corr[j] = corr[j - 1];
-                       roll[j] = roll[j - 1];
-               }
-               trans[i] = t;
-               corr[i] = positive ? 1L : eitol(-count);
-               roll[i] = rolling;
-               ++leapcnt;
-       } while (positive && --count != 0);
-}
-
-static void
-adjleap P((void))
-{
-       register int    i;
-       register long   last = 0;
-
-       /*
-       ** propagate leap seconds forward
-       */
-       for (i = 0; i < leapcnt; ++i) {
-               trans[i] = tadd(trans[i], last);
-               last = corr[i] += last;
-       }
-}
-
-static int
-yearistype(year, type)
-const int              year;
-const char * const     type;
-{
-       static char *   buf;
-       int             result;
-
-       if (type == NULL || *type == '\0')
-               return TRUE;
-       buf = erealloc(buf, (int) (132 + strlen(yitcommand) + strlen(type)));
-       (void) sprintf(buf, "%s %d %s", yitcommand, year, type);
-       result = system(buf);
-       if (WIFEXITED(result)) switch (WEXITSTATUS(result)) {
-               case 0:
-                       return TRUE;
-               case 1:
-                       return FALSE;
-       }
-       error(_("Wild result from command execution"));
-       (void) fprintf(stderr, _("%s: command was '%s', result was %d\n"),
-               progname, buf, result);
-       for ( ; ; )
-               exit(EXIT_FAILURE);
-}
-
-static int
-lowerit(a)
-int    a;
-{
-       a = (unsigned char) a;
-       return (isascii(a) && isupper(a)) ? tolower(a) : a;
-}
-
-static int
-ciequal(ap, bp)                /* case-insensitive equality */
-register const char *  ap;
-register const char *  bp;
-{
-       while (lowerit(*ap) == lowerit(*bp++))
-               if (*ap++ == '\0')
-                       return TRUE;
-       return FALSE;
-}
-
-static int
-itsabbr(abbr, word)
-register const char *  abbr;
-register const char *  word;
-{
-       if (lowerit(*abbr) != lowerit(*word))
-               return FALSE;
-       ++word;
-       while (*++abbr != '\0')
-               do {
-                       if (*word == '\0')
-                               return FALSE;
-               } while (lowerit(*word++) != lowerit(*abbr));
-       return TRUE;
-}
-
-static const struct lookup *
-byword(word, table)
-register const char * const            word;
-register const struct lookup * const   table;
-{
-       register const struct lookup *  foundlp;
-       register const struct lookup *  lp;
-
-       if (word == NULL || table == NULL)
-               return NULL;
-       /*
-       ** Look for exact match.
-       */
-       for (lp = table; lp->l_word != NULL; ++lp)
-               if (ciequal(word, lp->l_word))
-                       return lp;
-       /*
-       ** Look for inexact match.
-       */
-       foundlp = NULL;
-       for (lp = table; lp->l_word != NULL; ++lp)
-               if (itsabbr(word, lp->l_word)) {
-                       if (foundlp == NULL)
-                               foundlp = lp;
-                       else    return NULL;    /* multiple inexact matches */
-               }
-       return foundlp;
-}
-
-static char **
-getfields(cp)
-register char *        cp;
-{
-       register char *         dp;
-       register char **        array;
-       register int            nsubs;
-
-       if (cp == NULL)
-               return NULL;
-       array = (char **) (void *)
-               emalloc((int) ((strlen(cp) + 1) * sizeof *array));
-       nsubs = 0;
-       for ( ; ; ) {
-               while (isascii((unsigned char) *cp) &&
-                       isspace((unsigned char) *cp))
-                               ++cp;
-               if (*cp == '\0' || *cp == '#')
-                       break;
-               array[nsubs++] = dp = cp;
-               do {
-                       if ((*dp = *cp++) != '"')
-                               ++dp;
-                       else while ((*dp = *cp++) != '"')
-                               if (*dp != '\0')
-                                       ++dp;
-                               else    error(_(
-                                               "Odd number of quotation marks"
-                                               ));
-               } while (*cp != '\0' && *cp != '#' &&
-                       (!isascii(*cp) || !isspace((unsigned char) *cp)));
-               if (isascii(*cp) && isspace((unsigned char) *cp))
-                       ++cp;
-               *dp = '\0';
-       }
-       array[nsubs] = NULL;
-       return array;
-}
-
-static long
-oadd(t1, t2)
-const long     t1;
-const long     t2;
-{
-       register long   t;
-
-       t = t1 + t2;
-       if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1)) {
-               error(_("time overflow"));
-               exit(EXIT_FAILURE);
-       }
-       return t;
-}
-
-static zic_t
-tadd(t1, t2)
-const zic_t    t1;
-const long     t2;
-{
-       register zic_t  t;
-
-       if (t1 == max_time && t2 > 0)
-               return max_time;
-       if (t1 == min_time && t2 < 0)
-               return min_time;
-       t = t1 + t2;
-       if ((t2 > 0 && t <= t1) || (t2 < 0 && t >= t1)) {
-               error(_("time overflow"));
-               exit(EXIT_FAILURE);
-       }
-       return t;
-}
-
-/*
-** Given a rule, and a year, compute the date - in seconds since January 1,
-** 1970, 00:00 LOCAL time - in that year that the rule refers to.
-*/
-
-static zic_t
-rpytime(rp, wantedy)
-register const struct rule * const     rp;
-register const int                     wantedy;
-{
-       register int    y, m, i;
-       register long   dayoff;                 /* with a nod to Margaret O. */
-       register zic_t  t;
-
-       if (wantedy == INT_MIN)
-               return min_time;
-       if (wantedy == INT_MAX)
-               return max_time;
-       dayoff = 0;
-       m = TM_JANUARY;
-       y = EPOCH_YEAR;
-       while (wantedy != y) {
-               if (wantedy > y) {
-                       i = len_years[isleap(y)];
-                       ++y;
-               } else {
-                       --y;
-                       i = -len_years[isleap(y)];
-               }
-               dayoff = oadd(dayoff, eitol(i));
-       }
-       while (m != rp->r_month) {
-               i = len_months[isleap(y)][m];
-               dayoff = oadd(dayoff, eitol(i));
-               ++m;
-       }
-       i = rp->r_dayofmonth;
-       if (m == TM_FEBRUARY && i == 29 && !isleap(y)) {
-               if (rp->r_dycode == DC_DOWLEQ)
-                       --i;
-               else {
-                       error(_("use of 2/29 in non leap-year"));
-                       exit(EXIT_FAILURE);
-               }
-       }
-       --i;
-       dayoff = oadd(dayoff, eitol(i));
-       if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ) {
-               register long   wday;
-
-#define LDAYSPERWEEK   ((long) DAYSPERWEEK)
-               wday = eitol(EPOCH_WDAY);
-               /*
-               ** Don't trust mod of negative numbers.
-               */
-               if (dayoff >= 0)
-                       wday = (wday + dayoff) % LDAYSPERWEEK;
-               else {
-                       wday -= ((-dayoff) % LDAYSPERWEEK);
-                       if (wday < 0)
-                               wday += LDAYSPERWEEK;
-               }
-               while (wday != eitol(rp->r_wday))
-                       if (rp->r_dycode == DC_DOWGEQ) {
-                               dayoff = oadd(dayoff, (long) 1);
-                               if (++wday >= LDAYSPERWEEK)
-                                       wday = 0;
-                               ++i;
-                       } else {
-                               dayoff = oadd(dayoff, (long) -1);
-                               if (--wday < 0)
-                                       wday = LDAYSPERWEEK - 1;
-                               --i;
-                       }
-               if (i < 0 || i >= len_months[isleap(y)][m]) {
-                       if (noise)
-                               warning(_("rule goes past start/end of month--\
-will not work with pre-2004 versions of zic"));
-               }
-       }
-       if (dayoff < 0 && !TYPE_SIGNED(zic_t))
-               return min_time;
-       if (dayoff < min_time / SECSPERDAY)
-               return min_time;
-       if (dayoff > max_time / SECSPERDAY)
-               return max_time;
-       t = (zic_t) dayoff * SECSPERDAY;
-       return tadd(t, rp->r_tod);
-}
-
-static void
-newabbr(string)
-const char * const     string;
-{
-       register int    i;
-
-       if (strcmp(string, GRANDPARENTED) != 0) {
-               register const char *   cp;
-               register char *         wp;
-
-               /*
-               ** Want one to ZIC_MAX_ABBR_LEN_WO_WARN alphabetics
-               ** optionally followed by a + or - and a number from 1 to 14.
-               */
-               cp = string;
-               wp = NULL;
-               while (isascii((unsigned char) *cp) &&
-                       isalpha((unsigned char) *cp))
-                               ++cp;
-               if (cp - string == 0)
-wp = _("time zone abbreviation lacks alphabetic at start");
-               if (noise && cp - string > 3)
-wp = _("time zone abbreviation has more than 3 alphabetics");
-               if (cp - string > ZIC_MAX_ABBR_LEN_WO_WARN)
-wp = _("time zone abbreviation has too many alphabetics");
-               if (wp == NULL && (*cp == '+' || *cp == '-')) {
-                       ++cp;
-                       if (isascii((unsigned char) *cp) &&
-                               isdigit((unsigned char) *cp))
-                                       if (*cp++ == '1' &&
-                                               *cp >= '0' && *cp <= '4')
-                                                       ++cp;
-               }
-               if (*cp != '\0')
-wp = _("time zone abbreviation differs from POSIX standard");
-               if (wp != NULL) {
-                       wp = ecpyalloc(wp);
-                       wp = ecatalloc(wp, " (");
-                       wp = ecatalloc(wp, string);
-                       wp = ecatalloc(wp, ")");
-                       warning(wp);
-                       ifree(wp);
-               }
-       }
-       i = strlen(string) + 1;
-       if (charcnt + i > TZ_MAX_CHARS) {
-               error(_("too many, or too long, time zone abbreviations"));
-               exit(EXIT_FAILURE);
-       }
-       (void) strcpy(&chars[charcnt], string);
-       charcnt += eitol(i);
-}
-
-static int
-mkdirs(argname)
-char * const   argname;
-{
-       register char * name;
-       register char * cp;
-
-       if (argname == NULL || *argname == '\0')
-               return 0;
-       cp = name = ecpyalloc(argname);
-       while ((cp = strchr(cp + 1, '/')) != 0) {
-               *cp = '\0';
-#ifndef unix
-               /*
-               ** DOS drive specifier?
-               */
-               if (isalpha((unsigned char) name[0]) &&
-                       name[1] == ':' && name[2] == '\0') {
-                               *cp = '/';
-                               continue;
-               }
-#endif /* !defined unix */
-               if (!itsdir(name)) {
-                       /*
-                       ** It doesn't seem to exist, so we try to create it.
-                       ** Creation may fail because of the directory being
-                       ** created by some other multiprocessor, so we get
-                       ** to do extra checking.
-                       */
-                       if (mkdir(name, MKDIR_UMASK) != 0) {
-                               const char *e = strerror(errno);
-
-                               if (errno != EEXIST || !itsdir(name)) {
-                                       (void) fprintf(stderr,
-_("%s: Can't create directory %s: %s\n"),
-                                               progname, name, e);
-                                       ifree(name);
-                                       return -1;
-                               }
-                       }
-               }
-               *cp = '/';
-       }
-       ifree(name);
-       return 0;
-}
-
-static long
-eitol(i)
-const int      i;
-{
-       long    l;
-
-       l = i;
-       if ((i < 0 && l >= 0) || (i == 0 && l != 0) || (i > 0 && l <= 0)) {
-               (void) fprintf(stderr,
-                       _("%s: %d did not sign extend correctly\n"),
-                       progname, i);
-               exit(EXIT_FAILURE);
-       }
-       return l;
-}
-
-/*
-** UNIX was a registered trademark of The Open Group in 2003.
-*/
similarity index 100%
rename from lib/nbsd_libc/sys/_brk.c
rename to lib/libc/sys/_brk.c
similarity index 100%
rename from lib/nbsd_libc/sys/acct.2
rename to lib/libc/sys/acct.2
similarity index 100%
rename from lib/nbsd_libc/sys/bind.2
rename to lib/libc/sys/bind.2
similarity index 100%
rename from lib/nbsd_libc/sys/brk.2
rename to lib/libc/sys/brk.2
similarity index 100%
rename from lib/nbsd_libc/sys/dup.2
rename to lib/libc/sys/dup.2
similarity index 100%
rename from lib/nbsd_libc/sys/fork.2
rename to lib/libc/sys/fork.2
similarity index 100%
rename from lib/nbsd_libc/sys/kill.2
rename to lib/libc/sys/kill.2
similarity index 100%
rename from lib/nbsd_libc/sys/link.2
rename to lib/libc/sys/link.2
similarity index 100%
rename from lib/nbsd_libc/sys/mmap.2
rename to lib/libc/sys/mmap.2
similarity index 100%
rename from lib/nbsd_libc/sys/mmap.c
rename to lib/libc/sys/mmap.c
similarity index 100%
rename from lib/nbsd_libc/sys/open.2
rename to lib/libc/sys/open.2
similarity index 100%
rename from lib/nbsd_libc/sys/pipe.2
rename to lib/libc/sys/pipe.2
similarity index 100%
rename from lib/nbsd_libc/sys/poll.2
rename to lib/libc/sys/poll.2
similarity index 100%
rename from lib/nbsd_libc/sys/read.2
rename to lib/libc/sys/read.2
similarity index 100%
rename from lib/nbsd_libc/sys/recv.2
rename to lib/libc/sys/recv.2
similarity index 100%
rename from lib/nbsd_libc/sys/send.2
rename to lib/libc/sys/send.2
similarity index 100%
rename from lib/nbsd_libc/sys/stat.2
rename to lib/libc/sys/stat.2
similarity index 100%
rename from lib/nbsd_libc/sys/sync.2
rename to lib/libc/sys/sync.2
similarity index 100%
rename from lib/nbsd_libc/sys/wait.2
rename to lib/libc/sys/wait.2
diff --git a/lib/libc/syscall/Makefile.inc b/lib/libc/syscall/Makefile.inc
deleted file mode 100644 (file)
index 48782ad..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-# syscall sources
-.PATH: ${.CURDIR}/syscall
-
-SRCS+=  \
-       _exit.S \
-       _pm_findproc.S \
-       access.S \
-       alarm.S \
-       brk.S \
-       cfgetispeed.S \
-       cfgetospeed.S \
-       cfsetispeed.S \
-       cfsetospeed.S \
-       chdir.S \
-       chmod.S \
-       chown.S \
-       chroot.S \
-       close.S \
-       closedir.S \
-       cprofile.S \
-       creat.S \
-       dup.S \
-       dup2.S \
-       execl.S \
-       execle.S \
-       execlp.S \
-       execv.S \
-       execve.S \
-       execvp.S \
-       fchown.S \
-       fchmod.S \
-       fcntl.S \
-       fork.S \
-       fpathconf.S \
-       fstat.S \
-       fstatfs.S \
-       fstatvfs.S \
-       getcwd.S \
-       getdents.S \
-       getegid.S \
-       geteuid.S \
-       getgid.S \
-       getgroups.S \
-       getitimer.S \
-       getnpid.S \
-       getnucred.S \
-       getnuid.S \
-       getngid.S \
-       getnprocnr.S \
-       getpgrp.S \
-       getpid.S \
-       getppid.S \
-       getpprocnr.S \
-       getprocnr.S \
-       getuid.S \
-       ioctl.S \
-       isatty.S \
-       kill.S \
-       killpg.S \
-       link.S \
-       lseek.S \
-       lseek64.S \
-       lstat.S \
-       mapdriver.S \
-       mkdir.S \
-       mkfifo.S \
-       mknod.S \
-       mmap.S \
-       munmap.S \
-       vm_getphys.S \
-       vm_getrefcount.S \
-       vm_memctl.S \
-       vm_remap.S \
-       vm_unmap.S \
-       vm_set_priv.S \
-       vm_update.S \
-       vm_query_exit.S \
-       mount.S \
-       nanosleep.S \
-       open.S \
-       opendir.S \
-       pathconf.S \
-       pause.S \
-       pipe.S \
-       ptrace.S \
-       read.S \
-       readdir.S \
-       readlink.S \
-       reboot.S \
-       rename.S \
-       rewinddir.S \
-       rmdir.S \
-       sbrk.S \
-       select.S \
-       seekdir.S \
-       setgid.S \
-       setgroups.S \
-       setitimer.S \
-       setsid.S \
-       setuid.S \
-       sigaction.S \
-       sigaddset.S \
-       sigdelset.S \
-       sigemptyset.S \
-       sigfillset.S \
-       sigismember.S \
-       sigpending.S \
-       sigprocmask.S \
-       sigreturn.S \
-       sigsuspend.S \
-       sleep.S \
-       sprofile.S \
-       stat.S \
-       statvfs.S \
-       stime.S \
-       svrctl.S \
-       symlink.S \
-       sync.S \
-       sysuname.S \
-       tcdrain.S \
-       tcflow.S \
-       tcflush.S \
-       tcgetattr.S \
-       tcsendbreak.S \
-       tcsetattr.S \
-       time.S \
-       times.S \
-       truncate.S \
-       umask.S \
-       umount.S \
-       uname.S \
-       unlink.S \
-       utime.S \
-       wait.S \
-       waitpid.S \
-       write.S
diff --git a/lib/libc/syscall/_exit.S b/lib/libc/syscall/_exit.S
deleted file mode 100644 (file)
index 470ebae..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(__exit)
-ENTRY(_exit)
-       jmp     _C_LABEL(__exit)
-
diff --git a/lib/libc/syscall/_pm_findproc.S b/lib/libc/syscall/_pm_findproc.S
deleted file mode 100644 (file)
index ce0c954..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(__pm_findproc)
-ENTRY(_pm_findproc)
-       jmp     _C_LABEL(__pm_findproc)
-
diff --git a/lib/libc/syscall/access.S b/lib/libc/syscall/access.S
deleted file mode 100644 (file)
index 1e0a86e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_access)
-ENTRY(access)
-       jmp     _C_LABEL(_access)
-
diff --git a/lib/libc/syscall/alarm.S b/lib/libc/syscall/alarm.S
deleted file mode 100644 (file)
index 5256d70..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_alarm)
-ENTRY(alarm)
-       jmp     _C_LABEL(_alarm)
-
diff --git a/lib/libc/syscall/brk.S b/lib/libc/syscall/brk.S
deleted file mode 100644 (file)
index c097632..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_brk)
-ENTRY(brk)
-       jmp     _C_LABEL(_brk)
-
diff --git a/lib/libc/syscall/cfgetispeed.S b/lib/libc/syscall/cfgetispeed.S
deleted file mode 100644 (file)
index 9e308bc..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_cfgetispeed)
-ENTRY(cfgetispeed)
-       jmp     _C_LABEL(_cfgetispeed)
-
diff --git a/lib/libc/syscall/cfgetospeed.S b/lib/libc/syscall/cfgetospeed.S
deleted file mode 100644 (file)
index a2734e3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_cfgetospeed)
-ENTRY(cfgetospeed)
-       jmp     _C_LABEL(_cfgetospeed)
-
diff --git a/lib/libc/syscall/cfsetispeed.S b/lib/libc/syscall/cfsetispeed.S
deleted file mode 100644 (file)
index 230b9bb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_cfsetispeed)
-ENTRY(cfsetispeed)
-       jmp     _C_LABEL(_cfsetispeed)
-
diff --git a/lib/libc/syscall/cfsetospeed.S b/lib/libc/syscall/cfsetospeed.S
deleted file mode 100644 (file)
index d6b1cea..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_cfsetospeed)
-ENTRY(cfsetospeed)
-       jmp     _C_LABEL(_cfsetospeed)
-
diff --git a/lib/libc/syscall/chdir.S b/lib/libc/syscall/chdir.S
deleted file mode 100644 (file)
index e234a24..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_chdir)
-ENTRY(chdir)
-       jmp     _C_LABEL(_chdir)
-
-IMPORT(_fchdir)
-ENTRY(fchdir)
-       jmp     _C_LABEL(_fchdir)
-
diff --git a/lib/libc/syscall/chmod.S b/lib/libc/syscall/chmod.S
deleted file mode 100644 (file)
index cb78d3f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_chmod)
-ENTRY(chmod)
-       jmp     _C_LABEL(_chmod)
-
diff --git a/lib/libc/syscall/chown.S b/lib/libc/syscall/chown.S
deleted file mode 100644 (file)
index c93bc4e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_chown)
-ENTRY(chown)
-       jmp     _C_LABEL(_chown)
-
diff --git a/lib/libc/syscall/chroot.S b/lib/libc/syscall/chroot.S
deleted file mode 100644 (file)
index fa59851..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_chroot)
-ENTRY(chroot)
-       jmp     _C_LABEL(_chroot)
-
diff --git a/lib/libc/syscall/close.S b/lib/libc/syscall/close.S
deleted file mode 100644 (file)
index 34fc826..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_close)
-ENTRY(close)
-       jmp     _C_LABEL(_close)
-
diff --git a/lib/libc/syscall/closedir.S b/lib/libc/syscall/closedir.S
deleted file mode 100644 (file)
index 56a4261..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_closedir)
-ENTRY(closedir)
-       jmp     _C_LABEL(_closedir)
-
diff --git a/lib/libc/syscall/cprofile.S b/lib/libc/syscall/cprofile.S
deleted file mode 100644 (file)
index 5622ec6..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_cprofile)
-ENTRY(cprofile)
-       jmp     _C_LABEL(_cprofile)
-
diff --git a/lib/libc/syscall/creat.S b/lib/libc/syscall/creat.S
deleted file mode 100644 (file)
index 82cf0d3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_creat)
-ENTRY(creat)
-       jmp     _C_LABEL(_creat)
-
diff --git a/lib/libc/syscall/dup.S b/lib/libc/syscall/dup.S
deleted file mode 100644 (file)
index a318063..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_dup)
-ENTRY(dup)
-       jmp     _C_LABEL(_dup)
-
diff --git a/lib/libc/syscall/dup2.S b/lib/libc/syscall/dup2.S
deleted file mode 100644 (file)
index 2cefff8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_dup2)
-ENTRY(dup2)
-       jmp     _C_LABEL(_dup2)
-
diff --git a/lib/libc/syscall/execl.S b/lib/libc/syscall/execl.S
deleted file mode 100644 (file)
index 89368f4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_execl)
-ENTRY(execl)
-       jmp     _C_LABEL(_execl)
-
diff --git a/lib/libc/syscall/execle.S b/lib/libc/syscall/execle.S
deleted file mode 100644 (file)
index cd221e4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_execle)
-ENTRY(execle)
-       jmp     _C_LABEL(_execle)
-
diff --git a/lib/libc/syscall/execlp.S b/lib/libc/syscall/execlp.S
deleted file mode 100644 (file)
index aea8517..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_execlp)
-ENTRY(execlp)
-       jmp     _C_LABEL(_execlp)
-
diff --git a/lib/libc/syscall/execv.S b/lib/libc/syscall/execv.S
deleted file mode 100644 (file)
index 25ceaee..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_execv)
-ENTRY(execv)
-       jmp     _C_LABEL(_execv)
-
diff --git a/lib/libc/syscall/execve.S b/lib/libc/syscall/execve.S
deleted file mode 100644 (file)
index 1cc63b8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_execve)
-ENTRY(execve)
-       jmp     _C_LABEL(_execve)
-
diff --git a/lib/libc/syscall/execvp.S b/lib/libc/syscall/execvp.S
deleted file mode 100644 (file)
index aefdb28..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_execvp)
-ENTRY(execvp)
-       jmp     _C_LABEL(_execvp)
-
diff --git a/lib/libc/syscall/fchmod.S b/lib/libc/syscall/fchmod.S
deleted file mode 100644 (file)
index ce219df..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_fchmod)
-ENTRY(fchmod)
-       jmp     _C_LABEL(_fchmod)
-
diff --git a/lib/libc/syscall/fchown.S b/lib/libc/syscall/fchown.S
deleted file mode 100644 (file)
index 6d23bf9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_fchown)
-ENTRY(fchown)
-       jmp     _C_LABEL(_fchown)
-
diff --git a/lib/libc/syscall/fcntl.S b/lib/libc/syscall/fcntl.S
deleted file mode 100644 (file)
index 804b2b3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_fcntl)
-ENTRY(fcntl)
-       jmp     _C_LABEL(_fcntl)
-
diff --git a/lib/libc/syscall/fork.S b/lib/libc/syscall/fork.S
deleted file mode 100644 (file)
index a0fa84f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_fork)
-ENTRY(fork)
-       jmp     _C_LABEL(_fork)
-
diff --git a/lib/libc/syscall/fpathconf.S b/lib/libc/syscall/fpathconf.S
deleted file mode 100644 (file)
index 970e756..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_fpathconf)
-ENTRY(fpathconf)
-       jmp     _C_LABEL(_fpathconf)
-
diff --git a/lib/libc/syscall/fstat.S b/lib/libc/syscall/fstat.S
deleted file mode 100644 (file)
index d419ef5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_fstat)
-ENTRY(fstat)
-       jmp     _C_LABEL(_fstat)
-
diff --git a/lib/libc/syscall/fstatfs.S b/lib/libc/syscall/fstatfs.S
deleted file mode 100644 (file)
index 1b9eba4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_fstatfs)
-ENTRY(fstatfs)
-       jmp     _C_LABEL(_fstatfs)
-
diff --git a/lib/libc/syscall/fstatvfs.S b/lib/libc/syscall/fstatvfs.S
deleted file mode 100644 (file)
index 52e2c40..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_fstatvfs)
-ENTRY(fstatvfs)
-       jmp     _C_LABEL(_fstatvfs)
-
diff --git a/lib/libc/syscall/getcwd.S b/lib/libc/syscall/getcwd.S
deleted file mode 100644 (file)
index d8a5cc0..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getcwd)
-ENTRY(getcwd)
-       jmp     _C_LABEL(_getcwd)
-
diff --git a/lib/libc/syscall/getdents.S b/lib/libc/syscall/getdents.S
deleted file mode 100644 (file)
index cac5c71..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getdents)
-ENTRY(getdents)
-       jmp     _C_LABEL(_getdents)
-
diff --git a/lib/libc/syscall/getegid.S b/lib/libc/syscall/getegid.S
deleted file mode 100644 (file)
index a18d8c7..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getegid)
-ENTRY(getegid)
-       jmp     _C_LABEL(_getegid)
-
diff --git a/lib/libc/syscall/geteuid.S b/lib/libc/syscall/geteuid.S
deleted file mode 100644 (file)
index 603371d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_geteuid)
-ENTRY(geteuid)
-       jmp     _C_LABEL(_geteuid)
-
diff --git a/lib/libc/syscall/getgid.S b/lib/libc/syscall/getgid.S
deleted file mode 100644 (file)
index 484da0d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getgid)
-ENTRY(getgid)
-       jmp     _C_LABEL(_getgid)
-
diff --git a/lib/libc/syscall/getgroups.S b/lib/libc/syscall/getgroups.S
deleted file mode 100644 (file)
index 3c7de3d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getgroups)
-ENTRY(getgroups)
-       jmp     _C_LABEL(_getgroups)
-
diff --git a/lib/libc/syscall/getitimer.S b/lib/libc/syscall/getitimer.S
deleted file mode 100644 (file)
index db20d78..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getitimer)
-ENTRY(getitimer)
-       jmp     _C_LABEL(_getitimer)
-
diff --git a/lib/libc/syscall/getngid.S b/lib/libc/syscall/getngid.S
deleted file mode 100644 (file)
index d4c51cb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getngid)
-ENTRY(getngid)
-       jmp     _C_LABEL(_getngid)
-
diff --git a/lib/libc/syscall/getnpid.S b/lib/libc/syscall/getnpid.S
deleted file mode 100644 (file)
index 3fdf2e9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getnpid)
-ENTRY(getnpid)
-       jmp     _C_LABEL(_getnpid)
-
diff --git a/lib/libc/syscall/getnprocnr.S b/lib/libc/syscall/getnprocnr.S
deleted file mode 100644 (file)
index 5006e93..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getnprocnr)
-ENTRY(getnprocnr)
-       jmp     _C_LABEL(_getnprocnr)
-
diff --git a/lib/libc/syscall/getnucred.S b/lib/libc/syscall/getnucred.S
deleted file mode 100644 (file)
index c2f1fb9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getnucred)
-ENTRY(getnucred)
-       jmp     _C_LABEL(_getnucred)
-
diff --git a/lib/libc/syscall/getnuid.S b/lib/libc/syscall/getnuid.S
deleted file mode 100644 (file)
index 9029663..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getnuid)
-ENTRY(getnuid)
-       jmp     _C_LABEL(_getnuid)
-
diff --git a/lib/libc/syscall/getpgrp.S b/lib/libc/syscall/getpgrp.S
deleted file mode 100644 (file)
index ba58c21..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getpgrp)
-ENTRY(getpgrp)
-       jmp     _C_LABEL(_getpgrp)
-
diff --git a/lib/libc/syscall/getpid.S b/lib/libc/syscall/getpid.S
deleted file mode 100644 (file)
index 211c5fc..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getpid)
-ENTRY(getpid)
-       jmp     _C_LABEL(_getpid)
-
diff --git a/lib/libc/syscall/getppid.S b/lib/libc/syscall/getppid.S
deleted file mode 100644 (file)
index bda02d5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getppid)
-ENTRY(getppid)
-       jmp     _C_LABEL(_getppid)
-
diff --git a/lib/libc/syscall/getpprocnr.S b/lib/libc/syscall/getpprocnr.S
deleted file mode 100644 (file)
index 8172928..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getpprocnr)
-ENTRY(getpprocnr)
-       jmp     _C_LABEL(_getpprocnr)
-
diff --git a/lib/libc/syscall/getprocnr.S b/lib/libc/syscall/getprocnr.S
deleted file mode 100644 (file)
index dd2051a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getprocnr)
-ENTRY(getprocnr)
-       jmp     _C_LABEL(_getprocnr)
-
diff --git a/lib/libc/syscall/getuid.S b/lib/libc/syscall/getuid.S
deleted file mode 100644 (file)
index 712c433..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_getuid)
-ENTRY(getuid)
-       jmp     _C_LABEL(_getuid)
-
diff --git a/lib/libc/syscall/ioctl.S b/lib/libc/syscall/ioctl.S
deleted file mode 100644 (file)
index d0876cb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_ioctl)
-ENTRY(ioctl)
-       jmp     _C_LABEL(_ioctl)
-
diff --git a/lib/libc/syscall/isatty.S b/lib/libc/syscall/isatty.S
deleted file mode 100644 (file)
index 559fd65..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_isatty)
-ENTRY(isatty)
-       jmp     _C_LABEL(_isatty)
-
diff --git a/lib/libc/syscall/kill.S b/lib/libc/syscall/kill.S
deleted file mode 100644 (file)
index bbbdcdb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_kill)
-ENTRY(kill)
-       jmp     _C_LABEL(_kill)
-
diff --git a/lib/libc/syscall/killpg.S b/lib/libc/syscall/killpg.S
deleted file mode 100644 (file)
index cff838f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_killpg)
-ENTRY(killpg)
-       jmp     _C_LABEL(_killpg)
-
diff --git a/lib/libc/syscall/link.S b/lib/libc/syscall/link.S
deleted file mode 100644 (file)
index b8b01a6..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_link)
-ENTRY(link)
-       jmp     _C_LABEL(_link)
-
diff --git a/lib/libc/syscall/lseek.S b/lib/libc/syscall/lseek.S
deleted file mode 100644 (file)
index d5d1bea..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_lseek)
-ENTRY(lseek)
-       jmp     _C_LABEL(_lseek)
-
diff --git a/lib/libc/syscall/lseek64.S b/lib/libc/syscall/lseek64.S
deleted file mode 100644 (file)
index b445dd5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_lseek64)
-ENTRY(lseek64)
-       jmp     _C_LABEL(_lseek64)
-
diff --git a/lib/libc/syscall/lstat.S b/lib/libc/syscall/lstat.S
deleted file mode 100644 (file)
index 88e7df8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_lstat)
-ENTRY(lstat)
-       jmp     _C_LABEL(_lstat)
-
diff --git a/lib/libc/syscall/mapdriver.S b/lib/libc/syscall/mapdriver.S
deleted file mode 100644 (file)
index 10f328c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_mapdriver)
-ENTRY(mapdriver)
-       jmp     _C_LABEL(_mapdriver)
-
diff --git a/lib/libc/syscall/mkdir.S b/lib/libc/syscall/mkdir.S
deleted file mode 100644 (file)
index 20bde08..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_mkdir)
-ENTRY(mkdir)
-       jmp     _C_LABEL(_mkdir)
-
diff --git a/lib/libc/syscall/mkfifo.S b/lib/libc/syscall/mkfifo.S
deleted file mode 100644 (file)
index 60df68b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_mkfifo)
-ENTRY(mkfifo)
-       jmp     _C_LABEL(_mkfifo)
-
diff --git a/lib/libc/syscall/mknod.S b/lib/libc/syscall/mknod.S
deleted file mode 100644 (file)
index dd0565c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_mknod)
-ENTRY(mknod)
-       jmp     _C_LABEL(_mknod)
-
diff --git a/lib/libc/syscall/mmap.S b/lib/libc/syscall/mmap.S
deleted file mode 100644 (file)
index 364c6eb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_minix_mmap)
-ENTRY(minix_mmap)
-       jmp     _C_LABEL(_minix_mmap)
-
diff --git a/lib/libc/syscall/mount.S b/lib/libc/syscall/mount.S
deleted file mode 100644 (file)
index 0bb46c8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_mount)
-ENTRY(mount)
-       jmp     _C_LABEL(_mount)
-
diff --git a/lib/libc/syscall/munmap.S b/lib/libc/syscall/munmap.S
deleted file mode 100644 (file)
index c770825..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_minix_munmap)
-ENTRY(minix_munmap)
-       jmp     _C_LABEL(_minix_munmap)
-
-IMPORT(_minix_munmap_text)
-ENTRY(minix_munmap_text)
-       jmp     _C_LABEL(_minix_munmap_text)
-
diff --git a/lib/libc/syscall/nanosleep.S b/lib/libc/syscall/nanosleep.S
deleted file mode 100644 (file)
index 63db02d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_nanosleep)
-ENTRY(nanosleep)
-       jmp     _C_LABEL(_nanosleep)
-
diff --git a/lib/libc/syscall/open.S b/lib/libc/syscall/open.S
deleted file mode 100644 (file)
index 0c66064..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_open)
-ENTRY(open)
-       jmp     _C_LABEL(_open)
-
diff --git a/lib/libc/syscall/opendir.S b/lib/libc/syscall/opendir.S
deleted file mode 100644 (file)
index 9b9f3c3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_opendir)
-ENTRY(opendir)
-       jmp     _C_LABEL(_opendir)
-
diff --git a/lib/libc/syscall/pathconf.S b/lib/libc/syscall/pathconf.S
deleted file mode 100644 (file)
index 340400f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_pathconf)
-ENTRY(pathconf)
-       jmp     _C_LABEL(_pathconf)
-
diff --git a/lib/libc/syscall/pause.S b/lib/libc/syscall/pause.S
deleted file mode 100644 (file)
index 1f55503..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_pause)
-ENTRY(pause)
-       jmp     _C_LABEL(_pause)
-
diff --git a/lib/libc/syscall/pipe.S b/lib/libc/syscall/pipe.S
deleted file mode 100644 (file)
index 29ee2f3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_pipe)
-ENTRY(pipe)
-       jmp     _C_LABEL(_pipe)
-
diff --git a/lib/libc/syscall/ptrace.S b/lib/libc/syscall/ptrace.S
deleted file mode 100644 (file)
index cd1b894..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_ptrace)
-ENTRY(ptrace)
-       jmp     _C_LABEL(_ptrace)
-
diff --git a/lib/libc/syscall/read.S b/lib/libc/syscall/read.S
deleted file mode 100644 (file)
index da015ae..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_read)
-ENTRY(read)
-       jmp     _C_LABEL(_read)
-
diff --git a/lib/libc/syscall/readdir.S b/lib/libc/syscall/readdir.S
deleted file mode 100644 (file)
index 42cae1d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_readdir)
-ENTRY(readdir)
-       jmp     _C_LABEL(_readdir)
-
diff --git a/lib/libc/syscall/readlink.S b/lib/libc/syscall/readlink.S
deleted file mode 100644 (file)
index 9159097..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_readlink)
-ENTRY(readlink)
-       jmp     _C_LABEL(_readlink)
-
diff --git a/lib/libc/syscall/reboot.S b/lib/libc/syscall/reboot.S
deleted file mode 100644 (file)
index 06b6413..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_reboot)
-ENTRY(reboot)
-       jmp     _C_LABEL(_reboot)
-
diff --git a/lib/libc/syscall/rename.S b/lib/libc/syscall/rename.S
deleted file mode 100644 (file)
index cfc35dc..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_rename)
-ENTRY(rename)
-       jmp     _C_LABEL(_rename)
-
diff --git a/lib/libc/syscall/rewinddir.S b/lib/libc/syscall/rewinddir.S
deleted file mode 100644 (file)
index 8c4c29e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_rewinddir)
-ENTRY(rewinddir)
-       jmp     _C_LABEL(_rewinddir)
-
diff --git a/lib/libc/syscall/rmdir.S b/lib/libc/syscall/rmdir.S
deleted file mode 100644 (file)
index 0e634d8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_rmdir)
-ENTRY(rmdir)
-       jmp     _C_LABEL(_rmdir)
-
diff --git a/lib/libc/syscall/sbrk.S b/lib/libc/syscall/sbrk.S
deleted file mode 100644 (file)
index 3648db7..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sbrk)
-ENTRY(sbrk)
-       jmp     _C_LABEL(_sbrk)
-
diff --git a/lib/libc/syscall/seekdir.S b/lib/libc/syscall/seekdir.S
deleted file mode 100644 (file)
index 61738a3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_seekdir)
-ENTRY(seekdir)
-       jmp     _C_LABEL(_seekdir)
-
diff --git a/lib/libc/syscall/select.S b/lib/libc/syscall/select.S
deleted file mode 100644 (file)
index e5da271..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_select)
-ENTRY(select)
-       jmp     _C_LABEL(_select)
-
diff --git a/lib/libc/syscall/setgid.S b/lib/libc/syscall/setgid.S
deleted file mode 100644 (file)
index 2045815..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_setgid)
-ENTRY(setgid)
-       jmp     _C_LABEL(_setgid)
-
-IMPORT(_setegid)
-ENTRY(setegid)
-       jmp     _C_LABEL(_setegid)
-
diff --git a/lib/libc/syscall/setgroups.S b/lib/libc/syscall/setgroups.S
deleted file mode 100644 (file)
index 4bdabd2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_setgroups)
-ENTRY(setgroups)
-       jmp     _C_LABEL(_setgroups)
-
diff --git a/lib/libc/syscall/setitimer.S b/lib/libc/syscall/setitimer.S
deleted file mode 100644 (file)
index eecf898..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_setitimer)
-ENTRY(setitimer)
-       jmp     _C_LABEL(_setitimer)
-
diff --git a/lib/libc/syscall/setsid.S b/lib/libc/syscall/setsid.S
deleted file mode 100644 (file)
index 3b22131..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_setsid)
-ENTRY(setsid)
-       jmp     _C_LABEL(_setsid)
-
diff --git a/lib/libc/syscall/setuid.S b/lib/libc/syscall/setuid.S
deleted file mode 100644 (file)
index 838088a..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_setuid)
-ENTRY(setuid)
-       jmp     _C_LABEL(_setuid)
-
-IMPORT(_seteuid)
-ENTRY(seteuid)
-       jmp     _C_LABEL(_seteuid)
-
diff --git a/lib/libc/syscall/sigaction.S b/lib/libc/syscall/sigaction.S
deleted file mode 100644 (file)
index ef6eb07..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sigaction)
-ENTRY(sigaction)
-       jmp     _C_LABEL(_sigaction)
-
diff --git a/lib/libc/syscall/sigaddset.S b/lib/libc/syscall/sigaddset.S
deleted file mode 100644 (file)
index dcef837..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sigaddset)
-ENTRY(sigaddset)
-       jmp     _C_LABEL(_sigaddset)
-
diff --git a/lib/libc/syscall/sigdelset.S b/lib/libc/syscall/sigdelset.S
deleted file mode 100644 (file)
index 1e36da8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sigdelset)
-ENTRY(sigdelset)
-       jmp     _C_LABEL(_sigdelset)
-
diff --git a/lib/libc/syscall/sigemptyset.S b/lib/libc/syscall/sigemptyset.S
deleted file mode 100644 (file)
index 755cbb6..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sigemptyset)
-ENTRY(sigemptyset)
-       jmp     _C_LABEL(_sigemptyset)
-
diff --git a/lib/libc/syscall/sigfillset.S b/lib/libc/syscall/sigfillset.S
deleted file mode 100644 (file)
index 2aa563a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sigfillset)
-ENTRY(sigfillset)
-       jmp     _C_LABEL(_sigfillset)
-
diff --git a/lib/libc/syscall/sigismember.S b/lib/libc/syscall/sigismember.S
deleted file mode 100644 (file)
index c403a7a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sigismember)
-ENTRY(sigismember)
-       jmp     _C_LABEL(_sigismember)
-
diff --git a/lib/libc/syscall/sigpending.S b/lib/libc/syscall/sigpending.S
deleted file mode 100644 (file)
index 4cd828d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sigpending)
-ENTRY(sigpending)
-       jmp     _C_LABEL(_sigpending)
-
diff --git a/lib/libc/syscall/sigprocmask.S b/lib/libc/syscall/sigprocmask.S
deleted file mode 100644 (file)
index 9572794..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sigprocmask)
-ENTRY(sigprocmask)
-       jmp     _C_LABEL(_sigprocmask)
-
diff --git a/lib/libc/syscall/sigreturn.S b/lib/libc/syscall/sigreturn.S
deleted file mode 100644 (file)
index 1be4ce1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sigreturn)
-ENTRY(sigreturn)
-       jmp     _C_LABEL(_sigreturn)
-
diff --git a/lib/libc/syscall/sigsuspend.S b/lib/libc/syscall/sigsuspend.S
deleted file mode 100644 (file)
index 9b38ab5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sigsuspend)
-ENTRY(sigsuspend)
-       jmp     _C_LABEL(_sigsuspend)
-
diff --git a/lib/libc/syscall/sleep.S b/lib/libc/syscall/sleep.S
deleted file mode 100644 (file)
index 0f7177d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sleep)
-ENTRY(sleep)
-       jmp     _C_LABEL(_sleep)
-
diff --git a/lib/libc/syscall/sprofile.S b/lib/libc/syscall/sprofile.S
deleted file mode 100644 (file)
index a59e934..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sprofile)
-ENTRY(sprofile)
-       jmp     _C_LABEL(_sprofile)
-
diff --git a/lib/libc/syscall/stat.S b/lib/libc/syscall/stat.S
deleted file mode 100644 (file)
index d38bb19..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_stat)
-ENTRY(stat)
-       jmp     _C_LABEL(_stat)
-
diff --git a/lib/libc/syscall/statvfs.S b/lib/libc/syscall/statvfs.S
deleted file mode 100644 (file)
index 8b698b9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_statvfs)
-ENTRY(statvfs)
-       jmp     _C_LABEL(_statvfs)
-
diff --git a/lib/libc/syscall/stime.S b/lib/libc/syscall/stime.S
deleted file mode 100644 (file)
index 24f4fb1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_stime)
-ENTRY(stime)
-       jmp     _C_LABEL(_stime)
-
diff --git a/lib/libc/syscall/svrctl.S b/lib/libc/syscall/svrctl.S
deleted file mode 100644 (file)
index d29a155..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_svrctl)
-ENTRY(svrctl)
-       jmp     _C_LABEL(_svrctl)
-
diff --git a/lib/libc/syscall/symlink.S b/lib/libc/syscall/symlink.S
deleted file mode 100644 (file)
index 4f4ce5d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_symlink)
-ENTRY(symlink)
-       jmp     _C_LABEL(_symlink)
-
diff --git a/lib/libc/syscall/sync.S b/lib/libc/syscall/sync.S
deleted file mode 100644 (file)
index d7035b3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sync)
-ENTRY(sync)
-       jmp     _C_LABEL(_sync)
-
diff --git a/lib/libc/syscall/sysuname.S b/lib/libc/syscall/sysuname.S
deleted file mode 100644 (file)
index 3cc7585..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_sysuname)
-ENTRY(sysuname)
-       jmp     _C_LABEL(_sysuname)
-
diff --git a/lib/libc/syscall/tcdrain.S b/lib/libc/syscall/tcdrain.S
deleted file mode 100644 (file)
index cd22509..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_tcdrain)
-ENTRY(tcdrain)
-       jmp     _C_LABEL(_tcdrain)
-
diff --git a/lib/libc/syscall/tcflow.S b/lib/libc/syscall/tcflow.S
deleted file mode 100644 (file)
index e488fcd..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_tcflow)
-ENTRY(tcflow)
-       jmp     _C_LABEL(_tcflow)
-
diff --git a/lib/libc/syscall/tcflush.S b/lib/libc/syscall/tcflush.S
deleted file mode 100644 (file)
index d85fde0..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_tcflush)
-ENTRY(tcflush)
-       jmp     _C_LABEL(_tcflush)
-
diff --git a/lib/libc/syscall/tcgetattr.S b/lib/libc/syscall/tcgetattr.S
deleted file mode 100644 (file)
index a282100..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_tcgetattr)
-ENTRY(tcgetattr)
-       jmp     _C_LABEL(_tcgetattr)
-
diff --git a/lib/libc/syscall/tcsendbreak.S b/lib/libc/syscall/tcsendbreak.S
deleted file mode 100644 (file)
index 6e6d585..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_tcsendbreak)
-ENTRY(tcsendbreak)
-       jmp     _C_LABEL(_tcsendbreak)
-
diff --git a/lib/libc/syscall/tcsetattr.S b/lib/libc/syscall/tcsetattr.S
deleted file mode 100644 (file)
index d8b9a17..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_tcsetattr)
-ENTRY(tcsetattr)
-       jmp     _C_LABEL(_tcsetattr)
-
diff --git a/lib/libc/syscall/time.S b/lib/libc/syscall/time.S
deleted file mode 100644 (file)
index 1a55773..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_time)
-ENTRY(time)
-       jmp     _C_LABEL(_time)
-
diff --git a/lib/libc/syscall/times.S b/lib/libc/syscall/times.S
deleted file mode 100644 (file)
index 2bc0f8c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_times)
-ENTRY(times)
-       jmp     _C_LABEL(_times)
-
diff --git a/lib/libc/syscall/truncate.S b/lib/libc/syscall/truncate.S
deleted file mode 100644 (file)
index 84647d8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_truncate)
-ENTRY(truncate)
-       jmp     _C_LABEL(_truncate)
-
-IMPORT(_ftruncate)
-ENTRY(ftruncate)
-       jmp     _C_LABEL(_ftruncate)
-
diff --git a/lib/libc/syscall/umask.S b/lib/libc/syscall/umask.S
deleted file mode 100644 (file)
index b6e9129..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_umask)
-ENTRY(umask)
-       jmp     _C_LABEL(_umask)
-
diff --git a/lib/libc/syscall/umount.S b/lib/libc/syscall/umount.S
deleted file mode 100644 (file)
index 169e6c4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_umount)
-ENTRY(umount)
-       jmp     _C_LABEL(_umount)
-
diff --git a/lib/libc/syscall/uname.S b/lib/libc/syscall/uname.S
deleted file mode 100644 (file)
index ddf7076..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_uname)
-ENTRY(uname)
-       jmp     _C_LABEL(_uname)
-
diff --git a/lib/libc/syscall/unlink.S b/lib/libc/syscall/unlink.S
deleted file mode 100644 (file)
index 30dedc1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_unlink)
-ENTRY(unlink)
-       jmp     _C_LABEL(_unlink)
-
diff --git a/lib/libc/syscall/utime.S b/lib/libc/syscall/utime.S
deleted file mode 100644 (file)
index 7ae24ab..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_utime)
-ENTRY(utime)
-       jmp     _C_LABEL(_utime)
-
diff --git a/lib/libc/syscall/vm_getphys.S b/lib/libc/syscall/vm_getphys.S
deleted file mode 100644 (file)
index ed6b2e0..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_vm_getphys)
-ENTRY(vm_getphys)
-       jmp     _C_LABEL(_vm_getphys)
-
diff --git a/lib/libc/syscall/vm_getrefcount.S b/lib/libc/syscall/vm_getrefcount.S
deleted file mode 100644 (file)
index 80ae339..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_vm_getrefcount)
-ENTRY(vm_getrefcount)
-       jmp     _C_LABEL(_vm_getrefcount)
-
diff --git a/lib/libc/syscall/vm_memctl.S b/lib/libc/syscall/vm_memctl.S
deleted file mode 100644 (file)
index 7341a44..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_vm_memctl)
-ENTRY(vm_memctl)
-       jmp     _C_LABEL(_vm_memctl)
-
diff --git a/lib/libc/syscall/vm_query_exit.S b/lib/libc/syscall/vm_query_exit.S
deleted file mode 100644 (file)
index c73c95c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_vm_query_exit)
-ENTRY(vm_query_exit)
-       jmp     _C_LABEL(_vm_query_exit)
-
diff --git a/lib/libc/syscall/vm_remap.S b/lib/libc/syscall/vm_remap.S
deleted file mode 100644 (file)
index 286e656..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_vm_remap)
-ENTRY(vm_remap)
-       jmp     _C_LABEL(_vm_remap)
-
diff --git a/lib/libc/syscall/vm_set_priv.S b/lib/libc/syscall/vm_set_priv.S
deleted file mode 100644 (file)
index 9a502d4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_vm_set_priv)
-ENTRY(vm_set_priv)
-       jmp     _C_LABEL(_vm_set_priv)
-
diff --git a/lib/libc/syscall/vm_unmap.S b/lib/libc/syscall/vm_unmap.S
deleted file mode 100644 (file)
index 5660fea..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_vm_unmap)
-ENTRY(vm_unmap)
-       jmp     _C_LABEL(_vm_unmap)
-
diff --git a/lib/libc/syscall/vm_update.S b/lib/libc/syscall/vm_update.S
deleted file mode 100644 (file)
index c4f0eb2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_vm_update)
-ENTRY(vm_update)
-       jmp     _C_LABEL(_vm_update)
-
diff --git a/lib/libc/syscall/wait.S b/lib/libc/syscall/wait.S
deleted file mode 100644 (file)
index bb0d6f2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_wait)
-ENTRY(wait)
-       jmp     _C_LABEL(_wait)
-
diff --git a/lib/libc/syscall/waitpid.S b/lib/libc/syscall/waitpid.S
deleted file mode 100644 (file)
index c9ffc8b..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_waitpid)
-ENTRY(waitpid)
-       jmp     _C_LABEL(_waitpid)
-
diff --git a/lib/libc/syscall/write.S b/lib/libc/syscall/write.S
deleted file mode 100644 (file)
index 712d4b6..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <machine/asm.h>
-
-IMPORT(_write)
-ENTRY(write)
-       jmp     _C_LABEL(_write)
-
diff --git a/lib/libc/sysvipc/Makefile.inc b/lib/libc/sysvipc/Makefile.inc
deleted file mode 100644 (file)
index 9ad78f7..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# sysvipc sources
-.PATH: ${.CURDIR}/sysvipc
-
-SRCS+= ftok.c sem.c shm.c
diff --git a/lib/libc/sysvipc/ftok.c b/lib/libc/sysvipc/ftok.c
deleted file mode 100644 (file)
index e2e8912..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <sys/ipc.h>
-#include <sys/stat.h>
-
-key_t ftok(const char *path, int id)
-{
-       struct stat st;
-
-       if (lstat(path, &st) < 0)
-               return (key_t) -1;
-
-       return (key_t) ((st.st_ino & 0xffff) |
-               ((st.st_dev & 0xff) << 16) |
-               ((id & 0xff) << 24));
-}
-
diff --git a/lib/libc/sysvipc/sem.c b/lib/libc/sysvipc/sem.c
deleted file mode 100644 (file)
index 5481029..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-#define __USE_MISC
-#define _SYSTEM        1
-#define _MINIX 1
-
-#include <minix/com.h>
-#include <minix/config.h>
-#include <minix/ipc.h>
-#include <minix/endpoint.h>
-#include <minix/sysutil.h>
-#include <minix/const.h>
-#include <minix/type.h>
-#include <minix/rs.h>
-
-#include <lib.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/sem.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <errno.h>
-
-PRIVATE int get_ipc_endpt(endpoint_t *pt)
-{
-       return minix_rs_lookup("ipc", pt);
-}
-
-/* Get semaphore.  */
-PUBLIC int semget(key_t key, int nsems, int semflag)
-{
-       message m;
-       endpoint_t ipc_pt;
-       int r;
-
-       if (get_ipc_endpt(&ipc_pt) != OK) {
-               errno = ENOSYS;
-               return -1;
-       }
-
-       m.SEMGET_KEY = key;
-       m.SEMGET_NR = nsems;
-       m.SEMGET_FLAG = semflag;
-
-       r = _syscall(ipc_pt, IPC_SEMGET, &m);
-       if (r != OK)
-               return r;
-
-       return m.SEMGET_RETID;
-}
-/* Semaphore control operation.  */
-PUBLIC int semctl(int semid, int semnum, int cmd, ...)
-{
-       message m;
-       endpoint_t ipc_pt;
-       va_list ap;
-       int r;
-
-       if (get_ipc_endpt(&ipc_pt) != OK) {
-               errno = ENOSYS;
-               return -1;
-       }
-
-       m.SEMCTL_ID = semid;
-       m.SEMCTL_NUM = semnum;
-       m.SEMCTL_CMD = cmd;
-       va_start(ap, cmd);
-       if (cmd == IPC_STAT || cmd == IPC_SET || cmd == IPC_INFO ||
-               cmd == SEM_INFO || cmd == SEM_STAT || cmd == GETALL ||
-               cmd == SETALL || cmd == SETVAL)
-               m.SEMCTL_OPT = (long) va_arg(ap, long);
-       va_end(ap); 
-
-       r = _syscall(ipc_pt, IPC_SEMCTL, &m);
-       if ((r != -1) && (cmd == GETNCNT || cmd == GETZCNT || cmd == GETPID ||
-               cmd == GETVAL || cmd == IPC_INFO || cmd == SEM_INFO ||
-               cmd == SEM_STAT))
-               return m.SHMCTL_RET;
-       return r;
-}
-
-/* Operate on semaphore.  */
-PUBLIC int semop(int semid, struct sembuf *sops, size_t nsops)
-{
-       message m;
-       endpoint_t ipc_pt;
-
-       if (get_ipc_endpt(&ipc_pt) != OK) {
-               errno = ENOSYS;
-               return -1;
-       }
-
-       m.SEMOP_ID = semid;
-       m.SEMOP_OPS = (long) sops;
-       m.SEMOP_SIZE = nsops;
-
-       return _syscall(ipc_pt, IPC_SEMOP, &m);
-}
-
diff --git a/lib/libc/sysvipc/shm.c b/lib/libc/sysvipc/shm.c
deleted file mode 100644 (file)
index 69f0883..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#define _SYSTEM        1
-#define _MINIX 1
-
-#include <minix/com.h>
-#include <minix/config.h>
-#include <minix/ipc.h>
-#include <minix/endpoint.h>
-#include <minix/sysutil.h>
-#include <minix/const.h>
-#include <minix/type.h>
-#include <minix/rs.h>
-
-#include <lib.h>
-#include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <stdlib.h>
-#include <errno.h>
-
-PRIVATE int get_ipc_endpt(endpoint_t *pt)
-{
-       return minix_rs_lookup("ipc", pt);
-}
-
-/* Shared memory control operation. */
-PUBLIC int shmctl(int shmid, int cmd, struct shmid_ds *buf)
-{
-       message m;
-       endpoint_t ipc_pt;
-       int r;
-
-       if (get_ipc_endpt(&ipc_pt) != OK) {
-               errno = ENOSYS;
-               return -1;
-       }
-
-       m.SHMCTL_ID = shmid;
-       m.SHMCTL_CMD = cmd;
-       m.SHMCTL_BUF = (long) buf;
-
-       r = _syscall(ipc_pt, IPC_SHMCTL, &m);
-       if ((cmd == IPC_INFO || cmd == SHM_INFO || cmd == SHM_STAT)
-               && (r == OK))
-               return m.SHMCTL_RET;
-       return r;
-}
-
-/* Get shared memory segment. */
-PUBLIC int shmget(key_t key, size_t size, int shmflg)
-{
-       message m;
-       endpoint_t ipc_pt;
-       int r;
-
-       if (get_ipc_endpt(&ipc_pt) != OK) {
-               errno = ENOSYS;
-               return -1;
-       }
-
-       m.SHMGET_KEY = key;
-       m.SHMGET_SIZE = size;
-       m.SHMGET_FLAG = shmflg;
-
-       r = _syscall(ipc_pt, IPC_SHMGET, &m);
-       if (r != OK)
-               return r;
-       return m.SHMGET_RETID;
-}
-
-/* Attach shared memory segment. */
-PUBLIC void *shmat(int shmid, const void *shmaddr, int shmflg)
-{
-       message m;
-       endpoint_t ipc_pt;
-       int r;
-
-       if (get_ipc_endpt(&ipc_pt) != OK) {
-               errno = ENOSYS;
-               return NULL;
-       }
-
-       m.SHMAT_ID = shmid;
-       m.SHMAT_ADDR = (long) shmaddr;
-       m.SHMAT_FLAG = shmflg;
-
-       r = _syscall(ipc_pt, IPC_SHMAT, &m);
-       if (r != OK)
-               return (void *) -1;
-       return (void *) m.SHMAT_RETADDR;
-}
-
-/* Deattach shared memory segment. */
-PUBLIC int shmdt(const void *shmaddr)
-{
-       message m;
-       endpoint_t ipc_pt;
-
-       if (get_ipc_endpt(&ipc_pt) != OK) {
-               errno = ENOSYS;
-               return -1;
-       }
-
-       m.SHMDT_ADDR = (long) shmaddr;
-
-       return _syscall(ipc_pt, IPC_SHMDT, &m);
-}
-
similarity index 100%
rename from lib/nbsd_libc/time/zic.8
rename to lib/libc/time/zic.8
similarity index 100%
rename from lib/nbsd_libc/time/zic.c
rename to lib/libc/time/zic.c
diff --git a/lib/libc/wchar/Makefile.inc b/lib/libc/wchar/Makefile.inc
deleted file mode 100644 (file)
index a0355af..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-# wchar sources
-.PATH: ${.CURDIR}/wchar
-
-SRCS+=  \
-       towupper.c \
-       towlower.c \
-       wcscasecmp.c \
-       wcscat.c \
-       wcschr.c \
-       wcscmp.c \
-       wcscpy.c \
-       wcscspn.c \
-       wcsdup.c \
-       wcslcat.c \
-       wcslcpy.c \
-       wcslen.c \
-       wcsncasecmp.c \
-       wcsncat.c \
-       wcsncmp.c \
-       wcsncpy.c \
-       wcspbrk.c \
-       wcsrchr.c \
-       wcsspn.c \
-       wcsstr.c \
-       wcstok.c \
-       wcstombs.c \
-       wcswcs.c \
-       wctomb.c \
-       wmemchr.c \
-       wmemcmp.c \
-       wmemcpy.c \
-       wmemmove.c \
-       wmemset.c
diff --git a/lib/libc/wchar/towlower.c b/lib/libc/wchar/towlower.c
deleted file mode 100644 (file)
index 897e686..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Very lame implementation of towlower that simply applies tolower
- * if the character is within range of 'normal' characters.
- */
-
-#include <wchar.h>
-#include <ctype.h>
-
-wint_t towlower(wint_t c)
-{
-    if( c>0xff ){
-        return c;
-    }
-    return (wint_t) tolower((char) c);
-}
diff --git a/lib/libc/wchar/towupper.c b/lib/libc/wchar/towupper.c
deleted file mode 100644 (file)
index 920e112..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Very lame implementation of towupper that simply applies toupper
- * if the character is within range of 'normal' characters.
- */
-
-#include <wchar.h>
-#include <ctype.h>
-
-wint_t towupper(wint_t c)
-{
-    if( c>0xff ){
-        return c;
-    }
-    return (wint_t) toupper((char) c);
-}
diff --git a/lib/libc/wchar/wcscasecmp.c b/lib/libc/wchar/wcscasecmp.c
deleted file mode 100644 (file)
index 0467157..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2006 Aleksey Cheusov
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted 
- * without fee. Permission to modify the code and to distribute modified
- * code is also granted without any restrictions.
- */
-
-#include <assert.h>
-#include <wchar.h>
-#include <wctype.h>
-
-int
-wcscasecmp(const wchar_t *s1, const wchar_t *s2)
-{
-
-       assert(s1 != NULL);
-       assert(s2 != NULL);
-
-       for (;;) {
-               int lc1 = towlower(*s1);
-               int lc2 = towlower(*s2);
-
-               int diff = lc1 - lc2;
-               if (diff != 0)
-                       return diff;
-
-               if (!lc1)
-                       return 0;
-
-               ++s1;
-               ++s2;
-       }
-}
diff --git a/lib/libc/wchar/wcscat.c b/lib/libc/wchar/wcscat.c
deleted file mode 100644 (file)
index 0c7fd4f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wcscat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t *
-wcscat(wchar_t *s1, const wchar_t *s2)
-{
-       wchar_t *p;
-       wchar_t *q;
-       const wchar_t *r;
-
-       assert(s1 != NULL);
-       assert(s2 != NULL);
-
-       p = s1;
-       while (*p)
-               p++;
-       q = p;
-       r = s2;
-       while (*r)
-               *q++ = *r++;
-       *q = '\0';
-       return s1;
-}
diff --git a/lib/libc/wchar/wcschr.c b/lib/libc/wchar/wcschr.c
deleted file mode 100644 (file)
index 2285e36..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wcschr.c,v 1.2 2000/12/21 05:07:25 itojun Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t *
-wcschr(const wchar_t *p, wchar_t c)
-{
-       assert(p != NULL);
-
-       for (;; ++p) {
-               if (*p == c) {
-                       /* LINTED interface specification */
-                       return (wchar_t *) p;
-               }
-               if (!*p)
-                       return NULL;
-       }
-       /*NOTREACHED*/
-}
diff --git a/lib/libc/wchar/wcscmp.c b/lib/libc/wchar/wcscmp.c
deleted file mode 100644 (file)
index d07fd52..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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 <assert.h>
-#include <wchar.h>
-
-/*
- * Compare strings.
- */
-int
-wcscmp(const wchar_t *s1, const wchar_t *s2)
-{
-
-       assert(s1 != NULL);
-       assert(s2 != NULL);
-
-       while (*s1 == *s2++)
-               if (*s1++ == 0)
-                       return (0);
-       /* XXX assumes wchar_t = int */
-       return (*s1 - *--s2);
-}
diff --git a/lib/libc/wchar/wcscpy.c b/lib/libc/wchar/wcscpy.c
deleted file mode 100644 (file)
index 9f969b4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wcscpy.c,v 1.2 2000/12/21 04:51:09 itojun Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t *
-wcscpy(wchar_t *s1, const wchar_t *s2)
-{
-       wchar_t *p;
-
-       assert(s1 != NULL);
-       assert(s2 != NULL);
-
-       for (p = s1; (*p = *s2) != L'\0'; ++p, ++s2);
-
-       return s1;
-}
diff --git a/lib/libc/wchar/wcscspn.c b/lib/libc/wchar/wcscspn.c
deleted file mode 100644 (file)
index 24fdc20..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wcscspn.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-size_t
-wcscspn(const wchar_t *s, const wchar_t *set)
-{
-       const wchar_t *p;
-       const wchar_t *q;
-
-       assert(s != NULL);
-       assert(set != NULL);
-
-       p = s;
-       while (*p) {
-               q = set;
-               while (*q) {
-                       if (*p == *q)
-                               goto done;
-                       q++;
-               }
-               p++;
-       }
-
-done:
-       return (p - s);
-}
diff --git a/lib/libc/wchar/wcsdup.c b/lib/libc/wchar/wcsdup.c
deleted file mode 100644 (file)
index fe42ce8..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2006 Aleksey Cheusov
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted 
- * without fee. Permission to modify the code and to distribute modified
- * code is also granted without any restrictions.
- */
-
-#include <stdlib.h>
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t *
-wcsdup(const wchar_t *str)
-{
-       wchar_t *copy;
-       size_t len;
-
-       assert(str != NULL);
-
-       len = wcslen(str) + 1;
-       copy = malloc(len * sizeof (wchar_t));
-
-       if (!copy)
-               return NULL;
-
-       return wmemcpy(copy, str, len);
-}
diff --git a/lib/libc/wchar/wcslcat.c b/lib/libc/wchar/wcslcat.c
deleted file mode 100644 (file)
index d213a3e..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * 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. 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 ``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.
- */
-
-#include <sys/types.h>
-#include <assert.h>
-#include <wchar.h>
-
-/*
- * Appends src to string dst of size siz (unlike wcsncat, siz is the
- * full size of dst, not space left).  At most siz-1 characters
- * will be copied.  Always NUL terminates (unless siz == 0).
- * Returns wcslen(initial dst) + wcslen(src); if retval >= siz,
- * truncation occurred.
- */
-size_t
-wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
-{
-       wchar_t *d = dst;
-       const wchar_t *s = src;
-       size_t n = siz;
-       size_t dlen;
-
-       assert(dst != NULL);
-       assert(src != NULL);
-
-       /* Find the end of dst and adjust bytes left but don't go past end */
-       while (*d != '\0' && n-- != 0)
-               d++;
-       dlen = d - dst;
-       n = siz - dlen;
-
-       if (n == 0)
-               return(dlen + wcslen(s));
-       while (*s != '\0') {
-               if (n != 1) {
-                       *d++ = *s;
-                       n--;
-               }
-               s++;
-       }
-       *d = '\0';
-
-       return(dlen + (s - src));       /* count does not include NUL */
-}
diff --git a/lib/libc/wchar/wcslcpy.c b/lib/libc/wchar/wcslcpy.c
deleted file mode 100644 (file)
index bd99485..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
- * 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. 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 ``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.
- */
-
-#include <sys/types.h>
-#include <assert.h>
-#include <wchar.h>
-
-/*
- * Copy src to string dst of size siz.  At most siz-1 characters
- * will be copied.  Always NUL terminates (unless siz == 0).
- * Returns wcslen(src); if retval >= siz, truncation occurred.
- */
-size_t
-wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
-{
-       wchar_t *d = dst;
-       const wchar_t *s = src;
-       size_t n = siz;
-
-       assert(dst != NULL);
-       assert(src != NULL);
-
-       /* Copy as many bytes as will fit */
-       if (n != 0 && --n != 0) {
-               do {
-                       if ((*d++ = *s++) == 0)
-                               break;
-               } while (--n != 0);
-       }
-
-       /* Not enough room in dst, add NUL and traverse rest of src */
-       if (n == 0) {
-               if (siz != 0)
-                       *d = '\0';              /* NUL-terminate dst */
-               while (*s++)
-                       ;
-       }
-
-       return(s - src - 1);    /* count does not include NUL */
-}
diff --git a/lib/libc/wchar/wcslen.c b/lib/libc/wchar/wcslen.c
deleted file mode 100644 (file)
index 0442e90..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-size_t wcslen(const wchar_t *s)
-{
-       const wchar_t *p = s;
-       size_t res = 0;
-
-       assert(s != NULL);
-
-       while (*p != L'\0'){
-               p++;
-               res++;
-       }
-
-       return res;
-}
diff --git a/lib/libc/wchar/wcsncasecmp.c b/lib/libc/wchar/wcsncasecmp.c
deleted file mode 100644 (file)
index 98a3f14..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2006 Aleksey Cheusov
- *
- * This material is provided "as is", with absolutely no warranty expressed
- * or implied. Any use is at your own risk.
- *
- * Permission to use or copy this software for any purpose is hereby granted 
- * without fee. Permission to modify the code and to distribute modified
- * code is also granted without any restrictions.
- */
-
-#include <assert.h>
-#include <wchar.h>
-#include <wctype.h>
-
-int
-wcsncasecmp(const wchar_t *s1, const wchar_t *s2, size_t n)
-{
-       int lc1  = 0;
-       int lc2  = 0;
-       int diff = 0;
-
-       assert(s1);
-       assert(s2);
-
-       while (n--) {
-               lc1 = towlower (*s1);
-               lc2 = towlower (*s2);
-
-               diff = lc1 - lc2;
-               if (diff)
-                       return diff;
-
-               if (!lc1)
-                       return 0;
-
-               ++s1;
-               ++s2;
-       }
-
-       return 0;
-}
diff --git a/lib/libc/wchar/wcsncat.c b/lib/libc/wchar/wcsncat.c
deleted file mode 100644 (file)
index 55efe6e..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wcsncat.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t *
-wcsncat(wchar_t *s1, const wchar_t *s2, size_t n)
-{
-       wchar_t *p;
-       wchar_t *q;
-       const wchar_t *r;
-
-       assert(s1 != NULL);
-       assert(s2 != NULL);
-
-       p = s1;
-       while (*p)
-               p++;
-       q = p;
-       r = s2;
-       while (*r && n) {
-               *q++ = *r++;
-               n--;
-       }
-       *q = '\0';
-       return s1;
-}
diff --git a/lib/libc/wchar/wcsncmp.c b/lib/libc/wchar/wcsncmp.c
deleted file mode 100644 (file)
index 7ee23ab..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1989, 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. 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 <assert.h>
-#include <wchar.h>
-
-int
-wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
-{
-
-       assert(s1 != NULL);
-       assert(s2 != NULL);
-
-       if (n == 0)
-               return (0);
-       do {
-               if (*s1 != *s2++) {
-                       /* XXX assumes wchar_t = int */
-                       return (*s1 - *--s2);
-               }
-               if (*s1++ == 0)
-                       break;
-       } while (--n != 0);
-       return (0);
-}
diff --git a/lib/libc/wchar/wcsncpy.c b/lib/libc/wchar/wcsncpy.c
deleted file mode 100644 (file)
index e41a790..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wcsncpy.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t *
-wcsncpy(wchar_t *s1, const wchar_t *s2, size_t n)
-{
-       wchar_t *p = s1;
-
-       assert(s1 != NULL);
-       assert(s2 != NULL);
-
-       while (n>0 && *s2) {
-               *p++ = *s2++;
-               n--;
-       }
-       while (n>0) {
-               *p++ = L'\0';
-               n--;
-       }
-
-       return s1;
-}
diff --git a/lib/libc/wchar/wcspbrk.c b/lib/libc/wchar/wcspbrk.c
deleted file mode 100644 (file)
index 02b3844..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wcspbrk.c,v 1.2 2000/12/21 05:07:25 itojun Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t *
-wcspbrk(const wchar_t *s, const wchar_t *set)
-{
-       const wchar_t *p;
-       const wchar_t *q;
-
-       assert(s != NULL);
-       assert(set != NULL);
-
-       p = s;
-       while (*p) {
-               q = set;
-               while (*q) {
-                       if (*p == *q)
-                               return (wchar_t *) p;
-                       q++;
-               }
-               p++;
-       }
-       return NULL;
-}
diff --git a/lib/libc/wchar/wcsrchr.c b/lib/libc/wchar/wcsrchr.c
deleted file mode 100644 (file)
index 8ca8787..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wcsrchr.c,v 1.2 2000/12/21 05:07:25 itojun Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t *
-wcsrchr(const wchar_t *s, wchar_t c)
-{
-       const wchar_t *p;
-
-       assert(s != NULL);
-
-       p = s;
-       while (*p)
-               p++;
-       while (s <= p) {
-               if (*p == c)
-                       return (wchar_t *) p;
-               p--;
-       }
-       return NULL;
-}
diff --git a/lib/libc/wchar/wcsspn.c b/lib/libc/wchar/wcsspn.c
deleted file mode 100644 (file)
index 31c3796..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * Copyright (c)1999,2001 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     $Citrus: xpg4dl/FreeBSD/lib/libc/string/wcsspn.c,v 1.3 2001/09/21 16:06:43 yamt Exp $
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-size_t
-wcsspn(const wchar_t *s, const wchar_t *set)
-{
-       const wchar_t *p;
-       const wchar_t *q;
-
-       assert(s != NULL);
-       assert(set != NULL);
-
-       p = s;
-       while (*p) {
-               q = set;
-               while (*q) {
-                       if (*p == *q)
-                               break;
-                       q++;
-               }
-               if (!*q)
-                       goto done;
-               p++;
-       }
-
-done:
-       return (p - s);
-}
diff --git a/lib/libc/wchar/wcsstr.c b/lib/libc/wchar/wcsstr.c
deleted file mode 100644 (file)
index 41bd18f..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wcsstr.c,v 1.2 2000/12/21 05:07:25 itojun Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t *
-#ifdef WCSWCS
-wcswcs(const wchar_t *big, const wchar_t *little)
-#else
-wcsstr(const wchar_t *big, const wchar_t *little)
-#endif
-{
-       const wchar_t *p;
-       const wchar_t *q;
-       const wchar_t *r;
-
-       assert(big != NULL);
-       assert(little != NULL);
-
-       if (!*little)
-               return (wchar_t *) big;
-       if (wcslen(big) < wcslen(little))
-               return NULL;
-
-       p = big;
-       q = little;
-       while (*p) {
-               q = little;
-               r = p;
-               while (*q) {
-                       if (*r != *q)
-                               break;
-                       q++;
-                       r++;
-               }
-               if (!*q)
-                       return (wchar_t *) p;
-               p++;
-       }
-       return NULL;
-}
diff --git a/lib/libc/wchar/wcstok.c b/lib/libc/wchar/wcstok.c
deleted file mode 100644 (file)
index 8b5fd37..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*-
- * Copyright (c) 1998 Softweyr LLC.  All rights reserved.
- *
- * strtok_r, from Berkeley strtok
- * Oct 13, 1998 by Wes Peters <wes@softweyr.com>
- *
- * 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
- *    notices, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notices, 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 Softweyr LLC, 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 SOFTWEYR LLC, 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 SOFTWEYR LLC, 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.
- *
- * Original version ID:
- * FreeBSD: src/lib/libc/string/wcstok.c,v 1.1 2002/09/07 08:16:57 tjr Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t *
-wcstok(wchar_t *s, const wchar_t *delim, wchar_t **last)
-{
-       const wchar_t *spanp;
-       wchar_t c, sc;
-       wchar_t *tok;
-
-       /* s may be NULL */
-       assert(delim != NULL);
-       assert(last != NULL);
-
-       if (s == NULL && (s = *last) == NULL)
-               return (NULL);
-
-       /*
-        * Skip (span) leading delimiters (s += wcsspn(s, delim), sort of).
-        */
-cont:
-       c = *s++;
-       for (spanp = delim; (sc = *spanp++) != L'\0';) {
-               if (c == sc)
-                       goto cont;
-       }
-
-       if (c == L'\0') {       /* no non-delimiter characters */
-               *last = NULL;
-               return (NULL);
-       }
-       tok = s - 1;
-
-       /*
-        * Scan token (scan for delimiters: s += wcscspn(s, delim), sort of).
-        * Note that delim must have one NUL; we stop if we see that, too.
-        */
-       for (;;) {
-               c = *s++;
-               spanp = delim;
-               do {
-                       if ((sc = *spanp++) == c) {
-                               if (c == L'\0')
-                                       s = NULL;
-                               else
-                                       s[-1] = L'\0';
-                               *last = s;
-                               return (tok);
-                       }
-               } while (sc != L'\0');
-       }
-       /* NOTREACHED */
-}
diff --git a/lib/libc/wchar/wcstombs.c b/lib/libc/wchar/wcstombs.c
deleted file mode 100644 (file)
index 97e5f8f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-#include       <locale.h>
-
-size_t
-wcstombs(register char *s, register const wchar_t *pwcs, size_t n)
-{
-       register int i = n;
-
-       while (--i >= 0) {
-               if (!(*s++ = *pwcs++))
-                       break;
-       }
-       return n - i - 1;
-}
diff --git a/lib/libc/wchar/wcswcs.c b/lib/libc/wchar/wcswcs.c
deleted file mode 100644 (file)
index 4a346bd..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#define WCSWCS
-#include "wcsstr.c"
diff --git a/lib/libc/wchar/wctomb.c b/lib/libc/wchar/wctomb.c
deleted file mode 100644 (file)
index 1afc0c5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#include       <stdlib.h>
-
-int
-/* was: wctomb(char *s, wchar_t wchar) 
- * This conflicts with prototype, so it was changed to:
- */
-wctomb(char *s, wchar_t wchar)
-{
-       if (!s) return 0;               /* no state dependent codings */
-
-       *s = wchar;
-       return 1;
-}
diff --git a/lib/libc/wchar/wmemchr.c b/lib/libc/wchar/wmemchr.c
deleted file mode 100644 (file)
index 424a553..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wmemchr.c,v 1.2 2000/12/20 14:08:31 itojun Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t        *
-wmemchr(const wchar_t *s, wchar_t c, size_t n)
-{
-       size_t i;
-
-       assert(s != NULL);
-
-       for (i = 0; i < n; i++) {
-               if (*s == c)
-                       return (wchar_t *) s;
-               s++;
-       }
-       return NULL;
-}
diff --git a/lib/libc/wchar/wmemcmp.c b/lib/libc/wchar/wmemcmp.c
deleted file mode 100644 (file)
index 3e1ffcf..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wmemcmp.c,v 1.2 2000/12/20 14:08:31 itojun Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-int
-wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
-{
-       size_t i;
-
-       assert(s1 != NULL);
-       assert(s2 != NULL);
-
-       for (i = 0; i < n; i++) {
-               if (*s1 != *s2) {
-                       /* wchar might be unsigned */
-                       return (*s1 > *s2) ? 1 : -1;
-               }
-               s1++;
-               s2++;
-       }
-       return 0;
-}
diff --git a/lib/libc/wchar/wmemcpy.c b/lib/libc/wchar/wmemcpy.c
deleted file mode 100644 (file)
index f76d98f..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wmemcpy.c,v 1.2 2000/12/20 14:08:31 itojun Exp
- */
-
-#include <assert.h>
-#include <string.h>
-#include <wchar.h>
-
-wchar_t *
-wmemcpy(wchar_t *d, const wchar_t *s, size_t n)
-{
-       assert(d != NULL);
-       assert(s != NULL);
-
-       return (wchar_t *)memcpy(d, s, n * sizeof(wchar_t));
-}
diff --git a/lib/libc/wchar/wmemmove.c b/lib/libc/wchar/wmemmove.c
deleted file mode 100644 (file)
index 445c2d5..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wmemmove.c,v 1.2 2000/12/20 14:08:31 itojun Exp
- */
-
-#include <assert.h>
-#include <string.h>
-#include <wchar.h>
-
-wchar_t *
-wmemmove(wchar_t *d, const wchar_t *s, size_t n)
-{
-       assert(d != NULL);
-       assert(s != NULL);
-
-       return (wchar_t *)memmove(d, s, n * sizeof(wchar_t));
-}
diff --git a/lib/libc/wchar/wmemset.c b/lib/libc/wchar/wmemset.c
deleted file mode 100644 (file)
index a41469f..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wmemset.c,v 1.2 2000/12/20 14:08:31 itojun Exp
- */
-
-#include <assert.h>
-#include <wchar.h>
-
-wchar_t        *
-wmemset(wchar_t *s, wchar_t c, size_t n)
-{
-       size_t i;
-       wchar_t *p;
-
-       assert(s != NULL);
-
-       p = (wchar_t *)s;
-       for (i = 0; i < n; i++) {
-               *p = c;
-               p++;
-       }
-       return s;
-}
similarity index 100%
rename from lib/nbsd_libc/yp/local.h
rename to lib/libc/yp/local.h
similarity index 100%
rename from lib/nbsd_libc/yp/xdryp.c
rename to lib/libc/yp/xdryp.c
similarity index 100%
rename from lib/nbsd_libc/yp/yplib.c
rename to lib/libc/yp/yplib.c
similarity index 82%
rename from lib/nbsd_libcompat_minix/include/Makefile.inc
rename to lib/libcompat_minix/include/Makefile.inc
index 88965f3e8b720f93a7fea4934f32c9d40cd57a54..8cff32e845e540143b262369e66b2b1d5e096873 100644 (file)
@@ -1,4 +1,4 @@
-.PATH: ${MINIXSRCDIR}/lib/nbsd_libcompat_minix/include
+.PATH: ${MINIXSRCDIR}/lib/libcompat_minix/include
 
 INCSDIR= /usr/include
 
index a04e90657beebc9cb3aaadc5154f14517304e6b9..72298847b39f7a9814a6a3162f13ed956be7563e 100644 (file)
@@ -1,6 +1,4 @@
 
-.if ${COMPILER_TYPE} == "gnu" 
 SUBDIR = build
-.endif
 
 .include <bsd.subdir.mk>
index 7015b62057eadf2a3039e4525af67f0cc0bb5a0a..dd5db5a8a3a728eedd76f42869ce09c0d9daf918 100644 (file)
@@ -1,6 +1,4 @@
-.if ${COMPILER_TYPE} == "gnu"
 SUBDIR = ddekit ddekit_usb_client ddekit_usb_server
-.endif
 .include <bsd.subdir.mk>
 
 
index 97bdb5f3567acfbb8de8e5b85fae6fb1449fd9ef..50089baab2f4c908321b2204981fde50adec9e24 100644 (file)
@@ -1,4 +1,3 @@
-.if ${COMPILER_TYPE} == "gnu"
 
 LIB=           ddekit
 
@@ -8,12 +7,7 @@ VPATH = $(SRC_DIR)
 
 SRCS = pci.c printf.c mem.c pgtab.c dde.c initcall.c thread.c condvar.c lock.c semaphore.c timer.c panic.c irq.c resource.c msg_queue.c
 
-CFLAGS +=  -Wall 
+CFLAGS +=  -Wall -D_NETBSD_SOURCE
 
-.if ${NBSD_LIBC} != "no"
-CFLAGS += -D_NETBSD_SOURCE
-.endif
-
-.endif
 .include <bsd.lib.mk>
 
index 816983ba4f340f4ee2e0351f0eec516b4335ceb6..5299be4eb59fe6d01bc4bf363b78beb02bc98cd5 100644 (file)
@@ -1,4 +1,3 @@
-.if ${COMPILER_TYPE} == "gnu"
 LIB=           ddekit_usb_client
 
 SRC_DIR = ${MINIXSRCDIR}/lib/libddekit/src 
@@ -9,6 +8,5 @@ SRCS = usb_client.c
 
 CFLAGS += -Wall 
 
-.endif
 .include <bsd.lib.mk>
 
index bc41af2a0b617a65e85118e71036ef9ade0bc27c..42ab62d45950b05bc75e8cac86ff320a35285154 100644 (file)
@@ -1,10 +1,8 @@
-.if ${COMPILER_TYPE} == "gnu"
 LIB=           ddekit_usb_server
 SRC_DIR = ${MINIXSRCDIR}/lib/libddekit/src 
 VPATH = $(SRC_DIR) 
 SRCS = usb_server.c
 CFLAGS += -Wall
-.endif
 .include <bsd.lib.mk>
 
 
diff --git a/lib/libend/Makefile b/lib/libend/Makefile
deleted file mode 100644 (file)
index 35d9bc9..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# Makefile for libend
-
-.include "Makefile.inc"
-
-LIB=end
-
-SRCS=  \
-       edata.S \
-       em_end.S \
-       end.S \
-       etext.S
-
-.if ${COMPILER_TYPE} == "gnu"
-.include "${.CURDIR}/gnu/Makefile.inc"
-.endif
-
-.include <bsd.lib.mk>
diff --git a/lib/libend/Makefile.inc b/lib/libend/Makefile.inc
deleted file mode 100644 (file)
index 4df075a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-.include <bsd.own.mk>
diff --git a/lib/libend/edata.S b/lib/libend/edata.S
deleted file mode 100644 (file)
index a598c6e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-.text
-#if defined(__ACK__)
-.rom
-#else
-.data
-#endif
-.data
-.balign _EM_WSIZE
-.globl _edata
-_edata:
diff --git a/lib/libend/em_end.S b/lib/libend/em_end.S
deleted file mode 100644 (file)
index a1a09e7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-.text
-.balign _EM_WSIZE
-.globl __etext, endtext
-__etext:
-endtext:
-#if defined(__ACK__)
-.rom
-#else
-.data
-#endif
-.balign _EM_WSIZE
-.globl endrom
-endrom:
-.data
-.balign _EM_WSIZE
-.globl __edata, enddata
-__edata:
-enddata:
-.bss
-.balign _EM_WSIZE
-#if defined(__ACK__)
-.end   /* only for declaration of _end, __end or endbss. */
-.globl __end, endbss
-__end:
-endbss:
-#endif
diff --git a/lib/libend/end.S b/lib/libend/end.S
deleted file mode 100644 (file)
index a2efbdb..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-.text
-#if defined(__ACK__)
-.rom
-#else
-.data
-#endif
-.data
-.bss
-#if defined(__ACK__)
-.end   /* only for declaration of _end, __end or endbss. */
-.globl _end
-_end:
-#endif
diff --git a/lib/libend/etext.S b/lib/libend/etext.S
deleted file mode 100644 (file)
index dc927f6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-.text
-.balign _EM_WSIZE
-.globl _etext
-_etext:
diff --git a/lib/libend/gnu/Makefile.inc b/lib/libend/gnu/Makefile.inc
deleted file mode 100644 (file)
index 16dea0d..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# end sources
-.PATH: ${.CURDIR}/gnu
-
-SRCS+=gnu_end.S
-
diff --git a/lib/libend/gnu/gnu_end.S b/lib/libend/gnu/gnu_end.S
deleted file mode 100644 (file)
index 3d774ff..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-
-.stabs "endbss",11,0,0,0
-.stabs "__end",1,0,0,0
-
-
index 4becb6e287b59418c3f0501e44814b019f8aaa5a..3c3de53b99acdb80c31cc5ef491a8b7e0e227049 100644 (file)
@@ -1,9 +1,280 @@
-# Makefile for libm
+#  $NetBSD: Makefile,v 1.101 2011/01/12 23:03:56 joerg Exp $
+#
+#  @(#)Makefile 5.1beta 93/09/24
+#
+#  ====================================================
+#  Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+#
+#  Developed at SunPro, a Sun Microsystems, Inc. business.
+#  Permission to use, copy, modify, and distribute this
+#  software is freely granted, provided that this notice
+#  is preserved.
+#  ====================================================
+#
+#
 
-# Make a dummy libm library so that -lm works.
+#
+# There are two options in making libm at fdlibm compile time:
+#      _IEEE_LIBM      --- IEEE libm; smaller, and somewhat faster
+#      _MULTI_LIBM     --- Support multi-standard at runtime by
+#                          imposing wrapper functions defined in
+#                          fdlibm.h:
+#                              _IEEE_MODE      -- IEEE
+#                              _XOPEN_MODE     -- X/OPEN
+#                              _POSIX_MODE     -- POSIX/ANSI
+#                              _SVID3_MODE     -- SVID
+#
+# Here is how to set up CPPFLAGS to create the desired libm at
+# compile time:
+#
+#      CPPFLAGS = -D_IEEE_LIBM         ... IEEE libm (recommended)
+#      CPPFLAGS = -D_SVID3_MODE        ... Multi-standard supported
+#                                          libm with SVID as the
+#                                          default standard
+#      CPPFLAGS = -D_XOPEN_MODE        ... Multi-standard supported
+#                                          libm with XOPEN as the
+#                                          default standard
+#      CPPFLAGS = -D_POSIX_MODE        ... Multi-standard supported
+#                                          libm with POSIX as the
+#                                          default standard
+#      CPPFLAGS =                      ... Multi-standard supported
+#                                          libm with IEEE as the
+#                                          default standard
+#
+
+USE_SHLIBDIR=  yes
+
+# require this for the value of I387_LIBM from mk.conf, if set.
+.include <bsd.own.mk>
+
+.if (${MACHINE_ARCH} == "alpha")
+.PATH: ${.CURDIR}/arch/alpha
+ARCH_SRCS = s_copysign.S s_copysignf.S lrint.S
+.elif ((${MACHINE_ARCH} == "i386") || (${MACHINE_ARCH} == "x86_64"))
+
+.if (${MACHINE_ARCH} == "x86_64")
+.PATH: ${.CURDIR}/arch/x86_64
+.endif
+.PATH: ${.CURDIR}/arch/i387
+
+COMMON_SRCS+= fenv.c s_nextafterl.c s_nexttoward.c
+ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_expf.S e_fmod.S e_log.S \
+           e_logf.S e_log10.S e_log10f.S e_log2.S e_log2f.S e_remainder.S \
+           e_remainderf.S e_scalb.S e_scalbf.S e_sqrt.S e_sqrtf.S s_atan.S \
+           s_atanf.S s_ceil.S s_ceilf.S s_copysign.S s_copysignf.S s_cos.S \
+           s_cosf.S s_finite.S s_finitef.S s_floor.S s_floorf.S s_ilogb.S \
+           s_ilogbf.S s_log1p.S s_log1pf.S s_logb.S s_logbf.S s_rint.S \
+           s_rintf.S s_scalbn.S s_scalbnf.S s_significand.S \
+           s_significandf.S s_sin.S s_sinf.S s_tan.S s_tanf.S lrint.S
+# do not pick up the i387 asm version, it is incorrect
+s_modf.o s_modf.pico s_modf.po s_modf.d: s_modf.c
+
+.if (${MACHINE_ARCH} == "i386")
+SUBDIR=arch/i387
+.endif
+.elif (${MACHINE_ARCH} == "m68k")
+.if defined(M68060)
+.PATH: ${.CURDIR}/arch/m68060
+.include "${.CURDIR}/arch/m68060/Makefile.list"
+COPTS+=-m68060
+.PATH: ${.CURDIR}/arch/m68k
+ARCH_SRCS += s_ceil.S s_copysign.S s_finite.S s_floor.S s_rint.S
+.elif defined(M68040)
+.PATH: ${.CURDIR}/arch/m68k
+COPTS+=-m68040
+ARCH_SRCS = s_copysign.S s_finite.S
+.else
+.if (${MKSOFTFLOAT} != "yes")
+.PATH: ${.CURDIR}/arch/mc68881 ${.CURDIR}/arch/m68k
+ARCH_SRCS = e_acos.S e_asin.S e_atanh.S e_cosh.S e_exp.S e_fmod.S e_log.S \
+           e_log10.S e_remainder.S e_scalb.S e_sinh.S e_sqrt.S s_atan.S \
+           s_ceil.S s_copysign.S s_cos.S s_expm1.S s_finite.S s_floor.S \
+           s_log1p.S s_logb.S s_rint.S s_scalbn.S s_sin.S s_tan.S s_tanh.S
+.endif
+.endif
+# end of m68k
+.elif (${MACHINE_ARCH} == "vax")
+#.PATH:        ${.CURDIR}/arch/vax
+
+#NOIEEE_ARCH= n_infnan.S n_argred.S n_sqrt.S
+#ARCH_SRCS = n_atan2.S n_cabs.S n_cbrt.S n_support.S n_sincos.S n_tan.S
+# XXX - ripped out due to lack of the insn polyd in the Mariah chip,
+# and emulation code isn't written yet.
+WARNS?=4
+.endif
+
+WARNS?=4
+
+.PATH: ${.CURDIR}/man
+.PATH: ${.CURDIR}/src
+.PATH: ${.CURDIR}/noieee_src
+
+.if (${MACHINE_ARCH} != "vax")
+CPPFLAGS+= -D_MULTI_LIBM -D_POSIX_MODE
+# XXX noieee libm is gross
+COPTS+=        -fno-strict-aliasing
+.endif
+CPPFLAGS+=-DLIBM_SCCS
 
 LIB=   m
+COMMON_SRCS+= e_acos.c e_acosf.c e_acosh.c e_acoshf.c e_asin.c e_asinf.c \
+       e_atan2.c e_atan2f.c e_atanh.c e_atanhf.c e_cosh.c e_coshf.c e_exp.c \
+       e_expf.c e_fmod.c e_fmodf.c e_hypot.c e_hypotf.c e_j0.c e_j0f.c \
+       e_j1.c e_j1f.c e_jn.c e_jnf.c e_lgamma_r.c e_lgammaf_r.c e_log.c \
+       e_log2.c e_log10.c e_log10f.c e_log2f.c e_logf.c e_pow.c e_powf.c \
+       e_rem_pio2.c e_rem_pio2f.c e_remainder.c e_remainderf.c e_scalb.c \
+       e_scalbf.c e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c \
+       k_cos.c k_cosf.c k_rem_pio2.c k_rem_pio2f.c k_sin.c k_sinf.c \
+       k_standard.c k_tan.c k_tanf.c \
+       s_asinh.c s_asinhf.c s_atan.c s_atanf.c s_cbrt.c s_cbrtf.c s_ceil.c \
+       s_ceilf.c s_copysign.c s_copysignf.c s_copysignl.c s_cos.c s_cosf.c s_erf.c \
+       s_erff.c s_exp2.c s_exp2f.c s_expm1.c s_expm1f.c s_fabsf.c s_fabsl.c \
+       s_finite.c s_finitef.c \
+       s_floor.c s_floorf.c s_frexpf.c s_ilogb.c s_ilogbf.c \
+       s_isinff.c s_isnanf.c s_ldexpf.c s_lib_version.c s_log1p.c \
+       s_log1pf.c s_logb.c s_logbf.c s_matherr.c s_modff.c s_nextafter.c \
+       s_nextafterf.c s_rint.c s_rintf.c s_round.c s_roundf.c s_scalbn.c \
+       s_scalbnf.c s_signgam.c s_significand.c s_significandf.c s_sin.c \
+       s_sinf.c s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_trunc.c s_truncf.c \
+       w_acos.c w_acosf.c w_acosh.c w_acoshf.c w_asin.c w_asinf.c w_atan2.c \
+       w_atan2f.c w_atanh.c w_atanhf.c w_cosh.c w_coshf.c \
+       w_drem.c w_dremf.c w_exp.c w_expf.c w_fmod.c w_fmodf.c w_gamma.c \
+       w_gamma_r.c w_gammaf.c w_gammaf_r.c w_hypot.c w_hypotf.c w_j0.c \
+       w_j0f.c w_j1.c w_j1f.c w_jn.c w_jnf.c w_lgamma.c w_lgamma_r.c \
+       w_lgammaf.c w_lgammaf_r.c w_log.c w_log10.c w_log10f.c w_log2.c \
+       w_log2f.c w_logf.c \
+       w_pow.c w_powf.c w_remainder.c w_remainderf.c w_scalb.c w_scalbf.c \
+       w_sinh.c w_sinhf.c w_sqrt.c w_sqrtf.c \
+       lrint.c lrintf.c llrint.c llrintf.c lround.c lroundf.c llround.c \
+       llroundf.c s_frexp.c s_ldexp.c s_modf.c \
+       s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c s_fminf.c s_fminl.c s_fdim.c
+
+.PATH: ${.CURDIR}/compat
+COMMON_SRCS+= compat_cabs.c compat_cabsf.c
+# XXX our compatibility cabs() is different!
+.if defined(HAVE_GCC) && ${HAVE_GCC} == 4
+COPTS.compat_cabs.c=   -fno-builtin-cabs
+COPTS.compat_cabsf.c=  -fno-builtin-cabsf
+.endif
+
+# math routines for non-IEEE architectures.
+NOIEEE_SRCS = n_asincos.c n_acosh.c n_asinh.c n_atan.c n_atanh.c n_cosh.c \
+       n_erf.c n_exp.c n_exp__E.c n_expm1.c n_floor.c n_fmod.c n_gamma.c \
+       n_lgamma.c n_j0.c n_j1.c n_jn.c n_log.c n_log10.c n_log1p.c \
+       n_log__L.c n_pow.c n_sinh.c n_tanh.c \
+       n_sincos.c n_tan.c \
+       n_round.c n_roundf.c n_lround.c n_lroundf.c \
+       n_fmax.c n_fmaxf.c n_fmin.c n_fminf.c
+#      n_sqrt.c n_argred.c n_infnan.c n_atan2.c n_cabs.c n_cbrt.c n_support.c
+
+
+# NetBSD's C library supplies these functions:
+#COMMON_SRCS+= s_fabs.c s_frexp.c s_isinf.c s_isnan.c s_ldexp.c s_modf.c
+
+.if (${MACHINE_ARCH} == "vax")
+SRCS=  ${NOIEEE_SRCS} ${NOIEEE_ARCH}
+.else
+SRCS=  ${COMMON_SRCS}
+.endif
+
+.ifdef ARCH_ADDS
+SRCS+= ${ARCH_ADDS}
+.endif
+
+# Substitute common sources with any arch specific sources
+.for i in ${ARCH_SRCS} ${NOIEEE_ARCH}
+    SRCS:=${SRCS:S/^${i:S/.S/.c/}/$i/}
+.endfor
+
+.if (${MACHINE_ARCH} == "vax") # XXX until POLYD is written.
+.PATH: ${.CURDIR}/arch/vax
+SRCS:=${SRCS} n_sqrt.S n_argred.S n_infnan.S n_atan2.S n_cabs.S n_cbrt.S \
+       n_support.S
+.endif
+
+.if (${MACHINE_ARCH} == "i386")
+# XXX this gets miscompiled. There should be a better fix.
+COPTS.s_tanh.c+= -O0
+.endif
+
+MAN+=  acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 ceil.3 \
+       cos.3 cosh.3 erf.3 exp.3 fabs.3 floor.3 fmod.3 frexp.3 hypot.3 ieee.3 \
+       ieee_test.3 isinff.3 j0.3 ldexp.3 lgamma.3 lrint.3 \
+       math.3 modf.3 rint.3 round.3 sin.3 sinh.3 \
+       sqrt.3 tan.3 tanh.3 trunc.3 fmax.3 fdim.3
+
+# fenv.h interface
+MAN+=  feclearexcept.3 feenableexcept.3 fegetenv.3 fegetround.3 fenv.3
+MLINKS+=feclearexcept.3 fegetexceptflag.3      \
+       feclearexcept.3 feraiseexcept.3         \
+       feclearexcept.3 fesetexceptflag.3       \
+       feclearexcept.3 fetestexcept.3
+MLINKS+=feenableexcept.3 fedisableexcept.3     \
+       feenableexcept.3 fegetexcept.3
+MLINKS+=fegetenv.3 feholdexcept.3              \
+       fegetenv.3 fesetenv.3                   \
+       fegetenv.3 feupdateenv.3
+MLINKS+=fegetround.3 fesetround.3
+
+MLINKS+=acos.3 acosf.3
+MLINKS+=acosh.3 acoshf.3
+MLINKS+=asin.3 asinf.3
+MLINKS+=asinh.3 asinhf.3
+MLINKS+=atan.3 atanf.3
+MLINKS+=atan2.3 atan2f.3
+MLINKS+=atanh.3 atanhf.3
+MLINKS+=ceil.3 ceilf.3
+MLINKS+=cos.3 cosf.3
+MLINKS+=cosh.3 coshf.3
+MLINKS+=erf.3 erff.3 erf.3 erfc.3 erf.3 erfcf.3
+MLINKS+=exp.3 expf.3 exp.3 expm1.3 exp.3 expm1f.3                      \
+       exp.3 exp2.3 exp.3 exp2f.3                                      \
+       exp.3 log.3 exp.3 logf.3                                        \
+       exp.3 log10.3 exp.3 log10f.3                                    \
+       exp.3 log1p.3 exp.3 log1pf.3                                    \
+       exp.3 pow.3 exp.3 powf.3                                        \
+       exp.3 log2.3 exp.3 log2f.3
+MLINKS+=fabs.3 fabsf.3
+MLINKS+=floor.3 floorf.3
+MLINKS+=fmod.3 fmodf.3
+MLINKS+=hypot.3 hypotf.3
+MLINKS+=ieee.3 copysign.3 ieee.3 copysignf.3 ieee.3 copysignl.3        \
+       ieee.3 finite.3 ieee.3 finitef.3                                \
+       ieee.3 ilogb.3 ieee.3 ilogbf.3                                  \
+       ieee.3 nextafter.3 ieee.3 nextafterf.3 ieee.3 nextafterl.3      \
+       ieee.3 nexttoward.3                                             \
+       ieee.3 remainder.3 ieee.3 remainderf.3                          \
+       ieee.3 scalbn.3 ieee.3 scalbnf.3
+MLINKS+=ieee_test.3 logb.3 ieee_test.3 logbf.3
+MLINKS+=ieee_test.3 scalb.3 ieee_test.3 scalbf.3
+MLINKS+=ieee_test.3 significand.3 ieee_test.3 significandf.3
+MLINKS+=isinff.3 isnanf.3
+MLINKS+=j0.3 j0f.3 j0.3 j1.3 j0.3 j1f.3 j0.3 jn.3 j0.3 jnf.3 \
+       j0.3 y0.3 j0.3 y0f.3 j0.3 y1.3 j0.3 y1f.3 j0.3 yn.3 j0.3 ynf.3
+MLINKS+=lgamma.3 lgammaf.3 lgamma.3 lgamma_r.3 lgamma.3 lgammaf_r.3 \
+       lgamma.3 gamma.3 lgamma.3 gammaf.3 lgamma.3 gamma_r.3 \
+       lgamma.3 gammaf_r.3
+MLINKS+=lrint.3 lrintf.3 lrint.3 llrint.3 lrint.3 llrintf.3
+MLINKS+=rint.3 rintf.3
+MLINKS+=sin.3 sinf.3
+MLINKS+=sinf.3 sinhf.3
+MLINKS+=sqrt.3 sqrtf.3 sqrt.3 cbrt.3 sqrt.3 cbrtf.3
+MLINKS+=tan.3 tanf.3
+MLINKS+=tanh.3 tanhf.3
+MLINKS+=round.3 roundf.3
+MLINKS+=trunc.3 truncf.3
+MLINKS+=fmax.3 fmaxl.3
+MLINKS+=fmax.3 fmaxf.3
+MLINKS+=fmax.3 fmin.3
+MLINKS+=fmax.3 fminl.3
+MLINKS+=fmax.3 fminf.3
+MLINKS+=fdim.3 fdiml.3
+MLINKS+=fdim.3 fdimf.3
 
-SRCS=  dummy.c
+.if (${MKCOMPLEX} != "no")
+.include "${.CURDIR}/complex/Makefile.inc"
+.endif
 
+.include "${.CURDIR}/gen/Makefile.inc"
 .include <bsd.lib.mk>
+.include <bsd.subdir.mk>
diff --git a/lib/libm/dummy.c b/lib/libm/dummy.c
deleted file mode 100644 (file)
index 6473470..0000000
+++ /dev/null
@@ -1 +0,0 @@
-int __dummy__;
similarity index 100%
rename from lib/nbsd_libm/gen/nan.3
rename to lib/libm/gen/nan.3
similarity index 100%
rename from lib/nbsd_libm/gen/nan.c
rename to lib/libm/gen/nan.c
similarity index 100%
rename from lib/nbsd_libm/gen/nanf.c
rename to lib/libm/gen/nanf.c
similarity index 100%
rename from lib/nbsd_libm/gen/nanl.c
rename to lib/libm/gen/nanl.c
similarity index 100%
rename from lib/nbsd_libm/man/acos.3
rename to lib/libm/man/acos.3
similarity index 100%
rename from lib/nbsd_libm/man/asin.3
rename to lib/libm/man/asin.3
similarity index 100%
rename from lib/nbsd_libm/man/atan.3
rename to lib/libm/man/atan.3
similarity index 100%
rename from lib/nbsd_libm/man/ceil.3
rename to lib/libm/man/ceil.3
similarity index 100%
rename from lib/nbsd_libm/man/cos.3
rename to lib/libm/man/cos.3
similarity index 100%
rename from lib/nbsd_libm/man/cosh.3
rename to lib/libm/man/cosh.3
similarity index 100%
rename from lib/nbsd_libm/man/erf.3
rename to lib/libm/man/erf.3
similarity index 100%
rename from lib/nbsd_libm/man/exp.3
rename to lib/libm/man/exp.3
similarity index 100%
rename from lib/nbsd_libm/man/fabs.3
rename to lib/libm/man/fabs.3
similarity index 100%
rename from lib/nbsd_libm/man/fdim.3
rename to lib/libm/man/fdim.3
similarity index 100%
rename from lib/nbsd_libm/man/fenv.3
rename to lib/libm/man/fenv.3
similarity index 100%
rename from lib/nbsd_libm/man/fmax.3
rename to lib/libm/man/fmax.3
similarity index 100%
rename from lib/nbsd_libm/man/fmod.3
rename to lib/libm/man/fmod.3
similarity index 100%
rename from lib/nbsd_libm/man/ieee.3
rename to lib/libm/man/ieee.3
similarity index 100%
rename from lib/nbsd_libm/man/j0.3
rename to lib/libm/man/j0.3
similarity index 100%
rename from lib/nbsd_libm/man/math.3
rename to lib/libm/man/math.3
similarity index 100%
rename from lib/nbsd_libm/man/modf.3
rename to lib/libm/man/modf.3
similarity index 100%
rename from lib/nbsd_libm/man/rint.3
rename to lib/libm/man/rint.3
similarity index 100%
rename from lib/nbsd_libm/man/sin.3
rename to lib/libm/man/sin.3
similarity index 100%
rename from lib/nbsd_libm/man/sinh.3
rename to lib/libm/man/sinh.3
similarity index 100%
rename from lib/nbsd_libm/man/sqrt.3
rename to lib/libm/man/sqrt.3
similarity index 100%
rename from lib/nbsd_libm/man/tan.3
rename to lib/libm/man/tan.3
similarity index 100%
rename from lib/nbsd_libm/man/tanh.3
rename to lib/libm/man/tanh.3
similarity index 100%
rename from lib/nbsd_libm/src/e_j0.c
rename to lib/libm/src/e_j0.c
similarity index 100%
rename from lib/nbsd_libm/src/e_j1.c
rename to lib/libm/src/e_j1.c
similarity index 100%
rename from lib/nbsd_libm/src/e_jn.c
rename to lib/libm/src/e_jn.c
similarity index 100%
rename from lib/nbsd_libm/src/w_j0.c
rename to lib/libm/src/w_j0.c
similarity index 100%
rename from lib/nbsd_libm/src/w_j1.c
rename to lib/libm/src/w_j1.c
similarity index 100%
rename from lib/nbsd_libm/src/w_jn.c
rename to lib/libm/src/w_jn.c
index a20f5ef67c4db3711e0dbdd8581e6b586a0fc1c6..c4d26001eccc49a26378e42825421583c68e2067 100644 (file)
@@ -8,7 +8,7 @@ LIB=            minc
 
 CPPFLAGS.sched_start.c+=       -I${MINIXSRCDIR}
 
-LIBCSRCDIR=${MINIXSRCDIR}/lib/nbsd_libc
+LIBCSRCDIR=${MINIXSRCDIR}/lib/libc
 
 MACHINE_ARCH=${MACHINE}
 
@@ -74,8 +74,8 @@ CPPFLAGS.${i}+= -I${LIBCSRCDIR}/stdlib -I${LIBCSRCDIR}/include
 # Import from gen
 
 errlist.c: ${LIBCSRCDIR}/gen/errlist.awk \
-          ${MINIXSRCDIR}/nbsd_include/sys/errno.h
-       cat ${MINIXSRCDIR}/nbsd_include/sys/errno.h | ${TOOL_SED} 's/(_SIGN//' | ${TOOL_AWK} -f ${LIBCSRCDIR}/gen/errlist.awk > ${.TARGET}
+          ${MINIXSRCDIR}/include/sys/errno.h
+       cat ${MINIXSRCDIR}/include/sys/errno.h | ${TOOL_SED} 's/(_SIGN//' | ${TOOL_AWK} -f ${LIBCSRCDIR}/gen/errlist.awk > ${.TARGET}
 
 .for i in assert.c _errno.c errno.c _env.c errlist.c \
        execle.c getprogname.c sleep.c time.c \
diff --git a/lib/libminixutil/Makefile b/lib/libminixutil/Makefile
deleted file mode 100644 (file)
index e179280..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Makefile for libminixutil
-
-LIB=   minixutil
-
-.if (${NBSD_LIBC} != "no")
-# SHA and MD5 functions already in libc
-SRCS=  openpty.c efun.c
-.else
-SRCS=  openpty.c sha2.c efun.c \
-               sha1.c sha1hl.c sha2.c sha2hl.c md5c.c md5hl.c
-.endif
-.include <bsd.lib.mk>
diff --git a/lib/libminixutil/efun.c b/lib/libminixutil/efun.c
deleted file mode 100644 (file)
index ef2c1b3..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*     $NetBSD: efun.c,v 1.6 2008/04/28 20:23:02 martin Exp $  */
-
-/*-
- * Copyright (c) 2006 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Christos Zoulas.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#ifdef __RCSID
-__RCSID("$NetBSD: efun.c,v 1.6 2008/04/28 20:23:02 martin Exp $");
-#endif
-
-#include <err.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <err.h>
-#include <util.h>
-
-static void (*efunc)(int, const char *, ...) = err;
-
-void (*
-esetfunc(void (*ef)(int, const char *, ...)))(int, const char *, ...)
-{
-       void (*of)(int, const char *, ...) = efunc;
-       efunc = ef == NULL ? (void (*)(int, const char *, ...))exit : ef;
-       return of;
-}
-
-size_t
-estrlcpy(char *dst, const char *src, size_t len)
-{
-       size_t rv;
-       if ((rv = strlcpy(dst, src, len)) >= len) {
-               errno = ENAMETOOLONG;
-               (*efunc)(1,
-                   "Cannot copy string; %zu chars needed %zu provided",
-                   rv, len);
-       }
-       return rv;
-}
-
-size_t
-estrlcat(char *dst, const char *src, size_t len)
-{
-       size_t rv;
-       if ((rv = strlcat(dst, src, len)) >= len) {
-               errno = ENAMETOOLONG;
-               (*efunc)(1,
-                   "Cannot append to string; %zu chars needed %zu provided",
-                   rv, len);
-       }
-       return rv;
-}
-
-char *
-estrdup(const char *s)
-{
-       char *d = strdup(s);
-       if (d == NULL)
-               (*efunc)(1, "Cannot copy string");
-       return d;
-}
-
-#ifndef __minix
-char *
-estrndup(const char *s, size_t len)
-{
-       char *d = strndup(s, len);
-       if (d == NULL)
-               (*efunc)(1, "Cannot copy string");
-       return d;
-}
-#endif
-
-void *
-emalloc(size_t n)
-{
-       void *p = malloc(n);
-       if (p == NULL)
-               (*efunc)(1, "Cannot allocate %zu bytes", n);
-       return p;
-}
-
-void *
-ecalloc(size_t n, size_t s)
-{
-       void *p = calloc(n, s);
-       if (p == NULL)
-               (*efunc)(1, "Cannot allocate %zu bytes", n);
-       return p;
-}
-
-void *
-erealloc(void *p, size_t n)
-{
-       void *q = realloc(p, n);
-       if (q == NULL)
-               (*efunc)(1, "Cannot re-allocate %zu bytes", n);
-       return q;
-}
-
-FILE *
-efopen(const char *p, const char *m)
-{
-       FILE *fp = fopen(p, m);
-       if (fp == NULL)
-               (*efunc)(1, "Cannot open `%s'", p);
-       return fp;
-}
-
-int
-easprintf(char ** __restrict ret, const char * __restrict format, ...)
-{
-       int rv;
-       va_list ap;
-       va_start(ap, format);
-       if ((rv = vasprintf(ret, format, ap)) == -1)
-               (*efunc)(1, "Cannot format string");
-       va_end(ap);
-       return rv;
-}
-
-int
-evasprintf(char ** __restrict ret, const char * __restrict format, va_list ap)
-{
-       int rv;
-       if ((rv = vasprintf(ret, format, ap)) == -1)
-               (*efunc)(1, "Cannot format string");
-       return rv;
-}
diff --git a/lib/libminixutil/md5c.c b/lib/libminixutil/md5c.c
deleted file mode 100644 (file)
index 6c38186..0000000
+++ /dev/null
@@ -1,379 +0,0 @@
-/*     $NetBSD: md5c.c,v 1.7 2008/10/06 12:36:20 joerg Exp $   */
-
-/*
- * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org>
- * for portability and formatting.
- */
-
-/*
- * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
- * rights reserved.
- *
- * License to copy and use this software is granted provided that it
- * is identified as the "RSA Data Security, Inc. MD5 Message-Digest
- * Algorithm" in all material mentioning or referencing this software
- * or this function.
- *
- * License is also granted to make and use derivative works provided
- * that such works are identified as "derived from the RSA Data
- * Security, Inc. MD5 Message-Digest Algorithm" in all material
- * mentioning or referencing the derived work.
- *
- * RSA Data Security, Inc. makes no representations concerning either
- * the merchantability of this software or the suitability of this
- * software for any particular purpose. It is provided "as is"
- * without express or implied warranty of any kind.
- *
- * These notices must be retained in any copies of any part of this
- * documentation and/or software.
- */
-
-#if defined(_KERNEL) || defined(_STANDALONE)
-#include <lib/libkern/libkern.h>
-#include <sys/param.h>
-#include <sys/md5.h>
-#define _DIAGASSERT(x) (void)0
-#else
-#if 0
-#include "namespace.h"
-#endif
-#include <sys/types.h>
-#include <assert.h>
-#include <string.h>
-#include <minix/md5.h>
-#endif /* _KERNEL || _STANDALONE */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#ifndef __minix
-#if defined(HAVE_MEMSET)
-#define ZEROIZE(d, l)          memset((d), 0, (l)) 
-#else 
-# if defined(HAVE_BZERO)
-#define ZEROIZE(d, l)          bzero((d), (l))
-# else
-#error You need either memset or bzero 
-# endif 
-#endif
-#else
-#define ZEROIZE(d, l)          memset((d), 0, (l)) 
-#endif
-
-#define _DIAGASSERT assert
-
-typedef unsigned char *POINTER;
-typedef uint16_t UINT2;
-typedef uint32_t UINT4;
-
-/*
- * Constants for MD5Transform routine.
- */
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
-
-#if 0
-#if !defined(_KERNEL) && !defined(_STANDALONE) && defined(__weak_alias)
-__weak_alias(MD5Init,_MD5Init)
-__weak_alias(MD5Update,_MD5Update)
-__weak_alias(MD5Final,_MD5Final)
-#endif
-#endif
-
-static void MD5Transform __P((UINT4 [4], const unsigned char [64]));
-
-static void Encode __P((unsigned char *, UINT4 *, unsigned int));
-static void Decode __P((UINT4 *, const unsigned char *, unsigned int));
-
-/*
- * Encodes input (UINT4) into output (unsigned char).  Assumes len is
- * a multiple of 4.
- */
-static void
-Encode (output, input, len)
-       unsigned char *output;
-       UINT4 *input;
-       unsigned int len;
-{
-       unsigned int i, j;
-
-       for (i = 0, j = 0; j < len; i++, j += 4) {
-               output[j] = (unsigned char)(input[i] & 0xff);
-               output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
-               output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
-               output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
-       }
-}
-
-/*
- * Decodes input (unsigned char) into output (UINT4).  Assumes len is
- * a multiple of 4.
- */
-static void
-Decode (output, input, len)
-       UINT4 *output;
-       const unsigned char *input;
-       unsigned int len;
-{
-       unsigned int i, j;
-
-       for (i = 0, j = 0; j < len; i++, j += 4)
-               output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
-                   (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
-}
-
-static const unsigned char PADDING[64] = {
-       0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-
-/*
- * F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z)     (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z)     (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z)     ((x) ^ (y) ^ (z))
-#define I(x, y, z)     ((y) ^ ((x) | (~z)))
-
-/*
- * ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n)      (((x) << (n)) | ((x) >> (32-(n))))
-
-/*
- * FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
- * Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
-       (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
-       (a) = ROTATE_LEFT ((a), (s)); \
-       (a) += (b); \
-}
-
-#define GG(a, b, c, d, x, s, ac) { \
-       (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
-       (a) = ROTATE_LEFT ((a), (s)); \
-       (a) += (b); \
-}
-
-#define HH(a, b, c, d, x, s, ac) { \
-       (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
-       (a) = ROTATE_LEFT ((a), (s)); \
-       (a) += (b); \
-}
-
-#define II(a, b, c, d, x, s, ac) { \
-       (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
-       (a) = ROTATE_LEFT ((a), (s)); \
-       (a) += (b); \
-}
-
-/*
- * MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-void
-MD5Init(context)
-       MD5_CTX *context;               /* context */
-{
-
-       _DIAGASSERT(context != 0);
-
-       context->count[0] = context->count[1] = 0;
-
-       /* Load magic initialization constants. */
-       context->state[0] = 0x67452301;
-       context->state[1] = 0xefcdab89;
-       context->state[2] = 0x98badcfe;
-       context->state[3] = 0x10325476;
-}
-
-/*
- * MD5 block update operation.  Continues an MD5 message-digest
- * operation, processing another message block, and updating the
- * context.
- */
-void
-MD5Update(context, input, inputLen)
-       MD5_CTX *context;               /* context */
-       const unsigned char *input;     /* input block */
-       unsigned int inputLen;          /* length of input block */
-{
-       unsigned int i, idx, partLen;
-
-       _DIAGASSERT(context != 0);
-       _DIAGASSERT(input != 0);
-
-       /* Compute number of bytes mod 64 */
-       idx = (unsigned int)((context->count[0] >> 3) & 0x3F);
-
-       /* Update number of bits */
-       if ((context->count[0] += ((UINT4)inputLen << 3))
-           < ((UINT4)inputLen << 3))
-               context->count[1]++;
-       context->count[1] += ((UINT4)inputLen >> 29);
-
-       partLen = 64 - idx;
-
-       /* Transform as many times as possible. */
-       if (inputLen >= partLen) {
-               /* LINTED const castaway ok */
-               memcpy((POINTER)&context->buffer[idx],
-                   (POINTER)input, partLen);
-               MD5Transform(context->state, context->buffer);
-
-               for (i = partLen; i + 63 < inputLen; i += 64)
-                       MD5Transform(context->state, &input[i]);
-
-               idx = 0;
-       } else
-               i = 0;
-
-       /* Buffer remaining input */
-       /* LINTED const castaway ok */
-       memcpy((POINTER)&context->buffer[idx], (POINTER)&input[i],
-           inputLen - i);
-}
-
-/*
- * MD5 finalization.  Ends an MD5 message-digest operation, writing the
- * message digest and zeroing the context.
- */
-void
-MD5Final(digest, context)
-       unsigned char digest[16];       /* message digest */
-       MD5_CTX *context;               /* context */
-{
-       unsigned char bits[8];
-       unsigned int idx, padLen;
-
-       _DIAGASSERT(digest != 0);
-       _DIAGASSERT(context != 0);
-
-       /* Save number of bits */
-       Encode(bits, context->count, 8);
-
-       /* Pad out to 56 mod 64. */
-       idx = (unsigned int)((context->count[0] >> 3) & 0x3f);
-       padLen = (idx < 56) ? (56 - idx) : (120 - idx);
-       MD5Update (context, PADDING, padLen);
-
-       /* Append length (before padding) */
-       MD5Update(context, bits, 8);
-
-       /* Store state in digest */
-       Encode(digest, context->state, 16);
-
-       /* Zeroize sensitive information. */
-       ZEROIZE((POINTER)(void *)context, sizeof(*context));
-}
-
-/*
- * MD5 basic transformation. Transforms state based on block.
- */
-static void
-MD5Transform(state, block)
-       UINT4 state[4];
-       const unsigned char block[64];
-{
-       UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
-       Decode(x, block, 64);
-
-       /* Round 1 */
-       FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
-       FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
-       FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
-       FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
-       FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
-       FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
-       FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
-       FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
-       FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
-       FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
-       FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
-       FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
-       FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
-       FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
-       FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
-       FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
-
-       /* Round 2 */
-       GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
-       GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
-       GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
-       GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
-       GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
-       GG (d, a, b, c, x[10], S22,  0x2441453); /* 22 */
-       GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
-       GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
-       GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
-       GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
-       GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
-       GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
-       GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
-       GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
-       GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
-       GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
-
-       /* Round 3 */
-       HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
-       HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
-       HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
-       HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
-       HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
-       HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
-       HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
-       HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
-       HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
-       HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
-       HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
-       HH (b, c, d, a, x[ 6], S34,  0x4881d05); /* 44 */
-       HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
-       HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
-       HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
-       HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
-
-       /* Round 4 */
-       II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
-       II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
-       II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
-       II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
-       II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
-       II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
-       II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
-       II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
-       II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
-       II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
-       II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
-       II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
-       II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
-       II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
-       II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
-       II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
-
-       state[0] += a;
-       state[1] += b;
-       state[2] += c;
-       state[3] += d;
-
-       /* Zeroize sensitive information. */
-       ZEROIZE((POINTER)(void *)x, sizeof (x));
-}
-
diff --git a/lib/libminixutil/md5hl.c b/lib/libminixutil/md5hl.c
deleted file mode 100644 (file)
index 427abab..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*     $NetBSD: mdXhl.c,v 1.2 2008/10/06 12:36:20 joerg Exp $  */
-
-/*
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dkuug.dk> wrote this file.  As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- *
- * from FreeBSD Id: mdXhl.c,v 1.8 1996/10/25 06:48:12 bde Exp
- */
-
-/*
- * Modifed April 29, 1997 by Jason R. Thorpe <thorpej@NetBSD.org>
- */
-
-#include <sys/types.h>
-
-#include <assert.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/cdefs.h>
-#include <minix/md5.h>
-
-#define MDALGORITHM MD5
-#define        CONCAT(x,y)     __CONCAT(x,y)
-#define        MDNAME(x)       CONCAT(MDALGORITHM,x)
-
-#define _DIAGASSERT assert
-
-char *
-MDNAME(End)(ctx, buf)
-       MDNAME(_CTX) *ctx;
-       char *buf;
-{
-       int i;
-       unsigned char digest[16];
-       static const char hex[]="0123456789abcdef";
-
-       _DIAGASSERT(ctx != 0);
-
-       if (buf == NULL)
-               buf = malloc(33);
-       if (buf == NULL)
-               return (NULL);
-
-       MDNAME(Final)(digest, ctx);
-
-       for (i = 0; i < 16; i++) {
-               buf[i+i] = hex[(uint32_t)digest[i] >> 4];
-               buf[i+i+1] = hex[digest[i] & 0x0f];
-       }
-
-       buf[i+i] = '\0';
-       return (buf);
-}
-
-char *
-MDNAME(File)(filename, buf)
-       const char *filename;
-       char *buf;
-{
-       unsigned char buffer[BUFSIZ];
-       MDNAME(_CTX) ctx;
-       int f, i, j;
-
-       _DIAGASSERT(filename != 0);
-       /* buf may be NULL */
-
-       MDNAME(Init)(&ctx);
-       f = open(filename, O_RDONLY, 0666);
-       if (f < 0)
-               return NULL;
-
-       while ((i = read(f, buffer, sizeof(buffer))) > 0)
-               MDNAME(Update)(&ctx, buffer, (unsigned int)i);
-
-       j = errno;
-       close(f);
-       errno = j;
-
-       if (i < 0)
-               return NULL;
-
-       return (MDNAME(End)(&ctx, buf));
-}
-
-char *
-MDNAME(Data)(data, len, buf)
-       const unsigned char *data;
-       unsigned int len;
-       char *buf;
-{
-       MDNAME(_CTX) ctx;
-
-       _DIAGASSERT(data != 0);
-
-       MDNAME(Init)(&ctx);
-       MDNAME(Update)(&ctx, data, len);
-       return (MDNAME(End)(&ctx, buf));
-}
diff --git a/lib/libminixutil/openpty.c b/lib/libminixutil/openpty.c
deleted file mode 100644 (file)
index e280800..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * openpty() tries to open a pty; applications won't have to
- * duplicate this code all the time (or change it if the system
- * pty interface changes).
- *
- * First version by Ben Gras <beng@few.vu.nl>,
- * Initially heavily based on telnetd/pty.c
- * by Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>.
- *
- */
-#include <libutil.h>
-#include <termios.h>
-#include <fcntl.h>
-#include <grp.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioc_tty.h>
-
-#define DEV_DIR                "/dev"
-
-/*
- * Allocate a PTY, by trying to open one repeatedly.
- */
-int openpty(int *amaster, int *aslave, char *name,
-       struct termios *termp, struct winsize *winp)
-{
-  char buff[128];
-  register int i, j;
-  static char tty_name[128];
-  struct group *ttygroup;
-  gid_t tty_gid = 0;
-
-  if(!amaster || !aslave) {
-       errno = EINVAL;
-       return -1;
-  }
-
-  for(i = 'p'; i < 'w'; i++) {
-       j = 0;
-       do {
-               sprintf(buff, "%s/pty%c%c",
-                       DEV_DIR, i, (j < 10) ? j + '0' : j + 'a' - 10);
-
-               if((*amaster = open(buff, O_RDWR)) >= 0) {
-                 sprintf(tty_name, "%s/tty%c%c", DEV_DIR,
-                       i, (j < 10) ? j + '0' : j + 'a' - 10);
-                 if((*aslave = open(tty_name, O_RDWR)) >= 0)
-                       break;
-               }
-               close(*amaster);
-
-               j++;
-               if (j == 16) break;
-       } while(1);
-
-       /* Did we find one? */
-       if (j < 16) break;
-  }
-  if (*amaster < 0) { errno = ENOENT; return(-1); }
-
-  setgrent();
-  ttygroup = getgrnam("tty");
-  endgrent();
-  if(ttygroup) tty_gid = ttygroup->gr_gid;
-
-  if(name) strcpy(name, tty_name);
-
-  /* Ignore errors on these. */
-  chown(tty_name, getuid(), tty_gid);
-  chmod(tty_name, 0620);       /* -rw--w---- */
-  if(termp) tcsetattr(*aslave, TCSAFLUSH, termp);
-  if(winp) ioctl(*aslave, TIOCSWINSZ, winp);
-
-  return(0);
-}
-
diff --git a/lib/libminixutil/sha1.c b/lib/libminixutil/sha1.c
deleted file mode 100644 (file)
index 53269bc..0000000
+++ /dev/null
@@ -1,295 +0,0 @@
-/*     $NetBSD: sha1.c,v 1.8 2008/10/06 12:36:20 joerg Exp $   */
-/*     $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $       */
-
-/*
- * SHA-1 in C
- * By Steve Reid <steve@edmweb.com>
- * 100% Public Domain
- *
- * Test Vectors (from FIPS PUB 180-1)
- * "abc"
- *   A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
- * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
- *   84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
- * A million repetitions of "a"
- *   34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
- */
-
-#define SHA1HANDSOFF           /* Copies data before messing with it. */
-
-#if defined(_KERNEL) || defined(_STANDALONE)
-#include <sys/param.h>
-#include <sys/sha1.h>
-#include <sys/systm.h>
-#define _DIAGASSERT(x) (void)0
-#else
-#if 0
-#include "namespace.h"
-#endif
-#include <sys/types.h>
-#include <assert.h>
-#include <minix/sha1.h>
-#include <string.h>
-#endif
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-#define _DIAGASSERT assert
-
-/*
- * XXX Kludge until there is resolution regarding mem*() functions
- * XXX in the kernel.
- */
-#if defined(_KERNEL) || defined(_STANDALONE)
-#define        memcpy(s, d, l)         bcopy((d), (s), (l))
-#endif
-
-#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
-
-/*
- * blk0() and blk() perform the initial expand.
- * I got the idea of expanding during the round function from SSLeay
- */
-#if BYTE_ORDER == LITTLE_ENDIAN
-# define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
-    |(rol(block->l[i],8)&0x00FF00FF))
-#else
-# define blk0(i) block->l[i]
-#endif
-#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
-    ^block->l[(i+2)&15]^block->l[i&15],1))
-
-/*
- * (R0+R1), R2, R3, R4 are the different operations (rounds) used in SHA1
- */
-#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
-#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
-#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
-#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
-#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
-
-
-#if 0
-#if !defined(_KERNEL) && defined(__weak_alias)
-__weak_alias(SHA1Transform,_SHA1Transform)
-__weak_alias(SHA1Init,_SHA1Init)
-__weak_alias(SHA1Update,_SHA1Update)
-__weak_alias(SHA1Final,_SHA1Final)
-#endif
-#endif
-
-typedef union {
-    unsigned char c[64];
-    unsigned int l[16];
-} CHAR64LONG16;
-
-/* old sparc64 gcc could not compile this */
-#undef SPARC64_GCC_WORKAROUND
-#if defined(__sparc64__) && defined(__GNUC__) && __GNUC__ < 3
-#define SPARC64_GCC_WORKAROUND
-#endif
-
-#ifdef SPARC64_GCC_WORKAROUND
-void do_R01(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
-void do_R2(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
-void do_R3(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
-void do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *);
-
-#define nR0(v,w,x,y,z,i) R0(*v,*w,*x,*y,*z,i)
-#define nR1(v,w,x,y,z,i) R1(*v,*w,*x,*y,*z,i)
-#define nR2(v,w,x,y,z,i) R2(*v,*w,*x,*y,*z,i)
-#define nR3(v,w,x,y,z,i) R3(*v,*w,*x,*y,*z,i)
-#define nR4(v,w,x,y,z,i) R4(*v,*w,*x,*y,*z,i)
-
-void
-do_R01(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
-{
-    nR0(a,b,c,d,e, 0); nR0(e,a,b,c,d, 1); nR0(d,e,a,b,c, 2); nR0(c,d,e,a,b, 3);
-    nR0(b,c,d,e,a, 4); nR0(a,b,c,d,e, 5); nR0(e,a,b,c,d, 6); nR0(d,e,a,b,c, 7);
-    nR0(c,d,e,a,b, 8); nR0(b,c,d,e,a, 9); nR0(a,b,c,d,e,10); nR0(e,a,b,c,d,11);
-    nR0(d,e,a,b,c,12); nR0(c,d,e,a,b,13); nR0(b,c,d,e,a,14); nR0(a,b,c,d,e,15);
-    nR1(e,a,b,c,d,16); nR1(d,e,a,b,c,17); nR1(c,d,e,a,b,18); nR1(b,c,d,e,a,19);
-}
-
-void
-do_R2(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
-{
-    nR2(a,b,c,d,e,20); nR2(e,a,b,c,d,21); nR2(d,e,a,b,c,22); nR2(c,d,e,a,b,23);
-    nR2(b,c,d,e,a,24); nR2(a,b,c,d,e,25); nR2(e,a,b,c,d,26); nR2(d,e,a,b,c,27);
-    nR2(c,d,e,a,b,28); nR2(b,c,d,e,a,29); nR2(a,b,c,d,e,30); nR2(e,a,b,c,d,31);
-    nR2(d,e,a,b,c,32); nR2(c,d,e,a,b,33); nR2(b,c,d,e,a,34); nR2(a,b,c,d,e,35);
-    nR2(e,a,b,c,d,36); nR2(d,e,a,b,c,37); nR2(c,d,e,a,b,38); nR2(b,c,d,e,a,39);
-}
-
-void
-do_R3(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
-{
-    nR3(a,b,c,d,e,40); nR3(e,a,b,c,d,41); nR3(d,e,a,b,c,42); nR3(c,d,e,a,b,43);
-    nR3(b,c,d,e,a,44); nR3(a,b,c,d,e,45); nR3(e,a,b,c,d,46); nR3(d,e,a,b,c,47);
-    nR3(c,d,e,a,b,48); nR3(b,c,d,e,a,49); nR3(a,b,c,d,e,50); nR3(e,a,b,c,d,51);
-    nR3(d,e,a,b,c,52); nR3(c,d,e,a,b,53); nR3(b,c,d,e,a,54); nR3(a,b,c,d,e,55);
-    nR3(e,a,b,c,d,56); nR3(d,e,a,b,c,57); nR3(c,d,e,a,b,58); nR3(b,c,d,e,a,59);
-}
-
-void
-do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block)
-{
-    nR4(a,b,c,d,e,60); nR4(e,a,b,c,d,61); nR4(d,e,a,b,c,62); nR4(c,d,e,a,b,63);
-    nR4(b,c,d,e,a,64); nR4(a,b,c,d,e,65); nR4(e,a,b,c,d,66); nR4(d,e,a,b,c,67);
-    nR4(c,d,e,a,b,68); nR4(b,c,d,e,a,69); nR4(a,b,c,d,e,70); nR4(e,a,b,c,d,71);
-    nR4(d,e,a,b,c,72); nR4(c,d,e,a,b,73); nR4(b,c,d,e,a,74); nR4(a,b,c,d,e,75);
-    nR4(e,a,b,c,d,76); nR4(d,e,a,b,c,77); nR4(c,d,e,a,b,78); nR4(b,c,d,e,a,79);
-}
-#endif
-
-/*
- * Hash a single 512-bit block. This is the core of the algorithm.
- */
-void SHA1Transform(state, buffer)
-    uint32_t state[5];
-    const unsigned char buffer[64];
-{
-    uint32_t a, b, c, d, e;
-    CHAR64LONG16 *block;
-
-#ifdef SHA1HANDSOFF
-    CHAR64LONG16 workspace;
-#endif
-
-    _DIAGASSERT(buffer != 0);
-    _DIAGASSERT(state != 0);
-
-#ifdef SHA1HANDSOFF
-    block = &workspace;
-    (void)memcpy(block, buffer, 64);
-#else
-    block = (CHAR64LONG16 *)(void *)buffer;
-#endif
-
-    /* Copy context->state[] to working vars */
-    a = state[0];
-    b = state[1];
-    c = state[2];
-    d = state[3];
-    e = state[4];
-
-#ifdef SPARC64_GCC_WORKAROUND
-    do_R01(&a, &b, &c, &d, &e, block);
-    do_R2(&a, &b, &c, &d, &e, block);
-    do_R3(&a, &b, &c, &d, &e, block);
-    do_R4(&a, &b, &c, &d, &e, block);
-#else
-    /* 4 rounds of 20 operations each. Loop unrolled. */
-    R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
-    R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
-    R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
-    R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
-    R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
-    R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
-    R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
-    R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
-    R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
-    R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
-    R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
-    R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
-    R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
-    R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
-    R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
-    R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
-    R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
-    R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
-    R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
-    R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
-#endif
-
-    /* Add the working vars back into context.state[] */
-    state[0] += a;
-    state[1] += b;
-    state[2] += c;
-    state[3] += d;
-    state[4] += e;
-
-    /* Wipe variables */
-    a = b = c = d = e = 0;
-}
-
-
-/*
- * SHA1Init - Initialize new context
- */
-void SHA1Init(context)
-    SHA1_CTX *context;
-{
-
-    _DIAGASSERT(context != 0);
-
-    /* SHA1 initialization constants */
-    context->state[0] = 0x67452301;
-    context->state[1] = 0xEFCDAB89;
-    context->state[2] = 0x98BADCFE;
-    context->state[3] = 0x10325476;
-    context->state[4] = 0xC3D2E1F0;
-    context->count[0] = context->count[1] = 0;
-}
-
-
-/*
- * Run your data through this.
- */
-void SHA1Update(context, data, len)
-    SHA1_CTX *context;
-    const unsigned char *data;
-    unsigned int len;
-{
-    unsigned int i, j;
-
-    _DIAGASSERT(context != 0);
-    _DIAGASSERT(data != 0);
-
-    j = context->count[0];
-    if ((context->count[0] += len << 3) < j)
-       context->count[1] += (len>>29)+1;
-    j = (j >> 3) & 63;
-    if ((j + len) > 63) {
-       (void)memcpy(&context->buffer[j], data, (i = 64-j));
-       SHA1Transform(context->state, context->buffer);
-       for ( ; i + 63 < len; i += 64)
-           SHA1Transform(context->state, &data[i]);
-       j = 0;
-    } else {
-       i = 0;
-    }
-    (void)memcpy(&context->buffer[j], &data[i], len - i);
-}
-
-
-/*
- * Add padding and return the message digest.
- */
-void SHA1Final(digest, context)
-    unsigned char digest[20];
-    SHA1_CTX* context;
-{
-    unsigned int i;
-    unsigned char finalcount[8];
-
-    _DIAGASSERT(digest != 0);
-    _DIAGASSERT(context != 0);
-
-    for (i = 0; i < 8; i++) {
-       finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
-        >> ((3-(i & 3)) * 8) ) & 255);  /* Endian independent */
-    }
-    SHA1Update(context, (unsigned char *)"\200", 1);
-    while ((context->count[0] & 504) != 448)
-       SHA1Update(context, (unsigned char *)"\0", 1);
-    SHA1Update(context, finalcount, 8);  /* Should cause a SHA1Transform() */
-
-    if (digest) {
-       for (i = 0; i < 20; i++)
-           digest[i] = (unsigned char)
-               ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
-    }
-}
-
diff --git a/lib/libminixutil/sha1hl.c b/lib/libminixutil/sha1hl.c
deleted file mode 100644 (file)
index 47c5db1..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*     $NetBSD: sha1hl.c,v 1.8 2008/10/06 12:36:20 joerg Exp $ */
-
-/* sha1hl.c
- * ----------------------------------------------------------------------------
- * "THE BEER-WARE LICENSE" (Revision 42):
- * <phk@login.dkuug.dk> wrote this file.  As long as you retain this notice you
- * can do whatever you want with this stuff. If we meet some day, and you think
- * this stuff is worth it, you can buy me a beer in return.   Poul-Henning Kamp
- * ----------------------------------------------------------------------------
- */
-
-#if 0
-#include "namespace.h"
-#endif
-
-#include <sys/cdefs.h>
-#include <sys/file.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <minix/sha1.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#define _DIAGASSERT assert
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: sha1hl.c,v 1.8 2008/10/06 12:36:20 joerg Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#if 0
-#if defined(__weak_alias)
-__weak_alias(SHA1End,_SHA1End)
-__weak_alias(SHA1File,_SHA1File)
-__weak_alias(SHA1Data,_SHA1Data)
-#endif
-#endif
-
-/* ARGSUSED */
-char *
-SHA1End(ctx, buf)
-    SHA1_CTX *ctx;
-    char *buf;
-{
-    int i;
-    char *p = buf;
-    unsigned char digest[20];
-    static const char hex[]="0123456789abcdef";
-
-    _DIAGASSERT(ctx != NULL);
-    /* buf may be NULL */
-
-    if (p == NULL && (p = malloc(41)) == NULL)
-       return 0;
-
-    SHA1Final(digest,ctx);
-    for (i = 0; i < 20; i++) {
-       p[i + i] = hex[((uint32_t)digest[i]) >> 4];
-       p[i + i + 1] = hex[digest[i] & 0x0f];
-    }
-    p[i + i] = '\0';
-    return(p);
-}
-
-char *
-SHA1File (filename, buf)
-    char *filename;
-    char *buf;
-{
-    unsigned char buffer[BUFSIZ];
-    SHA1_CTX ctx;
-    int fd, num, oerrno;
-
-    _DIAGASSERT(filename != NULL);
-    /* XXX: buf may be NULL ? */
-
-    SHA1Init(&ctx);
-
-    if ((fd = open(filename,O_RDONLY)) < 0)
-       return(0);
-
-    while ((num = read(fd, buffer, sizeof(buffer))) > 0)
-       SHA1Update(&ctx, buffer, (size_t)num);
-
-    oerrno = errno;
-    close(fd);
-    errno = oerrno;
-    return(num < 0 ? 0 : SHA1End(&ctx, buf));
-}
-
-char *
-SHA1Data (data, len, buf)
-    const unsigned char *data;
-    size_t len;
-    char *buf;
-{
-    SHA1_CTX ctx;
-
-    _DIAGASSERT(data != NULL);
-    /* XXX: buf may be NULL ? */
-
-    SHA1Init(&ctx);
-    SHA1Update(&ctx, data, len);
-    return(SHA1End(&ctx, buf));
-}
diff --git a/lib/libminixutil/sha2.c b/lib/libminixutil/sha2.c
deleted file mode 100644 (file)
index cced4ee..0000000
+++ /dev/null
@@ -1,1165 +0,0 @@
-/* $NetBSD: sha2.c,v 1.7 2007/07/18 14:09:55 joerg Exp $ */
-/*     $KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $    */
-
-/*
- * sha2.c
- *
- * Version 1.0.0beta1
- *
- * Written by Aaron D. Gifford <me@aarongifford.com>
- *
- * Copyright 2000 Aaron D. Gifford.  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. Neither the name of the copyright holder nor the names of contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``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(S) OR CONTRIBUTOR(S) 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/types.h>
-/* #include <sys/time.h> */
-/* #include <sys/systm.h> */
-/* #include <machine/endian.h> */
-#include <stdint.h>
-#include <minix/sha2.h>
-#include <assert.h>
-
-/*
- * ASSERT NOTE:
- * Some sanity checking code is included using assert().  On my FreeBSD
- * system, this additional code can be removed by compiling with NDEBUG
- * defined.  Check your own systems manpage on assert() to see how to
- * compile WITHOUT the sanity checking code on your system.
- *
- * UNROLLED TRANSFORM LOOP NOTE:
- * You can define SHA2_UNROLL_TRANSFORM to use the unrolled transform
- * loop version for the hash transform rounds (defined using macros
- * later in this file).  Either define on the command line, for example:
- *
- *   cc -DSHA2_UNROLL_TRANSFORM -o sha2 sha2.c sha2prog.c
- *
- * or define below:
- *
- *   #define SHA2_UNROLL_TRANSFORM
- *
- */
-
-/*** SHA-256/384/512 Machine Architecture Definitions *****************/
-/*
- * SHA2_BYTE_ORDER NOTE:
- *
- * Please make sure that your system defines SHA2_BYTE_ORDER.  If your
- * architecture is little-endian, make sure it also defines
- * SHA2_LITTLE_ENDIAN and that the two (SHA2_BYTE_ORDER and SHA2_LITTLE_ENDIAN) are
- * equivilent.
- *
- * If your system does not define the above, then you can do so by
- * hand like this:
- *
- *   #define SHA2_LITTLE_ENDIAN 1234
- *   #define SHA2_BIG_ENDIAN    4321
- *
- * And for little-endian machines, add:
- *
- *   #define SHA2_BYTE_ORDER SHA2_LITTLE_ENDIAN 
- *
- * Or for big-endian machines:
- *
- *   #define SHA2_BYTE_ORDER SHA2_BIG_ENDIAN
- *
- * The FreeBSD machine this was written on defines BYTE_ORDER
- * appropriately by including <sys/types.h> (which in turn includes
- * <machine/endian.h> where the appropriate definitions are actually
- * made).
- */
-#if !defined(SHA2_BYTE_ORDER) || (SHA2_BYTE_ORDER != SHA2_LITTLE_ENDIAN && SHA2_BYTE_ORDER != SHA2_BIG_ENDIAN)
-#error Define SHA2_BYTE_ORDER to be equal to either SHA2_LITTLE_ENDIAN or SHA2_BIG_ENDIAN
-#endif
-
-#if 0 /*def SHA2_USE_INTTYPES_H*/
-
-typedef uint8_t  sha2_byte;    /* Exactly 1 byte */
-typedef uint32_t sha2_word32;  /* Exactly 4 bytes */
-typedef uint64_t sha2_word64;  /* Exactly 8 bytes */
-
-#else /* SHA2_USE_INTTYPES_H */
-
-typedef u_int8_t  sha2_byte;   /* Exactly 1 byte */
-typedef u_int32_t sha2_word32; /* Exactly 4 bytes */
-typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
-
-#endif /* SHA2_USE_INTTYPES_H */
-
-/*** SHA-256/384/512 Various Length Definitions ***********************/
-/* NOTE: Most of these are in sha2.h */
-#define SHA256_SHORT_BLOCK_LENGTH      (SHA256_BLOCK_LENGTH - 8)
-#define SHA384_SHORT_BLOCK_LENGTH      (SHA384_BLOCK_LENGTH - 16)
-#define SHA512_SHORT_BLOCK_LENGTH      (SHA512_BLOCK_LENGTH - 16)
-
-/*** ENDIAN REVERSAL MACROS *******************************************/
-#if SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN
-#define REVERSE32(w,x) { \
-       sha2_word32 tmp = (w); \
-       tmp = (tmp >> 16) | (tmp << 16); \
-       (x) = (sha2_word32)(((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8)); \
-}
-#define REVERSE64(w,x) { \
-       sha2_word64 tmp = (w); \
-       tmp = (tmp >> 32) | (tmp << 32); \
-       tmp = (sha2_word64)(((tmp & 0xff00ff00ff00ff00ULL) >> 8) | \
-             ((tmp & 0x00ff00ff00ff00ffULL) << 8)); \
-       (x) = (sha2_word64)(((tmp & 0xffff0000ffff0000ULL) >> 16) | \
-             ((tmp & 0x0000ffff0000ffffULL) << 16)); \
-}
-#if MINIX_64BIT
-#undef REVERSE64
-#define REVERSE64(w,x) { \
-       sha2_word64 tmp64 = (w); \
-       u32_t hi, lo; \
-       REVERSE32(ex64hi(tmp64), lo); \
-       REVERSE32(ex64lo(tmp64), hi); \
-       (x) = make64(lo, hi); \
-}
-#endif /* MINIX_64BIT */
-#endif /* SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN */
-
-/*
- * Macro for incrementally adding the unsigned 64-bit integer n to the
- * unsigned 128-bit integer (represented using a two-element array of
- * 64-bit words):
- */
-#define ADDINC128(w,n) { \
-       (w)[0] += (sha2_word64)(n); \
-       if ((w)[0] < (n)) { \
-               (w)[1]++; \
-       } \
-}
-#if MINIX_64BIT
-#undef ADDINC128
-#define ADDINC128(w,n) { \
-       (w)[0] = add64u((w)[0], (n)); \
-       if (cmp64u((w)[0], (n)) < 0) { \
-               (w)[1] = add64u((w)[1], 1); \
-       } \
-}
-#endif /* MINIX_64BIT */
-
-/*** THE SIX LOGICAL FUNCTIONS ****************************************/
-/*
- * Bit shifting and rotation (used by the six SHA-XYZ logical functions:
- *
- *   NOTE:  The naming of R and S appears backwards here (R is a SHIFT and
- *   S is a ROTATION) because the SHA-256/384/512 description document
- *   (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this
- *   same "backwards" definition.
- */
-/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */
-#define R(b,x)                 ((x) >> (b))
-/* 32-bit Rotate-right (used in SHA-256): */
-#define S32(b,x)       (((x) >> (b)) | ((x) << (32 - (b))))
-/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */
-#define S64(b,x)       (((x) >> (b)) | ((x) << (64 - (b))))
-#if MINIX_64BIT
-#undef S64
-#define S64(b,x)       (rrotate64((x), (b)))
-#define R64(b, x)   (rshift64(x, b))
-#endif /* MINIX_64BIT */
-
-/* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */
-#define Ch(x,y,z)      (((x) & (y)) ^ ((~(x)) & (z)))
-#define Maj(x,y,z)     (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
-#if MINIX_64BIT
-#define Ch64(x,y,z)    (xor64(and64((x), (y)), and64(not64((x)), (z))))
-#define Maj64(x,y,z) (xor64(xor64(and64((x), (y)), and64((x), (z))), and64((y), (z))))
-#endif /* MINIX_64BIT */
-
-/* Four of six logical functions used in SHA-256: */
-#define Sigma0_256(x)  (S32(2,  (x)) ^ S32(13, (x)) ^ S32(22, (x)))
-#define Sigma1_256(x)  (S32(6,  (x)) ^ S32(11, (x)) ^ S32(25, (x)))
-#define sigma0_256(x)  (S32(7,  (x)) ^ S32(18, (x)) ^ R(3 ,   (x)))
-#define sigma1_256(x)  (S32(17, (x)) ^ S32(19, (x)) ^ R(10,   (x)))
-
-/* Four of six logical functions used in SHA-384 and SHA-512: */
-#define Sigma0_512(x)  (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x)))
-#define Sigma1_512(x)  (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x)))
-#define sigma0_512(x)  (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7,   (x)))
-#define sigma1_512(x)  (S64(19, (x)) ^ S64(61, (x)) ^ R( 6,   (x)))
-#if MINIX_64BIT
-#undef Sigma0_512
-#undef Sigma1_512
-#undef sigma0_512
-#undef sigma1_512
-#define Sigma0_512(x)  (xor64(xor64(S64(28, (x)), S64(34, (x))), S64(39, (x))))
-#define Sigma1_512(x)  (xor64(xor64(S64(14, (x)), S64(18, (x))), S64(41, (x))))
-#define sigma0_512(x)  (xor64(xor64(S64( 1, (x)), S64( 8, (x))), R64( 7, (x))))
-#define sigma1_512(x)  (xor64(xor64(S64(19, (x)), S64(61, (x))), R64( 6, (x))))
-#endif /* MINIX_64BIT */
-
-/*** INTERNAL FUNCTION PROTOTYPES *************************************/
-/* NOTE: These should not be accessed directly from outside this
- * library -- they are intended for private internal visibility/use
- * only.
- */
-static void SHA512_Last(SHA512_CTX*);
-void SHA256_Transform(SHA256_CTX*, const sha2_word32*);
-void SHA384_Transform(SHA384_CTX*, const sha2_word64*);
-void SHA512_Transform(SHA512_CTX*, const sha2_word64*);
-
-
-/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/
-/* Hash constant words K for SHA-256: */
-static const sha2_word32 K256[64] = {
-       0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
-       0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
-       0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
-       0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL,
-       0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL,
-       0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL,
-       0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL,
-       0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL,
-       0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL,
-       0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL,
-       0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL,
-       0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL,
-       0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL,
-       0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL,
-       0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL,
-       0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL
-};
-
-/* Initial hash value H for SHA-256: */
-static const sha2_word32 sha256_initial_hash_value[8] = {
-       0x6a09e667UL,
-       0xbb67ae85UL,
-       0x3c6ef372UL,
-       0xa54ff53aUL,
-       0x510e527fUL,
-       0x9b05688cUL,
-       0x1f83d9abUL,
-       0x5be0cd19UL
-};
-
-/* Hash constant words K for SHA-384 and SHA-512: */
-#if MINIX_64BIT
-const static sha2_word64 K512[80] = {
-       {0xd728ae22UL, 0x428a2f98UL}, {0x23ef65cdUL, 0x71374491UL},
-       {0xec4d3b2fUL, 0xb5c0fbcfUL}, {0x8189dbbcUL, 0xe9b5dba5UL},
-       {0xf348b538UL, 0x3956c25bUL}, {0xb605d019UL, 0x59f111f1UL},
-       {0xaf194f9bUL, 0x923f82a4UL}, {0xda6d8118UL, 0xab1c5ed5UL},
-       {0xa3030242UL, 0xd807aa98UL}, {0x45706fbeUL, 0x12835b01UL},
-       {0x4ee4b28cUL, 0x243185beUL}, {0xd5ffb4e2UL, 0x550c7dc3UL},
-       {0xf27b896fUL, 0x72be5d74UL}, {0x3b1696b1UL, 0x80deb1feUL},
-       {0x25c71235UL, 0x9bdc06a7UL}, {0xcf692694UL, 0xc19bf174UL},
-       {0x9ef14ad2UL, 0xe49b69c1UL}, {0x384f25e3UL, 0xefbe4786UL},
-       {0x8b8cd5b5UL, 0x0fc19dc6UL}, {0x77ac9c65UL, 0x240ca1ccUL},
-       {0x592b0275UL, 0x2de92c6fUL}, {0x6ea6e483UL, 0x4a7484aaUL},
-       {0xbd41fbd4UL, 0x5cb0a9dcUL}, {0x831153b5UL, 0x76f988daUL},
-       {0xee66dfabUL, 0x983e5152UL}, {0x2db43210UL, 0xa831c66dUL},
-       {0x98fb213fUL, 0xb00327c8UL}, {0xbeef0ee4UL, 0xbf597fc7UL},
-       {0x3da88fc2UL, 0xc6e00bf3UL}, {0x930aa725UL, 0xd5a79147UL},
-       {0xe003826fUL, 0x06ca6351UL}, {0x0a0e6e70UL, 0x14292967UL},
-       {0x46d22ffcUL, 0x27b70a85UL}, {0x5c26c926UL, 0x2e1b2138UL},
-       {0x5ac42aedUL, 0x4d2c6dfcUL}, {0x9d95b3dfUL, 0x53380d13UL},
-       {0x8baf63deUL, 0x650a7354UL}, {0x3c77b2a8UL, 0x766a0abbUL},
-       {0x47edaee6UL, 0x81c2c92eUL}, {0x1482353bUL, 0x92722c85UL},
-       {0x4cf10364UL, 0xa2bfe8a1UL}, {0xbc423001UL, 0xa81a664bUL},
-       {0xd0f89791UL, 0xc24b8b70UL}, {0x0654be30UL, 0xc76c51a3UL},
-       {0xd6ef5218UL, 0xd192e819UL}, {0x5565a910UL, 0xd6990624UL},
-       {0x5771202aUL, 0xf40e3585UL}, {0x32bbd1b8UL, 0x106aa070UL},
-       {0xb8d2d0c8UL, 0x19a4c116UL}, {0x5141ab53UL, 0x1e376c08UL},
-       {0xdf8eeb99UL, 0x2748774cUL}, {0xe19b48a8UL, 0x34b0bcb5UL},
-       {0xc5c95a63UL, 0x391c0cb3UL}, {0xe3418acbUL, 0x4ed8aa4aUL},
-       {0x7763e373UL, 0x5b9cca4fUL}, {0xd6b2b8a3UL, 0x682e6ff3UL},
-       {0x5defb2fcUL, 0x748f82eeUL}, {0x43172f60UL, 0x78a5636fUL},
-       {0xa1f0ab72UL, 0x84c87814UL}, {0x1a6439ecUL, 0x8cc70208UL},
-       {0x23631e28UL, 0x90befffaUL}, {0xde82bde9UL, 0xa4506cebUL},
-       {0xb2c67915UL, 0xbef9a3f7UL}, {0xe372532bUL, 0xc67178f2UL},
-       {0xea26619cUL, 0xca273eceUL}, {0x21c0c207UL, 0xd186b8c7UL},
-       {0xcde0eb1eUL, 0xeada7dd6UL}, {0xee6ed178UL, 0xf57d4f7fUL},
-       {0x72176fbaUL, 0x06f067aaUL}, {0xa2c898a6UL, 0x0a637dc5UL},
-       {0xbef90daeUL, 0x113f9804UL}, {0x131c471bUL, 0x1b710b35UL},
-       {0x23047d84UL, 0x28db77f5UL}, {0x40c72493UL, 0x32caab7bUL},
-       {0x15c9bebcUL, 0x3c9ebe0aUL}, {0x9c100d4cUL, 0x431d67c4UL},
-       {0xcb3e42b6UL, 0x4cc5d4beUL}, {0xfc657e2aUL, 0x597f299cUL},
-       {0x3ad6faecUL, 0x5fcb6fabUL}, {0x4a475817UL, 0x6c44198cUL}
-};
-#else /* !MINIX_64BIT */
-static const sha2_word64 K512[80] = {
-       0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL,
-       0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL,
-       0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL,
-       0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL,
-       0xd807aa98a3030242ULL, 0x12835b0145706fbeULL,
-       0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL,
-       0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL,
-       0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL,
-       0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL,
-       0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL,
-       0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL,
-       0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL,
-       0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL,
-       0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL,
-       0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL,
-       0x06ca6351e003826fULL, 0x142929670a0e6e70ULL,
-       0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL,
-       0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL,
-       0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL,
-       0x81c2c92e47edaee6ULL, 0x92722c851482353bULL,
-       0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL,
-       0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL,
-       0xd192e819d6ef5218ULL, 0xd69906245565a910ULL,
-       0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL,
-       0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL,
-       0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL,
-       0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL,
-       0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL,
-       0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL,
-       0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL,
-       0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL,
-       0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL,
-       0xca273eceea26619cULL, 0xd186b8c721c0c207ULL,
-       0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL,
-       0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL,
-       0x113f9804bef90daeULL, 0x1b710b35131c471bULL,
-       0x28db77f523047d84ULL, 0x32caab7b40c72493ULL,
-       0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL,
-       0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL,
-       0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL
-};
-#endif /* MINIX_64BIT */
-
-/* Initial hash value H for SHA-384 */
-#if MINIX_64BIT
-const static sha2_word64 sha384_initial_hash_value[8] = {
-       {0xc1059ed8UL, 0xcbbb9d5dUL},
-       {0x367cd507UL, 0x629a292aUL},
-       {0x3070dd17UL, 0x9159015aUL},
-       {0xf70e5939UL, 0x152fecd8UL},
-       {0xffc00b31UL, 0x67332667UL},
-       {0x68581511UL, 0x8eb44a87UL},
-       {0x64f98fa7UL, 0xdb0c2e0dUL},
-       {0xbefa4fa4UL, 0x47b5481dUL}
-};
-#else /* !MINIX_64BIT */
-static const sha2_word64 sha384_initial_hash_value[8] = {
-       0xcbbb9d5dc1059ed8ULL,
-       0x629a292a367cd507ULL,
-       0x9159015a3070dd17ULL,
-       0x152fecd8f70e5939ULL,
-       0x67332667ffc00b31ULL,
-       0x8eb44a8768581511ULL,
-       0xdb0c2e0d64f98fa7ULL,
-       0x47b5481dbefa4fa4ULL
-};
-#endif /* MINIX_64BIT */
-
-/* Initial hash value H for SHA-512 */
-#if MINIX_64BIT
-const static sha2_word64 sha512_initial_hash_value[8] = {
-       {0xf3bcc908UL, 0x6a09e667UL},
-       {0x84caa73bUL, 0xbb67ae85UL},
-       {0xfe94f82bUL, 0x3c6ef372UL},
-       {0x5f1d36f1UL, 0xa54ff53aUL},
-       {0xade682d1UL, 0x510e527fUL},
-       {0x2b3e6c1fUL, 0x9b05688cUL},
-       {0xfb41bd6bUL, 0x1f83d9abUL},
-       {0x137e2179UL, 0x5be0cd19UL}
-};
-#else /* !MINIX_64BIT */
-static const sha2_word64 sha512_initial_hash_value[8] = {
-       0x6a09e667f3bcc908ULL,
-       0xbb67ae8584caa73bULL,
-       0x3c6ef372fe94f82bULL,
-       0xa54ff53a5f1d36f1ULL,
-       0x510e527fade682d1ULL,
-       0x9b05688c2b3e6c1fULL,
-       0x1f83d9abfb41bd6bULL,
-       0x5be0cd19137e2179ULL
-};
-#endif /* MINIX_64BIT */
-
-/*** SHA-256: *********************************************************/
-void SHA256_Init(SHA256_CTX* context) {
-       if (context == (SHA256_CTX*)0) {
-               return;
-       }
-       memcpy(context->state, sha256_initial_hash_value, (size_t)(SHA256_DIGEST_LENGTH));
-       memset(context->buffer, 0, (size_t)(SHA256_BLOCK_LENGTH));
-#if MINIX_64BIT
-       context->bitcount = cvu64(0);
-#else /* !MINIX_64BIT */
-       context->bitcount = 0;
-#endif /* MINIX_64BIT */
-}
-
-#ifdef SHA2_UNROLL_TRANSFORM
-
-/* Unrolled SHA-256 round macros: */
-
-#if SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN
-
-#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h)      \
-       REVERSE32(*data++, W256[j]); \
-       T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
-             K256[j] + W256[j]; \
-       (d) += T1; \
-       (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
-       j++
-
-
-#else /* SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN */
-
-#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h)      \
-       T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \
-            K256[j] + (W256[j] = *data++); \
-       (d) += T1; \
-       (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
-       j++
-
-#endif /* SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN */
-
-#define ROUND256(a,b,c,d,e,f,g,h)      \
-       s0 = W256[(j+1)&0x0f]; \
-       s0 = sigma0_256(s0); \
-       s1 = W256[(j+14)&0x0f]; \
-       s1 = sigma1_256(s1); \
-       T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \
-            (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \
-       (d) += T1; \
-       (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \
-       j++
-
-void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
-       sha2_word32     a, b, c, d, e, f, g, h, s0, s1;
-       sha2_word32     T1, *W256;
-       int             j;
-
-       W256 = (sha2_word32*)context->buffer;
-
-       /* Initialize registers with the prev. intermediate value */
-       a = context->state[0];
-       b = context->state[1];
-       c = context->state[2];
-       d = context->state[3];
-       e = context->state[4];
-       f = context->state[5];
-       g = context->state[6];
-       h = context->state[7];
-
-       j = 0;
-       do {
-               /* Rounds 0 to 15 (unrolled): */
-               ROUND256_0_TO_15(a,b,c,d,e,f,g,h);
-               ROUND256_0_TO_15(h,a,b,c,d,e,f,g);
-               ROUND256_0_TO_15(g,h,a,b,c,d,e,f);
-               ROUND256_0_TO_15(f,g,h,a,b,c,d,e);
-               ROUND256_0_TO_15(e,f,g,h,a,b,c,d);
-               ROUND256_0_TO_15(d,e,f,g,h,a,b,c);
-               ROUND256_0_TO_15(c,d,e,f,g,h,a,b);
-               ROUND256_0_TO_15(b,c,d,e,f,g,h,a);
-       } while (j < 16);
-
-       /* Now for the remaining rounds to 64: */
-       do {
-               ROUND256(a,b,c,d,e,f,g,h);
-               ROUND256(h,a,b,c,d,e,f,g);
-               ROUND256(g,h,a,b,c,d,e,f);
-               ROUND256(f,g,h,a,b,c,d,e);
-               ROUND256(e,f,g,h,a,b,c,d);
-               ROUND256(d,e,f,g,h,a,b,c);
-               ROUND256(c,d,e,f,g,h,a,b);
-               ROUND256(b,c,d,e,f,g,h,a);
-       } while (j < 64);
-
-       /* Compute the current intermediate hash value */
-       context->state[0] += a;
-       context->state[1] += b;
-       context->state[2] += c;
-       context->state[3] += d;
-       context->state[4] += e;
-       context->state[5] += f;
-       context->state[6] += g;
-       context->state[7] += h;
-
-       /* Clean up */
-       a = b = c = d = e = f = g = h = T1 = 0;
-}
-
-#else /* SHA2_UNROLL_TRANSFORM */
-
-void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
-       sha2_word32     a, b, c, d, e, f, g, h, s0, s1;
-       sha2_word32     T1, T2, *W256;
-       int             j;
-
-       W256 = (sha2_word32*)(void *)context->buffer;
-
-       /* Initialize registers with the prev. intermediate value */
-       a = context->state[0];
-       b = context->state[1];
-       c = context->state[2];
-       d = context->state[3];
-       e = context->state[4];
-       f = context->state[5];
-       g = context->state[6];
-       h = context->state[7];
-
-       j = 0;
-       do {
-#if SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN
-               /* Copy data while converting to host byte order */
-               REVERSE32(*data++,W256[j]);
-               /* Apply the SHA-256 compression function to update a..h */
-               T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j];
-#else /* SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN */
-               /* Apply the SHA-256 compression function to update a..h with copy */
-               T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++);
-#endif /* SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN */
-               T2 = Sigma0_256(a) + Maj(a, b, c);
-               h = g;
-               g = f;
-               f = e;
-               e = d + T1;
-               d = c;
-               c = b;
-               b = a;
-               a = T1 + T2;
-
-               j++;
-       } while (j < 16);
-
-       do {
-               /* Part of the message block expansion: */
-               s0 = W256[(j+1)&0x0f];
-               s0 = sigma0_256(s0);
-               s1 = W256[(j+14)&0x0f]; 
-               s1 = sigma1_256(s1);
-
-               /* Apply the SHA-256 compression function to update a..h */
-               T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + 
-                    (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0);
-               T2 = Sigma0_256(a) + Maj(a, b, c);
-               h = g;
-               g = f;
-               f = e;
-               e = d + T1;
-               d = c;
-               c = b;
-               b = a;
-               a = T1 + T2;
-
-               j++;
-       } while (j < 64);
-
-       /* Compute the current intermediate hash value */
-       context->state[0] += a;
-       context->state[1] += b;
-       context->state[2] += c;
-       context->state[3] += d;
-       context->state[4] += e;
-       context->state[5] += f;
-       context->state[6] += g;
-       context->state[7] += h;
-
-       /* Clean up */
-       a = b = c = d = e = f = g = h = T1 = T2 = 0;
-}
-
-#endif /* SHA2_UNROLL_TRANSFORM */
-
-void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
-       unsigned int    freespace, usedspace;
-
-       if (len == 0) {
-               /* Calling with no data is valid - we do nothing */
-               return;
-       }
-
-       /* Sanity check: */
-       assert(context != (SHA256_CTX*)0 && data != (sha2_byte*)0);
-
-#if MINIX_64BIT
-       usedspace= rem64u(context->bitcount, SHA256_BLOCK_LENGTH*8)/8;
-#else /* !MINIX_64BIT */
-       usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
-#endif /* MINIX_64BIT */
-       if (usedspace > 0) {
-               /* Calculate how much free space is available in the buffer */
-               freespace = SHA256_BLOCK_LENGTH - usedspace;
-
-               if (len >= freespace) {
-                       /* Fill the buffer completely and process it */
-                       memcpy(&context->buffer[usedspace], data, (size_t)(freespace));
-#if MINIX_64BIT
-                       context->bitcount= add64u(context->bitcount,
-                               freespace << 3);
-#else /* !MINIX_64BIT */
-                       context->bitcount += freespace << 3;
-#endif /* MINIX_64BIT */
-                       len -= freespace;
-                       data += freespace;
-                       SHA256_Transform(context, (sha2_word32*)(void *)context->buffer);
-               } else {
-                       /* The buffer is not yet full */
-                       memcpy(&context->buffer[usedspace], data, len);
-#if MINIX_64BIT
-                       context->bitcount= add64u(context->bitcount, len << 3);
-#else /* !MINIX_64BIT */
-                       context->bitcount += len << 3;
-#endif /* MINIX_64BIT */
-                       /* Clean up: */
-                       usedspace = freespace = 0;
-                       return;
-               }
-       }
-       /*
-        * Process as many complete blocks as possible.
-        *
-        * Check alignment of the data pointer. If it is 32bit aligned,
-        * SHA256_Transform can be called directly on the data stream,
-        * otherwise enforce the alignment by copy into the buffer.
-        */
-       if ((uintptr_t)data % 4 == 0) {
-               while (len >= SHA256_BLOCK_LENGTH) {
-                       SHA256_Transform(context,
-                           (const sha2_word32 *)(const void *)data);
-#if MINIX_64BIT
-                       context->bitcount= add64u(context->bitcount,
-                               SHA256_BLOCK_LENGTH << 3);
-#else /* !MINIX_64BIT */
-                       context->bitcount += SHA256_BLOCK_LENGTH << 3;
-#endif /* !MINIX_64BIT */
-                       len -= SHA256_BLOCK_LENGTH;
-                       data += SHA256_BLOCK_LENGTH;
-               }
-       } else {
-               while (len >= SHA256_BLOCK_LENGTH) {
-                       memcpy(context->buffer, data, SHA256_BLOCK_LENGTH);
-                       SHA256_Transform(context,
-                           (const sha2_word32 *)(const void *)context->buffer);
-#if MINIX_64BIT
-                       context->bitcount= add64u(context->bitcount,
-                               SHA256_BLOCK_LENGTH << 3);
-#else /* !MINIX_64BIT */
-                       context->bitcount += SHA256_BLOCK_LENGTH << 3;
-#endif /* MINIX_64BIT */
-                       len -= SHA256_BLOCK_LENGTH;
-                       data += SHA256_BLOCK_LENGTH;
-               }
-       }
-       if (len > 0) {
-               /* There's left-overs, so save 'em */
-               memcpy(context->buffer, data, len);
-#if MINIX_64BIT
-               context->bitcount= add64u(context->bitcount, len << 3);
-#else /* !MINIX_64BIT */
-               context->bitcount += len << 3;
-#endif /* MINIX_64BIT */
-       }
-       /* Clean up: */
-       usedspace = freespace = 0;
-}
-
-void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
-       sha2_word32     *d = (void *)digest;
-       unsigned int    usedspace;
-
-       /* Sanity check: */
-       assert(context != (SHA256_CTX*)0);
-
-       /* If no digest buffer is passed, we don't bother doing this: */
-       if (digest != (sha2_byte*)0) {
-#if MINIX_64BIT
-               usedspace= rem64u(context->bitcount, SHA256_BLOCK_LENGTH*8)/8;
-#else /* !MINIX_64BIT */
-               usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
-#endif /* MINIX_64BIT */
-
-#if SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN
-               /* Convert FROM host byte order */
-               REVERSE64(context->bitcount,context->bitcount);
-#endif
-               if (usedspace > 0) {
-                       /* Begin padding with a 1 bit: */
-                       context->buffer[usedspace++] = 0x80;
-
-                       if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) {
-                               /* Set-up for the last transform: */
-                               memset(&context->buffer[usedspace], 0, (size_t)(SHA256_SHORT_BLOCK_LENGTH - usedspace));
-                       } else {
-                               if (usedspace < SHA256_BLOCK_LENGTH) {
-                                       memset(&context->buffer[usedspace], 0, (size_t)(SHA256_BLOCK_LENGTH - usedspace));
-                               }
-                               /* Do second-to-last transform: */
-                               SHA256_Transform(context, (sha2_word32*)(void *)context->buffer);
-
-                               /* And set-up for the last transform: */
-                               memset(context->buffer, 0, (size_t)(SHA256_SHORT_BLOCK_LENGTH));
-                       }
-               } else {
-                       /* Set-up for the last transform: */
-                       memset(context->buffer, 0, (size_t)(SHA256_SHORT_BLOCK_LENGTH));
-
-                       /* Begin padding with a 1 bit: */
-                       *context->buffer = 0x80;
-               }
-               /* Set the bit count: */
-               *(sha2_word64*)(void *)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
-
-               /* Final transform: */
-               SHA256_Transform(context, (sha2_word32*)(void *)context->buffer);
-
-#if SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN
-               {
-                       /* Convert TO host byte order */
-                       int     j;
-                       for (j = 0; j < 8; j++) {
-                               REVERSE32(context->state[j],context->state[j]);
-                               *d++ = context->state[j];
-                       }
-               }
-#else
-               memcpy(d, context->state, SHA256_DIGEST_LENGTH);
-#endif
-       }
-
-       /* Clean up state data: */
-       memset(context, 0, sizeof(*context));
-       usedspace = 0;
-}
-
-/*** SHA-512: *********************************************************/
-void SHA512_Init(SHA512_CTX* context) {
-       if (context == (SHA512_CTX*)0) {
-               return;
-       }
-       memcpy(context->state, sha512_initial_hash_value, (size_t)(SHA512_DIGEST_LENGTH));
-       memset(context->buffer, 0, (size_t)(SHA512_BLOCK_LENGTH));
-#if MINIX_64BIT
-       make_zero64(context->bitcount[0]);
-       make_zero64(context->bitcount[1]);
-#else /* !MINIX_64BIT */
-       context->bitcount[0] = context->bitcount[1] =  0;
-#endif /* MINIX_64BIT */
-}
-
-#ifdef SHA2_UNROLL_TRANSFORM
-
-/* Unrolled SHA-512 round macros: */
-#if SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN
-
-#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h)      \
-       REVERSE64(*data++, W512[j]); \
-       T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
-             K512[j] + W512[j]; \
-       (d) += T1, \
-       (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \
-       j++
-
-
-#else /* SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN */
-
-#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h)      \
-       T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \
-             K512[j] + (W512[j] = *data++); \
-       (d) += T1; \
-       (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
-       j++
-
-#endif /* SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN */
-
-#define ROUND512(a,b,c,d,e,f,g,h)      \
-       s0 = W512[(j+1)&0x0f]; \
-       s0 = sigma0_512(s0); \
-       s1 = W512[(j+14)&0x0f]; \
-       s1 = sigma1_512(s1); \
-       T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \
-             (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \
-       (d) += T1; \
-       (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \
-       j++
-
-void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
-       sha2_word64     a, b, c, d, e, f, g, h, s0, s1;
-       sha2_word64     T1, *W512 = (sha2_word64*)context->buffer;
-       int             j;
-
-       /* Initialize registers with the prev. intermediate value */
-       a = context->state[0];
-       b = context->state[1];
-       c = context->state[2];
-       d = context->state[3];
-       e = context->state[4];
-       f = context->state[5];
-       g = context->state[6];
-       h = context->state[7];
-
-       j = 0;
-       do {
-               ROUND512_0_TO_15(a,b,c,d,e,f,g,h);
-               ROUND512_0_TO_15(h,a,b,c,d,e,f,g);
-               ROUND512_0_TO_15(g,h,a,b,c,d,e,f);
-               ROUND512_0_TO_15(f,g,h,a,b,c,d,e);
-               ROUND512_0_TO_15(e,f,g,h,a,b,c,d);
-               ROUND512_0_TO_15(d,e,f,g,h,a,b,c);
-               ROUND512_0_TO_15(c,d,e,f,g,h,a,b);
-               ROUND512_0_TO_15(b,c,d,e,f,g,h,a);
-       } while (j < 16);
-
-       /* Now for the remaining rounds up to 79: */
-       do {
-               ROUND512(a,b,c,d,e,f,g,h);
-               ROUND512(h,a,b,c,d,e,f,g);
-               ROUND512(g,h,a,b,c,d,e,f);
-               ROUND512(f,g,h,a,b,c,d,e);
-               ROUND512(e,f,g,h,a,b,c,d);
-               ROUND512(d,e,f,g,h,a,b,c);
-               ROUND512(c,d,e,f,g,h,a,b);
-               ROUND512(b,c,d,e,f,g,h,a);
-       } while (j < 80);
-
-       /* Compute the current intermediate hash value */
-       context->state[0] += a;
-       context->state[1] += b;
-       context->state[2] += c;
-       context->state[3] += d;
-       context->state[4] += e;
-       context->state[5] += f;
-       context->state[6] += g;
-       context->state[7] += h;
-
-       /* Clean up */
-       a = b = c = d = e = f = g = h = T1 = 0;
-}
-
-#else /* SHA2_UNROLL_TRANSFORM */
-
-void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) {
-       sha2_word64     a, b, c, d, e, f, g, h, s0, s1;
-       sha2_word64     T1, T2, *W512 = (void *)context->buffer;
-       int             j;
-
-       /* Initialize registers with the prev. intermediate value */
-       a = context->state[0];
-       b = context->state[1];
-       c = context->state[2];
-       d = context->state[3];
-       e = context->state[4];
-       f = context->state[5];
-       g = context->state[6];
-       h = context->state[7];
-
-       j = 0;
-       do {
-#if SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN
-               /* Convert TO host byte order */
-               REVERSE64(*data++, W512[j]);
-#if MINIX_64BIT
-               /* Apply the SHA-512 compression function to update a..h with copy */
-               T1 = add64(add64(add64(add64(h, Sigma1_512(e)), Ch64(e, f, g)), K512[j]), W512[j]);
-#else /* !MINIX_64BIT */
-               T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j];
-#endif /* MINIX_64BIT */
-#else /* SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN */
-               /* Apply the SHA-512 compression function to update a..h with copy */
-               T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++);
-#endif /* SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN */
-#ifdef MINIX_64BIT
-               T2 = add64(Sigma0_512(a), Maj64(a, b, c));
-#else /* !MINIX_64BIT */
-               T2 = Sigma0_512(a) + Maj(a, b, c);
-#endif /* MINIX_64BIT */
-               h = g;
-               g = f;
-               f = e;
-#if MINIX_64BIT
-               e = add64(d, T1);
-#else /* !MINIX_64BIT */
-               e = d + T1;
-#endif /* MINIX_64BIT */
-               d = c;
-               c = b;
-               b = a;
-#if MINIX_64BIT
-               a = add64(T1, T2);
-#else /* !MINIX_64BIT */
-               a = T1 + T2;
-#endif /* MINIX_64BIT */
-
-               j++;
-       } while (j < 16);
-
-       do {
-               /* Part of the message block expansion: */
-               s0 = W512[(j+1)&0x0f];
-               s0 = sigma0_512(s0);
-               s1 = W512[(j+14)&0x0f];
-               s1 =  sigma1_512(s1);
-
-               /* Apply the SHA-512 compression function to update a..h */
-#ifdef MINIX_64BIT
-               W512[j&0x0f] = add64(add64(add64(W512[j&0x0f], s1), W512[(j+9)&0x0f]),  s0);
-               T1 = add64(add64(add64(add64(h, Sigma1_512(e)), Ch64(e, f, g)), K512[j]), W512[j&0x0f]);
-               T2 = add64(Sigma0_512(a), Maj64(a, b, c));
-#else /* !MINIX_64BIT */
-               T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] +
-                    (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0);
-               T2 = Sigma0_512(a) + Maj(a, b, c);
-#endif /* MINIX_64BIT */
-               h = g;
-               g = f;
-               f = e;
-#if MINIX_64BIT
-               e = add64(d, T1);
-#else /* !MINIX_64BIT */
-               e = d + T1;
-#endif /* MINIX_64BIT */
-               d = c;
-               c = b;
-               b = a;
-#if MINIX_64BIT
-               a = add64(T1, T2);
-#else /* !MINIX_64BIT */
-               a = T1 + T2;
-#endif /* MINIX_64BIT */
-
-               j++;
-       } while (j < 80);
-
-       /* Compute the current intermediate hash value */
-#ifdef MINIX_64BIT
-       context->state[0] = add64(context->state[0], a);
-       context->state[1] = add64(context->state[1], b);
-       context->state[2] = add64(context->state[2], c);
-       context->state[3] = add64(context->state[3], d);
-       context->state[4] = add64(context->state[4], e);
-       context->state[5] = add64(context->state[5], f);
-       context->state[6] = add64(context->state[6], g);
-       context->state[7] = add64(context->state[7], h);
-       /* Clean up */
-       a = b = c = d = e = f = g = h = T1 = T2 = cvu64(0);
-#else /* !MINIX_64BIT */
-       context->state[0] += a;
-       context->state[1] += b;
-       context->state[2] += c;
-       context->state[3] += d;
-       context->state[4] += e;
-       context->state[5] += f;
-       context->state[6] += g;
-       context->state[7] += h;
-       a = b = c = d = e = f = g = h = T1 = T2 = 0;
-#endif /* MINIX_64BIT */
-}
-
-#endif /* SHA2_UNROLL_TRANSFORM */
-
-void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) {
-       unsigned int    freespace, usedspace;
-
-       if (len == 0) {
-               /* Calling with no data is valid - we do nothing */
-               return;
-       }
-
-       /* Sanity check: */
-       assert(context != (SHA512_CTX*)0 && data != (sha2_byte*)0);
-
-#if MINIX_64BIT
-       usedspace = (unsigned int)rem64u(rshift64(context->bitcount[0], 3), SHA512_BLOCK_LENGTH);
-#else /* !MINIX_64BIT */
-       usedspace = (unsigned int)((context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH);
-#endif /* MINIX_64BIT */
-       if (usedspace > 0) {
-               /* Calculate how much free space is available in the buffer */
-               freespace = SHA512_BLOCK_LENGTH - usedspace;
-
-               if (len >= freespace) {
-                       /* Fill the buffer completely and process it */
-                       memcpy(&context->buffer[usedspace], data, (size_t)(freespace));
-                       ADDINC128(context->bitcount, freespace << 3);
-                       len -= freespace;
-                       data += freespace;
-                       SHA512_Transform(context, (sha2_word64*)(void *)context->buffer);
-               } else {
-                       /* The buffer is not yet full */
-                       memcpy(&context->buffer[usedspace], data, len);
-                       ADDINC128(context->bitcount, len << 3);
-                       /* Clean up: */
-                       usedspace = freespace = 0;
-                       return;
-               }
-       }
-       /*
-        * Process as many complete blocks as possible.
-        *
-        * Check alignment of the data pointer. If it is 64bit aligned,
-        * SHA512_Transform can be called directly on the data stream,
-        * otherwise enforce the alignment by copy into the buffer.
-        */
-       if ((uintptr_t)data % 8 == 0) {
-               while (len >= SHA512_BLOCK_LENGTH) {
-                       SHA512_Transform(context,
-                           (const sha2_word64 *)(const void *)data);
-                       ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
-                       len -= SHA512_BLOCK_LENGTH;
-                       data += SHA512_BLOCK_LENGTH;
-               }
-       } else {
-               while (len >= SHA512_BLOCK_LENGTH) {
-                       memcpy(context->buffer, data, SHA512_BLOCK_LENGTH);
-                       SHA512_Transform(context,
-                           (const sha2_word64 *)(void *)context->buffer);
-                       ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3);
-                       len -= SHA512_BLOCK_LENGTH;
-                       data += SHA512_BLOCK_LENGTH;
-               }
-       }
-       if (len > 0) {
-               /* There's left-overs, so save 'em */
-               memcpy(context->buffer, data, len);
-               ADDINC128(context->bitcount, len << 3);
-       }
-       /* Clean up: */
-       usedspace = freespace = 0;
-}
-
-static void SHA512_Last(SHA512_CTX* context) {
-       unsigned int    usedspace;
-
-       usedspace = rem64u(rshift64(context->bitcount[0], 3), SHA512_BLOCK_LENGTH);
-#if SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN
-       /* Convert FROM host byte order */
-       REVERSE64(context->bitcount[0],context->bitcount[0]);
-       REVERSE64(context->bitcount[1],context->bitcount[1]);
-#endif
-       if (usedspace > 0) {
-               /* Begin padding with a 1 bit: */
-               context->buffer[usedspace++] = 0x80;
-
-               if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) {
-                       /* Set-up for the last transform: */
-                       memset(&context->buffer[usedspace], 0, (size_t)(SHA512_SHORT_BLOCK_LENGTH - usedspace));
-               } else {
-                       if (usedspace < SHA512_BLOCK_LENGTH) {
-                               memset(&context->buffer[usedspace], 0, (size_t)(SHA512_BLOCK_LENGTH - usedspace));
-                       }
-                       /* Do second-to-last transform: */
-                       SHA512_Transform(context, (sha2_word64*)(void *)context->buffer);
-
-                       /* And set-up for the last transform: */
-                       memset(context->buffer, 0, (size_t)(SHA512_BLOCK_LENGTH - 2));
-               }
-       } else {
-               /* Prepare for final transform: */
-               memset(context->buffer, 0, (size_t)(SHA512_SHORT_BLOCK_LENGTH));
-
-               /* Begin padding with a 1 bit: */
-               *context->buffer = 0x80;
-       }
-       /* Store the length of input data (in bits): */
-       *(sha2_word64*)(void *)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1];
-       *(sha2_word64*)(void *)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0];
-
-       /* Final transform: */
-       SHA512_Transform(context, (sha2_word64*)(void *)context->buffer);
-}
-
-void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
-       sha2_word64     *d = (void *)digest;
-
-       /* Sanity check: */
-       assert(context != (SHA512_CTX*)0);
-
-       /* If no digest buffer is passed, we don't bother doing this: */
-       if (digest != (sha2_byte*)0) {
-               SHA512_Last(context);
-
-               /* Save the hash data for output: */
-#if SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN
-               {
-                       /* Convert TO host byte order */
-                       int     j;
-                       for (j = 0; j < 8; j++) {
-                               REVERSE64(context->state[j],context->state[j]);
-                               *d++ = context->state[j];
-                       }
-               }
-#else
-               memcpy(d, context->state, SHA512_DIGEST_LENGTH);
-#endif
-       }
-
-       /* Zero out state data */
-       memset(context, 0, sizeof(*context));
-}
-
-/*** SHA-384: *********************************************************/
-void SHA384_Init(SHA384_CTX* context) {
-       if (context == (SHA384_CTX*)0) {
-               return;
-       }
-       memcpy(context->state, sha384_initial_hash_value, (size_t)(SHA512_DIGEST_LENGTH));
-       memset(context->buffer, 0, (size_t)(SHA384_BLOCK_LENGTH));
-#if MINIX_64BIT
-       make_zero64(context->bitcount[0]);
-       make_zero64(context->bitcount[1]);
-#else /* !MINIX_64BIT */
-       context->bitcount[0] = context->bitcount[1] = 0;
-#endif /* MINIX_64BIT */
-}
-
-void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) {
-       SHA512_Update((SHA512_CTX*)context, data, len);
-}
-
-void SHA384_Transform(SHA512_CTX* context, const sha2_word64* data) {
-       SHA512_Transform((SHA512_CTX*)context, data);
-}
-
-void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
-       sha2_word64     *d = (void *)digest;
-
-       /* Sanity check: */
-       assert(context != (SHA384_CTX*)0);
-
-       /* If no digest buffer is passed, we don't bother doing this: */
-       if (digest != (sha2_byte*)0) {
-               SHA512_Last((SHA512_CTX*)context);
-
-               /* Save the hash data for output: */
-#if SHA2_BYTE_ORDER == SHA2_LITTLE_ENDIAN
-               {
-                       /* Convert TO host byte order */
-                       int     j;
-                       for (j = 0; j < 6; j++) {
-                               REVERSE64(context->state[j],context->state[j]);
-                               *d++ = context->state[j];
-                       }
-               }
-#else
-               memcpy(d, context->state, SHA384_DIGEST_LENGTH);
-#endif
-       }
-
-       /* Zero out state data */
-       memset(context, 0, sizeof(*context));
-}
diff --git a/lib/libminixutil/sha2hl.c b/lib/libminixutil/sha2hl.c
deleted file mode 100644 (file)
index 9a0c6db..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/* $NetBSD: sha2hl.c,v 1.7 2007/07/31 13:17:34 joerg Exp $      */
-
-/*
- * sha2hl.c
- * This code includes some functions taken from sha2.c, hence the
- * following licence reproduction.
- *
- * This code is not a verbatim copy, since some routines have been added,
- * and some bugs have been fixed.
- *
- * Version 1.0.0beta1
- *
- * Written by Aaron D. Gifford <me@aarongifford.com>
- *
- * Copyright 2000 Aaron D. Gifford.  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. Neither the name of the copyright holder nor the names of contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``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(S) OR CONTRIBUTOR(S) 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 <fcntl.h>
-#include <assert.h>
-#include <minix/sha2.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#ifndef _DIAGASSERT
-#define _DIAGASSERT(cond)      assert(cond)
-#endif
-
-#ifndef MEMSET_BZERO
-#define MEMSET_BZERO(p,l)      memset((p), 0, (l))
-#endif
-
-/*
- * Constant used by SHA256/384/512_End() functions for converting the
- * digest to a readable hexadecimal character string:
- */
-static const char sha2_hex_digits[] = "0123456789abcdef";
-
-char           *
-SHA256_File(char *filename, char *buf)
-{
-       unsigned char          buffer[SHA256_DIGEST_STRING_LENGTH];
-       SHA256_CTX      ctx;
-       int             fd, num, oerrno;
-
-       _DIAGASSERT(filename != NULL);
-       /* XXX: buf may be NULL ? */
-
-       SHA256_Init(&ctx);
-
-       if ((fd = open(filename, O_RDONLY)) < 0)
-               return (0);
-
-       while ((num = read(fd, buffer, sizeof(buffer))) > 0)
-               SHA256_Update(&ctx, buffer, (size_t) num);
-
-       oerrno = errno;
-       close(fd);
-       errno = oerrno;
-       return (num < 0 ? 0 : SHA256_End(&ctx, buf));
-}
-
-
-char           *
-SHA256_End(SHA256_CTX *ctx, char buffer[SHA256_DIGEST_STRING_LENGTH])
-{
-       unsigned char          digest[SHA256_DIGEST_LENGTH], *d = digest;
-       unsigned char          *ret;
-       int             i;
-
-       /* Sanity check: */
-       assert(ctx != NULL);
-
-       if ((ret = (unsigned char *)buffer) != NULL) {
-               SHA256_Final(digest, ctx);
-
-               for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
-                       *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
-                       *buffer++ = sha2_hex_digits[*d & 0x0f];
-                       d++;
-               }
-               *buffer = (char) 0;
-       } else {
-               (void) MEMSET_BZERO(ctx, sizeof(SHA256_CTX));
-       }
-       (void) MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH);
-       return (char *)ret;
-}
-
-char           *
-SHA256_Data(const uint8_t * data, size_t len, unsigned char digest[SHA256_DIGEST_STRING_LENGTH])
-{
-       SHA256_CTX      ctx;
-
-       SHA256_Init(&ctx);
-       SHA256_Update(&ctx, data, len);
-       return SHA256_End(&ctx, (char *)digest);
-}
-
-char           *
-SHA384_File(char *filename, char *buf)
-{
-       SHA384_CTX      ctx;
-       unsigned char          buffer[SHA384_DIGEST_STRING_LENGTH];
-       int             fd, num, oerrno;
-
-       _DIAGASSERT(filename != NULL);
-       /* XXX: buf may be NULL ? */
-
-       SHA384_Init(&ctx);
-
-       if ((fd = open(filename, O_RDONLY)) < 0)
-               return (0);
-
-       while ((num = read(fd, buffer, sizeof(buffer))) > 0)
-               SHA384_Update(&ctx, buffer, (size_t) num);
-
-       oerrno = errno;
-       close(fd);
-       errno = oerrno;
-       return (num < 0 ? 0 : SHA384_End(&ctx, buf));
-}
-
-char           *
-SHA384_End(SHA384_CTX * ctx, char buffer[SHA384_DIGEST_STRING_LENGTH])
-{
-       unsigned char          digest[SHA384_DIGEST_LENGTH], *d = digest;
-       unsigned char          *ret;
-       int             i;
-
-       /* Sanity check: */
-       assert(ctx != NULL);
-
-       if ((ret = (unsigned char *)buffer) != NULL) {
-               SHA384_Final(digest, ctx);
-
-               for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
-                       *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
-                       *buffer++ = sha2_hex_digits[*d & 0x0f];
-                       d++;
-               }
-               *buffer = (char) 0;
-       } else {
-               (void) MEMSET_BZERO(ctx, sizeof(SHA384_CTX));
-       }
-       (void) MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
-       return (char *)ret;
-}
-
-char           *
-SHA384_Data(const uint8_t* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH])
-{
-       SHA384_CTX      ctx;
-
-       SHA384_Init(&ctx);
-       SHA384_Update(&ctx, data, len);
-       return SHA384_End(&ctx, digest);
-}
-
-char           *
-SHA512_File(char *filename, char *buf)
-{
-       SHA512_CTX      ctx;
-       unsigned char          buffer[SHA512_DIGEST_STRING_LENGTH];
-       int             fd, num, oerrno;
-
-       _DIAGASSERT(filename != NULL);
-       /* XXX: buf may be NULL ? */
-
-       SHA512_Init(&ctx);
-
-       if ((fd = open(filename, O_RDONLY)) < 0)
-               return (0);
-
-       while ((num = read(fd, buffer, sizeof(buffer))) > 0)
-               SHA512_Update(&ctx, buffer, (size_t) num);
-
-       oerrno = errno;
-       close(fd);
-       errno = oerrno;
-       return (num < 0 ? 0 : SHA512_End(&ctx, buf));
-}
-
-char           *
-SHA512_End(SHA512_CTX * ctx, char buffer[SHA512_DIGEST_STRING_LENGTH])
-{
-       unsigned char          digest[SHA512_DIGEST_LENGTH], *d = digest;
-       unsigned char          *ret;
-       int             i;
-
-       /* Sanity check: */
-       assert(ctx != NULL);
-
-       if ((ret = (unsigned char *)buffer) != NULL) {
-               SHA512_Final(digest, ctx);
-
-               for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
-                       *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4];
-                       *buffer++ = sha2_hex_digits[*d & 0x0f];
-                       d++;
-               }
-               *buffer = (char) 0;
-       } else {
-               (void) MEMSET_BZERO(ctx, sizeof(SHA512_CTX));
-       }
-       (void) MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
-       return (char *)ret;
-}
-
-char           *
-SHA512_Data(const uint8_t * data, size_t len, char *digest)
-{
-       SHA512_CTX      ctx;
-
-       SHA512_Init(&ctx);
-       SHA512_Update(&ctx, data, len);
-       return SHA512_End(&ctx, digest);
-}
-
similarity index 100%
rename from lib/libc/other/fslib.c
rename to lib/libminlib/fslib.c
similarity index 100%
rename from lib/libc/other/gcov.c
rename to lib/libminlib/gcov.c
similarity index 100%
rename from lib/libc/other/itoa.c
rename to lib/libminlib/itoa.c
similarity index 100%
rename from include/tools.h
rename to lib/libminlib/tools.h
index 0fd3d3f112272f76f0b3efe83b2c6ec284733b72..d9c26f48f57c409e0bd1cc3844539e2b6af6368c 100644 (file)
@@ -10,7 +10,7 @@ PROPLIBDIR=${NETBSDSRCDIR}/common/lib/libprop
 .include "${PROPLIBDIR}/Makefile.inc"
 
 CPPFLAGS+=-D_LIBPROP
-CPPFLAGS+= -I${NETBSDSRCDIR}/lib/nbsd_libc/include # -D_REENTRANT
+CPPFLAGS+= -I${NETBSDSRCDIR}/lib/libc/include # -D_REENTRANT
 
 LINTFLAGS+=-w
 LIB=   prop
index cb52a61582b2fc3c9ef0380c1391038d6551c459..1efebcf70cf6b2e71169d165a920590bcd9aad09 100644 (file)
@@ -54,8 +54,7 @@ MAN=  efun.3 getbootfile.3 \
 .endif
 
 YPREFIX=__pd
-#.PATH:        ${NETBSDSRCDIR}/lib/libc/gen
-.PATH: ${NETBSDSRCDIR}/lib/nbsd_libc/gen
+.PATH: ${NETBSDSRCDIR}/lib/libc/gen
 
 .if defined(__MINIX)
 .include "compat-minix/Makefile.inc"
diff --git a/lib/nbsd_libasyn/asynchio.h b/lib/nbsd_libasyn/asynchio.h
deleted file mode 100644 (file)
index 726dd1e..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*     asynchio.h - Asynchronous I/O                   Author: Kees J. Bot
- *                                                             7 Jul 1997
- * Minix-vmd compatible asynchio(3) using BSD select(2).
- */
-#ifndef _SYS__ASYNCHIO_H
-#define _SYS__ASYNCHIO_H
-
-#include <sys/select.h>                        /* for FD_SETSIZE */
-
-#define SEL_READ       0               /* Code for a read. */
-#define SEL_WRITE      1               /* Code for a write. */
-#define SEL_EXCEPT     2               /* Code for some exception. */
-#define SEL_NR         3               /* Number of codes. */
-
-struct _asynfd {
-       int             afd_seen;       /* Set if we manage this descriptor. */
-       int             afd_flags;      /* File flags by fcntl(fd, F_GETFL). */
-       int             afd_state[SEL_NR];  /* Operation state. */
-};
-
-typedef struct {
-       int             asyn_more;      /* Set if more to do before blocking. */
-       struct _asynfd  asyn_afd[FD_SETSIZE];
-       fd_set          asyn_fdset[SEL_NR];     /* Select() fd sets. */
-} asynchio_t;
-
-#define ASYN_INPROGRESS        EAGAIN          /* Errno code telling "nothing yet." */
-#define ASYN_NONBLOCK  0x01            /* If asyn_wait() mustn't block. */
-
-struct timeval;
-
-void asyn_init(asynchio_t *_asyn);
-ssize_t asyn_read(asynchio_t *_asyn, int _fd, void *_buf, size_t _len);
-ssize_t asyn_write(asynchio_t *_asyn, int _fd, const void *_buf, size_t _len);
-int asyn_special(asynchio_t *_asyn, int _fd, int _op);
-int asyn_result(asynchio_t *_asyn, int _fd, int _op, int _result);
-int asyn_wait(asynchio_t *_asyn, int _flags, struct timeval *to);
-int asyn_cancel(asynchio_t *_asyn, int _fd, int _op);
-int asyn_pending(asynchio_t *_asyn, int _fd, int _op);
-int asyn_synch(asynchio_t *_asyn, int _fd);
-int asyn_close(asynchio_t *_asyn, int _fd);
-
-#endif /* _SYS__ASYNCHIO_H */
diff --git a/lib/nbsd_libc/Makefile b/lib/nbsd_libc/Makefile
deleted file mode 100644 (file)
index 32e67e7..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-#      $NetBSD: Makefile,v 1.143 2010/09/04 12:17:58 ahoka Exp $
-#      @(#)Makefile    8.2 (Berkeley) 2/3/94
-#
-# All library objects contain sccsid strings by default; they may be
-# excluded as a space-saving measure.  To produce a library that does
-# not contain these strings, delete -DLIBC_SCCS and -DSYSLIBC_SCCS
-# from CPPFLAGS below.  To remove these strings from just the system call
-# stubs, remove just -DSYSLIBC_SCCS from CPPFLAGS.
-#
-# The NLS (message catalog) functions are always in libc.  To choose that
-# strerror(), perror(), strsignal(), psignal(), etc. actually call the NLS
-# functions, put -DNLS on the CPPFLAGS line below.
-#
-# The YP functions are always in libc. To choose that getpwent() and friends
-# actually call the YP functions, put -DYP on the CPPFLAGS line below.
-#
-# The Hesiod functions are always in libc. To choose that getpwent() and friends
-# actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below.
-
-.if defined(__MINIX)
-.include "minix-config.inc"
-.endif
-.include "Makefile.inc"
-
-LIB=           c
-CPPFLAGS+=     -I${.CURDIR}/include -I${.CURDIR}
-
-LIBCDIR=       ${.CURDIR}
-
-.if exists (${ARCHDIR}/Makefile.inc)
-.PATH: ${ARCHDIR}
-.include "${ARCHDIR}/Makefile.inc"
-.endif
-
-.if exists (${ARCHDIR}/genassym.cf)
-DPSRCS+=       assym.h
-CLEANFILES+=   assym.h assym.h.tmp
-
-assym.h: ${ARCHDIR}/genassym.cf
-       ${_MKTARGET_CREATE}
-       ${TOOL_GENASSYM} -- ${CC} ${CFLAGS} \
-               ${CPPFLAGS} ${CPPFLAGS.assym.h} ${PROF} \
-               < ${ARCHDIR}/genassym.cf > assym.h.tmp && \
-       mv -f assym.h.tmp assym.h
-.endif
-
-# The following controls how to build compatibility code for old NetBSD
-# binaries. If BUILDCOLD is yes, then we build a separate library; otherwise
-# we include the code in libc.
-BUILDCOLD?= no
-.if "${BUILDCOLD}" == "yes"
-SUBDIR=compat
-.include <bsd.subdir.mk>
-.else
-COMPATDIR= ${.CURDIR}/compat-minix
-.include "${.CURDIR}/compat-minix/Makefile.inc"
-.endif
-
-.include "${.CURDIR}/../../common/lib/libc/Makefile.inc"
-.include "${.CURDIR}/atomic/Makefile.inc"
-.include "${.CURDIR}/cdb/Makefile.inc"
-.include "${.CURDIR}/db/Makefile.inc"
-.if (${CITRUS} == "yes")
-.include "${.CURDIR}/citrus/Makefile.inc"
-.endif
-.include "${.CURDIR}/compat-43/Makefile.inc"
-.include "${.CURDIR}/dlfcn/Makefile.inc"
-.include "${.CURDIR}/gdtoa/Makefile.inc"
-.include "${.CURDIR}/gen/Makefile.inc"
-.if defined(__MINIX)
-# gmon needs profil()
-.else
-.include "${.CURDIR}/gmon/Makefile.inc"
-.endif
-.include "${.CURDIR}/hash/Makefile.inc"
-.include "${.CURDIR}/iconv/Makefile.inc"
-.include "${.CURDIR}/inet/Makefile.inc"
-.include "${.CURDIR}/isc/Makefile.inc"
-.include "${.CURDIR}/locale/Makefile.inc"
-.include "${.CURDIR}/md/Makefile.inc"
-.include "${.CURDIR}/misc/Makefile.inc"
-.include "${.CURDIR}/net/Makefile.inc"
-.include "${.CURDIR}/nameser/Makefile.inc"
-.include "${.CURDIR}/nls/Makefile.inc"
-.if (${MACHINE_ARCH} != "alpha") && (${MACHINE_ARCH} != "sparc64")
-.include "${.CURDIR}/quad/Makefile.inc"
-.endif
-.if (${USE_LIBTRE} == "yes")
-.include "${NETBSDSRCDIR}/external/bsd/tre/Makefile.inc"
-.else
-.include "${.CURDIR}/regex/Makefile.inc"
-.endif
-.include "${.CURDIR}/resolv/Makefile.inc"
-.if defined(__MINIX)
-# RPC needs pollts() and a reserved port allocator.
-.else
-.include "${.CURDIR}/rpc/Makefile.inc"
-.endif
-.include "${.CURDIR}/ssp/Makefile.inc"
-.include "${.CURDIR}/stdio/Makefile.inc"
-.include "${.CURDIR}/stdlib/Makefile.inc"
-.include "${.CURDIR}/string/Makefile.inc"
-.include "${.CURDIR}/termios/Makefile.inc"
-.include "${.CURDIR}/thread-stub/Makefile.inc"
-.include "${.CURDIR}/time/Makefile.inc"
-.if defined(__MINIX)
-.include "${.CURDIR}/sys-minix/Makefile.inc"
-.else
-.include "${.CURDIR}/sys/Makefile.inc"
-.endif
-.include "${.CURDIR}/uuid/Makefile.inc"
-.if (${MKYP} != "no")
-.include "${.CURDIR}/yp/Makefile.inc"
-.endif
-
-# Remove from SRCS the .c files for any .S files added by the MD makefiles,
-# also remove from SRCS the .c files for the .S and .c files in NO_SRCS.
-# Add the .c file for .S files (in both variables) to LSRCS so that the
-# 'normal' .c file for assembly files is used for the lint librray.
-#
-# Usage:
-# Add .S files to NO_SRSC when another .S file provides the entry points.
-# Add .c files to NO_SRSC when another .c file provides the entry points.
-# (lint is run on all .c files in SRCS)
-
-.for check_file in ${SRCS:M*.S} ${NO_SRCS}
-unwanted_file := ${SRCS:M${check_file:.S=.c}}
-.if "${unwanted_file}" != ""
-SRCS := ${SRCS:N${unwanted_file}}
-.if "${unwanted_file}" != "${check_file}"
-LSRCS := ${LSRCS} ${unwanted_file}
-.endif
-.endif
-.endfor
-
-NLS=   C.msg Pig.msg ca.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg \
-       no.msg pl.msg sk.msg sv.msg
-
-.if defined(__MINIX)
-realall: 
-.else
-realall: tags
-.endif
-tags: ${.OBJDIR}/tags
-${.OBJDIR}/tags: ${SRCS}
-       ${_MKTARGET_CREATE}
-       -${TOOL_CTAGS} -w ${.ALLSRC:M*.c}
-       -egrep "^ENTRY(.*)|^FUNC(.*)|^SYSCALL(.*)" /dev/null ${.ALLSRC:M*.S} | \
-           sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
-           >> ${.TARGET}; sort -o ${.TARGET} ${.TARGET}
-
-.if !defined(__MINIX)
-FILES=         ${.OBJDIR}/tags
-FILESNAME=     libc.tags
-FILESDIR=      /var/db
-.endif
-
-
-# workaround for I18N stuffs: build singlebyte setlocale() for libc.a,
-# multibyte for libc.so.  the quirk should be removed when we support
-# dlopen() from within statically linked binaries.
-.if (${CITRUS} == "yes")
-CSHLIBFLAGS+=  -D_I18N_DYNAMIC
-.endif
-
-.include <bsd.lib.mk>
-
-# force the dynamic linker to initialize libc first
-SHLIB_SHFLAGS+=        -Wl,-z,initfirst
-
-.include <bsd.own.mk>
-SUBDIR+= pkgconfig
-.include <bsd.subdir.mk>
-
diff --git a/lib/nbsd_libc/Makefile.inc b/lib/nbsd_libc/Makefile.inc
deleted file mode 100644 (file)
index 0b2facf..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#      $NetBSD: Makefile.inc,v 1.6 2010/05/30 08:28:53 tnozaki Exp $
-#      @(#)Makefile    8.2 (Berkeley) 2/3/94
-#
-# All library objects contain sccsid strings by default; they may be
-# excluded as a space-saving measure.  To produce a library that does
-# not contain these strings, delete -DLIBC_SCCS and -DSYSLIBC_SCCS
-# from CPPFLAGS below.  To remove these strings from just the system call
-# stubs, remove just -DSYSLIBC_SCCS from CPPFLAGS.
-#
-# The NLS (message catalog) functions are always in libc.  To choose that
-# strerror(), perror(), strsignal(), psignal(), etc. actually call the NLS
-# functions, put -DNLS on the CPPFLAGS line below.
-#
-# The YP functions are always in libc. To choose that getpwent() and friends
-# actually call the YP functions, put -DYP on the CPPFLAGS line below.
-#
-# The Hesiod functions are always in libc. To choose that getpwent() and friends
-# actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below.
-
-USE_FORT?=     yes
-
-.if defined(__MINIX)
-USE_SHLIBDIR= no
-.else
-USE_SHLIBDIR=  yes
-.endif
-
-CITRUS?=       yes
-
-.include <bsd.own.mk>
-
-WARNS=4
-.if defined(__MINIX)
-CPPFLAGS+=     -D_LIBC
-.else
-CPPFLAGS+=     -D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT
-.endif
-
-.if (${USE_HESIOD} != "no")
-CPPFLAGS+=     -DHESIOD
-.endif
-
-.if (${USE_INET6} != "no")
-CPPFLAGS+=     -DINET6
-.endif
-
-CPPFLAGS+=     -DNLS
-
-.if (${USE_YP} != "no")
-CPPFLAGS+=     -DYP
-.endif
-
-.if ${MACHINE_ARCH} == "i386"
-# Set lint to exit on warnings
-LINTFLAGS+=    -w
-.endif
-# ignore 'empty translation unit' warnings.
-LINTFLAGS+=    -X 272
-
-.include "libcincludes.mk"
-
-ARCHDIR=       ${.CURDIR}/arch/${ARCHSUBDIR}
-AFLAGS+=       -I${ARCHDIR}
-.if defined(DESTDIR)
-AFLAGS+=       -nostdinc -isystem ${DESTDIR}/usr/include
-.endif
-CLEANFILES+=   tags
-
-# Don't try to lint the C library against itself when creating llib-lc.ln
-LLIBS=
-
-INCSDIR=       /usr/include
diff --git a/lib/nbsd_libc/arch/i386/string/Makefile.inc b/lib/nbsd_libc/arch/i386/string/Makefile.inc
deleted file mode 100644 (file)
index c161174..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#      $NetBSD: Makefile.inc,v 1.5 2009/07/30 20:57:16 dsl Exp $
-
-# objects built from assembler sources
-SRCS+= bcmp.S bcopy.S bzero.S ffs.S memchr.S memcmp.S \
-       memcpy.S memmove.S memset.S strcat.S strchr.S \
-       strcmp.S strcpy.S strlen.S strncmp.S strrchr.S swab.S
diff --git a/lib/nbsd_libc/arch/i386/string/bcmp.S b/lib/nbsd_libc/arch/i386/string/bcmp.S
deleted file mode 100644 (file)
index 3ea341e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@NetBSD.org>.
- * Public domain.
- */
-
-#include <machine/asm.h>
-
-#if defined(LIBC_SCCS)
-       RCSID("$NetBSD: bcmp.S,v 1.9 2007/11/12 18:41:59 ad Exp $")
-#endif
-
-ENTRY(bcmp)
-       pushl   %edi
-       pushl   %esi
-       movl    12(%esp),%edi
-       movl    16(%esp),%esi
-       xorl    %eax,%eax               /* clear return value */
-
-       movl    20(%esp),%ecx           /* compare by words */
-       shrl    $2,%ecx
-       repe
-       cmpsl
-       jne     L1
-
-       movl    20(%esp),%ecx           /* compare remainder by bytes */
-       andl    $3,%ecx
-       repe
-       cmpsb
-       je      L2
-
-L1:    incl    %eax
-L2:    popl    %esi
-       popl    %edi
-       ret
diff --git a/lib/nbsd_libc/arch/i386/string/bcopy.S b/lib/nbsd_libc/arch/i386/string/bcopy.S
deleted file mode 100644 (file)
index 35fb1df..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/*     $NetBSD: bcopy.S,v 1.15 2005/02/09 18:15:16 christos Exp $      */
-
-#define BCOPY
-#include "memcpy.S"
diff --git a/lib/nbsd_libc/arch/i386/string/bzero.S b/lib/nbsd_libc/arch/i386/string/bzero.S
deleted file mode 100644 (file)
index f837447..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/*     $NetBSD: bzero.S,v 1.12 2005/02/09 18:15:16 christos Exp $      */
-
-#define BZERO
-#include "memset.S"
diff --git a/lib/nbsd_libc/arch/i386/string/index.S b/lib/nbsd_libc/arch/i386/string/index.S
deleted file mode 100644 (file)
index bda26bb..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $NetBSD: index.S,v 1.14 2005/02/09 18:15:16 christos Exp $ */
-
-#define INDEX
-#include "strchr.S"
diff --git a/lib/nbsd_libc/arch/i386/string/rindex.S b/lib/nbsd_libc/arch/i386/string/rindex.S
deleted file mode 100644 (file)
index f39cc2c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/* $NetBSD: rindex.S,v 1.14 2005/02/09 18:15:16 christos Exp $ */
-
-#define RINDEX
-#include "strrchr.S"
diff --git a/lib/nbsd_libc/arch/i386/string/strncmp.S b/lib/nbsd_libc/arch/i386/string/strncmp.S
deleted file mode 100644 (file)
index 45b1ce2..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Written by J.T. Conklin <jtc@NetBSD.org>.
- * Public domain.
- */
-
-#include <machine/asm.h>
-
-#if defined(LIBC_SCCS)
-       RCSID("$NetBSD: strncmp.S,v 1.14 2005/08/03 22:59:50 rpaulo Exp $")
-#endif
-
-/*
- * NOTE: I've unrolled the loop eight times: large enough to make a
- * significant difference, and small enough not to totally trash the
- * cache.
- */
-
-ENTRY(strncmp)
-       pushl   %ebx
-       movl    8(%esp),%eax
-       movl    12(%esp),%ecx
-       movl    16(%esp),%edx
-       testl   %edx,%edx
-       jmp     L2                      /* Jump into the loop! */
-
-       _ALIGN_TEXT,0x90
-L1:    incl    %eax
-       incl    %ecx
-       decl    %edx
-L2:    jz      L4                      /* strings are equal */
-       movb    (%eax),%bl
-       testb   %bl,%bl
-       jz      L3
-       cmpb    %bl,(%ecx)
-       jne     L3
-
-       incl    %eax
-       incl    %ecx
-       decl    %edx
-       jz      L4
-       movb    (%eax),%bl
-       testb   %bl,%bl
-       jz      L3
-       cmpb    %bl,(%ecx)
-       jne     L3
-
-       incl    %eax
-       incl    %ecx
-       decl    %edx
-       jz      L4
-       movb    (%eax),%bl
-       testb   %bl,%bl
-       jz      L3
-       cmpb    %bl,(%ecx)
-       jne     L3
-
-       incl    %eax
-       incl    %ecx
-       decl    %edx
-       jz      L4
-       movb    (%eax),%bl
-       testb   %bl,%bl
-       jz      L3
-       cmpb    %bl,(%ecx)
-       jne     L3
-
-       incl    %eax
-       incl    %ecx
-       decl    %edx
-       jz      L4
-       movb    (%eax),%bl
-       testb   %bl,%bl
-       jz      L3
-       cmpb    %bl,(%ecx)
-       jne     L3
-
-       incl    %eax
-       incl    %ecx
-       decl    %edx
-       jz      L4
-       movb    (%eax),%bl
-       testb   %bl,%bl
-       jz      L3
-       cmpb    %bl,(%ecx)
-       jne     L3
-
-       incl    %eax
-       incl    %ecx
-       decl    %edx
-       jz      L4
-       movb    (%eax),%bl
-       testb   %bl,%bl
-       jz      L3
-       cmpb    %bl,(%ecx)
-       jne     L3
-
-       incl    %eax
-       incl    %ecx
-       decl    %edx
-       jz      L4
-       movb    (%eax),%bl
-       testb   %bl,%bl
-       jz      L3
-       cmpb    %bl,(%ecx)
-       je      L1
-
-       _ALIGN_TEXT,0x90
-L3:    movzbl  (%eax),%eax             /* unsigned comparison */
-       movzbl  (%ecx),%ecx
-       subl    %ecx,%eax
-       popl    %ebx
-       ret
-       _ALIGN_TEXT,0x90
-L4:    xorl    %eax,%eax
-       popl    %ebx
-       ret
diff --git a/lib/nbsd_libc/arch/i386/sys-minix/__sigreturn.S b/lib/nbsd_libc/arch/i386/sys-minix/__sigreturn.S
deleted file mode 100644 (file)
index 01182b0..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/* This routine is the low-level code for returning from signals.   */
-/* It calls _sigreturn, which is the normal "system call" routine. */
-/* Both __sigreturn and _sigreturn are needed. */
-#include <machine/asm.h>
-
-IMPORT(_sigreturn)
-ENTRY(__sigreturn)
-       addl    $16, %esp
-       jmp     _C_LABEL(_sigreturn)
diff --git a/lib/nbsd_libc/arch/i386/sys-minix/_ipc.S b/lib/nbsd_libc/arch/i386/sys-minix/_ipc.S
deleted file mode 100644 (file)
index 5d5d778..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-#include <minix/ipcconst.h>
-#include <machine/asm.h>
-
-       IPCVEC = 33     /* ipc trap to kernel  */
-       KERVEC = 32     /* syscall trap to kernel */
-
-       SRC_DST = 8     /* source/ destination process  */
-       MESSAGE = 12    /* message pointer  */
-       STATUS = 16     /* status pointer  */
-
-/**========================================================================* */
-/*                           IPC assembly routines                       * */
-/**========================================================================* */
-/* all message passing routines save ebx, but destroy eax and ecx. */
-ENTRY(_send)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %ebx
-       movl    SRC_DST(%ebp), %eax     /* eax = dest-src */
-       movl    MESSAGE(%ebp), %ebx     /* ebx = message pointer */
-       movl    $SEND, %ecx     /* _send(dest, ptr) */
-       int     $IPCVEC /* trap to the kernel */
-       pop     %ebx
-       pop     %ebp
-       ret
-
-ENTRY(_receive)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %ebx
-       movl    SRC_DST(%ebp), %eax     /* eax = dest-src */
-       movl    MESSAGE(%ebp), %ebx     /* ebx = message pointer */
-       movl    $RECEIVE, %ecx  /* _receive(src, ptr) */
-       int     $IPCVEC /* trap to the kernel */
-       movl    STATUS(%ebp), %ecx      /* ecx = status pointer */
-       movl    %ebx, (%ecx)
-       pop     %ebx
-       pop     %ebp
-       ret
-
-ENTRY(_sendrec)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %ebx
-       movl    SRC_DST(%ebp), %eax     /* eax = dest-src */
-       movl    MESSAGE(%ebp), %ebx     /* ebx = message pointer */
-       movl    $SENDREC, %ecx  /* _sendrec(srcdest, ptr) */
-       int     $IPCVEC /* trap to the kernel */
-       pop     %ebx
-       pop     %ebp
-       ret
-
-ENTRY(_notify)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %ebx
-       movl    SRC_DST(%ebp), %eax     /* eax = destination  */
-       movl    $NOTIFY, %ecx   /* _notify(srcdst) */
-       int     $IPCVEC /* trap to the kernel */
-       pop     %ebx
-       pop     %ebp
-       ret
-
-ENTRY(_sendnb)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %ebx
-       movl    SRC_DST(%ebp), %eax     /* eax = dest-src */
-       movl    MESSAGE(%ebp), %ebx     /* ebx = message pointer */
-       movl    $SENDNB, %ecx   /* _sendnb(dest, ptr) */
-       int     $IPCVEC /* trap to the kernel */
-       pop     %ebx
-       pop     %ebp
-       ret
-
-ENTRY(_do_kernel_call)
-       /* pass the message pointer to kernel in the %eax register */
-       movl    4(%esp), %eax
-       int     $KERVEC
-       ret
diff --git a/lib/nbsd_libc/arch/i386/sys-minix/_senda.S b/lib/nbsd_libc/arch/i386/sys-minix/_senda.S
deleted file mode 100644 (file)
index a38c2c9..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <minix/ipcconst.h>
-#include <machine/asm.h>
-
-       SYSVEC = 33
-
-       MSGTAB = 8      /* message table */
-       TABCOUNT = 12   /* number of entries in message table */
-
-ENTRY(_senda)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %ebx
-       movl    TABCOUNT(%ebp), %eax    /* eax = count */
-       movl    MSGTAB(%ebp), %ebx      /* ebx = table */
-       movl    $SENDA, %ecx    /* _senda(table, count) */
-       int     $SYSVEC /* trap to the kernel */
-       pop     %ebx
-       pop     %ebp
-       ret
diff --git a/lib/nbsd_libc/arch/i386/sys-minix/brksize.S b/lib/nbsd_libc/arch/i386/sys-minix/brksize.S
deleted file mode 100644 (file)
index 64ec062..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#if defined(__ELF__)
-.globl _end
-.globl _brksize
-
-.data
-_brksize: .long _end
-#else
-.globl __brksize
-.data
-.extern        endbss, __brksize
-__brksize:
-.long  endbss
-#endif
diff --git a/lib/nbsd_libc/arch/i386/sys-minix/ucontext.S b/lib/nbsd_libc/arch/i386/sys-minix/ucontext.S
deleted file mode 100644 (file)
index 27e237e..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-#include <machine/asm.h>
-
-#ifdef __ACK__
-.text
-begtext:
-#ifdef __ACK__
-.rom
-#else
-.data
-#endif
-begrom:
-.data
-begdata:
-.bss
-begbss:
-#endif
-
-
-IMPORT(getuctx)
-IMPORT(setuctx)
-IMPORT(resumecontext)
-
-
-/* Offsets into ucontext_t structure. Keep in sync with <sys/ucontext.h>! */
-#define UC_FLAGS       0 
-#define UC_LINK                UC_FLAGS + 4
-#define MCTX           UC_LINK + 4
-#define MAGIC          MCTX
-#define GS             MAGIC+4
-#define FS             GS+2
-#define ES             FS+2
-#define DS             ES+2
-#define DI             DS+2
-#define SI             DI+4
-#define BP             SI+4
-#define ST             BP+4    /* Hole for another SP */
-#define BX             ST+4
-#define DX             BX+4
-#define CX             DX+4
-#define AX             CX+4
-#define RETADR         AX+4
-#define PC             RETADR+4
-#define CS             PC+4
-#define PSW            CS+4
-#define SP             PSW+4
-#define SS             SP+4
-
-
-/* MCF_MAGIC value from <mcontext.h> */
-#define MCF_MAGIC      0xc0ffee
-
-/* Values from <sys/ucontext.h> */
-#define UCF_IGNFPU     0x002
-#define UCF_IGNSIGM    0x004
-
-
-/* EINVAL from errno.h */
-#define EFAULT         14
-#define EINVAL                 22
-
-
-/* int getcontext(ucontext_t *ucp) 
- *     Initialise the structure pointed to by ucp to the current user context
- *     of the calling thread. */
-ENTRY(getcontext)
-       /* In case a process does not use the FPU and is neither interested in
-        * saving its signal mask, then we can skip the context switch to
-        * PM and kernel altogether and only save general-purpose registers. */
-
-       mov (%esp), %ecx        /* Save return address:
-                                * When setcontext or swapcontext is called,
-                                * we jump to this address and continue
-                                * running. */
-
-       mov 4(%esp), %edx               /* edx = ucp */
-       /* Check null pointer */
-       cmp $0, %edx                    /* edx == NULL? */
-       jne 3f                          /* Not null, continue */
-       movl $EFAULT, (_C_LABEL(errno))
-       xor %eax, %eax
-       dec %eax                        /* return -1 */
-       ret
-       
-3:     /* Check flags */
-       push %ecx                       /* save ecx */
-       push %ebx                       /* save ebx */
-       lea UC_FLAGS(%edx), %ebx        /* ebx = &(ucp->uc_flags) */
-       mov (%ebx), %ecx                /* ecx = ucp->uc_flags */
-       mov $UCF_IGNFPU, %eax
-       or $UCF_IGNSIGM, %eax
-       cmp %eax, %ecx                  /* is UCF_IGNFPU or UCF_IGNSIGM set? */
-       pop %ebx                        /* restore ebx */
-       pop %ecx                        /* restore ecx */
-       jz 1f                           /* Both are set, skip getuctx */
-
-0:
-       push %ecx                       /* Save ecx */
-       push %edx                
-       call _C_LABEL(getuctx)          /* getuctx(ucp) */
-       pop %edx                        /* clean up stack and restore edx */
-       pop %ecx                        /* Restore ecx */
-
-1: 
-       /* Save the context */
-       mov 4(%esp), %edx               /* edx = ucp */
-       pop %eax                        /* retaddr */
-       mov %eax, PC(%edx)              /* Save real RTA in mcp struct */
-       mov %esp, SP(%edx)      /* Save stack pointer (now pointing to ucp) */
-       /* Save GP registers */
-       mov %ebp, BP(%edx)              /* Save EBP */
-       mov %esi, SI(%edx)              /* Save ESI */
-       mov %edi, DI(%edx)              /* Save EDI */
-       mov %ebx, BX(%edx)              /* Save EBX */
-       mov %ecx, CX(%edx)              /* Save ECX */
-       movl $MCF_MAGIC, MAGIC(%edx)    /* Set magic value */
-       push %eax                       /* Restore retaddr */
-
-       xor %eax, %eax                  /* Return 0 */
-
-2:     
-       add $4, %esp                    /* Remove stale (setcontext) RTA */
-       jmp *%ecx                       /* Restore return address */
-       
-
-/* int setcontext(const ucontext_t *ucp)
- *     Restore the user context pointed to by ucp. A successful call to
- *     setcontext does not return; program execution resumes at the point
- *     specified by the ucp argument. If ucp was created with getcontext(), 
- *     program execution continues as if the corresponding call of getcontext()
- *     had just returned. If ucp was created with makecontext(), program
- *     execution continues with the function passed to makecontext(). */
-ENTRY(setcontext)
-       /* In case a process does not use the FPU and is neither interested in
-        * restoring its signal mask, then we can skip the context switch to
-        * PM and kernel altogether and restore state here. */
-
-       mov 4(%esp), %edx               /* edx = ucp */
-
-       /* Check null pointer */
-       cmp $0, %edx                    /* edx == NULL? */
-       jnz 3f                          /* Not null, continue */
-       movl $EFAULT, (_C_LABEL(errno))
-       xor %eax, %eax
-       dec %eax                        /* return -1 */
-       ret
-       
-3:     /* Check flags */
-       push %ebx                       /* save ebx */
-       lea MAGIC(%edx), %ebx           /* ebx = &(ucp->mc_context.mc_magic) */
-       mov (%ebx), %ecx                /* ecx = ucp->mc_context.mc_magic */
-       pop %ebx                        /* restore ebx */
-       cmp $MCF_MAGIC, %ecx    /* is the magic value set (is context valid)?*/
-       jz 4f                           /* is set, proceed */
-       movl $EINVAL, (_C_LABEL(errno)) /* not set, return error code */
-       xor %eax, %eax
-       dec %eax                        /* return -1 */
-       ret     
-
-
-4:     push %ebx                       /* save ebx */
-       lea UC_FLAGS(%edx), %ebx        /* ebx = &(ucp->uc_flags) */
-       mov (%ebx), %ecx                /* ecx = ucp->uc_flags */
-       pop %ebx                        /* restore ebx */
-       mov $UCF_IGNFPU, %eax
-       or $UCF_IGNSIGM, %eax
-       cmp %eax, %ecx          /* Are UCF_IGNFPU and UCF_IGNSIGM flags set? */
-       jz 1f                   /* Both are set, so don't bother restoring FPU
-                                * state and signal mask */
-
-0:     push %ecx                       /* Save ecx */
-       push %edx                
-       call _C_LABEL(setuctx)          /* setuctx(ucp) */
-       pop %edx                        /* Clean up stack and restore edx */
-       pop %ecx                        /* Restore ecx */
-
-1:     /* Restore the registers */
-       mov 4(%esp), %edx               /* edx = ucp */
-       mov CX(%edx), %ecx              /* Restore ECX */
-       mov BX(%edx), %ebx              /* Restore EBX */
-       mov DI(%edx), %edi              /* Restore EDI */
-       mov SI(%edx), %esi              /* Restore ESI */
-       mov BP(%edx), %ebp              /* Restore EBP */
-       mov SP(%edx), %esp              /* Restore stack pointer */
-
-2:
-       jmp *PC(%edx)   /* Push RTA onto stack so we can return to it */
-
-
-/* void ctx_start((void *func)(int arg1, ..., argn), arg1, ..., argn,
- *               ucontext_t *ucp)
- *     A wrapper to start function `func'. ESI register will contain a pointer
- *     to ucp on the stack. By setting ESP to ESI, we effectively 'remove' all
- *     arguments to `func' from the stack. Finally, a call to resumecontext
- *     will start the next context in the linked list (or exit the program if
- *     there is no context). */
-ENTRY(ctx_start)
-       /* 0(esp) -> func
-        * 4(esp) -> arg1
-        * ...
-        * 4*n(esp) -> argn
-        * 4*(n+1)(esp) -> ucp */
-
-       pop %eax                        /* eax = func */
-       call *%eax                      /* func(arg1, ..., argn) */
-       mov %esi, %esp                  /* Clean up stack */
-       /* ucp is now at the top of the stack again */
-       call _C_LABEL(resumecontext)    /* resumecontext(ucp) */
-       ret                     /* never reached */
-
-
diff --git a/lib/nbsd_libc/db/Makefile.inc b/lib/nbsd_libc/db/Makefile.inc
deleted file mode 100644 (file)
index 224719d..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#      $NetBSD: Makefile.inc,v 1.6 1997/10/22 23:14:11 lukem Exp $
-#      @(#)Makefile.inc        8.2 (Berkeley) 2/21/94
-#
-CPPFLAGS+=-D__DBINTERFACE_PRIVATE
-
-.include "${.CURDIR}/db/btree/Makefile.inc"
-.include "${.CURDIR}/db/db/Makefile.inc"
-.include "${.CURDIR}/db/hash/Makefile.inc"
-.include "${.CURDIR}/db/man/Makefile.inc"
-.include "${.CURDIR}/db/mpool/Makefile.inc"
-.include "${.CURDIR}/db/recno/Makefile.inc"
diff --git a/lib/nbsd_libc/db/README b/lib/nbsd_libc/db/README
deleted file mode 100644 (file)
index d06cdf1..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#      $NetBSD: README,v 1.3 1996/05/03 21:17:07 cgd Exp $
-#      @(#)README      8.27 (Berkeley) 9/1/94
-
-This is version 1.85 of the Berkeley DB code.
-
-For information on compiling and installing this software, see the file
-PORT/README.
-
-Newer versions of this software will periodically be made available by
-anonymous ftp from ftp.cs.berkeley.edu.  An archive in compressed format
-is in ucb/4bsd/db.tar.Z, or in gzip format in ucb/4bsd/db.tar.gz.  If
-you'd like to receive announcements of future releases of this software,
-send email to the contact address below.
-
-Email questions may be addressed to Keith Bostic at bostic@cs.berkeley.edu.
-
-============================================
-Distribution contents:
-
-Makefile.inc   Ignore this, it's the 4.4BSD subsystem Makefile.
-PORT           The per OS/architecture directories to use to build
-               libdb.a, if you're not running 4.4BSD.  See the file
-               PORT/README for more information.
-README         This file.
-btree          The B+tree routines.
-changelog      List of changes, per version.
-db             The dbopen(3) interface routine.
-docs           Various USENIX papers, and the formatted manual pages.
-hash           The extended linear hashing routines.
-man            The unformatted manual pages.
-mpool          The memory pool routines.
-recno          The fixed/variable length record routines.
-test           Test package.
-
-============================================
-Debugging:
-
-If you're running a memory checker (e.g. Purify) on DB, make sure that
-you recompile it with "-DPURIFY" in the CFLAGS, first.  By default,
-allocated pages are not initialized by the DB code, and they will show
-up as reads of uninitialized memory in the buffer write routines.
diff --git a/lib/nbsd_libc/db/btree/Makefile.inc b/lib/nbsd_libc/db/btree/Makefile.inc
deleted file mode 100644 (file)
index 46fbb02..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#      $NetBSD: Makefile.inc,v 1.6 1996/05/03 21:50:36 cgd Exp $
-#      @(#)Makefile.inc        8.2 (Berkeley) 7/14/94
-
-.PATH: ${.CURDIR}/db/btree
-
-SRCS+= bt_close.c bt_conv.c bt_debug.c bt_delete.c bt_get.c bt_open.c \
-       bt_overflow.c bt_page.c bt_put.c bt_search.c bt_seq.c bt_split.c \
-       bt_utils.c
diff --git a/lib/nbsd_libc/db/btree/bt_close.c b/lib/nbsd_libc/db/btree/bt_close.c
deleted file mode 100644 (file)
index a085952..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-/*     $NetBSD: bt_close.c,v 1.14 2008/09/11 12:58:00 joerg Exp $      */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_close.c,v 1.14 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <db.h>
-#include "btree.h"
-
-static int bt_meta(BTREE *);
-
-/*
- * BT_CLOSE -- Close a btree.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__bt_close(DB *dbp)
-{
-       BTREE *t;
-       int fd;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /* Sync the tree. */
-       if (__bt_sync(dbp, 0) == RET_ERROR)
-               return (RET_ERROR);
-
-       /* Close the memory pool. */
-       if (mpool_close(t->bt_mp) == RET_ERROR)
-               return (RET_ERROR);
-
-       /* Free random memory. */
-       if (t->bt_cursor.key.data != NULL) {
-               free(t->bt_cursor.key.data);
-               t->bt_cursor.key.size = 0;
-               t->bt_cursor.key.data = NULL;
-       }
-       if (t->bt_rkey.data) {
-               free(t->bt_rkey.data);
-               t->bt_rkey.size = 0;
-               t->bt_rkey.data = NULL;
-       }
-       if (t->bt_rdata.data) {
-               free(t->bt_rdata.data);
-               t->bt_rdata.size = 0;
-               t->bt_rdata.data = NULL;
-       }
-
-       fd = t->bt_fd;
-       free(t);
-       free(dbp);
-       return (close(fd) ? RET_ERROR : RET_SUCCESS);
-}
-
-/*
- * BT_SYNC -- sync the btree to disk.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *
- * Returns:
- *     RET_SUCCESS, RET_ERROR.
- */
-int
-__bt_sync(const DB *dbp, u_int flags)
-{
-       BTREE *t;
-       int status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /* Sync doesn't currently take any flags. */
-       if (flags != 0) {
-               errno = EINVAL;
-               return (RET_ERROR);
-       }
-
-       if (F_ISSET(t, B_INMEM | B_RDONLY) || !F_ISSET(t, B_MODIFIED))
-               return (RET_SUCCESS);
-
-       if (F_ISSET(t, B_METADIRTY) && bt_meta(t) == RET_ERROR)
-               return (RET_ERROR);
-
-       if ((status = mpool_sync(t->bt_mp)) == RET_SUCCESS)
-               F_CLR(t, B_MODIFIED);
-
-       return (status);
-}
-
-/*
- * BT_META -- write the tree meta data to disk.
- *
- * Parameters:
- *     t:      tree
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-static int
-bt_meta(BTREE *t)
-{
-       BTMETA m;
-       void *p;
-
-       if ((p = mpool_get(t->bt_mp, P_META, 0)) == NULL)
-               return (RET_ERROR);
-
-       /* Fill in metadata. */
-       m.magic = BTREEMAGIC;
-       m.version = BTREEVERSION;
-       m.psize = t->bt_psize;
-       m.free = t->bt_free;
-       m.nrecs = t->bt_nrecs;
-       m.flags = F_ISSET(t, SAVEMETA);
-
-       memmove(p, &m, sizeof(BTMETA));
-       mpool_put(t->bt_mp, p, MPOOL_DIRTY);
-       return (RET_SUCCESS);
-}
diff --git a/lib/nbsd_libc/db/btree/bt_conv.c b/lib/nbsd_libc/db/btree/bt_conv.c
deleted file mode 100644 (file)
index 2c5217a..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/*     $NetBSD: bt_conv.c,v 1.14 2008/09/10 17:52:35 joerg Exp $       */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_conv.c,v 1.14 2008/09/10 17:52:35 joerg Exp $");
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <db.h>
-#include "btree.h"
-
-static void mswap(PAGE *);
-
-/*
- * __BT_BPGIN, __BT_BPGOUT --
- *     Convert host-specific number layout to/from the host-independent
- *     format stored on disk.
- *
- * Parameters:
- *     t:      tree
- *     pg:     page number
- *     h:      page to convert
- */
-void
-__bt_pgin(void *t, pgno_t pg, void *pp)
-{
-       PAGE *h;
-       indx_t i, top;
-       uint8_t flags;
-       char *p;
-
-       if (!F_ISSET(((BTREE *)t), B_NEEDSWAP))
-               return;
-       if (pg == P_META) {
-               mswap(pp);
-               return;
-       }
-
-       h = pp;
-       M_32_SWAP(h->pgno);
-       M_32_SWAP(h->prevpg);
-       M_32_SWAP(h->nextpg);
-       M_32_SWAP(h->flags);
-       M_16_SWAP(h->lower);
-       M_16_SWAP(h->upper);
-
-       top = NEXTINDEX(h);
-       if ((h->flags & P_TYPE) == P_BINTERNAL)
-               for (i = 0; i < top; i++) {
-                       M_16_SWAP(h->linp[i]);
-                       p = (char *)(void *)GETBINTERNAL(h, i);
-                       P_32_SWAP(p);
-                       p += sizeof(uint32_t);
-                       P_32_SWAP(p);
-                       p += sizeof(pgno_t);
-                       if (*(uint8_t *)p & P_BIGKEY) {
-                               p += sizeof(uint8_t);
-                               P_32_SWAP(p);
-                               p += sizeof(pgno_t);
-                               P_32_SWAP(p);
-                       }
-               }
-       else if ((h->flags & P_TYPE) == P_BLEAF)
-               for (i = 0; i < top; i++) {
-                       M_16_SWAP(h->linp[i]);
-                       p = (char *)(void *)GETBLEAF(h, i);
-                       P_32_SWAP(p);
-                       p += sizeof(uint32_t);
-                       P_32_SWAP(p);
-                       p += sizeof(uint32_t);
-                       flags = *(uint8_t *)p;
-                       if (flags & (P_BIGKEY | P_BIGDATA)) {
-                               p += sizeof(uint8_t);
-                               if (flags & P_BIGKEY) {
-                                       P_32_SWAP(p);
-                                       p += sizeof(pgno_t);
-                                       P_32_SWAP(p);
-                               }
-                               if (flags & P_BIGDATA) {
-                                       p += sizeof(uint32_t);
-                                       P_32_SWAP(p);
-                                       p += sizeof(pgno_t);
-                                       P_32_SWAP(p);
-                               }
-                       }
-               }
-}
-
-void
-__bt_pgout(void *t, pgno_t pg, void *pp)
-{
-       PAGE *h;
-       indx_t i, top;
-       uint8_t flags;
-       char *p;
-
-       if (!F_ISSET(((BTREE *)t), B_NEEDSWAP))
-               return;
-       if (pg == P_META) {
-               mswap(pp);
-               return;
-       }
-
-       h = pp;
-       top = NEXTINDEX(h);
-       if ((h->flags & P_TYPE) == P_BINTERNAL)
-               for (i = 0; i < top; i++) {
-                       p = (char *)(void *)GETBINTERNAL(h, i);
-                       P_32_SWAP(p);
-                       p += sizeof(uint32_t);
-                       P_32_SWAP(p);
-                       p += sizeof(pgno_t);
-                       if (*(uint8_t *)p & P_BIGKEY) {
-                               p += sizeof(uint8_t);
-                               P_32_SWAP(p);
-                               p += sizeof(pgno_t);
-                               P_32_SWAP(p);
-                       }
-                       M_16_SWAP(h->linp[i]);
-               }
-       else if ((h->flags & P_TYPE) == P_BLEAF)
-               for (i = 0; i < top; i++) {
-                       p = (char *)(void *)GETBLEAF(h, i);
-                       P_32_SWAP(p);
-                       p += sizeof(uint32_t);
-                       P_32_SWAP(p);
-                       p += sizeof(uint32_t);
-                       flags = *(uint8_t *)p;
-                       if (flags & (P_BIGKEY | P_BIGDATA)) {
-                               p += sizeof(uint8_t);
-                               if (flags & P_BIGKEY) {
-                                       P_32_SWAP(p);
-                                       p += sizeof(pgno_t);
-                                       P_32_SWAP(p);
-                               }
-                               if (flags & P_BIGDATA) {
-                                       p += sizeof(uint32_t);
-                                       P_32_SWAP(p);
-                                       p += sizeof(pgno_t);
-                                       P_32_SWAP(p);
-                               }
-                       }
-                       M_16_SWAP(h->linp[i]);
-               }
-
-       M_32_SWAP(h->pgno);
-       M_32_SWAP(h->prevpg);
-       M_32_SWAP(h->nextpg);
-       M_32_SWAP(h->flags);
-       M_16_SWAP(h->lower);
-       M_16_SWAP(h->upper);
-}
-
-/*
- * MSWAP -- Actually swap the bytes on the meta page.
- *
- * Parameters:
- *     p:      page to convert
- */
-static void
-mswap(PAGE *pg)
-{
-       char *p;
-
-       p = (char *)(void *)pg;
-       P_32_SWAP(p);           /* magic */
-       p += sizeof(uint32_t);
-       P_32_SWAP(p);           /* version */
-       p += sizeof(uint32_t);
-       P_32_SWAP(p);           /* psize */
-       p += sizeof(uint32_t);
-       P_32_SWAP(p);           /* free */
-       p += sizeof(uint32_t);
-       P_32_SWAP(p);           /* nrecs */
-       p += sizeof(uint32_t);
-       P_32_SWAP(p);           /* flags */
-       p += sizeof(uint32_t);
-}
diff --git a/lib/nbsd_libc/db/btree/bt_debug.c b/lib/nbsd_libc/db/btree/bt_debug.c
deleted file mode 100644 (file)
index 590ca4a..0000000
+++ /dev/null
@@ -1,324 +0,0 @@
-/*     $NetBSD: bt_debug.c,v 1.15 2008/09/10 17:52:35 joerg Exp $      */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_debug.c,v 1.15 2008/09/10 17:52:35 joerg Exp $");
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <db.h>
-#include "btree.h"
-
-#ifdef DEBUG
-/*
- * BT_DUMP -- Dump the tree
- *
- * Parameters:
- *     dbp:    pointer to the DB
- */
-void
-__bt_dump(DB *dbp)
-{
-       BTREE *t;
-       PAGE *h;
-       pgno_t i;
-       const char *sep;
-
-       t = dbp->internal;
-       (void)fprintf(stderr, "%s: pgsz %d",
-           F_ISSET(t, B_INMEM) ? "memory" : "disk", t->bt_psize);
-       if (F_ISSET(t, R_RECNO))
-               (void)fprintf(stderr, " keys %lu", (unsigned long) t->bt_nrecs);
-#undef X
-#define        X(flag, name) \
-       if (F_ISSET(t, flag)) { \
-               (void)fprintf(stderr, "%s%s", sep, name); \
-               sep = ", "; \
-       }
-       if (t->flags != 0) {
-               sep = " flags (";
-               X(R_FIXLEN,     "FIXLEN");
-               X(B_INMEM,      "INMEM");
-               X(B_NODUPS,     "NODUPS");
-               X(B_RDONLY,     "RDONLY");
-               X(R_RECNO,      "RECNO");
-               X(B_METADIRTY,"METADIRTY");
-               (void)fprintf(stderr, ")\n");
-       }
-#undef X
-
-       for (i = P_ROOT; (h = mpool_get(t->bt_mp, i, 0)) != NULL; ++i) {
-               __bt_dpage(h);
-               (void)mpool_put(t->bt_mp, h, 0);
-       }
-}
-
-/*
- * BT_DMPAGE -- Dump the meta page
- *
- * Parameters:
- *     h:      pointer to the PAGE
- */
-void
-__bt_dmpage(PAGE *h)
-{
-       BTMETA *m;
-       const char *sep;
-
-       m = (BTMETA *)(void *)h;
-       (void)fprintf(stderr, "magic %lx\n", (unsigned long) m->magic);
-       (void)fprintf(stderr, "version %lu\n", (unsigned long) m->version);
-       (void)fprintf(stderr, "psize %lu\n", (unsigned long) m->psize);
-       (void)fprintf(stderr, "free %lu\n", (unsigned long) m->free);
-       (void)fprintf(stderr, "nrecs %lu\n", (unsigned long) m->nrecs);
-       (void)fprintf(stderr, "flags %lu", (unsigned long) m->flags);
-#undef X
-#define        X(flag, name) \
-       if (m->flags & flag) { \
-               (void)fprintf(stderr, "%s%s", sep, name); \
-               sep = ", "; \
-       }
-       if (m->flags) {
-               sep = " (";
-               X(B_NODUPS,     "NODUPS");
-               X(R_RECNO,      "RECNO");
-               (void)fprintf(stderr, ")");
-       }
-}
-
-/*
- * BT_DNPAGE -- Dump the page
- *
- * Parameters:
- *     n:      page number to dump.
- */
-void
-__bt_dnpage(DB *dbp, pgno_t pgno)
-{
-       BTREE *t;
-       PAGE *h;
-
-       t = dbp->internal;
-       if ((h = mpool_get(t->bt_mp, pgno, 0)) != NULL) {
-               __bt_dpage(h);
-               (void)mpool_put(t->bt_mp, h, 0);
-       }
-}
-
-/*
- * BT_DPAGE -- Dump the page
- *
- * Parameters:
- *     h:      pointer to the PAGE
- */
-void
-__bt_dpage(PAGE *h)
-{
-       BINTERNAL *bi;
-       BLEAF *bl;
-       RINTERNAL *ri;
-       RLEAF *rl;
-       indx_t cur, top;
-       const char *sep;
-
-       (void)fprintf(stderr, "    page %d: (", h->pgno);
-#undef X
-#define        X(flag, name) \
-       if (h->flags & flag) { \
-               (void)fprintf(stderr, "%s%s", sep, name); \
-               sep = ", "; \
-       }
-       sep = "";
-       X(P_BINTERNAL,  "BINTERNAL")            /* types */
-       X(P_BLEAF,      "BLEAF")
-       X(P_RINTERNAL,  "RINTERNAL")            /* types */
-       X(P_RLEAF,      "RLEAF")
-       X(P_OVERFLOW,   "OVERFLOW")
-       X(P_PRESERVE,   "PRESERVE");
-       (void)fprintf(stderr, ")\n");
-#undef X
-
-       (void)fprintf(stderr, "\tprev %2d next %2d", h->prevpg, h->nextpg);
-       if (h->flags & P_OVERFLOW)
-               return;
-
-       top = NEXTINDEX(h);
-       (void)fprintf(stderr, " lower %3d upper %3d nextind %d\n",
-           h->lower, h->upper, top);
-       for (cur = 0; cur < top; cur++) {
-               (void)fprintf(stderr, "\t[%03d] %4d ", cur, h->linp[cur]);
-               switch (h->flags & P_TYPE) {
-               case P_BINTERNAL:
-                       bi = GETBINTERNAL(h, cur);
-                       (void)fprintf(stderr,
-                           "size %03d pgno %03d", bi->ksize, bi->pgno);
-                       if (bi->flags & P_BIGKEY)
-                               (void)fprintf(stderr, " (indirect)");
-                       else if (bi->ksize)
-                               (void)fprintf(stderr,
-                                   " {%.*s}", (int)bi->ksize, bi->bytes);
-                       break;
-               case P_RINTERNAL:
-                       ri = GETRINTERNAL(h, cur);
-                       (void)fprintf(stderr, "entries %03d pgno %03d",
-                               ri->nrecs, ri->pgno);
-                       break;
-               case P_BLEAF:
-                       bl = GETBLEAF(h, cur);
-                       if (bl->flags & P_BIGKEY)
-                               (void)fprintf(stderr,
-                                   "big key page %lu size %u/",
-                                   (unsigned long) *(pgno_t *)(void *)bl->bytes,
-                                   *(uint32_t *)(void *)(bl->bytes + sizeof(pgno_t)));
-                       else if (bl->ksize)
-                               (void)fprintf(stderr, "%s/", bl->bytes);
-                       if (bl->flags & P_BIGDATA)
-                               (void)fprintf(stderr,
-                                   "big data page %lu size %u",
-                                   (unsigned long) *(pgno_t *)(void *)(bl->bytes + bl->ksize),
-                                   *(uint32_t *)(void *)(bl->bytes + bl->ksize +
-                                   sizeof(pgno_t)));
-                       else if (bl->dsize)
-                               (void)fprintf(stderr, "%.*s",
-                                   (int)bl->dsize, bl->bytes + bl->ksize);
-                       break;
-               case P_RLEAF:
-                       rl = GETRLEAF(h, cur);
-                       if (rl->flags & P_BIGDATA)
-                               (void)fprintf(stderr,
-                                   "big data page %lu size %u",
-                                   (unsigned long) *(pgno_t *)(void *)rl->bytes,
-                                   *(uint32_t *)(void *)(rl->bytes + sizeof(pgno_t)));
-                       else if (rl->dsize)
-                               (void)fprintf(stderr,
-                                   "%.*s", (int)rl->dsize, rl->bytes);
-                       break;
-               }
-               (void)fprintf(stderr, "\n");
-       }
-}
-#endif
-
-#ifdef STATISTICS
-/*
- * BT_STAT -- Gather/print the tree statistics
- *
- * Parameters:
- *     dbp:    pointer to the DB
- */
-void
-__bt_stat(DB *dbp)
-{
-       extern unsigned long bt_cache_hit, bt_cache_miss, bt_pfxsaved, bt_rootsplit;
-       extern unsigned long bt_sortsplit, bt_split;
-       BTREE *t;
-       PAGE *h;
-       pgno_t i, pcont, pinternal, pleaf;
-       unsigned long ifree, lfree, nkeys;
-       int levels;
-
-       t = dbp->internal;
-       pcont = pinternal = pleaf = 0;
-       nkeys = ifree = lfree = 0;
-       for (i = P_ROOT; (h = mpool_get(t->bt_mp, i, 0)) != NULL; ++i) {
-               switch (h->flags & P_TYPE) {
-               case P_BINTERNAL:
-               case P_RINTERNAL:
-                       ++pinternal;
-                       ifree += h->upper - h->lower;
-                       break;
-               case P_BLEAF:
-               case P_RLEAF:
-                       ++pleaf;
-                       lfree += h->upper - h->lower;
-                       nkeys += NEXTINDEX(h);
-                       break;
-               case P_OVERFLOW:
-                       ++pcont;
-                       break;
-               }
-               (void)mpool_put(t->bt_mp, h, 0);
-       }
-
-       /* Count the levels of the tree. */
-       for (i = P_ROOT, levels = 0 ;; ++levels) {
-               h = mpool_get(t->bt_mp, i, 0);
-               if (h->flags & (P_BLEAF|P_RLEAF)) {
-                       if (levels == 0)
-                               levels = 1;
-                       (void)mpool_put(t->bt_mp, h, 0);
-                       break;
-               }
-               i = F_ISSET(t, R_RECNO) ?
-                   GETRINTERNAL(h, 0)->pgno :
-                   GETBINTERNAL(h, 0)->pgno;
-               (void)mpool_put(t->bt_mp, h, 0);
-       }
-
-       (void)fprintf(stderr, "%d level%s with %ld keys",
-           levels, levels == 1 ? "" : "s", nkeys);
-       if (F_ISSET(t, R_RECNO))
-               (void)fprintf(stderr, " (%ld header count)", (long)t->bt_nrecs);
-       (void)fprintf(stderr,
-           "\n%lu pages (leaf %ld, internal %ld, overflow %ld)\n",
-           (long)pinternal + pleaf + pcont, (long)pleaf, (long)pinternal,
-           (long)pcont);
-       (void)fprintf(stderr, "%ld cache hits, %ld cache misses\n",
-           bt_cache_hit, bt_cache_miss);
-       (void)fprintf(stderr, "%ld splits (%ld root splits, %ld sort splits)\n",
-           bt_split, bt_rootsplit, bt_sortsplit);
-       pleaf *= t->bt_psize - BTDATAOFF;
-       if (pleaf)
-               (void)fprintf(stderr,
-                   "%.0f%% leaf fill (%ld bytes used, %ld bytes free)\n",
-                   ((double)(pleaf - lfree) / pleaf) * 100,
-                   pleaf - lfree, lfree);
-       pinternal *= t->bt_psize - BTDATAOFF;
-       if (pinternal)
-               (void)fprintf(stderr,
-                   "%.0f%% internal fill (%ld bytes used, %ld bytes free\n",
-                   ((double)(pinternal - ifree) / pinternal) * 100,
-                   pinternal - ifree, ifree);
-       if (bt_pfxsaved)
-               (void)fprintf(stderr, "prefix checking removed %lu bytes.\n",
-                   bt_pfxsaved);
-}
-#endif
diff --git a/lib/nbsd_libc/db/btree/bt_delete.c b/lib/nbsd_libc/db/btree/bt_delete.c
deleted file mode 100644 (file)
index 701c8b2..0000000
+++ /dev/null
@@ -1,642 +0,0 @@
-/*     $NetBSD: bt_delete.c,v 1.17 2009/01/29 02:02:36 lukem Exp $     */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_delete.c,v 1.17 2009/01/29 02:02:36 lukem Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <db.h>
-#include "btree.h"
-
-static int __bt_bdelete(BTREE *, const DBT *);
-static int __bt_curdel(BTREE *, const DBT *, PAGE *, u_int);
-static int __bt_pdelete(BTREE *, PAGE *);
-static int __bt_relink(BTREE *, PAGE *);
-static int __bt_stkacq(BTREE *, PAGE **, CURSOR *);
-
-/*
- * __bt_delete
- *     Delete the item(s) referenced by a key.
- *
- * Return RET_SPECIAL if the key is not found.
- */
-int
-__bt_delete(const DB *dbp, const DBT *key, u_int flags)
-{
-       BTREE *t;
-       CURSOR *c;
-       PAGE *h;
-       int status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /* Check for change to a read-only tree. */
-       if (F_ISSET(t, B_RDONLY)) {
-               errno = EPERM;
-               return (RET_ERROR);
-       }
-
-       switch (flags) {
-       case 0:
-               status = __bt_bdelete(t, key);
-               break;
-       case R_CURSOR:
-               /*
-                * If flags is R_CURSOR, delete the cursor.  Must already
-                * have started a scan and not have already deleted it.
-                */
-               c = &t->bt_cursor;
-               if (F_ISSET(c, CURS_INIT)) {
-                       if (F_ISSET(c, CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE))
-                               return (RET_SPECIAL);
-                       if ((h = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL)
-                               return (RET_ERROR);
-
-                       /*
-                        * If the page is about to be emptied, we'll need to
-                        * delete it, which means we have to acquire a stack.
-                        */
-                       if (NEXTINDEX(h) == 1)
-                               if (__bt_stkacq(t, &h, &t->bt_cursor))
-                                       return (RET_ERROR);
-
-                       status = __bt_dleaf(t, NULL, h, (u_int)c->pg.index);
-
-                       if (NEXTINDEX(h) == 0 && status == RET_SUCCESS) {
-                               if (__bt_pdelete(t, h))
-                                       return (RET_ERROR);
-                       } else
-                               mpool_put(t->bt_mp, h,
-                                   (u_int)(status == RET_SUCCESS ?
-                                   MPOOL_DIRTY : 0));
-                       break;
-               }
-               /* FALLTHROUGH */
-       default:
-               errno = EINVAL;
-               return (RET_ERROR);
-       }
-       if (status == RET_SUCCESS)
-               F_SET(t, B_MODIFIED);
-       return (status);
-}
-
-/*
- * __bt_stkacq --
- *     Acquire a stack so we can delete a cursor entry.
- *
- * Parameters:
- *       t:    tree
- *      hp:    pointer to current, pinned PAGE pointer
- *       c:    pointer to the cursor
- *
- * Returns:
- *     0 on success, 1 on failure
- */
-static int
-__bt_stkacq(BTREE *t, PAGE **hp, CURSOR *c)
-{
-       BINTERNAL *bi;
-       EPG *e;
-       EPGNO *parent;
-       PAGE *h;
-       indx_t idx = 0; /* Pacify gcc */
-       pgno_t pgno;
-       recno_t nextpg, prevpg;
-       int exact, level;
-       
-       /*
-        * Find the first occurrence of the key in the tree.  Toss the
-        * currently locked page so we don't hit an already-locked page.
-        */
-       h = *hp;
-       mpool_put(t->bt_mp, h, 0);
-       if ((e = __bt_search(t, &c->key, &exact)) == NULL)
-               return (1);
-       h = e->page;
-
-       /* See if we got it in one shot. */
-       if (h->pgno == c->pg.pgno)
-               goto ret;
-
-       /*
-        * Move right, looking for the page.  At each move we have to move
-        * up the stack until we don't have to move to the next page.  If
-        * we have to change pages at an internal level, we have to fix the
-        * stack back up.
-        */
-       while (h->pgno != c->pg.pgno) {
-               if ((nextpg = h->nextpg) == P_INVALID)
-                       break;
-               mpool_put(t->bt_mp, h, 0);
-
-               /* Move up the stack. */
-               for (level = 0; (parent = BT_POP(t)) != NULL; ++level) {
-                       /* Get the parent page. */
-                       if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
-                               return (1);
-
-                       /* Move to the next index. */
-                       if (parent->index != NEXTINDEX(h) - 1) {
-                               idx = parent->index + 1;
-                               BT_PUSH(t, h->pgno, idx);
-                               break;
-                       }
-                       mpool_put(t->bt_mp, h, 0);
-               }
-
-               /* Restore the stack. */
-               while (level--) {
-                       /* Push the next level down onto the stack. */
-                       bi = GETBINTERNAL(h, idx);
-                       pgno = bi->pgno;
-                       BT_PUSH(t, pgno, 0);
-
-                       /* Lose the currently pinned page. */
-                       mpool_put(t->bt_mp, h, 0);
-
-                       /* Get the next level down. */
-                       if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL)
-                               return (1);
-                       idx = 0;
-               }
-               mpool_put(t->bt_mp, h, 0);
-               if ((h = mpool_get(t->bt_mp, nextpg, 0)) == NULL)
-                       return (1);
-       }
-
-       if (h->pgno == c->pg.pgno)
-               goto ret;
-
-       /* Reacquire the original stack. */
-       mpool_put(t->bt_mp, h, 0);
-       if ((e = __bt_search(t, &c->key, &exact)) == NULL)
-               return (1);
-       h = e->page;
-
-       /*
-        * Move left, looking for the page.  At each move we have to move
-        * up the stack until we don't have to change pages to move to the
-        * next page.  If we have to change pages at an internal level, we
-        * have to fix the stack back up.
-        */
-       while (h->pgno != c->pg.pgno) {
-               if ((prevpg = h->prevpg) == P_INVALID)
-                       break;
-               mpool_put(t->bt_mp, h, 0);
-
-               /* Move up the stack. */
-               for (level = 0; (parent = BT_POP(t)) != NULL; ++level) {
-                       /* Get the parent page. */
-                       if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
-                               return (1);
-
-                       /* Move to the next index. */
-                       if (parent->index != 0) {
-                               idx = parent->index - 1;
-                               BT_PUSH(t, h->pgno, idx);
-                               break;
-                       }
-                       mpool_put(t->bt_mp, h, 0);
-               }
-
-               /* Restore the stack. */
-               while (level--) {
-                       /* Push the next level down onto the stack. */
-                       bi = GETBINTERNAL(h, idx);
-                       pgno = bi->pgno;
-
-                       /* Lose the currently pinned page. */
-                       mpool_put(t->bt_mp, h, 0);
-
-                       /* Get the next level down. */
-                       if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL)
-                               return (1);
-
-                       idx = NEXTINDEX(h) - 1;
-                       BT_PUSH(t, pgno, idx);
-               }
-               mpool_put(t->bt_mp, h, 0);
-               if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL)
-                       return (1);
-       }
-       
-
-ret:   mpool_put(t->bt_mp, h, 0);
-       return ((*hp = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL);
-}
-
-/*
- * __bt_bdelete --
- *     Delete all key/data pairs matching the specified key.
- *
- * Parameters:
- *       t:    tree
- *     key:    key to delete
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
- */
-static int
-__bt_bdelete(BTREE *t, const DBT *key)
-{
-       EPG *e;
-       PAGE *h;
-       int deleted, exact, redo;
-
-       deleted = 0;
-
-       /* Find any matching record; __bt_search pins the page. */
-loop:  if ((e = __bt_search(t, key, &exact)) == NULL)
-               return (deleted ? RET_SUCCESS : RET_ERROR);
-       if (!exact) {
-               mpool_put(t->bt_mp, e->page, 0);
-               return (deleted ? RET_SUCCESS : RET_SPECIAL);
-       }
-
-       /*
-        * Delete forward, then delete backward, from the found key.  If
-        * there are duplicates and we reach either side of the page, do
-        * the key search again, so that we get them all.
-        */
-       redo = 0;
-       h = e->page;
-       do {
-               if (__bt_dleaf(t, key, h, (u_int)e->index)) {
-                       mpool_put(t->bt_mp, h, 0);
-                       return (RET_ERROR);
-               }
-               if (F_ISSET(t, B_NODUPS)) {
-                       if (NEXTINDEX(h) == 0) {
-                               if (__bt_pdelete(t, h))
-                                       return (RET_ERROR);
-                       } else
-                               mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-                       return (RET_SUCCESS);
-               }
-               deleted = 1;
-       } while (e->index < NEXTINDEX(h) && __bt_cmp(t, key, e) == 0);
-
-       /* Check for right-hand edge of the page. */
-       if (e->index == NEXTINDEX(h))
-               redo = 1;
-
-       /* Delete from the key to the beginning of the page. */
-       while (e->index-- > 0) {
-               if (__bt_cmp(t, key, e) != 0)
-                       break;
-               if (__bt_dleaf(t, key, h, (u_int)e->index) == RET_ERROR) {
-                       mpool_put(t->bt_mp, h, 0);
-                       return (RET_ERROR);
-               }
-               if (e->index == 0)
-                       redo = 1;
-       }
-
-       /* Check for an empty page. */
-       if (NEXTINDEX(h) == 0) {
-               if (__bt_pdelete(t, h))
-                       return (RET_ERROR);
-               goto loop;
-       }
-
-       /* Put the page. */
-       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-
-       if (redo)
-               goto loop;
-       return (RET_SUCCESS);
-}
-
-/*
- * __bt_pdelete --
- *     Delete a single page from the tree.
- *
- * Parameters:
- *     t:      tree
- *     h:      leaf page
- *
- * Returns:
- *     RET_SUCCESS, RET_ERROR.
- *
- * Side-effects:
- *     mpool_put's the page
- */
-static int
-__bt_pdelete(BTREE *t, PAGE *h)
-{
-       BINTERNAL *bi;
-       PAGE *pg;
-       EPGNO *parent;
-       indx_t cnt, idx, *ip, offset;
-       uint32_t nksize;
-       char *from;
-
-       /*
-        * Walk the parent page stack -- a LIFO stack of the pages that were
-        * traversed when we searched for the page where the delete occurred.
-        * Each stack entry is a page number and a page index offset.  The
-        * offset is for the page traversed on the search.  We've just deleted
-        * a page, so we have to delete the key from the parent page.
-        *
-        * If the delete from the parent page makes it empty, this process may
-        * continue all the way up the tree.  We stop if we reach the root page
-        * (which is never deleted, it's just not worth the effort) or if the
-        * delete does not empty the page.
-        */
-       while ((parent = BT_POP(t)) != NULL) {
-               /* Get the parent page. */
-               if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
-                       return (RET_ERROR);
-               
-               idx = parent->index;
-               bi = GETBINTERNAL(pg, idx);
-
-               /* Free any overflow pages. */
-               if (bi->flags & P_BIGKEY &&
-                   __ovfl_delete(t, bi->bytes) == RET_ERROR) {
-                       mpool_put(t->bt_mp, pg, 0);
-                       return (RET_ERROR);
-               }
-
-               /*
-                * Free the parent if it has only the one key and it's not the
-                * root page. If it's the rootpage, turn it back into an empty
-                * leaf page.
-                */
-               if (NEXTINDEX(pg) == 1) {
-                       if (pg->pgno == P_ROOT) {
-                               pg->lower = BTDATAOFF;
-                               pg->upper = t->bt_psize;
-                               pg->flags = P_BLEAF;
-                       } else {
-                               if (__bt_relink(t, pg) || __bt_free(t, pg))
-                                       return (RET_ERROR);
-                               continue;
-                       }
-               } else {
-                       /* Pack remaining key items at the end of the page. */
-                       nksize = NBINTERNAL(bi->ksize);
-                       from = (char *)(void *)pg + pg->upper;
-                       memmove(from + nksize, from,
-                       (size_t)((char *)(void *)bi - from));
-                       pg->upper += nksize;
-
-                       /* Adjust indices' offsets, shift the indices down. */
-                       offset = pg->linp[idx];
-                       for (cnt = idx, ip = &pg->linp[0]; cnt--; ++ip)
-                               if (ip[0] < offset)
-                                       ip[0] += nksize;
-                       for (cnt = NEXTINDEX(pg) - idx; --cnt; ++ip)
-                               ip[0] = ip[1] < offset ? ip[1] + nksize : ip[1];
-                       pg->lower -= sizeof(indx_t);
-               }
-
-               mpool_put(t->bt_mp, pg, MPOOL_DIRTY);
-               break;
-       }
-
-       /* Free the leaf page, as long as it wasn't the root. */
-       if (h->pgno == P_ROOT) {
-               mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-               return (RET_SUCCESS);
-       }
-       return (__bt_relink(t, h) || __bt_free(t, h));
-}
-
-/*
- * __bt_dleaf --
- *     Delete a single record from a leaf page.
- *
- * Parameters:
- *     t:      tree
- *    key:     referenced key
- *     h:      page
- *     idx:    index on page to delete
- *
- * Returns:
- *     RET_SUCCESS, RET_ERROR.
- */
-int
-__bt_dleaf(BTREE *t, const DBT *key, PAGE *h, u_int idx)
-{
-       BLEAF *bl;
-       indx_t cnt, *ip, offset;
-       uint32_t nbytes;
-       void *to;
-       char *from;
-
-       /* If this record is referenced by the cursor, delete the cursor. */
-       if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
-           !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
-           t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index == idx &&
-           __bt_curdel(t, key, h, idx))
-               return (RET_ERROR);
-
-       /* If the entry uses overflow pages, make them available for reuse. */
-       to = bl = GETBLEAF(h, idx);
-       if (bl->flags & P_BIGKEY && __ovfl_delete(t, bl->bytes) == RET_ERROR)
-               return (RET_ERROR);
-       if (bl->flags & P_BIGDATA &&
-           __ovfl_delete(t, bl->bytes + bl->ksize) == RET_ERROR)
-               return (RET_ERROR);
-
-       /* Pack the remaining key/data items at the end of the page. */
-       nbytes = NBLEAF(bl);
-       from = (char *)(void *)h + h->upper;
-       memmove(from + nbytes, from, (size_t)((char *)(void *)to - from));
-       h->upper += nbytes;
-
-       /* Adjust the indices' offsets, shift the indices down. */
-       offset = h->linp[idx];
-       for (cnt = idx, ip = &h->linp[0]; cnt--; ++ip)
-               if (ip[0] < offset)
-                       ip[0] += nbytes;
-       for (cnt = NEXTINDEX(h) - idx; --cnt; ++ip)
-               ip[0] = ip[1] < offset ? ip[1] + nbytes : ip[1];
-       h->lower -= sizeof(indx_t);
-
-       /* If the cursor is on this page, adjust it as necessary. */
-       if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
-           !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
-           t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index > idx)
-               --t->bt_cursor.pg.index;
-
-       return (RET_SUCCESS);
-}
-
-/*
- * __bt_curdel --
- *     Delete the cursor.
- *
- * Parameters:
- *     t:      tree
- *    key:     referenced key (or NULL)
- *     h:      page
- *  idx:       index on page to delete
- *
- * Returns:
- *     RET_SUCCESS, RET_ERROR.
- */
-static int
-__bt_curdel(BTREE *t, const DBT *key, PAGE *h, u_int idx)
-{
-       CURSOR *c;
-       EPG e;
-       PAGE *pg;
-       int curcopy, status;
-
-       /*
-        * If there are duplicates, move forward or backward to one.
-        * Otherwise, copy the key into the cursor area.
-        */
-       c = &t->bt_cursor;
-       F_CLR(c, CURS_AFTER | CURS_BEFORE | CURS_ACQUIRE);
-
-       curcopy = 0;
-       if (!F_ISSET(t, B_NODUPS)) {
-               /*
-                * We're going to have to do comparisons.  If we weren't
-                * provided a copy of the key, i.e. the user is deleting
-                * the current cursor position, get one.
-                */
-               if (key == NULL) {
-                       e.page = h;
-                       e.index = idx;
-                       if ((status = __bt_ret(t, &e,
-                           &c->key, &c->key, NULL, NULL, 1)) != RET_SUCCESS)
-                               return (status);
-                       curcopy = 1;
-                       key = &c->key;
-               }
-               /* Check previous key, if not at the beginning of the page. */
-               if (idx > 0) { 
-                       e.page = h;
-                       e.index = idx - 1;
-                       if (__bt_cmp(t, key, &e) == 0) {
-                               F_SET(c, CURS_BEFORE);
-                               goto dup2;
-                       }
-               }
-               /* Check next key, if not at the end of the page. */
-               if (idx < (unsigned)(NEXTINDEX(h) - 1)) {
-                       e.page = h;
-                       e.index = idx + 1;
-                       if (__bt_cmp(t, key, &e) == 0) {
-                               F_SET(c, CURS_AFTER);
-                               goto dup2;
-                       }
-               }
-               /* Check previous key if at the beginning of the page. */
-               if (idx == 0 && h->prevpg != P_INVALID) {
-                       if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL)
-                               return (RET_ERROR);
-                       e.page = pg;
-                       e.index = NEXTINDEX(pg) - 1;
-                       if (__bt_cmp(t, key, &e) == 0) {
-                               F_SET(c, CURS_BEFORE);
-                               goto dup1;
-                       }
-                       mpool_put(t->bt_mp, pg, 0);
-               }
-               /* Check next key if at the end of the page. */
-               if (idx == (unsigned)(NEXTINDEX(h) - 1) && h->nextpg != P_INVALID) {
-                       if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL)
-                               return (RET_ERROR);
-                       e.page = pg;
-                       e.index = 0;
-                       if (__bt_cmp(t, key, &e) == 0) {
-                               F_SET(c, CURS_AFTER);
-dup1:                          mpool_put(t->bt_mp, pg, 0);
-dup2:                          c->pg.pgno = e.page->pgno;
-                               c->pg.index = e.index;
-                               return (RET_SUCCESS);
-                       }
-                       mpool_put(t->bt_mp, pg, 0);
-               }
-       }
-       e.page = h;
-       e.index = idx;
-       if (curcopy || (status =
-           __bt_ret(t, &e, &c->key, &c->key, NULL, NULL, 1)) == RET_SUCCESS) {
-               F_SET(c, CURS_ACQUIRE);
-               return (RET_SUCCESS);
-       }
-       return (status);
-}
-
-/*
- * __bt_relink --
- *     Link around a deleted page.
- *
- * Parameters:
- *     t:      tree
- *     h:      page to be deleted
- */
-static int
-__bt_relink(BTREE *t, PAGE *h)
-{
-       PAGE *pg;
-
-       if (h->nextpg != P_INVALID) {
-               if ((pg = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL)
-                       return (RET_ERROR);
-               pg->prevpg = h->prevpg;
-               mpool_put(t->bt_mp, pg, MPOOL_DIRTY);
-       }
-       if (h->prevpg != P_INVALID) {
-               if ((pg = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL)
-                       return (RET_ERROR);
-               pg->nextpg = h->nextpg;
-               mpool_put(t->bt_mp, pg, MPOOL_DIRTY);
-       }
-       return (0);
-}
diff --git a/lib/nbsd_libc/db/btree/bt_get.c b/lib/nbsd_libc/db/btree/bt_get.c
deleted file mode 100644 (file)
index 772210a..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*     $NetBSD: bt_get.c,v 1.13 2008/09/11 12:58:00 joerg Exp $        */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_get.c,v 1.13 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#include <db.h>
-#include "btree.h"
-
-/*
- * __BT_GET -- Get a record from the btree.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *     key:    key to find
- *     data:   data to return
- *     flag:   currently unused
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
- */
-int
-__bt_get(const DB *dbp, const DBT *key, DBT *data, u_int flags)
-{
-       BTREE *t;
-       EPG *e;
-       int exact, status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /* Get currently doesn't take any flags. */
-       if (flags) {
-               errno = EINVAL;
-               return (RET_ERROR);
-       }
-
-       if ((e = __bt_search(t, key, &exact)) == NULL)
-               return (RET_ERROR);
-       if (!exact) {
-               mpool_put(t->bt_mp, e->page, 0);
-               return (RET_SPECIAL);
-       }
-
-       status = __bt_ret(t, e, NULL, NULL, data, &t->bt_rdata, 0);
-
-       /*
-        * If the user is doing concurrent access, we copied the
-        * key/data, toss the page.
-        */
-       if (F_ISSET(t, B_DB_LOCK))
-               mpool_put(t->bt_mp, e->page, 0);
-       else
-               t->bt_pinned = e->page;
-       return (status);
-}
diff --git a/lib/nbsd_libc/db/btree/bt_open.c b/lib/nbsd_libc/db/btree/bt_open.c
deleted file mode 100644 (file)
index b5f7158..0000000
+++ /dev/null
@@ -1,465 +0,0 @@
-/*     $NetBSD: bt_open.c,v 1.24 2008/09/11 12:58:00 joerg Exp $       */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_open.c,v 1.24 2008/09/11 12:58:00 joerg Exp $");
-
-/*
- * Implementation of btree access method for 4.4BSD.
- *
- * The design here was originally based on that of the btree access method
- * used in the Postgres database system at UC Berkeley.  This implementation
- * is wholly independent of the Postgres code.
- */
-
-#include "namespace.h"
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <paths.h>
-
-#include <db.h>
-#include "btree.h"
-
-#ifdef DEBUG
-#undef MINPSIZE
-#define        MINPSIZE        128
-#endif
-
-static int byteorder(void);
-static int nroot(BTREE *);
-static int tmp(void);
-
-/*
- * __BT_OPEN -- Open a btree.
- *
- * Creates and fills a DB struct, and calls the routine that actually
- * opens the btree.
- *
- * Parameters:
- *     fname:  filename (NULL for in-memory trees)
- *     flags:  open flag bits
- *     mode:   open permission bits
- *     b:      BTREEINFO pointer
- *
- * Returns:
- *     NULL on failure, pointer to DB on success.
- *
- */
-DB *
-__bt_open(const char *fname, int flags, mode_t mode, const BTREEINFO *openinfo,
-    int dflags)
-{
-       struct stat sb;
-       BTMETA m;
-       BTREE *t;
-       BTREEINFO b;
-       DB *dbp;
-       pgno_t ncache;
-       ssize_t nr;
-       size_t temp;
-       int machine_lorder;
-
-       t = NULL;
-
-       /*
-        * Intention is to make sure all of the user's selections are okay
-        * here and then use them without checking.  Can't be complete, since
-        * we don't know the right page size, lorder or flags until the backing
-        * file is opened.  Also, the file's page size can cause the cachesize
-        * to change.
-        */
-       machine_lorder = byteorder();
-       if (openinfo) {
-               b = *openinfo;
-
-               /* Flags: R_DUP. */
-               if (b.flags & ~(R_DUP))
-                       goto einval;
-
-               /*
-                * Page size must be indx_t aligned and >= MINPSIZE.  Default
-                * page size is set farther on, based on the underlying file
-                * transfer size.
-                */
-               if (b.psize &&
-                   (b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 ||
-                   b.psize & (sizeof(indx_t) - 1)))
-                       goto einval;
-
-               /* Minimum number of keys per page; absolute minimum is 2. */
-               if (b.minkeypage) {
-                       if (b.minkeypage < 2)
-                               goto einval;
-               } else
-                       b.minkeypage = DEFMINKEYPAGE;
-
-               /* If no comparison, use default comparison and prefix. */
-               if (b.compare == NULL) {
-                       b.compare = __bt_defcmp;
-                       if (b.prefix == NULL)
-                               b.prefix = __bt_defpfx;
-               }
-
-               if (b.lorder == 0)
-                       b.lorder = machine_lorder;
-       } else {
-               b.compare = __bt_defcmp;
-               b.cachesize = 0;
-               b.flags = 0;
-               b.lorder = machine_lorder;
-               b.minkeypage = DEFMINKEYPAGE;
-               b.prefix = __bt_defpfx;
-               b.psize = 0;
-       }
-
-       /* Check for the ubiquitous PDP-11. */
-       if (b.lorder != BIG_ENDIAN && b.lorder != LITTLE_ENDIAN)
-               goto einval;
-
-       /* Allocate and initialize DB and BTREE structures. */
-       if ((t = (BTREE *)malloc(sizeof(BTREE))) == NULL)
-               goto err;
-       memset(t, 0, sizeof(BTREE));
-       t->bt_fd = -1;                  /* Don't close unopened fd on error. */
-       t->bt_lorder = b.lorder;
-       t->bt_order = NOT;
-       t->bt_cmp = b.compare;
-       t->bt_pfx = b.prefix;
-       t->bt_rfd = -1;
-
-       if ((t->bt_dbp = dbp = (DB *)malloc(sizeof(DB))) == NULL)
-               goto err;
-       memset(t->bt_dbp, 0, sizeof(DB));
-       if (t->bt_lorder != machine_lorder)
-               F_SET(t, B_NEEDSWAP);
-
-       dbp->type = DB_BTREE;
-       dbp->internal = t;
-       dbp->close = __bt_close;
-       dbp->del = __bt_delete;
-       dbp->fd = __bt_fd;
-       dbp->get = __bt_get;
-       dbp->put = __bt_put;
-       dbp->seq = __bt_seq;
-       dbp->sync = __bt_sync;
-
-       /*
-        * If no file name was supplied, this is an in-memory btree and we
-        * open a backing temporary file.  Otherwise, it's a disk-based tree.
-        */
-       if (fname) {
-               switch (flags & O_ACCMODE) {
-               case O_RDONLY:
-                       F_SET(t, B_RDONLY);
-                       break;
-               case O_RDWR:
-                       break;
-               case O_WRONLY:
-               default:
-                       goto einval;
-               }
-               
-               if ((t->bt_fd = open(fname, flags, mode)) == -1)
-                       goto err;
-               if (fcntl(t->bt_fd, F_SETFD, FD_CLOEXEC) == -1)
-                       goto err;
-       } else {
-               if ((flags & O_ACCMODE) != O_RDWR)
-                       goto einval;
-               if ((t->bt_fd = tmp()) == -1)
-                       goto err;
-               F_SET(t, B_INMEM);
-       }
-
-       if (fcntl(t->bt_fd, F_SETFD, FD_CLOEXEC) == -1)
-               goto err;
-
-       if (fstat(t->bt_fd, &sb))
-               goto err;
-       if (sb.st_size) {
-               if ((nr = read(t->bt_fd, &m, sizeof(BTMETA))) < 0)
-                       goto err;
-               if (nr != sizeof(BTMETA))
-                       goto eftype;
-
-               /*
-                * Read in the meta-data.  This can change the notion of what
-                * the lorder, page size and flags are, and, when the page size
-                * changes, the cachesize value can change too.  If the user
-                * specified the wrong byte order for an existing database, we
-                * don't bother to return an error, we just clear the NEEDSWAP
-                * bit.
-                */
-               if (m.magic == BTREEMAGIC)
-                       F_CLR(t, B_NEEDSWAP);
-               else {
-                       F_SET(t, B_NEEDSWAP);
-                       M_32_SWAP(m.magic);
-                       M_32_SWAP(m.version);
-                       M_32_SWAP(m.psize);
-                       M_32_SWAP(m.free);
-                       M_32_SWAP(m.nrecs);
-                       M_32_SWAP(m.flags);
-               }
-               if (m.magic != BTREEMAGIC || m.version != BTREEVERSION)
-                       goto eftype;
-               if (m.psize < MINPSIZE || m.psize > MAX_PAGE_OFFSET + 1 ||
-                   m.psize & (sizeof(indx_t) - 1))
-                       goto eftype;
-               if (m.flags & ~SAVEMETA)
-                       goto eftype;
-               b.psize = m.psize;
-               F_SET(t, m.flags);
-               t->bt_free = m.free;
-               t->bt_nrecs = m.nrecs;
-       } else {
-               /*
-                * Set the page size to the best value for I/O to this file.
-                * Don't overflow the page offset type.
-                */
-               if (b.psize == 0) {
-#ifdef __minix
-                       if (sb.st_blksize == 0) {
-                               /* 0 in 2 cases: upgrade from old to new struct stat or
-                                * there is a bug in underlying fs.
-                                */
-                               b.psize = MINIX_ST_BLKSIZE;
-                       } else
-#endif
-                               b.psize = sb.st_blksize;
-
-                       if (b.psize < MINPSIZE)
-                               b.psize = MINPSIZE;
-                       if (b.psize > MAX_PAGE_OFFSET + 1)
-                               b.psize = MAX_PAGE_OFFSET + 1;
-               }
-
-               /* Set flag if duplicates permitted. */
-               if (!(b.flags & R_DUP))
-                       F_SET(t, B_NODUPS);
-
-               t->bt_free = P_INVALID;
-               t->bt_nrecs = 0;
-               F_SET(t, B_METADIRTY);
-       }
-
-       t->bt_psize = b.psize;
-
-       /* Set the cache size; must be a multiple of the page size. */
-       if (b.cachesize && b.cachesize & (b.psize - 1))
-               b.cachesize += (~b.cachesize & (b.psize - 1)) + 1;
-       if (b.cachesize < b.psize * MINCACHE)
-               b.cachesize = b.psize * MINCACHE;
-
-       /* Calculate number of pages to cache. */
-       ncache = (b.cachesize + t->bt_psize - 1) / t->bt_psize;
-
-       /*
-        * The btree data structure requires that at least two keys can fit on
-        * a page, but other than that there's no fixed requirement.  The user
-        * specified a minimum number per page, and we translated that into the
-        * number of bytes a key/data pair can use before being placed on an
-        * overflow page.  This calculation includes the page header, the size
-        * of the index referencing the leaf item and the size of the leaf item
-        * structure.  Also, don't let the user specify a minkeypage such that
-        * a key/data pair won't fit even if both key and data are on overflow
-        * pages.
-        */
-       temp = (t->bt_psize - BTDATAOFF) / b.minkeypage -
-           (sizeof(indx_t) + NBLEAFDBT(0, 0));
-       _DBFIT(temp, indx_t);
-       t->bt_ovflsize = (indx_t)temp;
-       if (t->bt_ovflsize < NBLEAFDBT(NOVFLSIZE, NOVFLSIZE) + sizeof(indx_t))
-               t->bt_ovflsize =
-                   NBLEAFDBT(NOVFLSIZE, NOVFLSIZE) + sizeof(indx_t);
-
-       /* Initialize the buffer pool. */
-       if ((t->bt_mp =
-           mpool_open(NULL, t->bt_fd, t->bt_psize, ncache)) == NULL)
-               goto err;
-       if (!F_ISSET(t, B_INMEM))
-               mpool_filter(t->bt_mp, __bt_pgin, __bt_pgout, t);
-
-       /* Create a root page if new tree. */
-       if (nroot(t) == RET_ERROR)
-               goto err;
-
-       /* Global flags. */
-       if (dflags & DB_LOCK)
-               F_SET(t, B_DB_LOCK);
-       if (dflags & DB_SHMEM)
-               F_SET(t, B_DB_SHMEM);
-       if (dflags & DB_TXN)
-               F_SET(t, B_DB_TXN);
-
-       return (dbp);
-
-einval:        errno = EINVAL;
-       goto err;
-
-eftype:        errno = EFTYPE;
-       goto err;
-
-err:   if (t) {
-               if (t->bt_dbp)
-                       free(t->bt_dbp);
-               if (t->bt_fd != -1)
-                       (void)close(t->bt_fd);
-               free(t);
-       }
-       return (NULL);
-}
-
-/*
- * NROOT -- Create the root of a new tree.
- *
- * Parameters:
- *     t:      tree
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-static int
-nroot(BTREE *t)
-{
-       PAGE *meta, *root;
-       pgno_t npg;
-
-       if ((meta = mpool_get(t->bt_mp, 0, 0)) != NULL) {
-               mpool_put(t->bt_mp, meta, 0);
-               return (RET_SUCCESS);
-       }
-       if (errno != EINVAL)            /* It's OK to not exist. */
-               return (RET_ERROR);
-       errno = 0;
-
-       if ((meta = mpool_new(t->bt_mp, &npg)) == NULL)
-               return (RET_ERROR);
-
-       if ((root = mpool_new(t->bt_mp, &npg)) == NULL)
-               return (RET_ERROR);
-
-       if (npg != P_ROOT)
-               return (RET_ERROR);
-       root->pgno = npg;
-       root->prevpg = root->nextpg = P_INVALID;
-       root->lower = BTDATAOFF;
-       root->upper = t->bt_psize;
-       root->flags = P_BLEAF;
-       memset(meta, 0, t->bt_psize);
-       mpool_put(t->bt_mp, meta, MPOOL_DIRTY);
-       mpool_put(t->bt_mp, root, MPOOL_DIRTY);
-       return (RET_SUCCESS);
-}
-
-static int
-tmp(void)
-{
-       sigset_t set, oset;
-       size_t len;
-       int fd;
-       char *envtmp;
-       char path[PATH_MAX];
-
-       if (issetugid())
-               envtmp = NULL;
-       else
-               envtmp = getenv("TMPDIR");
-
-       len = snprintf(path,
-           sizeof(path), "%s/bt.XXXXXX", envtmp ? envtmp : _PATH_TMP);
-       if (len >= sizeof(path))
-               return -1;
-       
-       (void)sigfillset(&set);
-       (void)sigprocmask(SIG_BLOCK, &set, &oset);
-       if ((fd = mkstemp(path)) != -1) {
-               (void)unlink(path);
-               (void)fcntl(fd, F_SETFD, FD_CLOEXEC);
-       }
-       (void)sigprocmask(SIG_SETMASK, &oset, NULL);
-       return(fd);
-}
-
-static int
-byteorder(void)
-{
-       uint32_t x;
-       uint8_t *p;
-
-       x = 0x01020304;
-       p = (uint8_t *)(void *)&x;
-       switch (*p) {
-       case 1:
-               return (BIG_ENDIAN);
-       case 4:
-               return (LITTLE_ENDIAN);
-       default:
-               return (0);
-       }
-}
-
-int
-__bt_fd(const DB *dbp)
-{
-       BTREE *t;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /* In-memory database can't have a file descriptor. */
-       if (F_ISSET(t, B_INMEM)) {
-               errno = ENOENT;
-               return (-1);
-       }
-       return (t->bt_fd);
-}
diff --git a/lib/nbsd_libc/db/btree/bt_overflow.c b/lib/nbsd_libc/db/btree/bt_overflow.c
deleted file mode 100644 (file)
index 9654804..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-/*     $NetBSD: bt_overflow.c,v 1.16 2008/09/11 12:58:00 joerg Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_overflow.c,v 1.16 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <db.h>
-#include "btree.h"
-
-/*
- * Big key/data code.
- *
- * Big key and data entries are stored on linked lists of pages.  The initial
- * reference is byte string stored with the key or data and is the page number
- * and size.  The actual record is stored in a chain of pages linked by the
- * nextpg field of the PAGE header.
- *
- * The first page of the chain has a special property.  If the record is used
- * by an internal page, it cannot be deleted and the P_PRESERVE bit will be set
- * in the header.
- *
- * XXX
- * A single DBT is written to each chain, so a lot of space on the last page
- * is wasted.  This is a fairly major bug for some data sets.
- */
-
-/*
- * __OVFL_GET -- Get an overflow key/data item.
- *
- * Parameters:
- *     t:      tree
- *     p:      pointer to { pgno_t, uint32_t }
- *     buf:    storage address
- *     bufsz:  storage size
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__ovfl_get(BTREE *t, void *p, size_t *ssz, void **buf, size_t *bufsz)
-{
-       PAGE *h;
-       pgno_t pg;
-       uint32_t sz, nb, plen;
-       size_t temp;
-
-       memmove(&pg, p, sizeof(pgno_t));
-       memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(uint32_t));
-       *ssz = sz;
-
-#ifdef DEBUG
-       if (pg == P_INVALID || sz == 0)
-               abort();
-#endif
-       /* Make the buffer bigger as necessary. */
-       if (*bufsz < sz) {
-               *buf = (char *)(*buf == NULL ? malloc(sz) : realloc(*buf, sz));
-               if (*buf == NULL)
-                       return (RET_ERROR);
-               *bufsz = sz;
-       }
-
-       /*
-        * Step through the linked list of pages, copying the data on each one
-        * into the buffer.  Never copy more than the data's length.
-        */
-       temp = t->bt_psize - BTDATAOFF;
-       _DBFIT(temp, uint32_t);
-       plen = (uint32_t)temp;
-       for (p = *buf;; p = (char *)p + nb, pg = h->nextpg) {
-               if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                       return (RET_ERROR);
-
-               nb = MIN(sz, plen);
-               memmove(p, (char *)(void *)h + BTDATAOFF, nb);
-               mpool_put(t->bt_mp, h, 0);
-
-               if ((sz -= nb) == 0)
-                       break;
-       }
-       return (RET_SUCCESS);
-}
-
-/*
- * __OVFL_PUT -- Store an overflow key/data item.
- *
- * Parameters:
- *     t:      tree
- *     data:   DBT to store
- *     pgno:   storage page number
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__ovfl_put(BTREE *t, const DBT *dbt, pgno_t *pg)
-{
-       PAGE *h, *last;
-       void *p;
-       pgno_t npg;
-       uint32_t sz, nb, plen;
-       size_t temp;
-
-       /*
-        * Allocate pages and copy the key/data record into them.  Store the
-        * number of the first page in the chain.
-        */
-       temp = t->bt_psize - BTDATAOFF;
-       _DBFIT(temp, uint32_t);
-       plen = (uint32_t)temp;
-       last = NULL;
-       p = dbt->data;
-       temp = dbt->size;
-       _DBFIT(temp, uint32_t);
-       sz = temp;
-       for (;; p = (char *)p + plen, last = h) {
-               if ((h = __bt_new(t, &npg)) == NULL)
-                       return (RET_ERROR);
-
-               h->pgno = npg;
-               h->nextpg = h->prevpg = P_INVALID;
-               h->flags = P_OVERFLOW;
-               h->lower = h->upper = 0;
-
-               nb = MIN(sz, plen);
-               (void)memmove((char *)(void *)h + BTDATAOFF, p, (size_t)nb);
-
-               if (last) {
-                       last->nextpg = h->pgno;
-                       mpool_put(t->bt_mp, last, MPOOL_DIRTY);
-               } else
-                       *pg = h->pgno;
-
-               if ((sz -= nb) == 0) {
-                       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-                       break;
-               }
-       }
-       return (RET_SUCCESS);
-}
-
-/*
- * __OVFL_DELETE -- Delete an overflow chain.
- *
- * Parameters:
- *     t:      tree
- *     p:      pointer to { pgno_t, uint32_t }
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__ovfl_delete(BTREE *t, void *p)
-{
-       PAGE *h;
-       pgno_t pg;
-       uint32_t sz, plen;
-       size_t temp;
-
-       (void)memmove(&pg, p, sizeof(pgno_t));
-       (void)memmove(&sz, (char *)p + sizeof(pgno_t), sizeof(uint32_t));
-
-#ifdef DEBUG
-       if (pg == P_INVALID || sz == 0)
-               abort();
-#endif
-       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-               return (RET_ERROR);
-
-       /* Don't delete chains used by internal pages. */
-       if (h->flags & P_PRESERVE) {
-               mpool_put(t->bt_mp, h, 0);
-               return (RET_SUCCESS);
-       }
-
-       /* Step through the chain, calling the free routine for each page. */
-       temp = t->bt_psize - BTDATAOFF;
-       _DBFIT(temp, uint32_t);
-       plen = (uint32_t)temp;
-       for (;; sz -= plen) {
-               pg = h->nextpg;
-               __bt_free(t, h);
-               if (sz <= plen)
-                       break;
-               if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                       return (RET_ERROR);
-       }
-       return (RET_SUCCESS);
-}
diff --git a/lib/nbsd_libc/db/btree/bt_page.c b/lib/nbsd_libc/db/btree/bt_page.c
deleted file mode 100644 (file)
index 0db4aeb..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*     $NetBSD: bt_page.c,v 1.13 2008/09/11 12:58:00 joerg Exp $       */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_page.c,v 1.13 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <db.h>
-#include "btree.h"
-
-/*
- * __bt_free --
- *     Put a page on the freelist.
- *
- * Parameters:
- *     t:      tree
- *     h:      page to free
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- *
- * Side-effect:
- *     mpool_put's the page.
- */
-int
-__bt_free(BTREE *t, PAGE *h)
-{
-       /* Insert the page at the head of the free list. */
-       h->prevpg = P_INVALID;
-       h->nextpg = t->bt_free;
-       t->bt_free = h->pgno;
-       F_SET(t, B_METADIRTY);
-
-       /* Make sure the page gets written back. */
-       return (mpool_put(t->bt_mp, h, MPOOL_DIRTY));
-}
-
-/*
- * __bt_new --
- *     Get a new page, preferably from the freelist.
- *
- * Parameters:
- *     t:      tree
- *     npg:    storage for page number.
- *
- * Returns:
- *     Pointer to a page, NULL on error.
- */
-PAGE *
-__bt_new(BTREE *t, pgno_t *npg)
-{
-       PAGE *h;
-
-       if (t->bt_free != P_INVALID &&
-           (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
-               *npg = t->bt_free;
-               t->bt_free = h->nextpg;
-               F_SET(t, B_METADIRTY);
-               return (h);
-       }
-       return (mpool_new(t->bt_mp, npg));
-}
diff --git a/lib/nbsd_libc/db/btree/bt_put.c b/lib/nbsd_libc/db/btree/bt_put.c
deleted file mode 100644 (file)
index 37630b8..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-/*     $NetBSD: bt_put.c,v 1.19 2009/02/12 06:40:14 lukem Exp $        */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_put.c,v 1.19 2009/02/12 06:40:14 lukem Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <db.h>
-#include "btree.h"
-
-static EPG *bt_fast(BTREE *, const DBT *, const DBT *, int *);
-
-/*
- * __BT_PUT -- Add a btree item to the tree.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *     key:    key
- *     data:   data
- *     flag:   R_NOOVERWRITE
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key is already in the
- *     tree and R_NOOVERWRITE specified.
- */
-int
-__bt_put(const DB *dbp, DBT *key, const DBT *data, u_int flags)
-{
-       BTREE *t;
-       DBT tkey, tdata;
-       EPG *e = NULL; /* pacify gcc */
-       PAGE *h;
-       indx_t idx, nxtindex;
-       pgno_t pg;
-       uint32_t nbytes, temp;
-       int dflags, exact, status;
-       char *dest, db[NOVFLSIZE], kb[NOVFLSIZE];
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /* Check for change to a read-only tree. */
-       if (F_ISSET(t, B_RDONLY)) {
-               errno = EPERM;
-               return (RET_ERROR);
-       }
-
-       switch (flags) {
-       case 0:
-       case R_NOOVERWRITE:
-               break;
-       case R_CURSOR:
-               /*
-                * If flags is R_CURSOR, put the cursor.  Must already
-                * have started a scan and not have already deleted it.
-                */
-               if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
-                   !F_ISSET(&t->bt_cursor,
-                       CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE))
-                       break;
-               /* FALLTHROUGH */
-       default:
-               errno = EINVAL;
-               return (RET_ERROR);
-       }
-
-       /*
-        * If the key/data pair won't fit on a page, store it on overflow
-        * pages.  Only put the key on the overflow page if the pair are
-        * still too big after moving the data to an overflow page.
-        *
-        * XXX
-        * If the insert fails later on, the overflow pages aren't recovered.
-        */
-       dflags = 0;
-       if (key->size + data->size > t->bt_ovflsize) {
-               if (key->size > t->bt_ovflsize) {
-storekey:              if (__ovfl_put(t, key, &pg) == RET_ERROR)
-                               return (RET_ERROR);
-                       tkey.data = kb;
-                       tkey.size = NOVFLSIZE;
-                       memmove(kb, &pg, sizeof(pgno_t));
-                       memmove(kb + sizeof(pgno_t),
-                           &key->size, sizeof(uint32_t));
-                       dflags |= P_BIGKEY;
-                       key = &tkey;
-               }
-               if (key->size + data->size > t->bt_ovflsize) {
-                       if (__ovfl_put(t, data, &pg) == RET_ERROR)
-                               return (RET_ERROR);
-                       tdata.data = db;
-                       tdata.size = NOVFLSIZE;
-                       memmove(db, &pg, sizeof(pgno_t));
-                       _DBFIT(data->size, uint32_t);
-                       temp = (uint32_t)data->size;
-                       (void)memmove(db + sizeof(pgno_t),
-                           &temp, sizeof(uint32_t));
-                       dflags |= P_BIGDATA;
-                       data = &tdata;
-               }
-               if (key->size + data->size > t->bt_ovflsize)
-                       goto storekey;
-       }
-
-       /* Replace the cursor. */
-       if (flags == R_CURSOR) {
-               if ((h = mpool_get(t->bt_mp, t->bt_cursor.pg.pgno, 0)) == NULL)
-                       return (RET_ERROR);
-               idx = t->bt_cursor.pg.index;
-               goto delete;
-       }
-
-       /*
-        * Find the key to delete, or, the location at which to insert.
-        * Bt_fast and __bt_search both pin the returned page.
-        */
-       if (t->bt_order == NOT || (e = bt_fast(t, key, data, &exact)) == NULL)
-               if ((e = __bt_search(t, key, &exact)) == NULL)
-                       return (RET_ERROR);
-       h = e->page;
-       idx = e->index;
-
-       /*
-        * Add the key/data pair to the tree.  If an identical key is already
-        * in the tree, and R_NOOVERWRITE is set, an error is returned.  If
-        * R_NOOVERWRITE is not set, the key is either added (if duplicates are
-        * permitted) or an error is returned.
-        */
-       switch (flags) {
-       case R_NOOVERWRITE:
-               if (!exact)
-                       break;
-               mpool_put(t->bt_mp, h, 0);
-               return (RET_SPECIAL);
-       default:
-               if (!exact || !F_ISSET(t, B_NODUPS))
-                       break;
-               /*
-                * !!!
-                * Note, the delete may empty the page, so we need to put a
-                * new entry into the page immediately.
-                */
-delete:                if (__bt_dleaf(t, key, h, (u_int)idx) == RET_ERROR) {
-                       mpool_put(t->bt_mp, h, 0);
-                       return (RET_ERROR);
-               }
-               break;
-       }
-
-       /*
-        * If not enough room, or the user has put a ceiling on the number of
-        * keys permitted in the page, split the page.  The split code will
-        * insert the key and data and unpin the current page.  If inserting
-        * into the offset array, shift the pointers up.
-        */
-       nbytes = NBLEAFDBT(key->size, data->size);
-       if ((uint32_t)h->upper - (uint32_t)h->lower < nbytes + sizeof(indx_t)) {
-               if ((status = __bt_split(t, h, key,
-                   data, dflags, nbytes, (u_int)idx)) != RET_SUCCESS)
-                       return (status);
-               goto success;
-       }
-
-       if (idx < (nxtindex = NEXTINDEX(h)))
-               memmove(h->linp + idx + 1, h->linp + idx,
-                   (nxtindex - idx) * sizeof(indx_t));
-       h->lower += sizeof(indx_t);
-
-       h->linp[idx] = h->upper -= nbytes;
-       dest = (char *)(void *)h + h->upper;
-       WR_BLEAF(dest, key, data, dflags);
-
-       /* If the cursor is on this page, adjust it as necessary. */
-       if (F_ISSET(&t->bt_cursor, CURS_INIT) &&
-           !F_ISSET(&t->bt_cursor, CURS_ACQUIRE) &&
-           t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= idx)
-               ++t->bt_cursor.pg.index;
-
-       if (t->bt_order == NOT) {
-               if (h->nextpg == P_INVALID) {
-                       if (idx == NEXTINDEX(h) - 1) {
-                               t->bt_order = FORWARD;
-                               t->bt_last.index = idx;
-                               t->bt_last.pgno = h->pgno;
-                       }
-               } else if (h->prevpg == P_INVALID) {
-                       if (idx == 0) {
-                               t->bt_order = BACK;
-                               t->bt_last.index = 0;
-                               t->bt_last.pgno = h->pgno;
-                       }
-               }
-       }
-
-       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-
-success:
-       if (flags == R_SETCURSOR)
-               __bt_setcur(t, e->page->pgno, (u_int)e->index);
-
-       F_SET(t, B_MODIFIED);
-       return (RET_SUCCESS);
-}
-
-#ifdef STATISTICS
-unsigned long bt_cache_hit, bt_cache_miss;
-#endif
-
-/*
- * BT_FAST -- Do a quick check for sorted data.
- *
- * Parameters:
- *     t:      tree
- *     key:    key to insert
- *
- * Returns:
- *     EPG for new record or NULL if not found.
- */
-static EPG *
-bt_fast(BTREE *t, const DBT *key, const DBT *data, int *exactp)
-{
-       PAGE *h;
-       uint32_t nbytes;
-       int cmp;
-
-       if ((h = mpool_get(t->bt_mp, t->bt_last.pgno, 0)) == NULL) {
-               t->bt_order = NOT;
-               return (NULL);
-       }
-       t->bt_cur.page = h;
-       t->bt_cur.index = t->bt_last.index;
-
-       /*
-        * If won't fit in this page or have too many keys in this page,
-        * have to search to get split stack.
-        */
-       nbytes = NBLEAFDBT(key->size, data->size);
-       if ((uint32_t)h->upper - (uint32_t)h->lower < nbytes + sizeof(indx_t))
-               goto miss;
-
-       if (t->bt_order == FORWARD) {
-               if (t->bt_cur.page->nextpg != P_INVALID)
-                       goto miss;
-               if (t->bt_cur.index != NEXTINDEX(h) - 1)
-                       goto miss;
-               if ((cmp = __bt_cmp(t, key, &t->bt_cur)) < 0)
-                       goto miss;
-               t->bt_last.index = cmp ? ++t->bt_cur.index : t->bt_cur.index;
-       } else {
-               if (t->bt_cur.page->prevpg != P_INVALID)
-                       goto miss;
-               if (t->bt_cur.index != 0)
-                       goto miss;
-               if ((cmp = __bt_cmp(t, key, &t->bt_cur)) > 0)
-                       goto miss;
-               t->bt_last.index = 0;
-       }
-       *exactp = cmp == 0;
-#ifdef STATISTICS
-       ++bt_cache_hit;
-#endif
-       return (&t->bt_cur);
-
-miss:
-#ifdef STATISTICS
-       ++bt_cache_miss;
-#endif
-       t->bt_order = NOT;
-       mpool_put(t->bt_mp, h, 0);
-       return (NULL);
-}
diff --git a/lib/nbsd_libc/db/btree/bt_search.c b/lib/nbsd_libc/db/btree/bt_search.c
deleted file mode 100644 (file)
index 00da7c9..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*     $NetBSD: bt_search.c,v 1.17 2008/09/11 12:58:00 joerg Exp $     */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_search.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <stdio.h>
-
-#include <db.h>
-#include "btree.h"
-
-static int __bt_snext(BTREE *, PAGE *, const DBT *, int *);
-static int __bt_sprev(BTREE *, PAGE *, const DBT *, int *);
-
-/*
- * __bt_search --
- *     Search a btree for a key.
- *
- * Parameters:
- *     t:      tree to search
- *     key:    key to find
- *     exactp: pointer to exact match flag
- *
- * Returns:
- *     The EPG for matching record, if any, or the EPG for the location
- *     of the key, if it were inserted into the tree, is entered into
- *     the bt_cur field of the tree.  A pointer to the field is returned.
- */
-EPG *
-__bt_search(BTREE *t, const DBT *key, int *exactp)
-{
-       PAGE *h;
-       indx_t base, idx, lim;
-       pgno_t pg;
-       int cmp;
-
-       BT_CLR(t);
-       for (pg = P_ROOT;;) {
-               if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                       return (NULL);
-
-               /* Do a binary search on the current page. */
-               t->bt_cur.page = h;
-               for (base = 0, lim = NEXTINDEX(h); lim; lim >>= 1) {
-                       t->bt_cur.index = idx = base + ((uint32_t)lim >> 1);
-                       if ((cmp = __bt_cmp(t, key, &t->bt_cur)) == 0) {
-                               if (h->flags & P_BLEAF) {
-                                       *exactp = 1;
-                                       return (&t->bt_cur);
-                               }
-                               goto next;
-                       }
-                       if (cmp > 0) {
-                               base = idx + 1;
-                               --lim;
-                       }
-               }
-
-               /*
-                * If it's a leaf page, we're almost done.  If no duplicates
-                * are allowed, or we have an exact match, we're done.  Else,
-                * it's possible that there were matching keys on this page,
-                * which later deleted, and we're on a page with no matches
-                * while there are matches on other pages.  If at the start or
-                * end of a page, check the adjacent page.
-                */
-               if (h->flags & P_BLEAF) {
-                       if (!F_ISSET(t, B_NODUPS)) {
-                               if (base == 0 &&
-                                   h->prevpg != P_INVALID &&
-                                   __bt_sprev(t, h, key, exactp))
-                                       return (&t->bt_cur);
-                               if (base == NEXTINDEX(h) &&
-                                   h->nextpg != P_INVALID &&
-                                   __bt_snext(t, h, key, exactp))
-                                       return (&t->bt_cur);
-                       }
-                       *exactp = 0;
-                       t->bt_cur.index = base;
-                       return (&t->bt_cur);
-               }
-
-               /*
-                * No match found.  Base is the smallest index greater than
-                * key and may be zero or a last + 1 index.  If it's non-zero,
-                * decrement by one, and record the internal page which should
-                * be a parent page for the key.  If a split later occurs, the
-                * inserted page will be to the right of the saved page.
-                */
-               idx = base ? base - 1 : base;
-
-next:          BT_PUSH(t, h->pgno, idx);
-               pg = GETBINTERNAL(h, idx)->pgno;
-               mpool_put(t->bt_mp, h, 0);
-       }
-}
-
-/*
- * __bt_snext --
- *     Check for an exact match after the key.
- *
- * Parameters:
- *     t:      tree
- *     h:      current page
- *     key:    key
- *     exactp: pointer to exact match flag
- *
- * Returns:
- *     If an exact match found.
- */
-static int
-__bt_snext(BTREE *t, PAGE *h, const DBT *key, int *exactp)
-{
-       EPG e;
-
-       /*
-        * Get the next page.  The key is either an exact
-        * match, or not as good as the one we already have.
-        */
-       if ((e.page = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL)
-               return (0);
-       e.index = 0;
-       if (__bt_cmp(t, key, &e) == 0) {
-               mpool_put(t->bt_mp, h, 0);
-               t->bt_cur = e;
-               *exactp = 1;
-               return (1);
-       }
-       mpool_put(t->bt_mp, e.page, 0);
-       return (0);
-}
-
-/*
- * __bt_sprev --
- *     Check for an exact match before the key.
- *
- * Parameters:
- *     t:      tree
- *     h:      current page
- *     key:    key
- *     exactp: pointer to exact match flag
- *
- * Returns:
- *     If an exact match found.
- */
-static int
-__bt_sprev(BTREE *t, PAGE *h, const DBT *key, int *exactp)
-{
-       EPG e;
-
-       /*
-        * Get the previous page.  The key is either an exact
-        * match, or not as good as the one we already have.
-        */
-       if ((e.page = mpool_get(t->bt_mp, h->prevpg, 0)) == NULL)
-               return (0);
-       e.index = NEXTINDEX(e.page) - 1;
-       if (__bt_cmp(t, key, &e) == 0) {
-               mpool_put(t->bt_mp, h, 0);
-               t->bt_cur = e;
-               *exactp = 1;
-               return (1);
-       }
-       mpool_put(t->bt_mp, e.page, 0);
-       return (0);
-}
diff --git a/lib/nbsd_libc/db/btree/bt_seq.c b/lib/nbsd_libc/db/btree/bt_seq.c
deleted file mode 100644 (file)
index 58f25a0..0000000
+++ /dev/null
@@ -1,442 +0,0 @@
-/*     $NetBSD: bt_seq.c,v 1.17 2008/09/11 12:58:00 joerg Exp $        */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_seq.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <db.h>
-#include "btree.h"
-
-static int __bt_first(BTREE *, const DBT *, EPG *, int *);
-static int __bt_seqadv(BTREE *, EPG *, int);
-static int __bt_seqset(BTREE *, EPG *, DBT *, int);
-
-/*
- * Sequential scan support.
- *
- * The tree can be scanned sequentially, starting from either end of the
- * tree or from any specific key.  A scan request before any scanning is
- * done is initialized as starting from the least node.
- */
-
-/*
- * __bt_seq --
- *     Btree sequential scan interface.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *     key:    key for positioning and return value
- *     data:   data return value
- *     flags:  R_CURSOR, R_FIRST, R_LAST, R_NEXT, R_PREV.
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
- */
-int
-__bt_seq(const DB *dbp, DBT *key, DBT *data, u_int flags)
-{
-       BTREE *t;
-       EPG e;
-       int status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /*
-        * If scan unitialized as yet, or starting at a specific record, set
-        * the scan to a specific key.  Both __bt_seqset and __bt_seqadv pin
-        * the page the cursor references if they're successful.
-        */
-       switch (flags) {
-       case R_NEXT:
-       case R_PREV:
-               if (F_ISSET(&t->bt_cursor, CURS_INIT)) {
-                       status = __bt_seqadv(t, &e, (int)flags);
-                       break;
-               }
-               /* FALLTHROUGH */
-       case R_FIRST:
-       case R_LAST:
-       case R_CURSOR:
-               status = __bt_seqset(t, &e, key, (int)flags);
-               break;
-       default:
-               errno = EINVAL;
-               return (RET_ERROR);
-       }
-
-       if (status == RET_SUCCESS) {
-               __bt_setcur(t, e.page->pgno, (u_int)e.index);
-
-               status =
-                   __bt_ret(t, &e, key, &t->bt_rkey, data, &t->bt_rdata, 0);
-
-               /*
-                * If the user is doing concurrent access, we copied the
-                * key/data, toss the page.
-                */
-               if (F_ISSET(t, B_DB_LOCK))
-                       mpool_put(t->bt_mp, e.page, 0);
-               else
-                       t->bt_pinned = e.page;
-       }
-       return (status);
-}
-
-/*
- * __bt_seqset --
- *     Set the sequential scan to a specific key.
- *
- * Parameters:
- *     t:      tree
- *     ep:     storage for returned key
- *     key:    key for initial scan position
- *     flags:  R_CURSOR, R_FIRST, R_LAST, R_NEXT, R_PREV
- *
- * Side effects:
- *     Pins the page the cursor references.
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
- */
-static int
-__bt_seqset(BTREE *t, EPG *ep, DBT *key, int flags)
-{
-       PAGE *h;
-       pgno_t pg;
-       int exact;
-
-       /*
-        * Find the first, last or specific key in the tree and point the
-        * cursor at it.  The cursor may not be moved until a new key has
-        * been found.
-        */
-       switch (flags) {
-       case R_CURSOR:                          /* Keyed scan. */
-               /*
-                * Find the first instance of the key or the smallest key
-                * which is greater than or equal to the specified key.
-                */
-               if (key->data == NULL || key->size == 0) {
-                       errno = EINVAL;
-                       return (RET_ERROR);
-               }
-               return (__bt_first(t, key, ep, &exact));
-       case R_FIRST:                           /* First record. */
-       case R_NEXT:
-               /* Walk down the left-hand side of the tree. */
-               for (pg = P_ROOT;;) {
-                       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                               return (RET_ERROR);
-
-                       /* Check for an empty tree. */
-                       if (NEXTINDEX(h) == 0) {
-                               mpool_put(t->bt_mp, h, 0);
-                               return (RET_SPECIAL);
-                       }
-
-                       if (h->flags & (P_BLEAF | P_RLEAF))
-                               break;
-                       pg = GETBINTERNAL(h, 0)->pgno;
-                       mpool_put(t->bt_mp, h, 0);
-               }
-               ep->page = h;
-               ep->index = 0;
-               break;
-       case R_LAST:                            /* Last record. */
-       case R_PREV:
-               /* Walk down the right-hand side of the tree. */
-               for (pg = P_ROOT;;) {
-                       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                               return (RET_ERROR);
-
-                       /* Check for an empty tree. */
-                       if (NEXTINDEX(h) == 0) {
-                               mpool_put(t->bt_mp, h, 0);
-                               return (RET_SPECIAL);
-                       }
-
-                       if (h->flags & (P_BLEAF | P_RLEAF))
-                               break;
-                       pg = GETBINTERNAL(h, NEXTINDEX(h) - 1)->pgno;
-                       mpool_put(t->bt_mp, h, 0);
-               }
-
-               ep->page = h;
-               ep->index = NEXTINDEX(h) - 1;
-               break;
-       }
-       return (RET_SUCCESS);
-}
-
-/*
- * __bt_seqadvance --
- *     Advance the sequential scan.
- *
- * Parameters:
- *     t:      tree
- *     flags:  R_NEXT, R_PREV
- *
- * Side effects:
- *     Pins the page the new key/data record is on.
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
- */
-static int
-__bt_seqadv(BTREE *t, EPG *ep, int flags)
-{
-       CURSOR *c;
-       PAGE *h;
-       indx_t idx = 0; /* pacify gcc */
-       pgno_t pg;
-       int exact;
-
-       /*
-        * There are a couple of states that we can be in.  The cursor has
-        * been initialized by the time we get here, but that's all we know.
-        */
-       c = &t->bt_cursor;
-
-       /*
-        * The cursor was deleted where there weren't any duplicate records,
-        * so the key was saved.  Find out where that key would go in the
-        * current tree.  It doesn't matter if the returned key is an exact
-        * match or not -- if it's an exact match, the record was added after
-        * the delete so we can just return it.  If not, as long as there's
-        * a record there, return it.
-        */
-       if (F_ISSET(c, CURS_ACQUIRE))
-               return (__bt_first(t, &c->key, ep, &exact));
-
-       /* Get the page referenced by the cursor. */
-       if ((h = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL)
-               return (RET_ERROR);
-
-       /*
-        * Find the next/previous record in the tree and point the cursor at
-        * it.  The cursor may not be moved until a new key has been found.
-        */
-       switch (flags) {
-       case R_NEXT:                    /* Next record. */
-               /*
-                * The cursor was deleted in duplicate records, and moved
-                * forward to a record that has yet to be returned.  Clear
-                * that flag, and return the record.
-                */
-               if (F_ISSET(c, CURS_AFTER))
-                       goto usecurrent;
-               idx = c->pg.index;
-               if (++idx == NEXTINDEX(h)) {
-                       pg = h->nextpg;
-                       mpool_put(t->bt_mp, h, 0);
-                       if (pg == P_INVALID)
-                               return (RET_SPECIAL);
-                       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                               return (RET_ERROR);
-                       idx = 0;
-               }
-               break;
-       case R_PREV:                    /* Previous record. */
-               /*
-                * The cursor was deleted in duplicate records, and moved
-                * backward to a record that has yet to be returned.  Clear
-                * that flag, and return the record.
-                */
-               if (F_ISSET(c, CURS_BEFORE)) {
-usecurrent:            F_CLR(c, CURS_AFTER | CURS_BEFORE);
-                       ep->page = h;
-                       ep->index = c->pg.index;
-                       return (RET_SUCCESS);
-               }
-               idx = c->pg.index;
-               if (idx == 0) {
-                       pg = h->prevpg;
-                       mpool_put(t->bt_mp, h, 0);
-                       if (pg == P_INVALID)
-                               return (RET_SPECIAL);
-                       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                               return (RET_ERROR);
-                       idx = NEXTINDEX(h) - 1;
-               } else
-                       --idx;
-               break;
-       }
-
-       ep->page = h;
-       ep->index = idx;
-       return (RET_SUCCESS);
-}
-
-/*
- * __bt_first --
- *     Find the first entry.
- *
- * Parameters:
- *     t:      the tree
- *    key:     the key
- *  erval:     return EPG
- * exactp:     pointer to exact match flag
- *
- * Returns:
- *     The first entry in the tree greater than or equal to key,
- *     or RET_SPECIAL if no such key exists.
- */
-static int
-__bt_first(BTREE *t, const DBT *key, EPG *erval, int *exactp)
-{
-       PAGE *h;
-       EPG *ep, save;
-       pgno_t pg;
-
-       /*
-        * Find any matching record; __bt_search pins the page.
-        *
-        * If it's an exact match and duplicates are possible, walk backwards
-        * in the tree until we find the first one.  Otherwise, make sure it's
-        * a valid key (__bt_search may return an index just past the end of a
-        * page) and return it.
-        */
-       if ((ep = __bt_search(t, key, exactp)) == NULL)
-               return (0);
-       if (*exactp) {
-               if (F_ISSET(t, B_NODUPS)) {
-                       *erval = *ep;
-                       return (RET_SUCCESS);
-               }
-                       
-               /*
-                * Walk backwards, as long as the entry matches and there are
-                * keys left in the tree.  Save a copy of each match in case
-                * we go too far.
-                */
-               save = *ep;
-               h = ep->page;
-               do {
-                       if (save.page->pgno != ep->page->pgno) {
-                               mpool_put(t->bt_mp, save.page, 0);
-                               save = *ep;
-                       } else
-                               save.index = ep->index;
-
-                       /*
-                        * Don't unpin the page the last (or original) match
-                        * was on, but make sure it's unpinned if an error
-                        * occurs.
-                        */
-                       if (ep->index == 0) {
-                               if (h->prevpg == P_INVALID)
-                                       break;
-                               if (h->pgno != save.page->pgno)
-                                       mpool_put(t->bt_mp, h, 0);
-                               if ((h = mpool_get(t->bt_mp,
-                                   h->prevpg, 0)) == NULL)
-                                       return (RET_ERROR);
-                               ep->page = h;
-                               ep->index = NEXTINDEX(h);
-                       }
-                       --ep->index;
-               } while (__bt_cmp(t, key, ep) == 0);
-
-               /*
-                * Reach here with the last page that was looked at pinned,
-                * which may or may not be the same as the last (or original)
-                * match page.  If it's not useful, release it.
-                */
-               if (h->pgno != save.page->pgno)
-                       mpool_put(t->bt_mp, h, 0);
-
-               *erval = save;
-               return (RET_SUCCESS);
-       }
-
-       /* If at the end of a page, find the next entry. */
-       if (ep->index == NEXTINDEX(ep->page)) {
-               h = ep->page;
-               pg = h->nextpg;
-               mpool_put(t->bt_mp, h, 0);
-               if (pg == P_INVALID)
-                       return (RET_SPECIAL);
-               if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                       return (RET_ERROR);
-               ep->index = 0;
-               ep->page = h;
-       }
-       *erval = *ep;
-       return (RET_SUCCESS);
-}
-
-/*
- * __bt_setcur --
- *     Set the cursor to an entry in the tree.
- *
- * Parameters:
- *     t:      the tree
- *   pgno:     page number
- *    idx:     page index
- */
-void
-__bt_setcur(BTREE *t, pgno_t pgno, u_int idx)
-{
-       /* Lose any already deleted key. */
-       if (t->bt_cursor.key.data != NULL) {
-               free(t->bt_cursor.key.data);
-               t->bt_cursor.key.size = 0;
-               t->bt_cursor.key.data = NULL;
-       }
-       F_CLR(&t->bt_cursor, CURS_ACQUIRE | CURS_AFTER | CURS_BEFORE);
-
-       /* Update the cursor. */
-       t->bt_cursor.pg.pgno = pgno;
-       t->bt_cursor.pg.index = idx;
-       F_SET(&t->bt_cursor, CURS_INIT);
-}
diff --git a/lib/nbsd_libc/db/btree/bt_split.c b/lib/nbsd_libc/db/btree/bt_split.c
deleted file mode 100644 (file)
index 8a97501..0000000
+++ /dev/null
@@ -1,827 +0,0 @@
-/*     $NetBSD: bt_split.c,v 1.19 2009/04/22 18:44:06 christos Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_split.c,v 1.19 2009/04/22 18:44:06 christos Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <db.h>
-#include "btree.h"
-
-static int      bt_broot(BTREE *, PAGE *, PAGE *, PAGE *);
-static PAGE    *bt_page(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
-static int      bt_preserve(BTREE *, pgno_t);
-static PAGE    *bt_psplit(BTREE *, PAGE *, PAGE *, PAGE *, indx_t *, size_t);
-static PAGE    *bt_root(BTREE *, PAGE *, PAGE **, PAGE **, indx_t *, size_t);
-static int      bt_rroot(BTREE *, PAGE *, PAGE *, PAGE *);
-static recno_t  rec_total(PAGE *);
-
-#ifdef STATISTICS
-unsigned long  bt_rootsplit, bt_split, bt_sortsplit, bt_pfxsaved;
-#endif
-
-/*
- * __BT_SPLIT -- Split the tree.
- *
- * Parameters:
- *     t:      tree
- *     sp:     page to split
- *     key:    key to insert
- *     data:   data to insert
- *     flags:  BIGKEY/BIGDATA flags
- *     ilen:   insert length
- *     skip:   index to leave open
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__bt_split(BTREE *t, PAGE *sp, const DBT *key, const DBT *data, int flags,
-    size_t ilen, uint32_t argskip)
-{
-       BINTERNAL *bi = NULL;   /* pacify gcc */
-       BLEAF *bl = NULL, *tbl; /* pacify gcc */
-       DBT a, b;
-       EPGNO *parent;
-       PAGE *h, *l, *r, *lchild, *rchild;
-       indx_t nxtindex;
-       uint16_t skip;
-       uint32_t n, nbytes, nksize = 0; /* pacify gcc */
-       int parentsplit;
-       char *dest;
-
-       /*
-        * Split the page into two pages, l and r.  The split routines return
-        * a pointer to the page into which the key should be inserted and with
-        * skip set to the offset which should be used.  Additionally, l and r
-        * are pinned.
-        */
-       skip = argskip;
-       h = sp->pgno == P_ROOT ?
-           bt_root(t, sp, &l, &r, &skip, ilen) :
-           bt_page(t, sp, &l, &r, &skip, ilen);
-       if (h == NULL)
-               return (RET_ERROR);
-
-       /*
-        * Insert the new key/data pair into the leaf page.  (Key inserts
-        * always cause a leaf page to split first.)
-        */
-       _DBFIT(ilen, indx_t);
-       h->upper -= (indx_t)ilen;
-       h->linp[skip] = h->upper;
-       dest = (char *)(void *)h + h->upper;
-       if (F_ISSET(t, R_RECNO))
-               WR_RLEAF(dest, data, flags);
-       else
-               WR_BLEAF(dest, key, data, flags);
-
-       /* If the root page was split, make it look right. */
-       if (sp->pgno == P_ROOT &&
-           (F_ISSET(t, R_RECNO) ?
-           bt_rroot(t, sp, l, r) : bt_broot(t, sp, l, r)) == RET_ERROR)
-               goto err2;
-
-       /*
-        * Now we walk the parent page stack -- a LIFO stack of the pages that
-        * were traversed when we searched for the page that split.  Each stack
-        * entry is a page number and a page index offset.  The offset is for
-        * the page traversed on the search.  We've just split a page, so we
-        * have to insert a new key into the parent page.
-        *
-        * If the insert into the parent page causes it to split, may have to
-        * continue splitting all the way up the tree.  We stop if the root
-        * splits or the page inserted into didn't have to split to hold the
-        * new key.  Some algorithms replace the key for the old page as well
-        * as the new page.  We don't, as there's no reason to believe that the
-        * first key on the old page is any better than the key we have, and,
-        * in the case of a key being placed at index 0 causing the split, the
-        * key is unavailable.
-        *
-        * There are a maximum of 5 pages pinned at any time.  We keep the left
-        * and right pages pinned while working on the parent.   The 5 are the
-        * two children, left parent and right parent (when the parent splits)
-        * and the root page or the overflow key page when calling bt_preserve.
-        * This code must make sure that all pins are released other than the
-        * root page or overflow page which is unlocked elsewhere.
-        */
-       while ((parent = BT_POP(t)) != NULL) {
-               lchild = l;
-               rchild = r;
-
-               /* Get the parent page. */
-               if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
-                       goto err2;
-
-               /*
-                * The new key goes ONE AFTER the index, because the split
-                * was to the right.
-                */
-               skip = parent->index + 1;
-
-               /*
-                * Calculate the space needed on the parent page.
-                *
-                * Prefix trees: space hack when inserting into BINTERNAL
-                * pages.  Retain only what's needed to distinguish between
-                * the new entry and the LAST entry on the page to its left.
-                * If the keys compare equal, retain the entire key.  Note,
-                * we don't touch overflow keys, and the entire key must be
-                * retained for the next-to-left most key on the leftmost
-                * page of each level, or the search will fail.  Applicable
-                * ONLY to internal pages that have leaf pages as children.
-                * Further reduction of the key between pairs of internal
-                * pages loses too much information.
-                */
-               switch (rchild->flags & P_TYPE) {
-               case P_BINTERNAL:
-                       bi = GETBINTERNAL(rchild, 0);
-                       nbytes = NBINTERNAL(bi->ksize);
-                       break;
-               case P_BLEAF:
-                       bl = GETBLEAF(rchild, 0);
-                       nbytes = NBINTERNAL(bl->ksize);
-                       if (t->bt_pfx && !(bl->flags & P_BIGKEY) &&
-                           (h->prevpg != P_INVALID || skip > 1)) {
-                               size_t temp;
-                               tbl = GETBLEAF(lchild, NEXTINDEX(lchild) - 1);
-                               a.size = tbl->ksize;
-                               a.data = tbl->bytes;
-                               b.size = bl->ksize;
-                               b.data = bl->bytes;
-                               temp = t->bt_pfx(&a, &b);
-                               _DBFIT(temp, uint32_t);
-                               nksize = (uint32_t)temp;
-                               n = NBINTERNAL(nksize);
-                               if (n < nbytes) {
-#ifdef STATISTICS
-                                       bt_pfxsaved += nbytes - n;
-#endif
-                                       nbytes = n;
-                               } else
-                                       nksize = 0;
-                       } else
-                               nksize = 0;
-                       break;
-               case P_RINTERNAL:
-               case P_RLEAF:
-                       nbytes = NRINTERNAL;
-                       break;
-               default:
-                       abort();
-               }
-
-               /* Split the parent page if necessary or shift the indices. */
-               if ((uint32_t)h->upper - (uint32_t)h->lower < nbytes + sizeof(indx_t)) {
-                       sp = h;
-                       h = h->pgno == P_ROOT ?
-                           bt_root(t, h, &l, &r, &skip, nbytes) :
-                           bt_page(t, h, &l, &r, &skip, nbytes);
-                       if (h == NULL)
-                               goto err1;
-                       parentsplit = 1;
-               } else {
-                       if (skip < (nxtindex = NEXTINDEX(h)))
-                               memmove(h->linp + skip + 1, h->linp + skip,
-                                   (nxtindex - skip) * sizeof(indx_t));
-                       h->lower += sizeof(indx_t);
-                       parentsplit = 0;
-               }
-
-               /* Insert the key into the parent page. */
-               switch (rchild->flags & P_TYPE) {
-               case P_BINTERNAL:
-                       h->linp[skip] = h->upper -= nbytes;
-                       dest = (char *)(void *)h + h->linp[skip];
-                       memmove(dest, bi, nbytes);
-                       ((BINTERNAL *)(void *)dest)->pgno = rchild->pgno;
-                       break;
-               case P_BLEAF:
-                       h->linp[skip] = h->upper -= nbytes;
-                       dest = (char *)(void *)h + h->linp[skip];
-                       WR_BINTERNAL(dest, nksize ? nksize : bl->ksize,
-                           rchild->pgno, bl->flags & P_BIGKEY);
-                       memmove(dest, bl->bytes, nksize ? nksize : bl->ksize);
-                       if (bl->flags & P_BIGKEY &&
-                           bt_preserve(t, *(pgno_t *)(void *)bl->bytes) ==
-                           RET_ERROR)
-                               goto err1;
-                       break;
-               case P_RINTERNAL:
-                       /*
-                        * Update the left page count.  If split
-                        * added at index 0, fix the correct page.
-                        */
-                       if (skip > 0)
-                               dest = (char *)(void *)h + h->linp[skip - 1];
-                       else
-                               dest = (char *)(void *)l + l->linp[NEXTINDEX(l) - 1];
-                       ((RINTERNAL *)(void *)dest)->nrecs = rec_total(lchild);
-                       ((RINTERNAL *)(void *)dest)->pgno = lchild->pgno;
-
-                       /* Update the right page count. */
-                       h->linp[skip] = h->upper -= nbytes;
-                       dest = (char *)(void *)h + h->linp[skip];
-                       ((RINTERNAL *)(void *)dest)->nrecs = rec_total(rchild);
-                       ((RINTERNAL *)(void *)dest)->pgno = rchild->pgno;
-                       break;
-               case P_RLEAF:
-                       /*
-                        * Update the left page count.  If split
-                        * added at index 0, fix the correct page.
-                        */
-                       if (skip > 0)
-                               dest = (char *)(void *)h + h->linp[skip - 1];
-                       else
-                               dest = (char *)(void *)l + l->linp[NEXTINDEX(l) - 1];
-                       ((RINTERNAL *)(void *)dest)->nrecs = NEXTINDEX(lchild);
-                       ((RINTERNAL *)(void *)dest)->pgno = lchild->pgno;
-
-                       /* Update the right page count. */
-                       h->linp[skip] = h->upper -= nbytes;
-                       dest = (char *)(void *)h + h->linp[skip];
-                       ((RINTERNAL *)(void *)dest)->nrecs = NEXTINDEX(rchild);
-                       ((RINTERNAL *)(void *)dest)->pgno = rchild->pgno;
-                       break;
-               default:
-                       abort();
-               }
-
-               /* Unpin the held pages. */
-               if (!parentsplit) {
-                       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-                       break;
-               }
-
-               /* If the root page was split, make it look right. */
-               if (sp->pgno == P_ROOT &&
-                   (F_ISSET(t, R_RECNO) ?
-                   bt_rroot(t, sp, l, r) : bt_broot(t, sp, l, r)) == RET_ERROR)
-                       goto err1;
-
-               mpool_put(t->bt_mp, lchild, MPOOL_DIRTY);
-               mpool_put(t->bt_mp, rchild, MPOOL_DIRTY);
-       }
-
-       /* Unpin the held pages. */
-       mpool_put(t->bt_mp, l, MPOOL_DIRTY);
-       mpool_put(t->bt_mp, r, MPOOL_DIRTY);
-
-       /* Clear any pages left on the stack. */
-       return (RET_SUCCESS);
-
-       /*
-        * If something fails in the above loop we were already walking back
-        * up the tree and the tree is now inconsistent.  Nothing much we can
-        * do about it but release any memory we're holding.
-        */
-err1:  mpool_put(t->bt_mp, lchild, MPOOL_DIRTY);
-       mpool_put(t->bt_mp, rchild, MPOOL_DIRTY);
-
-err2:  mpool_put(t->bt_mp, l, 0);
-       mpool_put(t->bt_mp, r, 0);
-       __dbpanic(t->bt_dbp);
-       return (RET_ERROR);
-}
-
-/*
- * BT_PAGE -- Split a non-root page of a btree.
- *
- * Parameters:
- *     t:      tree
- *     h:      root page
- *     lp:     pointer to left page pointer
- *     rp:     pointer to right page pointer
- *     skip:   pointer to index to leave open
- *     ilen:   insert length
- *
- * Returns:
- *     Pointer to page in which to insert or NULL on error.
- */
-static PAGE *
-bt_page(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen)
-{
-       PAGE *l, *r, *tp;
-       pgno_t npg;
-
-#ifdef STATISTICS
-       ++bt_split;
-#endif
-       /* Put the new right page for the split into place. */
-       if ((r = __bt_new(t, &npg)) == NULL)
-               return (NULL);
-       r->pgno = npg;
-       r->lower = BTDATAOFF;
-       r->upper = t->bt_psize;
-       r->nextpg = h->nextpg;
-       r->prevpg = h->pgno;
-       r->flags = h->flags & P_TYPE;
-
-       /*
-        * If we're splitting the last page on a level because we're appending
-        * a key to it (skip is NEXTINDEX()), it's likely that the data is
-        * sorted.  Adding an empty page on the side of the level is less work
-        * and can push the fill factor much higher than normal.  If we're
-        * wrong it's no big deal, we'll just do the split the right way next
-        * time.  It may look like it's equally easy to do a similar hack for
-        * reverse sorted data, that is, split the tree left, but it's not.
-        * Don't even try.
-        */
-       if (h->nextpg == P_INVALID && *skip == NEXTINDEX(h)) {
-#ifdef STATISTICS
-               ++bt_sortsplit;
-#endif
-               h->nextpg = r->pgno;
-               r->lower = BTDATAOFF + sizeof(indx_t);
-               *skip = 0;
-               *lp = h;
-               *rp = r;
-               return (r);
-       }
-
-       /* Put the new left page for the split into place. */
-       if ((l = calloc(1, t->bt_psize)) == NULL) {
-               mpool_put(t->bt_mp, r, 0);
-               return (NULL);
-       }
-#ifdef PURIFY
-       memset(l, 0xff, t->bt_psize);
-#endif
-       l->pgno = h->pgno;
-       l->nextpg = r->pgno;
-       l->prevpg = h->prevpg;
-       l->lower = BTDATAOFF;
-       l->upper = t->bt_psize;
-       l->flags = h->flags & P_TYPE;
-
-       /* Fix up the previous pointer of the page after the split page. */
-       if (h->nextpg != P_INVALID) {
-               if ((tp = mpool_get(t->bt_mp, h->nextpg, 0)) == NULL) {
-                       free(l);
-                       /* XXX mpool_free(t->bt_mp, r->pgno); */
-                       return (NULL);
-               }
-               tp->prevpg = r->pgno;
-               mpool_put(t->bt_mp, tp, MPOOL_DIRTY);
-       }
-
-       /*
-        * Split right.  The key/data pairs aren't sorted in the btree page so
-        * it's simpler to copy the data from the split page onto two new pages
-        * instead of copying half the data to the right page and compacting
-        * the left page in place.  Since the left page can't change, we have
-        * to swap the original and the allocated left page after the split.
-        */
-       tp = bt_psplit(t, h, l, r, skip, ilen);
-
-       /* Move the new left page onto the old left page. */
-       memmove(h, l, t->bt_psize);
-       if (tp == l)
-               tp = h;
-       free(l);
-
-       *lp = h;
-       *rp = r;
-       return (tp);
-}
-
-/*
- * BT_ROOT -- Split the root page of a btree.
- *
- * Parameters:
- *     t:      tree
- *     h:      root page
- *     lp:     pointer to left page pointer
- *     rp:     pointer to right page pointer
- *     skip:   pointer to index to leave open
- *     ilen:   insert length
- *
- * Returns:
- *     Pointer to page in which to insert or NULL on error.
- */
-static PAGE *
-bt_root(BTREE *t, PAGE *h, PAGE **lp, PAGE **rp, indx_t *skip, size_t ilen)
-{
-       PAGE *l, *r, *tp;
-       pgno_t lnpg, rnpg;
-
-#ifdef STATISTICS
-       ++bt_split;
-       ++bt_rootsplit;
-#endif
-       /* Put the new left and right pages for the split into place. */
-       if ((l = __bt_new(t, &lnpg)) == NULL ||
-           (r = __bt_new(t, &rnpg)) == NULL)
-               return (NULL);
-       l->pgno = lnpg;
-       r->pgno = rnpg;
-       l->nextpg = r->pgno;
-       r->prevpg = l->pgno;
-       l->prevpg = r->nextpg = P_INVALID;
-       l->lower = r->lower = BTDATAOFF;
-       l->upper = r->upper = t->bt_psize;
-       l->flags = r->flags = h->flags & P_TYPE;
-
-       /* Split the root page. */
-       tp = bt_psplit(t, h, l, r, skip, ilen);
-
-       *lp = l;
-       *rp = r;
-       return (tp);
-}
-
-/*
- * BT_RROOT -- Fix up the recno root page after it has been split.
- *
- * Parameters:
- *     t:      tree
- *     h:      root page
- *     l:      left page
- *     r:      right page
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-static int
-bt_rroot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
-{
-       char *dest;
-       uint32_t sz;
-       size_t temp;
-
-       temp = t->bt_psize - NRINTERNAL;
-       _DBFIT(temp, uint32_t);
-       sz = (uint32_t)temp;
-
-       /* Insert the left and right keys, set the header information. */
-       _DBFIT(sz, indx_t);
-       h->linp[0] = h->upper = (indx_t)sz;
-       dest = (char *)(void *)h + h->upper;
-       WR_RINTERNAL(dest,
-           l->flags & P_RLEAF ? NEXTINDEX(l) : rec_total(l), l->pgno);
-
-       h->linp[1] = h->upper -= NRINTERNAL;
-       dest = (char *)(void *)h + h->upper;
-       WR_RINTERNAL(dest,
-           r->flags & P_RLEAF ? NEXTINDEX(r) : rec_total(r), r->pgno);
-
-       h->lower = BTDATAOFF + 2 * sizeof(indx_t);
-
-       /* Unpin the root page, set to recno internal page. */
-       h->flags &= ~P_TYPE;
-       h->flags |= P_RINTERNAL;
-       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-
-       return (RET_SUCCESS);
-}
-
-/*
- * BT_BROOT -- Fix up the btree root page after it has been split.
- *
- * Parameters:
- *     t:      tree
- *     h:      root page
- *     l:      left page
- *     r:      right page
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-static int
-bt_broot(BTREE *t, PAGE *h, PAGE *l, PAGE *r)
-{
-       BINTERNAL *bi = NULL;   /* pacify gcc */
-       BLEAF *bl;
-       uint32_t nbytes;
-       char *dest;
-
-       /*
-        * If the root page was a leaf page, change it into an internal page.
-        * We copy the key we split on (but not the key's data, in the case of
-        * a leaf page) to the new root page.
-        *
-        * The btree comparison code guarantees that the left-most key on any
-        * level of the tree is never used, so it doesn't need to be filled in.
-        */
-       nbytes = NBINTERNAL(0);
-       h->linp[0] = h->upper = t->bt_psize - nbytes;
-       dest = (char *)(void *)h + h->upper;
-       WR_BINTERNAL(dest, 0, l->pgno, 0);
-
-       switch (h->flags & P_TYPE) {
-       case P_BLEAF:
-               bl = GETBLEAF(r, 0);
-               nbytes = NBINTERNAL(bl->ksize);
-               h->linp[1] = h->upper -= nbytes;
-               dest = (char *)(void *)h + h->upper;
-               WR_BINTERNAL(dest, bl->ksize, r->pgno, 0);
-               memmove(dest, bl->bytes, bl->ksize);
-
-               /*
-                * If the key is on an overflow page, mark the overflow chain
-                * so it isn't deleted when the leaf copy of the key is deleted.
-                */
-               if (bl->flags & P_BIGKEY &&
-                   bt_preserve(t, *(pgno_t *)(void *)bl->bytes) == RET_ERROR)
-                       return (RET_ERROR);
-               break;
-       case P_BINTERNAL:
-               bi = GETBINTERNAL(r, 0);
-               nbytes = NBINTERNAL(bi->ksize);
-               h->linp[1] = h->upper -= nbytes;
-               dest = (char *)(void *)h + h->upper;
-               memmove(dest, bi, nbytes);
-               ((BINTERNAL *)(void *)dest)->pgno = r->pgno;
-               break;
-       default:
-               abort();
-       }
-
-       /* There are two keys on the page. */
-       h->lower = BTDATAOFF + 2 * sizeof(indx_t);
-
-       /* Unpin the root page, set to btree internal page. */
-       h->flags &= ~P_TYPE;
-       h->flags |= P_BINTERNAL;
-       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-
-       return (RET_SUCCESS);
-}
-
-/*
- * BT_PSPLIT -- Do the real work of splitting the page.
- *
- * Parameters:
- *     t:      tree
- *     h:      page to be split
- *     l:      page to put lower half of data
- *     r:      page to put upper half of data
- *     pskip:  pointer to index to leave open
- *     ilen:   insert length
- *
- * Returns:
- *     Pointer to page in which to insert.
- */
-static PAGE *
-bt_psplit(BTREE *t, PAGE *h, PAGE *l, PAGE *r, indx_t *pskip, size_t ilen)
-{
-       BINTERNAL *bi;
-       BLEAF *bl;
-       CURSOR *c;
-       RLEAF *rl;
-       PAGE *rval;
-       void *src = NULL;       /* pacify gcc */
-       indx_t full, half, nxt, off, skip, top, used;
-       uint32_t nbytes;
-       size_t temp;
-       int bigkeycnt, isbigkey;
-
-       /*
-        * Split the data to the left and right pages.  Leave the skip index
-        * open.  Additionally, make some effort not to split on an overflow
-        * key.  This makes internal page processing faster and can save
-        * space as overflow keys used by internal pages are never deleted.
-        */
-       bigkeycnt = 0;
-       skip = *pskip;
-       temp = t->bt_psize - BTDATAOFF;
-       _DBFIT(temp, indx_t);
-       full = (indx_t)temp;
-       half = full / 2;
-       used = 0;
-       for (nxt = off = 0, top = NEXTINDEX(h); nxt < top; ++off) {
-               if (skip == off) {
-                       _DBFIT(ilen, uint32_t);
-                       nbytes = (uint32_t)ilen;
-                       isbigkey = 0;           /* XXX: not really known. */
-               } else
-                       switch (h->flags & P_TYPE) {
-                       case P_BINTERNAL:
-                               src = bi = GETBINTERNAL(h, nxt);
-                               nbytes = NBINTERNAL(bi->ksize);
-                               isbigkey = bi->flags & P_BIGKEY;
-                               break;
-                       case P_BLEAF:
-                               src = bl = GETBLEAF(h, nxt);
-                               nbytes = NBLEAF(bl);
-                               isbigkey = bl->flags & P_BIGKEY;
-                               break;
-                       case P_RINTERNAL:
-                               src = GETRINTERNAL(h, nxt);
-                               nbytes = NRINTERNAL;
-                               isbigkey = 0;
-                               break;
-                       case P_RLEAF:
-                               src = rl = GETRLEAF(h, nxt);
-                               nbytes = NRLEAF(rl);
-                               isbigkey = 0;
-                               break;
-                       default:
-                               abort();
-                       }
-
-               /*
-                * If the key/data pairs are substantial fractions of the max
-                * possible size for the page, it's possible to get situations
-                * where we decide to try and copy too much onto the left page.
-                * Make sure that doesn't happen.
-                */
-               if ((skip <= off && used + nbytes + sizeof(indx_t) >= full) ||
-                   nxt == top - 1) {
-                       --off;
-                       break;
-               }
-
-               /* Copy the key/data pair, if not the skipped index. */
-               if (skip != off) {
-                       ++nxt;
-
-                       l->linp[off] = l->upper -= nbytes;
-                       memmove((char *)(void *)l + l->upper, src, nbytes);
-               }
-
-               temp = nbytes + sizeof(indx_t);
-               _DBFIT(temp, indx_t);
-               used += (indx_t)temp;
-               if (used >= half) {
-                       if (!isbigkey || bigkeycnt == 3)
-                               break;
-                       else
-                               ++bigkeycnt;
-               }
-       }
-
-       /*
-        * Off is the last offset that's valid for the left page.
-        * Nxt is the first offset to be placed on the right page.
-        */
-       temp = (off + 1) * sizeof(indx_t);
-       _DBFIT(temp, indx_t);
-       l->lower += (indx_t)temp;
-
-       /*
-        * If splitting the page that the cursor was on, the cursor has to be
-        * adjusted to point to the same record as before the split.  If the
-        * cursor is at or past the skipped slot, the cursor is incremented by
-        * one.  If the cursor is on the right page, it is decremented by the
-        * number of records split to the left page.
-        */
-       c = &t->bt_cursor;
-       if (F_ISSET(c, CURS_INIT) && c->pg.pgno == h->pgno) {
-               if (c->pg.index >= skip)
-                       ++c->pg.index;
-               if (c->pg.index < nxt)                  /* Left page. */
-                       c->pg.pgno = l->pgno;
-               else {                                  /* Right page. */
-                       c->pg.pgno = r->pgno;
-                       c->pg.index -= nxt;
-               }
-       }
-
-       /*
-        * If the skipped index was on the left page, just return that page.
-        * Otherwise, adjust the skip index to reflect the new position on
-        * the right page.
-        */
-       if (skip <= off) {
-               skip = MAX_PAGE_OFFSET;
-               rval = l;
-       } else {
-               rval = r;
-               *pskip -= nxt;
-       }
-
-       for (off = 0; nxt < top; ++off) {
-               if (skip == nxt) {
-                       ++off;
-                       skip = MAX_PAGE_OFFSET;
-               }
-               switch (h->flags & P_TYPE) {
-               case P_BINTERNAL:
-                       src = bi = GETBINTERNAL(h, nxt);
-                       nbytes = NBINTERNAL(bi->ksize);
-                       break;
-               case P_BLEAF:
-                       src = bl = GETBLEAF(h, nxt);
-                       nbytes = NBLEAF(bl);
-                       break;
-               case P_RINTERNAL:
-                       src = GETRINTERNAL(h, nxt);
-                       nbytes = NRINTERNAL;
-                       break;
-               case P_RLEAF:
-                       src = rl = GETRLEAF(h, nxt);
-                       nbytes = NRLEAF(rl);
-                       break;
-               default:
-                       abort();
-               }
-               ++nxt;
-               r->linp[off] = r->upper -= nbytes;
-               memmove((char *)(void *)r + r->upper, src, nbytes);
-       }
-       temp = off * sizeof(indx_t);
-       _DBFIT(temp, indx_t);
-       r->lower += (indx_t)temp;
-
-       /* If the key is being appended to the page, adjust the index. */
-       if (skip == top)
-               r->lower += sizeof(indx_t);
-
-       return (rval);
-}
-
-/*
- * BT_PRESERVE -- Mark a chain of pages as used by an internal node.
- *
- * Chains of indirect blocks pointed to by leaf nodes get reclaimed when the
- * record that references them gets deleted.  Chains pointed to by internal
- * pages never get deleted.  This routine marks a chain as pointed to by an
- * internal page.
- *
- * Parameters:
- *     t:      tree
- *     pg:     page number of first page in the chain.
- *
- * Returns:
- *     RET_SUCCESS, RET_ERROR.
- */
-static int
-bt_preserve(BTREE *t, pgno_t pg)
-{
-       PAGE *h;
-
-       if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-               return (RET_ERROR);
-       h->flags |= P_PRESERVE;
-       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-       return (RET_SUCCESS);
-}
-
-/*
- * REC_TOTAL -- Return the number of recno entries below a page.
- *
- * Parameters:
- *     h:      page
- *
- * Returns:
- *     The number of recno entries below a page.
- *
- * XXX
- * These values could be set by the bt_psplit routine.  The problem is that the
- * entry has to be popped off of the stack etc. or the values have to be passed
- * all the way back to bt_split/bt_rroot and it's not very clean.
- */
-static recno_t
-rec_total(PAGE *h)
-{
-       recno_t recs;
-       indx_t nxt, top;
-
-       for (recs = 0, nxt = 0, top = NEXTINDEX(h); nxt < top; ++nxt)
-               recs += GETRINTERNAL(h, nxt)->nrecs;
-       return (recs);
-}
diff --git a/lib/nbsd_libc/db/btree/bt_utils.c b/lib/nbsd_libc/db/btree/bt_utils.c
deleted file mode 100644 (file)
index db0d058..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/*     $NetBSD: bt_utils.c,v 1.13 2008/09/10 17:52:35 joerg Exp $      */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: bt_utils.c,v 1.13 2008/09/10 17:52:35 joerg Exp $");
-
-#include <sys/param.h>
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <db.h>
-#include "btree.h"
-
-/*
- * __bt_ret --
- *     Build return key/data pair.
- *
- * Parameters:
- *     t:      tree
- *     e:      key/data pair to be returned
- *     key:    user's key structure (NULL if not to be filled in)
- *     rkey:   memory area to hold key
- *     data:   user's data structure (NULL if not to be filled in)
- *     rdata:  memory area to hold data
- *       copy: always copy the key/data item
- *
- * Returns:
- *     RET_SUCCESS, RET_ERROR.
- */
-int
-__bt_ret(BTREE *t, EPG *e, DBT *key, DBT *rkey, DBT *data, DBT *rdata, int copy)
-{
-       BLEAF *bl;
-       void *p;
-
-       bl = GETBLEAF(e->page, e->index);
-
-       /*
-        * We must copy big keys/data to make them contigous.  Otherwise,
-        * leave the page pinned and don't copy unless the user specified
-        * concurrent access.
-        */
-       if (key == NULL)
-               goto dataonly;
-
-       if (bl->flags & P_BIGKEY) {
-               if (__ovfl_get(t, bl->bytes,
-                   &key->size, &rkey->data, &rkey->size))
-                       return (RET_ERROR);
-               key->data = rkey->data;
-       } else if (copy || F_ISSET(t, B_DB_LOCK)) {
-               if (bl->ksize > rkey->size) {
-                       p = (void *)(rkey->data == NULL ?
-                           malloc(bl->ksize) : realloc(rkey->data, bl->ksize));
-                       if (p == NULL)
-                               return (RET_ERROR);
-                       rkey->data = p;
-                       rkey->size = bl->ksize;
-               }
-               memmove(rkey->data, bl->bytes, bl->ksize);
-               key->size = bl->ksize;
-               key->data = rkey->data;
-       } else {
-               key->size = bl->ksize;
-               key->data = bl->bytes;
-       }
-
-dataonly:
-       if (data == NULL)
-               return (RET_SUCCESS);
-
-       if (bl->flags & P_BIGDATA) {
-               if (__ovfl_get(t, bl->bytes + bl->ksize,
-                   &data->size, &rdata->data, &rdata->size))
-                       return (RET_ERROR);
-               data->data = rdata->data;
-       } else if (copy || F_ISSET(t, B_DB_LOCK)) {
-               /* Use +1 in case the first record retrieved is 0 length. */
-               if (bl->dsize + 1 > rdata->size) {
-                       p = (void *)(rdata->data == NULL ?
-                           malloc(bl->dsize + 1) :
-                           realloc(rdata->data, bl->dsize + 1));
-                       if (p == NULL)
-                               return (RET_ERROR);
-                       rdata->data = p;
-                       rdata->size = bl->dsize + 1;
-               }
-               memmove(rdata->data, bl->bytes + bl->ksize, bl->dsize);
-               data->size = bl->dsize;
-               data->data = rdata->data;
-       } else {
-               data->size = bl->dsize;
-               data->data = bl->bytes + bl->ksize;
-       }
-
-       return (RET_SUCCESS);
-}
-
-/*
- * __BT_CMP -- Compare a key to a given record.
- *
- * Parameters:
- *     t:      tree
- *     k1:     DBT pointer of first arg to comparison
- *     e:      pointer to EPG for comparison
- *
- * Returns:
- *     < 0 if k1 is < record
- *     = 0 if k1 is = record
- *     > 0 if k1 is > record
- */
-int
-__bt_cmp(BTREE *t, const DBT *k1, EPG *e)
-{
-       BINTERNAL *bi;
-       BLEAF *bl;
-       DBT k2;
-       PAGE *h;
-       void *bigkey;
-
-       /*
-        * The left-most key on internal pages, at any level of the tree, is
-        * guaranteed by the following code to be less than any user key.
-        * This saves us from having to update the leftmost key on an internal
-        * page when the user inserts a new key in the tree smaller than
-        * anything we've yet seen.
-        */
-       h = e->page;
-       if (e->index == 0 && h->prevpg == P_INVALID && !(h->flags & P_BLEAF))
-               return (1);
-
-       bigkey = NULL;
-       if (h->flags & P_BLEAF) {
-               bl = GETBLEAF(h, e->index);
-               if (bl->flags & P_BIGKEY)
-                       bigkey = bl->bytes;
-               else {
-                       k2.data = bl->bytes;
-                       k2.size = bl->ksize;
-               }
-       } else {
-               bi = GETBINTERNAL(h, e->index);
-               if (bi->flags & P_BIGKEY)
-                       bigkey = bi->bytes;
-               else {
-                       k2.data = bi->bytes;
-                       k2.size = bi->ksize;
-               }
-       }
-
-       if (bigkey) {
-               if (__ovfl_get(t, bigkey,
-                   &k2.size, &t->bt_rdata.data, &t->bt_rdata.size))
-                       return (RET_ERROR);
-               k2.data = t->bt_rdata.data;
-       }
-       return ((*t->bt_cmp)(k1, &k2));
-}
-
-/*
- * __BT_DEFCMP -- Default comparison routine.
- *
- * Parameters:
- *     a:      DBT #1
- *     b:      DBT #2
- *
- * Returns:
- *     < 0 if a is < b
- *     = 0 if a is = b
- *     > 0 if a is > b
- */
-int
-__bt_defcmp(const DBT *a, const DBT *b)
-{
-       size_t len;
-       uint8_t *p1, *p2;
-
-       /*
-        * XXX
-        * If a size_t doesn't fit in an int, this routine can lose.
-        * What we need is a integral type which is guaranteed to be
-        * larger than a size_t, and there is no such thing.
-        */
-       len = MIN(a->size, b->size);
-       for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2)
-               if (*p1 != *p2)
-                       return ((int)*p1 - (int)*p2);
-       return ((int)a->size - (int)b->size);
-}
-
-/*
- * __BT_DEFPFX -- Default prefix routine.
- *
- * Parameters:
- *     a:      DBT #1
- *     b:      DBT #2
- *
- * Returns:
- *     Number of bytes needed to distinguish b from a.
- */
-size_t
-__bt_defpfx(const DBT *a, const DBT *b)
-{
-       uint8_t *p1, *p2;
-       size_t cnt, len;
-
-       cnt = 1;
-       len = MIN(a->size, b->size);
-       for (p1 = a->data, p2 = b->data; len--; ++p1, ++p2, ++cnt)
-               if (*p1 != *p2)
-                       return (cnt);
-
-       /* a->size must be <= b->size, or they wouldn't be in this order. */
-       return (a->size < b->size ? a->size + 1 : a->size);
-}
diff --git a/lib/nbsd_libc/db/btree/btree.h b/lib/nbsd_libc/db/btree/btree.h
deleted file mode 100644 (file)
index b28f082..0000000
+++ /dev/null
@@ -1,433 +0,0 @@
-/*     $NetBSD: btree.h,v 1.16 2008/08/26 21:18:38 joerg Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- *
- *     @(#)btree.h     8.11 (Berkeley) 8/17/94
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-/* Macros to set/clear/test flags. */
-#define        F_SET(p, f)     (p)->flags |= (f)
-#define        F_CLR(p, f)     (p)->flags &= ~(f)
-#define        F_ISSET(p, f)   ((p)->flags & (f))
-
-#include <mpool.h>
-
-#define        DEFMINKEYPAGE   (2)             /* Minimum keys per page */
-#define        MINCACHE        (5)             /* Minimum cached pages */
-#define        MINPSIZE        (512)           /* Minimum page size */
-
-/*
- * Page 0 of a btree file contains a copy of the meta-data.  This page is also
- * used as an out-of-band page, i.e. page pointers that point to nowhere point
- * to page 0.  Page 1 is the root of the btree.
- */
-#define        P_INVALID        0              /* Invalid tree page number. */
-#define        P_META           0              /* Tree metadata page number. */
-#define        P_ROOT           1              /* Tree root page number. */
-
-/*
- * There are five page layouts in the btree: btree internal pages (BINTERNAL),
- * btree leaf pages (BLEAF), recno internal pages (RINTERNAL), recno leaf pages
- * (RLEAF) and overflow pages.  All five page types have a page header (PAGE).
- * This implementation requires that values within structures NOT be padded.
- * (ANSI C permits random padding.)  If your compiler pads randomly you'll have
- * to do some work to get this package to run.
- */
-typedef struct _page {
-       pgno_t  pgno;                   /* this page's page number */
-       pgno_t  prevpg;                 /* left sibling */
-       pgno_t  nextpg;                 /* right sibling */
-
-#define        P_BINTERNAL     0x01            /* btree internal page */
-#define        P_BLEAF         0x02            /* leaf page */
-#define        P_OVERFLOW      0x04            /* overflow page */
-#define        P_RINTERNAL     0x08            /* recno internal page */
-#define        P_RLEAF         0x10            /* leaf page */
-#define P_TYPE         0x1f            /* type mask */
-#define        P_PRESERVE      0x20            /* never delete this chain of pages */
-       uint32_t flags;
-
-       indx_t  lower;                  /* lower bound of free space on page */
-       indx_t  upper;                  /* upper bound of free space on page */
-       indx_t  linp[1];                /* indx_t-aligned VAR. LENGTH DATA */
-} PAGE;
-
-/* First and next index. */
-#define        BTDATAOFF                                                       \
-       (sizeof(pgno_t) + sizeof(pgno_t) + sizeof(pgno_t) +             \
-           sizeof(uint32_t) + sizeof(indx_t) + sizeof(indx_t))
-
-#define        _NEXTINDEX(p) (((p)->lower - BTDATAOFF) / sizeof(indx_t))
-#ifdef _DIAGNOSTIC
-static __inline indx_t
-NEXTINDEX(const PAGE *p) {
-       size_t x = _NEXTINDEX(p);
-       _DBFIT(x, indx_t);
-       return (indx_t)x;
-}
-#else
-#define        NEXTINDEX(p) (indx_t)_NEXTINDEX(p)
-#endif
-
-/*
- * For pages other than overflow pages, there is an array of offsets into the
- * rest of the page immediately following the page header.  Each offset is to
- * an item which is unique to the type of page.  The h_lower offset is just
- * past the last filled-in index.  The h_upper offset is the first item on the
- * page.  Offsets are from the beginning of the page.
- *
- * If an item is too big to store on a single page, a flag is set and the item
- * is a { page, size } pair such that the page is the first page of an overflow
- * chain with size bytes of item.  Overflow pages are simply bytes without any
- * external structure.
- *
- * The page number and size fields in the items are pgno_t-aligned so they can
- * be manipulated without copying.  (This presumes that 32 bit items can be
- * manipulated on this system.)
- */
-#define        BTLALIGN(n)     (((n) + sizeof(pgno_t) - 1) & ~(sizeof(pgno_t) - 1))
-#define        NOVFLSIZE       (sizeof(pgno_t) + sizeof(uint32_t))
-
-/*
- * For the btree internal pages, the item is a key.  BINTERNALs are {key, pgno}
- * pairs, such that the key compares less than or equal to all of the records
- * on that page.  For a tree without duplicate keys, an internal page with two
- * consecutive keys, a and b, will have all records greater than or equal to a
- * and less than b stored on the page associated with a.  Duplicate keys are
- * somewhat special and can cause duplicate internal and leaf page records and
- * some minor modifications of the above rule.
- */
-typedef struct _binternal {
-       uint32_t ksize;                 /* key size */
-       pgno_t  pgno;                   /* page number stored on */
-#define        P_BIGDATA       0x01            /* overflow data */
-#define        P_BIGKEY        0x02            /* overflow key */
-       uint8_t flags;
-       char    bytes[1];               /* data */
-} BINTERNAL;
-
-/* Get the page's BINTERNAL structure at index indx. */
-#define        GETBINTERNAL(pg, indx)                                          \
-       ((BINTERNAL *)(void *)((char *)(void *)(pg) + (pg)->linp[indx]))
-
-/* Get the number of bytes in the entry. */
-#define _NBINTERNAL(len)                                               \
-    BTLALIGN(sizeof(uint32_t) + sizeof(pgno_t) + sizeof(uint8_t) + (len))
-#ifdef _DIAGNOSTIC
-static __inline uint32_t
-NBINTERNAL(uint32_t len) {
-       size_t x = _NBINTERNAL(len);
-       _DBFIT(x, uint32_t);
-       return (uint32_t)x;
-}
-#else
-#define NBINTERNAL(len)        (uint32_t)_NBINTERNAL(len)
-#endif
-
-/* Copy a BINTERNAL entry to the page. */
-#define        WR_BINTERNAL(p, size, pgno, flags) do {                         \
-       _DBFIT(size, uint32_t);                                         \
-       *(uint32_t *)(void *)p = (uint32_t)size;                        \
-       p += sizeof(uint32_t);                                          \
-       *(pgno_t *)(void *)p = pgno;                                    \
-       p += sizeof(pgno_t);                                            \
-       *(uint8_t *)(void *)p = flags;                                  \
-       p += sizeof(uint8_t);                                           \
-} while (/*CONSTCOND*/0)
-
-/*
- * For the recno internal pages, the item is a page number with the number of
- * keys found on that page and below.
- */
-typedef struct _rinternal {
-       recno_t nrecs;                  /* number of records */
-       pgno_t  pgno;                   /* page number stored below */
-} RINTERNAL;
-
-/* Get the page's RINTERNAL structure at index indx. */
-#define        GETRINTERNAL(pg, indx)                                          \
-       ((RINTERNAL *)(void *)((char *)(void *)(pg) + (pg)->linp[indx]))
-
-/* Get the number of bytes in the entry. */
-#define NRINTERNAL                                                     \
-       BTLALIGN(sizeof(recno_t) + sizeof(pgno_t))
-
-/* Copy a RINTERAL entry to the page. */
-#define        WR_RINTERNAL(p, nrecs, pgno) do {                               \
-       *(recno_t *)(void *)p = nrecs;                                  \
-       p += sizeof(recno_t);                                           \
-       *(pgno_t *)(void *)p = pgno;                                    \
-} while (/*CONSTCOND*/0)
-
-/* For the btree leaf pages, the item is a key and data pair. */
-typedef struct _bleaf {
-       uint32_t        ksize;          /* size of key */
-       uint32_t        dsize;          /* size of data */
-       uint8_t flags;                  /* P_BIGDATA, P_BIGKEY */
-       char    bytes[1];               /* data */
-} BLEAF;
-
-/* Get the page's BLEAF structure at index indx. */
-#define        GETBLEAF(pg, indx)                                              \
-       ((BLEAF *)(void *)((char *)(void *)(pg) + (pg)->linp[indx]))
-
-
-/* Get the number of bytes in the user's key/data pair. */
-#define _NBLEAFDBT(ksize, dsize)                                       \
-    BTLALIGN(sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint8_t) +   \
-           (ksize) + (dsize))
-#ifdef _DIAGNOSTIC
-static __inline uint32_t
-NBLEAFDBT(size_t k, size_t d) {
-       size_t x = _NBLEAFDBT(k, d);
-       _DBFIT(x, uint32_t);
-       return (uint32_t)x;
-}
-#else
-#define NBLEAFDBT(p, q)        (uint32_t)_NBLEAFDBT(p, q)
-#endif
-
-/* Get the number of bytes in the entry. */
-#define NBLEAF(p)      NBLEAFDBT((p)->ksize, (p)->dsize)
-
-/* Copy a BLEAF entry to the page. */
-#define        WR_BLEAF(p, key, data, flags) do {                              \
-       _DBFIT(key->size, uint32_t);                                    \
-       *(uint32_t *)(void *)p = (uint32_t)key->size;                   \
-       p += sizeof(uint32_t);                                          \
-       _DBFIT(data->size, uint32_t);                                   \
-       *(uint32_t *)(void *)p = (uint32_t)data->size;                  \
-       p += sizeof(uint32_t);                                          \
-       *(uint8_t *)(void *)p = flags;                                  \
-       p += sizeof(uint8_t);                                           \
-       (void)memmove(p, key->data, key->size);                         \
-       p += key->size;                                                 \
-       (void)memmove(p, data->data, data->size);                       \
-} while (/*CONSTCOND*/0)
-
-/* For the recno leaf pages, the item is a data entry. */
-typedef struct _rleaf {
-       uint32_t        dsize;          /* size of data */
-       uint8_t flags;                  /* P_BIGDATA */
-       char    bytes[1];
-} RLEAF;
-
-/* Get the page's RLEAF structure at index indx. */
-#define        GETRLEAF(pg, indx)                                              \
-       ((RLEAF *)(void *)((char *)(void *)(pg) + (pg)->linp[indx]))
-
-#define        _NRLEAFDBT(dsize)                                               \
-       BTLALIGN(sizeof(uint32_t) + sizeof(uint8_t) + (dsize))
-
-#ifdef _DIAGNOSTIC
-static __inline uint32_t
-NRLEAFDBT(size_t d) {
-       size_t x = _NRLEAFDBT(d);
-       _DBFIT(x, uint32_t);
-       return (uint32_t)x;
-}
-#else
-#define NRLEAFDBT(d)   (uint32_t)_NRLEAFDBT(d)
-#endif
-
-/* Get the number of bytes in the entry. */
-#define NRLEAF(p)      NRLEAFDBT((p)->dsize)
-
-/* Get the number of bytes from the user's data. */
-
-/* Copy a RLEAF entry to the page. */
-#define        WR_RLEAF(p, data, flags) do {                                   \
-       _DBFIT(data->size, uint32_t);                                   \
-       *(uint32_t *)(void *)p = (uint32_t)data->size;                  \
-       p += sizeof(uint32_t);                                          \
-       *(uint8_t *)(void *)p = flags;                                  \
-       p += sizeof(uint8_t);                                           \
-       memmove(p, data->data, data->size);                             \
-} while (/*CONSTCOND*/0)
-
-/*
- * A record in the tree is either a pointer to a page and an index in the page
- * or a page number and an index.  These structures are used as a cursor, stack
- * entry and search returns as well as to pass records to other routines.
- *
- * One comment about searches.  Internal page searches must find the largest
- * record less than key in the tree so that descents work.  Leaf page searches
- * must find the smallest record greater than key so that the returned index
- * is the record's correct position for insertion.
- */
-typedef struct _epgno {
-       pgno_t  pgno;                   /* the page number */
-       indx_t  index;                  /* the index on the page */
-} EPGNO;
-
-typedef struct _epg {
-       PAGE    *page;                  /* the (pinned) page */
-       indx_t   index;                 /* the index on the page */
-} EPG;
-
-/*
- * About cursors.  The cursor (and the page that contained the key/data pair
- * that it referenced) can be deleted, which makes things a bit tricky.  If
- * there are no duplicates of the cursor key in the tree (i.e. B_NODUPS is set
- * or there simply aren't any duplicates of the key) we copy the key that it
- * referenced when it's deleted, and reacquire a new cursor key if the cursor
- * is used again.  If there are duplicates keys, we move to the next/previous
- * key, and set a flag so that we know what happened.  NOTE: if duplicate (to
- * the cursor) keys are added to the tree during this process, it is undefined
- * if they will be returned or not in a cursor scan.
- *
- * The flags determine the possible states of the cursor:
- *
- * CURS_INIT   The cursor references *something*.
- * CURS_ACQUIRE        The cursor was deleted, and a key has been saved so that
- *             we can reacquire the right position in the tree.
- * CURS_AFTER, CURS_BEFORE
- *             The cursor was deleted, and now references a key/data pair
- *             that has not yet been returned, either before or after the
- *             deleted key/data pair.
- * XXX
- * This structure is broken out so that we can eventually offer multiple
- * cursors as part of the DB interface.
- */
-typedef struct _cursor {
-       EPGNO    pg;                    /* B: Saved tree reference. */
-       DBT      key;                   /* B: Saved key, or key.data == NULL. */
-       recno_t  rcursor;               /* R: recno cursor (1-based) */
-
-#define        CURS_ACQUIRE    0x01            /*  B: Cursor needs to be reacquired. */
-#define        CURS_AFTER      0x02            /*  B: Unreturned cursor after key. */
-#define        CURS_BEFORE     0x04            /*  B: Unreturned cursor before key. */
-#define        CURS_INIT       0x08            /* RB: Cursor initialized. */
-       uint8_t flags;
-} CURSOR;
-
-/*
- * The metadata of the tree.  The nrecs field is used only by the RECNO code.
- * This is because the btree doesn't really need it and it requires that every
- * put or delete call modify the metadata.
- */
-typedef struct _btmeta {
-       uint32_t        magic;          /* magic number */
-       uint32_t        version;        /* version */
-       uint32_t        psize;          /* page size */
-       uint32_t        free;           /* page number of first free page */
-       uint32_t        nrecs;          /* R: number of records */
-
-#define        SAVEMETA        (B_NODUPS | R_RECNO)
-       uint32_t        flags;          /* bt_flags & SAVEMETA */
-} BTMETA;
-
-/* The in-memory btree/recno data structure. */
-typedef struct _btree {
-       MPOOL    *bt_mp;                /* memory pool cookie */
-
-       DB       *bt_dbp;               /* pointer to enclosing DB */
-
-       EPG       bt_cur;               /* current (pinned) page */
-       PAGE     *bt_pinned;            /* page pinned across calls */
-
-       CURSOR    bt_cursor;            /* cursor */
-
-#define        BT_PUSH(t, p, i) {                                              \
-       t->bt_sp->pgno = p;                                             \
-       t->bt_sp->index = i;                                            \
-       ++t->bt_sp;                                                     \
-}
-#define        BT_POP(t)       (t->bt_sp == t->bt_stack ? NULL : --t->bt_sp)
-#define        BT_CLR(t)       (t->bt_sp = t->bt_stack)
-       EPGNO     bt_stack[50];         /* stack of parent pages */
-       EPGNO    *bt_sp;                /* current stack pointer */
-
-       DBT       bt_rkey;              /* returned key */
-       DBT       bt_rdata;             /* returned data */
-
-       int       bt_fd;                /* tree file descriptor */
-
-       pgno_t    bt_free;              /* next free page */
-       uint32_t bt_psize;              /* page size */
-       indx_t    bt_ovflsize;          /* cut-off for key/data overflow */
-       int       bt_lorder;            /* byte order */
-                                       /* sorted order */
-       enum { NOT, BACK, FORWARD } bt_order;
-       EPGNO     bt_last;              /* last insert */
-
-                                       /* B: key comparison function */
-       int     (*bt_cmp)(const DBT *, const DBT *);
-                                       /* B: prefix comparison function */
-       size_t  (*bt_pfx)(const DBT *, const DBT *);
-                                       /* R: recno input function */
-       int     (*bt_irec)(struct _btree *, recno_t);
-
-       FILE     *bt_rfp;               /* R: record FILE pointer */
-       int       bt_rfd;               /* R: record file descriptor */
-
-       caddr_t   bt_cmap;              /* R: current point in mapped space */
-       caddr_t   bt_smap;              /* R: start of mapped space */
-       caddr_t   bt_emap;              /* R: end of mapped space */
-       size_t    bt_msize;             /* R: size of mapped region. */
-
-       recno_t   bt_nrecs;             /* R: number of records */
-       size_t    bt_reclen;            /* R: fixed record length */
-       uint8_t   bt_bval;              /* R: delimiting byte/pad character */
-
-/*
- * NB:
- * B_NODUPS and R_RECNO are stored on disk, and may not be changed.
- */
-#define        B_INMEM         0x00001         /* in-memory tree */
-#define        B_METADIRTY     0x00002         /* need to write metadata */
-#define        B_MODIFIED      0x00004         /* tree modified */
-#define        B_NEEDSWAP      0x00008         /* if byte order requires swapping */
-#define        B_RDONLY        0x00010         /* read-only tree */
-
-#define        B_NODUPS        0x00020         /* no duplicate keys permitted */
-#define        R_RECNO         0x00080         /* record oriented tree */
-
-#define        R_CLOSEFP       0x00040         /* opened a file pointer */
-#define        R_EOF           0x00100         /* end of input file reached. */
-#define        R_FIXLEN        0x00200         /* fixed length records */
-#define        R_MEMMAPPED     0x00400         /* memory mapped file. */
-#define        R_INMEM         0x00800         /* in-memory file */
-#define        R_MODIFIED      0x01000         /* modified file */
-#define        R_RDONLY        0x02000         /* read-only file */
-
-#define        B_DB_LOCK       0x04000         /* DB_LOCK specified. */
-#define        B_DB_SHMEM      0x08000         /* DB_SHMEM specified. */
-#define        B_DB_TXN        0x10000         /* DB_TXN specified. */
-       uint32_t flags;
-} BTREE;
-
-#include "extern.h"
diff --git a/lib/nbsd_libc/db/btree/extern.h b/lib/nbsd_libc/db/btree/extern.h
deleted file mode 100644 (file)
index 665f852..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*     $NetBSD: extern.h,v 1.12 2008/09/26 11:41:06 tsutsui Exp $      */
-
-/*-
- * Copyright (c) 1991, 1993, 1994
- *     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. 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.
- *
- *     @(#)extern.h    8.10 (Berkeley) 7/20/94
- */
-
-#ifndef _BTREE_EXTERN_H_
-#define _BTREE_EXTERN_H_
-int     __bt_close(DB *);
-int     __bt_cmp(BTREE *, const DBT *, EPG *);
-int     __bt_crsrdel(BTREE *, EPGNO *);
-int     __bt_defcmp(const DBT *, const DBT *);
-size_t  __bt_defpfx(const DBT *, const DBT *);
-int     __bt_delete(const DB *, const DBT *, unsigned int);
-int     __bt_dleaf(BTREE *, const DBT *, PAGE *, unsigned int);
-int     __bt_fd(const DB *);
-int     __bt_free(BTREE *, PAGE *);
-int     __bt_get(const DB *, const DBT *, DBT *, unsigned int);
-PAGE   *__bt_new(BTREE *, pgno_t *);
-void    __bt_pgin(void *, pgno_t, void *);
-void    __bt_pgout(void *, pgno_t, void *);
-int     __bt_push(BTREE *, pgno_t, int);
-int     __bt_put(const DB *dbp, DBT *, const DBT *, unsigned int);
-int     __bt_ret(BTREE *, EPG *, DBT *, DBT *, DBT *, DBT *, int);
-EPG    *__bt_search(BTREE *, const DBT *, int *);
-int     __bt_seq(const DB *, DBT *, DBT *, unsigned int);
-void    __bt_setcur(BTREE *, pgno_t, unsigned int);
-int     __bt_split(BTREE *, PAGE *,
-           const DBT *, const DBT *, int, size_t, uint32_t);
-int     __bt_sync(const DB *, unsigned int);
-
-int     __ovfl_delete(BTREE *, void *);
-int     __ovfl_get(BTREE *, void *, size_t *, void **, size_t *);
-int     __ovfl_put(BTREE *, const DBT *, pgno_t *);
-
-#ifdef DEBUG
-void    __bt_dmpage(PAGE *);
-void    __bt_dnpage(DB *, pgno_t);
-void    __bt_dpage(PAGE *);
-void    __bt_dump(DB *);
-#endif
-#ifdef STATISTICS
-void    __bt_stat(DB *);
-#endif
-#endif /* _BTREE_EXTERN_H_ */
diff --git a/lib/nbsd_libc/db/changelog b/lib/nbsd_libc/db/changelog
deleted file mode 100644 (file)
index f820e56..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#      $NetBSD: changelog,v 1.2 1996/05/03 21:20:56 cgd Exp $
-
-1.84 -> 1.85
-       recno:  #ifdef out use of mmap, it's not portable enough.
-
-1.83 -> 1.84   Thu Aug 18 15:46:07 EDT 1994
-       recno:  Rework fixed-length records so that closing and reopening
-               the file now works.  Pad short records on input.  Never do
-               signed comparison in recno input reading functions.
-
-1.82 -> 1.83   Tue Jul 26 15:33:44 EDT 1994
-       btree:  Rework cursor deletion code yet again; bugs with
-               deleting empty pages that only contained the cursor
-               record.
-
-1.81 -> 1.82   Sat Jul 16 11:01:50 EDT 1994
-       btree:  Fix bugs introduced by new cursor/deletion code.
-               Replace return kbuf/dbuf with real DBT's.
-
-1.80 -> 1.81
-       btree:  Fix bugs introduced by new cursor/deletion code.
-       all:    Add #defines for Purify.
-
-1.79 -> 1.80   Wed Jul 13 22:41:54 EDT 1994
-       btree   Change deletion to coalesce empty pages.  This is a major
-               change, cursors and duplicate pages all had to be reworked.
-               Return to a fixed stack.
-       recno:  Affected by cursor changes.  New cursor structures should
-               permit multiple cursors in the future.
-
-1.78 -> 1.79   Mon Jun 20 17:36:47 EDT 1994
-       all:    Minor cleanups of 1.78 for porting reasons; only
-               major change was inlining check of NULL pointer
-               so that __fix_realloc goes away.
-
-1.77 -> 1.78   Thu Jun 16 19:06:43 EDT 1994
-       all:    Move "standard" size typedef's into db.h.
-
-1.76 -> 1.77   Thu Jun 16 16:48:38 EDT 1994
-       hash:   Delete __init_ routine, has special meaning to OSF 2.0.
-
-1.74 -> 1.76
-       all:    Finish up the port to the Alpha.
-
-1.73 -> 1.74
-       recno:  Don't put the record if rec_search fails, in rec_rdelete.
-               Create fixed-length intermediate records past "end" of DB
-               correctly.
-               Realloc bug when reading in fixed records.
-       all:    First cut at port to Alpha (64-bit architecture) using
-               4.4BSD basic integral types typedef's.
-               Cast allocation pointers to shut up old compilers.
-               Rework PORT directory into OS/machine directories.
-
-1.72 -> 1.73
-       btree:  If enough duplicate records were inserted and then deleted
-               that internal pages had references to empty pages of the
-               duplicate keys, the search function ended up on the wrong
-               page.
-
-1.7  -> 1.72   12 Oct 1993
-       hash:   Support NET/2 hash formats.
-
-1.7  -> 1.71   16 Sep 1993
-       btree/recno:
-               Fix bug in internal search routines that caused
-               return of invalid pointers.
-
-1.6  -> 1.7    07 Sep 1993
-       hash:   Fixed big key overflow bugs.
-       test:   Portability hacks, rewrite test script, Makefile.
-       btree/recno:
-               Stop copying non-overflow key/data pairs.
-       PORT:   Break PORT directory up into per architecture/OS
-               subdirectories.
-
-1.5  -> 1.6    06 Jun 1993
-       hash:   In PAIRFITS, the first comparison should look at (P)[2].
-               The hash_realloc function was walking off the end of memory.
-               The overflow page number was wrong when bumping splitpoint.
-
-1.4  -> 1.5    23 May 1993
-       hash:   Set hash default fill factor dynamically.
-       recno:  Fixed bug in sorted page splits.
-               Add page size parameter support.
-               Allow recno to specify the name of the underlying btree;
-                       used for vi recovery.
-       btree/recno:
-               Support 64K pages.
-       btree/hash/recno:
-               Provide access to an underlying file descriptor.
-               Change sync routines to take a flag argument, recno
-                       uses this to sync out the underlying btree.
-
-1.3  -> 1.4    10 May 1993
-       recno:  Delete the R_CURSORLOG flag from the recno interface.
-               Zero-length record fix for non-mmap reads.
-               Try and make SIZE_T_MAX test in open portable.
-
-1.2  -> 1.3    01 May 1993
-       btree:  Ignore user byte-order setting when reading already
-               existing database.  Fixes to byte-order conversions.
-
-1.1  -> 1.2    15 Apr 1993
-               No bug fixes, only compatibility hacks.
diff --git a/lib/nbsd_libc/db/db/Makefile.inc b/lib/nbsd_libc/db/db/Makefile.inc
deleted file mode 100644 (file)
index 9755e8f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#      $NetBSD: Makefile.inc,v 1.4 1995/02/27 13:21:22 cgd Exp $
-#       @(#)Makefile.inc       8.1 (Berkeley) 6/4/93
-
-.PATH: ${.CURDIR}/db/db
-
-SRCS+= db.c
diff --git a/lib/nbsd_libc/db/db/db.c b/lib/nbsd_libc/db/db/db.c
deleted file mode 100644 (file)
index fb3155e..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*     $NetBSD: db.c,v 1.16 2008/09/11 12:58:00 joerg Exp $    */
-
-/*-
- * Copyright (c) 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: db.c,v 1.16 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#include <db.h>
-static int __dberr(void);
-
-#ifdef __weak_alias
-__weak_alias(dbopen,_dbopen)
-#endif
-
-DB *
-dbopen(const char *fname, int flags, mode_t mode, DBTYPE type,
-    const void *openinfo)
-{
-
-#define        DB_FLAGS        (DB_LOCK | DB_SHMEM | DB_TXN)
-#ifdef __minix
-#define USE_OPEN_FLAGS                                                         \
-       (O_CREAT | O_EXCL | O_NONBLOCK | O_RDONLY |                     \
-        O_RDWR | O_TRUNC)
-#else /* !__minix */
-#define        USE_OPEN_FLAGS                                                  \
-       (O_CREAT | O_EXCL | O_EXLOCK | O_NONBLOCK | O_RDONLY |          \
-        O_RDWR | O_SHLOCK | O_TRUNC)
-#endif /* __minix */
-
-       if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
-               switch (type) {
-               case DB_BTREE:
-                       return (__bt_open(fname, flags & USE_OPEN_FLAGS,
-                           mode, openinfo, (int)(flags & DB_FLAGS)));
-               case DB_HASH:
-                       return (__hash_open(fname, flags & USE_OPEN_FLAGS,
-                           mode, openinfo, (int)(flags & DB_FLAGS)));
-               case DB_RECNO:
-                       return (__rec_open(fname, flags & USE_OPEN_FLAGS,
-                           mode, openinfo, (int)(flags & DB_FLAGS)));
-               }
-       errno = EINVAL;
-       return (NULL);
-}
-
-static int
-__dberr(void)
-{
-       return (RET_ERROR);
-}
-
-/*
- * __DBPANIC -- Stop.
- *
- * Parameters:
- *     dbp:    pointer to the DB structure.
- */
-void
-__dbpanic(DB *dbp)
-{
-       /* The only thing that can succeed is a close. */
-       dbp->del = (int (*)(const struct __db *, const DBT*, u_int))__dberr;
-       dbp->fd = (int (*)(const struct __db *))__dberr;
-       dbp->get = (int (*)(const struct __db *, const DBT*, DBT *, u_int))__dberr;
-       dbp->put = (int (*)(const struct __db *, DBT *, const DBT *, u_int))__dberr;
-       dbp->seq = (int (*)(const struct __db *, DBT *, DBT *, u_int))__dberr;
-       dbp->sync = (int (*)(const struct __db *, u_int))__dberr;
-}
diff --git a/lib/nbsd_libc/db/db2netbsd b/lib/nbsd_libc/db/db2netbsd
deleted file mode 100755 (executable)
index d5abeda..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/sh
-#      $NetBSD: db2netbsd,v 1.2 1999/02/16 18:01:37 kleink Exp $
-
-# This version transforms a Berkeley DB distribution into something
-# which can be 'cvs import'ed into the NetBSD source repository.
-# It is to be run in the untarred Berkeley DB distribution directory
-# (e.g. the "db.1.85" directory created by tar xvf), and sets up
-# the destination tree in place.
-
-version=`basename $PWD | sed -e 's/db\.//'`
-releasetag=`basename $PWD | sed -e 's/\./-/g'`
-
-CLEANFILES="PORT docs hash/search.h test/btree.tests test/hash.tests"
-
-# clean up pieces that we never import
-/bin/rm -rf $CLEANFILES
-find . -type l -o -name tags | xargs /bin/rm -f
-
-# The include files are already in place
-
-# Put the regression tests in the right place
-mkdir -p regress/lib/libc
-mv test regress/lib/libc/db
-
-# Put the libc pieces in the right place.
-mkdir -p lib/libc/db
-mv Makefile.inc README btree changelog db hash man mpool recno lib/libc/db
-
-echo "import with:"
-echo "cvs import -m \"Import of Berkeley DB version $version\" \
-src CSRG $releasetag"
diff --git a/lib/nbsd_libc/db/hash/Makefile.inc b/lib/nbsd_libc/db/hash/Makefile.inc
deleted file mode 100644 (file)
index d65b310..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#      $NetBSD: Makefile.inc,v 1.9 2005/09/13 01:44:09 christos Exp $
-#       @(#)Makefile.inc       8.1 (Berkeley) 6/4/93
-
-.PATH: ${.CURDIR}/db/hash
-
-SRCS+= hash.c hash_bigkey.c hash_buf.c hash_func.c hash_log2.c \
-       hash_page.c ndbmdatum.c ndbm.c
diff --git a/lib/nbsd_libc/db/hash/README b/lib/nbsd_libc/db/hash/README
deleted file mode 100644 (file)
index 02e1655..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#      $NetBSD: README,v 1.5 1999/02/16 17:59:18 kleink Exp $
-#      @(#)README      8.1 (Berkeley) 6/4/93
-
-This package implements a superset of the hsearch and dbm/ndbm libraries.
-
-Test Programs:
-       All test programs which need key/data pairs expect them entered
-       with key and data on separate lines
-
-       tcreat3.c       
-               Takes 
-                       bucketsize (bsize), 
-                       fill factor (ffactor), and
-                       initial number of elements (nelem).  
-               Creates a hash table named hashtest containing the 
-               keys/data pairs entered from standard in.
-       thash4.c
-               Takes
-                       bucketsize (bsize), 
-                       fill factor (ffactor), 
-                       initial number of elements (nelem)
-                       bytes of cache (ncached), and
-                       file from which to read data  (fname)
-               Creates a table from the key/data pairs on standard in and
-               then does a read of each key/data in fname
-       tdel.c
-               Takes
-                       bucketsize (bsize), and
-                       fill factor (ffactor).
-                       file from which to read data (fname)
-               Reads each key/data pair from fname and deletes the
-               key from the hash table hashtest
-       tseq.c
-               Reads the key/data pairs in the file hashtest and writes them
-               to standard out.
-       tread2.c
-               Takes
-                       butes of cache (ncached).
-               Reads key/data pairs from standard in and looks them up
-               in the file hashtest.
-       tverify.c
-               Reads key/data pairs from standard in, looks them up
-               in the file hashtest, and verifies that the data is
-               correct.
-
-NOTES:
-
-The man page ../man/db.3 explains the interface to the hashing system.
-The file hash.ps is a postscript copy of a paper explaining
-the history, implementation, and performance of the hash package.
-
-"bugs" or idiosyncracies
-
-If you have a lot of overflows, it is possible to run out of overflow
-pages.  Currently, this will cause a message to be printed on stderr.
-Eventually, this will be indicated by a return error code.
-
-If you are using the ndbm interface and exit without flushing or closing the
-file, you may lose updates since the package buffers all writes.  Also,
-the db interface only creates a single database file.  To avoid overwriting
-the user's original file, the suffix ".db" is appended to the file name
-passed to dbm_open.  Additionally, if your code "knows" about the historic
-.dir and .pag files, it will break.  
-
-There is a fundamental difference between this package and the old hsearch.
-Hsearch requires the user to maintain the keys and data in the application's
-allocated memory while hash takes care of all storage management.  The down
-side is that the byte strings passed in the ENTRY structure must be null
-terminated (both the keys and the data).
diff --git a/lib/nbsd_libc/db/hash/extern.h b/lib/nbsd_libc/db/hash/extern.h
deleted file mode 100644 (file)
index 455bf51..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*     $NetBSD: extern.h,v 1.9 2008/08/26 21:18:38 joerg Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993, 1994
- *     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. 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.
- *
- *     @(#)extern.h    8.4 (Berkeley) 6/16/94
- */
-
-BUFHEAD        *__add_ovflpage(HTAB *, BUFHEAD *);
-int     __addel(HTAB *, BUFHEAD *, const DBT *, const DBT *);
-int     __big_delete(HTAB *, BUFHEAD *);
-int     __big_insert(HTAB *, BUFHEAD *, const DBT *, const DBT *);
-int     __big_keydata(HTAB *, BUFHEAD *, DBT *, DBT *, int);
-int     __big_return(HTAB *, BUFHEAD *, int, DBT *, int);
-int     __big_split(HTAB *, BUFHEAD *, BUFHEAD *, BUFHEAD *,
-               int, uint32_t, SPLIT_RETURN *);
-int     __buf_free(HTAB *, int, int);
-void    __buf_init(HTAB *, u_int);
-uint32_t        __call_hash(HTAB *, char *, int);
-int     __delpair(HTAB *, BUFHEAD *, int);
-int     __expand_table(HTAB *);
-int     __find_bigpair(HTAB *, BUFHEAD *, int, char *, int);
-uint16_t        __find_last_page(HTAB *, BUFHEAD **);
-void    __free_ovflpage(HTAB *, BUFHEAD *);
-BUFHEAD        *__get_buf(HTAB *, uint32_t, BUFHEAD *, int);
-int     __get_page(HTAB *, char *, uint32_t, int, int, int);
-int     __ibitmap(HTAB *, int, int, int);
-uint32_t        __log2(uint32_t);
-int     __put_page(HTAB *, char *, uint32_t, int, int);
-void    __reclaim_buf(HTAB *, BUFHEAD *);
-int     __split_page(HTAB *, uint32_t, uint32_t);
-
-/* Default hash routine. */
-extern uint32_t (*__default_hash)(const void *, size_t);
-
-#ifdef HASH_STATISTICS
-extern int hash_accesses, hash_collisions, hash_expansions, hash_overflows;
-#endif
diff --git a/lib/nbsd_libc/db/hash/hash.c b/lib/nbsd_libc/db/hash/hash.c
deleted file mode 100644 (file)
index 5e69e4c..0000000
+++ /dev/null
@@ -1,981 +0,0 @@
-/*     $NetBSD: hash.c,v 1.31 2009/02/12 06:35:54 lukem Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: hash.c,v 1.31 2009/02/12 06:35:54 lukem Exp $");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <assert.h>
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "extern.h"
-
-static int   alloc_segs(HTAB *, int);
-static int   flush_meta(HTAB *);
-static int   hash_access(HTAB *, ACTION, DBT *, DBT *);
-static int   hash_close(DB *);
-static int   hash_delete(const DB *, const DBT *, uint32_t);
-static int   hash_fd(const DB *);
-static int   hash_get(const DB *, const DBT *, DBT *, uint32_t);
-static int   hash_put(const DB *, DBT *, const DBT *, uint32_t);
-static void *hash_realloc(SEGMENT **, size_t, size_t);
-static int   hash_seq(const DB *, DBT *, DBT *, uint32_t);
-static int   hash_sync(const DB *, uint32_t);
-static int   hdestroy(HTAB *);
-static HTAB *init_hash(HTAB *, const char *, const HASHINFO *);
-static int   init_htab(HTAB *, size_t);
-#if BYTE_ORDER == LITTLE_ENDIAN
-static void  swap_header(HTAB *);
-static void  swap_header_copy(HASHHDR *, HASHHDR *);
-#endif
-
-/* Fast arithmetic, relying on powers of 2, */
-#define MOD(x, y)              ((x) & ((y) - 1))
-
-#define RETURN_ERROR(ERR, LOC) { save_errno = ERR; goto LOC; }
-
-/* Return values */
-#define        SUCCESS  (0)
-#define        ERROR   (-1)
-#define        ABNORMAL (1)
-
-#ifdef HASH_STATISTICS
-int hash_accesses, hash_collisions, hash_expansions, hash_overflows;
-#endif
-
-/************************** INTERFACE ROUTINES ***************************/
-/* OPEN/CLOSE */
-
-/* ARGSUSED */
-DB *
-__hash_open(const char *file, int flags, mode_t mode, const HASHINFO *info,
-    int dflags)
-{
-       HTAB *hashp;
-       struct stat statbuf;
-       DB *dbp;
-       int bpages, new_table, nsegs, save_errno;
-       ssize_t hdrsize;
-
-       if ((flags & O_ACCMODE) == O_WRONLY) {
-               errno = EINVAL;
-               return (NULL);
-       }
-
-       if (!(hashp = calloc(1, sizeof(HTAB))))
-               return (NULL);
-       hashp->fp = -1;
-
-       /*
-        * Even if user wants write only, we need to be able to read
-        * the actual file, so we need to open it read/write. But, the
-        * field in the hashp structure needs to be accurate so that
-        * we can check accesses.
-        */
-       hashp->flags = flags;
-
-       new_table = 0;
-       if (!file || (flags & O_TRUNC) ||
-           (stat(file, &statbuf) && (errno == ENOENT))) {
-               if (errno == ENOENT)
-                       errno = 0; /* Just in case someone looks at errno */
-               new_table = 1;
-       }
-       if (file) {
-               if ((hashp->fp = open(file, flags, mode)) == -1)
-                       RETURN_ERROR(errno, error0);
-               if (fcntl(hashp->fp, F_SETFD, FD_CLOEXEC) == -1)
-                       RETURN_ERROR(errno, error1);
-               if (fstat(hashp->fp, &statbuf) == -1)
-                       RETURN_ERROR(errno, error1);
-               new_table |= statbuf.st_size == 0;
-       }
-       if (new_table) {
-               if (!(hashp = init_hash(hashp, file, info)))
-                       RETURN_ERROR(errno, error1);
-       } else {
-               /* Table already exists */
-               if (info && info->hash)
-                       hashp->hash = info->hash;
-               else
-                       hashp->hash = __default_hash;
-
-               hdrsize = read(hashp->fp, &hashp->hdr, sizeof(HASHHDR));
-#if BYTE_ORDER == LITTLE_ENDIAN
-               swap_header(hashp);
-#endif
-               if (hdrsize == -1)
-                       RETURN_ERROR(errno, error1);
-               if (hdrsize != sizeof(HASHHDR))
-                       RETURN_ERROR(EFTYPE, error1);
-               /* Verify file type, versions and hash function */
-               if (hashp->MAGIC != HASHMAGIC)
-                       RETURN_ERROR(EFTYPE, error1);
-#define        OLDHASHVERSION  1
-               if (hashp->VERSION != HASHVERSION &&
-                   hashp->VERSION != OLDHASHVERSION)
-                       RETURN_ERROR(EFTYPE, error1);
-               if (hashp->hash(CHARKEY, sizeof(CHARKEY)) !=
-                   (uint32_t)hashp->H_CHARKEY)
-                       RETURN_ERROR(EFTYPE, error1);
-               /*
-                * Figure out how many segments we need.  Max_Bucket is the
-                * maximum bucket number, so the number of buckets is
-                * max_bucket + 1.
-                */
-               nsegs = (hashp->MAX_BUCKET + 1 + hashp->SGSIZE - 1) /
-                        hashp->SGSIZE;
-               hashp->nsegs = 0;
-               if (alloc_segs(hashp, nsegs))
-                       /*
-                        * If alloc_segs fails, table will have been destroyed
-                        * and errno will have been set.
-                        */
-                       return (NULL);
-               /* Read in bitmaps */
-               bpages = (hashp->SPARES[hashp->OVFL_POINT] +
-                   (unsigned int)(hashp->BSIZE << BYTE_SHIFT) - 1) >>
-                   (hashp->BSHIFT + BYTE_SHIFT);
-
-               hashp->nmaps = bpages;
-               (void)memset(&hashp->mapp[0], 0, bpages * sizeof(uint32_t *));
-       }
-
-       /* Initialize Buffer Manager */
-       if (info && info->cachesize)
-               __buf_init(hashp, info->cachesize);
-       else
-               __buf_init(hashp, DEF_BUFSIZE);
-
-       hashp->new_file = new_table;
-       hashp->save_file = file && (hashp->flags & O_RDWR);
-       hashp->cbucket = -1;
-       if (!(dbp = malloc(sizeof(DB)))) {
-               save_errno = errno;
-               hdestroy(hashp);
-               errno = save_errno;
-               return (NULL);
-       }
-       dbp->internal = hashp;
-       dbp->close = hash_close;
-       dbp->del = hash_delete;
-       dbp->fd = hash_fd;
-       dbp->get = hash_get;
-       dbp->put = hash_put;
-       dbp->seq = hash_seq;
-       dbp->sync = hash_sync;
-       dbp->type = DB_HASH;
-
-#ifdef DEBUG
-       (void)fprintf(stderr,
-"%s\n%s%p\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n%s%x\n%s%x\n%s%d\n%s%d\n",
-           "init_htab:",
-           "TABLE POINTER   ", hashp,
-           "BUCKET SIZE     ", hashp->BSIZE,
-           "BUCKET SHIFT    ", hashp->BSHIFT,
-           "DIRECTORY SIZE  ", hashp->DSIZE,
-           "SEGMENT SIZE    ", hashp->SGSIZE,
-           "SEGMENT SHIFT   ", hashp->SSHIFT,
-           "FILL FACTOR     ", hashp->FFACTOR,
-           "MAX BUCKET      ", hashp->MAX_BUCKET,
-           "OVFL POINT      ", hashp->OVFL_POINT,
-           "LAST FREED      ", hashp->LAST_FREED,
-           "HIGH MASK       ", hashp->HIGH_MASK,
-           "LOW  MASK       ", hashp->LOW_MASK,
-           "NSEGS           ", hashp->nsegs,
-           "NKEYS           ", hashp->NKEYS);
-#endif
-#ifdef HASH_STATISTICS
-       hash_overflows = hash_accesses = hash_collisions = hash_expansions = 0;
-#endif
-       return (dbp);
-
-error1:
-       if (hashp != NULL)
-               (void)close(hashp->fp);
-
-error0:
-       free(hashp);
-       errno = save_errno;
-       return (NULL);
-}
-
-static int
-hash_close(DB *dbp)
-{
-       HTAB *hashp;
-       int retval;
-
-       if (!dbp)
-               return (ERROR);
-
-       hashp = dbp->internal;
-       retval = hdestroy(hashp);
-       free(dbp);
-       return (retval);
-}
-
-static int
-hash_fd(const DB *dbp)
-{
-       HTAB *hashp;
-
-       if (!dbp)
-               return (ERROR);
-
-       hashp = dbp->internal;
-       if (hashp->fp == -1) {
-               errno = ENOENT;
-               return (-1);
-       }
-       return (hashp->fp);
-}
-
-/************************** LOCAL CREATION ROUTINES **********************/
-static HTAB *
-init_hash(HTAB *hashp, const char *file, const HASHINFO *info)
-{
-       struct stat statbuf;
-       int nelem;
-
-       nelem = 1;
-       hashp->NKEYS = 0;
-       hashp->LORDER = BYTE_ORDER;
-       hashp->BSIZE = DEF_BUCKET_SIZE;
-       hashp->BSHIFT = DEF_BUCKET_SHIFT;
-       hashp->SGSIZE = DEF_SEGSIZE;
-       hashp->SSHIFT = DEF_SEGSIZE_SHIFT;
-       hashp->DSIZE = DEF_DIRSIZE;
-       hashp->FFACTOR = DEF_FFACTOR;
-       hashp->hash = __default_hash;
-       memset(hashp->SPARES, 0, sizeof(hashp->SPARES));
-       memset(hashp->BITMAPS, 0, sizeof (hashp->BITMAPS));
-
-       /* Fix bucket size to be optimal for file system */
-       if (file != NULL) {
-               if (stat(file, &statbuf))
-                       return (NULL);
-#ifdef __minix
-               if (statbuf.st_blksize == 0) {
-                       /* 0 in 2 cases: upgrade from old to new struct stat or
-                        * there is a bug in underlying fs.
-                        */
-                       hashp->BSIZE = MIN(MINIX_ST_BLKSIZE, MAX_BSIZE);
-               } else
-#endif
-                       hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE);
-
-               hashp->BSHIFT = __log2((uint32_t)hashp->BSIZE);
-       }
-
-       if (info) {
-               if (info->bsize) {
-                       /* Round pagesize up to power of 2 */
-                       hashp->BSHIFT = __log2(info->bsize);
-                       hashp->BSIZE = 1 << hashp->BSHIFT;
-                       if (hashp->BSIZE > MAX_BSIZE) {
-                               errno = EINVAL;
-                               return (NULL);
-                       }
-               }
-               if (info->ffactor)
-                       hashp->FFACTOR = info->ffactor;
-               if (info->hash)
-                       hashp->hash = info->hash;
-               if (info->nelem)
-                       nelem = info->nelem;
-               if (info->lorder) {
-                       if (info->lorder != BIG_ENDIAN &&
-                           info->lorder != LITTLE_ENDIAN) {
-                               errno = EINVAL;
-                               return (NULL);
-                       }
-                       hashp->LORDER = info->lorder;
-               }
-       }
-       /* init_htab should destroy the table and set errno if it fails */
-       if (init_htab(hashp, (size_t)nelem))
-               return (NULL);
-       else
-               return (hashp);
-}
-/*
- * This calls alloc_segs which may run out of memory.  Alloc_segs will destroy
- * the table and set errno, so we just pass the error information along.
- *
- * Returns 0 on No Error
- */
-static int
-init_htab(HTAB *hashp, size_t nelem)
-{
-       int nbuckets;
-       uint32_t nsegs;
-       int l2;
-
-       /*
-        * Divide number of elements by the fill factor and determine a
-        * desired number of buckets.  Allocate space for the next greater
-        * power of two number of buckets.
-        */
-       nelem = (nelem - 1) / hashp->FFACTOR + 1;
-
-       _DBFIT(nelem, uint32_t);
-       l2 = __log2(MAX((uint32_t)nelem, 2));
-       nbuckets = 1 << l2;
-
-       hashp->SPARES[l2] = l2 + 1;
-       hashp->SPARES[l2 + 1] = l2 + 1;
-       hashp->OVFL_POINT = l2;
-       hashp->LAST_FREED = 2;
-
-       /* First bitmap page is at: splitpoint l2 page offset 1 */
-       if (__ibitmap(hashp, (int)OADDR_OF(l2, 1), l2 + 1, 0))
-               return (-1);
-
-       hashp->MAX_BUCKET = hashp->LOW_MASK = nbuckets - 1;
-       hashp->HIGH_MASK = (nbuckets << 1) - 1;
-       /* LINTED constant in conditional context */
-       hashp->HDRPAGES = ((MAX(sizeof(HASHHDR), MINHDRSIZE) - 1) >>
-           hashp->BSHIFT) + 1;
-
-       nsegs = (nbuckets - 1) / hashp->SGSIZE + 1;
-       nsegs = 1 << __log2(nsegs);
-
-       if (nsegs > (uint32_t)hashp->DSIZE)
-               hashp->DSIZE = nsegs;
-       return (alloc_segs(hashp, (int)nsegs));
-}
-
-/********************** DESTROY/CLOSE ROUTINES ************************/
-
-/*
- * Flushes any changes to the file if necessary and destroys the hashp
- * structure, freeing all allocated space.
- */
-static int
-hdestroy(HTAB *hashp)
-{
-       int i, save_errno;
-
-       save_errno = 0;
-
-#ifdef HASH_STATISTICS
-       (void)fprintf(stderr, "hdestroy: accesses %d collisions %d\n",
-           hash_accesses, hash_collisions);
-       (void)fprintf(stderr, "hdestroy: expansions %d\n",
-           hash_expansions);
-       (void)fprintf(stderr, "hdestroy: overflows %d\n",
-           hash_overflows);
-       (void)fprintf(stderr, "keys %d maxp %d segmentcount %d\n",
-           hashp->NKEYS, hashp->MAX_BUCKET, hashp->nsegs);
-
-       for (i = 0; i < NCACHED; i++)
-               (void)fprintf(stderr,
-                   "spares[%d] = %d\n", i, hashp->SPARES[i]);
-#endif
-       /*
-        * Call on buffer manager to free buffers, and if required,
-        * write them to disk.
-        */
-       if (__buf_free(hashp, 1, hashp->save_file))
-               save_errno = errno;
-       if (hashp->dir) {
-               free(*hashp->dir);      /* Free initial segments */
-               /* Free extra segments */
-               while (hashp->exsegs--)
-                       free(hashp->dir[--hashp->nsegs]);
-               free(hashp->dir);
-       }
-       if (flush_meta(hashp) && !save_errno)
-               save_errno = errno;
-       /* Free Bigmaps */
-       for (i = 0; i < hashp->nmaps; i++)
-               if (hashp->mapp[i])
-                       free(hashp->mapp[i]);
-
-       if (hashp->fp != -1)
-               (void)close(hashp->fp);
-
-       free(hashp);
-
-       if (save_errno) {
-               errno = save_errno;
-               return (ERROR);
-       }
-       return (SUCCESS);
-}
-/*
- * Write modified pages to disk
- *
- * Returns:
- *      0 == OK
- *     -1 ERROR
- */
-static int
-hash_sync(const DB *dbp, uint32_t flags)
-{
-       HTAB *hashp;
-
-       if (flags != 0) {
-               errno = EINVAL;
-               return (ERROR);
-       }
-
-       if (!dbp)
-               return (ERROR);
-
-       hashp = dbp->internal;
-       if (!hashp->save_file)
-               return (0);
-       if (__buf_free(hashp, 0, 1) || flush_meta(hashp))
-               return (ERROR);
-       hashp->new_file = 0;
-       return (0);
-}
-
-/*
- * Returns:
- *      0 == OK
- *     -1 indicates that errno should be set
- */
-static int
-flush_meta(HTAB *hashp)
-{
-       HASHHDR *whdrp;
-#if BYTE_ORDER == LITTLE_ENDIAN
-       HASHHDR whdr;
-#endif
-       int fp, i;
-       ssize_t wsize;
-
-       if (!hashp->save_file)
-               return (0);
-       hashp->MAGIC = HASHMAGIC;
-       hashp->VERSION = HASHVERSION;
-       hashp->H_CHARKEY = hashp->hash(CHARKEY, sizeof(CHARKEY));
-
-       fp = hashp->fp;
-       whdrp = &hashp->hdr;
-#if BYTE_ORDER == LITTLE_ENDIAN
-       whdrp = &whdr;
-       swap_header_copy(&hashp->hdr, whdrp);
-#endif
-       if ((wsize = pwrite(fp, whdrp, sizeof(HASHHDR), (off_t)0)) == -1)
-               return (-1);
-       else
-               if (wsize != sizeof(HASHHDR)) {
-                       errno = EFTYPE;
-                       hashp->err = errno;
-                       return (-1);
-               }
-       for (i = 0; i < NCACHED; i++)
-               if (hashp->mapp[i])
-                       if (__put_page(hashp, (char *)(void *)hashp->mapp[i],
-                               (u_int)hashp->BITMAPS[i], 0, 1))
-                               return (-1);
-       return (0);
-}
-
-/*******************************SEARCH ROUTINES *****************************/
-/*
- * All the access routines return
- *
- * Returns:
- *      0 on SUCCESS
- *      1 to indicate an external ERROR (i.e. key not found, etc)
- *     -1 to indicate an internal ERROR (i.e. out of memory, etc)
- */
-static int
-hash_get(const DB *dbp, const DBT *key, DBT *data, uint32_t flag)
-{
-       HTAB *hashp;
-
-       hashp = dbp->internal;
-       if (flag) {
-               hashp->err = errno = EINVAL;
-               return (ERROR);
-       }
-       return (hash_access(hashp, HASH_GET, __UNCONST(key), data));
-}
-
-static int
-hash_put(const DB *dbp, DBT *key, const DBT *data, uint32_t flag)
-{
-       HTAB *hashp;
-
-       hashp = dbp->internal;
-       if (flag && flag != R_NOOVERWRITE) {
-               hashp->err = errno = EINVAL;
-               return (ERROR);
-       }
-       if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
-               hashp->err = errno = EPERM;
-               return (ERROR);
-       }
-       /* LINTED const castaway */
-       return (hash_access(hashp, flag == R_NOOVERWRITE ?
-           HASH_PUTNEW : HASH_PUT, __UNCONST(key), __UNCONST(data)));
-}
-
-static int
-hash_delete(const DB *dbp, const DBT *key, uint32_t flag)
-{
-       HTAB *hashp;
-
-       hashp = dbp->internal;
-       if (flag && flag != R_CURSOR) {
-               hashp->err = errno = EINVAL;
-               return (ERROR);
-       }
-       if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
-               hashp->err = errno = EPERM;
-               return (ERROR);
-       }
-       return hash_access(hashp, HASH_DELETE, __UNCONST(key), NULL);
-}
-
-/*
- * Assume that hashp has been set in wrapper routine.
- */
-static int
-hash_access(HTAB *hashp, ACTION action, DBT *key, DBT *val)
-{
-       BUFHEAD *rbufp;
-       BUFHEAD *bufp, *save_bufp;
-       uint16_t *bp;
-       int n, ndx, off;
-       size_t size;
-       char *kp;
-       uint16_t pageno;
-
-#ifdef HASH_STATISTICS
-       hash_accesses++;
-#endif
-
-       off = hashp->BSIZE;
-       size = key->size;
-       kp = (char *)key->data;
-       rbufp = __get_buf(hashp, __call_hash(hashp, kp, (int)size), NULL, 0);
-       if (!rbufp)
-               return (ERROR);
-       save_bufp = rbufp;
-
-       /* Pin the bucket chain */
-       rbufp->flags |= BUF_PIN;
-       for (bp = (uint16_t *)(void *)rbufp->page, n = *bp++, ndx = 1; ndx < n;)
-               if (bp[1] >= REAL_KEY) {
-                       /* Real key/data pair */
-                       if (size == (size_t)(off - *bp) &&
-                           memcmp(kp, rbufp->page + *bp, size) == 0)
-                               goto found;
-                       off = bp[1];
-#ifdef HASH_STATISTICS
-                       hash_collisions++;
-#endif
-                       bp += 2;
-                       ndx += 2;
-               } else if (bp[1] == OVFLPAGE) {
-                       rbufp = __get_buf(hashp, (uint32_t)*bp, rbufp, 0);
-                       if (!rbufp) {
-                               save_bufp->flags &= ~BUF_PIN;
-                               return (ERROR);
-                       }
-                       /* FOR LOOP INIT */
-                       bp = (uint16_t *)(void *)rbufp->page;
-                       n = *bp++;
-                       ndx = 1;
-                       off = hashp->BSIZE;
-               } else if (bp[1] < REAL_KEY) {
-                       if ((ndx =
-                           __find_bigpair(hashp, rbufp, ndx, kp, (int)size)) > 0)
-                               goto found;
-                       if (ndx == -2) {
-                               bufp = rbufp;
-                               if (!(pageno =
-                                   __find_last_page(hashp, &bufp))) {
-                                       ndx = 0;
-                                       rbufp = bufp;
-                                       break;  /* FOR */
-                               }
-                               rbufp = __get_buf(hashp, (uint32_t)pageno,
-                                   bufp, 0);
-                               if (!rbufp) {
-                                       save_bufp->flags &= ~BUF_PIN;
-                                       return (ERROR);
-                               }
-                               /* FOR LOOP INIT */
-                               bp = (uint16_t *)(void *)rbufp->page;
-                               n = *bp++;
-                               ndx = 1;
-                               off = hashp->BSIZE;
-                       } else {
-                               save_bufp->flags &= ~BUF_PIN;
-                               return (ERROR);
-                       }
-               }
-
-       /* Not found */
-       switch (action) {
-       case HASH_PUT:
-       case HASH_PUTNEW:
-               if (__addel(hashp, rbufp, key, val)) {
-                       save_bufp->flags &= ~BUF_PIN;
-                       return (ERROR);
-               } else {
-                       save_bufp->flags &= ~BUF_PIN;
-                       return (SUCCESS);
-               }
-       case HASH_GET:
-       case HASH_DELETE:
-       default:
-               save_bufp->flags &= ~BUF_PIN;
-               return (ABNORMAL);
-       }
-
-found:
-       switch (action) {
-       case HASH_PUTNEW:
-               save_bufp->flags &= ~BUF_PIN;
-               return (ABNORMAL);
-       case HASH_GET:
-               bp = (uint16_t *)(void *)rbufp->page;
-               if (bp[ndx + 1] < REAL_KEY) {
-                       if (__big_return(hashp, rbufp, ndx, val, 0))
-                               return (ERROR);
-               } else {
-                       val->data = (uint8_t *)rbufp->page + (int)bp[ndx + 1];
-                       val->size = bp[ndx] - bp[ndx + 1];
-               }
-               break;
-       case HASH_PUT:
-               if ((__delpair(hashp, rbufp, ndx)) ||
-                   (__addel(hashp, rbufp, key, val))) {
-                       save_bufp->flags &= ~BUF_PIN;
-                       return (ERROR);
-               }
-               break;
-       case HASH_DELETE:
-               if (__delpair(hashp, rbufp, ndx))
-                       return (ERROR);
-               break;
-       default:
-               abort();
-       }
-       save_bufp->flags &= ~BUF_PIN;
-       return (SUCCESS);
-}
-
-static int
-hash_seq(const DB *dbp, DBT *key, DBT *data, uint32_t flag)
-{
-       uint32_t bucket;
-       BUFHEAD *bufp = NULL; /* XXX: gcc */
-       HTAB *hashp;
-       uint16_t *bp, ndx;
-
-       hashp = dbp->internal;
-       if (flag && flag != R_FIRST && flag != R_NEXT) {
-               hashp->err = errno = EINVAL;
-               return (ERROR);
-       }
-#ifdef HASH_STATISTICS
-       hash_accesses++;
-#endif
-       if ((hashp->cbucket < 0) || (flag == R_FIRST)) {
-               hashp->cbucket = 0;
-               hashp->cndx = 1;
-               hashp->cpage = NULL;
-       }
-
-       for (bp = NULL; !bp || !bp[0]; ) {
-               if (!(bufp = hashp->cpage)) {
-                       for (bucket = hashp->cbucket;
-                           bucket <= (uint32_t)hashp->MAX_BUCKET;
-                           bucket++, hashp->cndx = 1) {
-                               bufp = __get_buf(hashp, bucket, NULL, 0);
-                               if (!bufp)
-                                       return (ERROR);
-                               hashp->cpage = bufp;
-                               bp = (uint16_t *)(void *)bufp->page;
-                               if (bp[0])
-                                       break;
-                       }
-                       hashp->cbucket = bucket;
-                       if (hashp->cbucket > hashp->MAX_BUCKET) {
-                               hashp->cbucket = -1;
-                               return (ABNORMAL);
-                       }
-               } else
-                       bp = (uint16_t *)(void *)hashp->cpage->page;
-
-               _DIAGASSERT(bp != NULL);
-               _DIAGASSERT(bufp != NULL);
-               while (bp[hashp->cndx + 1] == OVFLPAGE) {
-                       bufp = hashp->cpage =
-                           __get_buf(hashp, (uint32_t)bp[hashp->cndx], bufp,
-                               0);
-                       if (!bufp)
-                               return (ERROR);
-                       bp = (uint16_t *)(void *)(bufp->page);
-                       hashp->cndx = 1;
-               }
-               if (!bp[0]) {
-                       hashp->cpage = NULL;
-                       ++hashp->cbucket;
-               }
-       }
-       ndx = hashp->cndx;
-       if (bp[ndx + 1] < REAL_KEY) {
-               if (__big_keydata(hashp, bufp, key, data, 1))
-                       return (ERROR);
-       } else {
-               if (hashp->cpage == NULL)
-                       return (ERROR);
-               key->data = (uint8_t *)hashp->cpage->page + bp[ndx];
-               key->size = (ndx > 1 ? bp[ndx - 1] : hashp->BSIZE) - bp[ndx];
-               data->data = (uint8_t *)hashp->cpage->page + bp[ndx + 1];
-               data->size = bp[ndx] - bp[ndx + 1];
-               ndx += 2;
-               if (ndx > bp[0]) {
-                       hashp->cpage = NULL;
-                       hashp->cbucket++;
-                       hashp->cndx = 1;
-               } else
-                       hashp->cndx = ndx;
-       }
-       return (SUCCESS);
-}
-
-/********************************* UTILITIES ************************/
-
-/*
- * Returns:
- *      0 ==> OK
- *     -1 ==> Error
- */
-int
-__expand_table(HTAB *hashp)
-{
-       uint32_t old_bucket, new_bucket;
-       int new_segnum, spare_ndx;
-       size_t dirsize;
-
-#ifdef HASH_STATISTICS
-       hash_expansions++;
-#endif
-       new_bucket = ++hashp->MAX_BUCKET;
-       old_bucket = (hashp->MAX_BUCKET & hashp->LOW_MASK);
-
-       new_segnum = new_bucket >> hashp->SSHIFT;
-
-       /* Check if we need a new segment */
-       if (new_segnum >= hashp->nsegs) {
-               /* Check if we need to expand directory */
-               if (new_segnum >= hashp->DSIZE) {
-                       /* Reallocate directory */
-                       dirsize = hashp->DSIZE * sizeof(SEGMENT *);
-                       if (!hash_realloc(&hashp->dir, dirsize, dirsize << 1))
-                               return (-1);
-                       hashp->DSIZE = dirsize << 1;
-               }
-               if ((hashp->dir[new_segnum] =
-                   calloc((size_t)hashp->SGSIZE, sizeof(SEGMENT))) == NULL)
-                       return (-1);
-               hashp->exsegs++;
-               hashp->nsegs++;
-       }
-       /*
-        * If the split point is increasing (MAX_BUCKET's log base 2
-        * * increases), we need to copy the current contents of the spare
-        * split bucket to the next bucket.
-        */
-       spare_ndx = __log2((uint32_t)(hashp->MAX_BUCKET + 1));
-       if (spare_ndx > hashp->OVFL_POINT) {
-               hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT];
-               hashp->OVFL_POINT = spare_ndx;
-       }
-
-       if (new_bucket > (uint32_t)hashp->HIGH_MASK) {
-               /* Starting a new doubling */
-               hashp->LOW_MASK = hashp->HIGH_MASK;
-               hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK;
-       }
-       /* Relocate records to the new bucket */
-       return (__split_page(hashp, old_bucket, new_bucket));
-}
-
-/*
- * If realloc guarantees that the pointer is not destroyed if the realloc
- * fails, then this routine can go away.
- */
-static void *
-hash_realloc(SEGMENT **p_ptr, size_t oldsize, size_t newsize)
-{
-       void *p;
-
-       if ((p = malloc(newsize)) != NULL) {
-               memmove(p, *p_ptr, oldsize);
-               memset((char *)p + oldsize, 0, newsize - oldsize);
-               free(*p_ptr);
-               *p_ptr = p;
-       }
-       return (p);
-}
-
-uint32_t
-__call_hash(HTAB *hashp, char *k, int len)
-{
-       int n, bucket;
-
-       n = hashp->hash(k, (size_t)len);
-       bucket = n & hashp->HIGH_MASK;
-       if (bucket > hashp->MAX_BUCKET)
-               bucket = bucket & hashp->LOW_MASK;
-       return (bucket);
-}
-
-/*
- * Allocate segment table.  On error, destroy the table and set errno.
- *
- * Returns 0 on success
- */
-static int
-alloc_segs(HTAB *hashp, int nsegs)
-{
-       int i;
-       SEGMENT store;
-
-       int save_errno;
-
-       hashp->dir = calloc((size_t)hashp->DSIZE, sizeof(SEGMENT *));
-       if (hashp->dir == NULL) {
-               save_errno = errno;
-               (void)hdestroy(hashp);
-               errno = save_errno;
-               return (-1);
-       }
-       hashp->nsegs = nsegs;
-       if (nsegs == 0)
-               return 0;
-       /* Allocate segments */
-       store = calloc((size_t)(nsegs << hashp->SSHIFT), sizeof(SEGMENT));
-       if (store == NULL) {
-               save_errno = errno;
-               (void)hdestroy(hashp);
-               errno = save_errno;
-               return (-1);
-       }
-       for (i = 0; i < nsegs; i++)
-               hashp->dir[i] = &store[i << hashp->SSHIFT];
-       return (0);
-}
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-/*
- * Hashp->hdr needs to be byteswapped.
- */
-static void
-swap_header_copy(HASHHDR *srcp, HASHHDR *destp)
-{
-       size_t i;
-
-       P_32_COPY(srcp->magic, destp->magic);
-       P_32_COPY(srcp->version, destp->version);
-       P_32_COPY(srcp->lorder, destp->lorder);
-       P_32_COPY(srcp->bsize, destp->bsize);
-       P_32_COPY(srcp->bshift, destp->bshift);
-       P_32_COPY(srcp->dsize, destp->dsize);
-       P_32_COPY(srcp->ssize, destp->ssize);
-       P_32_COPY(srcp->sshift, destp->sshift);
-       P_32_COPY(srcp->ovfl_point, destp->ovfl_point);
-       P_32_COPY(srcp->last_freed, destp->last_freed);
-       P_32_COPY(srcp->max_bucket, destp->max_bucket);
-       P_32_COPY(srcp->high_mask, destp->high_mask);
-       P_32_COPY(srcp->low_mask, destp->low_mask);
-       P_32_COPY(srcp->ffactor, destp->ffactor);
-       P_32_COPY(srcp->nkeys, destp->nkeys);
-       P_32_COPY(srcp->hdrpages, destp->hdrpages);
-       P_32_COPY(srcp->h_charkey, destp->h_charkey);
-       for (i = 0; i < NCACHED; i++) {
-               P_32_COPY(srcp->spares[i], destp->spares[i]);
-               P_16_COPY(srcp->bitmaps[i], destp->bitmaps[i]);
-       }
-}
-
-static void
-swap_header(HTAB *hashp)
-{
-       HASHHDR *hdrp;
-       size_t i;
-
-       hdrp = &hashp->hdr;
-
-       M_32_SWAP(hdrp->magic);
-       M_32_SWAP(hdrp->version);
-       M_32_SWAP(hdrp->lorder);
-       M_32_SWAP(hdrp->bsize);
-       M_32_SWAP(hdrp->bshift);
-       M_32_SWAP(hdrp->dsize);
-       M_32_SWAP(hdrp->ssize);
-       M_32_SWAP(hdrp->sshift);
-       M_32_SWAP(hdrp->ovfl_point);
-       M_32_SWAP(hdrp->last_freed);
-       M_32_SWAP(hdrp->max_bucket);
-       M_32_SWAP(hdrp->high_mask);
-       M_32_SWAP(hdrp->low_mask);
-       M_32_SWAP(hdrp->ffactor);
-       M_32_SWAP(hdrp->nkeys);
-       M_32_SWAP(hdrp->hdrpages);
-       M_32_SWAP(hdrp->h_charkey);
-       for (i = 0; i < NCACHED; i++) {
-               M_32_SWAP(hdrp->spares[i]);
-               M_16_SWAP(hdrp->bitmaps[i]);
-       }
-}
-#endif
diff --git a/lib/nbsd_libc/db/hash/hash.h b/lib/nbsd_libc/db/hash/hash.h
deleted file mode 100644 (file)
index f3c87a8..0000000
+++ /dev/null
@@ -1,295 +0,0 @@
-/*     $NetBSD: hash.h,v 1.15 2008/08/26 21:18:38 joerg Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- *
- *     @(#)hash.h      8.3 (Berkeley) 5/31/94
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-/* Operations */
-typedef enum {
-       HASH_GET, HASH_PUT, HASH_PUTNEW, HASH_DELETE, HASH_FIRST, HASH_NEXT
-} ACTION;
-
-/* Buffer Management structures */
-typedef struct _bufhead BUFHEAD;
-
-struct _bufhead {
-       BUFHEAD         *prev;          /* LRU links */
-       BUFHEAD         *next;          /* LRU links */
-       BUFHEAD         *ovfl;          /* Overflow page buffer header */
-       uint32_t         addr;          /* Address of this page */
-       char            *page;          /* Actual page data */
-       char            flags;
-#define        BUF_MOD         0x0001
-#define BUF_DISK       0x0002
-#define        BUF_BUCKET      0x0004
-#define        BUF_PIN         0x0008
-};
-
-#define IS_BUCKET(X)   ((X) & BUF_BUCKET)
-
-typedef BUFHEAD **SEGMENT;
-
-/* Hash Table Information */
-typedef struct hashhdr {               /* Disk resident portion */
-       int32_t         magic;          /* Magic NO for hash tables */
-       int32_t         version;        /* Version ID */
-       uint32_t        lorder;         /* Byte Order */
-       int32_t         bsize;          /* Bucket/Page Size */
-       int32_t         bshift;         /* Bucket shift */
-       int32_t         dsize;          /* Directory Size */
-       int32_t         ssize;          /* Segment Size */
-       int32_t         sshift;         /* Segment shift */
-       int32_t         ovfl_point;     /* Where overflow pages are being 
-                                        * allocated */
-       int32_t         last_freed;     /* Last overflow page freed */
-       int32_t         max_bucket;     /* ID of Maximum bucket in use */
-       int32_t         high_mask;      /* Mask to modulo into entire table */
-       int32_t         low_mask;       /* Mask to modulo into lower half of 
-                                        * table */
-       int32_t         ffactor;        /* Fill factor */
-       int32_t         nkeys;          /* Number of keys in hash table */
-       int32_t         hdrpages;       /* Size of table header */
-       int32_t         h_charkey;      /* value of hash(CHARKEY) */
-#define NCACHED        32                      /* number of bit maps and spare 
-                                        * points */
-       int32_t         spares[NCACHED];/* spare pages for overflow */
-       uint16_t        bitmaps[NCACHED];       /* address of overflow page 
-                                                * bitmaps */
-} HASHHDR;
-
-typedef struct htab     {              /* Memory resident data structure */
-       HASHHDR         hdr;            /* Header */
-       int             nsegs;          /* Number of allocated segments */
-       int             exsegs;         /* Number of extra allocated 
-                                        * segments */
-       uint32_t        (*hash)(const void *, size_t);  /* Hash function */
-       int             flags;          /* Flag values */
-       int             fp;             /* File pointer */
-       char            *tmp_buf;       /* Temporary Buffer for BIG data */
-       char            *tmp_key;       /* Temporary Buffer for BIG keys */
-       BUFHEAD         *cpage;         /* Current page */
-       int             cbucket;        /* Current bucket */
-       int             cndx;           /* Index of next item on cpage */
-       int             err;            /* Error Number -- for DBM 
-                                        * compatibility */
-       int             new_file;       /* Indicates if fd is backing store 
-                                        * or no */
-       int             save_file;      /* Indicates whether we need to flush 
-                                        * file at
-                                        * exit */
-       uint32_t        *mapp[NCACHED]; /* Pointers to page maps */
-       int             nmaps;          /* Initial number of bitmaps */
-       int             nbufs;          /* Number of buffers left to 
-                                        * allocate */
-       BUFHEAD         bufhead;        /* Header of buffer lru list */
-       SEGMENT         *dir;           /* Hash Bucket directory */
-} HTAB;
-
-/*
- * Constants
- */
-#define        MAX_BSIZE               65536           /* 2^16 */
-#define MIN_BUFFERS            6
-#define MINHDRSIZE             512
-#define DEF_BUFSIZE            65536           /* 64 K */
-#define DEF_BUCKET_SIZE                4096
-#define DEF_BUCKET_SHIFT       12              /* log2(BUCKET) */
-#define DEF_SEGSIZE            256
-#define DEF_SEGSIZE_SHIFT      8               /* log2(SEGSIZE)         */
-#define DEF_DIRSIZE            256
-#define DEF_FFACTOR            65536
-#define MIN_FFACTOR            4
-#define SPLTMAX                        8
-#define CHARKEY                        "%$sniglet^&"
-#define NUMKEY                 1038583
-#define BYTE_SHIFT             3
-#define INT_TO_BYTE            2
-#define INT_BYTE_SHIFT         5
-#define ALL_SET                        ((uint32_t)0xFFFFFFFF)
-#define ALL_CLEAR              0
-
-#define PTROF(X)       ((BUFHEAD *)(void *)((u_long)(X)&~0x3))
-#define ISMOD(X)       ((uint32_t)(u_long)(X)&0x1)
-#define DOMOD(X)       ((X) = (char *)(void *)((u_long)(X)|0x1))
-#define ISDISK(X)      ((uint32_t)(u_long)(X)&0x2)
-#define DODISK(X)      ((X) = (char *)(void *)((u_long)(X)|0x2))
-
-#define BITS_PER_MAP   32
-
-/* Given the address of the beginning of a big map, clear/set the nth bit */
-#define CLRBIT(A, N)   ((A)[(N)/BITS_PER_MAP] &= ~(1<<((N)%BITS_PER_MAP)))
-#define SETBIT(A, N)   ((A)[(N)/BITS_PER_MAP] |= (1<<((N)%BITS_PER_MAP)))
-#define ISSET(A, N)    ((A)[(N)/BITS_PER_MAP] & (1<<((N)%BITS_PER_MAP)))
-
-/* Overflow management */
-/*
- * Overflow page numbers are allocated per split point.  At each doubling of
- * the table, we can allocate extra pages.  So, an overflow page number has
- * the top 5 bits indicate which split point and the lower 11 bits indicate
- * which page at that split point is indicated (pages within split points are
- * numberered starting with 1).
- */
-
-#define SPLITSHIFT     11
-#define SPLITMASK      0x7FF
-#define SPLITNUM(N)    (((uint32_t)(N)) >> SPLITSHIFT)
-#define OPAGENUM(N)    ((N) & SPLITMASK)
-#define        OADDR_OF(S,O)   ((uint32_t)((uint32_t)(S) << SPLITSHIFT) + (O))
-
-#define BUCKET_TO_PAGE(B) \
-       (B) + hashp->HDRPAGES + \
-       ((B) ? hashp->SPARES[__log2((uint32_t)((B)+1))-1] : 0)
-#define OADDR_TO_PAGE(B)       \
-       BUCKET_TO_PAGE ( (1 << SPLITNUM((B))) -1 ) + OPAGENUM((B));
-
-/*
- * page.h contains a detailed description of the page format.
- *
- * Normally, keys and data are accessed from offset tables in the top of
- * each page which point to the beginning of the key and data.  There are
- * four flag values which may be stored in these offset tables which indicate
- * the following:
- *
- *
- * OVFLPAGE    Rather than a key data pair, this pair contains
- *             the address of an overflow page.  The format of
- *             the pair is:
- *                 OVERFLOW_PAGE_NUMBER OVFLPAGE
- *
- * PARTIAL_KEY This must be the first key/data pair on a page
- *             and implies that page contains only a partial key.
- *             That is, the key is too big to fit on a single page
- *             so it starts on this page and continues on the next.
- *             The format of the page is:
- *                 KEY_OFF PARTIAL_KEY OVFL_PAGENO OVFLPAGE
- *             
- *                 KEY_OFF -- offset of the beginning of the key
- *                 PARTIAL_KEY -- 1
- *                 OVFL_PAGENO - page number of the next overflow page
- *                 OVFLPAGE -- 0
- *
- * FULL_KEY    This must be the first key/data pair on the page.  It
- *             is used in two cases.
- *
- *             Case 1:
- *                 There is a complete key on the page but no data
- *                 (because it wouldn't fit).  The next page contains
- *                 the data.
- *
- *                 Page format it:
- *                 KEY_OFF FULL_KEY OVFL_PAGENO OVFL_PAGE
- *
- *                 KEY_OFF -- offset of the beginning of the key
- *                 FULL_KEY -- 2
- *                 OVFL_PAGENO - page number of the next overflow page
- *                 OVFLPAGE -- 0
- *
- *             Case 2:
- *                 This page contains no key, but part of a large
- *                 data field, which is continued on the next page.
- *
- *                 Page format it:
- *                 DATA_OFF FULL_KEY OVFL_PAGENO OVFL_PAGE
- *
- *                 KEY_OFF -- offset of the beginning of the data on
- *                             this page
- *                 FULL_KEY -- 2
- *                 OVFL_PAGENO - page number of the next overflow page
- *                 OVFLPAGE -- 0
- *
- * FULL_KEY_DATA 
- *             This must be the first key/data pair on the page.
- *             There are two cases:
- *
- *             Case 1:
- *                 This page contains a key and the beginning of the
- *                 data field, but the data field is continued on the
- *                 next page.
- *
- *                 Page format is:
- *                 KEY_OFF FULL_KEY_DATA OVFL_PAGENO DATA_OFF
- *
- *                 KEY_OFF -- offset of the beginning of the key
- *                 FULL_KEY_DATA -- 3
- *                 OVFL_PAGENO - page number of the next overflow page
- *                 DATA_OFF -- offset of the beginning of the data
- *
- *             Case 2:
- *                 This page contains the last page of a big data pair.
- *                 There is no key, only the  tail end of the data
- *                 on this page.
- *
- *                 Page format is:
- *                 DATA_OFF FULL_KEY_DATA <OVFL_PAGENO> <OVFLPAGE>
- *
- *                 DATA_OFF -- offset of the beginning of the data on
- *                             this page
- *                 FULL_KEY_DATA -- 3
- *                 OVFL_PAGENO - page number of the next overflow page
- *                 OVFLPAGE -- 0
- *
- *                 OVFL_PAGENO and OVFLPAGE are optional (they are
- *                 not present if there is no next page).
- */
-
-#define OVFLPAGE       0
-#define PARTIAL_KEY    1
-#define FULL_KEY       2
-#define FULL_KEY_DATA  3
-#define        REAL_KEY        4
-
-/* Short hands for accessing structure */
-#define BSIZE          hdr.bsize
-#define BSHIFT         hdr.bshift
-#define DSIZE          hdr.dsize
-#define SGSIZE         hdr.ssize
-#define SSHIFT         hdr.sshift
-#define LORDER         hdr.lorder
-#define OVFL_POINT     hdr.ovfl_point
-#define        LAST_FREED      hdr.last_freed
-#define MAX_BUCKET     hdr.max_bucket
-#define FFACTOR                hdr.ffactor
-#define HIGH_MASK      hdr.high_mask
-#define LOW_MASK       hdr.low_mask
-#define NKEYS          hdr.nkeys
-#define HDRPAGES       hdr.hdrpages
-#define SPARES         hdr.spares
-#define BITMAPS                hdr.bitmaps
-#define VERSION                hdr.version
-#define MAGIC          hdr.magic
-#define NEXT_FREE      hdr.next_free
-#define H_CHARKEY      hdr.h_charkey
diff --git a/lib/nbsd_libc/db/hash/hash_bigkey.c b/lib/nbsd_libc/db/hash/hash_bigkey.c
deleted file mode 100644 (file)
index 5c6fc9b..0000000
+++ /dev/null
@@ -1,674 +0,0 @@
-/*     $NetBSD: hash_bigkey.c,v 1.23 2009/02/12 06:33:13 lukem Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: hash_bigkey.c,v 1.23 2009/02/12 06:33:13 lukem Exp $");
-
-/*
- * PACKAGE: hash
- * DESCRIPTION:
- *     Big key/data handling for the hashing package.
- *
- * ROUTINES:
- * External
- *     __big_keydata
- *     __big_split
- *     __big_insert
- *     __big_return
- *     __big_delete
- *     __find_last_page
- * Internal
- *     collect_key
- *     collect_data
- */
-
-#include <sys/param.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "extern.h"
-
-static int collect_key(HTAB *, BUFHEAD *, int, DBT *, int);
-static int collect_data(HTAB *, BUFHEAD *, int, int);
-
-/*
- * Big_insert
- *
- * You need to do an insert and the key/data pair is too big
- *
- * Returns:
- * 0 ==> OK
- *-1 ==> ERROR
- */
-int
-__big_insert(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
-{
-       uint16_t *p, n;
-       size_t key_size, val_size;
-       uint16_t space, move_bytes, off;
-       char *cp, *key_data, *val_data;
-       size_t temp;
-
-       cp = bufp->page;                /* Character pointer of p. */
-       p = (uint16_t *)(void *)cp;
-
-       key_data = (char *)key->data;
-       _DBFIT(key->size, int);
-       key_size = key->size;
-       val_data = (char *)val->data;
-       _DBFIT(val->size, int);
-       val_size = val->size;
-
-       /* First move the Key */
-       
-       temp = FREESPACE(p) - BIGOVERHEAD;
-       _DBFIT(temp, uint16_t);
-       space = (uint16_t)temp;
-       while (key_size) {
-               move_bytes = MIN(space, key_size);
-               off = OFFSET(p) - move_bytes;
-               memmove(cp + off, key_data, (size_t)move_bytes);
-               key_size -= move_bytes;
-               key_data += move_bytes;
-               n = p[0];
-               p[++n] = off;
-               p[0] = ++n;
-               temp = off - PAGE_META(n);
-               _DBFIT(temp, uint16_t);
-               FREESPACE(p) = (uint16_t)temp;
-               OFFSET(p) = off;
-               p[n] = PARTIAL_KEY;
-               bufp = __add_ovflpage(hashp, bufp);
-               if (!bufp)
-                       return (-1);
-               n = p[0];
-               if (!key_size) {
-                       space = FREESPACE(p);
-                       if (space) {
-                               move_bytes = MIN(space, val_size);
-                               /*
-                                * If the data would fit exactly in the
-                                * remaining space, we must overflow it to the
-                                * next page; otherwise the invariant that the
-                                * data must end on a page with FREESPACE
-                                * non-zero would fail.
-                                */
-                               if (space == val_size && val_size == val->size)
-                                       goto toolarge;
-                               off = OFFSET(p) - move_bytes;
-                               memmove(cp + off, val_data, (size_t)move_bytes);
-                               val_data += move_bytes;
-                               val_size -= move_bytes;
-                               p[n] = off;
-                               p[n - 2] = FULL_KEY_DATA;
-                               FREESPACE(p) = FREESPACE(p) - move_bytes;
-                               OFFSET(p) = off;
-                       } else {
-                       toolarge:
-                               p[n - 2] = FULL_KEY;
-                       }
-               }
-               p = (uint16_t *)(void *)bufp->page;
-               cp = bufp->page;
-               bufp->flags |= BUF_MOD;
-               temp = FREESPACE(p) - BIGOVERHEAD;
-               _DBFIT(temp, uint16_t);
-               space = (uint16_t)temp;
-       }
-
-       /* Now move the data */
-       temp = FREESPACE(p) - BIGOVERHEAD;
-       _DBFIT(temp, uint16_t);
-       space = (uint16_t)temp;
-       while (val_size) {
-               move_bytes = MIN(space, val_size);
-               /*
-                * Here's the hack to make sure that if the data ends on the
-                * same page as the key ends, FREESPACE is at least one.
-                */
-               if (space == val_size && val_size == val->size)
-                       move_bytes--;
-               off = OFFSET(p) - move_bytes;
-               memmove(cp + off, val_data, (size_t)move_bytes);
-               val_size -= move_bytes;
-               val_data += move_bytes;
-               n = p[0];
-               p[++n] = off;
-               p[0] = ++n;
-               temp = off - PAGE_META(n);
-               _DBFIT(temp, uint16_t);
-               FREESPACE(p) = (uint16_t)temp;
-               OFFSET(p) = off;
-               if (val_size) {
-                       p[n] = FULL_KEY;
-                       bufp = __add_ovflpage(hashp, bufp);
-                       if (!bufp)
-                               return (-1);
-                       cp = bufp->page;
-                       p = (uint16_t *)(void *)cp;
-               } else
-                       p[n] = FULL_KEY_DATA;
-               bufp->flags |= BUF_MOD;
-               temp = FREESPACE(p) - BIGOVERHEAD;
-               _DBFIT(temp, uint16_t);
-               space = (uint16_t)temp;
-       }
-       return (0);
-}
-
-/*
- * Called when bufp's page  contains a partial key (index should be 1)
- *
- * All pages in the big key/data pair except bufp are freed.  We cannot
- * free bufp because the page pointing to it is lost and we can't get rid
- * of its pointer.
- *
- * Returns:
- * 0 => OK
- *-1 => ERROR
- */
-int
-__big_delete(HTAB *hashp, BUFHEAD *bufp)
-{
-       BUFHEAD *last_bfp, *rbufp;
-       uint16_t *bp, pageno;
-       int key_done, n;
-       size_t temp;
-
-       rbufp = bufp;
-       last_bfp = NULL;
-       bp = (uint16_t *)(void *)bufp->page;
-       pageno = 0;
-       key_done = 0;
-
-       while (!key_done || (bp[2] != FULL_KEY_DATA)) {
-               if (bp[2] == FULL_KEY || bp[2] == FULL_KEY_DATA)
-                       key_done = 1;
-
-               /*
-                * If there is freespace left on a FULL_KEY_DATA page, then
-                * the data is short and fits entirely on this page, and this
-                * is the last page.
-                */
-               if (bp[2] == FULL_KEY_DATA && FREESPACE(bp))
-                       break;
-               pageno = bp[bp[0] - 1];
-               rbufp->flags |= BUF_MOD;
-               rbufp = __get_buf(hashp, (uint32_t)pageno, rbufp, 0);
-               if (last_bfp)
-                       __free_ovflpage(hashp, last_bfp);
-               last_bfp = rbufp;
-               if (!rbufp)
-                       return (-1);            /* Error. */
-               bp = (uint16_t *)(void *)rbufp->page;
-       }
-
-       /*
-        * If we get here then rbufp points to the last page of the big
-        * key/data pair.  Bufp points to the first one -- it should now be
-        * empty pointing to the next page after this pair.  Can't free it
-        * because we don't have the page pointing to it.
-        */
-
-       /* This is information from the last page of the pair. */
-       n = bp[0];
-       pageno = bp[n - 1];
-
-       /* Now, bp is the first page of the pair. */
-       bp = (uint16_t *)(void *)bufp->page;
-       if (n > 2) {
-               /* There is an overflow page. */
-               bp[1] = pageno;
-               bp[2] = OVFLPAGE;
-               bufp->ovfl = rbufp->ovfl;
-       } else
-               /* This is the last page. */
-               bufp->ovfl = NULL;
-       n -= 2;
-       bp[0] = n;
-       temp = hashp->BSIZE - PAGE_META(n);
-       _DBFIT(temp, uint16_t);
-       FREESPACE(bp) = (uint16_t)temp;
-       OFFSET(bp) = hashp->BSIZE;
-
-       bufp->flags |= BUF_MOD;
-       if (rbufp)
-               __free_ovflpage(hashp, rbufp);
-       if (last_bfp && last_bfp != rbufp)
-               __free_ovflpage(hashp, last_bfp);
-
-       hashp->NKEYS--;
-       return (0);
-}
-/*
- * Returns:
- *  0 = key not found
- * -1 = get next overflow page
- * -2 means key not found and this is big key/data
- * -3 error
- */
-int
-__find_bigpair(HTAB *hashp, BUFHEAD *bufp, int ndx, char *key, int size)
-{
-       uint16_t *bp;
-       char *p;
-       int ksize;
-       uint16_t bytes;
-       char *kkey;
-
-       bp = (uint16_t *)(void *)bufp->page;
-       p = bufp->page;
-       ksize = size;
-       kkey = key;
-
-       for (bytes = hashp->BSIZE - bp[ndx];
-           bytes <= size && bp[ndx + 1] == PARTIAL_KEY;
-           bytes = hashp->BSIZE - bp[ndx]) {
-               if (memcmp(p + bp[ndx], kkey, (size_t)bytes))
-                       return (-2);
-               kkey += bytes;
-               ksize -= bytes;
-               bufp = __get_buf(hashp, (uint32_t)bp[ndx + 2], bufp, 0);
-               if (!bufp)
-                       return (-3);
-               p = bufp->page;
-               bp = (uint16_t *)(void *)p;
-               ndx = 1;
-       }
-
-       if (bytes != ksize || memcmp(p + bp[ndx], kkey, (size_t)bytes)) {
-#ifdef HASH_STATISTICS
-               ++hash_collisions;
-#endif
-               return (-2);
-       } else
-               return (ndx);
-}
-
-/*
- * Given the buffer pointer of the first overflow page of a big pair,
- * find the end of the big pair
- *
- * This will set bpp to the buffer header of the last page of the big pair.
- * It will return the pageno of the overflow page following the last page
- * of the pair; 0 if there isn't any (i.e. big pair is the last key in the
- * bucket)
- */
-uint16_t
-__find_last_page(HTAB *hashp, BUFHEAD **bpp)
-{
-       BUFHEAD *bufp;
-       uint16_t *bp, pageno;
-       int n;
-
-       bufp = *bpp;
-       bp = (uint16_t *)(void *)bufp->page;
-       for (;;) {
-               n = bp[0];
-
-               /*
-                * This is the last page if: the tag is FULL_KEY_DATA and
-                * either only 2 entries OVFLPAGE marker is explicit there
-                * is freespace on the page.
-                */
-               if (bp[2] == FULL_KEY_DATA &&
-                   ((n == 2) || (bp[n] == OVFLPAGE) || (FREESPACE(bp))))
-                       break;
-
-               pageno = bp[n - 1];
-               bufp = __get_buf(hashp, (uint32_t)pageno, bufp, 0);
-               if (!bufp)
-                       return (0);     /* Need to indicate an error! */
-               bp = (uint16_t *)(void *)bufp->page;
-       }
-
-       *bpp = bufp;
-       if (bp[0] > 2)
-               return (bp[3]);
-       else
-               return (0);
-}
-
-/*
- * Return the data for the key/data pair that begins on this page at this
- * index (index should always be 1).
- */
-int
-__big_return(HTAB *hashp, BUFHEAD *bufp, int ndx, DBT *val, int set_current)
-{
-       BUFHEAD *save_p;
-       uint16_t *bp, len, off, save_addr;
-       char *tp;
-
-       bp = (uint16_t *)(void *)bufp->page;
-       while (bp[ndx + 1] == PARTIAL_KEY) {
-               bufp = __get_buf(hashp, (uint32_t)bp[bp[0] - 1], bufp, 0);
-               if (!bufp)
-                       return (-1);
-               bp = (uint16_t *)(void *)bufp->page;
-               ndx = 1;
-       }
-
-       if (bp[ndx + 1] == FULL_KEY) {
-               bufp = __get_buf(hashp, (uint32_t)bp[bp[0] - 1], bufp, 0);
-               if (!bufp)
-                       return (-1);
-               bp = (uint16_t *)(void *)bufp->page;
-               save_p = bufp;
-               save_addr = save_p->addr;
-               off = bp[1];
-               len = 0;
-       } else
-               if (!FREESPACE(bp)) {
-                       /*
-                        * This is a hack.  We can't distinguish between
-                        * FULL_KEY_DATA that contains complete data or
-                        * incomplete data, so we require that if the data
-                        * is complete, there is at least 1 byte of free
-                        * space left.
-                        */
-                       off = bp[bp[0]];
-                       len = bp[1] - off;
-                       save_p = bufp;
-                       save_addr = bufp->addr;
-                       bufp = __get_buf(hashp, (uint32_t)bp[bp[0] - 1], bufp,
-                           0);
-                       if (!bufp)
-                               return (-1);
-                       bp = (uint16_t *)(void *)bufp->page;
-               } else {
-                       /* The data is all on one page. */
-                       tp = (char *)(void *)bp;
-                       off = bp[bp[0]];
-                       val->data = (uint8_t *)tp + off;
-                       val->size = bp[1] - off;
-                       if (set_current) {
-                               if (bp[0] == 2) {       /* No more buckets in
-                                                        * chain */
-                                       hashp->cpage = NULL;
-                                       hashp->cbucket++;
-                                       hashp->cndx = 1;
-                               } else {
-                                       hashp->cpage = __get_buf(hashp,
-                                           (uint32_t)bp[bp[0] - 1], bufp, 0);
-                                       if (!hashp->cpage)
-                                               return (-1);
-                                       hashp->cndx = 1;
-                                       if (!((uint16_t *)(void *)
-                                           hashp->cpage->page)[0]) {
-                                               hashp->cbucket++;
-                                               hashp->cpage = NULL;
-                                       }
-                               }
-                       }
-                       return (0);
-               }
-
-       val->size = collect_data(hashp, bufp, (int)len, set_current);
-       if (val->size == (size_t)-1)
-               return (-1);
-       if (save_p->addr != save_addr) {
-               /* We are pretty short on buffers. */
-               errno = EINVAL;                 /* OUT OF BUFFERS */
-               return (-1);
-       }
-       memmove(hashp->tmp_buf, (save_p->page) + off, (size_t)len);
-       val->data = (uint8_t *)hashp->tmp_buf;
-       return (0);
-}
-/*
- * Count how big the total datasize is by recursing through the pages.  Then
- * allocate a buffer and copy the data as you recurse up.
- */
-static int
-collect_data(HTAB *hashp, BUFHEAD *bufp, int len, int set)
-{
-       uint16_t *bp;
-       char *p;
-       BUFHEAD *xbp;
-       uint16_t save_addr;
-       int mylen, totlen;
-
-       p = bufp->page;
-       bp = (uint16_t *)(void *)p;
-       mylen = hashp->BSIZE - bp[1];
-       save_addr = bufp->addr;
-
-       if (bp[2] == FULL_KEY_DATA) {           /* End of Data */
-               totlen = len + mylen;
-               if (hashp->tmp_buf)
-                       free(hashp->tmp_buf);
-               if ((hashp->tmp_buf = calloc(1, (size_t)totlen)) == NULL)
-                       return (-1);
-               if (set) {
-                       hashp->cndx = 1;
-                       if (bp[0] == 2) {       /* No more buckets in chain */
-                               hashp->cpage = NULL;
-                               hashp->cbucket++;
-                       } else {
-                               hashp->cpage =
-                                   __get_buf(hashp, (uint32_t)bp[bp[0] - 1],
-                                   bufp, 0);
-                               if (!hashp->cpage)
-                                       return (-1);
-                               else if (!((uint16_t *)(void *)hashp->cpage->page)[0]) {
-                                       hashp->cbucket++;
-                                       hashp->cpage = NULL;
-                               }
-                       }
-               }
-       } else {
-               xbp = __get_buf(hashp, (uint32_t)bp[bp[0] - 1], bufp, 0);
-               if (!xbp || ((totlen =
-                   collect_data(hashp, xbp, len + mylen, set)) < 1))
-                       return (-1);
-       }
-       if (bufp->addr != save_addr) {
-               errno = EINVAL;                 /* Out of buffers. */
-               return (-1);
-       }
-       memmove(&hashp->tmp_buf[len], (bufp->page) + bp[1], (size_t)mylen);
-       return (totlen);
-}
-
-/*
- * Fill in the key and data for this big pair.
- */
-int
-__big_keydata(HTAB *hashp, BUFHEAD *bufp, DBT *key, DBT *val, int set)
-{
-       key->size = collect_key(hashp, bufp, 0, val, set);
-       if (key->size == (size_t)-1)
-               return (-1);
-       key->data = (uint8_t *)hashp->tmp_key;
-       return (0);
-}
-
-/*
- * Count how big the total key size is by recursing through the pages.  Then
- * collect the data, allocate a buffer and copy the key as you recurse up.
- */
-static int
-collect_key(HTAB *hashp, BUFHEAD *bufp, int len, DBT *val, int set)
-{
-       BUFHEAD *xbp;
-       char *p;
-       int mylen, totlen;
-       uint16_t *bp, save_addr;
-
-       p = bufp->page;
-       bp = (uint16_t *)(void *)p;
-       mylen = hashp->BSIZE - bp[1];
-
-       save_addr = bufp->addr;
-       totlen = len + mylen;
-       if (bp[2] == FULL_KEY || bp[2] == FULL_KEY_DATA) {    /* End of Key. */
-               if (hashp->tmp_key != NULL)
-                       free(hashp->tmp_key);
-               if ((hashp->tmp_key = calloc(1, (size_t)totlen)) == NULL)
-                       return (-1);
-               if (__big_return(hashp, bufp, 1, val, set))
-                       return (-1);
-       } else {
-               xbp = __get_buf(hashp, (uint32_t)bp[bp[0] - 1], bufp, 0);
-               if (!xbp || ((totlen =
-                   collect_key(hashp, xbp, totlen, val, set)) < 1))
-                       return (-1);
-       }
-       if (bufp->addr != save_addr) {
-               errno = EINVAL;         /* MIS -- OUT OF BUFFERS */
-               return (-1);
-       }
-       memmove(&hashp->tmp_key[len], (bufp->page) + bp[1], (size_t)mylen);
-       return (totlen);
-}
-
-/*
- * Returns:
- *  0 => OK
- * -1 => error
- */
-int
-__big_split(
-       HTAB *hashp,
-       BUFHEAD *op,    /* Pointer to where to put keys that go in old bucket */
-       BUFHEAD *np,    /* Pointer to new bucket page */
-                       /* Pointer to first page containing the big key/data */
-       BUFHEAD *big_keyp,
-       int addr,       /* Address of big_keyp */
-       uint32_t   obucket,/* Old Bucket */
-       SPLIT_RETURN *ret
-)
-{
-       BUFHEAD *tmpp;
-       uint16_t *tp;
-       BUFHEAD *bp;
-       DBT key, val;
-       uint32_t change;
-       uint16_t free_space, n, off;
-       size_t temp;
-
-       bp = big_keyp;
-
-       /* Now figure out where the big key/data goes */
-       if (__big_keydata(hashp, big_keyp, &key, &val, 0))
-               return (-1);
-       change = (__call_hash(hashp, key.data, (int)key.size) != obucket);
-
-       if ((ret->next_addr = __find_last_page(hashp, &big_keyp)) != 0) {
-               if (!(ret->nextp =
-                   __get_buf(hashp, (uint32_t)ret->next_addr, big_keyp, 0)))
-                       return (-1);
-       } else
-               ret->nextp = NULL;
-
-       /* Now make one of np/op point to the big key/data pair */
-       _DIAGASSERT(np->ovfl == NULL);
-       if (change)
-               tmpp = np;
-       else
-               tmpp = op;
-
-       tmpp->flags |= BUF_MOD;
-#ifdef DEBUG1
-       (void)fprintf(stderr,
-           "BIG_SPLIT: %d->ovfl was %d is now %d\n", tmpp->addr,
-           (tmpp->ovfl ? tmpp->ovfl->addr : 0), (bp ? bp->addr : 0));
-#endif
-       tmpp->ovfl = bp;        /* one of op/np point to big_keyp */
-       tp = (uint16_t *)(void *)tmpp->page;
-       _DIAGASSERT(FREESPACE(tp) >= OVFLSIZE);
-       n = tp[0];
-       off = OFFSET(tp);
-       free_space = FREESPACE(tp);
-       tp[++n] = (uint16_t)addr;
-       tp[++n] = OVFLPAGE;
-       tp[0] = n;
-       OFFSET(tp) = off;
-       temp = free_space - OVFLSIZE;
-       _DBFIT(temp, uint16_t);
-       FREESPACE(tp) = (uint16_t)temp;
-
-       /*
-        * Finally, set the new and old return values. BIG_KEYP contains a
-        * pointer to the last page of the big key_data pair. Make sure that
-        * big_keyp has no following page (2 elements) or create an empty
-        * following page.
-        */
-
-       ret->newp = np;
-       ret->oldp = op;
-
-       tp = (uint16_t *)(void *)big_keyp->page;
-       big_keyp->flags |= BUF_MOD;
-       if (tp[0] > 2) {
-               /*
-                * There may be either one or two offsets on this page.  If
-                * there is one, then the overflow page is linked on normally
-                * and tp[4] is OVFLPAGE.  If there are two, tp[4] contains
-                * the second offset and needs to get stuffed in after the
-                * next overflow page is added.
-                */
-               n = tp[4];
-               free_space = FREESPACE(tp);
-               off = OFFSET(tp);
-               tp[0] -= 2;
-               temp = free_space + OVFLSIZE;
-               _DBFIT(temp, uint16_t);
-               FREESPACE(tp) = (uint16_t)temp;
-               OFFSET(tp) = off;
-               tmpp = __add_ovflpage(hashp, big_keyp);
-               if (!tmpp)
-                       return (-1);
-               tp[4] = n;
-       } else
-               tmpp = big_keyp;
-
-       if (change)
-               ret->newp = tmpp;
-       else
-               ret->oldp = tmpp;
-       return (0);
-}
diff --git a/lib/nbsd_libc/db/hash/hash_buf.c b/lib/nbsd_libc/db/hash/hash_buf.c
deleted file mode 100644 (file)
index 6469736..0000000
+++ /dev/null
@@ -1,338 +0,0 @@
-/*     $NetBSD: hash_buf.c,v 1.18 2009/04/23 22:09:23 christos Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: hash_buf.c,v 1.18 2009/04/23 22:09:23 christos Exp $");
-
-/*
- * PACKAGE: hash
- *
- * DESCRIPTION:
- *     Contains buffer management
- *
- * ROUTINES:
- * External
- *     __buf_init
- *     __get_buf
- *     __buf_free
- *     __reclaim_buf
- * Internal
- *     newbuf
- */
-
-#include <sys/param.h>
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "extern.h"
-
-static BUFHEAD *newbuf(HTAB *, uint32_t, BUFHEAD *);
-
-/* Unlink B from its place in the lru */
-#define BUF_REMOVE(B) { \
-       (B)->prev->next = (B)->next; \
-       (B)->next->prev = (B)->prev; \
-}
-
-/* Insert B after P */
-#define BUF_INSERT(B, P) { \
-       (B)->next = (P)->next; \
-       (B)->prev = (P); \
-       (P)->next = (B); \
-       (B)->next->prev = (B); \
-}
-
-#define        MRU     hashp->bufhead.next
-#define        LRU     hashp->bufhead.prev
-
-#define MRU_INSERT(B)  BUF_INSERT((B), &hashp->bufhead)
-#define LRU_INSERT(B)  BUF_INSERT((B), LRU)
-
-/*
- * We are looking for a buffer with address "addr".  If prev_bp is NULL, then
- * address is a bucket index.  If prev_bp is not NULL, then it points to the
- * page previous to an overflow page that we are trying to find.
- *
- * CAVEAT:  The buffer header accessed via prev_bp's ovfl field may no longer
- * be valid.  Therefore, you must always verify that its address matches the
- * address you are seeking.
- */
-BUFHEAD *
-__get_buf(
-       HTAB *hashp,
-       uint32_t addr,
-       BUFHEAD *prev_bp,
-       int newpage     /* If prev_bp set, indicates a new overflow page. */
-)
-{
-       BUFHEAD *bp;
-       uint32_t is_disk_mask;
-       int is_disk, segment_ndx = 0;   /* pacify gcc */
-       SEGMENT segp = NULL;    /* pacify gcc */
-
-       is_disk = 0;
-       is_disk_mask = 0;
-       if (prev_bp) {
-               bp = prev_bp->ovfl;
-               if (!bp || (bp->addr != addr))
-                       bp = NULL;
-               if (!newpage)
-                       is_disk = BUF_DISK;
-       } else {
-               /* Grab buffer out of directory */
-               segment_ndx = addr & (hashp->SGSIZE - 1);
-
-               /* valid segment ensured by __call_hash() */
-               segp = hashp->dir[addr >> hashp->SSHIFT];
-               _DIAGASSERT(segp != NULL);
-               bp = PTROF(segp[segment_ndx]);
-               is_disk_mask = ISDISK(segp[segment_ndx]);
-               is_disk = is_disk_mask || !hashp->new_file;
-       }
-
-       if (!bp) {
-               bp = newbuf(hashp, addr, prev_bp);
-               if (!bp ||
-                   __get_page(hashp, bp->page, addr, !prev_bp, is_disk, 0))
-                       return (NULL);
-               if (!prev_bp)
-                       segp[segment_ndx] =
-                           (BUFHEAD *)(void *)((u_long)bp | is_disk_mask);
-       } else {
-               BUF_REMOVE(bp);
-               MRU_INSERT(bp);
-       }
-       return (bp);
-}
-
-/*
- * We need a buffer for this page. Either allocate one, or evict a resident
- * one (if we have as many buffers as we're allowed) and put this one in.
- *
- * If newbuf finds an error (returning NULL), it also sets errno.
- */
-static BUFHEAD *
-newbuf(HTAB *hashp, uint32_t addr, BUFHEAD *prev_bp)
-{
-       BUFHEAD *bp;            /* The buffer we're going to use */
-       BUFHEAD *xbp;           /* Temp pointer */
-       BUFHEAD *next_xbp;
-       SEGMENT segp;
-       int segment_ndx;
-       uint16_t oaddr, *shortp;
-
-       oaddr = 0;
-       bp = LRU;
-       /*
-        * If LRU buffer is pinned, the buffer pool is too small. We need to
-        * allocate more buffers.
-        */
-       if (hashp->nbufs || (bp->flags & BUF_PIN)) {
-               /* Allocate a new one */
-               if ((bp = calloc(1, sizeof(BUFHEAD))) == NULL)
-                       return (NULL);
-               if ((bp->page = calloc(1, (size_t)hashp->BSIZE)) == NULL) {
-                       free(bp);
-                       return (NULL);
-               }
-               if (hashp->nbufs)
-                       hashp->nbufs--;
-       } else {
-               /* Kick someone out */
-               BUF_REMOVE(bp);
-               /*
-                * If this is an overflow page with addr 0, it's already been
-                * flushed back in an overflow chain and initialized.
-                */
-               if ((bp->addr != 0) || (bp->flags & BUF_BUCKET)) {
-                       /*
-                        * Set oaddr before __put_page so that you get it
-                        * before bytes are swapped.
-                        */
-                       shortp = (uint16_t *)(void *)bp->page;
-                       if (shortp[0])
-                               oaddr = shortp[shortp[0] - 1];
-                       if ((bp->flags & BUF_MOD) && __put_page(hashp, bp->page,
-                           bp->addr, (int)IS_BUCKET(bp->flags), 0))
-                               return (NULL);
-                       /*
-                        * Update the pointer to this page (i.e. invalidate it).
-                        *
-                        * If this is a new file (i.e. we created it at open
-                        * time), make sure that we mark pages which have been
-                        * written to disk so we retrieve them from disk later,
-                        * rather than allocating new pages.
-                        */
-                       if (IS_BUCKET(bp->flags)) {
-                               segment_ndx = bp->addr & (hashp->SGSIZE - 1);
-                               segp = hashp->dir[bp->addr >> hashp->SSHIFT];
-                               _DIAGASSERT(segp != NULL);
-
-                               if (hashp->new_file &&
-                                   ((bp->flags & BUF_MOD) ||
-                                   ISDISK(segp[segment_ndx])))
-                                       segp[segment_ndx] = (BUFHEAD *)BUF_DISK;
-                               else
-                                       segp[segment_ndx] = NULL;
-                       }
-                       /*
-                        * Since overflow pages can only be access by means of
-                        * their bucket, free overflow pages associated with
-                        * this bucket.
-                        */
-                       for (xbp = bp; xbp->ovfl;) {
-                               next_xbp = xbp->ovfl;
-                               xbp->ovfl = 0;
-                               xbp = next_xbp;
-
-                               /* Check that ovfl pointer is up date. */
-                               if (IS_BUCKET(xbp->flags) ||
-                                   (oaddr != xbp->addr))
-                                       break;
-
-                               shortp = (uint16_t *)(void *)xbp->page;
-                               if (shortp[0])
-                                       /* set before __put_page */
-                                       oaddr = shortp[shortp[0] - 1];
-                               if ((xbp->flags & BUF_MOD) && __put_page(hashp,
-                                   xbp->page, xbp->addr, 0, 0))
-                                       return (NULL);
-                               xbp->addr = 0;
-                               xbp->flags = 0;
-                               BUF_REMOVE(xbp);
-                               LRU_INSERT(xbp);
-                       }
-               }
-       }
-
-       /* Now assign this buffer */
-       bp->addr = addr;
-#ifdef DEBUG1
-       (void)fprintf(stderr, "NEWBUF1: %d->ovfl was %d is now %d\n",
-           bp->addr, (bp->ovfl ? bp->ovfl->addr : 0), 0);
-#endif
-       bp->ovfl = NULL;
-       if (prev_bp) {
-               /*
-                * If prev_bp is set, this is an overflow page, hook it in to
-                * the buffer overflow links.
-                */
-#ifdef DEBUG1
-               (void)fprintf(stderr, "NEWBUF2: %d->ovfl was %d is now %d\n",
-                   prev_bp->addr, (prev_bp->ovfl ? prev_bp->ovfl->addr : 0),
-                   (bp ? bp->addr : 0));
-#endif
-               prev_bp->ovfl = bp;
-               bp->flags = 0;
-       } else
-               bp->flags = BUF_BUCKET;
-       MRU_INSERT(bp);
-       return (bp);
-}
-
-void
-__buf_init(HTAB *hashp, u_int nbytes)
-{
-       BUFHEAD *bfp;
-       int npages;
-
-       bfp = &(hashp->bufhead);
-       npages = (unsigned int)(nbytes + hashp->BSIZE - 1) >> hashp->BSHIFT;
-       npages = MAX(npages, MIN_BUFFERS);
-
-       hashp->nbufs = npages;
-       bfp->next = bfp;
-       bfp->prev = bfp;
-       /*
-        * This space is calloc'd so these are already null.
-        *
-        * bfp->ovfl = NULL;
-        * bfp->flags = 0;
-        * bfp->page = NULL;
-        * bfp->addr = 0;
-        */
-}
-
-int
-__buf_free(HTAB *hashp, int do_free, int to_disk)
-{
-       BUFHEAD *bp;
-
-       /* Need to make sure that buffer manager has been initialized */
-       if (!LRU)
-               return (0);
-       for (bp = LRU; bp != &hashp->bufhead;) {
-               /* Check that the buffer is valid */
-               if (bp->addr || IS_BUCKET(bp->flags)) {
-                       if (to_disk && (bp->flags & BUF_MOD) &&
-                           __put_page(hashp, bp->page,
-                           bp->addr, IS_BUCKET(bp->flags), 0))
-                               return (-1);
-               }
-               /* Check if we are freeing stuff */
-               if (do_free) {
-                       if (bp->page) {
-                               (void)memset(bp->page, 0, (size_t)hashp->BSIZE);
-                               free(bp->page);
-                       }
-                       BUF_REMOVE(bp);
-                       free(bp);
-                       bp = LRU;
-               } else
-                       bp = bp->prev;
-       }
-       return (0);
-}
-
-void
-__reclaim_buf(HTAB *hashp, BUFHEAD *bp)
-{
-       bp->ovfl = 0;
-       bp->addr = 0;
-       bp->flags = 0;
-       BUF_REMOVE(bp);
-       LRU_INSERT(bp);
-}
diff --git a/lib/nbsd_libc/db/hash/hash_func.c b/lib/nbsd_libc/db/hash/hash_func.c
deleted file mode 100644 (file)
index 6dd136d..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-/*     $NetBSD: hash_func.c,v 1.13 2008/09/10 17:52:35 joerg Exp $     */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: hash_func.c,v 1.13 2008/09/10 17:52:35 joerg Exp $");
-
-#include <sys/types.h>
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "extern.h"
-
-#if 0
-static uint32_t hash1(const void *, size_t) __attribute__((__unused__));
-static uint32_t hash2(const void *, size_t) __attribute__((__unused__));
-static uint32_t hash3(const void *, size_t) __attribute__((__unused__));
-#endif
-static uint32_t hash4(const void *, size_t) __attribute__((__unused__));
-
-/* Global default hash function */
-uint32_t (*__default_hash)(const void *, size_t) = hash4;
-#if 0
-/*
- * HASH FUNCTIONS
- *
- * Assume that we've already split the bucket to which this key hashes,
- * calculate that bucket, and check that in fact we did already split it.
- *
- * This came from ejb's hsearch.
- */
-
-#define PRIME1         37
-#define PRIME2         1048583
-
-static uint32_t
-hash1(const void *keyarg, size_t len)
-{
-       const uint8_t *key;
-       uint32_t h;
-
-       /* Convert string to integer */
-       for (key = keyarg, h = 0; len--;)
-               h = h * PRIME1 ^ (*key++ - ' ');
-       h %= PRIME2;
-       return (h);
-}
-
-/*
- * Phong's linear congruential hash
- */
-#define dcharhash(h, c)        ((h) = 0x63c63cd9*(h) + 0x9c39c33d + (c))
-
-static uint32_t
-hash2(const void *keyarg, size_t len)
-{
-       const uint8_t *e, *key;
-       uint32_t h;
-       uint8_t c;
-
-       key = keyarg;
-       e = key + len;
-       for (h = 0; key != e;) {
-               c = *key++;
-               if (!c && key > e)
-                       break;
-               dcharhash(h, c);
-       }
-       return (h);
-}
-
-/*
- * This is INCREDIBLY ugly, but fast.  We break the string up into 8 byte
- * units.  On the first time through the loop we get the "leftover bytes"
- * (strlen % 8).  On every other iteration, we perform 8 HASHC's so we handle
- * all 8 bytes.  Essentially, this saves us 7 cmp & branch instructions.  If
- * this routine is heavily used enough, it's worth the ugly coding.
- *
- * OZ's original sdbm hash
- */
-static uint32_t
-hash3(const void *keyarg, size_t len)
-{
-       const uint8_t *key;
-       size_t loop;
-       uint32_t h;
-
-#define HASHC   h = *key++ + 65599 * h
-
-       h = 0;
-       key = keyarg;
-       if (len > 0) {
-               loop = (len + 8 - 1) >> 3;
-
-               switch (len & (8 - 1)) {
-               case 0:
-                       do {
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 7:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 6:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 5:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 4:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 3:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 2:
-                               HASHC;
-                               /* FALLTHROUGH */
-               case 1:
-                               HASHC;
-                       } while (--loop);
-               }
-       }
-       return (h);
-}
-#endif
-
-/* Hash function from Chris Torek. */
-static uint32_t
-hash4(const void *keyarg, size_t len)
-{
-       const uint8_t *key;
-       size_t loop;
-       uint32_t h;
-
-#define HASH4a   h = (h << 5) - h + *key++;
-#define HASH4b   h = (h << 5) + h + *key++;
-#define HASH4 HASH4b
-
-       h = 0;
-       key = keyarg;
-       if (len > 0) {
-               loop = (len + 8 - 1) >> 3;
-
-               switch (len & (8 - 1)) {
-               case 0:
-                       do {
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 7:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 6:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 5:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 4:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 3:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 2:
-                               HASH4;
-                               /* FALLTHROUGH */
-               case 1:
-                               HASH4;
-                       } while (--loop);
-               }
-       }
-       return (h);
-}
diff --git a/lib/nbsd_libc/db/hash/hash_log2.c b/lib/nbsd_libc/db/hash/hash_log2.c
deleted file mode 100644 (file)
index 74343da..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*     $NetBSD: hash_log2.c,v 1.13 2008/09/11 12:33:55 joerg Exp $     */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: hash_log2.c,v 1.13 2008/09/11 12:33:55 joerg Exp $");
-
-#include <sys/types.h>
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "extern.h"
-
-uint32_t
-__log2(uint32_t num)
-{
-       uint32_t i, limit;
-
-       if (num == 0)
-               return 0;
-       --num;
-
-       limit = 0;
-       for (i = 0; limit < num; limit = limit * 2 + 1, i++)
-               continue;
-       return (i);
-}
diff --git a/lib/nbsd_libc/db/hash/hash_page.c b/lib/nbsd_libc/db/hash/hash_page.c
deleted file mode 100644 (file)
index e79dfd9..0000000
+++ /dev/null
@@ -1,962 +0,0 @@
-/*     $NetBSD: hash_page.c,v 1.23 2008/09/11 12:58:00 joerg Exp $     */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: hash_page.c,v 1.23 2008/09/11 12:58:00 joerg Exp $");
-
-/*
- * PACKAGE:  hashing
- *
- * DESCRIPTION:
- *     Page manipulation for hashing package.
- *
- * ROUTINES:
- *
- * External
- *     __get_page
- *     __add_ovflpage
- * Internal
- *     overflow_page
- *     open_temp
- */
-
-#include "namespace.h"
-
-#include <sys/types.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <paths.h>
-#include <assert.h>
-
-#include <db.h>
-#include "hash.h"
-#include "page.h"
-#include "extern.h"
-
-static uint32_t        *fetch_bitmap(HTAB *, int);
-static uint32_t         first_free(uint32_t);
-static int      open_temp(HTAB *);
-static uint16_t         overflow_page(HTAB *);
-static void     putpair(char *, const DBT *, const DBT *);
-static void     squeeze_key(uint16_t *, const DBT *, const DBT *);
-static int      ugly_split(HTAB *, uint32_t, BUFHEAD *, BUFHEAD *, int, int);
-
-#define        PAGE_INIT(P) { \
-       ((uint16_t *)(void *)(P))[0] = 0; \
-       temp = 3 * sizeof(uint16_t); \
-       _DIAGASSERT(hashp->BSIZE >= temp); \
-       ((uint16_t *)(void *)(P))[1] = (uint16_t)(hashp->BSIZE - temp); \
-       ((uint16_t *)(void *)(P))[2] = hashp->BSIZE; \
-}
-
-/*
- * This is called AFTER we have verified that there is room on the page for
- * the pair (PAIRFITS has returned true) so we go right ahead and start moving
- * stuff on.
- */
-static void
-putpair(char *p, const DBT *key, const DBT *val)
-{
-       uint16_t *bp, n, off;
-       size_t temp;
-
-       bp = (uint16_t *)(void *)p;
-
-       /* Enter the key first. */
-       n = bp[0];
-
-       temp = OFFSET(bp);
-       _DIAGASSERT(temp >= key->size);
-       off = (uint16_t)(temp - key->size);
-       memmove(p + off, key->data, key->size);
-       bp[++n] = off;
-
-       /* Now the data. */
-       _DIAGASSERT(off >= val->size);
-       off -= (uint16_t)val->size;
-       memmove(p + off, val->data, val->size);
-       bp[++n] = off;
-
-       /* Adjust page info. */
-       bp[0] = n;
-       temp = (n + 3) * sizeof(uint16_t);
-       _DIAGASSERT(off >= temp);
-       bp[n + 1] = (uint16_t)(off - temp);
-       bp[n + 2] = off;
-}
-
-/*
- * Returns:
- *      0 OK
- *     -1 error
- */
-int
-__delpair(HTAB *hashp, BUFHEAD *bufp, int ndx)
-{
-       uint16_t *bp, newoff;
-       int n;
-       uint16_t pairlen;
-       size_t temp;
-
-       bp = (uint16_t *)(void *)bufp->page;
-       n = bp[0];
-
-       if (bp[ndx + 1] < REAL_KEY)
-               return (__big_delete(hashp, bufp));
-       if (ndx != 1)
-               newoff = bp[ndx - 1];
-       else
-               newoff = hashp->BSIZE;
-       pairlen = newoff - bp[ndx + 1];
-
-       if (ndx != (n - 1)) {
-               /* Hard Case -- need to shuffle keys */
-               int i;
-               char *src = bufp->page + (int)OFFSET(bp);
-               char *dst = src + (int)pairlen;
-               memmove(dst, src, (size_t)(bp[ndx + 1] - OFFSET(bp)));
-
-               /* Now adjust the pointers */
-               for (i = ndx + 2; i <= n; i += 2) {
-                       if (bp[i + 1] == OVFLPAGE) {
-                               bp[i - 2] = bp[i];
-                               bp[i - 1] = bp[i + 1];
-                       } else {
-                               bp[i - 2] = bp[i] + pairlen;
-                               bp[i - 1] = bp[i + 1] + pairlen;
-                       }
-               }
-       }
-       /* Finally adjust the page data */
-       bp[n] = OFFSET(bp) + pairlen;
-       temp = bp[n + 1] + pairlen + 2 * sizeof(uint16_t);
-       _DIAGASSERT(temp <= 0xffff);
-       bp[n - 1] = (uint16_t)temp;
-       bp[0] = n - 2;
-       hashp->NKEYS--;
-
-       bufp->flags |= BUF_MOD;
-       return (0);
-}
-/*
- * Returns:
- *      0 ==> OK
- *     -1 ==> Error
- */
-int
-__split_page(HTAB *hashp, uint32_t obucket, uint32_t nbucket)
-{
-       BUFHEAD *new_bufp, *old_bufp;
-       uint16_t *ino;
-       char *np;
-       DBT key, val;
-       int n, ndx, retval;
-       uint16_t copyto, diff, off, moved;
-       char *op;
-       size_t temp;
-
-       copyto = (uint16_t)hashp->BSIZE;
-       off = (uint16_t)hashp->BSIZE;
-       old_bufp = __get_buf(hashp, obucket, NULL, 0);
-       if (old_bufp == NULL)
-               return (-1);
-       new_bufp = __get_buf(hashp, nbucket, NULL, 0);
-       if (new_bufp == NULL)
-               return (-1);
-
-       old_bufp->flags |= (BUF_MOD | BUF_PIN);
-       new_bufp->flags |= (BUF_MOD | BUF_PIN);
-
-       ino = (uint16_t *)(void *)(op = old_bufp->page);
-       np = new_bufp->page;
-
-       moved = 0;
-
-       for (n = 1, ndx = 1; n < ino[0]; n += 2) {
-               if (ino[n + 1] < REAL_KEY) {
-                       retval = ugly_split(hashp, obucket, old_bufp, new_bufp,
-                           (int)copyto, (int)moved);
-                       old_bufp->flags &= ~BUF_PIN;
-                       new_bufp->flags &= ~BUF_PIN;
-                       return (retval);
-
-               }
-               key.data = (uint8_t *)op + ino[n];
-               key.size = off - ino[n];
-
-               if (__call_hash(hashp, key.data, (int)key.size) == obucket) {
-                       /* Don't switch page */
-                       diff = copyto - off;
-                       if (diff) {
-                               copyto = ino[n + 1] + diff;
-                               memmove(op + copyto, op + ino[n + 1],
-                                   (size_t)(off - ino[n + 1]));
-                               ino[ndx] = copyto + ino[n] - ino[n + 1];
-                               ino[ndx + 1] = copyto;
-                       } else
-                               copyto = ino[n + 1];
-                       ndx += 2;
-               } else {
-                       /* Switch page */
-                       val.data = (uint8_t *)op + ino[n + 1];
-                       val.size = ino[n] - ino[n + 1];
-                       putpair(np, &key, &val);
-                       moved += 2;
-               }
-
-               off = ino[n + 1];
-       }
-
-       /* Now clean up the page */
-       ino[0] -= moved;
-       temp = sizeof(uint16_t) * (ino[0] + 3);
-       _DIAGASSERT(copyto >= temp);
-       FREESPACE(ino) = (uint16_t)(copyto - temp);
-       OFFSET(ino) = copyto;
-
-#ifdef DEBUG3
-       (void)fprintf(stderr, "split %d/%d\n",
-           ((uint16_t *)np)[0] / 2,
-           ((uint16_t *)op)[0] / 2);
-#endif
-       /* unpin both pages */
-       old_bufp->flags &= ~BUF_PIN;
-       new_bufp->flags &= ~BUF_PIN;
-       return (0);
-}
-
-/*
- * Called when we encounter an overflow or big key/data page during split
- * handling.  This is special cased since we have to begin checking whether
- * the key/data pairs fit on their respective pages and because we may need
- * overflow pages for both the old and new pages.
- *
- * The first page might be a page with regular key/data pairs in which case
- * we have a regular overflow condition and just need to go on to the next
- * page or it might be a big key/data pair in which case we need to fix the
- * big key/data pair.
- *
- * Returns:
- *      0 ==> success
- *     -1 ==> failure
- */
-static int
-ugly_split(
-       HTAB *hashp,
-       uint32_t obucket,       /* Same as __split_page. */
-       BUFHEAD *old_bufp,
-       BUFHEAD *new_bufp,
-       int copyto,     /* First byte on page which contains key/data values. */
-       int moved       /* Number of pairs moved to new page. */
-)
-{
-       BUFHEAD *bufp;  /* Buffer header for ino */
-       uint16_t *ino;  /* Page keys come off of */
-       uint16_t *np;   /* New page */
-       uint16_t *op;   /* Page keys go on to if they aren't moving */
-       size_t temp;
-
-       BUFHEAD *last_bfp;      /* Last buf header OVFL needing to be freed */
-       DBT key, val;
-       SPLIT_RETURN ret;
-       uint16_t n, off, ov_addr, scopyto;
-       char *cino;             /* Character value of ino */
-
-       bufp = old_bufp;
-       ino = (uint16_t *)(void *)old_bufp->page;
-       np = (uint16_t *)(void *)new_bufp->page;
-       op = (uint16_t *)(void *)old_bufp->page;
-       last_bfp = NULL;
-       scopyto = (uint16_t)copyto;     /* ANSI */
-
-       n = ino[0] - 1;
-       while (n < ino[0]) {
-               if (ino[2] < REAL_KEY && ino[2] != OVFLPAGE) {
-                       if (__big_split(hashp, old_bufp,
-                           new_bufp, bufp, (int)bufp->addr, obucket, &ret))
-                               return (-1);
-                       old_bufp = ret.oldp;
-                       if (!old_bufp)
-                               return (-1);
-                       op = (uint16_t *)(void *)old_bufp->page;
-                       new_bufp = ret.newp;
-                       if (!new_bufp)
-                               return (-1);
-                       np = (uint16_t *)(void *)new_bufp->page;
-                       bufp = ret.nextp;
-                       if (!bufp)
-                               return (0);
-                       cino = (char *)bufp->page;
-                       ino = (uint16_t *)(void *)cino;
-                       last_bfp = ret.nextp;
-               } else if (ino[n + 1] == OVFLPAGE) {
-                       ov_addr = ino[n];
-                       /*
-                        * Fix up the old page -- the extra 2 are the fields
-                        * which contained the overflow information.
-                        */
-                       ino[0] -= (moved + 2);
-                       temp = sizeof(uint16_t) * (ino[0] + 3);
-                       _DIAGASSERT(scopyto >= temp);
-                       FREESPACE(ino) = (uint16_t)(scopyto - temp);
-                       OFFSET(ino) = scopyto;
-
-                       bufp = __get_buf(hashp, (uint32_t)ov_addr, bufp, 0);
-                       if (!bufp)
-                               return (-1);
-
-                       ino = (uint16_t *)(void *)bufp->page;
-                       n = 1;
-                       scopyto = hashp->BSIZE;
-                       moved = 0;
-
-                       if (last_bfp)
-                               __free_ovflpage(hashp, last_bfp);
-                       last_bfp = bufp;
-               }
-               /* Move regular sized pairs of there are any */
-               off = hashp->BSIZE;
-               for (n = 1; (n < ino[0]) && (ino[n + 1] >= REAL_KEY); n += 2) {
-                       cino = (char *)(void *)ino;
-                       key.data = (uint8_t *)cino + ino[n];
-                       key.size = off - ino[n];
-                       val.data = (uint8_t *)cino + ino[n + 1];
-                       val.size = ino[n] - ino[n + 1];
-                       off = ino[n + 1];
-
-                       if (__call_hash(hashp, key.data, (int)key.size) == obucket) {
-                               /* Keep on old page */
-                               if (PAIRFITS(op, (&key), (&val)))
-                                       putpair((char *)(void *)op, &key, &val);
-                               else {
-                                       old_bufp =
-                                           __add_ovflpage(hashp, old_bufp);
-                                       if (!old_bufp)
-                                               return (-1);
-                                       op = (uint16_t *)(void *)old_bufp->page;
-                                       putpair((char *)(void *)op, &key, &val);
-                               }
-                               old_bufp->flags |= BUF_MOD;
-                       } else {
-                               /* Move to new page */
-                               if (PAIRFITS(np, (&key), (&val)))
-                                       putpair((char *)(void *)np, &key, &val);
-                               else {
-                                       new_bufp =
-                                           __add_ovflpage(hashp, new_bufp);
-                                       if (!new_bufp)
-                                               return (-1);
-                                       np = (uint16_t *)(void *)new_bufp->page;
-                                       putpair((char *)(void *)np, &key, &val);
-                               }
-                               new_bufp->flags |= BUF_MOD;
-                       }
-               }
-       }
-       if (last_bfp)
-               __free_ovflpage(hashp, last_bfp);
-       return (0);
-}
-
-/*
- * Add the given pair to the page
- *
- * Returns:
- *     0 ==> OK
- *     1 ==> failure
- */
-int
-__addel(HTAB *hashp, BUFHEAD *bufp, const DBT *key, const DBT *val)
-{
-       uint16_t *bp, *sop;
-       int do_expand;
-
-       bp = (uint16_t *)(void *)bufp->page;
-       do_expand = 0;
-       while (bp[0] && (bp[2] < REAL_KEY || bp[bp[0]] < REAL_KEY))
-               /* Exception case */
-               if (bp[2] == FULL_KEY_DATA && bp[0] == 2)
-                       /* This is the last page of a big key/data pair
-                          and we need to add another page */
-                       break;
-               else if (bp[2] < REAL_KEY && bp[bp[0]] != OVFLPAGE) {
-                       bufp = __get_buf(hashp, (uint32_t)bp[bp[0] - 1], bufp,
-                           0);
-                       if (!bufp)
-                               return (-1);
-                       bp = (uint16_t *)(void *)bufp->page;
-               } else if (bp[bp[0]] != OVFLPAGE) {
-                       /* Short key/data pairs, no more pages */
-                       break;
-               } else {
-                       /* Try to squeeze key on this page */
-                       if (bp[2] >= REAL_KEY &&
-                           FREESPACE(bp) >= PAIRSIZE(key, val)) {
-                               squeeze_key(bp, key, val);
-                               goto stats;
-                       } else {
-                               bufp = __get_buf(hashp,
-                                   (uint32_t)bp[bp[0] - 1], bufp, 0);
-                               if (!bufp)
-                                       return (-1);
-                               bp = (uint16_t *)(void *)bufp->page;
-                       }
-               }
-
-       if (PAIRFITS(bp, key, val))
-               putpair(bufp->page, key, val);
-       else {
-               do_expand = 1;
-               bufp = __add_ovflpage(hashp, bufp);
-               if (!bufp)
-                       return (-1);
-               sop = (uint16_t *)(void *)bufp->page;
-
-               if (PAIRFITS(sop, key, val))
-                       putpair((char *)(void *)sop, key, val);
-               else
-                       if (__big_insert(hashp, bufp, key, val))
-                               return (-1);
-       }
-stats:
-       bufp->flags |= BUF_MOD;
-       /*
-        * If the average number of keys per bucket exceeds the fill factor,
-        * expand the table.
-        */
-       hashp->NKEYS++;
-       if (do_expand ||
-           (hashp->NKEYS / (hashp->MAX_BUCKET + 1) > hashp->FFACTOR))
-               return (__expand_table(hashp));
-       return (0);
-}
-
-/*
- *
- * Returns:
- *     pointer on success
- *     NULL on error
- */
-BUFHEAD *
-__add_ovflpage(HTAB *hashp, BUFHEAD *bufp)
-{
-       uint16_t *sp;
-       uint16_t ndx, ovfl_num;
-       size_t temp;
-#ifdef DEBUG1
-       int tmp1, tmp2;
-#endif
-       sp = (uint16_t *)(void *)bufp->page;
-
-       /* Check if we are dynamically determining the fill factor */
-       if (hashp->FFACTOR == DEF_FFACTOR) {
-               hashp->FFACTOR = (uint32_t)sp[0] >> 1;
-               if (hashp->FFACTOR < MIN_FFACTOR)
-                       hashp->FFACTOR = MIN_FFACTOR;
-       }
-       bufp->flags |= BUF_MOD;
-       ovfl_num = overflow_page(hashp);
-#ifdef DEBUG1
-       tmp1 = bufp->addr;
-       tmp2 = bufp->ovfl ? bufp->ovfl->addr : 0;
-#endif
-       if (!ovfl_num || !(bufp->ovfl = __get_buf(hashp, (uint32_t)ovfl_num,
-           bufp, 1)))
-               return (NULL);
-       bufp->ovfl->flags |= BUF_MOD;
-#ifdef DEBUG1
-       (void)fprintf(stderr, "ADDOVFLPAGE: %d->ovfl was %d is now %d\n",
-           tmp1, tmp2, bufp->ovfl->addr);
-#endif
-       ndx = sp[0];
-       /*
-        * Since a pair is allocated on a page only if there's room to add
-        * an overflow page, we know that the OVFL information will fit on
-        * the page.
-        */
-       sp[ndx + 4] = OFFSET(sp);
-       temp = FREESPACE(sp);
-       _DIAGASSERT(temp >= OVFLSIZE);
-       sp[ndx + 3] = (uint16_t)(temp - OVFLSIZE);
-       sp[ndx + 1] = ovfl_num;
-       sp[ndx + 2] = OVFLPAGE;
-       sp[0] = ndx + 2;
-#ifdef HASH_STATISTICS
-       hash_overflows++;
-#endif
-       return (bufp->ovfl);
-}
-
-/*
- * Returns:
- *      0 indicates SUCCESS
- *     -1 indicates FAILURE
- */
-int
-__get_page(HTAB *hashp, char *p, uint32_t bucket, int is_bucket, int is_disk,
-    int is_bitmap)
-{
-       int fd, page, size;
-       ssize_t rsize;
-       uint16_t *bp;
-       size_t temp;
-
-       fd = hashp->fp;
-       size = hashp->BSIZE;
-
-       if ((fd == -1) || !is_disk) {
-               PAGE_INIT(p);
-               return (0);
-       }
-       if (is_bucket)
-               page = BUCKET_TO_PAGE(bucket);
-       else
-               page = OADDR_TO_PAGE(bucket);
-       if ((rsize = pread(fd, p, (size_t)size, (off_t)page << hashp->BSHIFT)) == -1)
-               return (-1);
-       bp = (uint16_t *)(void *)p;
-       if (!rsize)
-               bp[0] = 0;      /* We hit the EOF, so initialize a new page */
-       else
-               if (rsize != size) {
-                       errno = EFTYPE;
-                       return (-1);
-               }
-       if (!is_bitmap && !bp[0]) {
-               PAGE_INIT(p);
-       } else
-               if (hashp->LORDER != BYTE_ORDER) {
-                       int i, max;
-
-                       if (is_bitmap) {
-                               max = (uint32_t)hashp->BSIZE >> 2; /* divide by 4 */
-                               for (i = 0; i < max; i++)
-                                       M_32_SWAP(((int *)(void *)p)[i]);
-                       } else {
-                               M_16_SWAP(bp[0]);
-                               max = bp[0] + 2;
-                               for (i = 1; i <= max; i++)
-                                       M_16_SWAP(bp[i]);
-                       }
-               }
-       return (0);
-}
-
-/*
- * Write page p to disk
- *
- * Returns:
- *      0 ==> OK
- *     -1 ==>failure
- */
-int
-__put_page(HTAB *hashp, char *p, uint32_t bucket, int is_bucket, int is_bitmap)
-{
-       int fd, page, size;
-       ssize_t wsize;
-
-       size = hashp->BSIZE;
-       if ((hashp->fp == -1) && open_temp(hashp))
-               return (-1);
-       fd = hashp->fp;
-
-       if (hashp->LORDER != BYTE_ORDER) {
-               int i;
-               int max;
-
-               if (is_bitmap) {
-                       max = (uint32_t)hashp->BSIZE >> 2;      /* divide by 4 */
-                       for (i = 0; i < max; i++)
-                               M_32_SWAP(((int *)(void *)p)[i]);
-               } else {
-                       max = ((uint16_t *)(void *)p)[0] + 2;
-                       for (i = 0; i <= max; i++)
-                               M_16_SWAP(((uint16_t *)(void *)p)[i]);
-               }
-       }
-       if (is_bucket)
-               page = BUCKET_TO_PAGE(bucket);
-       else
-               page = OADDR_TO_PAGE(bucket);
-       if ((wsize = pwrite(fd, p, (size_t)size, (off_t)page << hashp->BSHIFT)) == -1)
-               /* Errno is set */
-               return (-1);
-       if (wsize != size) {
-               errno = EFTYPE;
-               return (-1);
-       }
-       return (0);
-}
-
-#define BYTE_MASK      ((1 << INT_BYTE_SHIFT) -1)
-/*
- * Initialize a new bitmap page.  Bitmap pages are left in memory
- * once they are read in.
- */
-int
-__ibitmap(HTAB *hashp, int pnum, int nbits, int ndx)
-{
-       uint32_t *ip;
-       int clearbytes, clearints;
-
-       if ((ip = malloc((size_t)hashp->BSIZE)) == NULL)
-               return (1);
-       hashp->nmaps++;
-       clearints = ((uint32_t)(nbits - 1) >> INT_BYTE_SHIFT) + 1;
-       clearbytes = clearints << INT_TO_BYTE;
-       (void)memset(ip, 0, (size_t)clearbytes);
-       (void)memset(((char *)(void *)ip) + clearbytes, 0xFF,
-           (size_t)(hashp->BSIZE - clearbytes));
-       ip[clearints - 1] = ALL_SET << (nbits & BYTE_MASK);
-       SETBIT(ip, 0);
-       hashp->BITMAPS[ndx] = (uint16_t)pnum;
-       hashp->mapp[ndx] = ip;
-       return (0);
-}
-
-static uint32_t
-first_free(uint32_t map)
-{
-       uint32_t i, mask;
-
-       mask = 0x1;
-       for (i = 0; i < BITS_PER_MAP; i++) {
-               if (!(mask & map))
-                       return (i);
-               mask = mask << 1;
-       }
-       return (i);
-}
-
-static uint16_t
-overflow_page(HTAB *hashp)
-{
-       uint32_t *freep = NULL;
-       int max_free, offset, splitnum;
-       uint16_t addr;
-       int bit, first_page, free_bit, free_page, i, in_use_bits, j;
-#ifdef DEBUG2
-       int tmp1, tmp2;
-#endif
-       splitnum = hashp->OVFL_POINT;
-       max_free = hashp->SPARES[splitnum];
-
-       free_page = (uint32_t)(max_free - 1) >> (hashp->BSHIFT + BYTE_SHIFT);
-       free_bit = (max_free - 1) & ((hashp->BSIZE << BYTE_SHIFT) - 1);
-
-       /* Look through all the free maps to find the first free block */
-       first_page = (uint32_t)hashp->LAST_FREED >>(hashp->BSHIFT + BYTE_SHIFT);
-       for ( i = first_page; i <= free_page; i++ ) {
-               if (!(freep = (uint32_t *)hashp->mapp[i]) &&
-                   !(freep = fetch_bitmap(hashp, i)))
-                       return (0);
-               if (i == free_page)
-                       in_use_bits = free_bit;
-               else
-                       in_use_bits = (hashp->BSIZE << BYTE_SHIFT) - 1;
-               
-               if (i == first_page) {
-                       bit = hashp->LAST_FREED &
-                           ((hashp->BSIZE << BYTE_SHIFT) - 1);
-                       j = bit / BITS_PER_MAP;
-                       bit = bit & ~(BITS_PER_MAP - 1);
-               } else {
-                       bit = 0;
-                       j = 0;
-               }
-               for (; bit <= in_use_bits; j++, bit += BITS_PER_MAP)
-                       if (freep[j] != ALL_SET)
-                               goto found;
-       }
-
-       /* No Free Page Found */
-       hashp->LAST_FREED = hashp->SPARES[splitnum];
-       hashp->SPARES[splitnum]++;
-       offset = hashp->SPARES[splitnum] -
-           (splitnum ? hashp->SPARES[splitnum - 1] : 0);
-
-#define        OVMSG   "HASH: Out of overflow pages.  Increase page size\n"
-       if (offset > SPLITMASK) {
-               if (++splitnum >= NCACHED) {
-                       (void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
-                       errno = EFBIG;
-                       return (0);
-               }
-               hashp->OVFL_POINT = splitnum;
-               hashp->SPARES[splitnum] = hashp->SPARES[splitnum-1];
-               hashp->SPARES[splitnum-1]--;
-               offset = 1;
-       }
-
-       /* Check if we need to allocate a new bitmap page */
-       if (free_bit == (hashp->BSIZE << BYTE_SHIFT) - 1) {
-               free_page++;
-               if (free_page >= NCACHED) {
-                       (void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
-                       errno = EFBIG;
-                       return (0);
-               }
-               /*
-                * This is tricky.  The 1 indicates that you want the new page
-                * allocated with 1 clear bit.  Actually, you are going to
-                * allocate 2 pages from this map.  The first is going to be
-                * the map page, the second is the overflow page we were
-                * looking for.  The init_bitmap routine automatically, sets
-                * the first bit of itself to indicate that the bitmap itself
-                * is in use.  We would explicitly set the second bit, but
-                * don't have to if we tell init_bitmap not to leave it clear
-                * in the first place.
-                */
-               if (__ibitmap(hashp,
-                   (int)OADDR_OF(splitnum, offset), 1, free_page))
-                       return (0);
-               hashp->SPARES[splitnum]++;
-#ifdef DEBUG2
-               free_bit = 2;
-#endif
-               offset++;
-               if (offset > SPLITMASK) {
-                       if (++splitnum >= NCACHED) {
-                               (void)write(STDERR_FILENO, OVMSG,
-                                   sizeof(OVMSG) - 1);
-                               errno = EFBIG;
-                               return (0);
-                       }
-                       hashp->OVFL_POINT = splitnum;
-                       hashp->SPARES[splitnum] = hashp->SPARES[splitnum-1];
-                       hashp->SPARES[splitnum-1]--;
-                       offset = 0;
-               }
-       } else {
-               /*
-                * Free_bit addresses the last used bit.  Bump it to address
-                * the first available bit.
-                */
-               free_bit++;
-               SETBIT(freep, free_bit);
-       }
-
-       /* Calculate address of the new overflow page */
-       addr = OADDR_OF(splitnum, offset);
-#ifdef DEBUG2
-       (void)fprintf(stderr, "OVERFLOW_PAGE: ADDR: %d BIT: %d PAGE %d\n",
-           addr, free_bit, free_page);
-#endif
-       return (addr);
-
-found:
-       bit = bit + first_free(freep[j]);
-       SETBIT(freep, bit);
-#ifdef DEBUG2
-       tmp1 = bit;
-       tmp2 = i;
-#endif
-       /*
-        * Bits are addressed starting with 0, but overflow pages are addressed
-        * beginning at 1. Bit is a bit addressnumber, so we need to increment
-        * it to convert it to a page number.
-        */
-       bit = 1 + bit + (i * (hashp->BSIZE << BYTE_SHIFT));
-       if (bit >= hashp->LAST_FREED)
-               hashp->LAST_FREED = bit - 1;
-
-       /* Calculate the split number for this page */
-       for (i = 0; (i < splitnum) && (bit > hashp->SPARES[i]); i++);
-       offset = (i ? bit - hashp->SPARES[i - 1] : bit);
-       if (offset >= SPLITMASK) {
-               (void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
-               errno = EFBIG;
-               return (0);     /* Out of overflow pages */
-       }
-       addr = OADDR_OF(i, offset);
-#ifdef DEBUG2
-       (void)fprintf(stderr, "OVERFLOW_PAGE: ADDR: %d BIT: %d PAGE %d\n",
-           addr, tmp1, tmp2);
-#endif
-
-       /* Allocate and return the overflow page */
-       return (addr);
-}
-
-/*
- * Mark this overflow page as free.
- */
-void
-__free_ovflpage(HTAB *hashp, BUFHEAD *obufp)
-{
-       uint16_t addr;
-       uint32_t *freep;
-       int bit_address, free_page, free_bit;
-       uint16_t ndx;
-
-       addr = obufp->addr;
-#ifdef DEBUG1
-       (void)fprintf(stderr, "Freeing %d\n", addr);
-#endif
-       ndx = (((uint32_t)addr) >> SPLITSHIFT);
-       bit_address =
-           (ndx ? hashp->SPARES[ndx - 1] : 0) + (addr & SPLITMASK) - 1;
-        if (bit_address < hashp->LAST_FREED)
-               hashp->LAST_FREED = bit_address;
-       free_page = ((uint32_t)bit_address >> (hashp->BSHIFT + BYTE_SHIFT));
-       free_bit = bit_address & ((hashp->BSIZE << BYTE_SHIFT) - 1);
-
-       if (!(freep = hashp->mapp[free_page]))
-               freep = fetch_bitmap(hashp, free_page);
-       /*
-        * This had better never happen.  It means we tried to read a bitmap
-        * that has already had overflow pages allocated off it, and we
-        * failed to read it from the file.
-        */
-       _DIAGASSERT(freep != NULL);
-       CLRBIT(freep, free_bit);
-#ifdef DEBUG2
-       (void)fprintf(stderr, "FREE_OVFLPAGE: ADDR: %d BIT: %d PAGE %d\n",
-           obufp->addr, free_bit, free_page);
-#endif
-       __reclaim_buf(hashp, obufp);
-}
-
-/*
- * Returns:
- *      0 success
- *     -1 failure
- */
-static int
-open_temp(HTAB *hashp)
-{
-       sigset_t set, oset;
-       char *envtmp;
-       char namestr[PATH_MAX];
-
-       if (issetugid())
-               envtmp = NULL;
-       else
-               envtmp = getenv("TMPDIR");
-
-       if (-1 == snprintf(namestr, sizeof(namestr), "%s/_hashXXXXXX",
-           envtmp ? envtmp : _PATH_TMP))
-               return -1;
-
-       /* Block signals; make sure file goes away at process exit. */
-       (void)sigfillset(&set);
-       (void)sigprocmask(SIG_BLOCK, &set, &oset);
-       if ((hashp->fp = mkstemp(namestr)) != -1) {
-               (void)unlink(namestr);
-               (void)fcntl(hashp->fp, F_SETFD, FD_CLOEXEC);
-       }
-       (void)sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
-       return (hashp->fp != -1 ? 0 : -1);
-}
-
-/*
- * We have to know that the key will fit, but the last entry on the page is
- * an overflow pair, so we need to shift things.
- */
-static void
-squeeze_key(uint16_t *sp, const DBT *key, const DBT *val)
-{
-       char *p;
-       uint16_t free_space, n, off, pageno;
-       size_t temp;
-
-       p = (char *)(void *)sp;
-       n = sp[0];
-       free_space = FREESPACE(sp);
-       off = OFFSET(sp);
-
-       pageno = sp[n - 1];
-       _DIAGASSERT(off >= key->size);
-       off -= (uint16_t)key->size;
-       sp[n - 1] = off;
-       memmove(p + off, key->data, key->size);
-       _DIAGASSERT(off >= val->size);
-       off -= (uint16_t)val->size;
-       sp[n] = off;
-       memmove(p + off, val->data, val->size);
-       sp[0] = n + 2;
-       sp[n + 1] = pageno;
-       sp[n + 2] = OVFLPAGE;
-       temp = PAIRSIZE(key, val);
-       _DIAGASSERT(free_space >= temp);
-       FREESPACE(sp) = (uint16_t)(free_space - temp);
-       OFFSET(sp) = off;
-}
-
-static uint32_t *
-fetch_bitmap(HTAB *hashp, int ndx)
-{
-       if (ndx >= hashp->nmaps)
-               return (NULL);
-       if ((hashp->mapp[ndx] = malloc((size_t)hashp->BSIZE)) == NULL)
-               return (NULL);
-       if (__get_page(hashp,
-           (char *)(void *)hashp->mapp[ndx], (uint32_t)hashp->BITMAPS[ndx], 0, 1, 1)) {
-               free(hashp->mapp[ndx]);
-               return (NULL);
-       }
-       return (hashp->mapp[ndx]);
-}
-
-#ifdef DEBUG4
-void print_chain(HTAB *, uint32_t);
-void
-print_chain(HTAB *hashp, uint32_t addr)
-{
-       BUFHEAD *bufp;
-       uint16_t *bp, oaddr;
-
-       (void)fprintf(stderr, "%d ", addr);
-       bufp = __get_buf(hashp, addr, NULL, 0);
-       bp = (uint16_t *)bufp->page;
-       while (bp[0] && ((bp[bp[0]] == OVFLPAGE) ||
-               ((bp[0] > 2) && bp[2] < REAL_KEY))) {
-               oaddr = bp[bp[0] - 1];
-               (void)fprintf(stderr, "%d ", (int)oaddr);
-               bufp = __get_buf(hashp, (uint32_t)oaddr, bufp, 0);
-               bp = (uint16_t *)bufp->page;
-       }
-       (void)fprintf(stderr, "\n");
-}
-#endif
diff --git a/lib/nbsd_libc/db/hash/ndbm.c b/lib/nbsd_libc/db/hash/ndbm.c
deleted file mode 100644 (file)
index 1aea409..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*     $NetBSD: ndbm.c,v 1.23 2008/09/11 12:58:00 joerg Exp $  */
-/*     from: NetBSD: ndbm.c,v 1.18 2004/04/27 20:03:45 kleink Exp      */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: ndbm.c,v 1.23 2008/09/11 12:58:00 joerg Exp $");
-
-/*
- * This package provides a dbm compatible interface to the new hashing
- * package described in db(3).
- */
-#include "namespace.h"
-#include <sys/param.h>
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <ndbm.h>
-#include "hash.h"
-
-/*
- * Returns:
- *     *DBM on success
- *      NULL on failure
- */
-DBM *
-dbm_open(const char *file, int flags, mode_t mode)
-{
-       HASHINFO info;
-       char path[MAXPATHLEN];
-
-       info.bsize = 4096;
-       info.ffactor = 40;
-       info.nelem = 1;
-       info.cachesize = 0;
-       info.hash = NULL;
-       info.lorder = 0;
-       (void)strncpy(path, file, sizeof(path) - 1);
-       (void)strncat(path, DBM_SUFFIX, sizeof(path) - strlen(path) - 1);
-       if ((flags & O_ACCMODE) == O_WRONLY) {
-               flags &= ~O_WRONLY;
-               flags |= O_RDWR;
-       }
-       return ((DBM *)__hash_open(path, flags, mode, &info, 0));
-}
-
-void
-dbm_close(DBM *db)
-{
-       (void)(db->close)(db);
-}
-
-int
-dbm_error(DBM *db)
-{
-       HTAB *hp;
-
-       hp = db->internal;
-       return (hp->err);
-}
-
-int
-dbm_clearerr(DBM *db)
-{
-       HTAB *hp;
-
-       hp = db->internal;
-       hp->err = 0;
-       return (0);
-}
-
-int
-dbm_dirfno(DBM *db)
-{
-       HTAB *hp;
-
-       hp = db->internal;
-       return hp->fp;
-}
diff --git a/lib/nbsd_libc/db/hash/ndbmdatum.c b/lib/nbsd_libc/db/hash/ndbmdatum.c
deleted file mode 100644 (file)
index 75c6ab8..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*     $NetBSD: ndbmdatum.c,v 1.4 2008/09/11 12:58:00 joerg Exp $      */
-/*     from: NetBSD: ndbm.c,v 1.18 2004/04/27 20:03:45 kleink Exp      */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: ndbmdatum.c,v 1.4 2008/09/11 12:58:00 joerg Exp $");
-
-/*
- * This package provides a dbm compatible interface to the new hashing
- * package described in db(3).
- */
-#include "namespace.h"
-#include <sys/param.h>
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <ndbm.h>
-#include "hash.h"
-
-/*
- * Returns:
- *     DATUM on success
- *     NULL on failure
- */
-datum
-dbm_fetch(DBM *db, datum key)
-{
-       datum retdata;
-       int status;
-       DBT dbtkey, dbtretdata;
-
-       dbtkey.data = key.dptr;
-       dbtkey.size = key.dsize;
-       status = (db->get)(db, &dbtkey, &dbtretdata, 0);
-       if (status) {
-               dbtretdata.data = NULL;
-               dbtretdata.size = 0;
-       }
-       retdata.dptr = dbtretdata.data;
-       retdata.dsize = dbtretdata.size;
-       return (retdata);
-}
-
-/*
- * Returns:
- *     DATUM on success
- *     NULL on failure
- */
-datum
-dbm_firstkey(DBM *db)
-{
-       int status;
-       datum retkey;
-       DBT dbtretkey, dbtretdata;
-
-       status = (db->seq)(db, &dbtretkey, &dbtretdata, R_FIRST);
-       if (status)
-               dbtretkey.data = NULL;
-       retkey.dptr = dbtretkey.data;
-       retkey.dsize = dbtretkey.size;
-       return (retkey);
-}
-
-/*
- * Returns:
- *     DATUM on success
- *     NULL on failure
- */
-datum
-dbm_nextkey(DBM *db)
-{
-       int status;
-       datum retkey;
-       DBT dbtretkey, dbtretdata;
-
-       status = (db->seq)(db, &dbtretkey, &dbtretdata, R_NEXT);
-       if (status)
-               dbtretkey.data = NULL;
-       retkey.dptr = dbtretkey.data;
-       retkey.dsize = dbtretkey.size;
-       return (retkey);
-}
-
-/*
- * Returns:
- *      0 on success
- *     <0 failure
- */
-int
-dbm_delete(DBM *db, datum key)
-{
-       int status;
-       DBT dbtkey;
-
-       dbtkey.data = key.dptr;
-       dbtkey.size = key.dsize;
-       status = (db->del)(db, &dbtkey, 0);
-       if (status)
-               return (-1);
-       else
-               return (0);
-}
-
-/*
- * Returns:
- *      0 on success
- *     <0 failure
- *      1 if DBM_INSERT and entry exists
- */
-int
-dbm_store(DBM *db, datum key, datum data, int flags)
-{
-       DBT dbtkey, dbtdata;
-
-       dbtkey.data = key.dptr;
-       dbtkey.size = key.dsize;
-       dbtdata.data = data.dptr;
-       dbtdata.size = data.dsize;
-       return ((db->put)(db, &dbtkey, &dbtdata,
-           (u_int)((flags == DBM_INSERT) ? R_NOOVERWRITE : 0)));
-}
diff --git a/lib/nbsd_libc/db/hash/page.h b/lib/nbsd_libc/db/hash/page.h
deleted file mode 100644 (file)
index 40dc77d..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/*     $NetBSD: page.h,v 1.8 2008/08/26 21:18:38 joerg Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- *
- *     @(#)page.h      8.2 (Berkeley) 5/31/94
- */
-
-/*
- * Definitions for hashing page file format.
- */
-
-/*
- * routines dealing with a data page
- *
- * page format:
- *     +------------------------------+
- * p   | n | keyoff | datoff | keyoff |
- *     +------------+--------+--------+
- *     | datoff | free  |  ptr  | --> |
- *     +--------+---------------------+
- *     |        F R E E A R E A       |
- *     +--------------+---------------+
- *     |  <---- - - - | data          |
- *     +--------+-----+----+----------+
- *     |  key   | data     | key      |
- *     +--------+----------+----------+
- *
- * Pointer to the free space is always:  p[p[0] + 2]
- * Amount of free space on the page is:  p[p[0] + 1]
- */
-
-/*
- * How many bytes required for this pair?
- *     2 shorts in the table at the top of the page + room for the
- *     key and room for the data
- *
- * We prohibit entering a pair on a page unless there is also room to append
- * an overflow page. The reason for this it that you can get in a situation
- * where a single key/data pair fits on a page, but you can't append an
- * overflow page and later you'd have to split the key/data and handle like
- * a big pair.
- * You might as well do this up front.
- */
-
-#define        PAIRSIZE(K,D)   (2*sizeof(uint16_t) + (K)->size + (D)->size)
-#define BIGOVERHEAD    (4*sizeof(uint16_t))
-#define KEYSIZE(K)     (4*sizeof(uint16_t) + (K)->size);
-#define OVFLSIZE       (2*sizeof(uint16_t))
-#define FREESPACE(P)   ((P)[(P)[0]+1])
-#define        OFFSET(P)       ((P)[(P)[0]+2])
-#define PAIRFITS(P,K,D) \
-       (((P)[2] >= REAL_KEY) && \
-           (PAIRSIZE((K),(D)) + OVFLSIZE) <= FREESPACE((P)))
-#define PAGE_META(N)   (((N)+3) * sizeof(uint16_t))
-
-typedef struct {
-       BUFHEAD *newp;
-       BUFHEAD *oldp;
-       BUFHEAD *nextp;
-       uint16_t next_addr;
-}       SPLIT_RETURN;
diff --git a/lib/nbsd_libc/db/man/Makefile.inc b/lib/nbsd_libc/db/man/Makefile.inc
deleted file mode 100644 (file)
index f45c416..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#      $NetBSD: Makefile.inc,v 1.10 2004/04/30 21:13:23 kleink Exp $
-#       @(#)Makefile.inc       8.1 (Berkeley) 6/4/93
-
-.PATH: ${.CURDIR}/db/man
-
-MAN+=  btree.3 dbm_clearerr.3 dbopen.3 hash.3 recno.3 mpool.3
-MLINKS+= dbm_clearerr.3 dbm_close.3 dbm_clearerr.3 dbm_delete.3
-MLINKS+= dbm_clearerr.3 dbm_dirfno.3 dbm_clearerr.3 dbm_error.3
-MLINKS+= dbm_clearerr.3 dbm_fetch.3 dbm_clearerr.3 dbm_firstkey.3
-MLINKS+= dbm_clearerr.3 dbm_nextkey.3 dbm_clearerr.3 dbm_open.3
-MLINKS+= dbm_clearerr.3 dbm_store.3 dbm_clearerr.3 ndbm.3
-MLINKS+= dbopen.3 db.3
-MLINKS+= mpool.3 mpool_open.3 mpool.3 mpool_filter.3 mpool.3 mpool_new.3
-MLINKS+= mpool.3 mpool_get.3 mpool.3 mpool_put.3 mpool.3 mpool_sync.3
-MLINKS+= mpool.3 mpool_close.3
diff --git a/lib/nbsd_libc/db/man/btree.3 b/lib/nbsd_libc/db/man/btree.3
deleted file mode 100644 (file)
index 1936386..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-.\"    $NetBSD: btree.3,v 1.12 2010/03/22 19:30:53 joerg Exp $
-.\"
-.\" Copyright (c) 1990, 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. 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.
-.\"
-.\"    @(#)btree.3     8.4 (Berkeley) 8/18/94
-.\"
-.Dd April 17, 2003
-.Dt BTREE 3
-.Os
-.Sh NAME
-.Nm btree
-.Nd btree database access method
-.Sh SYNOPSIS
-.In sys/types.h
-.In db.h
-.Sh DESCRIPTION
-The routine
-.Fn dbopen
-is the library interface to database files.
-One of the supported file formats is btree files.
-The general description of the database access methods is in
-.Xr dbopen 3 ,
-this manual page describes only the btree specific information.
-.Pp
-The btree data structure is a sorted, balanced tree structure storing
-associated key/data pairs.
-.Pp
-The btree access method specific data structure provided to
-.Fn dbopen
-is defined in the
-.In db.h
-include file as follows:
-.Bd -literal
-typedef struct {
-       u_long flags;
-       u_int cachesize;
-       int maxkeypage;
-       int minkeypage;
-       u_int psize;
-       int (*compare)(const DBT *key1, const DBT *key2);
-       size_t (*prefix)(const DBT *key1, const DBT *key2);
-       int lorder;
-} BTREEINFO;
-.Ed
-.Pp
-The elements of this structure are as follows:
-.Bl -tag -width maxkeypagex
-.It Fa flags
-The flag value is specified by or'ing any of the following values:
-.Bl -tag -width R_DUP -offset indent
-.It Dv R_DUP
-Permit duplicate keys in the tree, i.e. permit insertion if the key to
-be inserted already exists in the tree.
-The default behavior, as described in
-.Xr dbopen 3 ,
-is to overwrite a matching key when inserting a new key or to fail if
-the
-.Dv R_NOOVERWRITE
-flag is specified.
-The
-.Dv R_DUP
-flag is overridden by the
-.Dv R_NOOVERWRITE
-flag, and if the
-.Dv R_NOOVERWRITE
-flag is specified, attempts to insert duplicate keys into the tree
-will fail.
-.Pp
-If the database contains duplicate keys, the order of retrieval of
-key/data pairs is undefined if the
-.Em get
-routine is used, however,
-.Em seq
-routine calls with the
-.Dv R_CURSOR
-flag set will always return the logical
-.Dq first
-of any group of duplicate keys.
-.El
-.It Fa cachesize
-A suggested maximum size (in bytes) of the memory cache.
-This value is
-.Em only
-advisory, and the access method will allocate more memory rather than
-fail.
-Since every search examines the root page of the tree, caching the
-most recently used pages substantially improves access time.
-In addition, physical writes are delayed as long as possible, so a
-moderate cache can reduce the number of I/O operations significantly.
-Obviously, using a cache increases (but only increases) the likelihood
-of corruption or lost data if the system crashes while a tree is being
-modified.
-If
-.Fa cachesize
-is 0 (no size is specified) a default cache is used.
-.It Fa maxkeypage
-The maximum number of keys which will be stored on any single page.
-Not currently implemented.
-.\" The maximum number of keys which will be stored on any single page.
-.\" Because of the way the btree data structure works,
-.\" .Fa maxkeypage
-.\" must always be greater than or equal to 2.
-.\" If
-.\" .Fa maxkeypage
-.\" is 0 (no maximum number of keys is specified) the page fill factor is
-.\" made as large as possible (which is almost invariably what is wanted).
-.It Fa minkeypage
-The minimum number of keys which will be stored on any single page.
-This value is used to determine which keys will be stored on overflow
-pages, i.e., if a key or data item is longer than the pagesize divided
-by the
-.Fa minkeypage
-value, it will be stored on overflow pages instead of in the page
-itself.
-If
-.Fa minkeypage
-is 0 (no minimum number of keys is specified) a value of 2 is used.
-.It Fa psize
-Page size is the size (in bytes) of the pages used for nodes in the
-tree.
-The minimum page size is 512 bytes and the maximum page size is 64K.
-If
-.Fa psize
-is 0 (no page size is specified) a page size is chosen based on the
-underlying file system I/O block size.
-.It Fa compare
-Compare is the key comparison function.
-It must return an integer less than, equal to, or greater than zero if
-the first key argument is considered to be respectively less than,
-equal to, or greater than the second key argument.
-The same comparison function must be used on a given tree every time
-it is opened.
-If
-.Fa compare
-is
-.Dv NULL
-(no comparison function is specified), the keys are compared
-lexically, with shorter keys considered less than longer keys.
-.It Fa prefix
-Prefix is the prefix comparison function.
-If specified, this routine must return the number of bytes of the
-second key argument which are necessary to determine that it is
-greater than the first key argument.
-If the keys are equal, the key length should be returned.
-Note, the usefulness of this routine is very data dependent, but, in
-some data sets can produce significantly reduced tree sizes and search
-times.
-If
-.Fa prefix
-is
-.Dv NULL
-(no prefix function is specified),
-.Em and
-no comparison function is specified, a default lexical comparison
-routine is used.
-If
-.Fa prefix
-is
-.Dv NULL
-and a comparison routine is specified, no prefix comparison is done.
-.It Fa lorder
-The byte order for integers in the stored database metadata.
-The number should represent the order as an integer; for example,
-big endian order would be the number 4,321.
-If
-.Fa lorder
-is 0 (no order is specified) the current host order is used.
-.El
-.Pp
-If the file already exists (and the
-.Dv O_TRUNC
-flag is not specified), the values specified for the parameters flags,
-lorder and psize are ignored in favor of the values used when the tree
-was created.
-.Pp
-Forward sequential scans of a tree are from the least key to the
-greatest.
-.Pp
-Space freed up by deleting key/data pairs from the tree is never
-reclaimed, although it is normally made available for reuse.
-This means that the btree storage structure is grow-only.
-The only solutions are to avoid excessive deletions, or to create a
-fresh tree periodically from a scan of an existing one.
-.Pp
-Searches, insertions, and deletions in a btree will all complete in
-O lg base N where base is the average fill factor.
-Often, inserting ordered data into btrees results in a low fill
-factor.
-This implementation has been modified to make ordered insertion the
-best case, resulting in a much better than normal page fill factor.
-.Sh ERRORS
-The
-.Nm
-access method routines may fail and set
-.Va errno
-for any of the errors specified for the library routine
-.Xr dbopen 3 .
-.Sh SEE ALSO
-.Xr dbopen 3 ,
-.Xr hash 3 ,
-.Xr mpool 3 ,
-.Xr recno 3
-.Pp
-.Rs
-.%T "The Ubiquitous B-tree"
-.%A "Douglas Comer"
-.%J "ACM Comput. Surv."
-.%V 2
-.%N 11
-.%D June 1979
-.%P 121-138
-.Re
-.Rs
-.%T "Prefix B-trees"
-.%A "Bayer"
-.%A "Unterauer"
-.%J "ACM Transactions on Database Systems"
-.%V Vol. 2
-.%N 1
-.%D March 1977
-.%P 11-26
-.Re
-.Rs
-.%B "The Art of Computer Programming Vol. 3: Sorting and Searching"
-.%A "D.E. Knuth"
-.%D 1968
-.%P 471-480
-.Re
-.Sh BUGS
-Only big and little endian byte order is supported.
diff --git a/lib/nbsd_libc/db/man/dbm_clearerr.3 b/lib/nbsd_libc/db/man/dbm_clearerr.3
deleted file mode 100644 (file)
index d9f0672..0000000
+++ /dev/null
@@ -1,306 +0,0 @@
-.\"    $NetBSD: dbm_clearerr.3,v 1.5 2010/05/05 06:55:57 jruoho Exp $
-.\"
-.\" Copyright (c) 2004 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Klaus Klein.
-.\"
-.\" 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.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
-.\"
-.Dd May 5, 2010
-.Dt DBM_CLEARERR 3
-.Os
-.Sh NAME
-.Nm dbm_clearerr ,
-.Nm dbm_close ,
-.Nm dbm_delete ,
-.Nm dbm_dirfno ,
-.Nm dbm_error ,
-.Nm dbm_fetch ,
-.Nm dbm_firstkey ,
-.Nm dbm_nextkey ,
-.Nm dbm_open ,
-.Nm dbm_store ,
-.Nm ndbm
-.Nd database functions
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In ndbm.h
-.Ft int
-.Fn dbm_clearerr "DBM *db"
-.Ft void
-.Fn dbm_close "DBM *db"
-.Ft int
-.Fn dbm_delete "DBM *db" "datum key"
-.Ft int
-.Fn dbm_dirfno "DBM *db"
-.Ft int
-.Fn dbm_error "DBM *db"
-.Ft datum
-.Fn dbm_fetch "DBM *db" "datum key"
-.Ft datum
-.Fn dbm_firstkey "DBM *db"
-.Ft datum
-.Fn dbm_nextkey "DBM *db"
-.Ft DBM *
-.Fn dbm_open "const char *file" "int open_flags" "mode_t file_mode"
-.Ft int
-.Fn dbm_store "DBM *db" "datum key" "datum content" "int store_mode"
-.Sh DESCRIPTION
-The
-.Nm ndbm
-facility provides access to hash database files.
-.Pp
-Two data types are fundamental to the
-.Nm ndbm
-facility.
-.Fa DBM
-serves as a handle to a database.
-It is an opaque type.
-.Pp
-The other data type is
-.Fa datum ,
-which is a structure type which includes the following members:
-.Bd -literal -offset indent
-void *  dptr
-size_t  dsize
-.Ed
-.Pp
-A
-.Fa datum
-is thus given by
-.Fa dptr
-pointing at an object of
-.Fa dsize
-bytes in length.
-.Pp
-The
-.Fn dbm_open
-function opens a database.
-The
-.Fa file
-argument is the pathname which the actual database file pathname
-is based on.
-This implementation uses a single file with the suffix
-.Pa .db
-appended to
-.Fa file .
-The
-.Fa open_flags
-argument has the same meaning as the
-.Fa flags
-argument to
-.Xr open 2
-except that when opening a database for write-only access the file
-is opened for read/write access, and the
-.Dv O_APPEND
-flag must not be specified.
-The
-.Fa file_mode
-argument has the same meaning as the
-.Fa mode
-argument to
-.Xr open 2 .
-.Pp
-For the following functions, the
-.Fa db
-argument is a handle previously returned by a call to
-.Fn dbm_open .
-.Pp
-The
-.Fn dbm_close
-function closes a database.
-.Pp
-The
-.Fn dbm_fetch
-function retrieves a record from the database.
-The
-.Fa key
-argument is a
-.Fa datum
-that identifies the record to be fetched.
-.Pp
-The
-.Fn dbm_store
-function stores a record into the database.
-The
-.Fa key
-argument is a
-.Fa datum
-that identifies the record to be stored.
-The
-.Fa content
-argument is a
-.Fa datum
-that specifies the value of the record to be stored.
-The
-.Fa store_mode
-argument specifies the behavior of
-.Fn dbm_store
-if a record matching
-.Fa key
-is already present in the database,
-.Fa db .
-.Fa store_mode
-must be one of the following:
-.Bl -tag -width DBM_REPLACEXX -offset indent
-.It Dv DBM_INSERT
-If a record matching
-.Fa key
-is already present, it is left unchanged.
-.It Dv DBM_REPLACE
-If a record matching
-.Fa key
-is already present, its value is replaced by
-.Fa content .
-.El
-.Pp
-If no record matching
-.Fa key
-is present, a new record is inserted regardless of
-.Fa store_mode .
-.Pp
-The
-.Fn dbm_delete
-function deletes a record from the database.
-The
-.Fa key
-argument is a
-.Fa datum
-that identifies the record to be deleted.
-.Pp
-The
-.Fn dbm_firstkey
-function returns the first key in the database.
-.Pp
-The
-.Fn dbm_nextkey
-function returns the next key in the database.
-In order to be meaningful, it must be preceded by a call to
-.Fn dbm_firstkey .
-.Pp
-The
-.Fn dbm_error
-function returns the error indicator of the database.
-.Pp
-The
-.Fn dbm_clearerr
-function clears the error indicator of the database.
-.Pp
-The
-.Fn dbm_dirfno
-function returns the file descriptor of the underlying database file.
-.Sh IMPLEMENTATION NOTES
-The
-.Nm ndbm
-facility is implemented on top of the
-.Xr hash 3
-access method of the
-.Xr db 3
-database facility.
-.Sh RETURN VALUES
-The
-.Fn dbm_open
-function returns a pointer to a
-.Fa DBM
-when successful; otherwise a null pointer is returned.
-.Pp
-The
-.Fn dbm_close
-function returns no value.
-.Pp
-The
-.Fn dbm_fetch
-function returns a content
-.Fa datum ;
-if no record matching
-.Fa key
-was found or if an error occured, its
-.Fa dptr
-member is a null pointer.
-.Pp
-The
-.Fn dbm_store
-function returns 0 when then record was successfully inserted;
-it returns 1 when called with
-.Fa store_mode
-being
-.Dv DBM_INSERT
-and a record matching
-.Fa key
-is already present;
-otherwise a negative value is returned.
-.Pp
-The
-.Fn dbm_delete
-function returns 0 when the record was successfully deleted;
-otherwise a negative value is returned.
-.Pp
-The
-.Fn dbm_firstkey
-and
-.Fn dbm_nextkey
-functions return a key
-.Fa datum .
-When the end of the database is reached or if an error occured, its
-.Fa dptr
-member is a null pointer.
-.Pp
-The
-.Fn dbm_error
-function returns 0 if the error indicator is clear;
-if the error indicator is set a non-zero value is returned.
-.Pp
-The
-.Fn dbm_clearerr
-function always returns 0.
-.Pp
-The
-.Fn dbm_dirfno
-function returns the file descriptor of the underlying database file.
-.Sh ERRORS
-No errors are defined.
-.Sh SEE ALSO
-.Xr open 2 ,
-.Xr db 3 ,
-.Xr hash 3
-.Sh STANDARDS
-The
-.Fn dbm_clearerr ,
-.Fn dbm_close ,
-.Fn dbm_delete ,
-.Fn dbm_error ,
-.Fn dbm_fetch ,
-.Fn dbm_firstkey ,
-.Fn dbm_nextkey ,
-.Fn dbm_open ,
-and
-.Fn dbm_store
-functions conform to
-.St -xpg4.2
-and
-.St -susv2 .
-The
-.Fn dbm_dirfno
-function is an extension.
diff --git a/lib/nbsd_libc/db/man/dbopen.3 b/lib/nbsd_libc/db/man/dbopen.3
deleted file mode 100644 (file)
index 1db9a25..0000000
+++ /dev/null
@@ -1,538 +0,0 @@
-.\"    $NetBSD: dbopen.3,v 1.19 2010/12/16 12:08:16 jruoho Exp $
-.\"
-.\" Copyright (c) 1990, 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. 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.
-.\"
-.\"    @(#)dbopen.3    8.5 (Berkeley) 1/2/94
-.\"
-.Dd December 16, 2010
-.Dt DBOPEN 3
-.Os
-.Sh NAME
-.Nm dbopen ,
-.Nm db
-.Nd database access methods
-.Sh SYNOPSIS
-.In sys/types.h
-.In limits.h
-.In db.h
-.In fcntl.h
-.Ft DB *
-.Fn dbopen "const char *file" "int flags" "mode_t mode" \
-"DBTYPE type" "const void *openinfo"
-.Sh DESCRIPTION
-.Nm
-is the library interface to database files.
-The supported file formats are btree, hashed, and UNIX file oriented.
-The btree format is a representation of a sorted, balanced tree
-structure.
-The hashed format is an extensible, dynamic hashing scheme.
-The flat-file format is a byte stream file with fixed or variable
-length records.
-The formats and file format specific information are described in
-detail in their respective manual pages
-.Xr btree 3 ,
-.Xr hash 3 ,
-and
-.Xr recno 3 .
-.Pp
-The
-.Fn dbopen
-function opens
-.Fa file
-for reading and/or writing.
-Files never intended to be preserved on disk may be created by setting
-the file parameter to
-.Dv NULL .
-.Pp
-The
-.Fa flags
-and
-.Fa mode
-arguments are as specified to the
-.Xr open 2
-routine, however, only the
-.Dv O_CREAT ,
-.Dv O_EXCL ,
-.Dv O_EXLOCK ,
-.Dv O_NONBLOCK ,
-.Dv O_RDONLY ,
-.Dv O_RDWR ,
-.Dv O_SHLOCK ,
-and
-.Dv O_TRUNC
-flags are meaningful.
-(Note, opening a database file
-.Dv O_WRONLY
-is not possible.)
-.\"Three additional options may be specified by or'ing
-.\"them into the
-.\".Fa flags
-.\"argument.
-.\".Pp
-.\".Dv DB_LOCK
-.\"Do the necessary locking in the database to support concurrent access.
-.\"If concurrent access isn't needed or the database is read-only this
-.\"flag should not be set, as it tends to have an associated performance
-.\"penalty.
-.\".Pp
-.\".Dv DB_SHMEM
-.\"Place the underlying memory pool used by the database in shared
-.\"memory.
-.\"Necessary for concurrent access.
-.\".Pp
-.\".Dv DB_TXN
-.\"Support transactions in the database.
-.\"The
-.\".Dv DB_LOCK
-.\"and
-.\".Dv DB_SHMEM
-.\"flags must be set as well.
-.Pp
-The
-.Fa type
-argument is of type
-.Vt DBTYPE
-(as defined in the
-.In db.h
-include file) and may be set to
-.Dv DB_BTREE ,
-.Dv DB_HASH ,
-or
-.Dv DB_RECNO .
-.Pp
-The
-.Fa openinfo
-argument is a pointer to an access method specific structure described
-in the access method's manual page.
-If
-.Fa openinfo
-is
-.Dv NULL ,
-each access method will use defaults appropriate for the system and
-the access method.
-.Ss The DB Structure
-The
-.Fn dbopen
-function returns a pointer to a DB structure on success and
-.Dv NULL
-on error.
-The DB structure is defined in the
-.In db.h
-include file, and contains at least the following fields:
-.Bd -literal -offset indent
-typedef struct {
-       DBTYPE type;
-       int (*close)(const DB *db);
-       int (*del)(const DB *db, const DBT *key, u_int flags);
-       int (*fd)(const DB *db);
-       int (*get)(const DB *db, DBT *key, DBT *data, u_int flags);
-       int (*put)(const DB *db, DBT *key, const DBT *data,
-           u_int flags);
-       int (*sync)(const DB *db, u_int flags);
-       int (*seq)(const DB *db, DBT *key, DBT *data, u_int flags);
-} DB;
-.Ed
-.Pp
-These elements describe a database type and a set of functions
-performing various actions.
-These functions take a pointer to a structure as returned by
-.Nm ,
-and sometimes one or more pointers to key/data structures and a flag
-value.
-.Bl -tag -width closex -offset indent
-.It Fa type
-The type of the underlying access method (and file format).
-.It Fa close
-A pointer to a routine to flush any cached information to disk, free
-any allocated resources, and close the underlying file(s).
-Since key/data pairs may be cached in memory, failing to sync the file
-with a
-.Fa close
-or
-.Fa sync
-function may result in inconsistent or lost information.
-.Fa close
-routines return \-1 on error (setting
-.Va errno )
-and 0 on success.
-.It Fa del
-A pointer to a routine to remove key/data pairs from the database.
-.Pp
-The parameter
-.Fa flag
-may be set to the following value:
-.Bl -tag -width R_CURSORX
-.It Dv R_CURSOR
-Delete the record referenced by the cursor.
-The cursor must have previously been initialized.
-.El
-.Pp
-.Fa delete
-routines return \-1 on error (setting
-.Va errno ) ,
-0 on success, and 1 if the specified
-.Fa key
-was not in the file.
-.It Fa fd
-A pointer to a routine which returns a file descriptor representative
-of the underlying database.
-A file descriptor referencing the same file will be returned to all
-processes which call
-.Nm
-with the same
-.Fa file
-name.
-This file descriptor may be safely used as an argument to the
-.Xr fcntl 2
-and
-.Xr flock 2
-locking functions.
-The file descriptor is not necessarily associated with any of the
-underlying files used by the access method.
-No file descriptor is available for in memory databases.
-.Fa fd
-routines return \-1 on error (setting
-.Va errno ) ,
-and the file descriptor on success.
-.It Fa get
-A pointer to a routine which is the interface for keyed retrieval from
-the database.
-The address and length of the data associated with the specified
-.Fa key
-are returned in the structure referenced by
-.Fa data .
-.Fa get
-routines return \-1 on error (setting
-.Va errno ) ,
-0 on success, and 1 if the
-.Fa key
-was not in the file.
-.It Fa put
-A pointer to a routine to store key/data pairs in the database.
-.Pp
-The parameter
-.Fa flag
-may be set to one of the following values:
-.Bl -tag -width R_NOOVERWRITEX
-.It Dv R_CURSOR
-Replace the key/data pair referenced by the cursor.
-The cursor must have previously been initialized.
-.It Dv R_IAFTER
-Append the data immediately after the data referenced by
-.Fa key ,
-creating a new key/data pair.
-The record number of the appended key/data pair is returned in the
-.Fa key
-structure.
-(Applicable only to the
-.Dv DB_RECNO
-access method.)
-.It Dv R_IBEFORE
-Insert the data immediately before the data referenced by
-.Fa key ,
-creating a new key/data pair.
-The record number of the inserted key/data pair is returned in the
-.Fa key
-structure.
-(Applicable only to the
-.Dv DB_RECNO
-access method.)
-.It Dv R_NOOVERWRITE
-Enter the new key/data pair only if the key does not previously
-exist.
-.It Dv R_SETCURSOR
-Store the key/data pair, setting or initializing the position of the
-cursor to reference it.
-(Applicable only to the
-.Dv DB_BTREE
-and
-.Dv DB_RECNO
-access methods.)
-.El
-.Pp
-.Dv R_SETCURSOR
-is available only for the
-.Dv DB_BTREE
-and
-.Dv DB_RECNO
-access methods because it implies that the keys have an inherent order
-which does not change.
-.Pp
-.Dv R_IAFTER
-and
-.Dv R_IBEFORE
-are available only for the
-.Dv DB_RECNO
-access method because they each imply that the access method is able
-to create new keys.
-This is only true if the keys are ordered and independent, record
-numbers for example.
-.Pp
-The default behavior of the
-.Fa put
-routines is to enter the new key/data pair, replacing any previously
-existing key.
-.Pp
-.Fa put
-routines return \-1 on error (setting
-.Va errno ) ,
-0 on success, and 1 if the
-.Dv R_NOOVERWRITE
-.Fa flag
-was set and the key already exists in the file.
-.It Fa seq
-A pointer to a routine which is the interface for sequential
-retrieval from the database.
-The address and length of the key are returned in the structure
-referenced by
-.Fa key ,
-and the address and length of the data are returned in the
-structure referenced by
-.Fa data .
-.Pp
-Sequential key/data pair retrieval may begin at any time, and the
-position of the
-.Dq cursor
-is not affected by calls to the
-.Fa del ,
-.Fa get ,
-.Fa put ,
-or
-.Fa sync
-routines.
-Modifications to the database during a sequential scan will be
-reflected in the scan, i.e., records inserted behind the cursor will
-not be returned while records inserted in front of the cursor will be
-returned.
-.Pp
-The flag value
-.Em must
-be set to one of the following values:
-.Bl -tag -width R_CURSORX
-.It Dv R_CURSOR
-The data associated with the specified key is returned.
-This differs from the
-.Fa get
-routines in that it sets or initializes the cursor to the location of
-the key as well.
-(Note, for the
-.Dv DB_BTREE
-access method, the returned key is not necessarily an exact match for
-the specified key.
-The returned key is the smallest key greater than or equal to the
-specified key, permitting partial key matches and range searches.)
-.It Dv R_FIRST
-The first key/data pair of the database is returned, and the cursor
-is set or initialized to reference it.
-.It Dv R_LAST
-The last key/data pair of the database is returned, and the cursor
-is set or initialized to reference it.
-(Applicable only to the
-.Dv DB_BTREE
-and
-.Dv DB_RECNO
-access methods.)
-.It Dv R_NEXT
-Retrieve the key/data pair immediately after the cursor.
-If the cursor is not yet set, this is the same as the
-.Dv R_FIRST
-flag.
-.It Dv R_PREV
-Retrieve the key/data pair immediately before the cursor.
-If the cursor is not yet set, this is the same as the
-.Dv R_LAST
-flag.
-(Applicable only to the
-.Dv DB_BTREE
-and
-.Dv DB_RECNO
-access methods.)
-.El
-.Pp
-.Dv R_LAST
-and
-.Dv R_PREV
-are available only for the
-.Dv DB_BTREE
-and
-.Dv DB_RECNO
-access methods because they each imply that the keys have an inherent
-order which does not change.
-.Pp
-.Fa seq
-routines return \-1 on error (setting
-.Va errno ) ,
-0 on success and 1 if there are no key/data pairs less than or greater
-than the specified or current key.
-If the
-.Dv DB_RECNO
-access method is being used, and if the database file is a character
-special file and no complete key/data pairs are currently available,
-the
-.Fa seq
-routines return 2.
-.It Fa sync
-A pointer to a routine to flush any cached information to disk.
-If the database is in memory only, the
-.Fa sync
-routine has no effect and will always succeed.
-.Pp
-The flag value may be set to the following value:
-.Bl -tag -width ".Dv R_RECNOSYNC"
-.It Dv R_RECNOSYNC
-If the
-.Dv DB_RECNO
-access method is being used, this flag causes the sync routine to
-apply to the btree file which underlies the recno file, not the recno
-file itself.
-(See the
-.Fa bfname
-field of the
-.Xr recno 3
-manual page for more information.)
-.El
-.Pp
-.Fa sync
-routines return \-1 on error (setting
-.Va errno )
-and 0 on success.
-.El
-.Ss Key/data Pairs
-Access to all file types is based on key/data pairs.
-Both keys and data are represented by the following data structure:
-.Bd -literal -offset indent
-typedef struct {
-       void *data;
-       size_t size;
-} DBT;
-.Ed
-.Pp
-The elements of the DBT structure are defined as follows:
-.Bl -tag -width datax -offset indent
-.It Fa data
-A pointer to a byte string.
-.It Fa size
-The length of the byte string.
-.El
-.Pp
-Key and data byte strings may reference strings of essentially
-unlimited length although any two of them must fit into available
-memory at the same time.
-It should be noted that the access methods provide no guarantees about
-byte string alignment.
-.Sh ERRORS
-The
-.Nm
-routine may fail and set
-.Va errno
-for any of the errors specified for the library routines
-.Xr open 2
-and
-.Xr malloc 3
-or the following:
-.Bl -tag -width Er
-.It Er EFTYPE
-A file is incorrectly formatted.
-.It Er EINVAL
-A parameter has been specified (hash function, pad byte, etc.) that is
-incompatible with the current file specification or which is not
-meaningful for the function (for example, use of the cursor without
-prior initialization) or there is a mismatch between the version
-number of file and the software.
-.It Er EFBIG
-The key could not be inserted due to limitations in the DB file format
-(e.g., a hash database was out of overflow pages).
-.El
-.Pp
-The
-.Fa close
-routines may fail and set
-.Va errno
-for any of the errors specified for the library routines
-.Xr close 2 ,
-.Xr read 2 ,
-.Xr write 2 ,
-.Xr free 3 ,
-or
-.Xr fsync 2 .
-.Pp
-The
-.Fa del ,
-.Fa get ,
-.Fa put ,
-and
-.Fa seq
-routines may fail and set
-.Va errno
-for any of the errors specified for the library routines
-.Xr read 2 ,
-.Xr write 2 ,
-.Xr free 3 ,
-or
-.Xr malloc 3 .
-.Pp
-The
-.Fa fd
-routines will fail and set
-.Va errno
-to
-.Er ENOENT
-for in memory databases.
-.Pp
-The
-.Fa sync
-routines may fail and set
-.Va errno
-for any of the errors specified for the library routine
-.Xr fsync 2 .
-.Sh SEE ALSO
-.Xr btree 3 ,
-.Xr hash 3 ,
-.Xr mpool 3 ,
-.Xr recno 3
-.Pp
-.Rs
-.%T LIBTP: Portable, Modular Transactions for UNIX
-.%A Margo Seltzer
-.%A Michael Olson
-.%I USENIX Association
-.%B Proceedings of the 1992 Winter USENIX Technical Conference
-.%D 1992
-.%P 9-25
-.Re
-.Sh BUGS
-The typedef DBT is a mnemonic for
-.Dq data base thang ,
-and was used because no one could think of a reasonable name that
-wasn't already used.
-.Pp
-The file descriptor interface is a kludge and will be deleted in a
-future version of the interface.
-.Pp
-None of the access methods provide any form of concurrent access,
-locking, or transactions.
diff --git a/lib/nbsd_libc/db/man/hash.3 b/lib/nbsd_libc/db/man/hash.3
deleted file mode 100644 (file)
index eaac286..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-.\"    $NetBSD: hash.3,v 1.14 2010/12/16 11:57:20 jruoho Exp $
-.\"
-.\" Copyright (c) 1990, 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. 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.
-.\"
-.\"    @(#)hash.3      8.6 (Berkeley) 8/18/94
-.\"
-.Dd December 16, 2010
-.Dt HASH 3
-.Os
-.Sh NAME
-.Nm hash
-.Nd hash database access method
-.Sh SYNOPSIS
-.In sys/types.h
-.In db.h
-.Sh DESCRIPTION
-The routine
-.Fn dbopen
-is the library interface to database files.
-One of the supported file formats is hash files.
-The general description of the database access methods is in
-.Xr dbopen 3 ,
-this manual page describes only the hash specific information.
-.Pp
-The hash data structure is an extensible, dynamic hashing scheme.
-.Pp
-The access method specific data structure provided to
-.Fn dbopen
-is defined in the
-.In db.h
-header as follows:
-.Bd -literal -offset indent
-typedef struct {
-       u_int bsize;
-       u_int ffactor;
-       u_int nelem;
-       u_int cachesize;
-       uint32_t (*hash)(const void *, size_t);
-       int lorder;
-} HASHINFO;
-.Ed
-.Pp
-The elements of this structure are as follows:
-.Bl -tag -width cachesizex
-.It Fa bsize
-.Fa bsize
-defines the hash table bucket size, and defaults to 4096 for in-memory tables.
-If
-.Fa bsize
-is 0 (no bucket size is specified) a bucket size is chosen based on the
-underlying file system I/O block size.
-It may be preferable to increase the page size for disk-resident
-tables and tables with large data items.
-.It Fa ffactor
-.Fa ffactor
-indicates a desired density within the hash table.
-It is an approximation of the number of keys allowed to accumulate in
-any one bucket, determining when the hash table grows or shrinks.
-The default value is 8.
-.It Fa nelem
-.Fa nelem
-is an estimate of the final size of the hash table.
-If not set or set too low, hash tables will expand gracefully as keys
-are entered, although a slight performance degradation may be
-noticed.
-The default value is 1.
-.It Fa cachesize
-A suggested maximum size, in bytes, of the memory cache.
-This value is
-.Em only
-advisory, and the access method will allocate more memory rather
-than fail.
-.It Fa hash
-.Fa hash
-is a user defined hash function.
-Since no hash function performs equally well on all possible data, the
-user may find that the built-in hash function does poorly on a
-particular data set.
-User specified hash functions must take two arguments (a pointer to a
-byte string and a length) and return a 32-bit quantity to be used as
-the hash value.
-.It Fa lorder
-The byte order for integers in the stored database metadata.
-The number should represent the order as an integer; for example,
-big endian order would be the number 4,321.
-If
-.Fa lorder
-is 0 (no order is specified) the current host order is used.
-If the file already exists, the specified value is ignored and the
-value specified when the tree was created is used.
-.El
-.Pp
-If the file already exists (and the
-.Dv O_TRUNC
-flag is not specified), the values specified for the parameters
-.Fa bsize ,
-.Fa ffactor ,
-.Fa lorder ,
-and
-.Fa nelem
-are ignored and the values specified when the tree was created are
-used.
-.Pp
-If a hash function is specified,
-.Fn hash_open
-will attempt to determine if the hash function specified is the same
-as the one with which the database was created, and will fail if it is
-not.
-.\".Pp
-.\"Backward compatible interfaces to the routines described in
-.\".Xr dbm 3 ,
-.\"and
-.\".Xr ndbm 3
-.\"are provided, however these interfaces are not compatible with
-.\"previous file formats.
-.Sh ERRORS
-The
-.Nm
-access method routines may fail and set
-.Va errno
-for any of the errors specified for the library routine
-.Xr dbopen 3 .
-.Sh SEE ALSO
-.Xr btree 3 ,
-.Xr dbopen 3 ,
-.Xr mpool 3 ,
-.Xr recno 3
-.Pp
-.Rs
-.%T Dynamic Hash Tables
-.%A Per-Ake Larson
-.%J Communications of the ACM
-.%D April 1988
-.%N Issue 4
-.%V Volume 31
-.Re
-.Rs
-.%T A New Hash Package for UNIX
-.%A Margo Seltzer
-.%I USENIX Association
-.%B Proceedings of the 1991 Winter USENIX Technical Conference
-.%D January 1991
-.%P 173-184
-.%U http://www.usenix.org/publications/library/proceedings/seltzer2.pdf
-.Re
-.Sh BUGS
-Only big and little endian byte order is supported.
diff --git a/lib/nbsd_libc/db/man/mpool.3 b/lib/nbsd_libc/db/man/mpool.3
deleted file mode 100644 (file)
index 32673f9..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-.\"    $NetBSD: mpool.3,v 1.10 2010/12/16 11:49:35 jruoho Exp $
-.\"
-.\" Copyright (c) 1990, 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. 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.
-.\"
-.\"    @(#)mpool.3     8.1 (Berkeley) 6/4/93
-.\"
-.Dd December 16, 2010
-.Dt MPOOL 3
-.Os
-.Sh NAME
-.Nm mpool ,
-.Nm mpool_open ,
-.Nm mpool_filter ,
-.Nm mpool_new ,
-.Nm mpool_get ,
-.Nm mpool_put ,
-.Nm mpool_sync ,
-.Nm mpool_close
-.Nd shared memory buffer pool
-.Sh SYNOPSIS
-.In db.h
-.In mpool.h
-.Ft MPOOL *
-.Fn mpool_open "DBT *key" "int fd" "pgno_t pagesize" "pgno_t maxcache"
-.Ft void
-.Fn mpool_filter "MPOOL *mp" "void (*pgin)(void *, pgno_t, void *)" \
-"void (*pgout)(void *, pgno_t, void *)" "void *pgcookie"
-.Ft void *
-.Fn mpool_new "MPOOL *mp" "pgno_t *pgnoaddr"
-.Ft void *
-.Fn mpool_get "MPOOL *mp" "pgno_t pgno" "u_int flags"
-.Ft int
-.Fn mpool_put "MPOOL *mp" "void *pgaddr" "u_int flags"
-.Ft int
-.Fn mpool_sync "MPOOL *mp"
-.Ft int
-.Fn mpool_close "MPOOL *mp"
-.Sh DESCRIPTION
-.Nm
-is the library interface intended to provide page oriented buffer
-management of files.
-The buffers may be shared between processes.
-.Pp
-The function
-.Fn mpool_open
-initializes a memory pool.
-The
-.Fa key
-argument is the byte string used to negotiate between multiple
-processes wishing to share buffers.
-If the file buffers are mapped in shared memory, all processes using
-the same key will share the buffers.
-If
-.Fa key
-is
-.Dv NULL ,
-the buffers are mapped into private memory.
-The
-.Fa fd
-argument is a file descriptor for the underlying file, which must be
-seekable.
-If
-.Fa key
-is
-.No non- Ns Dv NULL
-and matches a file already being mapped, the
-.Fa fd
-argument is ignored.
-.Pp
-The
-.Fa pagesize
-argument is the size, in bytes, of the pages into which the file is
-broken up.
-The
-.Fa maxcache
-argument is the maximum number of pages from the underlying file to
-cache at any one time.
-This value is not relative to the number of processes which share a
-file's buffers, but will be the largest value specified by any of the
-processes sharing the file.
-.Pp
-The
-.Fn mpool_filter
-function is intended to make transparent input and output processing
-of the pages possible.
-If the
-.Fa pgin
-function is specified, it is called each time a buffer is read into
-the memory pool from the backing file.
-If the
-.Fa pgout
-function is specified, it is called each time a buffer is written into
-the backing file.
-Both functions are are called with the
-.Fa pgcookie
-pointer, the page number and a pointer to the page to being read or
-written.
-.Pp
-The function
-.Fn mpool_new
-takes an MPOOL pointer and an address as arguments.
-If a new page can be allocated, a pointer to the page is returned and
-the page number is stored into the
-.Fa pgnoaddr
-address.
-Otherwise,
-.Dv NULL
-is returned and errno is set.
-.Pp
-The function
-.Fn mpool_get
-takes a MPOOL pointer and a page number as arguments.
-If the page exists, a pointer to the page is returned.
-Otherwise,
-.Dv NULL
-is returned and errno is set.
-The flags parameter is not currently used.
-.Pp
-The function
-.Fn mpool_put
-unpins the page referenced by
-.Fa pgaddr .
-.Fa pgaddr
-must be an address previously returned by
-.Fn mpool_get
-or
-.Fn mpool_new .
-The flag value is specified by or'ing any of the following values:
-.Bl -tag -width MPOOL_DIRTYX -offset indent
-.It Dv MPOOL_DIRTY
-The page has been modified and needs to be written to the backing
-file.
-.El
-.Pp
-.Fn mpool_put
-returns 0 on success and \-1 if an error occurs.
-.Pp
-The function
-.Fn mpool_sync
-writes all modified pages associated with the MPOOL pointer to the
-backing file.
-.Fn mpool_sync
-returns 0 on success and \-1 if an error occurs.
-.Pp
-The
-.Fn mpool_close
-function frees up any allocated memory associated with the memory pool
-cookie.
-Modified pages are
-.Em not
-written to the backing file.
-.Fn mpool_close
-returns 0 on success and \-1 if an error occurs.
-.Sh ERRORS
-The
-.Fn mpool_open
-function may fail and set
-.Va errno
-for any of the errors specified for the library routine
-.Xr malloc 3 .
-.Pp
-The
-.Fn mpool_get
-function may fail and set
-.Va errno
-for the following:
-.Bl -tag -width Er -offset indent
-.It Er EINVAL
-The requested record doesn't exist.
-.El
-.Pp
-The
-.Fn mpool_new
-and
-.Fn mpool_get
-functions may fail and set
-.Va errno
-for any of the errors specified for the library routines
-.Xr read 2 ,
-.Xr write 2 ,
-and
-.Xr malloc 3 .
-.Pp
-The
-.Fn mpool_sync
-function may fail and set
-.Va errno
-for any of the errors specified for the library routine
-.Xr write 2 .
-.Pp
-The
-.Fn mpool_close
-function may fail and set
-.Va errno
-for any of the errors specified for the library routine
-.Xr free 3 .
-.Sh SEE ALSO
-.Xr btree 3 ,
-.Xr dbopen 3 ,
-.Xr hash 3 ,
-.Xr recno 3
diff --git a/lib/nbsd_libc/db/man/recno.3 b/lib/nbsd_libc/db/man/recno.3
deleted file mode 100644 (file)
index a38871f..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-.\"    $NetBSD: recno.3,v 1.11 2010/03/22 19:30:53 joerg Exp $
-.\"
-.\" Copyright (c) 1990, 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. 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.
-.\"
-.\"    @(#)recno.3     8.5 (Berkeley) 8/18/94
-.\"
-.Dd April 17, 2003
-.Dt RECNO 3
-.Os
-.Sh NAME
-.Nm recno
-.Nd record number database access method
-.Sh SYNOPSIS
-.In sys/types.h
-.In db.h
-.Sh DESCRIPTION
-The routine
-.Fn dbopen
-is the library interface to database files.
-One of the supported file formats is record number files.
-The general description of the database access methods is in
-.Xr dbopen 3 ,
-this manual page describes only the recno specific information.
-.Pp
-The record number data structure is either variable or fixed-length
-records stored in a flat-file format, accessed by the logical record
-number.
-The existence of record number five implies the existence of records
-one through four, and the deletion of record number one causes
-record number five to be renumbered to record number four, as well
-as the cursor, if positioned after record number one, to shift down
-one record.
-.Pp
-The recno access method specific data structure provided to
-.Fn dbopen
-is defined in the
-.In db.h
-include file as follows:
-.Bd -literal
-typedef struct {
-       u_long flags;
-       u_int cachesize;
-       u_int psize;
-       int lorder;
-       size_t reclen;
-       uint8_t bval;
-       char *bfname;
-} RECNOINFO;
-.Ed
-.Pp
-The elements of this structure are defined as follows:
-.Bl -tag -width cachesizex
-.It Fa flags
-The flag value is specified by or'ing any of the following values:
-.Bl -tag -width R_FIXEDLENX -offset indent
-.It Dv R_FIXEDLEN
-The records are fixed-length, not byte delimited.
-The structure element
-.Fa reclen
-specifies the length of the record, and the structure element
-.Fa bval
-is used as the pad character.
-Any records, inserted into the database, that are less than
-.Fa reclen
-bytes long are automatically padded.
-.It Dv R_NOKEY
-In the interface specified by
-.Fn dbopen ,
-the sequential record retrieval fills in both the caller's key and
-data structures.
-If the
-.Dv R_NOKEY
-flag is specified, the cursor routines are not required to fill in the
-key structure.
-This permits applications to retrieve records at the end of files
-without reading all of the intervening records.
-.It Dv R_SNAPSHOT
-This flag requires that a snapshot of the file be taken when
-.Fn dbopen
-is called, instead of permitting any unmodified records to be read
-from the original file.
-.El
-.It Fa cachesize
-A suggested maximum size, in bytes, of the memory cache.
-This value is
-.Em only
-advisory, and the access method will allocate more memory rather than
-fail.
-If
-.Fa cachesize
-is 0 (no size is specified) a default cache is used.
-.It Fa psize
-The recno access method stores the in-memory copies of its records
-in a btree.
-This value is the size (in bytes) of the pages used for nodes in that
-tree.
-If
-.Fa psize
-is 0 (no page size is specified) a page size is chosen based on the
-underlying file system I/O block size.
-See
-.Xr btree 3
-for more information.
-.It Fa lorder
-The byte order for integers in the stored database metadata.
-The number should represent the order as an integer; for example,
-big endian order would be the number 4,321.
-If
-.Fa lorder
-is 0 (no order is specified) the current host order is used.
-.It Fa reclen
-The length of a fixed-length record.
-.It Fa bval
-The delimiting byte to be used to mark the end of a record for
-variable-length records, and the pad character for fixed-length
-records.
-If no value is specified, newlines
-.Pq Dq \en
-are used to mark the end of variable-length records and fixed-length
-records are padded with spaces.
-.It Fa bfname
-The recno access method stores the in-memory copies of its records
-in a btree.
-If bfname is
-.No non- Ns Dv NULL ,
-it specifies the name of the btree file, as if specified as the file
-name for a
-.Fn dbopen
-of a btree file.
-.El
-.Pp
-The data part of the key/data pair used by the recno access method
-is the same as other access methods.
-The key is different.
-The
-.Fa data
-field of the key should be a pointer to a memory location of type
-recno_t, as defined in the
-.In db.h
-include file.
-This type is normally the largest unsigned integral type available to
-the implementation.
-The
-.Fa size
-field of the key should be the size of that type.
-.Pp
-Because there can be no meta-data associated with the underlying
-recno access method files, any changes made to the default values
-(e.g., fixed record length or byte separator value) must be explicitly
-specified each time the file is opened.
-.Pp
-In the interface specified by
-.Fn dbopen ,
-using the
-.Fa put
-interface to create a new record will cause the creation of multiple,
-empty records if the record number is more than one greater than the
-largest record currently in the database.
-.Sh ERRORS
-The
-.Nm
-access method routines may fail and set
-.Va errno
-for any of the errors specified for the library routine
-.Xr dbopen 3
-or the following:
-.Bl -tag -width Er
-.It Er EINVAL
-An attempt was made to add a record to a fixed-length database that
-was too large to fit.
-.El
-.Sh SEE ALSO
-.Xr btree 3 ,
-.Xr dbopen 3 ,
-.Xr hash 3 ,
-.Xr mpool 3
-.Pp
-.Rs
-.%T "Document Processing in a Relational Database System"
-.%A Michael Stonebraker
-.%A Heidi Stettner
-.%A Joseph Kalash
-.%A Antonin Guttman
-.%A Nadene Lynn
-.%J Memorandum No. UCB/ERL M82/32
-.%D May 1982
-.Re
-.Sh BUGS
-Only big and little endian byte order is supported.
diff --git a/lib/nbsd_libc/db/mpool/Makefile.inc b/lib/nbsd_libc/db/mpool/Makefile.inc
deleted file mode 100644 (file)
index c9320fb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#      $NetBSD: Makefile.inc,v 1.4 1995/02/27 13:23:53 cgd Exp $
-#      @(#)Makefile.inc        8.1 (Berkeley) 6/4/93
-
-.PATH: ${.CURDIR}/db/mpool
-
-SRCS+= mpool.c
diff --git a/lib/nbsd_libc/db/mpool/README b/lib/nbsd_libc/db/mpool/README
deleted file mode 100644 (file)
index 13002b3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#      $NetBSD: README,v 1.2 1995/02/27 13:24:00 cgd Exp $
-#      @(#)README      8.1 (Berkeley) 6/4/93
-
-These are the current memory pool routines.
-They aren't ready for prime time, yet, and
-the interface is expected to change.
-
---keith
diff --git a/lib/nbsd_libc/db/mpool/mpool.c b/lib/nbsd_libc/db/mpool/mpool.c
deleted file mode 100644 (file)
index a9ce4a0..0000000
+++ /dev/null
@@ -1,462 +0,0 @@
-/*     $NetBSD: mpool.c,v 1.19 2009/04/22 18:44:06 christos Exp $      */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: mpool.c,v 1.19 2009/04/22 18:44:06 christos Exp $");
-
-#include "namespace.h"
-#include <sys/queue.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <db.h>
-
-#define        __MPOOLINTERFACE_PRIVATE
-#include <mpool.h>
-
-#ifdef __weak_alias
-__weak_alias(mpool_close,_mpool_close)
-__weak_alias(mpool_filter,_mpool_filter)
-__weak_alias(mpool_get,_mpool_get)
-__weak_alias(mpool_new,_mpool_new)
-__weak_alias(mpool_open,_mpool_open)
-__weak_alias(mpool_put,_mpool_put)
-__weak_alias(mpool_sync,_mpool_sync)
-#endif
-
-static BKT *mpool_bkt(MPOOL *);
-static BKT *mpool_look(MPOOL *, pgno_t);
-static int  mpool_write(MPOOL *, BKT *);
-
-/*
- * mpool_open --
- *     Initialize a memory pool.
- */
-/*ARGSUSED*/
-MPOOL *
-mpool_open(void *key, int fd, pgno_t pagesize, pgno_t maxcache)
-{
-       struct stat sb;
-       MPOOL *mp;
-       int entry;
-
-       /*
-        * Get information about the file.
-        *
-        * XXX
-        * We don't currently handle pipes, although we should.
-        */
-       if (fstat(fd, &sb))
-               return (NULL);
-       if (!S_ISREG(sb.st_mode)) {
-               errno = ESPIPE;
-               return (NULL);
-       }
-
-       /* Allocate and initialize the MPOOL cookie. */
-       if ((mp = (MPOOL *)calloc(1, sizeof(MPOOL))) == NULL)
-               return (NULL);
-       CIRCLEQ_INIT(&mp->lqh);
-       for (entry = 0; entry < HASHSIZE; ++entry)
-               CIRCLEQ_INIT(&mp->hqh[entry]);
-       mp->maxcache = maxcache;
-       mp->npages = (pgno_t)(sb.st_size / pagesize);
-       mp->pagesize = pagesize;
-       mp->fd = fd;
-       return (mp);
-}
-
-/*
- * mpool_filter --
- *     Initialize input/output filters.
- */
-void
-mpool_filter(MPOOL *mp, void (*pgin)(void *, pgno_t, void *),
-    void (*pgout)(void *, pgno_t, void *), void *pgcookie)
-{
-       mp->pgin = pgin;
-       mp->pgout = pgout;
-       mp->pgcookie = pgcookie;
-}
-       
-/*
- * mpool_new --
- *     Get a new page of memory.
- */
-void *
-mpool_new( MPOOL *mp, pgno_t *pgnoaddr)
-{
-       struct _hqh *head;
-       BKT *bp;
-
-       if (mp->npages == MAX_PAGE_NUMBER) {
-               (void)fprintf(stderr, "mpool_new: page allocation overflow.\n");
-               abort();
-       }
-#ifdef STATISTICS
-       ++mp->pagenew;
-#endif
-       /*
-        * Get a BKT from the cache.  Assign a new page number, attach
-        * it to the head of the hash chain, the tail of the lru chain,
-        * and return.
-        */
-       if ((bp = mpool_bkt(mp)) == NULL)
-               return (NULL);
-       *pgnoaddr = bp->pgno = mp->npages++;
-       bp->flags = MPOOL_PINNED;
-
-       head = &mp->hqh[HASHKEY(bp->pgno)];
-       CIRCLEQ_INSERT_HEAD(head, bp, hq);
-       CIRCLEQ_INSERT_TAIL(&mp->lqh, bp, q);
-       return (bp->page);
-}
-
-/*
- * mpool_get
- *     Get a page.
- */
-/*ARGSUSED*/
-void *
-mpool_get(MPOOL *mp, pgno_t pgno, u_int flags)
-{
-       struct _hqh *head;
-       BKT *bp;
-       off_t off;
-       ssize_t nr;
-
-       /* Check for attempt to retrieve a non-existent page. */
-       if (pgno >= mp->npages) {
-               errno = EINVAL;
-               return (NULL);
-       }
-
-#ifdef STATISTICS
-       ++mp->pageget;
-#endif
-
-       /* Check for a page that is cached. */
-       if ((bp = mpool_look(mp, pgno)) != NULL) {
-#ifdef DEBUG
-               if (bp->flags & MPOOL_PINNED) {
-                       (void)fprintf(stderr,
-                           "mpool_get: page %d already pinned\n", bp->pgno);
-                       abort();
-               }
-#endif
-               /*
-                * Move the page to the head of the hash chain and the tail
-                * of the lru chain.
-                */
-               head = &mp->hqh[HASHKEY(bp->pgno)];
-               CIRCLEQ_REMOVE(head, bp, hq);
-               CIRCLEQ_INSERT_HEAD(head, bp, hq);
-               CIRCLEQ_REMOVE(&mp->lqh, bp, q);
-               CIRCLEQ_INSERT_TAIL(&mp->lqh, bp, q);
-
-               /* Return a pinned page. */
-               bp->flags |= MPOOL_PINNED;
-               return (bp->page);
-       }
-
-       /* Get a page from the cache. */
-       if ((bp = mpool_bkt(mp)) == NULL)
-               return (NULL);
-
-       /* Read in the contents. */
-#ifdef STATISTICS
-       ++mp->pageread;
-#endif
-       off = mp->pagesize * pgno;
-       if ((nr = pread(mp->fd, bp->page, (size_t)mp->pagesize, off)) != (int)mp->pagesize) {
-               if (nr >= 0)
-                       errno = EFTYPE;
-               return (NULL);
-       }
-
-       /* Set the page number, pin the page. */
-       bp->pgno = pgno;
-       bp->flags = MPOOL_PINNED;
-
-       /*
-        * Add the page to the head of the hash chain and the tail
-        * of the lru chain.
-        */
-       head = &mp->hqh[HASHKEY(bp->pgno)];
-       CIRCLEQ_INSERT_HEAD(head, bp, hq);
-       CIRCLEQ_INSERT_TAIL(&mp->lqh, bp, q);
-
-       /* Run through the user's filter. */
-       if (mp->pgin != NULL)
-               (mp->pgin)(mp->pgcookie, bp->pgno, bp->page);
-
-       return (bp->page);
-}
-
-/*
- * mpool_put
- *     Return a page.
- */
-/*ARGSUSED*/
-int
-mpool_put(MPOOL *mp, void *page, u_int flags)
-{
-       BKT *bp;
-
-#ifdef STATISTICS
-       ++mp->pageput;
-#endif
-       bp = (BKT *)(void *)((char *)page - sizeof(BKT));
-#ifdef DEBUG
-       if (!(bp->flags & MPOOL_PINNED)) {
-               (void)fprintf(stderr,
-                   "mpool_put: page %d not pinned\n", bp->pgno);
-               abort();
-       }
-#endif
-       bp->flags &= ~MPOOL_PINNED;
-       bp->flags |= flags & MPOOL_DIRTY;
-       return (RET_SUCCESS);
-}
-
-/*
- * mpool_close
- *     Close the buffer pool.
- */
-int
-mpool_close(MPOOL *mp)
-{
-       BKT *bp;
-
-       /* Free up any space allocated to the lru pages. */
-       while ((bp = mp->lqh.cqh_first) != (void *)&mp->lqh) {
-               CIRCLEQ_REMOVE(&mp->lqh, mp->lqh.cqh_first, q);
-               free(bp);
-       }
-
-       /* Free the MPOOL cookie. */
-       free(mp);
-       return (RET_SUCCESS);
-}
-
-/*
- * mpool_sync
- *     Sync the pool to disk.
- */
-int
-mpool_sync(MPOOL *mp)
-{
-       BKT *bp;
-
-       /* Walk the lru chain, flushing any dirty pages to disk. */
-       for (bp = mp->lqh.cqh_first;
-           bp != (void *)&mp->lqh; bp = bp->q.cqe_next)
-               if (bp->flags & MPOOL_DIRTY &&
-                   mpool_write(mp, bp) == RET_ERROR)
-                       return (RET_ERROR);
-
-       /* Sync the file descriptor. */
-       return (fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
-}
-
-/*
- * mpool_bkt
- *     Get a page from the cache (or create one).
- */
-static BKT *
-mpool_bkt(MPOOL *mp)
-{
-       struct _hqh *head;
-       BKT *bp;
-
-       /* If under the max cached, always create a new page. */
-       if (mp->curcache < mp->maxcache)
-               goto new;
-
-       /*
-        * If the cache is max'd out, walk the lru list for a buffer we
-        * can flush.  If we find one, write it (if necessary) and take it
-        * off any lists.  If we don't find anything we grow the cache anyway.
-        * The cache never shrinks.
-        */
-       for (bp = mp->lqh.cqh_first;
-           bp != (void *)&mp->lqh; bp = bp->q.cqe_next)
-               if (!(bp->flags & MPOOL_PINNED)) {
-                       /* Flush if dirty. */
-                       if (bp->flags & MPOOL_DIRTY &&
-                           mpool_write(mp, bp) == RET_ERROR)
-                               return (NULL);
-#ifdef STATISTICS
-                       ++mp->pageflush;
-#endif
-                       /* Remove from the hash and lru queues. */
-                       head = &mp->hqh[HASHKEY(bp->pgno)];
-                       CIRCLEQ_REMOVE(head, bp, hq);
-                       CIRCLEQ_REMOVE(&mp->lqh, bp, q);
-#ifdef DEBUG
-                       {
-                               void *spage = bp->page;
-                               (void)memset(bp, 0xff,
-                                   (size_t)(sizeof(BKT) + mp->pagesize));
-                               bp->page = spage;
-                       }
-#endif
-                       return (bp);
-               }
-
-new:   if ((bp = calloc(1, (size_t)(sizeof(BKT) + mp->pagesize))) == NULL)
-               return (NULL);
-#ifdef STATISTICS
-       ++mp->pagealloc;
-#endif
-#if defined(DEBUG) || defined(PURIFY)
-       (void)memset(bp, 0xff, (size_t)(sizeof(BKT) + mp->pagesize));
-#endif
-       bp->page = (char *)(void *)bp + sizeof(BKT);
-       ++mp->curcache;
-       return (bp);
-}
-
-/*
- * mpool_write
- *     Write a page to disk.
- */
-static int
-mpool_write(MPOOL *mp, BKT *bp)
-{
-       off_t off;
-
-#ifdef STATISTICS
-       ++mp->pagewrite;
-#endif
-
-       /* Run through the user's filter. */
-       if (mp->pgout)
-               (mp->pgout)(mp->pgcookie, bp->pgno, bp->page);
-
-       off = mp->pagesize * bp->pgno;
-       if (pwrite(mp->fd, bp->page, (size_t)mp->pagesize, off) != (int)mp->pagesize)
-               return (RET_ERROR);
-
-       /*
-        * Re-run through the input filter since this page may soon be
-        * accessed via the cache, and whatever the user's output filter
-        * did may screw things up if we don't let the input filter
-        * restore the in-core copy.
-        */
-       if (mp->pgin)
-               (mp->pgin)(mp->pgcookie, bp->pgno, bp->page);
-
-       bp->flags &= ~MPOOL_DIRTY;
-       return (RET_SUCCESS);
-}
-
-/*
- * mpool_look
- *     Lookup a page in the cache.
- */
-static BKT *
-mpool_look(MPOOL *mp, pgno_t pgno)
-{
-       struct _hqh *head;
-       BKT *bp;
-
-       head = &mp->hqh[HASHKEY(pgno)];
-       for (bp = head->cqh_first; bp != (void *)head; bp = bp->hq.cqe_next)
-               if (bp->pgno == pgno) {
-#ifdef STATISTICS
-                       ++mp->cachehit;
-#endif
-                       return (bp);
-               }
-#ifdef STATISTICS
-       ++mp->cachemiss;
-#endif
-       return (NULL);
-}
-
-#ifdef STATISTICS
-/*
- * mpool_stat
- *     Print out cache statistics.
- */
-void
-mpool_stat(mp)
-       MPOOL *mp;
-{
-       BKT *bp;
-       int cnt;
-       const char *sep;
-
-       (void)fprintf(stderr, "%lu pages in the file\n", (u_long)mp->npages);
-       (void)fprintf(stderr,
-           "page size %lu, cacheing %lu pages of %lu page max cache\n",
-           (u_long)mp->pagesize, (u_long)mp->curcache, (u_long)mp->maxcache);
-       (void)fprintf(stderr, "%lu page puts, %lu page gets, %lu page new\n",
-           mp->pageput, mp->pageget, mp->pagenew);
-       (void)fprintf(stderr, "%lu page allocs, %lu page flushes\n",
-           mp->pagealloc, mp->pageflush);
-       if (mp->cachehit + mp->cachemiss)
-               (void)fprintf(stderr,
-                   "%.0f%% cache hit rate (%lu hits, %lu misses)\n", 
-                   ((double)mp->cachehit / (mp->cachehit + mp->cachemiss))
-                   * 100, mp->cachehit, mp->cachemiss);
-       (void)fprintf(stderr, "%lu page reads, %lu page writes\n",
-           mp->pageread, mp->pagewrite);
-
-       sep = "";
-       cnt = 0;
-       for (bp = mp->lqh.cqh_first;
-           bp != (void *)&mp->lqh; bp = bp->q.cqe_next) {
-               (void)fprintf(stderr, "%s%d", sep, bp->pgno);
-               if (bp->flags & MPOOL_DIRTY)
-                       (void)fprintf(stderr, "d");
-               if (bp->flags & MPOOL_PINNED)
-                       (void)fprintf(stderr, "P");
-               if (++cnt == 10) {
-                       sep = "\n";
-                       cnt = 0;
-               } else
-                       sep = ", ";
-                       
-       }
-       (void)fprintf(stderr, "\n");
-}
-#endif
diff --git a/lib/nbsd_libc/db/recno/Makefile.inc b/lib/nbsd_libc/db/recno/Makefile.inc
deleted file mode 100644 (file)
index e7f78f4..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#      $NetBSD: Makefile.inc,v 1.5 1996/05/03 21:38:43 cgd Exp $
-#       @(#)Makefile.inc       8.1 (Berkeley) 6/4/93
-
-.PATH: ${.CURDIR}/db/recno
-
-SRCS+= rec_close.c rec_delete.c rec_get.c rec_open.c rec_put.c rec_search.c \
-       rec_seq.c rec_utils.c
diff --git a/lib/nbsd_libc/db/recno/extern.h b/lib/nbsd_libc/db/recno/extern.h
deleted file mode 100644 (file)
index f73c83d..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*     $NetBSD: extern.h,v 1.8 2008/08/26 21:18:38 joerg Exp $ */
-
-/*-
- * Copyright (c) 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. 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.
- *
- *     @(#)extern.h    8.3 (Berkeley) 6/4/94
- */
-
-#include "../btree/extern.h"
-
-int     __rec_close(DB *);
-int     __rec_delete(const DB *, const DBT *, u_int);
-int     __rec_dleaf(BTREE *, PAGE *, uint32_t);
-int     __rec_fd(const DB *);
-int     __rec_fmap(BTREE *, recno_t);
-int     __rec_fout(BTREE *);
-int     __rec_fpipe(BTREE *, recno_t);
-int     __rec_get(const DB *, const DBT *, DBT *, u_int);
-int     __rec_iput(BTREE *, recno_t, const DBT *, u_int);
-int     __rec_put(const DB *dbp, DBT *, const DBT *, u_int);
-int     __rec_ret(BTREE *, EPG *, recno_t, DBT *, DBT *);
-EPG    *__rec_search(BTREE *, recno_t, enum SRCHOP);
-int     __rec_seq(const DB *, DBT *, DBT *, u_int);
-int     __rec_sync(const DB *, u_int);
-int     __rec_vmap(BTREE *, recno_t);
-int     __rec_vout(BTREE *);
-int     __rec_vpipe(BTREE *, recno_t);
diff --git a/lib/nbsd_libc/db/recno/rec_close.c b/lib/nbsd_libc/db/recno/rec_close.c
deleted file mode 100644 (file)
index 7fb5632..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/*     $NetBSD: rec_close.c,v 1.15 2008/09/11 12:58:00 joerg Exp $     */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_close.c,v 1.15 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/mman.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include <db.h>
-#include "recno.h"
-
-/*
- * __REC_CLOSE -- Close a recno tree.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__rec_close(DB *dbp)
-{
-       BTREE *t;
-       int status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       if (__rec_sync(dbp, 0) == RET_ERROR)
-               return (RET_ERROR);
-
-       /* Committed to closing. */
-       status = RET_SUCCESS;
-#ifndef __minix
-       if (F_ISSET(t, R_MEMMAPPED) && munmap(t->bt_smap, t->bt_msize))
-               status = RET_ERROR;
-#else
-       assert(!F_ISSET(t, R_MEMMAPPED));
-#endif
-
-       if (!F_ISSET(t, R_INMEM)) {
-               if (F_ISSET(t, R_CLOSEFP)) {
-                       if (fclose(t->bt_rfp))
-                               status = RET_ERROR;
-               } else {
-                       if (close(t->bt_rfd))
-                               status = RET_ERROR;
-               }
-       }
-
-       if (__bt_close(dbp) == RET_ERROR)
-               status = RET_ERROR;
-
-       return (status);
-}
-
-/*
- * __REC_SYNC -- sync the recno tree to disk.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *
- * Returns:
- *     RET_SUCCESS, RET_ERROR.
- */
-int
-__rec_sync(const DB *dbp, u_int flags)
-{
-       struct iovec iov[2];
-       BTREE *t;
-       DBT data, key;
-       off_t off;
-       recno_t scursor, trec;
-       int status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       if (flags == R_RECNOSYNC)
-               return (__bt_sync(dbp, 0));
-
-       if (F_ISSET(t, R_RDONLY | R_INMEM) || !F_ISSET(t, R_MODIFIED))
-               return (RET_SUCCESS);
-
-       /* Read any remaining records into the tree. */
-       if (!F_ISSET(t, R_EOF) && t->bt_irec(t, MAX_REC_NUMBER) == RET_ERROR)
-               return (RET_ERROR);
-
-       /* Rewind the file descriptor. */
-       if (lseek(t->bt_rfd, (off_t)0, SEEK_SET) != 0)
-               return (RET_ERROR);
-
-       /* Save the cursor. */
-       scursor = t->bt_cursor.rcursor;
-
-       key.size = sizeof(recno_t);
-       key.data = &trec;
-
-       if (F_ISSET(t, R_FIXLEN)) {
-               /*
-                * We assume that fixed length records are all fixed length.
-                * Any that aren't are either EINVAL'd or corrected by the
-                * record put code.
-                */
-               status = (dbp->seq)(dbp, &key, &data, R_FIRST);
-               while (status == RET_SUCCESS) {
-                       if (write(t->bt_rfd, data.data, data.size) !=
-                           (ssize_t) data.size)
-                               return (RET_ERROR);
-                       status = (dbp->seq)(dbp, &key, &data, R_NEXT);
-               }
-       } else {
-               iov[1].iov_base = &t->bt_bval;
-               iov[1].iov_len = 1;
-
-               status = (dbp->seq)(dbp, &key, &data, R_FIRST);
-               while (status == RET_SUCCESS) {
-                       iov[0].iov_base = data.data;
-                       iov[0].iov_len = data.size;
-                       if (writev(t->bt_rfd, iov, 2) !=
-                           (ssize_t) (data.size + 1))
-                               return (RET_ERROR);
-                       status = (dbp->seq)(dbp, &key, &data, R_NEXT);
-               }
-       }
-
-       /* Restore the cursor. */
-       t->bt_cursor.rcursor = scursor;
-
-       if (status == RET_ERROR)
-               return (RET_ERROR);
-       if ((off = lseek(t->bt_rfd, (off_t)0, SEEK_CUR)) == -1)
-               return (RET_ERROR);
-       if (ftruncate(t->bt_rfd, off))
-               return (RET_ERROR);
-       F_CLR(t, R_MODIFIED);
-       return (RET_SUCCESS);
-}
diff --git a/lib/nbsd_libc/db/recno/rec_delete.c b/lib/nbsd_libc/db/recno/rec_delete.c
deleted file mode 100644 (file)
index a9dea57..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*     $NetBSD: rec_delete.c,v 1.17 2008/09/11 12:58:00 joerg Exp $    */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_delete.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <db.h>
-#include "recno.h"
-
-static int rec_rdelete(BTREE *, recno_t);
-
-/*
- * __REC_DELETE -- Delete the item(s) referenced by a key.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *     key:    key to delete
- *     flags:  R_CURSOR if deleting what the cursor references
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
- */
-int
-__rec_delete(const DB *dbp, const DBT *key, u_int flags)
-{
-       BTREE *t;
-       recno_t nrec;
-       int status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       switch(flags) {
-       case 0:
-               if ((nrec = *(recno_t *)key->data) == 0)
-                       goto einval;
-               if (nrec > t->bt_nrecs)
-                       return (RET_SPECIAL);
-               --nrec;
-               status = rec_rdelete(t, nrec);
-               break;
-       case R_CURSOR:
-               if (!F_ISSET(&t->bt_cursor, CURS_INIT))
-                       goto einval;
-               if (t->bt_nrecs == 0)
-                       return (RET_SPECIAL);
-               status = rec_rdelete(t, t->bt_cursor.rcursor - 1);
-               if (status == RET_SUCCESS)
-                       --t->bt_cursor.rcursor;
-               break;
-       default:
-einval:                errno = EINVAL;
-               return (RET_ERROR);
-       }
-
-       if (status == RET_SUCCESS)
-               F_SET(t, B_MODIFIED | R_MODIFIED);
-       return (status);
-}
-
-/*
- * REC_RDELETE -- Delete the data matching the specified key.
- *
- * Parameters:
- *     tree:   tree
- *     nrec:   record to delete
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
- */
-static int
-rec_rdelete(BTREE *t, recno_t nrec)
-{
-       EPG *e;
-       PAGE *h;
-       int status;
-
-       /* Find the record; __rec_search pins the page. */
-       if ((e = __rec_search(t, nrec, SDELETE)) == NULL)
-               return (RET_ERROR);
-
-       /* Delete the record. */
-       h = e->page;
-       status = __rec_dleaf(t, h, (uint32_t)e->index);
-       if (status != RET_SUCCESS) {
-               mpool_put(t->bt_mp, h, 0);
-               return (status);
-       }
-       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-       return (RET_SUCCESS);
-}
-
-/*
- * __REC_DLEAF -- Delete a single record from a recno leaf page.
- *
- * Parameters:
- *     t:      tree
- *     index:  index on current page to delete
- *
- * Returns:
- *     RET_SUCCESS, RET_ERROR.
- */
-int
-__rec_dleaf(BTREE *t, PAGE *h, uint32_t idx)
-{
-       RLEAF *rl;
-       indx_t *ip, cnt, offset;
-       uint32_t nbytes;
-       char *from;
-       void *to;
-       size_t temp;
-
-       /*
-        * Delete a record from a recno leaf page.  Internal records are never
-        * deleted from internal pages, regardless of the records that caused
-        * them to be added being deleted.  Pages made empty by deletion are
-        * not reclaimed.  They are, however, made available for reuse.
-        *
-        * Pack the remaining entries at the end of the page, shift the indices
-        * down, overwriting the deleted record and its index.  If the record
-        * uses overflow pages, make them available for reuse.
-        */
-       to = rl = GETRLEAF(h, idx);
-       if (rl->flags & P_BIGDATA && __ovfl_delete(t, rl->bytes) == RET_ERROR)
-               return (RET_ERROR);
-       nbytes = NRLEAF(rl);
-
-       /*
-        * Compress the key/data pairs.  Compress and adjust the [BR]LEAF
-        * offsets.  Reset the headers.
-        */
-       from = (char *)(void *)h + h->upper;
-       memmove(from + nbytes, from, (size_t)((char *)to - from));
-       h->upper += nbytes;
-
-       offset = h->linp[idx];
-       temp = &h->linp[idx] - (ip = &h->linp[0]);
-       _DBFIT(temp, uint16_t);
-       for (cnt = (uint16_t)temp;  cnt--; ++ip)
-               if (ip[0] < offset)
-                       ip[0] += nbytes;
-       temp = &h->linp[NEXTINDEX(h)] - ip;
-       _DBFIT(temp, uint16_t);
-       for (cnt = (uint16_t)temp;  --cnt; ++ip)
-               ip[0] = ip[1] < offset ? ip[1] + nbytes : ip[1];
-       h->lower -= sizeof(indx_t);
-       --t->bt_nrecs;
-       return (RET_SUCCESS);
-}
diff --git a/lib/nbsd_libc/db/recno/rec_get.c b/lib/nbsd_libc/db/recno/rec_get.c
deleted file mode 100644 (file)
index 1dc80f9..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-/*     $NetBSD: rec_get.c,v 1.16 2008/09/11 12:58:00 joerg Exp $       */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_get.c,v 1.16 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <db.h>
-#include "recno.h"
-
-/*
- * __REC_GET -- Get a record from the btree.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *     key:    key to find
- *     data:   data to return
- *     flag:   currently unused
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key not found.
- */
-int
-__rec_get(const DB *dbp, const DBT *key, DBT *data, u_int flags)
-{
-       BTREE *t;
-       EPG *e;
-       recno_t nrec;
-       int status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /* Get currently doesn't take any flags, and keys of 0 are illegal. */
-       if (flags || (nrec = *(recno_t *)key->data) == 0) {
-               errno = EINVAL;
-               return (RET_ERROR);
-       }
-
-       /*
-        * If we haven't seen this record yet, try to find it in the
-        * original file.
-        */
-       if (nrec > t->bt_nrecs) {
-               if (F_ISSET(t, R_EOF | R_INMEM))
-                       return (RET_SPECIAL);
-               if ((status = t->bt_irec(t, nrec)) != RET_SUCCESS)
-                       return (status);
-       }
-
-       --nrec;
-       if ((e = __rec_search(t, nrec, SEARCH)) == NULL)
-               return (RET_ERROR);
-
-       status = __rec_ret(t, e, 0, NULL, data);
-       if (F_ISSET(t, B_DB_LOCK))
-               mpool_put(t->bt_mp, e->page, 0);
-       else
-               t->bt_pinned = e->page;
-       return (status);
-}
-
-/*
- * __REC_FPIPE -- Get fixed length records from a pipe.
- *
- * Parameters:
- *     t:      tree
- *     cnt:    records to read
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__rec_fpipe(BTREE *t, recno_t top)
-{
-       DBT data;
-       recno_t nrec;
-       size_t len;
-       int ch;
-       uint8_t *p;
-
-       if (t->bt_rdata.size < t->bt_reclen) {
-               t->bt_rdata.data = t->bt_rdata.data == NULL ?
-                   malloc(t->bt_reclen) :
-                   realloc(t->bt_rdata.data, t->bt_reclen);
-               if (t->bt_rdata.data == NULL)
-                       return (RET_ERROR);
-               t->bt_rdata.size = t->bt_reclen;
-       }
-       data.data = t->bt_rdata.data;
-       data.size = t->bt_reclen;
-
-       for (nrec = t->bt_nrecs; nrec < top;) {
-               len = t->bt_reclen;
-               for (p = t->bt_rdata.data;; *p++ = ch)
-                       if ((ch = getc(t->bt_rfp)) == EOF || !--len) {
-                               if (ch != EOF)
-                                       *p = ch;
-                               if (len != 0)
-                                       memset(p, t->bt_bval, len);
-                               if (__rec_iput(t,
-                                   nrec, &data, 0) != RET_SUCCESS)
-                                       return (RET_ERROR);
-                               ++nrec;
-                               break;
-                       }
-               if (ch == EOF)
-                       break;
-       }
-       if (nrec < top) {
-               F_SET(t, R_EOF);
-               return (RET_SPECIAL);
-       }
-       return (RET_SUCCESS);
-}
-
-/*
- * __REC_VPIPE -- Get variable length records from a pipe.
- *
- * Parameters:
- *     t:      tree
- *     cnt:    records to read
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__rec_vpipe(BTREE *t, recno_t top)
-{
-       DBT data;
-       recno_t nrec;
-       ptrdiff_t len;
-       size_t sz;
-       int bval, ch;
-       uint8_t *p;
-
-       bval = t->bt_bval;
-       for (nrec = t->bt_nrecs; nrec < top; ++nrec) {
-               for (p = t->bt_rdata.data,
-                   sz = t->bt_rdata.size;; *p++ = ch, --sz) {
-                       if ((ch = getc(t->bt_rfp)) == EOF || ch == bval) {
-                               data.data = t->bt_rdata.data;
-                               data.size = p - (uint8_t *)t->bt_rdata.data;
-                               if (ch == EOF && data.size == 0)
-                                       break;
-                               if (__rec_iput(t, nrec, &data, 0)
-                                   != RET_SUCCESS)
-                                       return (RET_ERROR);
-                               break;
-                       }
-                       if (sz == 0) {
-                               len = p - (uint8_t *)t->bt_rdata.data;
-                               t->bt_rdata.size += (sz = 256);
-                               t->bt_rdata.data = t->bt_rdata.data == NULL ?
-                                   malloc(t->bt_rdata.size) :
-                                   realloc(t->bt_rdata.data, t->bt_rdata.size);
-                               if (t->bt_rdata.data == NULL)
-                                       return (RET_ERROR);
-                               p = (uint8_t *)t->bt_rdata.data + len;
-                       }
-               }
-               if (ch == EOF)
-                       break;
-       }
-       if (nrec < top) {
-               F_SET(t, R_EOF);
-               return (RET_SPECIAL);
-       }
-       return (RET_SUCCESS);
-}
-
-/*
- * __REC_FMAP -- Get fixed length records from a file.
- *
- * Parameters:
- *     t:      tree
- *     cnt:    records to read
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__rec_fmap(BTREE *t, recno_t top)
-{
-       DBT data;
-       recno_t nrec;
-       uint8_t *sp, *ep, *p;
-       size_t len;
-
-       if (t->bt_rdata.size < t->bt_reclen) {
-               t->bt_rdata.data = t->bt_rdata.data == NULL ?
-                   malloc(t->bt_reclen) :
-                   realloc(t->bt_rdata.data, t->bt_reclen);
-               if (t->bt_rdata.data == NULL)
-                       return (RET_ERROR);
-               t->bt_rdata.size = t->bt_reclen;
-       }
-       data.data = t->bt_rdata.data;
-       data.size = t->bt_reclen;
-
-       sp = (uint8_t *)t->bt_cmap;
-       ep = (uint8_t *)t->bt_emap;
-       for (nrec = t->bt_nrecs; nrec < top; ++nrec) {
-               if (sp >= ep) {
-                       F_SET(t, R_EOF);
-                       return (RET_SPECIAL);
-               }
-               len = t->bt_reclen;
-               for (p = t->bt_rdata.data;
-                   sp < ep && len > 0; *p++ = *sp++, --len);
-               if (len != 0)
-                       memset(p, t->bt_bval, len);
-               if (__rec_iput(t, nrec, &data, 0) != RET_SUCCESS)
-                       return (RET_ERROR);
-       }
-       t->bt_cmap = (caddr_t)sp;
-       return (RET_SUCCESS);
-}
-
-/*
- * __REC_VMAP -- Get variable length records from a file.
- *
- * Parameters:
- *     t:      tree
- *     cnt:    records to read
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__rec_vmap(BTREE *t, recno_t top)
-{
-       DBT data;
-       uint8_t *sp, *ep;
-       recno_t nrec;
-       int bval;
-
-       sp = (uint8_t *)t->bt_cmap;
-       ep = (uint8_t *)t->bt_emap;
-       bval = t->bt_bval;
-
-       for (nrec = t->bt_nrecs; nrec < top; ++nrec) {
-               if (sp >= ep) {
-                       F_SET(t, R_EOF);
-                       return (RET_SPECIAL);
-               }
-               for (data.data = sp; sp < ep && *sp != bval; ++sp);
-               data.size = sp - (uint8_t *)data.data;
-               if (__rec_iput(t, nrec, &data, 0) != RET_SUCCESS)
-                       return (RET_ERROR);
-               ++sp;
-       }
-       t->bt_cmap = (caddr_t)sp;
-       return (RET_SUCCESS);
-}
diff --git a/lib/nbsd_libc/db/recno/rec_open.c b/lib/nbsd_libc/db/recno/rec_open.c
deleted file mode 100644 (file)
index ff1852e..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-/*     $NetBSD: rec_open.c,v 1.17 2008/09/11 12:58:00 joerg Exp $      */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Mike Olson.
- *
- * 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_open.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#include <db.h>
-#include "recno.h"
-
-DB *
-__rec_open(const char *fname, int flags, mode_t mode, const RECNOINFO *openinfo,
-    int dflags)
-{
-       BTREE *t;
-       BTREEINFO btopeninfo;
-       DB *dbp;
-       PAGE *h;
-       struct stat sb;
-       int rfd = -1;   /* pacify gcc */
-       int sverrno;
-
-       dbp = NULL;
-       /* Open the user's file -- if this fails, we're done. */
-       if (fname != NULL) {
-               if ((rfd = open(fname, flags, mode)) == -1)
-                       return (NULL);
-               if (fcntl(rfd, F_SETFD, FD_CLOEXEC) == -1)
-                       goto err;
-       }
-
-       /* Create a btree in memory (backed by disk). */
-       if (openinfo) {
-               if (openinfo->flags & ~(R_FIXEDLEN | R_NOKEY | R_SNAPSHOT))
-                       goto einval;
-               btopeninfo.flags = 0;
-               btopeninfo.cachesize = openinfo->cachesize;
-               btopeninfo.maxkeypage = 0;
-               btopeninfo.minkeypage = 0;
-               btopeninfo.psize = openinfo->psize;
-               btopeninfo.compare = NULL;
-               btopeninfo.prefix = NULL;
-               btopeninfo.lorder = openinfo->lorder;
-               dbp = __bt_open(openinfo->bfname,
-                   O_RDWR, S_IRUSR | S_IWUSR, &btopeninfo, dflags);
-       } else
-               dbp = __bt_open(NULL, O_RDWR, S_IRUSR | S_IWUSR, NULL, dflags);
-       if (dbp == NULL)
-               goto err;
-
-       /*
-        * Some fields in the tree structure are recno specific.  Fill them
-        * in and make the btree structure look like a recno structure.  We
-        * don't change the bt_ovflsize value, it's close enough and slightly
-        * bigger.
-        */
-       t = dbp->internal;
-       if (openinfo) {
-               if (openinfo->flags & R_FIXEDLEN) {
-                       F_SET(t, R_FIXLEN);
-                       t->bt_reclen = openinfo->reclen;
-                       if (t->bt_reclen == 0)
-                               goto einval;
-               }
-               t->bt_bval = openinfo->bval;
-       } else
-               t->bt_bval = '\n';
-
-       F_SET(t, R_RECNO);
-       if (fname == NULL)
-               F_SET(t, R_EOF | R_INMEM);
-       else
-               t->bt_rfd = rfd;
-
-       if (fname != NULL) {
-               /*
-                * In 4.4BSD, stat(2) returns true for ISSOCK on pipes.
-                * Unfortunately, that's not portable, so we use lseek
-                * and check the errno values.
-                */
-               errno = 0;
-               if (lseek(rfd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) {
-                       switch (flags & O_ACCMODE) {
-                       case O_RDONLY:
-                               F_SET(t, R_RDONLY);
-                               break;
-                       default:
-                               goto einval;
-                       }
-slow:                  if ((t->bt_rfp = fdopen(rfd, "r")) == NULL)
-                               goto err;
-                       F_SET(t, R_CLOSEFP);
-                       t->bt_irec =
-                           F_ISSET(t, R_FIXLEN) ? __rec_fpipe : __rec_vpipe;
-               } else {
-                       switch (flags & O_ACCMODE) {
-                       case O_RDONLY:
-                               F_SET(t, R_RDONLY);
-                               break;
-                       case O_RDWR:
-                               break;
-                       default:
-                               goto einval;
-                       }
-
-                       if (fstat(rfd, &sb))
-                               goto err;
-                       /*
-                        * Kluge -- we'd like to test to see if the file is too
-                        * big to mmap.  Since, we don't know what size or type
-                        * off_t's or size_t's are, what the largest unsigned
-                        * integral type is, or what random insanity the local
-                        * C compiler will perpetrate, doing the comparison in
-                        * a portable way is flatly impossible.  Hope that mmap
-                        * fails if the file is too large.
-                        */
-                       if (sb.st_size == 0)
-                               F_SET(t, R_EOF);
-                       else {
-#ifdef MMAP_NOT_AVAILABLE
-                               /*
-                                * XXX
-                                * Mmap doesn't work correctly on many current
-                                * systems.  In particular, it can fail subtly,
-                                * with cache coherency problems.  Don't use it
-                                * for now.
-                                */
-                               t->bt_msize = sb.st_size;
-                               if ((t->bt_smap = mmap(NULL, t->bt_msize,
-                                   PROT_READ, MAP_FILE | MAP_PRIVATE, rfd,
-                                   (off_t)0)) == (caddr_t)-1)
-                                       goto slow;
-                               t->bt_cmap = t->bt_smap;
-                               t->bt_emap = t->bt_smap + sb.st_size;
-                               t->bt_irec = F_ISSET(t, R_FIXLEN) ?
-                                   __rec_fmap : __rec_vmap;
-                               F_SET(t, R_MEMMAPPED);
-#else
-                               goto slow;
-#endif
-                       }
-               }
-       }
-
-       /* Use the recno routines. */
-       dbp->close = __rec_close;
-       dbp->del = __rec_delete;
-       dbp->fd = __rec_fd;
-       dbp->get = __rec_get;
-       dbp->put = __rec_put;
-       dbp->seq = __rec_seq;
-       dbp->sync = __rec_sync;
-
-       /* If the root page was created, reset the flags. */
-       if ((h = mpool_get(t->bt_mp, P_ROOT, 0)) == NULL)
-               goto err;
-       if ((h->flags & P_TYPE) == P_BLEAF) {
-               F_CLR(h, P_TYPE);
-               F_SET(h, P_RLEAF);
-               mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-       } else
-               mpool_put(t->bt_mp, h, 0);
-
-       if (openinfo && openinfo->flags & R_SNAPSHOT &&
-           !F_ISSET(t, R_EOF | R_INMEM) &&
-           t->bt_irec(t, MAX_REC_NUMBER) == RET_ERROR)
-                goto err;
-       return (dbp);
-
-einval:        errno = EINVAL;
-err:   sverrno = errno;
-       if (dbp != NULL)
-               (void)__bt_close(dbp);
-       if (fname != NULL)
-               (void)close(rfd);
-       errno = sverrno;
-       return (NULL);
-}
-
-int
-__rec_fd(const DB *dbp)
-{
-       BTREE *t;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /* In-memory database can't have a file descriptor. */
-       if (F_ISSET(t, R_INMEM)) {
-               errno = ENOENT;
-               return (-1);
-       }
-       return (t->bt_rfd);
-}
diff --git a/lib/nbsd_libc/db/recno/rec_put.c b/lib/nbsd_libc/db/recno/rec_put.c
deleted file mode 100644 (file)
index 7c1181c..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-/*     $NetBSD: rec_put.c,v 1.17 2008/09/11 12:58:00 joerg Exp $       */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_put.c,v 1.17 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <db.h>
-#include "recno.h"
-
-/*
- * __REC_PUT -- Add a recno item to the tree.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *     key:    key
- *     data:   data
- *     flag:   R_CURSOR, R_IAFTER, R_IBEFORE, R_NOOVERWRITE
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS and RET_SPECIAL if the key is
- *     already in the tree and R_NOOVERWRITE specified.
- */
-int
-__rec_put(const DB *dbp, DBT *key, const DBT *data, u_int flags)
-{
-       BTREE *t;
-       DBT fdata, tdata;
-       recno_t nrec;
-       int status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       /*
-        * If using fixed-length records, and the record is long, return
-        * EINVAL.  If it's short, pad it out.  Use the record data return
-        * memory, it's only short-term.
-        */
-       if (F_ISSET(t, R_FIXLEN) && data->size != t->bt_reclen) {
-               if (data->size > t->bt_reclen)
-                       goto einval;
-
-               if (t->bt_rdata.size < t->bt_reclen) {
-                       t->bt_rdata.data = t->bt_rdata.data == NULL ?
-                           malloc(t->bt_reclen) :
-                           realloc(t->bt_rdata.data, t->bt_reclen);
-                       if (t->bt_rdata.data == NULL)
-                               return (RET_ERROR);
-                       t->bt_rdata.size = t->bt_reclen;
-               }
-               memmove(t->bt_rdata.data, data->data, data->size);
-               memset((char *)t->bt_rdata.data + data->size,
-                   t->bt_bval, t->bt_reclen - data->size);
-               fdata.data = t->bt_rdata.data;
-               fdata.size = t->bt_reclen;
-       } else {
-               fdata.data = data->data;
-               fdata.size = data->size;
-       }
-
-       switch (flags) {
-       case R_CURSOR:
-               if (!F_ISSET(&t->bt_cursor, CURS_INIT))
-                       goto einval;
-               nrec = t->bt_cursor.rcursor;
-               break;
-       case R_SETCURSOR:
-               if ((nrec = *(recno_t *)key->data) == 0)
-                       goto einval;
-               break;
-       case R_IAFTER:
-               if ((nrec = *(recno_t *)key->data) == 0) {
-                       nrec = 1;
-                       flags = R_IBEFORE;
-               }
-               break;
-       case 0:
-       case R_IBEFORE:
-               if ((nrec = *(recno_t *)key->data) == 0)
-                       goto einval;
-               break;
-       case R_NOOVERWRITE:
-               if ((nrec = *(recno_t *)key->data) == 0)
-                       goto einval;
-               if (nrec <= t->bt_nrecs)
-                       return (RET_SPECIAL);
-               break;
-       default:
-einval:                errno = EINVAL;
-               return (RET_ERROR);
-       }
-
-       /*
-        * Make sure that records up to and including the put record are
-        * already in the database.  If skipping records, create empty ones.
-        */
-       if (nrec > t->bt_nrecs) {
-               if (!F_ISSET(t, R_EOF | R_INMEM) &&
-                   t->bt_irec(t, nrec) == RET_ERROR)
-                       return (RET_ERROR);
-               if (nrec > t->bt_nrecs + 1) {
-                       if (F_ISSET(t, R_FIXLEN)) {
-                               if ((tdata.data =
-                                   (void *)malloc(t->bt_reclen)) == NULL)
-                                       return (RET_ERROR);
-                               tdata.size = t->bt_reclen;
-                               memset(tdata.data, t->bt_bval, tdata.size);
-                       } else {
-                               tdata.data = NULL;
-                               tdata.size = 0;
-                       }
-                       while (nrec > t->bt_nrecs + 1)
-                               if (__rec_iput(t,
-                                   t->bt_nrecs, &tdata, 0) != RET_SUCCESS)
-                                       return (RET_ERROR);
-                       if (F_ISSET(t, R_FIXLEN))
-                               free(tdata.data);
-               }
-       }
-
-       if ((status = __rec_iput(t, nrec - 1, &fdata, flags)) != RET_SUCCESS)
-               return (status);
-
-       if (flags == R_SETCURSOR)
-               t->bt_cursor.rcursor = nrec;
-       
-       F_SET(t, R_MODIFIED);
-       return (__rec_ret(t, NULL, nrec, key, NULL));
-}
-
-/*
- * __REC_IPUT -- Add a recno item to the tree.
- *
- * Parameters:
- *     t:      tree
- *     nrec:   record number
- *     data:   data
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS
- */
-int
-__rec_iput(BTREE *t, recno_t nrec, const DBT *data, u_int flags)
-{
-       DBT tdata;
-       EPG *e;
-       PAGE *h;
-       indx_t idx, nxtindex;
-       pgno_t pg;
-       uint32_t nbytes;
-       int dflags, status;
-       char *dest, db[NOVFLSIZE];
-
-       /*
-        * If the data won't fit on a page, store it on indirect pages.
-        *
-        * XXX
-        * If the insert fails later on, these pages aren't recovered.
-        */
-       if (data->size > t->bt_ovflsize) {
-               if (__ovfl_put(t, data, &pg) == RET_ERROR)
-                       return (RET_ERROR);
-               tdata.data = db;
-               tdata.size = NOVFLSIZE;
-               *(pgno_t *)(void *)db = pg;
-               _DBFIT(data->size, uint32_t);
-               *(uint32_t *)(void *)(db + sizeof(pgno_t)) =
-                   (uint32_t)data->size;
-               dflags = P_BIGDATA;
-               data = &tdata;
-       } else
-               dflags = 0;
-
-       /* __rec_search pins the returned page. */
-       if ((e = __rec_search(t, nrec,
-           nrec > t->bt_nrecs || flags == R_IAFTER || flags == R_IBEFORE ?
-           SINSERT : SEARCH)) == NULL)
-               return (RET_ERROR);
-
-       h = e->page;
-       idx = e->index;
-
-       /*
-        * Add the specified key/data pair to the tree.  The R_IAFTER and
-        * R_IBEFORE flags insert the key after/before the specified key.
-        *
-        * Pages are split as required.
-        */
-       switch (flags) {
-       case R_IAFTER:
-               ++idx;
-               break;
-       case R_IBEFORE:
-               break;
-       default:
-               if (nrec < t->bt_nrecs &&
-                   __rec_dleaf(t, h, (uint32_t)idx) == RET_ERROR) {
-                       mpool_put(t->bt_mp, h, 0);
-                       return (RET_ERROR);
-               }
-               break;
-       }
-
-       /*
-        * If not enough room, split the page.  The split code will insert
-        * the key and data and unpin the current page.  If inserting into
-        * the offset array, shift the pointers up.
-        */
-       nbytes = NRLEAFDBT(data->size);
-       if ((uint32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t)) {
-               status = __bt_split(t, h, NULL, data, dflags, nbytes,
-                   (uint32_t)idx);
-               if (status == RET_SUCCESS)
-                       ++t->bt_nrecs;
-               return (status);
-       }
-
-       if (idx < (nxtindex = NEXTINDEX(h)))
-               memmove(h->linp + idx + 1, h->linp + idx,
-                   (nxtindex - idx) * sizeof(indx_t));
-       h->lower += sizeof(indx_t);
-
-       h->linp[idx] = h->upper -= nbytes;
-       dest = (char *)(void *)h + h->upper;
-       WR_RLEAF(dest, data, dflags);
-
-       ++t->bt_nrecs;
-       F_SET(t, B_MODIFIED);
-       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-
-       return (RET_SUCCESS);
-}
diff --git a/lib/nbsd_libc/db/recno/rec_search.c b/lib/nbsd_libc/db/recno/rec_search.c
deleted file mode 100644 (file)
index 1238c8d..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*     $NetBSD: rec_search.c,v 1.14 2008/09/11 12:58:00 joerg Exp $    */
-
-/*-
- * Copyright (c) 1990, 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_search.c,v 1.14 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include <db.h>
-#include "recno.h"
-
-/*
- * __REC_SEARCH -- Search a btree for a key.
- *
- * Parameters:
- *     t:      tree to search
- *     recno:  key to find
- *     op:     search operation
- *
- * Returns:
- *     EPG for matching record, if any, or the EPG for the location of the
- *     key, if it were inserted into the tree.
- *
- * Returns:
- *     The EPG for matching record, if any, or the EPG for the location
- *     of the key, if it were inserted into the tree, is entered into
- *     the bt_cur field of the tree.  A pointer to the field is returned.
- */
-EPG *
-__rec_search(BTREE *t, recno_t recno, enum SRCHOP op)
-{
-       indx_t idx;
-       PAGE *h;
-       EPGNO *parent;
-       RINTERNAL *r;
-       pgno_t pg;
-       indx_t top;
-       recno_t total;
-       int sverrno;
-
-       BT_CLR(t);
-       for (pg = P_ROOT, total = 0;;) {
-               if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
-                       goto err;
-               if (h->flags & P_RLEAF) {
-                       t->bt_cur.page = h;
-                       t->bt_cur.index = recno - total;
-                       return (&t->bt_cur);
-               }
-               for (idx = 0, top = NEXTINDEX(h);;) {
-                       r = GETRINTERNAL(h, idx);
-                       if (++idx == top || total + r->nrecs > recno)
-                               break;
-                       total += r->nrecs;
-               }
-
-               BT_PUSH(t, pg, idx - 1);
-               
-               pg = r->pgno;
-               switch (op) {
-               case SDELETE:
-                       --GETRINTERNAL(h, (idx - 1))->nrecs;
-                       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-                       break;
-               case SINSERT:
-                       ++GETRINTERNAL(h, (idx - 1))->nrecs;
-                       mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-                       break;
-               case SEARCH:
-                       mpool_put(t->bt_mp, h, 0);
-                       break;
-               }
-
-       }
-       /* Try and recover the tree. */
-err:   sverrno = errno;
-       if (op != SEARCH)
-               while  ((parent = BT_POP(t)) != NULL) {
-                       if ((h = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
-                               break;
-                       if (op == SINSERT)
-                               --GETRINTERNAL(h, parent->index)->nrecs;
-                       else
-                               ++GETRINTERNAL(h, parent->index)->nrecs;
-                        mpool_put(t->bt_mp, h, MPOOL_DIRTY);
-                }
-       errno = sverrno;
-       return (NULL);
-}
diff --git a/lib/nbsd_libc/db/recno/rec_seq.c b/lib/nbsd_libc/db/recno/rec_seq.c
deleted file mode 100644 (file)
index 3b1da48..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/*     $NetBSD: rec_seq.c,v 1.14 2008/09/11 12:58:00 joerg Exp $       */
-
-/*-
- * Copyright (c) 1991, 1993, 1994
- *     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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_seq.c,v 1.14 2008/09/11 12:58:00 joerg Exp $");
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <db.h>
-#include "recno.h"
-
-/*
- * __REC_SEQ -- Recno sequential scan interface.
- *
- * Parameters:
- *     dbp:    pointer to access method
- *     key:    key for positioning and return value
- *     data:   data return value
- *     flags:  R_CURSOR, R_FIRST, R_LAST, R_NEXT, R_PREV.
- *
- * Returns:
- *     RET_ERROR, RET_SUCCESS or RET_SPECIAL if there's no next key.
- */
-int
-__rec_seq(const DB *dbp, DBT *key, DBT *data, u_int flags)
-{
-       BTREE *t;
-       EPG *e;
-       recno_t nrec;
-       int status;
-
-       t = dbp->internal;
-
-       /* Toss any page pinned across calls. */
-       if (t->bt_pinned != NULL) {
-               mpool_put(t->bt_mp, t->bt_pinned, 0);
-               t->bt_pinned = NULL;
-       }
-
-       switch(flags) {
-       case R_CURSOR:
-               if ((nrec = *(recno_t *)key->data) == 0)
-                       goto einval;
-               break;
-       case R_NEXT:
-               if (F_ISSET(&t->bt_cursor, CURS_INIT)) {
-                       nrec = t->bt_cursor.rcursor + 1;
-                       break;
-               }
-               /* FALLTHROUGH */
-       case R_FIRST:
-               nrec = 1;
-               break;
-       case R_PREV:
-               if (F_ISSET(&t->bt_cursor, CURS_INIT)) {
-                       if ((nrec = t->bt_cursor.rcursor - 1) == 0)
-                               return (RET_SPECIAL);
-                       break;
-               }
-               /* FALLTHROUGH */
-       case R_LAST:
-               if (!F_ISSET(t, R_EOF | R_INMEM) &&
-                   t->bt_irec(t, MAX_REC_NUMBER) == RET_ERROR)
-                       return (RET_ERROR);
-               nrec = t->bt_nrecs;
-               break;
-       default:
-einval:                errno = EINVAL;
-               return (RET_ERROR);
-       }
-       
-       if (t->bt_nrecs == 0 || nrec > t->bt_nrecs) {
-               if (!F_ISSET(t, R_EOF | R_INMEM) &&
-                   (status = t->bt_irec(t, nrec)) != RET_SUCCESS)
-                       return (status);
-               if (t->bt_nrecs == 0 || nrec > t->bt_nrecs)
-                       return (RET_SPECIAL);
-       }
-
-       if ((e = __rec_search(t, nrec - 1, SEARCH)) == NULL)
-               return (RET_ERROR);
-
-       F_SET(&t->bt_cursor, CURS_INIT);
-       t->bt_cursor.rcursor = nrec;
-
-       status = __rec_ret(t, e, nrec, key, data);
-       if (F_ISSET(t, B_DB_LOCK))
-               mpool_put(t->bt_mp, e->page, 0);
-       else
-               t->bt_pinned = e->page;
-       return (status);
-}
diff --git a/lib/nbsd_libc/db/recno/rec_utils.c b/lib/nbsd_libc/db/recno/rec_utils.c
deleted file mode 100644 (file)
index 2a61c7b..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*     $NetBSD: rec_utils.c,v 1.12 2008/09/10 17:52:36 joerg Exp $     */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-__RCSID("$NetBSD: rec_utils.c,v 1.12 2008/09/10 17:52:36 joerg Exp $");
-
-#include <sys/param.h>
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <db.h>
-#include "recno.h"
-
-/*
- * __rec_ret --
- *     Build return data.
- *
- * Parameters:
- *     t:      tree
- *     e:      key/data pair to be returned
- *   nrec:     record number
- *    key:     user's key structure
- *     data:   user's data structure
- *
- * Returns:
- *     RET_SUCCESS, RET_ERROR.
- */
-int
-__rec_ret(BTREE *t, EPG *e, recno_t nrec, DBT *key, DBT *data)
-{
-       RLEAF *rl;
-       void *p;
-
-       if (key == NULL)
-               goto dataonly;
-
-       /* We have to copy the key, it's not on the page. */
-       if (sizeof(recno_t) > t->bt_rkey.size) {
-               p = (void *)(t->bt_rkey.data == NULL ?
-                   malloc(sizeof(recno_t)) :
-                   realloc(t->bt_rkey.data, sizeof(recno_t)));
-               if (p == NULL)
-                       return (RET_ERROR);
-               t->bt_rkey.data = p;
-               t->bt_rkey.size = sizeof(recno_t);
-       }
-       memmove(t->bt_rkey.data, &nrec, sizeof(recno_t));
-       key->size = sizeof(recno_t);
-       key->data = t->bt_rkey.data;
-
-dataonly:
-       if (data == NULL)
-               return (RET_SUCCESS);
-
-       /*
-        * We must copy big keys/data to make them contigous.  Otherwise,
-        * leave the page pinned and don't copy unless the user specified
-        * concurrent access.
-        */
-       rl = GETRLEAF(e->page, e->index);
-       if (rl->flags & P_BIGDATA) {
-               if (__ovfl_get(t, rl->bytes,
-                   &data->size, &t->bt_rdata.data, &t->bt_rdata.size))
-                       return (RET_ERROR);
-               data->data = t->bt_rdata.data;
-       } else if (F_ISSET(t, B_DB_LOCK)) {
-               /* Use +1 in case the first record retrieved is 0 length. */
-               if (rl->dsize + 1 > t->bt_rdata.size) {
-                       p = (void *)(t->bt_rdata.data == NULL ?
-                           malloc(rl->dsize + 1) :
-                           realloc(t->bt_rdata.data, rl->dsize + 1));
-                       if (p == NULL)
-                               return (RET_ERROR);
-                       t->bt_rdata.data = p;
-                       t->bt_rdata.size = rl->dsize + 1;
-               }
-               memmove(t->bt_rdata.data, rl->bytes, rl->dsize);
-               data->size = rl->dsize;
-               data->data = t->bt_rdata.data;
-       } else {
-               data->size = rl->dsize;
-               data->data = rl->bytes;
-       }
-       return (RET_SUCCESS);
-}
diff --git a/lib/nbsd_libc/db/recno/recno.h b/lib/nbsd_libc/db/recno/recno.h
deleted file mode 100644 (file)
index 7ac0d17..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*     $NetBSD: recno.h,v 1.6 2003/08/07 16:42:44 agc Exp $    */
-
-/*-
- * Copyright (c) 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. 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.
- *
- *     @(#)recno.h     8.1 (Berkeley) 6/4/93
- */
-
-enum SRCHOP { SDELETE, SINSERT, SEARCH};       /* Rec_search operation. */
-
-#include "../btree/btree.h"
-#include "extern.h"
diff --git a/lib/nbsd_libc/gen/err.c b/lib/nbsd_libc/gen/err.c
deleted file mode 100644 (file)
index 9bd01b0..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*     $NetBSD: err.c,v 1.26 2007/06/18 14:13:54 ginsbach Exp $        */
-
-/*-
- * Copyright (c) 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)err.c      8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: err.c,v 1.26 2007/06/18 14:13:54 ginsbach Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <err.h>
-#include <stdarg.h>
-
-#ifdef __weak_alias
-__weak_alias(err, _err)
-#endif
-
-#if !HAVE_ERR_H
-__dead void
-err(int eval, const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       verr(eval, fmt, ap);
-       va_end(ap);
-}
-#endif
diff --git a/lib/nbsd_libc/gen/errx.c b/lib/nbsd_libc/gen/errx.c
deleted file mode 100644 (file)
index 004fdd6..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*     $NetBSD: errx.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $       */
-
-/*-
- * Copyright (c) 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)err.c      8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: errx.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <err.h>
-#include <stdarg.h>
-
-#ifdef __weak_alias
-__weak_alias(errx, _errx)
-#endif
-
-#if !HAVE_ERR_H
-__dead void
-errx(int eval, const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       verrx(eval, fmt, ap);
-       va_end(ap);
-}
-#endif
diff --git a/lib/nbsd_libc/gen/minix/raise.c b/lib/nbsd_libc/gen/minix/raise.c
deleted file mode 100644 (file)
index a7e951c..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
- * See the copyright notice in the ACK home directory, in the file "Copyright".
- */
-/* $Header$ */
-
-#if    defined(_POSIX_SOURCE)
-#include       <sys/types.h>
-#endif
-#include       <signal.h>
-
-int _kill(int pid, int sig);
-pid_t _getpid(void);
-
-int
-raise(int sig)
-{
-       if (sig < 0 || sig >= _NSIG)
-               return -1;
-       return _kill(_getpid(), sig);
-}
diff --git a/lib/nbsd_libc/gen/pwcache.h b/lib/nbsd_libc/gen/pwcache.h
deleted file mode 100644 (file)
index 3bd651b..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*     $NetBSD: pwcache.h,v 1.5 2003/11/10 08:51:51 wiz Exp $  */
-
-/*-
- * Copyright (c) 1992 Keith Muller.
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Keith Muller of the University of California, San Diego.
- *
- * 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. 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.
- *
- *      @(#)cache.h    8.1 (Berkeley) 5/31/93
- */
-
-/*
- * Constants and data structures used to implement group and password file
- * caches. Traditional passwd/group cache routines perform quite poorly with
- * archives. The chances of hitting a valid lookup with an archive is quite a
- * bit worse than with files already resident on the file system. These misses
- * create a MAJOR performance cost. To address this problem, these routines
- * cache both hits and misses.
- *
- * NOTE:  name lengths must be as large as those stored in ANY PROTOCOL and
- * as stored in the passwd and group files. CACHE SIZES MUST BE PRIME
- */
-#define UNMLEN         32      /* >= user name found in any protocol */
-#define GNMLEN         32      /* >= group name found in any protocol */
-#define UID_SZ         317     /* size of uid to user_name cache */
-#define UNM_SZ         317     /* size of user_name to uid cache */
-#define GID_SZ         251     /* size of gid to group_name cache */
-#define GNM_SZ         251     /* size of group_name to gid cache */
-#define VALID          1       /* entry and name are valid */
-#define INVALID                2       /* entry valid, name NOT valid */
-
-/*
- * Node structures used in the user, group, uid, and gid caches.
- */
-
-typedef struct uidc {
-       int valid;              /* is this a valid or a miss entry */
-       char name[UNMLEN];      /* uid name */
-       uid_t uid;              /* cached uid */
-} UIDC;
-
-typedef struct gidc {
-       int valid;              /* is this a valid or a miss entry */
-       char name[GNMLEN];      /* gid name */
-       gid_t gid;              /* cached gid */
-} GIDC;
diff --git a/lib/nbsd_libc/gen/verr.c b/lib/nbsd_libc/gen/verr.c
deleted file mode 100644 (file)
index d78e32e..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*     $NetBSD: verr.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $       */
-
-/*-
- * Copyright (c) 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)err.c      8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: verr.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <err.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef __weak_alias
-__weak_alias(verr, _verr)
-#endif
-
-#if !HAVE_ERR_H
-__dead void
-verr(int eval, const char *fmt, _BSD_VA_LIST_ ap)
-{
-       int sverrno;
-
-       sverrno = errno;
-       (void)fprintf(stderr, "%s: ", getprogname());
-       if (fmt != NULL) {
-               (void)vfprintf(stderr, fmt, ap);
-               (void)fprintf(stderr, ": ");
-       }
-       (void)fprintf(stderr, "%s\n", strerror(sverrno));
-       exit(eval);
-}
-#endif
diff --git a/lib/nbsd_libc/gen/verrx.c b/lib/nbsd_libc/gen/verrx.c
deleted file mode 100644 (file)
index 951b862..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*     $NetBSD: verrx.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $      */
-
-/*-
- * Copyright (c) 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)err.c      8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: verrx.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <err.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifdef __weak_alias
-__weak_alias(verrx, _verrx)
-#endif
-
-#if !HAVE_ERR_H
-__dead void
-verrx(int eval, const char *fmt, _BSD_VA_LIST_ ap)
-{
-       (void)fprintf(stderr, "%s: ", getprogname());
-       if (fmt != NULL)
-               (void)vfprintf(stderr, fmt, ap);
-       (void)fprintf(stderr, "\n");
-       exit(eval);
-}
-#endif
diff --git a/lib/nbsd_libc/gen/vwarn.c b/lib/nbsd_libc/gen/vwarn.c
deleted file mode 100644 (file)
index 802efdc..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*     $NetBSD: vwarn.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $      */
-
-/*-
- * Copyright (c) 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)err.c      8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: vwarn.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <err.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef __weak_alias
-__weak_alias(vwarn, _vwarn)
-#endif
-
-#if !HAVE_ERR_H
-void
-vwarn(const char *fmt, _BSD_VA_LIST_ ap)
-{
-       int sverrno;
-
-       sverrno = errno;
-       (void)fprintf(stderr, "%s: ", getprogname());
-       if (fmt != NULL) {
-               (void)vfprintf(stderr, fmt, ap);
-               (void)fprintf(stderr, ": ");
-       }
-       (void)fprintf(stderr, "%s\n", strerror(sverrno));
-}
-#endif
diff --git a/lib/nbsd_libc/gen/warn.c b/lib/nbsd_libc/gen/warn.c
deleted file mode 100644 (file)
index 2f78466..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*     $NetBSD: warn.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $       */
-
-/*-
- * Copyright (c) 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. 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.
- */
-
-#if HAVE_NBTOOL_CONFIG_H
-#include "nbtool_config.h"
-#endif
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)err.c      8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: warn.c,v 1.14 2007/06/18 14:13:54 ginsbach Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <err.h>
-#include <stdarg.h>
-
-#ifdef __weak_alias
-__weak_alias(warn, _warn)
-#endif
-
-#if !HAVE_ERR_H
-void
-warn(const char *fmt, ...)
-{
-       va_list ap;
-
-       va_start(ap, fmt);
-       vwarn(fmt, ap);
-       va_end(ap);
-}
-#endif
diff --git a/lib/nbsd_libc/regex/COPYRIGHT b/lib/nbsd_libc/regex/COPYRIGHT
deleted file mode 100644 (file)
index f7a8f20..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-$NetBSD: COPYRIGHT,v 1.5 2003/08/07 16:43:19 agc Exp $
-
-Copyright 1992, 1993, 1994 Henry Spencer.  All rights reserved.
-This software is not subject to any license of the American Telephone
-and Telegraph Company or of the Regents of the University of California.
-
-Permission is granted to anyone to use this software for any purpose on
-any computer system, and to alter it and redistribute it, subject
-to the following restrictions:
-
-1. The author is not responsible for the consequences of use of this
-   software, no matter how awful, even if they arise from flaws in it.
-
-2. The origin of this software must not be misrepresented, either by
-   explicit claim or by omission.  Since few users ever read sources,
-   credits must appear in the documentation.
-
-3. Altered versions must be plainly marked as such, and must not be
-   misrepresented as being the original software.  Since few users
-   ever read sources, credits must appear in the documentation.
-
-4. This notice may not be removed or altered.
-
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-/*-
- * Copyright (c) 1994
- *     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. 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.
- *
- *     @(#)COPYRIGHT   8.1 (Berkeley) 3/16/94
- */
diff --git a/lib/nbsd_libc/regex/Makefile.inc b/lib/nbsd_libc/regex/Makefile.inc
deleted file mode 100644 (file)
index 4dd74cf..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#      $NetBSD: Makefile.inc,v 1.7 1997/11/14 02:04:46 mrg Exp $
-#      @(#)Makefile.inc        8.1 (Berkeley) 6/4/93
-
-# regex sources
-.PATH: ${.CURDIR}/regex
-
-CPPFLAGS+=-DPOSIX_MISTAKE
-
-SRCS+= regcomp.c regerror.c regexec.c regfree.c
-
-MAN+=  regex.3 re_format.7
-
-MLINKS+=regex.3 regcomp.3 regex.3 regexec.3 regex.3 regerror.3 \
-       regex.3 regfree.3
diff --git a/lib/nbsd_libc/regex/WHATSNEW b/lib/nbsd_libc/regex/WHATSNEW
deleted file mode 100644 (file)
index 93eb936..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-#      $NetBSD: WHATSNEW,v 1.6 1995/02/27 13:28:25 cgd Exp $
-# @(#)WHATSNEW 8.3 (Berkeley) 3/18/94
-
-New in alpha3.4:  The complex bug alluded to below has been fixed (in a
-slightly kludgey temporary way that may hurt efficiency a bit; this is
-another "get it out the door for 4.4" release).  The tests at the end of
-the tests file have accordingly been uncommented.  The primary sign of
-the bug was that something like a?b matching ab matched b rather than ab.
-(The bug was essentially specific to this exact situation, else it would
-have shown up earlier.)
-
-New in alpha3.3:  The definition of word boundaries has been altered
-slightly, to more closely match the usual programming notion that "_"
-is an alphabetic.  Stuff used for pre-ANSI systems is now in a subdir,
-and the makefile no longer alludes to it in mysterious ways.  The
-makefile has generally been cleaned up some.  Fixes have been made
-(again!) so that the regression test will run without -DREDEBUG, at
-the cost of weaker checking.  A workaround for a bug in some folks'
-<assert.h> has been added.  And some more things have been added to
-tests, including a couple right at the end which are commented out
-because the code currently flunks them (complex bug; fix coming).
-Plus the usual minor cleanup.
-
-New in alpha3.2:  Assorted bits of cleanup and portability improvement
-(the development base is now a BSDI system using GCC instead of an ancient
-Sun system, and the newer compiler exposed some glitches).  Fix for a
-serious bug that affected REs using many [] (including REG_ICASE REs
-because of the way they are implemented), *sometimes*, depending on
-memory-allocation patterns.  The header-file prototypes no longer name
-the parameters, avoiding possible name conflicts.  The possibility that
-some clot has defined CHAR_MIN as (say) `-128' instead of `(-128)' is
-now handled gracefully.  "uchar" is no longer used as an internal type
-name (too many people have the same idea).  Still the same old lousy
-performance, alas.
-
-New in alpha3.1:  Basically nothing, this release is just a bookkeeping
-convenience.  Stay tuned.
-
-New in alpha3.0:  Performance is no better, alas, but some fixes have been
-made and some functionality has been added.  (This is basically the "get
-it out the door in time for 4.4" release.)  One bug fix:  regfree() didn't
-free the main internal structure (how embarrassing).  It is now possible
-to put NULs in either the RE or the target string, using (resp.) a new
-REG_PEND flag and the old REG_STARTEND flag.  The REG_NOSPEC flag to
-regcomp() makes all characters ordinary, so you can match a literal
-string easily (this will become more useful when performance improves!).
-There are now primitives to match beginnings and ends of words, although
-the syntax is disgusting and so is the implementation.  The REG_ATOI
-debugging interface has changed a bit.  And there has been considerable
-internal cleanup of various kinds.
-
-New in alpha2.3:  Split change list out of README, and moved flags notes
-into Makefile.  Macro-ized the name of regex(7) in regex(3), since it has
-to change for 4.4BSD.  Cleanup work in engine.c, and some new regression
-tests to catch tricky cases thereof.
-
-New in alpha2.2:  Out-of-date manpages updated.  Regerror() acquires two
-small extensions -- REG_ITOA and REG_ATOI -- which avoid debugging kludges
-in my own test program and might be useful to others for similar purposes.
-The regression test will now compile (and run) without REDEBUG.  The
-BRE \$ bug is fixed.  Most uses of "uchar" are gone; it's all chars now.
-Char/uchar parameters are now written int/unsigned, to avoid possible
-portability problems with unpromoted parameters.  Some unsigned casts have
-been introduced to minimize portability problems with shifting into sign
-bits.
-
-New in alpha2.1:  Lots of little stuff, cleanup and fixes.  The one big
-thing is that regex.h is now generated, using mkh, rather than being
-supplied in the distribution; due to circularities in dependencies,
-you have to build regex.h explicitly by "make h".  The two known bugs
-have been fixed (and the regression test now checks for them), as has a
-problem with assertions not being suppressed in the absence of REDEBUG.
-No performance work yet.
-
-New in alpha2:  Backslash-anything is an ordinary character, not an
-error (except, of course, for the handful of backslashed metacharacters
-in BREs), which should reduce script breakage.  The regression test
-checks *where* null strings are supposed to match, and has generally
-been tightened up somewhat.  Small bug fixes in parameter passing (not
-harmful, but technically errors) and some other areas.  Debugging
-invoked by defining REDEBUG rather than not defining NDEBUG.
-
-New in alpha+3:  full prototyping for internal routines, using a little
-helper program, mkh, which extracts prototypes given in stylized comments.
-More minor cleanup.  Buglet fix:  it's CHAR_BIT, not CHAR_BITS.  Simple
-pre-screening of input when a literal string is known to be part of the
-RE; this does wonders for performance.
-
-New in alpha+2:  minor bits of cleanup.  Notably, the number "32" for the
-word width isn't hardwired into regexec.c any more, the public header
-file prototypes the functions if __STDC__ is defined, and some small typos
-in the manpages have been fixed.
-
-New in alpha+1:  improvements to the manual pages, and an important
-extension, the REG_STARTEND option to regexec().
diff --git a/lib/nbsd_libc/regex/cclass.h b/lib/nbsd_libc/regex/cclass.h
deleted file mode 100644 (file)
index 3ab2ccb..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*     $NetBSD: cclass.h,v 1.7 2003/08/07 16:43:19 agc Exp $   */
-
-/*-
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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. 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.
- *
- *     @(#)cclass.h    8.3 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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.
- *
- *     @(#)cclass.h    8.3 (Berkeley) 3/20/94
- */
-
-/* character-class table */
-static const struct cclass {
-       const char *name;
-       const char *chars;
-       const char *multis;
-} cclasses[] = {
-       { "alnum",      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789",                           "" },
-       { "alpha",      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
-                                       "" },
-       { "blank",      " \t",          "" },
-       { "cntrl",      "\007\b\t\n\v\f\r\1\2\3\4\5\6\16\17\20\21\22\23\24\
-\25\26\27\30\31\32\33\34\35\36\37\177",        "" },
-       { "digit",      "0123456789",   "" },
-       { "graph",      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
-                                       "" },
-       { "lower",      "abcdefghijklmnopqrstuvwxyz",
-                                       "" },
-       { "print",      "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\
-0123456789!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ",
-                                       "" },
-       { "punct",      "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",
-                                       "" },
-       { "space",      "\t\n\v\f\r ",  "" },
-       { "upper",      "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
-                                       "" },
-       { "xdigit",     "0123456789ABCDEFabcdef",
-                                       "" },
-       { NULL,         0,              "" }
-};
diff --git a/lib/nbsd_libc/regex/cname.h b/lib/nbsd_libc/regex/cname.h
deleted file mode 100644 (file)
index 4b9ef39..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*     $NetBSD: cname.h,v 1.7 2003/08/07 16:43:19 agc Exp $    */
-
-/*-
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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. 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.
- *
- *     @(#)cname.h     8.3 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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.
- *
- *     @(#)cname.h     8.3 (Berkeley) 3/20/94
- */
-
-/* character-name table */
-static const struct cname {
-       const char *name;
-       char code;
-} cnames[] = {
-       { "NUL",                        '\0' },
-       { "SOH",                        '\001' },
-       { "STX",                        '\002' },
-       { "ETX",                        '\003' },
-       { "EOT",                        '\004' },
-       { "ENQ",                        '\005' },
-       { "ACK",                        '\006' },
-       { "BEL",                        '\007' },
-       { "alert",                      '\007' },
-       { "BS",                         '\010' },
-       { "backspace",                  '\b' },
-       { "HT",                         '\011' },
-       { "tab",                        '\t' },
-       { "LF",                         '\012' },
-       { "newline",                    '\n' },
-       { "VT",                         '\013' },
-       { "vertical-tab",               '\v' },
-       { "FF",                         '\014' },
-       { "form-feed",                  '\f' },
-       { "CR",                         '\015' },
-       { "carriage-return",            '\r' },
-       { "SO",                         '\016' },
-       { "SI",                         '\017' },
-       { "DLE",                        '\020' },
-       { "DC1",                        '\021' },
-       { "DC2",                        '\022' },
-       { "DC3",                        '\023' },
-       { "DC4",                        '\024' },
-       { "NAK",                        '\025' },
-       { "SYN",                        '\026' },
-       { "ETB",                        '\027' },
-       { "CAN",                        '\030' },
-       { "EM",                         '\031' },
-       { "SUB",                        '\032' },
-       { "ESC",                        '\033' },
-       { "IS4",                        '\034' },
-       { "FS",                         '\034' },
-       { "IS3",                        '\035' },
-       { "GS",                         '\035' },
-       { "IS2",                        '\036' },
-       { "RS",                         '\036' },
-       { "IS1",                        '\037' },
-       { "US",                         '\037' },
-       { "space",                      ' ' },
-       { "exclamation-mark",           '!' },
-       { "quotation-mark",             '"' },
-       { "number-sign",                '#' },
-       { "dollar-sign",                '$' },
-       { "percent-sign",               '%' },
-       { "ampersand",                  '&' },
-       { "apostrophe",                 '\'' },
-       { "left-parenthesis",           '(' },
-       { "right-parenthesis",          ')' },
-       { "asterisk",                   '*' },
-       { "plus-sign",                  '+' },
-       { "comma",                      ',' },
-       { "hyphen",                     '-' },
-       { "hyphen-minus",               '-' },
-       { "period",                     '.' },
-       { "full-stop",                  '.' },
-       { "slash",                      '/' },
-       { "solidus",                    '/' },
-       { "zero",                       '0' },
-       { "one",                        '1' },
-       { "two",                        '2' },
-       { "three",                      '3' },
-       { "four",                       '4' },
-       { "five",                       '5' },
-       { "six",                        '6' },
-       { "seven",                      '7' },
-       { "eight",                      '8' },
-       { "nine",                       '9' },
-       { "colon",                      ':' },
-       { "semicolon",                  ';' },
-       { "less-than-sign",             '<' },
-       { "equals-sign",                '=' },
-       { "greater-than-sign",          '>' },
-       { "question-mark",              '?' },
-       { "commercial-at",              '@' },
-       { "left-square-bracket",        '[' },
-       { "backslash",                  '\\' },
-       { "reverse-solidus",            '\\' },
-       { "right-square-bracket",       ']' },
-       { "circumflex",                 '^' },
-       { "circumflex-accent",          '^' },
-       { "underscore",                 '_' },
-       { "low-line",                   '_' },
-       { "grave-accent",               '`' },
-       { "left-brace",                 '{' },
-       { "left-curly-bracket",         '{' },
-       { "vertical-line",              '|' },
-       { "right-brace",                '}' },
-       { "right-curly-bracket",        '}' },
-       { "tilde",                      '~' },
-       { "DEL",                        '\177' },
-       { NULL,                         0 },
-};
diff --git a/lib/nbsd_libc/regex/engine.c b/lib/nbsd_libc/regex/engine.c
deleted file mode 100644 (file)
index f51ff9c..0000000
+++ /dev/null
@@ -1,1188 +0,0 @@
-/*     $NetBSD: engine.c,v 1.22 2009/02/12 05:06:54 lukem Exp $        */
-
-/*-
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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. 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.
- *
- *     @(#)engine.c    8.5 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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.
- *
- *     @(#)engine.c    8.5 (Berkeley) 3/20/94
- */
-
-/*
- * The matching engine and friends.  This file is #included by regexec.c
- * after suitable #defines of a variety of macros used herein, so that
- * different state representations can be used without duplicating masses
- * of code.
- */
-
-#ifdef SNAMES
-#define        matcher smatcher
-#define        fast    sfast
-#define        slow    sslow
-#define        dissect sdissect
-#define        backref sbackref
-#define        step    sstep
-#define        print   sprint
-#define        at      sat
-#define        match   smat
-#define        nope    snope
-#endif
-#ifdef LNAMES
-#define        matcher lmatcher
-#define        fast    lfast
-#define        slow    lslow
-#define        dissect ldissect
-#define        backref lbackref
-#define        step    lstep
-#define        print   lprint
-#define        at      lat
-#define        match   lmat
-#define        nope    lnope
-#endif
-
-/* another structure passed up and down to avoid zillions of parameters */
-struct match {
-       struct re_guts *g;
-       int eflags;
-       regmatch_t *pmatch;     /* [nsub+1] (0 element unused) */
-       const char *offp;       /* offsets work from here */
-       const char *beginp;     /* start of string -- virtual NUL precedes */
-       const char *endp;       /* end of string -- virtual NUL here */
-       const char *coldp;      /* can be no match starting before here */
-       const char **lastpos;   /* [nplus+1] */
-       STATEVARS;
-       states st;              /* current states */
-       states fresh;           /* states for a fresh start */
-       states tmp;             /* temporary */
-       states empty;           /* empty set of states */
-};
-
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === engine.c === */
-static int matcher(struct re_guts *g, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags);
-static const char *dissect(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev);
-static const char *fast(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static const char *slow(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst);
-static states step(struct re_guts *g, sopno start, sopno stop, states bef, int ch, states aft);
-#define        BOL     (OUT+1)
-#define        EOL     (BOL+1)
-#define        BOLEOL  (BOL+2)
-#define        NOTHING (BOL+3)
-#define        BOW     (BOL+4)
-#define        EOW     (BOL+5)
-#define        CODEMAX (BOL+5)         /* highest code used */
-#define        NONCHAR(c)      ((c) > CHAR_MAX)
-#define        NNONCHAR        (CODEMAX-CHAR_MAX)
-#ifdef REDEBUG
-static void print(struct match *m, char *caption, states st, int ch, FILE *d);
-#endif
-#ifdef REDEBUG
-static void at(struct match *m, char *title, char *start, char *stop, sopno startst, sopno stopst);
-#endif
-#ifdef REDEBUG
-static char *pchar(int ch);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
-
-#ifdef REDEBUG
-#define        SP(t, s, c)     print(m, t, s, c, stdout)
-#define        AT(t, p1, p2, s1, s2)   at(m, t, p1, p2, s1, s2)
-#define        NOTE(str)       { if (m->eflags&REG_TRACE) printf("=%s\n", (str)); }
-static int nope = 0;
-#else
-#define        SP(t, s, c)     /* nothing */
-#define        AT(t, p1, p2, s1, s2)   /* nothing */
-#define        NOTE(s) /* nothing */
-#endif
-
-/*
- - matcher - the actual matching engine
- == static int matcher(struct re_guts *g, char *string, \
- ==    size_t nmatch, regmatch_t pmatch[], int eflags);
- */
-static int                     /* 0 success, REG_NOMATCH failure */
-matcher(
-    struct re_guts *g,
-    const char *string,
-    size_t nmatch,
-    regmatch_t pmatch[],
-    int eflags)
-{
-       const char *endp;
-       size_t i;
-       struct match mv;
-       struct match *m = &mv;
-       const char *dp;
-       const sopno gf = g->firststate+1;       /* +1 for OEND */
-       const sopno gl = g->laststate;
-       const char *start;
-       const char *stop;
-       int error = 0;
-
-       _DIAGASSERT(g != NULL);
-       _DIAGASSERT(string != NULL);
-       /* pmatch checked below */
-
-       /* simplify the situation where possible */
-       if (g->cflags&REG_NOSUB)
-               nmatch = 0;
-       if (eflags&REG_STARTEND) {
-               _DIAGASSERT(pmatch != NULL);
-               start = string + (size_t)pmatch[0].rm_so;
-               stop = string + (size_t)pmatch[0].rm_eo;
-       } else {
-               start = string;
-               stop = start + strlen(start);
-       }
-       if (stop < start)
-               return(REG_INVARG);
-
-       /* prescreening; this does wonders for this rather slow code */
-       if (g->must != NULL) {
-               for (dp = start; dp < stop; dp++)
-                       if (*dp == g->must[0] && stop - dp >= g->mlen &&
-                               memcmp(dp, g->must, (size_t)g->mlen) == 0)
-                               break;
-               if (dp == stop)         /* we didn't find g->must */
-                       return(REG_NOMATCH);
-       }
-
-       /* match struct setup */
-       m->g = g;
-       m->eflags = eflags;
-       m->pmatch = NULL;
-       m->lastpos = NULL;
-       m->offp = string;
-       m->beginp = start;
-       m->endp = stop;
-       STATESETUP(m, 4);
-       SETUP(m->st);
-       SETUP(m->fresh);
-       SETUP(m->tmp);
-       SETUP(m->empty);
-       CLEAR(m->empty);
-
-       /* this loop does only one repetition except for backrefs */
-       for (;;) {
-               endp = fast(m, start, stop, gf, gl);
-               if (endp == NULL) {             /* a miss */
-                       error = REG_NOMATCH;
-                       goto done;
-               }
-               if (nmatch == 0 && !g->backrefs)
-                       break;          /* no further info needed */
-
-               /* where? */
-               assert(m->coldp != NULL);
-               for (;;) {
-                       NOTE("finding start");
-                       endp = slow(m, m->coldp, stop, gf, gl);
-                       if (endp != NULL)
-                               break;
-                       assert(m->coldp < m->endp);
-                       m->coldp++;
-               }
-               if (nmatch == 1 && !g->backrefs)
-                       break;          /* no further info needed */
-
-               /* oh my, he wants the subexpressions... */
-               if (m->pmatch == NULL)
-                       m->pmatch = (regmatch_t *)malloc((m->g->nsub + 1) *
-                                                       sizeof(regmatch_t));
-               if (m->pmatch == NULL) {
-                       error = REG_ESPACE;
-                       goto done;
-               }
-               for (i = 1; i <= m->g->nsub; i++)
-                       m->pmatch[i].rm_so = m->pmatch[i].rm_eo = (regoff_t)-1;
-               if (!g->backrefs && !(m->eflags&REG_BACKR)) {
-                       NOTE("dissecting");
-                       dp = dissect(m, m->coldp, endp, gf, gl);
-               } else {
-                       if (g->nplus > 0 && m->lastpos == NULL)
-                               m->lastpos = malloc((g->nplus+1) *
-                                                       sizeof(const char *));
-                       if (g->nplus > 0 && m->lastpos == NULL) {
-                               error = REG_ESPACE;
-                               goto done;
-                       }
-                       NOTE("backref dissect");
-                       dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
-               }
-               if (dp != NULL)
-                       break;
-
-               /* uh-oh... we couldn't find a subexpression-level match */
-               assert(g->backrefs);    /* must be back references doing it */
-               assert(g->nplus == 0 || m->lastpos != NULL);
-               for (;;) {
-                       if (dp != NULL || endp <= m->coldp)
-                               break;          /* defeat */
-                       NOTE("backoff");
-                       endp = slow(m, m->coldp, endp-1, gf, gl);
-                       if (endp == NULL)
-                               break;          /* defeat */
-                       /* try it on a shorter possibility */
-#ifndef NDEBUG
-                       for (i = 1; i <= m->g->nsub; i++) {
-                               assert(m->pmatch[i].rm_so == (regoff_t)-1);
-                               assert(m->pmatch[i].rm_eo == (regoff_t)-1);
-                       }
-#endif
-                       NOTE("backoff dissect");
-                       dp = backref(m, m->coldp, endp, gf, gl, (sopno)0);
-               }
-               assert(dp == NULL || dp == endp);
-               if (dp != NULL)         /* found a shorter one */
-                       break;
-
-               /* despite initial appearances, there is no match here */
-               NOTE("false alarm");
-               start = m->coldp + 1;   /* recycle starting later */
-               assert(start <= stop);
-       }
-
-       /* fill in the details if requested */
-       if (nmatch > 0) {
-               _DIAGASSERT(pmatch != NULL);
-               pmatch[0].rm_so = m->coldp - m->offp;
-               pmatch[0].rm_eo = endp - m->offp;
-       }
-       if (nmatch > 1) {
-               assert(m->pmatch != NULL);
-               for (i = 1; i < nmatch; i++)
-                       if (i <= m->g->nsub)
-                               pmatch[i] = m->pmatch[i];
-                       else {
-                               pmatch[i].rm_so = (regoff_t)-1;
-                               pmatch[i].rm_eo = (regoff_t)-1;
-                       }
-       }
-
-done:
-       if (m->pmatch != NULL) {
-               free(m->pmatch);
-               m->pmatch = NULL;
-       }
-       if (m->lastpos != NULL) {
-               free(m->lastpos);
-               m->lastpos = NULL;
-       }
-       STATETEARDOWN(m);
-       return error;
-}
-
-/*
- - dissect - figure out what matched what, no back references
- == static const char *dissect(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst);
- */
-static const char *                    /* == stop (success) always */
-dissect(
-    struct match *m,
-    const char *start,
-    const char *stop,
-    sopno startst,
-    sopno stopst)
-{
-       int i;
-       sopno ss;       /* start sop of current subRE */
-       sopno es;       /* end sop of current subRE */
-       const char *sp; /* start of string matched by it */
-       const char *stp; /* string matched by it cannot pass here */
-       const char *rest; /* start of rest of string */
-       const char *tail; /* string unmatched by rest of RE */
-       sopno ssub;     /* start sop of subsubRE */
-       sopno esub;     /* end sop of subsubRE */
-       const char *ssp; /* start of string matched by subsubRE */
-       const char *sep; /* end of string matched by subsubRE */
-       const char *oldssp; /* previous ssp */
-#ifndef NDEBUG
-       const char *dp;
-#endif
-
-       _DIAGASSERT(m != NULL);
-       _DIAGASSERT(start != NULL);
-       _DIAGASSERT(stop != NULL);
-
-       AT("diss", start, stop, startst, stopst);
-       sp = start;
-       for (ss = startst; ss < stopst; ss = es) {
-               /* identify end of subRE */
-               es = ss;
-               switch (OP(m->g->strip[es])) {
-               case OPLUS_:
-               case OQUEST_:
-                       es += OPND(m->g->strip[es]);
-                       break;
-               case OCH_:
-                       while (OP(m->g->strip[es]) != O_CH)
-                               es += OPND(m->g->strip[es]);
-                       break;
-               }
-               es++;
-
-               /* figure out what it matched */
-               switch (OP(m->g->strip[ss])) {
-               case OEND:
-                       assert(nope);
-                       break;
-               case OCHAR:
-                       sp++;
-                       break;
-               case OBOL:
-               case OEOL:
-               case OBOW:
-               case OEOW:
-                       break;
-               case OANY:
-               case OANYOF:
-                       sp++;
-                       break;
-               case OBACK_:
-               case O_BACK:
-                       assert(nope);
-                       break;
-               /* cases where length of match is hard to find */
-               case OQUEST_:
-                       stp = stop;
-                       for (;;) {
-                               /* how long could this one be? */
-                               rest = slow(m, sp, stp, ss, es);
-                               assert(rest != NULL);   /* it did match */
-                               /* could the rest match the rest? */
-                               tail = slow(m, rest, stop, es, stopst);
-                               if (tail == stop)
-                                       break;          /* yes! */
-                               /* no -- try a shorter match for this one */
-                               stp = rest - 1;
-                               assert(stp >= sp);      /* it did work */
-                       }
-                       ssub = ss + 1;
-                       esub = es - 1;
-                       /* did innards match? */
-                       if (slow(m, sp, rest, ssub, esub) != NULL) {
-#ifdef NDEBUG
-                               (void)
-#else
-                               dp = 
-#endif
-                                   dissect(m, sp, rest, ssub, esub);
-                               assert(dp == rest);
-                       } else          /* no */
-                               assert(sp == rest);
-                       sp = rest;
-                       break;
-               case OPLUS_:
-                       stp = stop;
-                       for (;;) {
-                               /* how long could this one be? */
-                               rest = slow(m, sp, stp, ss, es);
-                               assert(rest != NULL);   /* it did match */
-                               /* could the rest match the rest? */
-                               tail = slow(m, rest, stop, es, stopst);
-                               if (tail == stop)
-                                       break;          /* yes! */
-                               /* no -- try a shorter match for this one */
-                               stp = rest - 1;
-                               assert(stp >= sp);      /* it did work */
-                       }
-                       ssub = ss + 1;
-                       esub = es - 1;
-                       ssp = sp;
-                       oldssp = ssp;
-                       for (;;) {      /* find last match of innards */
-                               sep = slow(m, ssp, rest, ssub, esub);
-                               if (sep == NULL || sep == ssp)
-                                       break;  /* failed or matched null */
-                               oldssp = ssp;   /* on to next try */
-                               ssp = sep;
-                       }
-                       if (sep == NULL) {
-                               /* last successful match */
-                               sep = ssp;
-                               ssp = oldssp;
-                       }
-                       assert(sep == rest);    /* must exhaust substring */
-                       assert(slow(m, ssp, sep, ssub, esub) == rest);
-#ifdef NDEBUG
-                       (void)
-#else
-                       dp =
-#endif
-                           dissect(m, ssp, sep, ssub, esub);
-                       assert(dp == sep);
-                       sp = rest;
-                       break;
-               case OCH_:
-                       stp = stop;
-                       for (;;) {
-                               /* how long could this one be? */
-                               rest = slow(m, sp, stp, ss, es);
-                               assert(rest != NULL);   /* it did match */
-                               /* could the rest match the rest? */
-                               tail = slow(m, rest, stop, es, stopst);
-                               if (tail == stop)
-                                       break;          /* yes! */
-                               /* no -- try a shorter match for this one */
-                               stp = rest - 1;
-                               assert(stp >= sp);      /* it did work */
-                       }
-                       ssub = ss + 1;
-                       esub = ss + OPND(m->g->strip[ss]) - 1;
-                       assert(OP(m->g->strip[esub]) == OOR1);
-                       for (;;) {      /* find first matching branch */
-                               if (slow(m, sp, rest, ssub, esub) == rest)
-                                       break;  /* it matched all of it */
-                               /* that one missed, try next one */
-                               assert(OP(m->g->strip[esub]) == OOR1);
-                               esub++;
-                               assert(OP(m->g->strip[esub]) == OOR2);
-                               ssub = esub + 1;
-                               esub += OPND(m->g->strip[esub]);
-                               if (OP(m->g->strip[esub]) == OOR2)
-                                       esub--;
-                               else
-                                       assert(OP(m->g->strip[esub]) == O_CH);
-                       }
-#ifdef NDEBUG
-                       (void)
-#else
-                       dp =
-#endif
-                           dissect(m, sp, rest, ssub, esub);
-                       assert(dp == rest);
-                       sp = rest;
-                       break;
-               case O_PLUS:
-               case O_QUEST:
-               case OOR1:
-               case OOR2:
-               case O_CH:
-                       assert(nope);
-                       break;
-               case OLPAREN:
-                       i = OPND(m->g->strip[ss]);
-                       assert(0 < i && i <= m->g->nsub);
-                       m->pmatch[i].rm_so = sp - m->offp;
-                       break;
-               case ORPAREN:
-                       i = OPND(m->g->strip[ss]);
-                       assert(0 < i && i <= m->g->nsub);
-                       m->pmatch[i].rm_eo = sp - m->offp;
-                       break;
-               default:                /* uh oh */
-                       assert(nope);
-                       break;
-               }
-       }
-
-       assert(sp == stop);
-       return(sp);
-}
-
-/*
- - backref - figure out what matched what, figuring in back references
- == static const char *backref(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst, sopno lev);
- */
-static const char *            /* == stop (success) or NULL (failure) */
-backref(
-    struct match *m,
-    const char *start,
-    const char *stop,
-    sopno startst,
-    sopno stopst,
-    sopno lev)                 /* PLUS nesting level */
-{
-       int i;
-       sopno ss;       /* start sop of current subRE */
-       const char *sp; /* start of string matched by it */
-       sopno ssub;     /* start sop of subsubRE */
-       sopno esub;     /* end sop of subsubRE */
-       const char *ssp; /* start of string matched by subsubRE */
-       const char *dp;
-       size_t len;
-       int hard;
-       sop s;
-       regoff_t offsave;
-       cset *cs;
-
-       _DIAGASSERT(m != NULL);
-       _DIAGASSERT(start != NULL);
-       _DIAGASSERT(stop != NULL);
-
-       AT("back", start, stop, startst, stopst);
-       sp = start;
-
-       /* get as far as we can with easy stuff */
-       hard = 0;
-       for (ss = startst; !hard && ss < stopst; ss++)
-               switch (OP(s = m->g->strip[ss])) {
-               case OCHAR:
-                       if (sp == stop || *sp++ != (char)OPND(s))
-                               return(NULL);
-                       break;
-               case OANY:
-                       if (sp == stop)
-                               return(NULL);
-                       sp++;
-                       break;
-               case OANYOF:
-                       cs = &m->g->sets[OPND(s)];
-                       if (sp == stop || !CHIN(cs, *sp++))
-                               return(NULL);
-                       break;
-               case OBOL:
-                       if ( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
-                                       (sp < m->endp && *(sp-1) == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case OEOL:
-                       if ( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
-                                       (sp < m->endp && *sp == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case OBOW:
-                       if (( (sp == m->beginp && !(m->eflags&REG_NOTBOL)) ||
-                                       (sp < m->endp && *(sp-1) == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) ||
-                                       (sp > m->beginp &&
-                                                       !ISWORD(*(sp-1))) ) &&
-                                       (sp < m->endp && ISWORD(*sp)) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case OEOW:
-                       if (( (sp == m->endp && !(m->eflags&REG_NOTEOL)) ||
-                                       (sp < m->endp && *sp == '\n' &&
-                                               (m->g->cflags&REG_NEWLINE)) ||
-                                       (sp < m->endp && !ISWORD(*sp)) ) &&
-                                       (sp > m->beginp && ISWORD(*(sp-1))) )
-                               { /* yes */ }
-                       else
-                               return(NULL);
-                       break;
-               case O_QUEST:
-                       break;
-               case OOR1:      /* matches null but needs to skip */
-                       ss++;
-                       s = m->g->strip[ss];
-                       do {
-                               assert(OP(s) == OOR2);
-                               ss += OPND(s);
-                       } while (OP(s = m->g->strip[ss]) != O_CH);
-                       /* note that the ss++ gets us past the O_CH */
-                       break;
-               default:        /* have to make a choice */
-                       hard = 1;
-                       break;
-               }
-       if (!hard) {            /* that was it! */
-               if (sp != stop)
-                       return(NULL);
-               return(sp);
-       }
-       ss--;                   /* adjust for the for's final increment */
-
-       /* the hard stuff */
-       AT("hard", sp, stop, ss, stopst);
-       s = m->g->strip[ss];
-       switch (OP(s)) {
-       case OBACK_:            /* the vilest depths */
-               i = OPND(s);
-               assert(0 < i && i <= m->g->nsub);
-               if (m->pmatch[i].rm_eo == (regoff_t)-1)
-                       return(NULL);
-               assert(m->pmatch[i].rm_so != (regoff_t)-1);
-               len = (size_t)(m->pmatch[i].rm_eo - m->pmatch[i].rm_so);
-               if (len == 0)
-                       return(NULL);
-               assert(stop - m->beginp >= len);
-               if (sp > stop - len)
-                       return(NULL);   /* not enough left to match */
-               ssp = m->offp + (size_t)m->pmatch[i].rm_so;
-               if (memcmp(sp, ssp, len) != 0)
-                       return(NULL);
-               while (m->g->strip[ss] != SOP(O_BACK, i))
-                       ss++;
-               return(backref(m, sp+len, stop, ss+1, stopst, lev));
-
-       case OQUEST_:           /* to null or not */
-               dp = backref(m, sp, stop, ss+1, stopst, lev);
-               if (dp != NULL)
-                       return(dp);     /* not */
-               return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev));
-
-       case OPLUS_:
-               assert(m->lastpos != NULL);
-               assert(lev+1 <= m->g->nplus);
-               m->lastpos[lev+1] = sp;
-               return(backref(m, sp, stop, ss+1, stopst, lev+1));
-
-       case O_PLUS:
-               if (sp == m->lastpos[lev])      /* last pass matched null */
-                       return(backref(m, sp, stop, ss+1, stopst, lev-1));
-               /* try another pass */
-               m->lastpos[lev] = sp;
-               dp = backref(m, sp, stop, ss-OPND(s)+1, stopst, lev);
-               if (dp == NULL)
-                       dp = backref(m, sp, stop, ss+1, stopst, lev-1);
-               return(dp);
-
-       case OCH_:              /* find the right one, if any */
-               ssub = ss + 1;
-               esub = ss + OPND(s) - 1;
-               assert(OP(m->g->strip[esub]) == OOR1);
-               for (;;) {      /* find first matching branch */
-                       dp = backref(m, sp, stop, ssub, esub, lev);
-                       if (dp != NULL)
-                               return(dp);
-                       /* that one missed, try next one */
-                       if (OP(m->g->strip[esub]) == O_CH)
-                               return(NULL);   /* there is none */
-                       esub++;
-                       assert(OP(m->g->strip[esub]) == OOR2);
-                       ssub = esub + 1;
-                       esub += OPND(m->g->strip[esub]);
-                       if (OP(m->g->strip[esub]) == OOR2)
-                               esub--;
-                       else
-                               assert(OP(m->g->strip[esub]) == O_CH);
-               }
-
-       case OLPAREN:           /* must undo assignment if rest fails */
-               i = OPND(s);
-               assert(0 < i && i <= m->g->nsub);
-               offsave = m->pmatch[i].rm_so;
-               m->pmatch[i].rm_so = sp - m->offp;
-               dp = backref(m, sp, stop, ss+1, stopst, lev);
-               if (dp != NULL)
-                       return(dp);
-               m->pmatch[i].rm_so = offsave;
-               return(NULL);
-
-       case ORPAREN:           /* must undo assignment if rest fails */
-               i = OPND(s);
-               assert(0 < i && i <= m->g->nsub);
-               offsave = m->pmatch[i].rm_eo;
-               m->pmatch[i].rm_eo = sp - m->offp;
-               dp = backref(m, sp, stop, ss+1, stopst, lev);
-               if (dp != NULL)
-                       return(dp);
-               m->pmatch[i].rm_eo = offsave;
-               return(NULL);
-
-       default:                /* uh oh */
-               assert(nope);
-               break;
-       }
-
-       /* "can't happen" */
-       assert(nope);
-       /* NOTREACHED */
-       return NULL;
-}
-
-/*
- - fast - step through the string at top speed
- == static const char *fast(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst);
- */
-static const char *            /* where tentative match ended, or NULL */
-fast(
-    struct match *m,
-    const char *start,
-    const char *stop,
-    sopno startst,
-    sopno stopst)
-{
-       states st = m->st;
-       states fresh = m->fresh;
-       states tmp = m->tmp;
-       const char *p = start;
-       int c = (start == m->beginp) ? OUT : *(start-1);
-       int lastc;      /* previous c */
-       int flagch;
-       int i;
-       const char *coldp; /* last p after which no match was underway */
-
-       _DIAGASSERT(m != NULL);
-       _DIAGASSERT(start != NULL);
-       _DIAGASSERT(stop != NULL);
-
-       CLEAR(st);
-       SET1(st, startst);
-       st = step(m->g, startst, stopst, st, NOTHING, st);
-       ASSIGN(fresh, st);
-       SP("start", st, *p);
-       coldp = NULL;
-       for (;;) {
-               /* next character */
-               lastc = c;
-               c = (p == m->endp) ? OUT : *p;
-               if (EQ(st, fresh))
-                       coldp = p;
-
-               /* is there an EOL and/or BOL between lastc and c? */
-               flagch = '\0';
-               i = 0;
-               if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
-                       flagch = BOL;
-                       i = m->g->nbol;
-               }
-               if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
-                       flagch = (flagch == BOL) ? BOLEOL : EOL;
-                       i += m->g->neol;
-               }
-               if (i != 0) {
-                       for (; i > 0; i--)
-                               st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("boleol", st, c);
-               }
-
-               /* how about a word boundary? */
-               if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
-                                       (c != OUT && ISWORD(c)) ) {
-                       flagch = BOW;
-               }
-               if ( (lastc != OUT && ISWORD(lastc)) &&
-                               (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
-                       flagch = EOW;
-               }
-               if (flagch == BOW || flagch == EOW) {
-                       st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("boweow", st, c);
-               }
-
-               /* are we done? */
-               if (ISSET(st, stopst) || p == stop)
-                       break;          /* NOTE BREAK OUT */
-
-               /* no, we must deal with this character */
-               ASSIGN(tmp, st);
-               ASSIGN(st, fresh);
-               assert(c != OUT);
-               st = step(m->g, startst, stopst, tmp, c, st);
-               SP("aft", st, c);
-               assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
-               p++;
-       }
-
-       assert(coldp != NULL);
-       m->coldp = coldp;
-       if (ISSET(st, stopst))
-               return(p+1);
-       else
-               return(NULL);
-}
-
-/*
- - slow - step through the string more deliberately
- == static const char *slow(struct match *m, const char *start, \
- ==    const char *stop, sopno startst, sopno stopst);
- */
-static const char *                    /* where it ended */
-slow(
-    struct match *m,
-    const char *start,
-    const char *stop,
-    sopno startst,
-    sopno stopst)
-{
-       states st = m->st;
-       states empty = m->empty;
-       states tmp = m->tmp;
-       const char *p = start;
-       int c = (start == m->beginp) ? OUT : *(start-1);
-       int lastc;      /* previous c */
-       int flagch;
-       int i;
-       const char *matchp;     /* last p at which a match ended */
-
-       _DIAGASSERT(m != NULL);
-       _DIAGASSERT(start != NULL);
-       _DIAGASSERT(stop != NULL);
-
-       AT("slow", start, stop, startst, stopst);
-       CLEAR(st);
-       SET1(st, startst);
-       SP("sstart", st, *p);
-       st = step(m->g, startst, stopst, st, NOTHING, st);
-       matchp = NULL;
-       for (;;) {
-               /* next character */
-               lastc = c;
-               c = (p == m->endp) ? OUT : *p;
-
-               /* is there an EOL and/or BOL between lastc and c? */
-               flagch = '\0';
-               i = 0;
-               if ( (lastc == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (lastc == OUT && !(m->eflags&REG_NOTBOL)) ) {
-                       flagch = BOL;
-                       i = m->g->nbol;
-               }
-               if ( (c == '\n' && m->g->cflags&REG_NEWLINE) ||
-                               (c == OUT && !(m->eflags&REG_NOTEOL)) ) {
-                       flagch = (flagch == BOL) ? BOLEOL : EOL;
-                       i += m->g->neol;
-               }
-               if (i != 0) {
-                       for (; i > 0; i--)
-                               st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("sboleol", st, c);
-               }
-
-               /* how about a word boundary? */
-               if ( (flagch == BOL || (lastc != OUT && !ISWORD(lastc))) &&
-                                       (c != OUT && ISWORD(c)) ) {
-                       flagch = BOW;
-               }
-               if ( (lastc != OUT && ISWORD(lastc)) &&
-                               (flagch == EOL || (c != OUT && !ISWORD(c))) ) {
-                       flagch = EOW;
-               }
-               if (flagch == BOW || flagch == EOW) {
-                       st = step(m->g, startst, stopst, st, flagch, st);
-                       SP("sboweow", st, c);
-               }
-
-               /* are we done? */
-               if (ISSET(st, stopst))
-                       matchp = p;
-               if (EQ(st, empty) || p == stop)
-                       break;          /* NOTE BREAK OUT */
-
-               /* no, we must deal with this character */
-               ASSIGN(tmp, st);
-               ASSIGN(st, empty);
-               assert(c != OUT);
-               st = step(m->g, startst, stopst, tmp, c, st);
-               SP("saft", st, c);
-               assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st));
-               p++;
-       }
-
-       return(matchp);
-}
-
-
-/*
- - step - map set of states reachable before char to set reachable after
- == static states step(struct re_guts *g, sopno start, sopno stop, \
- ==    states bef, int ch, states aft);
- == #define    BOL     (OUT+1)
- == #define    EOL     (BOL+1)
- == #define    BOLEOL  (BOL+2)
- == #define    NOTHING (BOL+3)
- == #define    BOW     (BOL+4)
- == #define    EOW     (BOL+5)
- == #define    CODEMAX (BOL+5)         // highest code used
- == #define    NONCHAR(c)      ((c) > CHAR_MAX)
- == #define    NNONCHAR        (CODEMAX-CHAR_MAX)
- */
-static states
-step(
-    struct re_guts *g,
-    sopno start,               /* start state within strip */
-    sopno stop,                        /* state after stop state within strip */
-    states bef,                        /* states reachable before */
-    int ch,                    /* character or NONCHAR code */
-    states aft)                        /* states already known reachable after */
-{
-       cset *cs;
-       sop s;
-       sopno pc;
-       onestate here;          /* note, macros know this name */
-       sopno look;
-       int i;
-
-       _DIAGASSERT(g != NULL);
-
-       for (pc = start, INIT(here, pc); pc != stop; pc++, INC(here)) {
-               s = g->strip[pc];
-               switch (OP(s)) {
-               case OEND:
-                       assert(pc == stop-1);
-                       break;
-               case OCHAR:
-                       /* only characters can match */
-                       assert(!NONCHAR(ch) || ch != (char)OPND(s));
-                       if (ch == (char)OPND(s))
-                               FWD(aft, bef, 1);
-                       break;
-               case OBOL:
-                       if (ch == BOL || ch == BOLEOL)
-                               FWD(aft, bef, 1);
-                       break;
-               case OEOL:
-                       if (ch == EOL || ch == BOLEOL)
-                               FWD(aft, bef, 1);
-                       break;
-               case OBOW:
-                       if (ch == BOW)
-                               FWD(aft, bef, 1);
-                       break;
-               case OEOW:
-                       if (ch == EOW)
-                               FWD(aft, bef, 1);
-                       break;
-               case OANY:
-                       if (!NONCHAR(ch))
-                               FWD(aft, bef, 1);
-                       break;
-               case OANYOF:
-                       cs = &g->sets[OPND(s)];
-                       if (!NONCHAR(ch) && CHIN(cs, ch))
-                               FWD(aft, bef, 1);
-                       break;
-               case OBACK_:            /* ignored here */
-               case O_BACK:
-                       FWD(aft, aft, 1);
-                       break;
-               case OPLUS_:            /* forward, this is just an empty */
-                       FWD(aft, aft, 1);
-                       break;
-               case O_PLUS:            /* both forward and back */
-                       FWD(aft, aft, 1);
-                       i = ISSETBACK(aft, OPND(s));
-                       BACK(aft, aft, OPND(s));
-                       if (!i && ISSETBACK(aft, OPND(s))) {
-                               /* oho, must reconsider loop body */
-                               pc -= OPND(s) + 1;
-                               INIT(here, pc);
-                       }
-                       break;
-               case OQUEST_:           /* two branches, both forward */
-                       FWD(aft, aft, 1);
-                       FWD(aft, aft, OPND(s));
-                       break;
-               case O_QUEST:           /* just an empty */
-                       FWD(aft, aft, 1);
-                       break;
-               case OLPAREN:           /* not significant here */
-               case ORPAREN:
-                       FWD(aft, aft, 1);
-                       break;
-               case OCH_:              /* mark the first two branches */
-                       FWD(aft, aft, 1);
-                       assert(OP(g->strip[pc+OPND(s)]) == OOR2);
-                       FWD(aft, aft, OPND(s));
-                       break;
-               case OOR1:              /* done a branch, find the O_CH */
-                       if (ISSTATEIN(aft, here)) {
-                               for (look = 1;
-                                               OP(s = g->strip[pc+look]) != O_CH;
-                                               look += OPND(s))
-                                       assert(OP(s) == OOR2);
-                               FWD(aft, aft, look);
-                       }
-                       break;
-               case OOR2:              /* propagate OCH_'s marking */
-                       FWD(aft, aft, 1);
-                       if (OP(g->strip[pc+OPND(s)]) != O_CH) {
-                               assert(OP(g->strip[pc+OPND(s)]) == OOR2);
-                               FWD(aft, aft, OPND(s));
-                       }
-                       break;
-               case O_CH:              /* just empty */
-                       FWD(aft, aft, 1);
-                       break;
-               default:                /* ooooops... */
-                       assert(nope);
-                       break;
-               }
-       }
-
-       return(aft);
-}
-
-#ifdef REDEBUG
-/*
- - print - print a set of states
- == #ifdef REDEBUG
- == static void print(struct match *m, char *caption, states st, \
- ==    int ch, FILE *d);
- == #endif
- */
-static void
-print(
-    struct match *m,
-    char *caption,
-    states st,
-    int ch,
-    FILE *d)
-{
-       struct re_guts *g = m->g;
-       int i;
-       int first = 1;
-
-       _DIAGASSERT(m != NULL);
-       _DIAGASSERT(caption != NULL);
-
-       if (!(m->eflags&REG_TRACE))
-               return;
-
-       _DIAGASSERT(d != NULL);
-
-       fprintf(d, "%s", caption);
-       if (ch != '\0')
-               fprintf(d, " %s", pchar(ch));
-       for (i = 0; i < g->nstates; i++)
-               if (ISSET(st, i)) {
-                       fprintf(d, "%s%d", (first) ? "\t" : ", ", i);
-                       first = 0;
-               }
-       fprintf(d, "\n");
-}
-
-/* 
- - at - print current situation
- == #ifdef REDEBUG
- == static void at(struct match *m, char *title, char *start, char *stop, \
- ==                                            sopno startst, sopno stopst);
- == #endif
- */
-static void
-at(
-    struct match *m,
-    char *title,
-    char *start,
-    char *stop,
-    sopno startst,
-    sopno stopst)
-{
-
-       _DIAGASSERT(m != NULL);
-       _DIAGASSERT(title != NULL);
-       _DIAGASSERT(start != NULL);
-       _DIAGASSERT(stop != NULL);
-
-       if (!(m->eflags&REG_TRACE))
-               return;
-
-       printf("%s %s-", title, pchar(*start));
-       printf("%s ", pchar(*stop));
-       printf("%ld-%ld\n", (long)startst, (long)stopst);
-}
-
-#ifndef PCHARDONE
-#define        PCHARDONE       /* never again */
-/*
- - pchar - make a character printable
- == #ifdef REDEBUG
- == static char *pchar(int ch);
- == #endif
- *
- * Is this identical to regchar() over in debug.c?  Well, yes.  But a
- * duplicate here avoids having a debugging-capable regexec.o tied to
- * a matching debug.o, and this is convenient.  It all disappears in
- * the non-debug compilation anyway, so it doesn't matter much.
- */
-static char *                  /* -> representation */
-pchar(
-    int ch)
-{
-       static char pbuf[10];
-
-       if (isprint(ch) || ch == ' ')
-               (void)snprintf(pbuf, sizeof pbuf, "%c", ch);
-       else
-               (void)snprintf(pbuf, sizeof pbuf, "\\%o", ch);
-       return(pbuf);
-}
-#endif
-#endif
-
-#undef matcher
-#undef fast
-#undef slow
-#undef dissect
-#undef backref
-#undef step
-#undef print
-#undef at
-#undef match
-#undef nope
diff --git a/lib/nbsd_libc/regex/re_format.7 b/lib/nbsd_libc/regex/re_format.7
deleted file mode 100644 (file)
index 2b1ced5..0000000
+++ /dev/null
@@ -1,315 +0,0 @@
-.\"    $NetBSD: re_format.7,v 1.9 2009/04/21 14:46:02 joerg Exp $
-.\"
-.\" Copyright (c) 1992, 1993, 1994
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Henry Spencer.
-.\"
-.\" 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. 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.
-.\"
-.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Henry Spencer.
-.\"
-.\" 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.
-.\"
-.\"    @(#)re_format.7 8.3 (Berkeley) 3/20/94
-.\"
-.Dd March 20, 1994
-.Dt RE_FORMAT 7
-.Os
-.Sh NAME
-.Nm re_format
-.Nd POSIX 1003.2 regular expressions
-.Sh DESCRIPTION
-Regular expressions (``RE''s),
-as defined in POSIX 1003.2, come in two forms:
-modern REs (roughly those of
-.Xr egrep 1 ;
-1003.2 calls these ``extended'' REs)
-and obsolete REs (roughly those of
-.Xr ed 1 ;
-1003.2 ``basic'' REs).
-Obsolete REs mostly exist for backward compatibility in some old programs;
-they will be discussed at the end.
-1003.2 leaves some aspects of RE syntax and semantics open;
-`\(dg' marks decisions on these aspects that
-may not be fully portable to other 1003.2 implementations.
-.Pp
-A (modern) RE is one\(dg or more non-empty\(dg
-.Em branches ,
-separated by `|'.
-It matches anything that matches one of the branches.
-.Pp
-A branch is one\(dg or more
-.Em pieces ,
-concatenated.
-It matches a match for the first, followed by a match for the second, etc.
-.Pp
-A piece is an
-.Em atom
-possibly followed
-by a single\(dg `*', `+', `?', or
-.Em bound .
-An atom followed by `*' matches a sequence of 0 or more matches of the atom.
-An atom followed by `+' matches a sequence of 1 or more matches of the atom.
-An atom followed by `?' matches a sequence of 0 or 1 matches of the atom.
-.Pp
-A
-.Em bound
-is `{' followed by an unsigned decimal integer, possibly followed by `,'
-possibly followed by another unsigned decimal integer,
-always followed by `}'.
-The integers must lie between 0 and RE_DUP_MAX (255\(dg) inclusive,
-and if there are two of them, the first may not exceed the second.
-An atom followed by a bound containing one integer
-.Em i
-and no comma matches a sequence of exactly
-.Em i
-matches of the atom.
-An atom followed by a bound containing one integer
-.Em i
-and a comma matches a sequence of
-.Em i
-or more matches of the atom.
-An atom followed by a bound containing two integers
-.Em i
-and
-.Em j
-matches a sequence of
-.Em i
-through
-.Em j
-(inclusive) matches of the atom.
-.Pp
-An atom is a regular expression enclosed in `()' (matching a match for the
-regular expression), an empty set of `()' (matching the null string)\(dg, a
-.Em bracket expression
-(see below), `.' (matching any single character),
-`^' (matching the null string at the beginning of a line),
-`$' (matching the null string at the end of a line),
-a `\e' followed by one of the characters `^.[$()|*+?{\e'
-(matching that character taken as an ordinary character),
-a `\e' followed by any other character\(dg
-(matching that character taken as an ordinary character,
-as if the `\e' had not been present\(dg),
-or a single character with no other significance (matching that character).
-A `{' followed by a character other than a digit is an ordinary
-character, not the beginning of a bound\(dg.
-It is illegal to end an RE with `\e'.
-.Pp
-A
-.Em bracket expression
-is a list of characters enclosed in `[]'.
-It normally matches any single character from the list (but see below).
-If the list begins with `^',
-it matches any single character (but see below)
-.Em not
-from the rest of the list.
-If two characters in the list are separated by `\-', this is shorthand
-for the full
-.Em range
-of characters between those two (inclusive) in the collating sequence,
-e.g. `[0-9]' in ASCII matches any decimal digit.
-It is illegal\(dg for two ranges to share an endpoint, e.g. `a-c-e'.
-Ranges are very collating-sequence-dependent,
-and portable programs should avoid relying on them.
-.Pp
-To include a literal `]' in the list, make it the first character
-(following a possible `^').
-To include a literal `\-', make it the first or last character,
-or the second endpoint of a range.
-To use a literal `\-' as the first endpoint of a range,
-enclose it in `[.' and `.]' to make it a collating element (see below).
-With the exception of these and some combinations using `[' (see next
-paragraphs), all other special characters, including `\e', lose their
-special significance within a bracket expression.
-.Pp
-Within a bracket expression, a collating element (a character,
-a multi-character sequence that collates as if it were a single character,
-or a collating-sequence name for either)
-enclosed in `[.' and `.]' stands for the
-sequence of characters of that collating element.
-The sequence is a single element of the bracket expression's list.
-A bracket expression containing a multi-character collating element
-can thus match more than one character,
-e.g. if the collating sequence includes a `ch' collating element,
-then the RE `[[.ch.]]*c' matches the first five characters
-of `chchcc'.
-.Pp
-Within a bracket expression, a collating element enclosed in `[=' and
-`=]' is an equivalence class, standing for the sequences of characters
-of all collating elements equivalent to that one, including itself.
-(If there are no other equivalent collating elements,
-the treatment is as if the enclosing delimiters were `[.' and `.]'.)
-For example, if o and '\(^o' are the members of an equivalence class,
-then `[[=o=]]', `[[=\(^o'=]]', and `[o\(^o']' are all synonymous.
-An equivalence class may not\(dg be an endpoint
-of a range.
-.Pp
-Within a bracket expression, the name of a
-.Em character class
-enclosed in `[:' and `:]' stands for the list of all characters
-belonging to that class.
-Standard character class names are:
-.Bl -column "alnum" "digit" "xdigit"
-.It alnum      digit   punct
-.It alpha      graph   space
-.It blank      lower   upper
-.It cntrl      print   xdigit
-.El
-.Pp
-These stand for the character classes defined in
-.Xr ctype 3 .
-A locale may provide others.
-A character class may not be used as an endpoint of a range.
-.Pp
-There are two special cases\(dg of bracket expressions:
-the bracket expressions `[[:\*[Lt]:]]' and `[[:\*[Gt]:]]' match
-the null string at the beginning and end of a word respectively.
-A word is defined as a sequence of word characters
-which is neither preceded nor followed by word characters.
-A word character is an
-.Em alnum
-character (as defined by
-.Xr ctype 3 )
-or an underscore.
-This is an extension, compatible with but not specified by POSIX 1003.2,
-and should be used with caution in software intended to be portable
-to other systems.
-.Pp
-In the event that an RE could match more than one substring of a given
-string, the RE matches the one starting earliest in the string.
-If the RE could match more than one substring starting at that point,
-it matches the longest.
-Subexpressions also match the longest possible substrings, subject to
-the constraint that the whole match be as long as possible,
-with subexpressions starting earlier in the RE taking priority over
-ones starting later.
-Note that higher-level subexpressions thus take priority over
-their lower-level component subexpressions.
-.Pp
-Match lengths are measured in characters, not collating elements.
-A null string is considered longer than no match at all.
-For example,
-`bb*' matches the three middle characters of `abbbc',
-`(wee|week)(knights|nights)' matches all ten characters of `weeknights',
-when `(.*).*' is matched against `abc' the parenthesized subexpression
-matches all three characters, and
-when `(a*)*' is matched against `bc' both the whole RE and the parenthesized
-subexpression match the null string.
-.Pp
-If case-independent matching is specified,
-the effect is much as if all case distinctions had vanished from the
-alphabet.
-When an alphabetic that exists in multiple cases appears as an
-ordinary character outside a bracket expression, it is effectively
-transformed into a bracket expression containing both cases,
-e.g. `x' becomes `[xX]'.
-When it appears inside a bracket expression, all case counterparts
-of it are added to the bracket expression, so that (e.g.) `[x]'
-becomes `[xX]' and `[^x]' becomes `[^xX]'.
-.Pp
-No particular limit is imposed on the length of REs\(dg.
-Programs intended to be portable should not employ REs longer
-than 256 bytes,
-as an implementation can refuse to accept such REs and remain
-POSIX-compliant.
-.Pp
-Obsolete (``basic'') regular expressions differ in several respects.
-`|', `+', and `?' are ordinary characters and there is no equivalent
-for their functionality.
-The delimiters for bounds are `\e{' and `\e}',
-with `{' and `}' by themselves ordinary characters.
-The parentheses for nested subexpressions are `\e(' and `\e)',
-with `(' and `)' by themselves ordinary characters.
-`^' is an ordinary character except at the beginning of the
-RE or\(dg the beginning of a parenthesized subexpression,
-`$' is an ordinary character except at the end of the
-RE or\(dg the end of a parenthesized subexpression,
-and `*' is an ordinary character if it appears at the beginning of the
-RE or the beginning of a parenthesized subexpression
-(after a possible leading `^').
-Finally, there is one new type of atom, a
-.Em back reference :
-`\e' followed by a non-zero decimal digit
-.Em d
-matches the same sequence of characters
-matched by the
-.Em d Ns th parenthesized subexpression
-(numbering subexpressions by the positions of their opening parentheses,
-left to right),
-so that (e.g.) `\e([bc]\e)\e1' matches `bb' or `cc' but not `bc'.
-.Sh SEE ALSO
-.Xr regex 3
-.Pp
-POSIX 1003.2, section 2.8 (Regular Expression Notation).
-.Sh BUGS
-Having two kinds of REs is a botch.
-.Pp
-The current 1003.2 spec says that `)' is an ordinary character in
-the absence of an unmatched `(';
-this was an unintentional result of a wording error, and change is likely.
-Avoid relying on it.
-.Pp
-Back references are a dreadful botch,
-posing major problems for efficient implementations.
-They are also somewhat vaguely defined
-(does `a\e(\e(b\e)*\e2\e)*d' match `abbbd'?).
-Avoid using them.
-.Pp
-1003.2's specification of case-independent matching is vague.
-The ``one case implies all cases'' definition given above
-is current consensus among implementors as to the right interpretation.
-.Pp
-The syntax for word boundaries is incredibly ugly.
diff --git a/lib/nbsd_libc/regex/regcomp.c b/lib/nbsd_libc/regex/regcomp.c
deleted file mode 100644 (file)
index fdaa6ac..0000000
+++ /dev/null
@@ -1,1902 +0,0 @@
-/*     $NetBSD: regcomp.c,v 1.29 2009/02/12 05:06:54 lukem Exp $       */
-
-/*-
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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. 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.
- *
- *     @(#)regcomp.c   8.5 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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.
- *
- *     @(#)regcomp.c   8.5 (Berkeley) 3/20/94
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)regcomp.c  8.5 (Berkeley) 3/20/94";
-#else
-__RCSID("$NetBSD: regcomp.c,v 1.29 2009/02/12 05:06:54 lukem Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <regex.h>
-
-#ifdef __weak_alias
-__weak_alias(regcomp,_regcomp)
-#endif
-
-#include "utils.h"
-#include "regex2.h"
-
-#include "cclass.h"
-#include "cname.h"
-
-/*
- * parse structure, passed up and down to avoid global variables and
- * other clumsinesses
- */
-struct parse {
-       const char *next;       /* next character in RE */
-       const char *end;        /* end of string (-> NUL normally) */
-       int error;              /* has an error been seen? */
-       sop *strip;             /* malloced strip */
-       sopno ssize;            /* malloced strip size (allocated) */
-       sopno slen;             /* malloced strip length (used) */
-       int ncsalloc;           /* number of csets allocated */
-       struct re_guts *g;
-#      define  NPAREN  10      /* we need to remember () 1-9 for back refs */
-       sopno pbegin[NPAREN];   /* -> ( ([0] unused) */
-       sopno pend[NPAREN];     /* -> ) ([0] unused) */
-};
-
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regcomp.c === */
-static void p_ere(struct parse *p, int stop);
-static void p_ere_exp(struct parse *p);
-static void p_str(struct parse *p);
-static void p_bre(struct parse *p, int end1, int end2);
-static int p_simp_re(struct parse *p, int starordinary);
-static int p_count(struct parse *p);
-static void p_bracket(struct parse *p);
-static void p_b_term(struct parse *p, cset *cs);
-static void p_b_cclass(struct parse *p, cset *cs);
-static void p_b_eclass(struct parse *p, cset *cs);
-static char p_b_symbol(struct parse *p);
-static char p_b_coll_elem(struct parse *p, int endc);
-static int othercase(int ch);
-static void bothcases(struct parse *p, int ch);
-static void ordinary(struct parse *p, int ch);
-static void nonnewline(struct parse *p);
-static void repeat(struct parse *p, sopno start, int from, int to);
-static int seterr(struct parse *p, int e);
-static cset *allocset(struct parse *p);
-static void freeset(struct parse *p, cset *cs);
-static int freezeset(struct parse *p, cset *cs);
-static int firstch(struct parse *p, cset *cs);
-static int nch(struct parse *p, cset *cs);
-static void mcadd(struct parse *p, cset *cs, const char *cp);
-#if 0
-static void mcsub(cset *cs, char *cp);
-static int mcin(cset *cs, char *cp);
-static char *mcfind(cset *cs, char *cp);
-#endif
-static void mcinvert(struct parse *p, cset *cs);
-static void mccase(struct parse *p, cset *cs);
-static int isinsets(struct re_guts *g, int c);
-static int samesets(struct re_guts *g, int c1, int c2);
-static void categorize(struct parse *p, struct re_guts *g);
-static sopno dupl(struct parse *p, sopno start, sopno finish);
-static void doemit(struct parse *p, sop op, sopno opnd);
-static void doinsert(struct parse *p, sop op, sopno opnd, sopno pos);
-static void dofwd(struct parse *p, sopno pos, sopno value);
-static void enlarge(struct parse *p, sopno size);
-static void stripsnug(struct parse *p, struct re_guts *g);
-static void findmust(struct parse *p, struct re_guts *g);
-static sopno pluscount(struct parse *p, struct re_guts *g);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
-
-static char nuls[10];          /* place to point scanner in event of error */
-
-/*
- * macros for use with parse structure
- * BEWARE:  these know that the parse structure is named `p' !!!
- */
-#define        PEEK()  (*p->next)
-#define        PEEK2() (*(p->next+1))
-#define        MORE()  (p->next < p->end)
-#define        MORE2() (p->next+1 < p->end)
-#define        SEE(c)  (MORE() && PEEK() == (c))
-#define        SEETWO(a, b)    (MORE() && MORE2() && PEEK() == (a) && PEEK2() == (b))
-#define        EAT(c)  ((SEE(c)) ? (NEXT(), 1) : 0)
-#define        EATTWO(a, b)    ((SEETWO(a, b)) ? (NEXT2(), 1) : 0)
-#define        NEXT()  (p->next++)
-#define        NEXT2() (p->next += 2)
-#define        NEXTn(n)        (p->next += (n))
-#define        GETNEXT()       (*p->next++)
-#define        SETERROR(e)     seterr(p, (e))
-#define        REQUIRE(co, e)  (void) ((co) || SETERROR(e))
-#define        MUSTSEE(c, e)   (REQUIRE(MORE() && PEEK() == (c), e))
-#define        MUSTEAT(c, e)   (void) (REQUIRE(MORE() && GETNEXT() == (c), e))
-#define        MUSTNOTSEE(c, e)        (REQUIRE(!MORE() || PEEK() != (c), e))
-#define        EMIT(op, sopnd) doemit(p, (sop)(op), sopnd)
-#define        INSERT(op, pos) doinsert(p, (sop)(op), HERE()-(pos)+1, pos)
-#define        AHEAD(pos)              dofwd(p, pos, HERE()-(pos))
-#define        ASTERN(sop, pos)        EMIT(sop, HERE()-pos)
-#define        HERE()          (p->slen)
-#define        THERE()         (p->slen - 1)
-#define        THERETHERE()    (p->slen - 2)
-#define        DROP(n) (p->slen -= (n))
-
-#ifndef NDEBUG
-static int never = 0;          /* for use in asserts; shuts lint up */
-#else
-#define        never   0               /* some <assert.h>s have bugs too */
-#endif
-
-/*
- - regcomp - interface for parser and compilation
- = extern int regcomp(regex_t *, const char *, int);
- = #define     REG_BASIC       0000
- = #define     REG_EXTENDED    0001
- = #define     REG_ICASE       0002
- = #define     REG_NOSUB       0004
- = #define     REG_NEWLINE     0010
- = #define     REG_NOSPEC      0020
- = #define     REG_PEND        0040
- = #define     REG_DUMP        0200
- */
-int                            /* 0 success, otherwise REG_something */
-regcomp(
-    regex_t *preg,
-    const char *pattern,
-    int cflags)
-{
-       struct parse pa;
-       struct re_guts *g;
-       struct parse *p = &pa;
-       int i;
-       size_t len;
-#ifdef REDEBUG
-#      define  GOODFLAGS(f)    (f)
-#else
-#      define  GOODFLAGS(f)    ((f)&~REG_DUMP)
-#endif
-
-       _DIAGASSERT(preg != NULL);
-       _DIAGASSERT(pattern != NULL);
-
-       cflags = GOODFLAGS(cflags);
-       if ((cflags&REG_EXTENDED) && (cflags&REG_NOSPEC))
-               return(REG_INVARG);
-
-       if (cflags&REG_PEND) {
-               if (preg->re_endp < pattern)
-                       return(REG_INVARG);
-               len = preg->re_endp - pattern;
-       } else
-               len = strlen(pattern);
-
-       /* do the mallocs early so failure handling is easy */
-       g = (struct re_guts *)malloc(sizeof(struct re_guts) +
-                                                       (NC-1)*sizeof(cat_t));
-       if (g == NULL)
-               return(REG_ESPACE);
-       p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
-       p->strip = (sop *)malloc(p->ssize * sizeof(sop));
-       p->slen = 0;
-       if (p->strip == NULL) {
-               free(g);
-               return(REG_ESPACE);
-       }
-
-       /* set things up */
-       p->g = g;
-       p->next = pattern;
-       p->end = p->next + len;
-       p->error = 0;
-       p->ncsalloc = 0;
-       for (i = 0; i < NPAREN; i++) {
-               p->pbegin[i] = 0;
-               p->pend[i] = 0;
-       }
-       g->csetsize = NC;
-       g->sets = NULL;
-       g->setbits = NULL;
-       g->ncsets = 0;
-       g->cflags = cflags;
-       g->iflags = 0;
-       g->nbol = 0;
-       g->neol = 0;
-       g->must = NULL;
-       g->mlen = 0;
-       g->nsub = 0;
-       g->ncategories = 1;     /* category 0 is "everything else" */
-       g->categories = &g->catspace[-(CHAR_MIN)];
-       (void) memset((char *)g->catspace, 0, NC*sizeof(cat_t));
-       g->backrefs = 0;
-
-       /* do it */
-       EMIT(OEND, 0);
-       g->firststate = THERE();
-       if (cflags&REG_EXTENDED)
-               p_ere(p, OUT);
-       else if (cflags&REG_NOSPEC)
-               p_str(p);
-       else
-               p_bre(p, OUT, OUT);
-       EMIT(OEND, 0);
-       g->laststate = THERE();
-
-       /* tidy up loose ends and fill things in */
-       categorize(p, g);
-       stripsnug(p, g);
-       findmust(p, g);
-       g->nplus = pluscount(p, g);
-       g->magic = MAGIC2;
-       preg->re_nsub = g->nsub;
-       preg->re_g = g;
-       preg->re_magic = MAGIC1;
-#ifndef REDEBUG
-       /* not debugging, so can't rely on the assert() in regexec() */
-       if (g->iflags&BAD)
-               SETERROR(REG_ASSERT);
-#endif
-
-       /* win or lose, we're done */
-       if (p->error != 0)      /* lose */
-               regfree(preg);
-       return(p->error);
-}
-
-/*
- - p_ere - ERE parser top level, concatenation and alternation
- == static void p_ere(struct parse *p, int stop);
- */
-static void
-p_ere(
-    struct parse *p,
-    int stop)                  /* character this ERE should end at */
-{
-       char c;
-       sopno prevback = 0;     /* pacify gcc */
-       sopno prevfwd = 0;      /* pacify gcc */
-       sopno conc;
-       int first = 1;          /* is this the first alternative? */
-
-       _DIAGASSERT(p != NULL);
-
-       for (;;) {
-               /* do a bunch of concatenated expressions */
-               conc = HERE();
-               while (MORE() && (c = PEEK()) != '|' && c != stop)
-                       p_ere_exp(p);
-               REQUIRE(HERE() != conc, REG_EMPTY);     /* require nonempty */
-
-               if (!EAT('|'))
-                       break;          /* NOTE BREAK OUT */
-
-               if (first) {
-                       INSERT(OCH_, conc);     /* offset is wrong */
-                       prevfwd = conc;
-                       prevback = conc;
-                       first = 0;
-               }
-               ASTERN(OOR1, prevback);
-               prevback = THERE();
-               AHEAD(prevfwd);                 /* fix previous offset */
-               prevfwd = HERE();
-               EMIT(OOR2, 0);                  /* offset is very wrong */
-       }
-
-       if (!first) {           /* tail-end fixups */
-               AHEAD(prevfwd);
-               ASTERN(O_CH, prevback);
-       }
-
-       assert(!MORE() || SEE(stop));
-}
-
-/*
- - p_ere_exp - parse one subERE, an atom possibly followed by a repetition op
- == static void p_ere_exp(struct parse *p);
- */
-static void
-p_ere_exp(
-    struct parse *p)
-{
-       char c;
-       sopno pos;
-       int count;
-       int count2;
-       sopno subno;
-       int wascaret = 0;
-
-       _DIAGASSERT(p != NULL);
-
-       assert(MORE());         /* caller should have ensured this */
-       c = GETNEXT();
-
-       pos = HERE();
-       switch (c) {
-       case '(':
-               REQUIRE(MORE(), REG_EPAREN);
-               p->g->nsub++;
-               subno = p->g->nsub;
-               if (subno < NPAREN)
-                       p->pbegin[subno] = HERE();
-               EMIT(OLPAREN, subno);
-               if (!SEE(')'))
-                       p_ere(p, ')');
-               if (subno < NPAREN) {
-                       p->pend[subno] = HERE();
-                       assert(p->pend[subno] != 0);
-               }
-               EMIT(ORPAREN, subno);
-               MUSTEAT(')', REG_EPAREN);
-               break;
-#ifndef POSIX_MISTAKE
-       case ')':               /* happens only if no current unmatched ( */
-               /*
-                * You may ask, why the ifndef?  Because I didn't notice
-                * this until slightly too late for 1003.2, and none of the
-                * other 1003.2 regular-expression reviewers noticed it at
-                * all.  So an unmatched ) is legal POSIX, at least until
-                * we can get it fixed.
-                */
-               SETERROR(REG_EPAREN);
-               break;
-#endif
-       case '^':
-               EMIT(OBOL, 0);
-               p->g->iflags |= USEBOL;
-               p->g->nbol++;
-               wascaret = 1;
-               break;
-       case '$':
-               EMIT(OEOL, 0);
-               p->g->iflags |= USEEOL;
-               p->g->neol++;
-               break;
-       case '|':
-               SETERROR(REG_EMPTY);
-               break;
-       case '*':
-       case '+':
-       case '?':
-               SETERROR(REG_BADRPT);
-               break;
-       case '.':
-               if (p->g->cflags&REG_NEWLINE)
-                       nonnewline(p);
-               else
-                       EMIT(OANY, 0);
-               break;
-       case '[':
-               p_bracket(p);
-               break;
-       case '\\':
-               REQUIRE(MORE(), REG_EESCAPE);
-               c = GETNEXT();
-               ordinary(p, c);
-               break;
-       case '{':               /* okay as ordinary except if digit follows */
-               REQUIRE(!MORE() || !isdigit((unsigned char)PEEK()), REG_BADRPT);
-               /* FALLTHROUGH */
-       default:
-               ordinary(p, c);
-               break;
-       }
-
-       if (!MORE())
-               return;
-       c = PEEK();
-       /* we call { a repetition if followed by a digit */
-       if (!( c == '*' || c == '+' || c == '?' ||
-           (c == '{' && MORE2() && isdigit((unsigned char)PEEK2())) ))
-               return;         /* no repetition, we're done */
-       NEXT();
-
-       REQUIRE(!wascaret, REG_BADRPT);
-       switch (c) {
-       case '*':       /* implemented as +? */
-               /* this case does not require the (y|) trick, noKLUDGE */
-               INSERT(OPLUS_, pos);
-               ASTERN(O_PLUS, pos);
-               INSERT(OQUEST_, pos);
-               ASTERN(O_QUEST, pos);
-               break;
-       case '+':
-               INSERT(OPLUS_, pos);
-               ASTERN(O_PLUS, pos);
-               break;
-       case '?':
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, pos);              /* offset slightly wrong */
-               ASTERN(OOR1, pos);              /* this one's right */
-               AHEAD(pos);                     /* fix the OCH_ */
-               EMIT(OOR2, 0);                  /* offset very wrong... */
-               AHEAD(THERE());                 /* ...so fix it */
-               ASTERN(O_CH, THERETHERE());
-               break;
-       case '{':
-               count = p_count(p);
-               if (EAT(',')) {
-                       if (isdigit((unsigned char)PEEK())) {
-                               count2 = p_count(p);
-                               REQUIRE(count <= count2, REG_BADBR);
-                       } else          /* single number with comma */
-                               count2 = INFINITY;
-               } else          /* just a single number */
-                       count2 = count;
-               repeat(p, pos, count, count2);
-               if (!EAT('}')) {        /* error heuristics */
-                       while (MORE() && PEEK() != '}')
-                               NEXT();
-                       REQUIRE(MORE(), REG_EBRACE);
-                       SETERROR(REG_BADBR);
-               }
-               break;
-       }
-
-       if (!MORE())
-               return;
-       c = PEEK();
-       if (!( c == '*' || c == '+' || c == '?' ||
-           (c == '{' && MORE2() && isdigit((unsigned char)PEEK2())) ) )
-               return;
-       SETERROR(REG_BADRPT);
-}
-
-/*
- - p_str - string (no metacharacters) "parser"
- == static void p_str(struct parse *p);
- */
-static void
-p_str(
-    struct parse *p)
-{
-
-       _DIAGASSERT(p != NULL);
-
-       REQUIRE(MORE(), REG_EMPTY);
-       while (MORE())
-               ordinary(p, GETNEXT());
-}
-
-/*
- - p_bre - BRE parser top level, anchoring and concatenation
- == static void p_bre(struct parse *p, int end1, \
- ==    int end2);
- * Giving end1 as OUT essentially eliminates the end1/end2 check.
- *
- * This implementation is a bit of a kludge, in that a trailing $ is first
- * taken as an ordinary character and then revised to be an anchor.  The
- * only undesirable side effect is that '$' gets included as a character
- * category in such cases.  This is fairly harmless; not worth fixing.
- * The amount of lookahead needed to avoid this kludge is excessive.
- */
-static void
-p_bre(
-    struct parse *p,
-    int end1,          /* first terminating character */
-    int end2)          /* second terminating character */
-{
-       sopno start;
-       int first = 1;                  /* first subexpression? */
-       int wasdollar = 0;
-
-       _DIAGASSERT(p != NULL);
-
-       start = HERE();
-
-       if (EAT('^')) {
-               EMIT(OBOL, 0);
-               p->g->iflags |= USEBOL;
-               p->g->nbol++;
-       }
-       while (MORE() && !SEETWO(end1, end2)) {
-               wasdollar = p_simp_re(p, first);
-               first = 0;
-       }
-       if (wasdollar) {        /* oops, that was a trailing anchor */
-               DROP(1);
-               EMIT(OEOL, 0);
-               p->g->iflags |= USEEOL;
-               p->g->neol++;
-       }
-
-       REQUIRE(HERE() != start, REG_EMPTY);    /* require nonempty */
-}
-
-/*
- - p_simp_re - parse a simple RE, an atom possibly followed by a repetition
- == static int p_simp_re(struct parse *p, int starordinary);
- */
-static int                     /* was the simple RE an unbackslashed $? */
-p_simp_re(
-    struct parse *p,
-    int starordinary)          /* is a leading * an ordinary character? */
-{
-       int c;
-       int count;
-       int count2;
-       sopno pos;
-       int i;
-       sopno subno;
-#      define  BACKSL  (1<<CHAR_BIT)
-
-       _DIAGASSERT(p != NULL);
-
-       pos = HERE();           /* repetion op, if any, covers from here */
-
-       assert(MORE());         /* caller should have ensured this */
-       c = GETNEXT();
-       if (c == '\\') {
-               REQUIRE(MORE(), REG_EESCAPE);
-               c = BACKSL | (unsigned char)GETNEXT();
-       }
-       switch (c) {
-       case '.':
-               if (p->g->cflags&REG_NEWLINE)
-                       nonnewline(p);
-               else
-                       EMIT(OANY, 0);
-               break;
-       case '[':
-               p_bracket(p);
-               break;
-       case BACKSL|'{':
-               SETERROR(REG_BADRPT);
-               break;
-       case BACKSL|'(':
-               p->g->nsub++;
-               subno = p->g->nsub;
-               if (subno < NPAREN)
-                       p->pbegin[subno] = HERE();
-               EMIT(OLPAREN, subno);
-               /* the MORE here is an error heuristic */
-               if (MORE() && !SEETWO('\\', ')'))
-                       p_bre(p, '\\', ')');
-               if (subno < NPAREN) {
-                       p->pend[subno] = HERE();
-                       assert(p->pend[subno] != 0);
-               }
-               EMIT(ORPAREN, subno);
-               REQUIRE(EATTWO('\\', ')'), REG_EPAREN);
-               break;
-       case BACKSL|')':        /* should not get here -- must be user */
-       case BACKSL|'}':
-               SETERROR(REG_EPAREN);
-               break;
-       case BACKSL|'1':
-       case BACKSL|'2':
-       case BACKSL|'3':
-       case BACKSL|'4':
-       case BACKSL|'5':
-       case BACKSL|'6':
-       case BACKSL|'7':
-       case BACKSL|'8':
-       case BACKSL|'9':
-               i = (c&~BACKSL) - '0';
-               assert(i < NPAREN);
-               if (p->pend[i] != 0) {
-                       assert(i <= p->g->nsub);
-                       EMIT(OBACK_, i);
-                       assert(p->pbegin[i] != 0);
-                       assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
-                       assert(OP(p->strip[p->pend[i]]) == ORPAREN);
-                       (void) dupl(p, p->pbegin[i]+1, p->pend[i]);
-                       EMIT(O_BACK, i);
-               } else
-                       SETERROR(REG_ESUBREG);
-               p->g->backrefs = 1;
-               break;
-       case '*':
-               REQUIRE(starordinary, REG_BADRPT);
-               /* FALLTHROUGH */
-       default:
-               ordinary(p, c &~ BACKSL);
-               break;
-       }
-
-       if (EAT('*')) {         /* implemented as +? */
-               /* this case does not require the (y|) trick, noKLUDGE */
-               INSERT(OPLUS_, pos);
-               ASTERN(O_PLUS, pos);
-               INSERT(OQUEST_, pos);
-               ASTERN(O_QUEST, pos);
-       } else if (EATTWO('\\', '{')) {
-               count = p_count(p);
-               if (EAT(',')) {
-                       if (MORE() && isdigit((unsigned char)PEEK())) {
-                               count2 = p_count(p);
-                               REQUIRE(count <= count2, REG_BADBR);
-                       } else          /* single number with comma */
-                               count2 = INFINITY;
-               } else          /* just a single number */
-                       count2 = count;
-               repeat(p, pos, count, count2);
-               if (!EATTWO('\\', '}')) {       /* error heuristics */
-                       while (MORE() && !SEETWO('\\', '}'))
-                               NEXT();
-                       REQUIRE(MORE(), REG_EBRACE);
-                       SETERROR(REG_BADBR);
-               }
-       } else if (c == (unsigned char)'$')     /* $ (but not \$) ends it */
-               return(1);
-
-       return(0);
-}
-
-/*
- - p_count - parse a repetition count
- == static int p_count(struct parse *p);
- */
-static int                     /* the value */
-p_count(
-    struct parse *p)
-{
-       int count = 0;
-       int ndigits = 0;
-
-       _DIAGASSERT(p != NULL);
-
-       while (MORE() && isdigit((unsigned char)PEEK()) && count <= DUPMAX) {
-               count = count*10 + (GETNEXT() - '0');
-               ndigits++;
-       }
-
-       REQUIRE(ndigits > 0 && count <= DUPMAX, REG_BADBR);
-       return(count);
-}
-
-/*
- - p_bracket - parse a bracketed character list
- == static void p_bracket(struct parse *p);
- *
- * Note a significant property of this code:  if the allocset() did SETERROR,
- * no set operations are done.
- */
-static void
-p_bracket(
-    struct parse *p)
-{
-       cset *cs;
-       int invert = 0;
-
-       _DIAGASSERT(p != NULL);
-
-       cs = allocset(p);
-
-       /* Dept of Truly Sickening Special-Case Kludges */
-       if (p->next + 5 < p->end && strncmp(p->next, "[:<:]]",
-                                           (size_t)6) == 0) {
-               EMIT(OBOW, 0);
-               NEXTn(6);
-               return;
-       }
-       if (p->next + 5 < p->end && strncmp(p->next, "[:>:]]",
-                                           (size_t)6) == 0) {
-               EMIT(OEOW, 0);
-               NEXTn(6);
-               return;
-       }
-
-       if (EAT('^'))
-               invert++;       /* make note to invert set at end */
-       if (EAT(']'))
-               CHadd(cs, ']');
-       else if (EAT('-'))
-               CHadd(cs, '-');
-       while (MORE() && PEEK() != ']' && !SEETWO('-', ']'))
-               p_b_term(p, cs);
-       if (EAT('-'))
-               CHadd(cs, '-');
-       MUSTEAT(']', REG_EBRACK);
-
-       if (p->error != 0)      /* don't mess things up further */
-               return;
-
-       if (p->g->cflags&REG_ICASE) {
-               int i;
-               int ci;
-
-               for (i = p->g->csetsize - 1; i >= 0; i--)
-                       if (CHIN(cs, i) && isalpha(i)) {
-                               ci = othercase(i);
-                               if (ci != i)
-                                       CHadd(cs, ci);
-                       }
-               if (cs->multis != NULL)
-                       mccase(p, cs);
-       }
-       if (invert) {
-               int i;
-
-               for (i = p->g->csetsize - 1; i >= 0; i--)
-                       if (CHIN(cs, i))
-                               CHsub(cs, i);
-                       else
-                               CHadd(cs, i);
-               if (p->g->cflags&REG_NEWLINE)
-                       CHsub(cs, '\n');
-               if (cs->multis != NULL)
-                       mcinvert(p, cs);
-       }
-
-       assert(cs->multis == NULL);             /* xxx */
-
-       if (nch(p, cs) == 1) {          /* optimize singleton sets */
-               ordinary(p, firstch(p, cs));
-               freeset(p, cs);
-       } else
-               EMIT(OANYOF, freezeset(p, cs));
-}
-
-/*
- - p_b_term - parse one term of a bracketed character list
- == static void p_b_term(struct parse *p, cset *cs);
- */
-static void
-p_b_term(
-    struct parse *p,
-    cset *cs)
-{
-       char c;
-       char start, finish;
-       int i;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(cs != NULL);
-
-       /* classify what we've got */
-       switch ((MORE()) ? PEEK() : '\0') {
-       case '[':
-               c = (MORE2()) ? PEEK2() : '\0';
-               break;
-
-       case '-':
-               SETERROR(REG_ERANGE);
-               return;                 /* NOTE RETURN */
-
-       default:
-               c = '\0';
-               break;
-       }
-
-       switch (c) {
-       case ':':               /* character class */
-               NEXT2();
-               REQUIRE(MORE(), REG_EBRACK);
-               c = PEEK();
-               REQUIRE(c != '-' && c != ']', REG_ECTYPE);
-               p_b_cclass(p, cs);
-               REQUIRE(MORE(), REG_EBRACK);
-               REQUIRE(EATTWO(':', ']'), REG_ECTYPE);
-               break;
-       case '=':               /* equivalence class */
-               NEXT2();
-               REQUIRE(MORE(), REG_EBRACK);
-               c = PEEK();
-               REQUIRE(c != '-' && c != ']', REG_ECOLLATE);
-               p_b_eclass(p, cs);
-               REQUIRE(MORE(), REG_EBRACK);
-               REQUIRE(EATTWO('=', ']'), REG_ECOLLATE);
-               break;
-       default:                /* symbol, ordinary character, or range */
-/* xxx revision needed for multichar stuff */
-               start = p_b_symbol(p);
-               if (SEE('-') && MORE2() && PEEK2() != ']') {
-                       /* range */
-                       NEXT();
-                       if (EAT('-'))
-                               finish = '-';
-                       else
-                               finish = p_b_symbol(p);
-               } else
-                       finish = start;
-/* xxx what about signed chars here... */
-               REQUIRE(start <= finish, REG_ERANGE);
-               for (i = start; i <= finish; i++)
-                       CHadd(cs, i);
-               break;
-       }
-}
-
-/*
- - p_b_cclass - parse a character-class name and deal with it
- == static void p_b_cclass(struct parse *p, cset *cs);
- */
-static void
-p_b_cclass(
-    struct parse *p,
-    cset *cs)
-{
-       const char *sp;
-       const struct cclass *cp;
-       size_t len;
-       const char *u;
-       char c;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(cs != NULL);
-
-       sp = p->next;
-
-       while (MORE() && isalpha((unsigned char)PEEK()))
-               NEXT();
-       len = p->next - sp;
-       for (cp = cclasses; cp->name != NULL; cp++)
-               if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
-                       break;
-       if (cp->name == NULL) {
-               /* oops, didn't find it */
-               SETERROR(REG_ECTYPE);
-               return;
-       }
-
-       u = cp->chars;
-       while ((c = *u++) != '\0')
-               CHadd(cs, c);
-       for (u = cp->multis; *u != '\0'; u += strlen(u) + 1)
-               MCadd(p, cs, u);
-}
-
-/*
- - p_b_eclass - parse an equivalence-class name and deal with it
- == static void p_b_eclass(struct parse *p, cset *cs);
- *
- * This implementation is incomplete. xxx
- */
-static void
-p_b_eclass(
-    struct parse *p,
-    cset *cs)
-{
-       char c;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(cs != NULL);
-
-       c = p_b_coll_elem(p, '=');
-       CHadd(cs, c);
-}
-
-/*
- - p_b_symbol - parse a character or [..]ed multicharacter collating symbol
- == static char p_b_symbol(struct parse *p);
- */
-static char                    /* value of symbol */
-p_b_symbol(
-    struct parse *p)
-{
-       char value;
-
-       _DIAGASSERT(p != NULL);
-
-       REQUIRE(MORE(), REG_EBRACK);
-       if (!EATTWO('[', '.'))
-               return(GETNEXT());
-
-       /* collating symbol */
-       value = p_b_coll_elem(p, '.');
-       REQUIRE(EATTWO('.', ']'), REG_ECOLLATE);
-       return(value);
-}
-
-/*
- - p_b_coll_elem - parse a collating-element name and look it up
- == static char p_b_coll_elem(struct parse *p, int endc);
- */
-static char                    /* value of collating element */
-p_b_coll_elem(
-    struct parse *p,
-    int endc)                  /* name ended by endc,']' */
-{
-       const char *sp;
-       const struct cname *cp;
-       size_t len;
-
-       _DIAGASSERT(p != NULL);
-
-       sp = p->next;
-
-       while (MORE() && !SEETWO(endc, ']'))
-               NEXT();
-       if (!MORE()) {
-               SETERROR(REG_EBRACK);
-               return(0);
-       }
-       len = p->next - sp;
-       for (cp = cnames; cp->name != NULL; cp++)
-               if (strncmp(cp->name, sp, len) == 0 && cp->name[len] == '\0')
-                       return(cp->code);       /* known name */
-       if (len == 1)
-               return(*sp);    /* single character */
-       SETERROR(REG_ECOLLATE);                 /* neither */
-       return(0);
-}
-
-/*
- - othercase - return the case counterpart of an alphabetic
- == static int othercase(int ch);
- */
-static int                     /* if no counterpart, return ch */
-othercase(
-    int ch)
-{
-       assert(isalpha(ch));
-       if (isupper(ch))
-               return(tolower(ch));
-       else if (islower(ch))
-               return(toupper(ch));
-       else                    /* peculiar, but could happen */
-               return(ch);
-}
-
-/*
- - bothcases - emit a dualcase version of a two-case character
- == static void bothcases(struct parse *p, int ch);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-bothcases(
-    struct parse *p,
-    int ch)
-{
-       const char *oldnext;
-       const char *oldend;
-       char bracket[3];
-
-       _DIAGASSERT(p != NULL);
-
-       oldnext = p->next;
-       oldend = p->end;
-
-       assert(othercase(ch) != ch);    /* p_bracket() would recurse */
-       p->next = bracket;
-       p->end = bracket+2;
-       bracket[0] = ch;
-       bracket[1] = ']';
-       bracket[2] = '\0';
-       p_bracket(p);
-       assert(p->next == bracket+2);
-       p->next = oldnext;
-       p->end = oldend;
-}
-
-/*
- - ordinary - emit an ordinary character
- == static void ordinary(struct parse *p, int ch);
- */
-static void
-ordinary(
-    struct parse *p,
-    int ch)
-{
-       cat_t *cap;
-
-       _DIAGASSERT(p != NULL);
-
-       cap = p->g->categories;
-       if ((p->g->cflags&REG_ICASE) && isalpha((unsigned char) ch)
-           && othercase((unsigned char) ch) != (unsigned char) ch)
-               bothcases(p, (unsigned char) ch);
-       else {
-               EMIT(OCHAR, (unsigned char)ch);
-               if (cap[ch] == 0)
-                       cap[ch] = p->g->ncategories++;
-       }
-}
-
-/*
- - nonnewline - emit REG_NEWLINE version of OANY
- == static void nonnewline(struct parse *p);
- *
- * Boy, is this implementation ever a kludge...
- */
-static void
-nonnewline(
-    struct parse *p)
-{
-       const char *oldnext;
-       const char *oldend;
-       char bracket[4];
-
-       _DIAGASSERT(p != NULL);
-
-       oldnext = p->next;
-       oldend = p->end;
-
-       p->next = bracket;
-       p->end = bracket+3;
-       bracket[0] = '^';
-       bracket[1] = '\n';
-       bracket[2] = ']';
-       bracket[3] = '\0';
-       p_bracket(p);
-       assert(p->next == bracket+3);
-       p->next = oldnext;
-       p->end = oldend;
-}
-
-/*
- - repeat - generate code for a bounded repetition, recursively if needed
- == static void repeat(struct parse *p, sopno start, int from, int to);
- */
-static void
-repeat(
-    struct parse *p,
-    sopno start,               /* operand from here to end of strip */
-    int from,                  /* repeated from this number */
-    int to)                    /* to this number of times (maybe INFINITY) */
-{
-       sopno finish;
-#      define  N       2
-#      define  INF     3
-#      define  REP(f, t)       ((f)*8 + (t))
-#      define  MAP(n)  (((n) <= 1) ? (n) : ((n) == INFINITY) ? INF : N)
-       sopno copy;
-
-       _DIAGASSERT(p != NULL);
-
-       finish = HERE();
-
-       if (p->error != 0)      /* head off possible runaway recursion */
-               return;
-
-       assert(from <= to);
-
-       switch (REP(MAP(from), MAP(to))) {
-       case REP(0, 0):                 /* must be user doing this */
-               DROP(finish-start);     /* drop the operand */
-               break;
-       case REP(0, 1):                 /* as x{1,1}? */
-       case REP(0, N):                 /* as x{1,n}? */
-       case REP(0, INF):               /* as x{1,}? */
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, start);            /* offset is wrong... */
-               repeat(p, start+1, 1, to);
-               ASTERN(OOR1, start);
-               AHEAD(start);                   /* ... fix it */
-               EMIT(OOR2, 0);
-               AHEAD(THERE());
-               ASTERN(O_CH, THERETHERE());
-               break;
-       case REP(1, 1):                 /* trivial case */
-               /* done */
-               break;
-       case REP(1, N):                 /* as x?x{1,n-1} */
-               /* KLUDGE: emit y? as (y|) until subtle bug gets fixed */
-               INSERT(OCH_, start);
-               ASTERN(OOR1, start);
-               AHEAD(start);
-               EMIT(OOR2, 0);                  /* offset very wrong... */
-               AHEAD(THERE());                 /* ...so fix it */
-               ASTERN(O_CH, THERETHERE());
-               copy = dupl(p, start+1, finish+1);
-               assert(copy == finish+4);
-               repeat(p, copy, 1, to-1);
-               break;
-       case REP(1, INF):               /* as x+ */
-               INSERT(OPLUS_, start);
-               ASTERN(O_PLUS, start);
-               break;
-       case REP(N, N):                 /* as xx{m-1,n-1} */
-               copy = dupl(p, start, finish);
-               repeat(p, copy, from-1, to-1);
-               break;
-       case REP(N, INF):               /* as xx{n-1,INF} */
-               copy = dupl(p, start, finish);
-               repeat(p, copy, from-1, to);
-               break;
-       default:                        /* "can't happen" */
-               SETERROR(REG_ASSERT);   /* just in case */
-               break;
-       }
-}
-
-/*
- - seterr - set an error condition
- == static int seterr(struct parse *p, int e);
- */
-static int                     /* useless but makes type checking happy */
-seterr(
-    struct parse *p,
-    int e)
-{
-
-       _DIAGASSERT(p != NULL);
-
-       if (p->error == 0)      /* keep earliest error condition */
-               p->error = e;
-       p->next = nuls;         /* try to bring things to a halt */
-       p->end = nuls;
-       return(0);              /* make the return value well-defined */
-}
-
-/*
- - allocset - allocate a set of characters for []
- == static cset *allocset(struct parse *p);
- */
-static cset *
-allocset(
-    struct parse *p)
-{
-       int no;
-       size_t nc;
-       size_t nbytes;
-       cset *cs;
-       size_t css;
-       int i;
-
-       _DIAGASSERT(p != NULL);
-
-       no = p->g->ncsets++;
-       css = (size_t)p->g->csetsize;
-       if (no >= p->ncsalloc) {        /* need another column of space */
-               p->ncsalloc += CHAR_BIT;
-               nc = p->ncsalloc;
-               assert(nc % CHAR_BIT == 0);
-               nbytes = nc / CHAR_BIT * css;
-               if (p->g->sets == NULL)
-                       p->g->sets = malloc(nc * sizeof(cset));
-               else
-                       p->g->sets = realloc(p->g->sets, nc * sizeof(cset));
-               if (p->g->setbits == NULL)
-                       p->g->setbits = malloc(nbytes);
-               else {
-                       p->g->setbits = realloc(p->g->setbits, nbytes);
-                       /* xxx this isn't right if setbits is now NULL */
-                       for (i = 0; i < no; i++)
-                               p->g->sets[i].ptr = p->g->setbits + css*(i/CHAR_BIT);
-               }
-               if (p->g->sets != NULL && p->g->setbits != NULL)
-                       (void) memset((char *)p->g->setbits + (nbytes - css),
-                                                               0, css);
-               else {
-                       no = 0;
-                       SETERROR(REG_ESPACE);
-                       /* caller's responsibility not to do set ops */
-               }
-       }
-
-       assert(p->g->sets != NULL);     /* xxx */
-       cs = &p->g->sets[no];
-       cs->ptr = p->g->setbits + css*((no)/CHAR_BIT);
-       cs->mask = 1 << ((no) % CHAR_BIT);
-       cs->hash = 0;
-       cs->smultis = 0;
-       cs->multis = NULL;
-
-       return(cs);
-}
-
-/*
- - freeset - free a now-unused set
- == static void freeset(struct parse *p, cset *cs);
- */
-static void
-freeset(
-    struct parse *p,
-    cset *cs)
-{
-       size_t i;
-       cset *top;
-       size_t css;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(cs != NULL);
-
-       top = &p->g->sets[p->g->ncsets];
-       css = (size_t)p->g->csetsize;
-
-       for (i = 0; i < css; i++)
-               CHsub(cs, i);
-       if (cs == top-1)        /* recover only the easy case */
-               p->g->ncsets--;
-}
-
-/*
- - freezeset - final processing on a set of characters
- == static int freezeset(struct parse *p, cset *cs);
- *
- * The main task here is merging identical sets.  This is usually a waste
- * of time (although the hash code minimizes the overhead), but can win
- * big if REG_ICASE is being used.  REG_ICASE, by the way, is why the hash
- * is done using addition rather than xor -- all ASCII [aA] sets xor to
- * the same value!
- */
-static int                     /* set number */
-freezeset(
-    struct parse *p,
-    cset *cs)
-{
-       uch h;
-       size_t i;
-       cset *top;
-       cset *cs2;
-       size_t css;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(cs != NULL);
-
-       h = cs->hash;
-       top = &p->g->sets[p->g->ncsets];
-       css = (size_t)p->g->csetsize;
-
-       /* look for an earlier one which is the same */
-       for (cs2 = &p->g->sets[0]; cs2 < top; cs2++)
-               if (cs2->hash == h && cs2 != cs) {
-                       /* maybe */
-                       for (i = 0; i < css; i++)
-                               if (!!CHIN(cs2, i) != !!CHIN(cs, i))
-                                       break;          /* no */
-                       if (i == css)
-                               break;                  /* yes */
-               }
-
-       if (cs2 < top) {        /* found one */
-               freeset(p, cs);
-               cs = cs2;
-       }
-
-       return((int)(cs - p->g->sets));
-}
-
-/*
- - firstch - return first character in a set (which must have at least one)
- == static int firstch(struct parse *p, cset *cs);
- */
-static int                     /* character; there is no "none" value */
-firstch(
-    struct parse *p,
-    cset *cs)
-{
-       size_t i;
-       size_t css;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(cs != NULL);
-
-       css = (size_t)p->g->csetsize;
-
-       for (i = 0; i < css; i++)
-               if (CHIN(cs, i))
-                       return((char)i);
-       assert(never);
-       return(0);              /* arbitrary */
-}
-
-/*
- - nch - number of characters in a set
- == static int nch(struct parse *p, cset *cs);
- */
-static int
-nch(
-    struct parse *p,
-    cset *cs)
-{
-       size_t i;
-       size_t css;
-       int n = 0;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(cs != NULL);
-
-       css = (size_t)p->g->csetsize;
-
-       for (i = 0; i < css; i++)
-               if (CHIN(cs, i))
-                       n++;
-       return(n);
-}
-
-/*
- - mcadd - add a collating element to a cset
- == static void mcadd(struct parse *p, cset *cs, \
- ==    char *cp);
- */
-static void
-mcadd(
-    struct parse *p,
-    cset *cs,
-    const char *cp)
-{
-       size_t oldend;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(cs != NULL);
-       _DIAGASSERT(cp != NULL);
-
-       oldend = cs->smultis;
-
-       cs->smultis += strlen(cp) + 1;
-       if (cs->multis == NULL)
-               cs->multis = malloc(cs->smultis);
-       else
-               cs->multis = realloc(cs->multis, cs->smultis);
-       if (cs->multis == NULL) {
-               SETERROR(REG_ESPACE);
-               return;
-       }
-
-       (void) strcpy(cs->multis + oldend - 1, cp);
-       cs->multis[cs->smultis - 1] = '\0';
-}
-
-#if 0
-/*
- - mcsub - subtract a collating element from a cset
- == static void mcsub(cset *cs, char *cp);
- */
-static void
-mcsub(
-    cset *cs,
-    char *cp)
-{
-       char *fp;
-       size_t len;
-
-       _DIAGASSERT(cs != NULL);
-       _DIAGASSERT(cp != NULL);
-
-       fp = mcfind(cs, cp);
-       len = strlen(fp);
-
-       assert(fp != NULL);
-       (void) memmove(fp, fp + len + 1,
-                               cs->smultis - (fp + len + 1 - cs->multis));
-       cs->smultis -= len;
-
-       if (cs->smultis == 0) {
-               free(cs->multis);
-               cs->multis = NULL;
-               return;
-       }
-
-       cs->multis = realloc(cs->multis, cs->smultis);
-       assert(cs->multis != NULL);
-}
-
-/*
- - mcin - is a collating element in a cset?
- == static int mcin(cset *cs, char *cp);
- */
-static int
-mcin(
-    cset *cs,
-    char *cp)
-{
-
-       _DIAGASSERT(cs != NULL);
-       _DIAGASSERT(cp != NULL);
-
-       return(mcfind(cs, cp) != NULL);
-}
-
-/*
- - mcfind - find a collating element in a cset
- == static char *mcfind(cset *cs, char *cp);
- */
-static char *
-mcfind(
-    cset *cs,
-    char *cp)
-{
-       char *p;
-
-       _DIAGASSERT(cs != NULL);
-       _DIAGASSERT(cp != NULL);
-
-       if (cs->multis == NULL)
-               return(NULL);
-       for (p = cs->multis; *p != '\0'; p += strlen(p) + 1)
-               if (strcmp(cp, p) == 0)
-                       return(p);
-       return(NULL);
-}
-#endif
-
-/*
- - mcinvert - invert the list of collating elements in a cset
- == static void mcinvert(struct parse *p, cset *cs);
- *
- * This would have to know the set of possibilities.  Implementation
- * is deferred.
- */
-/* ARGSUSED */
-static void
-mcinvert(
-    struct parse *p,
-    cset *cs)
-{
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(cs != NULL);
-
-       assert(cs->multis == NULL);     /* xxx */
-}
-
-/*
- - mccase - add case counterparts of the list of collating elements in a cset
- == static void mccase(struct parse *p, cset *cs);
- *
- * This would have to know the set of possibilities.  Implementation
- * is deferred.
- */
-/* ARGSUSED */
-static void
-mccase(
-    struct parse *p,
-    cset *cs)
-{
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(cs != NULL);
-
-       assert(cs->multis == NULL);     /* xxx */
-}
-
-/*
- - isinsets - is this character in any sets?
- == static int isinsets(struct re_guts *g, int c);
- */
-static int                     /* predicate */
-isinsets(
-    struct re_guts *g,
-    int c)
-{
-       uch *col;
-       int i;
-       int ncols;
-       unsigned uc = (unsigned char)c;
-
-       _DIAGASSERT(g != NULL);
-
-       ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
-
-       for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
-               if (col[uc] != 0)
-                       return(1);
-       return(0);
-}
-
-/*
- - samesets - are these two characters in exactly the same sets?
- == static int samesets(struct re_guts *g, int c1, int c2);
- */
-static int                     /* predicate */
-samesets(
-    struct re_guts *g,
-    int c1,
-    int c2)
-{
-       uch *col;
-       int i;
-       int ncols;
-       unsigned uc1 = (unsigned char)c1;
-       unsigned uc2 = (unsigned char)c2;
-
-       _DIAGASSERT(g != NULL);
-
-       ncols = (g->ncsets+(CHAR_BIT-1)) / CHAR_BIT;
-
-       for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
-               if (col[uc1] != col[uc2])
-                       return(0);
-       return(1);
-}
-
-/*
- - categorize - sort out character categories
- == static void categorize(struct parse *p, struct re_guts *g);
- */
-static void
-categorize(
-    struct parse *p,
-    struct re_guts *g)
-{
-       cat_t *cats;
-       int c;
-       int c2;
-       cat_t cat;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(g != NULL);
-
-       cats = g->categories;
-
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       for (c = CHAR_MIN; c <= CHAR_MAX; c++)
-               if (cats[c] == 0 && isinsets(g, c)) {
-                       cat = g->ncategories++;
-                       cats[c] = cat;
-                       for (c2 = c+1; c2 <= CHAR_MAX; c2++)
-                               if (cats[c2] == 0 && samesets(g, c, c2))
-                                       cats[c2] = cat;
-               }
-}
-
-/*
- - dupl - emit a duplicate of a bunch of sops
- == static sopno dupl(struct parse *p, sopno start, sopno finish);
- */
-static sopno                   /* start of duplicate */
-dupl(
-    struct parse *p,
-    sopno start,                       /* from here */
-    sopno finish)                      /* to this less one */
-{
-       sopno ret;
-       sopno len = finish - start;
-
-       _DIAGASSERT(p != NULL);
-
-       ret = HERE();
-
-       assert(finish >= start);
-       if (len == 0)
-               return(ret);
-       enlarge(p, p->ssize + len);     /* this many unexpected additions */
-       assert(p->ssize >= p->slen + len);
-       (void)memcpy(p->strip + p->slen, p->strip + start,
-           (size_t)len * sizeof(sop));
-       p->slen += len;
-       return(ret);
-}
-
-/*
- - doemit - emit a strip operator
- == static void doemit(struct parse *p, sop op, size_t opnd);
- *
- * It might seem better to implement this as a macro with a function as
- * hard-case backup, but it's just too big and messy unless there are
- * some changes to the data structures.  Maybe later.
- */
-static void
-doemit(
-    struct parse *p,
-    sop op,
-    sopno opnd)
-{
-
-       _DIAGASSERT(p != NULL);
-
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       /* deal with oversize operands ("can't happen", more or less) */
-       assert(opnd < 1<<OPSHIFT);
-
-       /* deal with undersized strip */
-       if (p->slen >= p->ssize)
-               enlarge(p, (p->ssize+1) / 2 * 3);       /* +50% */
-       assert(p->slen < p->ssize);
-
-       /* finally, it's all reduced to the easy case */
-       p->strip[p->slen++] = SOP(op, opnd);
-}
-
-/*
- - doinsert - insert a sop into the strip
- == static void doinsert(struct parse *p, sop op, size_t opnd, sopno pos);
- */
-static void
-doinsert(
-    struct parse *p,
-    sop op,
-    sopno opnd,
-    sopno pos)
-{
-       sopno sn;
-       sop s;
-       int i;
-
-       _DIAGASSERT(p != NULL);
-
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       sn = HERE();
-       EMIT(op, opnd);         /* do checks, ensure space */
-       assert(HERE() == sn+1);
-       s = p->strip[sn];
-
-       /* adjust paren pointers */
-       assert(pos > 0);
-       for (i = 1; i < NPAREN; i++) {
-               if (p->pbegin[i] >= pos) {
-                       p->pbegin[i]++;
-               }
-               if (p->pend[i] >= pos) {
-                       p->pend[i]++;
-               }
-       }
-
-       memmove(&p->strip[pos+1], &p->strip[pos], (HERE()-pos-1)*sizeof(sop));
-       p->strip[pos] = s;
-}
-
-/*
- - dofwd - complete a forward reference
- == static void dofwd(struct parse *p, sopno pos, sop value);
- */
-static void
-dofwd(
-    struct parse *p,
-    sopno pos,
-    sopno value)
-{
-
-       _DIAGASSERT(p != NULL);
-
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       assert(value < 1<<OPSHIFT);
-       p->strip[pos] = OP(p->strip[pos]) | value;
-}
-
-/*
- - enlarge - enlarge the strip
- == static void enlarge(struct parse *p, sopno size);
- */
-static void
-enlarge(
-    struct parse *p,
-    sopno size)
-{
-       sop *sp;
-
-       _DIAGASSERT(p != NULL);
-
-       if (p->ssize >= size)
-               return;
-
-       sp = (sop *)realloc(p->strip, size*sizeof(sop));
-       if (sp == NULL) {
-               SETERROR(REG_ESPACE);
-               return;
-       }
-       p->strip = sp;
-       p->ssize = size;
-}
-
-/*
- - stripsnug - compact the strip
- == static void stripsnug(struct parse *p, struct re_guts *g);
- */
-static void
-stripsnug(
-    struct parse *p,
-    struct re_guts *g)
-{
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(g != NULL);
-
-       g->nstates = p->slen;
-       g->strip = realloc(p->strip, p->slen * sizeof(sop));
-       if (g->strip == NULL) {
-               SETERROR(REG_ESPACE);
-               g->strip = p->strip;
-       }
-}
-
-/*
- - findmust - fill in must and mlen with longest mandatory literal string
- == static void findmust(struct parse *p, struct re_guts *g);
- *
- * This algorithm could do fancy things like analyzing the operands of |
- * for common subsequences.  Someday.  This code is simple and finds most
- * of the interesting cases.
- *
- * Note that must and mlen got initialized during setup.
- */
-static void
-findmust(
-    struct parse *p,
-    struct re_guts *g)
-{
-       sop *scan;
-       sop *start = NULL;
-       sop *newstart = NULL;
-       sopno newlen;
-       sop s;
-       char *cp;
-       sopno i;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(g != NULL);
-
-       /* avoid making error situations worse */
-       if (p->error != 0)
-               return;
-
-       /* find the longest OCHAR sequence in strip */
-       newlen = 0;
-       scan = g->strip + 1;
-       do {
-               s = *scan++;
-               switch (OP(s)) {
-               case OCHAR:             /* sequence member */
-                       if (newlen == 0)                /* new sequence */
-                               newstart = scan - 1;
-                       newlen++;
-                       break;
-               case OPLUS_:            /* things that don't break one */
-               case OLPAREN:
-               case ORPAREN:
-                       break;
-               case OQUEST_:           /* things that must be skipped */
-               case OCH_:
-                       scan--;
-                       do {
-                               scan += OPND(s);
-                               s = *scan;
-                               /* assert() interferes w debug printouts */
-                               if (OP(s) != O_QUEST && OP(s) != O_CH &&
-                                                       OP(s) != OOR2) {
-                                       g->iflags |= BAD;
-                                       return;
-                               }
-                       } while (OP(s) != O_QUEST && OP(s) != O_CH);
-                       /* FALLTHROUGH */
-               default:                /* things that break a sequence */
-                       if (newlen > g->mlen) {         /* ends one */
-                               start = newstart;
-                               g->mlen = newlen;
-                       }
-                       newlen = 0;
-                       break;
-               }
-       } while (OP(s) != OEND);
-
-       if (start == NULL)
-               g->mlen = 0;
-
-       if (g->mlen == 0)       /* there isn't one */
-               return;
-
-       /* turn it into a character string */
-       g->must = malloc((size_t)g->mlen + 1);
-       if (g->must == NULL) {          /* argh; just forget it */
-               g->mlen = 0;
-               return;
-       }
-       cp = g->must;
-       scan = start;
-       for (i = g->mlen; i > 0; i--) {
-               while (OP(s = *scan++) != OCHAR)
-                       continue;
-               assert(cp < g->must + g->mlen);
-               *cp++ = (char)OPND(s);
-       }
-       assert(cp == g->must + g->mlen);
-       *cp++ = '\0';           /* just on general principles */
-}
-
-/*
- - pluscount - count + nesting
- == static sopno pluscount(struct parse *p, struct re_guts *g);
- */
-static sopno                   /* nesting depth */
-pluscount(
-    struct parse *p,
-    struct re_guts *g)
-{
-       sop *scan;
-       sop s;
-       sopno plusnest = 0;
-       sopno maxnest = 0;
-
-       _DIAGASSERT(p != NULL);
-       _DIAGASSERT(g != NULL);
-
-       if (p->error != 0)
-               return(0);      /* there may not be an OEND */
-
-       scan = g->strip + 1;
-       do {
-               s = *scan++;
-               switch (OP(s)) {
-               case OPLUS_:
-                       plusnest++;
-                       break;
-               case O_PLUS:
-                       if (plusnest > maxnest)
-                               maxnest = plusnest;
-                       plusnest--;
-                       break;
-               }
-       } while (OP(s) != OEND);
-       if (plusnest != 0)
-               g->iflags |= BAD;
-       return(maxnest);
-}
diff --git a/lib/nbsd_libc/regex/regerror.c b/lib/nbsd_libc/regex/regerror.c
deleted file mode 100644 (file)
index e00d7c0..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-/*     $NetBSD: regerror.c,v 1.23 2007/02/09 23:44:18 junyoung Exp $   */
-
-/*-
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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. 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.
- *
- *     @(#)regerror.c  8.4 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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.
- *
- *     @(#)regerror.c  8.4 (Berkeley) 3/20/94
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
-#else
-__RCSID("$NetBSD: regerror.c,v 1.23 2007/02/09 23:44:18 junyoung Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <regex.h>
-
-#ifdef __weak_alias
-__weak_alias(regerror,_regerror)
-#endif
-
-#include "utils.h"
-
-/* ========= begin header generated by ./mkh ========= */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* === regerror.c === */
-static const char *regatoi(const regex_t *preg, char *localbuf, size_t buflen);
-
-#ifdef __cplusplus
-}
-#endif
-/* ========= end header generated by ./mkh ========= */
-/*
- = #define     REG_NOMATCH      1
- = #define     REG_BADPAT       2
- = #define     REG_ECOLLATE     3
- = #define     REG_ECTYPE       4
- = #define     REG_EESCAPE      5
- = #define     REG_ESUBREG      6
- = #define     REG_EBRACK       7
- = #define     REG_EPAREN       8
- = #define     REG_EBRACE       9
- = #define     REG_BADBR       10
- = #define     REG_ERANGE      11
- = #define     REG_ESPACE      12
- = #define     REG_BADRPT      13
- = #define     REG_EMPTY       14
- = #define     REG_ASSERT      15
- = #define     REG_INVARG      16
- = #define     REG_ATOI        255     // convert name to number (!)
- = #define     REG_ITOA        0400    // convert number to name (!)
- */
-static const struct rerr {
-       int code;
-       const char *name;
-       const char *explain;
-} rerrs[] = {
-       { REG_NOMATCH,  "REG_NOMATCH",  "regexec() failed to match" },
-       { REG_BADPAT,   "REG_BADPAT",   "invalid regular expression" },
-       { REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" },
-       { REG_ECTYPE,   "REG_ECTYPE",   "invalid character class" },
-       { REG_EESCAPE,  "REG_EESCAPE",  "trailing backslash (\\)" },
-       { REG_ESUBREG,  "REG_ESUBREG",  "invalid backreference number" },
-       { REG_EBRACK,   "REG_EBRACK",   "brackets ([ ]) not balanced" },
-       { REG_EPAREN,   "REG_EPAREN",   "parentheses not balanced" },
-       { REG_EBRACE,   "REG_EBRACE",   "braces not balanced" },
-       { REG_BADBR,    "REG_BADBR",    "invalid repetition count(s)" },
-       { REG_ERANGE,   "REG_ERANGE",   "invalid character range" },
-       { REG_ESPACE,   "REG_ESPACE",   "out of memory" },
-       { REG_BADRPT,   "REG_BADRPT",   "repetition-operator operand invalid" },
-       { REG_EMPTY,    "REG_EMPTY",    "empty (sub)expression" },
-       { REG_ASSERT,   "REG_ASSERT",   "\"can't happen\" -- you found a bug" },
-       { REG_INVARG,   "REG_INVARG",   "invalid argument to regex routine" },
-       { 0,            "",             "*** unknown regexp error code ***" }
-};
-
-/*
- * regerror - the interface to error numbers
- * extern size_t regerror(int, const regex_t *, char *, size_t);
- */
-/* ARGSUSED */
-size_t
-regerror(
-    int errcode,
-    const regex_t *preg,
-    char *errbuf,
-    size_t errbuf_size)
-{
-       const struct rerr *r;
-       size_t len;
-       int target = errcode &~ REG_ITOA;
-       const char *s;
-       char convbuf[50];
-
-       _DIAGASSERT(errcode != REG_ATOI || preg != NULL);
-       _DIAGASSERT(errbuf != NULL);
-
-       if (errcode == REG_ATOI)
-               s = regatoi(preg, convbuf, sizeof convbuf);
-       else {
-               for (r = rerrs; r->code != 0; r++)
-                       if (r->code == target)
-                               break;
-       
-               if (errcode & REG_ITOA) {
-                       if (r->code != 0) {
-                               (void)strlcpy(convbuf, r->name, sizeof convbuf);
-                       } else
-                               (void)snprintf(convbuf, sizeof convbuf,
-                                   "REG_0x%x", target);
-                       s = convbuf;
-               } else
-                       s = r->explain;
-       }
-
-       len = strlen(s) + 1;
-       if (errbuf_size > 0)
-               (void)strlcpy(errbuf, s, errbuf_size);
-
-       return(len);
-}
-
-/*
- * regatoi - internal routine to implement REG_ATOI
- * static const char *regatoi(const regex_t *preg, char *localbuf,
- * size_t buflen);
- */
-static const char *
-regatoi(
-    const regex_t *preg,
-    char *localbuf,
-    size_t buflen)
-{
-       const struct rerr *r;
-
-       for (r = rerrs; r->code != 0; r++)
-               if (strcmp(r->name, preg->re_endp) == 0)
-                       break;
-       if (r->code == 0)
-               return "0";
-
-       (void)snprintf(localbuf, buflen, "%d", r->code);
-       return localbuf;
-}
diff --git a/lib/nbsd_libc/regex/regex.3 b/lib/nbsd_libc/regex/regex.3
deleted file mode 100644 (file)
index dae8e17..0000000
+++ /dev/null
@@ -1,631 +0,0 @@
-.\"    $NetBSD: regex.3,v 1.21 2010/03/22 19:30:54 joerg Exp $
-.\"
-.\" Copyright (c) 1992, 1993, 1994
-.\"    The Regents of the University of California.  All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Henry Spencer.
-.\"
-.\" 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. 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.
-.\"
-.\" Copyright (c) 1992, 1993, 1994 Henry Spencer.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Henry Spencer.
-.\"
-.\" 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.
-.\"
-.\"    @(#)regex.3     8.4 (Berkeley) 3/20/94
-.\"
-.Dd December 29, 2003
-.Dt REGEX 3
-.Os
-.Sh NAME
-.Nm regex ,
-.Nm regcomp ,
-.Nm regexec ,
-.Nm regerror ,
-.Nm regfree
-.Nd regular-expression library
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In regex.h
-.Ft int
-.Fn regcomp "regex_t * restrict preg" "const char * restrict pattern" "int cflags"
-.Ft int
-.Fn regexec "const regex_t * restrict preg" "const char * restrict string" "size_t nmatch" "regmatch_t pmatch[]" "int eflags"
-.Ft size_t
-.Fn regerror "int errcode" "const regex_t * restrict preg" "char * restrict errbuf" "size_t errbuf_size"
-.Ft void
-.Fn regfree "regex_t *preg"
-.Sh DESCRIPTION
-These routines implement
-.St -p1003.2-92
-regular expressions (``RE''s);
-see
-.Xr re_format 7 .
-.Fn regcomp
-compiles an RE written as a string into an internal form,
-.Fn regexec
-matches that internal form against a string and reports results,
-.Fn regerror
-transforms error codes from either into human-readable messages,
-and
-.Fn regfree
-frees any dynamically-allocated storage used by the internal form
-of an RE.
-.Pp
-The header
-.In regex.h
-declares two structure types,
-.Fa regex_t
-and
-.Fa regmatch_t ,
-the former for compiled internal forms and the latter for match reporting.
-It also declares the four functions,
-a type
-.Fa regoff_t ,
-and a number of constants with names starting with ``REG_''.
-.Pp
-.Fn regcomp
-compiles the regular expression contained in the
-.Fa pattern
-string,
-subject to the flags in
-.Fa cflags ,
-and places the results in the
-.Fa regex_t
-structure pointed to by
-.Fa preg .
-.Fa cflags
-is the bitwise OR of zero or more of the following flags:
-.Bl -tag -width XXXREG_EXTENDED
-.It Dv REG_EXTENDED
-Compile modern (``extended'') REs, rather than the obsolete
-(``basic'') REs that are the default.
-.It Dv REG_BASIC
-This is a synonym for 0,
-provided as a counterpart to REG_EXTENDED to improve readability.
-.It Dv REG_NOSPEC
-Compile with recognition of all special characters turned off.
-All characters are thus considered ordinary, so the ``RE'' is a literal
-string.
-This is an extension, compatible with but not specified by
-.St -p1003.2-92 ,
-and should be used with caution in software intended to be portable to
-other systems.
-.Dv REG_EXTENDED
-and
-.Dv REG_NOSPEC
-may not be used in the same call to
-.Fn regcomp .
-.It Dv REG_ICASE
-Compile for matching that ignores upper/lower case distinctions.
-See
-.Xr re_format 7 .
-.It Dv REG_NOSUB
-Compile for matching that need only report success or failure, not
-what was matched.
-.It Dv REG_NEWLINE
-Compile for newline-sensitive matching.
-By default, newline is a completely ordinary character with no special
-meaning in either REs or strings.
-With this flag,
-`[^' bracket expressions and `.' never match newline,
-a `^' anchor matches the null string after any newline in the string
-in addition to its normal function,
-and the `$' anchor matches the null string before any newline in the
-string in addition to its normal function.
-.It Dv REG_PEND
-The regular expression ends, not at the first NUL, but just before the
-character pointed to by the
-.Fa re_endp
-member of the structure pointed to by
-.Fa preg .
-The
-.Fa re_endp
-member is of type
-.Fa "const\ char\ *" .
-This flag permits inclusion of NULs in the RE; they are considered
-ordinary characters.
-This is an extension, compatible with but not specified by
-.St -p1003.2-92 ,
-and should be used with caution in software intended to be portable to
-other systems.
-.El
-.Pp
-When successful,
-.Fn regcomp
-returns 0 and fills in the structure pointed to by
-.Fa preg .
-One member of that structure (other than
-.Fa re_endp )
-is publicized:
-.Fa re_nsub ,
-of type
-.Fa size_t ,
-contains the number of parenthesized subexpressions within the RE
-(except that the value of this member is undefined if the
-.Dv REG_NOSUB
-flag was used).
-If
-.Fn regcomp
-fails, it returns a non-zero error code;
-see
-.Sx DIAGNOSTICS .
-.Pp
-.Fn regexec
-matches the compiled RE pointed to by
-.Fa preg
-against the
-.Fa string ,
-subject to the flags in
-.Fa eflags ,
-and reports results using
-.Fa nmatch ,
-.Fa pmatch ,
-and the returned value.
-The RE must have been compiled by a previous invocation of
-.Fn regcomp .
-The compiled form is not altered during execution of
-.Fn regexec ,
-so a single compiled RE can be used simultaneously by multiple threads.
-.Pp
-By default,
-the NUL-terminated string pointed to by
-.Fa string
-is considered to be the text of an entire line, minus any terminating
-newline.
-The
-.Fa eflags
-argument is the bitwise OR of zero or more of the following flags:
-.Bl -tag -width XXXREG_NOTBOL
-.It Dv REG_NOTBOL
-The first character of the string
-is not the beginning of a line, so the `^' anchor should not match before it.
-This does not affect the behavior of newlines under
-.Dv REG_NEWLINE .
-.It Dv REG_NOTEOL
-The NUL terminating the string does not end a line, so the `$' anchor
-should not match before it.
-This does not affect the behavior of newlines under
-.Dv REG_NEWLINE .
-.It Dv REG_STARTEND
-The string is considered to start at
-.Fa string
-+
-.Fa pmatch[0].rm_so
-and to have a terminating NUL located at
-.Fa string
-+
-.Fa pmatch[0].rm_eo
-(there need not actually be a NUL at that location),
-regardless of the value of
-.Fa nmatch .
-See below for the definition of
-.Fa pmatch
-and
-.Fa nmatch .
-This is an extension, compatible with but not specified by
-.St -p1003.2-92 ,
-and should be used with caution in software intended to be portable to
-other systems.
-Note that a non-zero
-.Fa rm_so
-does not imply
-.Dv REG_NOTBOL ;
-.Dv REG_STARTEND
-affects only the location of the string, not how it is matched.
-.El
-.Pp
-See
-.Xr re_format 7
-for a discussion of what is matched in situations where an RE or a
-portion thereof could match any of several substrings of
-.Fa string .
-.Pp
-Normally,
-.Fn regexec
-returns 0 for success and the non-zero code
-.Dv REG_NOMATCH
-for failure.
-Other non-zero error codes may be returned in exceptional situations;
-see
-.Sx DIAGNOSTICS .
-.Pp
-If
-.Dv REG_NOSUB
-was specified in the compilation of the RE, or if
-.Fa nmatch
-is 0,
-.Fn regexec
-ignores the
-.Fa pmatch
-argument (but see below for the case where
-.Dv REG_STARTEND
-is specified).
-Otherwise,
-.Fa pmatch
-points to an array of
-.Fa nmatch
-structures of type
-.Fa regmatch_t .
-Such a structure has at least the members
-.Fa rm_so
-and
-.Fa rm_eo ,
-both of type
-.Fa regoff_t
-(a signed arithmetic type at least as large as an
-.Fa off_t
-and a
-.Fa ssize_t ) ,
-containing respectively the offset of the first character of a substring
-and the offset of the first character after the end of the substring.
-Offsets are measured from the beginning of the
-.Fa string
-argument given to
-.Fn regexec .
-An empty substring is denoted by equal offsets,
-both indicating the character following the empty substring.
-.Pp
-The 0th member of the
-.Fa pmatch
-array is filled in to indicate what substring of
-.Fa string
-was matched by the entire RE.
-Remaining members report what substring was matched by parenthesized
-subexpressions within the RE;
-member
-.Fa i
-reports subexpression
-.Fa i ,
-with subexpressions counted (starting at 1) by the order of their
-opening parentheses in the RE, left to right.
-Unused entries in the array\(emcorresponding either to subexpressions that
-did not participate in the match at all, or to subexpressions that do not
-exist in the RE (that is,
-.Fa i
-\*[Gt]
-.Fa preg-\*[Gt]re_nsub )
-\(emhave both
-.Fa rm_so
-and
-.Fa rm_eo
-set to -1.
-If a subexpression participated in the match several times,
-the reported substring is the last one it matched.
-(Note, as an example in particular, that when the RE `(b*)+' matches `bbb',
-the parenthesized subexpression matches each of the three `b's and then
-an infinite number of empty strings following the last `b',
-so the reported substring is one of the empties.)
-.Pp
-If
-.Dv REG_STARTEND
-is specified,
-.Fa pmatch
-must point to at least one
-.Fa regmatch_t
-(even if
-.Fa nmatch
-is 0 or
-.Dv REG_NOSUB
-was specified),
-to hold the input offsets for
-.Dv REG_STARTEND .
-Use for output is still entirely controlled by
-.Fa nmatch ;
-if
-.Fa nmatch
-is 0 or
-.Dv REG_NOSUB
-was specified,
-the value of
-.Fa pmatch [0]
-will not be changed by a successful
-.Fn regexec .
-.Pp
-.Fn regerror
-maps a non-zero
-.Fa errcode
-from either
-.Fn regcomp
-or
-.Fn regexec
-to a human-readable, printable message.
-If
-.Fa preg
-is non-NULL,
-the error code should have arisen from use of the
-.Fa regex_t
-pointed to by
-.Fa preg ,
-and if the error code came from
-.Fn regcomp ,
-it should have been the result from the most recent
-.Fn regcomp
-using that
-.Fa regex_t . (
-.Fn regerror
-may be able to supply a more detailed message using information
-from the
-.Fa regex_t . )
-.Fn regerror
-places the NUL-terminated message into the buffer pointed to by
-.Fa errbuf ,
-limiting the length (including the NUL) to at most
-.Fa errbuf_size
-bytes.
-If the whole message won't fit,
-as much of it as will fit before the terminating NUL is supplied.
-In any case,
-the returned value is the size of buffer needed to hold the whole
-message (including terminating NUL).
-If
-.Fa errbuf_size
-is 0,
-.Fa errbuf
-is ignored but the return value is still correct.
-.Pp
-If the
-.Fa errcode
-given to
-.Fn regerror
-is first ORed with
-.Dv REG_ITOA ,
-the ``message'' that results is the printable name of the error code,
-e.g. ``REG_NOMATCH'',
-rather than an explanation thereof.
-If
-.Fa errcode
-is
-.Dv REG_ATOI ,
-then
-.Fa preg
-shall be non-NULL and the
-.Fa re_endp
-member of the structure it points to
-must point to the printable name of an error code;
-in this case, the result in
-.Fa errbuf
-is the decimal digits of
-the numeric value of the error code
-(0 if the name is not recognized).
-.Dv REG_ITOA
-and
-.Dv REG_ATOI
-are intended primarily as debugging facilities;
-they are extensions, compatible with but not specified by
-.St -p1003.2-92 ,
-and should be used with caution in software intended to be portable to
-other systems.
-Be warned also that they are considered experimental and changes are possible.
-.Pp
-.Fn regfree
-frees any dynamically-allocated storage associated with the compiled RE
-pointed to by
-.Fa preg .
-The remaining
-.Fa regex_t
-is no longer a valid compiled RE
-and the effect of supplying it to
-.Fn regexec
-or
-.Fn regerror
-is undefined.
-.Pp
-None of these functions references global variables except for tables
-of constants;
-all are safe for use from multiple threads if the arguments are safe.
-.Sh IMPLEMENTATION CHOICES
-There are a number of decisions that
-.St -p1003.2-92
-leaves up to the implementor,
-either by explicitly saying ``undefined'' or by virtue of them being
-forbidden by the RE grammar.
-This implementation treats them as follows.
-.Pp
-See
-.Xr re_format 7
-for a discussion of the definition of case-independent matching.
-.Pp
-There is no particular limit on the length of REs,
-except insofar as memory is limited.
-Memory usage is approximately linear in RE size, and largely insensitive
-to RE complexity, except for bounded repetitions.
-See BUGS for one short RE using them
-that will run almost any system out of memory.
-.Pp
-A backslashed character other than one specifically given a magic meaning
-by
-.St -p1003.2-92
-(such magic meanings occur only in obsolete [``basic''] REs)
-is taken as an ordinary character.
-.Pp
-Any unmatched [ is a
-.Dv REG_EBRACK
-error.
-.Pp
-Equivalence classes cannot begin or end bracket-expression ranges.
-The endpoint of one range cannot begin another.
-.Pp
-.Dv RE_DUP_MAX ,
-the limit on repetition counts in bounded repetitions, is 255.
-.Pp
-A repetition operator (?, *, +, or bounds) cannot follow another
-repetition operator.
-A repetition operator cannot begin an expression or subexpression
-or follow `^' or `|'.
-.Pp
-`|' cannot appear first or last in a (sub)expression or after another `|',
-i.e. an operand of `|' cannot be an empty subexpression.
-An empty parenthesized subexpression, `()', is legal and matches an
-empty (sub)string.
-An empty string is not a legal RE.
-.Pp
-A `{' followed by a digit is considered the beginning of bounds for a
-bounded repetition, which must then follow the syntax for bounds.
-A `{'
-.Em not
-followed by a digit is considered an ordinary character.
-.Pp
-`^' and `$' beginning and ending subexpressions in obsolete (``basic'')
-REs are anchors, not ordinary characters.
-.Sh DIAGNOSTICS
-Non-zero error codes from
-.Fn regcomp
-and
-.Fn regexec
-include the following:
-.Pp
-.Bl -tag -width XXXREG_ECOLLATE -compact
-.It Dv REG_NOMATCH
-.Fn regexec
-failed to match
-.It Dv REG_BADPAT
-invalid regular expression
-.It Dv REG_ECOLLATE
-invalid collating element
-.It Dv REG_ECTYPE
-invalid character class
-.It Dv REG_EESCAPE
-\e applied to unescapable character
-.It Dv REG_ESUBREG
-invalid backreference number
-.It Dv REG_EBRACK
-brackets [ ] not balanced
-.It Dv REG_EPAREN
-parentheses ( ) not balanced
-.It Dv REG_EBRACE
-braces { } not balanced
-.It Dv REG_BADBR
-invalid repetition count(s) in { }
-.It Dv REG_ERANGE
-invalid character range in [ ]
-.It Dv REG_ESPACE
-ran out of memory
-.It Dv REG_BADRPT
-?, *, or + operand invalid
-.It Dv REG_EMPTY
-empty (sub)expression
-.It Dv REG_ASSERT
-``can't happen''\(emyou found a bug
-.It Dv REG_INVARG
-invalid argument, e.g. negative-length string
-.El
-.Sh SEE ALSO
-.Xr grep 1 ,
-.Xr sed 1 ,
-.Xr re_format 7
-.Pp
-.St -p1003.2-92 ,
-sections 2.8 (Regular Expression Notation)
-and
-B.5 (C Binding for Regular Expression Matching).
-.Sh HISTORY
-Originally written by Henry Spencer.
-Altered for inclusion in the
-.Bx 4.4
-distribution.
-.Sh BUGS
-There is one known functionality bug.
-The implementation of internationalization is incomplete:
-the locale is always assumed to be the default one of
-.St -p1003.2-92 ,
-and only the collating elements etc. of that locale are available.
-.Pp
-The back-reference code is subtle and doubts linger about its correctness
-in complex cases.
-.Pp
-.Fn regexec
-performance is poor.
-This will improve with later releases.
-.Fa nmatch
-exceeding 0 is expensive;
-.Fa nmatch
-exceeding 1 is worse.
-.Fa regexec
-is largely insensitive to RE complexity
-.Em except
-that back references are massively expensive.
-RE length does matter; in particular, there is a strong speed bonus
-for keeping RE length under about 30 characters,
-with most special characters counting roughly double.
-.Pp
-.Fn regcomp
-implements bounded repetitions by macro expansion,
-which is costly in time and space if counts are large
-or bounded repetitions are nested.
-An RE like, say,
-`((((a{1,100}){1,100}){1,100}){1,100}){1,100}'
-will (eventually) run almost any existing machine out of swap space.
-.Pp
-There are suspected problems with response to obscure error conditions.
-Notably,
-certain kinds of internal overflow,
-produced only by truly enormous REs or by multiply nested bounded repetitions,
-are probably not handled well.
-.Pp
-Due to a mistake in
-.St -p1003.2-92 ,
-things like `a)b' are legal REs because `)' is a special character
-only in the presence of a previous unmatched `('.
-This can't be fixed until the spec is fixed.
-.Pp
-The standard's definition of back references is vague.
-For example, does
-`a\e(\e(b\e)*\e2\e)*d' match `abbbd'?
-Until the standard is clarified, behavior in such cases should not be
-relied on.
-.Pp
-The implementation of word-boundary matching is a bit of a kludge,
-and bugs may lurk in combinations of word-boundary matching and anchoring.
diff --git a/lib/nbsd_libc/regex/regex2.h b/lib/nbsd_libc/regex/regex2.h
deleted file mode 100644 (file)
index 0fdbe74..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/*     $NetBSD: regex2.h,v 1.12 2009/02/12 05:06:54 lukem Exp $        */
-
-/*-
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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. 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.
- *
- *     @(#)regex2.h    8.4 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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.
- *
- *     @(#)regex2.h    8.4 (Berkeley) 3/20/94
- */
-
-/*
- * First, the stuff that ends up in the outside-world include file
- = typedef off_t regoff_t;
- = typedef struct {
- =     int re_magic;
- =     size_t re_nsub;         // number of parenthesized subexpressions
- =     const char *re_endp;    // end pointer for REG_PEND
- =     struct re_guts *re_g;   // none of your business :-)
- = } regex_t;
- = typedef struct {
- =     regoff_t rm_so;         // start of match
- =     regoff_t rm_eo;         // end of match
- = } regmatch_t;
- */
-/*
- * internals of regex_t
- */
-#define        MAGIC1  ((('r'^0200)<<8) | 'e')
-
-/*
- * The internal representation is a *strip*, a sequence of
- * operators ending with an endmarker.  (Some terminology etc. is a
- * historical relic of earlier versions which used multiple strips.)
- * Certain oddities in the representation are there to permit running
- * the machinery backwards; in particular, any deviation from sequential
- * flow must be marked at both its source and its destination.  Some
- * fine points:
- *
- * - OPLUS_ and O_PLUS are *inside* the loop they create.
- * - OQUEST_ and O_QUEST are *outside* the bypass they create.
- * - OCH_ and O_CH are *outside* the multi-way branch they create, while
- *   OOR1 and OOR2 are respectively the end and the beginning of one of
- *   the branches.  Note that there is an implicit OOR2 following OCH_
- *   and an implicit OOR1 preceding O_CH.
- *
- * In state representations, an operator's bit is on to signify a state
- * immediately *preceding* "execution" of that operator.
- */
-typedef u_int32_t sop; /* strip operator */
-typedef int sopno;
-#define        OPRMASK ((u_int32_t)0xf8000000UL)
-#define        OPDMASK ((u_int32_t)0x07ffffffUL)
-#define        OPSHIFT ((unsigned)27)
-#define        OP(n)   ((n)&OPRMASK)
-#define        OPND(n) ((int)((n)&OPDMASK))
-#define        SOP(op, opnd)   ((op)|(opnd))
-
-#define OPC(n) (((u_int32_t)(n))<<OPSHIFT)
-/* operators              meaning      operand                 */
-/*                                     (back, fwd are offsets) */
-#define        OEND    OPC(1)  /* endmarker    -                       */
-#define        OCHAR   OPC(2)  /* character    unsigned char           */
-#define        OBOL    OPC(3)  /* left anchor  -                       */
-#define        OEOL    OPC(4)  /* right anchor -                       */
-#define        OANY    OPC(5)  /* .            -                       */
-#define        OANYOF  OPC(6)  /* [...]        set number              */
-#define        OBACK_  OPC(7)  /* begin \d     paren number            */
-#define        O_BACK  OPC(8)  /* end \d       paren number            */
-#define        OPLUS_  OPC(9)  /* + prefix     fwd to suffix           */
-#define        O_PLUS  OPC(10) /* + suffix     back to prefix          */
-#define        OQUEST_ OPC(11) /* ? prefix     fwd to suffix           */
-#define        O_QUEST OPC(12) /* ? suffix     back to prefix          */
-#define        OLPAREN OPC(13) /* (            fwd to )                */
-#define        ORPAREN OPC(14) /* )            back to (               */
-#define        OCH_    OPC(15) /* begin choice fwd to OOR2             */
-#define        OOR1    OPC(16) /* | pt. 1      back to OOR1 or OCH_    */
-#define        OOR2    OPC(17) /* | pt. 2      fwd to OOR2 or O_CH     */
-#define        O_CH    OPC(18) /* end choice   back to OOR1            */
-#define        OBOW    OPC(19) /* begin word   -                       */
-#define        OEOW    OPC(20) /* end word     -                       */
-
-/*
- * Structure for [] character-set representation.  Character sets are
- * done as bit vectors, grouped 8 to a byte vector for compactness.
- * The individual set therefore has both a pointer to the byte vector
- * and a mask to pick out the relevant bit of each byte.  A hash code
- * simplifies testing whether two sets could be identical.
- *
- * This will get trickier for multicharacter collating elements.  As
- * preliminary hooks for dealing with such things, we also carry along
- * a string of multi-character elements, and decide the size of the
- * vectors at run time.
- */
-typedef struct {
-       uch *ptr;               /* -> uch [csetsize] */
-       uch mask;               /* bit within array */
-       uch hash;               /* hash code */
-       size_t smultis;
-       char *multis;           /* -> char[smulti]  ab\0cd\0ef\0\0 */
-} cset;
-/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
-#define        CHadd(cs, c)    ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
-#define        CHsub(cs, c)    ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
-#define        CHIN(cs, c)     ((cs)->ptr[(uch)(c)] & (cs)->mask)
-#define        MCadd(p, cs, cp)        mcadd(p, cs, cp)        /* regcomp() internal fns */
-#define        MCsub(p, cs, cp)        mcsub(p, cs, cp)
-#define        MCin(p, cs, cp) mcin(p, cs, cp)
-
-/* stuff for character categories */
-typedef unsigned char cat_t;
-
-/*
- * main compiled-expression structure
- */
-struct re_guts {
-       int magic;
-#              define  MAGIC2  ((('R'^0200)<<8)|'E')
-       sop *strip;             /* malloced area for strip */
-       int csetsize;           /* number of bits in a cset vector */
-       int ncsets;             /* number of csets in use */
-       cset *sets;             /* -> cset [ncsets] */
-       uch *setbits;           /* -> uch[csetsize][ncsets/CHAR_BIT] */
-       int cflags;             /* copy of regcomp() cflags argument */
-       sopno nstates;          /* = number of sops */
-       sopno firststate;       /* the initial OEND (normally 0) */
-       sopno laststate;        /* the final OEND */
-       int iflags;             /* internal flags */
-#              define  USEBOL  01      /* used ^ */
-#              define  USEEOL  02      /* used $ */
-#              define  BAD     04      /* something wrong */
-       int nbol;               /* number of ^ used */
-       int neol;               /* number of $ used */
-       int ncategories;        /* how many character categories */
-       cat_t *categories;      /* ->catspace[-CHAR_MIN] */
-       char *must;             /* match must contain this string */
-       int mlen;               /* length of must */
-       size_t nsub;            /* copy of re_nsub */
-       int backrefs;           /* does it use back references? */
-       sopno nplus;            /* how deep does it nest +s? */
-       /* catspace must be last */
-       cat_t catspace[1];      /* actually [NC] */
-};
-
-/* misc utilities */
-#define        OUT     (CHAR_MAX+1)    /* a non-character value */
-#define        ISWORD(c)       (isalnum((unsigned char)c) || (c) == '_')
diff --git a/lib/nbsd_libc/regex/regexec.c b/lib/nbsd_libc/regex/regexec.c
deleted file mode 100644 (file)
index d0e1084..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/*     $NetBSD: regexec.c,v 1.21 2009/02/12 05:06:54 lukem Exp $       */
-
-/*-
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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. 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.
- *
- *     @(#)regexec.c   8.3 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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.
- *
- *     @(#)regexec.c   8.3 (Berkeley) 3/20/94
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)regexec.c  8.3 (Berkeley) 3/20/94";
-#else
-__RCSID("$NetBSD: regexec.c,v 1.21 2009/02/12 05:06:54 lukem Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * the outer shell of regexec()
- *
- * This file includes engine.c *twice*, after muchos fiddling with the
- * macros that code uses.  This lets the same code operate on two different
- * representations for state sets.
- */
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <regex.h>
-
-#ifdef __weak_alias
-__weak_alias(regexec,_regexec)
-#endif
-
-#include "utils.h"
-#include "regex2.h"
-
-/* macros for manipulating states, small version */
-#define        states  unsigned long
-#define        states1 unsigned long   /* for later use in regexec() decision */
-#define        CLEAR(v)        ((v) = 0)
-#define        SET0(v, n)      ((v) &= ~((unsigned long)1 << (n)))
-#define        SET1(v, n)      ((v) |= (unsigned long)1 << (n))
-#define        ISSET(v, n)     (((v) & ((unsigned long)1 << (n))) != 0)
-#define        ASSIGN(d, s)    ((d) = (s))
-#define        EQ(a, b)        ((a) == (b))
-#define        STATEVARS       int dummy       /* dummy version */
-#define        STATESETUP(m, n)        /* nothing */
-#define        STATETEARDOWN(m)        /* nothing */
-#define        SETUP(v)        ((v) = 0)
-#define        onestate        unsigned long
-#define        INIT(o, n)      ((o) = (unsigned long)1 << (n))
-#define        INC(o)  ((o) <<= 1)
-#define        ISSTATEIN(v, o) (((v) & (o)) != 0)
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define        FWD(dst, src, n)        ((dst) |= ((unsigned long)(src)&(here)) << (n))
-#define        BACK(dst, src, n)       ((dst) |= ((unsigned long)(src)&(here)) >> (n))
-#define        ISSETBACK(v, n) (((v) & ((unsigned long)here >> (n))) != 0)
-/* function names */
-#define SNAMES                 /* engine.c looks after details */
-
-#include "engine.c"
-
-/* now undo things */
-#undef states
-#undef CLEAR
-#undef SET0
-#undef SET1
-#undef ISSET
-#undef ASSIGN
-#undef EQ
-#undef STATEVARS
-#undef STATESETUP
-#undef STATETEARDOWN
-#undef SETUP
-#undef onestate
-#undef INIT
-#undef INC
-#undef ISSTATEIN
-#undef FWD
-#undef BACK
-#undef ISSETBACK
-#undef SNAMES
-
-/* macros for manipulating states, large version */
-#define        states  char *
-#define        CLEAR(v)        memset(v, 0, (size_t)m->g->nstates)
-#define        SET0(v, n)      ((v)[n] = 0)
-#define        SET1(v, n)      ((v)[n] = 1)
-#define        ISSET(v, n)     ((v)[n])
-#define        ASSIGN(d, s)    memcpy(d, s, (size_t)m->g->nstates)
-#define        EQ(a, b)        (memcmp(a, b, (size_t)m->g->nstates) == 0)
-#define        STATEVARS       int vn; char *space
-#define        STATESETUP(m, nv) \
-    if (((m)->space = malloc((size_t)((nv)*(m)->g->nstates))) == NULL) \
-       return(REG_ESPACE); \
-    else \
-       (m)->vn = 0
-
-#define        STATETEARDOWN(m)        { free((m)->space); m->space = NULL; }
-#define        SETUP(v)        ((v) = &m->space[(size_t)(m->vn++ * m->g->nstates)])
-#define        onestate        int
-#define        INIT(o, n)      ((o) = (n))
-#define        INC(o)  ((o)++)
-#define        ISSTATEIN(v, o) ((v)[o])
-/* some abbreviations; note that some of these know variable names! */
-/* do "if I'm here, I can also be there" etc without branches */
-#define        FWD(dst, src, n)        ((dst)[here+(n)] |= (src)[here])
-#define        BACK(dst, src, n)       ((dst)[here-(n)] |= (src)[here])
-#define        ISSETBACK(v, n) ((v)[here - (n)])
-/* function names */
-#define        LNAMES                  /* flag */
-
-#include "engine.c"
-
-/*
- - regexec - interface for matching
- = extern int regexec(const regex_t *, const char *, size_t, \
- =                                     regmatch_t [], int);
- = #define     REG_NOTBOL      00001
- = #define     REG_NOTEOL      00002
- = #define     REG_STARTEND    00004
- = #define     REG_TRACE       00400   // tracing of execution
- = #define     REG_LARGE       01000   // force large representation
- = #define     REG_BACKR       02000   // force use of backref code
- *
- * We put this here so we can exploit knowledge of the state representation
- * when choosing which matcher to call.  Also, by this point the matchers
- * have been prototyped.
- */
-int                            /* 0 success, REG_NOMATCH failure */
-regexec(
-    const regex_t *preg,
-    const char *string,
-    size_t nmatch,
-    regmatch_t pmatch[],
-    int eflags)
-{
-       struct re_guts *g = preg->re_g;
-       char *s;
-#ifdef REDEBUG
-#      define  GOODFLAGS(f)    (f)
-#else
-#      define  GOODFLAGS(f)    ((f)&(REG_NOTBOL|REG_NOTEOL|REG_STARTEND))
-#endif
-
-       _DIAGASSERT(preg != NULL);
-       _DIAGASSERT(string != NULL);
-
-       if (preg->re_magic != MAGIC1 || g->magic != MAGIC2)
-               return(REG_BADPAT);
-       assert(!(g->iflags&BAD));
-       if (g->iflags&BAD)              /* backstop for no-debug case */
-               return(REG_BADPAT);
-       eflags = GOODFLAGS(eflags);
-
-       s = __UNCONST(string);
-
-       if (g->nstates <= (sopno)(CHAR_BIT*sizeof(states1)) && !(eflags&REG_LARGE))
-               return(smatcher(g, s, nmatch, pmatch, eflags));
-       else
-               return(lmatcher(g, s, nmatch, pmatch, eflags));
-}
diff --git a/lib/nbsd_libc/regex/regfree.c b/lib/nbsd_libc/regex/regfree.c
deleted file mode 100644 (file)
index ce011ea..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*     $NetBSD: regfree.c,v 1.15 2007/02/09 23:44:18 junyoung Exp $    */
-
-/*-
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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. 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.
- *
- *     @(#)regfree.c   8.3 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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.
- *
- *     @(#)regfree.c   8.3 (Berkeley) 3/20/94
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)regfree.c  8.3 (Berkeley) 3/20/94";
-#else
-__RCSID("$NetBSD: regfree.c,v 1.15 2007/02/09 23:44:18 junyoung Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <sys/types.h>
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <regex.h>
-
-#ifdef __weak_alias
-__weak_alias(regfree,_regfree)
-#endif
-
-#include "utils.h"
-#include "regex2.h"
-
-/*
- - regfree - free everything
- = extern void regfree(regex_t *);
- */
-void
-regfree(
-    regex_t *preg)
-{
-       struct re_guts *g;
-
-       _DIAGASSERT(preg != NULL);
-
-       _DIAGASSERT(preg->re_magic == MAGIC1);
-       if (preg->re_magic != MAGIC1)   /* oops */
-               return;                 /* nice to complain, but hard */
-
-       g = preg->re_g;
-       if (g == NULL || g->magic != MAGIC2)    /* oops again */
-               return;
-       preg->re_magic = 0;             /* mark it invalid */
-       g->magic = 0;                   /* mark it invalid */
-
-       if (g->strip != NULL)
-               free(g->strip);
-       if (g->sets != NULL)
-               free(g->sets);
-       if (g->setbits != NULL)
-               free(g->setbits);
-       if (g->must != NULL)
-               free(g->must);
-       free(g);
-}
diff --git a/lib/nbsd_libc/regex/utils.h b/lib/nbsd_libc/regex/utils.h
deleted file mode 100644 (file)
index 762caee..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*     $NetBSD: utils.h,v 1.6 2003/08/07 16:43:21 agc Exp $    */
-
-/*-
- * Copyright (c) 1992, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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. 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.
- *
- *     @(#)utils.h     8.3 (Berkeley) 3/20/94
- */
-
-/*-
- * Copyright (c) 1992, 1993, 1994 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer.
- *
- * 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.
- *
- *     @(#)utils.h     8.3 (Berkeley) 3/20/94
- */
-
-/* utility definitions */
-#define        DUPMAX          _POSIX2_RE_DUP_MAX      /* xxx is this right? */
-#define        INFINITY        (DUPMAX + 1)
-#define        NC              (CHAR_MAX - CHAR_MIN + 1)
-typedef unsigned char uch;
-
-/* switch off assertions (if not already off) if no REDEBUG */
-#ifndef REDEBUG
-#ifndef NDEBUG
-#define        NDEBUG  /* no assertions please */
-#endif
-#endif
-#include <assert.h>
-
-/* for old systems with bcopy() but no memmove() */
-#ifdef USEBCOPY
-#define        memmove(d, s, c)        bcopy(s, d, c)
-#endif
diff --git a/lib/nbsd_libc/stdio/Makefile.inc b/lib/nbsd_libc/stdio/Makefile.inc
deleted file mode 100644 (file)
index 2314360..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#      from: @(#)Makefile.inc  5.7 (Berkeley) 6/27/91
-#      $NetBSD: Makefile.inc,v 1.40 2010/12/22 16:59:10 christos Exp $
-
-# stdio sources
-.PATH: ${.CURDIR}/stdio
-
-CPPFLAGS+=-DWIDE_DOUBLE
-
-SRCS+= asprintf.c clrerr.c dprintf.c fclose.c fdopen.c feof.c ferror.c \
-       fflush.c fgetc.c fgetln.c fgetpos.c fgets.c fgetstr.c fgetwc.c \
-       fgetwln.c fgetws.c fileno.c findfp.c flags.c flockfile.c fopen.c \
-       fparseln.c fprintf.c fpurge.c fputc.c fputs.c fputwc.c fputws.c \
-       fread.c freopen.c fscanf.c fseek.c fseeko.c fsetpos.c ftell.c ftello.c \
-       funopen.c fvwrite.c fwalk.c fwide.c fwprintf.c fwrite.c fwscanf.c \
-       getc.c getchar.c getdelim.c getline.c gettemp.c getw.c getwc.c \
-       getwchar.c makebuf.c mkdtemp.c mkstemp.c perror.c printf.c putc.c \
-       putchar.c puts.c putw.c putwc.c putwchar.c refill.c remove.c rewind.c \
-       rget.c scanf.c setbuf.c setbuffer.c setvbuf.c snprintf.c snprintf_ss.c \
-       sscanf.c stdio.c swprintf.c swscanf.c tmpfile.c ungetc.c ungetwc.c \
-       vasprintf.c vdprintf.c vfprintf.c vfscanf.c vfwprintf.c vfwscanf.c \
-       vprintf.c vscanf.c vsnprintf.c vsnprintf_ss.c vsscanf.c vswprintf.c \
-       vswscanf.c vwprintf.c vwscanf.c wbuf.c wprintf.c wscanf.c wsetup.c
-SRCS+= fmemopen.c
-
-.if !defined(AUDIT)
-SRCS+= gets.c sprintf.c vsprintf.c tempnam.c tmpnam.c mktemp.c
-.endif
-
-# namespace purity wrappers
-SRCS+= _fileno.c _fseeko.c _ftello.c
-
-MAN+=  fclose.3 ferror.3 fflush.3 fgetln.3 fgets.3 fgetwln.3 fgetws.3 \
-       flockfile.3 fmemopen.3 fopen.3 fparseln.3 fputs.3 fputws.3 fread.3 \
-       fseek.3 funopen.3 fwide.3 getc.3 getdelim.3 getwc.3 mktemp.3 printf.3 \
-       putc.3 putwc.3 remove.3 scanf.3 setbuf.3 stdio.3 tmpnam.3 \
-       ungetc.3 ungetwc.3 wprintf.3 wscanf.3
-
-MLINKS+=ferror.3 clearerr.3 ferror.3 feof.3 ferror.3 fileno.3
-MLINKS+=fflush.3 fpurge.3
-MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3
-MLINKS+=fgets.3 gets.3
-MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3
-MLINKS+=fputs.3 puts.3
-MLINKS+=fread.3 fwrite.3
-MLINKS+=fseek.3 fgetpos.3 fseek.3 fseeko.3 fseek.3 fsetpos.3 fseek.3 ftell.3 \
-       fseek.3 ftello.3 fseek.3 rewind.3
-MLINKS+=funopen.3 fropen.3 funopen.3 fwopen.3
-MLINKS+=getc.3 fgetc.3 getc.3 getc_unlocked.3 getc.3 getchar.3 \
-       getc.3 getchar_unlocked.3 getc.3 getw.3
-MLINKS+=getdelim.3 getline.3
-MLINKS+=mktemp.3 mkdtemp.3 mktemp.3 mkstemp.3
-MLINKS+=printf.3 asprintf.3 printf.3 fprintf.3 printf.3 snprintf.3 \
-       printf.3 sprintf.3 printf.3 vasprintf.3 printf.3 vfprintf.3 \
-       printf.3 vprintf.3 printf.3 vsnprintf.3 printf.3 vsprintf.3 \
-       printf.3 dprintf.3 printf.3 vdprintf.3 printf.3 vsnprintf_ss.3
-MLINKS+=putc.3 fputc.3 putc.3 putc_unlocked.3 putc.3 putchar.3 \
-       putc.3 putchar_unlocked.3 putc.3 putw.3
-MLINKS+=scanf.3 fscanf.3 scanf.3 sscanf.3 scanf.3 vfscanf.3 scanf.3 vscanf.3 \
-       scanf.3 vsscanf.3
-MLINKS+=setbuf.3 setbuffer.3 setbuf.3 setlinebuf.3 setbuf.3 setvbuf.3
-MLINKS+=tmpnam.3 tempnam.3 tmpnam.3 tmpfile.3
-MLINKS+=putwc.3 fputwc.3 putwc.3 putwchar.3
-MLINKS+=getwc.3 fgetwc.3 getwc.3 getwchar.3
-MLINKS+=wprintf.3 fwprintf.3 wprintf.3 swprintf.3
-MLINKS+=wprintf.3 vwprintf.3 wprintf.3 vfwprintf.3 wprintf.3 vswprintf.3
-MLINKS+=wscanf.3 fwscanf.3 wscanf.3 swscanf.3 wscanf.3 vwscanf.3
-MLINKS+=wscanf.3 vswscanf.3 wscanf.3 vfwscanf.3
diff --git a/lib/nbsd_libc/stdio/asprintf.c b/lib/nbsd_libc/stdio/asprintf.c
deleted file mode 100644 (file)
index f537637..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*     $NetBSD: asprintf.c,v 1.18 2009/10/25 20:44:13 christos Exp $   */
-
-/*
- * Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
- * 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. 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 ``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.
- */
-
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: asprintf.c,v 1.18 2009/10/25 20:44:13 christos Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-
-#include "reentrant.h"
-#include "local.h"
-
-#ifdef __weak_alias
-__weak_alias(asprintf, _asprintf)
-#endif
-
-int
-asprintf(char **str, char const *fmt, ...)
-{
-       int ret;
-       va_list ap;
-       FILE f;
-       struct __sfileext fext;
-       unsigned char *_base;
-
-       _DIAGASSERT(str != NULL);
-
-       _FILEEXT_SETUP(&f, &fext);
-       f._file = -1;
-       f._flags = __SWR | __SSTR | __SALC;
-       f._bf._base = f._p = malloc((size_t)128);
-       if (f._bf._base == NULL)
-               goto err;
-       f._bf._size = f._w = 127;               /* Leave room for the NUL */
-       va_start(ap, fmt);
-       ret = __vfprintf_unlocked(&f, fmt, ap);
-       va_end(ap);
-       if (ret < 0)
-               goto err;
-       *f._p = '\0';
-       _base = realloc(f._bf._base, (size_t)ret + 1);
-       if (_base == NULL)
-               goto err;
-       *str = (char *)_base;
-       return (ret);
-
-err:
-       if (f._bf._base)
-               free(f._bf._base);
-       *str = NULL;
-       errno = ENOMEM;
-       return (-1);
-}
diff --git a/lib/nbsd_libc/stdio/fclose.c b/lib/nbsd_libc/stdio/fclose.c
deleted file mode 100644 (file)
index c1e0d24..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*     $NetBSD: fclose.c,v 1.17 2010/01/11 20:39:29 joerg Exp $        */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fclose.c   8.1 (Berkeley) 6/4/93";
-#endif
-__RCSID("$NetBSD: fclose.c,v 1.17 2010/01/11 20:39:29 joerg Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include "reentrant.h"
-#include "local.h"
-
-int
-fclose(fp)
-       FILE *fp;
-{
-       int r;
-
-       _DIAGASSERT(fp != NULL);
-
-       if (fp->_flags == 0) {  /* not open! */
-               errno = EBADF;
-               return (EOF);
-       }
-       FLOCKFILE(fp);
-       WCIO_FREE(fp);
-       r = fp->_flags & __SWR ? __sflush(fp) : 0;
-       if (fp->_close != NULL && (*fp->_close)(fp->_cookie) < 0)
-               r = EOF;
-       if (fp->_flags & __SMBF)
-               free((char *)fp->_bf._base);
-       if (HASUB(fp))
-               FREEUB(fp);
-       FREELB(fp);
-       FUNLOCKFILE(fp);
-       fp->_file = -1;
-       fp->_flags = 0;         /* Release this FILE for reuse. */
-       fp->_r = fp->_w = 0;    /* Mess up if reaccessed. */
-       return (r);
-}
diff --git a/lib/nbsd_libc/stdio/feof.c b/lib/nbsd_libc/stdio/feof.c
deleted file mode 100644 (file)
index 904b9b4..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*     $NetBSD: feof.c,v 1.11 2003/08/07 16:43:22 agc Exp $    */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)feof.c     8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: feof.c,v 1.11 2003/08/07 16:43:22 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-/*
- * A subroutine version of the macro feof.
- */
-#undef feof
-
-int
-feof(fp)
-       FILE *fp;
-{
-       int r;
-
-       _DIAGASSERT(fp != NULL);
-
-       FLOCKFILE(fp);
-       r = __sfeof(fp);
-       FUNLOCKFILE(fp);
-       return r;
-}
diff --git a/lib/nbsd_libc/stdio/ferror.c b/lib/nbsd_libc/stdio/ferror.c
deleted file mode 100644 (file)
index 97b58a7..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*     $NetBSD: ferror.c,v 1.11 2003/08/07 16:43:22 agc Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)ferror.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: ferror.c,v 1.11 2003/08/07 16:43:22 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-/*
- * A subroutine version of the macro ferror.
- */
-#undef ferror
-
-int
-ferror(fp)
-       FILE *fp;
-{
-       int r;
-
-       _DIAGASSERT(fp != NULL);
-
-       FLOCKFILE(fp);
-       r = __sferror(fp);
-       FUNLOCKFILE(fp);
-       return r;
-}
diff --git a/lib/nbsd_libc/stdio/fflush.c b/lib/nbsd_libc/stdio/fflush.c
deleted file mode 100644 (file)
index a78ad5e..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*     $NetBSD: fflush.c,v 1.15 2003/08/07 16:43:22 agc Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fflush.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fflush.c,v 1.15 2003/08/07 16:43:22 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-#ifdef _REENTRANT
-extern rwlock_t __sfp_lock;
-#endif
-
-/* Flush a single file, or (if fp is NULL) all files.  */
-int
-fflush(fp)
-       FILE *fp;
-{
-       int r;
-
-       if (fp == NULL) {
-               rwlock_rdlock(&__sfp_lock);
-               r = _fwalk(__sflush);
-               rwlock_unlock(&__sfp_lock);
-               return r;
-       }
-
-       FLOCKFILE(fp);
-       if ((fp->_flags & (__SWR | __SRW)) == 0) {
-               errno = EBADF;
-               r = EOF;
-       } else {
-               r = __sflush(fp);
-       }
-       FUNLOCKFILE(fp);
-       return r;
-}
-
-int
-__sflush(fp)
-       FILE *fp;
-{
-       unsigned char *p;
-       int n, t;
-
-       _DIAGASSERT(fp != NULL);
-
-       t = fp->_flags;
-       if ((t & __SWR) == 0)
-               return (0);
-
-       if ((p = fp->_bf._base) == NULL)
-               return (0);
-
-       n = fp->_p - p;         /* write this much */
-
-       /*
-        * Set these immediately to avoid problems with longjmp and to allow
-        * exchange buffering (via setvbuf) in user write function.
-        */
-       fp->_p = p;
-       fp->_w = t & (__SLBF|__SNBF) ? 0 : fp->_bf._size;
-
-       for (; n > 0; n -= t, p += t) {
-               t = (*fp->_write)(fp->_cookie, (char *)p, n);
-               if (t <= 0) {
-                       fp->_flags |= __SERR;
-                       return (EOF);
-               }
-       }
-       return (0);
-}
diff --git a/lib/nbsd_libc/stdio/fgetc.c b/lib/nbsd_libc/stdio/fgetc.c
deleted file mode 100644 (file)
index 4783cfe..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*     $NetBSD: fgetc.c,v 1.11 2003/08/07 16:43:22 agc Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fgetc.c    8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fgetc.c,v 1.11 2003/08/07 16:43:22 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-int
-fgetc(fp)
-       FILE *fp;
-{
-       int r;
-
-       _DIAGASSERT(fp != NULL);
-
-       FLOCKFILE(fp);
-       r = __sgetc(fp);
-       FUNLOCKFILE(fp);
-       return r;
-}
diff --git a/lib/nbsd_libc/stdio/fgetpos.c b/lib/nbsd_libc/stdio/fgetpos.c
deleted file mode 100644 (file)
index e0c97e9..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*     $NetBSD: fgetpos.c,v 1.11 2003/08/07 16:43:23 agc Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fgetpos.c  8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fgetpos.c,v 1.11 2003/08/07 16:43:23 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-
-int
-fgetpos(fp, pos)
-       FILE *fp;
-       fpos_t *pos;
-{
-       _DIAGASSERT(fp != NULL);
-       _DIAGASSERT(pos != NULL);
-
-       return((*pos = (off_t)ftello(fp)) == (off_t)-1);
-}
diff --git a/lib/nbsd_libc/stdio/fgets.c b/lib/nbsd_libc/stdio/fgets.c
deleted file mode 100644 (file)
index 15a7370..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*     $NetBSD: fgets.c,v 1.27 2009/10/25 20:44:13 christos Exp $      */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fgets.c    8.2 (Berkeley) 12/22/93";
-#else
-__RCSID("$NetBSD: fgets.c,v 1.27 2009/10/25 20:44:13 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include "reentrant.h"
-#include "local.h"
-#ifdef _FORTIFY_SOURCE
-#undef fgets
-#endif
-
-/*
- * Read at most n-1 characters from the given file.
- * Stop when a newline has been read, or the count runs out.
- * Return first argument, or NULL if no characters were read.
- */
-char *
-fgets(buf, n, fp)
-       char *buf;
-       int n;
-       FILE *fp;
-{
-       int len;
-       char *s;
-       unsigned char *p, *t;
-
-       _DIAGASSERT(buf != NULL);
-       _DIAGASSERT(fp != NULL);
-
-       FLOCKFILE(fp);
-       _SET_ORIENTATION(fp, -1);
-       s = buf;
-       n--;                    /* leave space for NUL */
-       do {
-               /*
-                * If the buffer is empty, refill it.
-                */
-               if (fp->_r <= 0) {
-                       if (__srefill(fp)) {
-                               /* EOF/error: stop with partial or no line */
-                               if (s == buf) {
-                                       FUNLOCKFILE(fp);
-                                       return (NULL);
-                               }
-                               break;
-                       }
-               }
-               len = fp->_r;
-               p = fp->_p;
-
-               /*
-                * Scan through at most n bytes of the current buffer,
-                * looking for '\n'.  If found, copy up to and including
-                * newline, and stop.  Otherwise, copy entire chunk
-                * and loop.
-                */
-               if (len > n) {
-                       if (n < 0) {
-                               /*
-                                * Caller's length <= 0
-                                * We can't write into the buffer, so cannot
-                                * return a string, so must return NULL.
-                                * Set errno and __SERR so it is consistent.
-                                * TOG gives no indication of what to do here!
-                                */
-                               errno = EINVAL;
-                               fp->_flags |= __SERR;
-                               FUNLOCKFILE(fp);
-                               return NULL;
-                       }
-                       len = n;
-               }
-               t = memchr(p, '\n', (size_t)len);
-               if (t != NULL) {
-                       len = (int)(++t - p);
-                       fp->_r -= len;
-                       fp->_p = t;
-                       (void)memcpy(s, p, (size_t)len);
-                       s[len] = 0;
-                       FUNLOCKFILE(fp);
-                       return (buf);
-               }
-               fp->_r -= len;
-               fp->_p += len;
-               (void)memcpy(s, p, (size_t)len);
-               s += len;
-               n -= len;
-       } while (n != 0);
-       *s = 0;
-       FUNLOCKFILE(fp);
-       return (buf);
-}
diff --git a/lib/nbsd_libc/stdio/fileno.c b/lib/nbsd_libc/stdio/fileno.c
deleted file mode 100644 (file)
index 6550a28..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*     $NetBSD: fileno.c,v 1.12 2004/05/09 17:27:53 kleink Exp $       */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fileno.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fileno.c,v 1.12 2004/05/09 17:27:53 kleink Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-/*
- * A subroutine version of the macro fileno.
- */
-#undef fileno
-int _fileno __P((FILE *));     /* XXX */
-
-__weak_alias(fileno,_fileno)
-
-int
-_fileno(fp)
-       FILE *fp;
-{
-       int r;
-
-       _DIAGASSERT(fp != NULL);
-
-       FLOCKFILE(fp);
-       r = __sfileno(fp);
-       FUNLOCKFILE(fp);
-       return r;
-}
diff --git a/lib/nbsd_libc/stdio/fopen.c b/lib/nbsd_libc/stdio/fopen.c
deleted file mode 100644 (file)
index c75e1c0..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*     $NetBSD: fopen.c,v 1.13 2008/03/13 15:40:00 christos Exp $      */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fopen.c    8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fopen.c,v 1.13 2008/03/13 15:40:00 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <assert.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <errno.h>
-#include <limits.h>
-#include "reentrant.h"
-#include "local.h"
-
-FILE *
-fopen(file, mode)
-       const char *file;
-       const char *mode;
-{
-       FILE *fp;
-       int f;
-       int flags, oflags;
-
-       _DIAGASSERT(file != NULL);
-       if ((flags = __sflags(mode, &oflags)) == 0)
-               return (NULL);
-       if ((fp = __sfp()) == NULL)
-               return (NULL);
-       if ((f = open(file, oflags, DEFFILEMODE)) < 0)
-               goto release;
-       if (oflags & O_NONBLOCK) {
-               struct stat st;
-               if (fstat(f, &st) == -1) {
-                       int sverrno = errno;
-                       (void)close(f);
-                       errno = sverrno;
-                       goto release;
-               }
-               if (!S_ISREG(st.st_mode)) {
-                       (void)close(f);
-                       errno = EFTYPE;
-                       goto release;
-               }
-       }
-       /*
-        * File descriptors are a full int, but _file is only a short.
-        * If we get a valid file descriptor that is greater or equal to
-        * USHRT_MAX, then the fd will get sign-extended into an
-        * invalid file descriptor.  Handle this case by failing the
-        * open. (We treat the short as unsigned, and special-case -1).
-        */
-       if (f >= USHRT_MAX) {
-               errno = EMFILE;
-               goto release;
-       }
-
-       fp->_file = f;
-       fp->_flags = flags;
-       fp->_cookie = fp;
-       fp->_read = __sread;
-       fp->_write = __swrite;
-       fp->_seek = __sseek;
-       fp->_close = __sclose;
-
-       /*
-        * When opening in append mode, even though we use O_APPEND,
-        * we need to seek to the end so that ftell() gets the right
-        * answer.  If the user then alters the seek pointer, or
-        * the file extends, this will fail, but there is not much
-        * we can do about this.  (We could set __SAPP and check in
-        * fseek and ftell.)
-        */
-       if (oflags & O_APPEND)
-               (void) __sseek((void *)fp, (fpos_t)0, SEEK_END);
-       return (fp);
-release:
-       fp->_flags = 0;                 /* release */
-       return (NULL);
-}
diff --git a/lib/nbsd_libc/stdio/fprintf.c b/lib/nbsd_libc/stdio/fprintf.c
deleted file mode 100644 (file)
index 54e4f33..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*     $NetBSD: fprintf.c,v 1.11 2003/08/07 16:43:24 agc Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fprintf.c  8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fprintf.c,v 1.11 2003/08/07 16:43:24 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-int
-fprintf(FILE *fp, const char *fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       _DIAGASSERT(fp != NULL);
-       _DIAGASSERT(fmt != NULL);
-
-       va_start(ap, fmt);
-       ret = vfprintf(fp, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/lib/nbsd_libc/stdio/fputc.c b/lib/nbsd_libc/stdio/fputc.c
deleted file mode 100644 (file)
index 1bc81e3..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*     $NetBSD: fputc.c,v 1.12 2003/08/07 16:43:24 agc Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fputc.c    8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fputc.c,v 1.12 2003/08/07 16:43:24 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-int
-fputc(c, fp)
-       int c;
-       FILE *fp;
-{
-       int r;
-
-       _DIAGASSERT(fp != NULL);
-
-       FLOCKFILE(fp); 
-       r = __sputc(c, fp);
-       FUNLOCKFILE(fp);
-       return r;
-}
diff --git a/lib/nbsd_libc/stdio/fputs.c b/lib/nbsd_libc/stdio/fputs.c
deleted file mode 100644 (file)
index 5463595..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*     $NetBSD: fputs.c,v 1.14 2005/06/22 19:45:22 christos Exp $      */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fputs.c    8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fputs.c,v 1.14 2005/06/22 19:45:22 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include "reentrant.h"
-#include "local.h"
-#include "fvwrite.h"
-
-/*
- * Write the given string to the given file.
- */
-int
-fputs(s, fp)
-       const char *s;
-       FILE *fp;
-{
-       struct __suio uio;
-       struct __siov iov;
-       int r;
-
-       _DIAGASSERT(s != NULL);
-       _DIAGASSERT(fp != NULL);
-
-       if (s == NULL)
-               s = "(null)";
-
-       iov.iov_base = __UNCONST(s);
-       iov.iov_len = uio.uio_resid = strlen(s);
-       uio.uio_iov = &iov;
-       uio.uio_iovcnt = 1;
-       FLOCKFILE(fp);
-       _SET_ORIENTATION(fp, -1);
-       r = __sfvwrite(fp, &uio);
-       FUNLOCKFILE(fp);
-       return r;
-}
diff --git a/lib/nbsd_libc/stdio/fread.c b/lib/nbsd_libc/stdio/fread.c
deleted file mode 100644 (file)
index d61fa81..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*     $NetBSD: fread.c,v 1.20 2009/10/25 20:44:13 christos Exp $      */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fread.c    8.2 (Berkeley) 12/11/93";
-#else
-__RCSID("$NetBSD: fread.c,v 1.20 2009/10/25 20:44:13 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include "reentrant.h"
-#include "local.h"
-
-size_t
-fread(buf, size, count, fp)
-       void *buf;
-       size_t size, count;
-       FILE *fp;
-{
-       size_t resid;
-       char *p;
-       int r;
-       size_t total;
-
-       _DIAGASSERT(fp != NULL);
-       /*
-        * The ANSI standard requires a return value of 0 for a count
-        * or a size of 0.  Whilst ANSI imposes no such requirements on
-        * fwrite, the SUSv2 does.
-        */
-       if ((resid = count * size) == 0)
-               return (0);
-
-       _DIAGASSERT(buf != NULL);
-
-       FLOCKFILE(fp);
-       if (fp->_r < 0)
-               fp->_r = 0;
-       total = resid;
-       p = buf;
-       while (resid > (size_t)(r = fp->_r)) {
-               (void)memcpy(p, fp->_p, (size_t)r);
-               fp->_p += r;
-               /* fp->_r = 0 ... done in __srefill */
-               p += r;
-               resid -= r;
-               if (__srefill(fp)) {
-                       /* no more input: return partial result */
-                       FUNLOCKFILE(fp);
-                       return ((total - resid) / size);
-               }
-       }
-       (void)memcpy(p, fp->_p, resid);
-       fp->_r -= resid;
-       fp->_p += resid;
-       FUNLOCKFILE(fp);
-       return (count);
-}
diff --git a/lib/nbsd_libc/stdio/freopen.c b/lib/nbsd_libc/stdio/freopen.c
deleted file mode 100644 (file)
index 5b370fa..0000000
+++ /dev/null
@@ -1,205 +0,0 @@
-/*     $NetBSD: freopen.c,v 1.16 2010/01/11 20:39:29 joerg Exp $       */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)freopen.c  8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: freopen.c,v 1.16 2010/01/11 20:39:29 joerg Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <limits.h>
-#include "reentrant.h"
-#include "local.h"
-
-/* 
- * Re-direct an existing, open (probably) file to some other file. 
- * ANSI is written such that the original file gets closed if at
- * all possible, no matter what.
- */
-FILE *
-freopen(file, mode, fp)
-       const char *file, *mode;
-       FILE *fp;
-{
-       int f;
-       int flags, isopen, oflags, sverrno, wantfd;
-
-       _DIAGASSERT(file != NULL);
-       _DIAGASSERT(mode != NULL);
-       _DIAGASSERT(fp != NULL);
-
-       if ((flags = __sflags(mode, &oflags)) == 0) {
-               (void) fclose(fp);
-               return (NULL);
-       }
-
-       if (!__sdidinit)
-               __sinit();
-
-       /*
-        * There are actually programs that depend on being able to "freopen"
-        * descriptors that weren't originally open.  Keep this from breaking.
-        * Remember whether the stream was open to begin with, and which file
-        * descriptor (if any) was associated with it.  If it was attached to
-        * a descriptor, defer closing it; freopen("/dev/stdin", "r", stdin)
-        * should work.  This is unnecessary if it was not a Unix file.
-        */
-       if (fp->_flags == 0) {
-               fp->_flags = __SEOF;    /* hold on to it */
-               isopen = 0;
-               wantfd = -1;
-       } else {
-               /* flush the stream; ANSI doesn't require this. */
-               if (fp->_flags & __SWR)
-                       (void) __sflush(fp);
-               /* if close is NULL, closing is a no-op, hence pointless */
-               isopen = fp->_close != NULL;
-               if ((wantfd = __sfileno(fp)) == -1 && isopen) {
-                       (void) (*fp->_close)(fp->_cookie);
-                       isopen = 0;
-               }
-       }
-
-       /* Get a new descriptor to refer to the new file. */
-       f = open(file, oflags, DEFFILEMODE);
-       if (f < 0 && isopen) {
-               /* If out of fd's close the old one and try again. */
-               if (errno == ENFILE || errno == EMFILE) {
-                       (void) (*fp->_close)(fp->_cookie);
-                       isopen = 0;
-                       f = open(file, oflags, DEFFILEMODE);
-               }
-       }
-       sverrno = errno;
-
-       /*
-        * Finish closing fp.  Even if the open succeeded above, we cannot
-        * keep fp->_base: it may be the wrong size.  This loses the effect
-        * of any setbuffer calls, but stdio has always done this before.
-        */
-       if (isopen && f != wantfd)
-               (void) (*fp->_close)(fp->_cookie);
-       if (fp->_flags & __SMBF)
-               free((char *)fp->_bf._base);
-       fp->_w = 0;
-       fp->_r = 0;
-       fp->_p = NULL;
-       fp->_bf._base = NULL;
-       fp->_bf._size = 0;
-       fp->_lbfsize = 0;
-       if (HASUB(fp))
-               FREEUB(fp);
-       WCIO_FREE(fp);
-       _UB(fp)._size = 0;
-       FREELB(fp);
-
-       if (f < 0) {                    /* did not get it after all */
-               fp->_flags = 0;         /* set it free */
-               errno = sverrno;        /* restore in case _close clobbered */
-               return (NULL);
-       }
-
-       if (oflags & O_NONBLOCK) {
-               struct stat st;
-               if (fstat(f, &st) == -1) {
-                       sverrno = errno;
-                       (void)close(f);
-                       errno = sverrno;
-                       return (NULL);
-               }
-               if (!S_ISREG(st.st_mode)) {
-                       (void)close(f);
-                       errno = EFTYPE;
-                       return (NULL);
-               }
-       }
-
-       /*
-        * If reopening something that was open before on a real file, try
-        * to maintain the descriptor.  Various C library routines (perror)
-        * assume stderr is always fd STDERR_FILENO, even if being freopen'd.
-        */
-       if (wantfd >= 0 && f != wantfd) {
-               if (dup2(f, wantfd) >= 0) {
-                       (void) close(f);
-                       f = wantfd;
-               }
-       }
-
-       /*
-        * File descriptors are a full int, but _file is only a short.
-        * If we get a valid file descriptor that is greater or equal to
-        * USHRT_MAX, then the fd will get sign-extended into an
-        * invalid file descriptor.  Handle this case by failing the
-        * open. (We treat the short as unsigned, and special-case -1).
-        */
-       if (f >= USHRT_MAX) {
-               (void)close(f);
-               errno = EMFILE;
-               return NULL;
-       }
-
-       fp->_flags = flags;
-       fp->_file = f;
-       fp->_cookie = fp;
-       fp->_read = __sread;
-       fp->_write = __swrite;
-       fp->_seek = __sseek;
-       fp->_close = __sclose;
-
-       /*
-        * When reopening in append mode, even though we use O_APPEND,
-        * we need to seek to the end so that ftell() gets the right
-        * answer.  If the user then alters the seek pointer, or
-        * the file extends, this will fail, but there is not much
-        * we can do about this.  (We could set __SAPP and check in
-        * fseek and ftell.)
-        */
-       if (oflags & O_APPEND)
-               (void) __sseek((void *)fp, (fpos_t)0, SEEK_END);
-       return (fp);
-}
diff --git a/lib/nbsd_libc/stdio/fscanf.c b/lib/nbsd_libc/stdio/fscanf.c
deleted file mode 100644 (file)
index 817e9a1..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*     $NetBSD: fscanf.c,v 1.12 2003/08/07 16:43:25 agc Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fscanf.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fscanf.c,v 1.12 2003/08/07 16:43:25 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "reentrant.h"
-#include "local.h"
-
-int
-fscanf(FILE *fp, char const *fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = __svfscanf(fp, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/lib/nbsd_libc/stdio/fseek.c b/lib/nbsd_libc/stdio/fseek.c
deleted file mode 100644 (file)
index bcfa5a9..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*     $NetBSD: fseek.c,v 1.23 2008/04/29 06:53:01 martin Exp $        */
-
-/*-
- * Copyright (c) 2005 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by David Laight.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fseek.c,v 1.23 2008/04/29 06:53:01 martin Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "namespace.h"
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "reentrant.h"
-#include "local.h"
-
-/*
- * Seek the given file to the given offset.
- * Zero extend the offset if SEEK_SET to allow access to 4GB files
- */
-int
-fseek(FILE *fp, long l_offset, int whence)
-{
-       off_t offset;
-
-       if (whence == SEEK_SET)
-               offset = (unsigned long)l_offset;
-       else
-               offset = l_offset;
-       return fseeko(fp, offset, whence);
-}
diff --git a/lib/nbsd_libc/stdio/fsetpos.c b/lib/nbsd_libc/stdio/fsetpos.c
deleted file mode 100644 (file)
index 6fbd3e2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*     $NetBSD: fsetpos.c,v 1.10 2003/08/07 16:43:25 agc Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fsetpos.c  8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fsetpos.c,v 1.10 2003/08/07 16:43:25 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-
-/*
- * fsetpos: like fseek.
- */
-int
-fsetpos(iop, pos)
-       FILE *iop;
-       const fpos_t *pos;
-{
-       _DIAGASSERT(iop != NULL);
-       _DIAGASSERT(pos != NULL);
-
-       return (fseeko(iop, (off_t)*pos, SEEK_SET));
-}
diff --git a/lib/nbsd_libc/stdio/ftell.c b/lib/nbsd_libc/stdio/ftell.c
deleted file mode 100644 (file)
index 828a23a..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*     $NetBSD: ftell.c,v 1.17 2010/10/24 17:44:32 tron Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)ftell.c    8.2 (Berkeley) 5/4/95";
-#else
-__RCSID("$NetBSD: ftell.c,v 1.17 2010/10/24 17:44:32 tron Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-/*
- * ftell: return current offset.
- */
-long
-ftell(fp)
-       FILE *fp;
-{
-       fpos_t pos;
-
-
-       FLOCKFILE(fp);
-
-       if (fp->_seek == NULL) {
-               FUNLOCKFILE(fp);
-               errno = ESPIPE;                 /* historic practice */
-               return -1L;
-       }
-
-       /*
-        * Find offset of underlying I/O object, then
-        * adjust for buffered bytes.
-        */
-       __sflush(fp);           /* may adjust seek offset on append stream */
-       if (fp->_flags & __SOFF)
-               pos = fp->_offset;
-       else {
-               pos = (*fp->_seek)(fp->_cookie, (fpos_t)0, SEEK_CUR);
-               if (pos == -1L) {
-                       FUNLOCKFILE(fp);
-                       return (long)(pos);
-               }
-       }
-       if (fp->_flags & __SRD) {
-               /*
-                * Reading.  Any unread characters (including
-                * those from ungetc) cause the position to be
-                * smaller than that in the underlying object.
-                */
-               pos -= fp->_r;
-               if (HASUB(fp))
-                       pos -= fp->_ur;
-       } else if (fp->_flags & __SWR && fp->_p != NULL) {
-               /*
-                * Writing.  Any buffered characters cause the
-                * position to be greater than that in the
-                * underlying object.
-                */
-               pos += fp->_p - fp->_bf._base;
-       }
-       FUNLOCKFILE(fp);
-
-       if (__fpos_overflow(pos)) {
-               errno = EOVERFLOW;
-               return -1L;
-       }
-               
-       return (long)(pos);
-}
diff --git a/lib/nbsd_libc/stdio/fwrite.c b/lib/nbsd_libc/stdio/fwrite.c
deleted file mode 100644 (file)
index c48a47c..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*     $NetBSD: fwrite.c,v 1.16 2005/11/29 03:12:00 christos Exp $     */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)fwrite.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: fwrite.c,v 1.16 2005/11/29 03:12:00 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-#include "fvwrite.h"
-
-/*
- * Write `count' objects (each size `size') from memory to the given file.
- * Return the number of whole objects written.
- */
-size_t
-fwrite(buf, size, count, fp)
-       const void *buf;
-       size_t size, count;
-       FILE *fp;
-{
-       size_t n;
-       struct __suio uio;
-       struct __siov iov;
-
-       _DIAGASSERT(fp != NULL);
-       /*
-        * SUSv2 requires a return value of 0 for a count or a size of 0.
-        */
-       if ((n = count * size) == 0)
-               return (0);
-       _DIAGASSERT(buf != NULL);
-
-       iov.iov_base = __UNCONST(buf);
-       uio.uio_resid = iov.iov_len = n;
-       uio.uio_iov = &iov;
-       uio.uio_iovcnt = 1;
-
-       /*
-        * The usual case is success (__sfvwrite returns 0);
-        * skip the divide if this happens, since divides are
-        * generally slow and since this occurs whenever size==0.
-        */
-       FLOCKFILE(fp);
-       if (__sfvwrite(fp, &uio) != 0)
-               count = ((n - uio.uio_resid) / size);
-       FUNLOCKFILE(fp);
-       return (count);
-}
diff --git a/lib/nbsd_libc/stdio/getc.c b/lib/nbsd_libc/stdio/getc.c
deleted file mode 100644 (file)
index 55bef64..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*     $NetBSD: getc.c,v 1.11 2003/08/07 16:43:26 agc Exp $    */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)getc.c     8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: getc.c,v 1.11 2003/08/07 16:43:26 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-/*
- * A subroutine version of the macro getc.
- */
-#undef getc
-#undef getc_unlocked
-
-int
-getc(fp)
-       FILE *fp;
-{
-       int r;
-
-       _DIAGASSERT(fp != NULL);
-
-       FLOCKFILE(fp);
-       r = __sgetc(fp);
-       FUNLOCKFILE(fp);
-       return r;
-}
-
-int
-getc_unlocked(fp)
-       FILE *fp;
-{
-
-       _DIAGASSERT(fp != NULL);
-
-       return (__sgetc(fp));
-}
diff --git a/lib/nbsd_libc/stdio/getchar.c b/lib/nbsd_libc/stdio/getchar.c
deleted file mode 100644 (file)
index 75cae92..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*     $NetBSD: getchar.c,v 1.9 2003/08/07 16:43:27 agc Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)getchar.c  8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: getchar.c,v 1.9 2003/08/07 16:43:27 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * A subroutine version of the macro getchar.
- */
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-#undef getchar
-#undef getchar_unlocked
-
-int
-getchar()
-{
-       FILE *fp = stdin;
-       int r;
-
-        FLOCKFILE(fp);
-        r = __sgetc(fp);
-        FUNLOCKFILE(fp);
-        return r;
-}
-
-int
-getchar_unlocked()
-{
-       return (__sgetc(stdin));
-}
diff --git a/lib/nbsd_libc/stdio/gets.c b/lib/nbsd_libc/stdio/gets.c
deleted file mode 100644 (file)
index 8526d8a..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*     $NetBSD: gets.c,v 1.16 2007/06/03 17:39:26 christos Exp $       */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)gets.c     8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: gets.c,v 1.16 2007/06/03 17:39:26 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-#ifdef _FORTIFY_SOURCE
-#undef gets
-#endif
-
-__warn_references(gets, "warning: this program uses gets(), which is unsafe.")
-
-char *
-gets(buf)
-       char *buf;
-{
-       int c;
-       char *s;
-
-       _DIAGASSERT(buf != NULL);
-
-       FLOCKFILE(stdin);
-       for (s = buf; (c = getchar_unlocked()) != '\n'; ) {
-               if (c == EOF) {
-                       if (s == buf) {
-                               FUNLOCKFILE(stdin);
-                               return (NULL);
-                       } else {
-                               break;
-                       }
-               } else {
-                       *s++ = c;
-               }
-       }
-       *s = 0;
-       FUNLOCKFILE(stdin);
-       return (buf);
-}
diff --git a/lib/nbsd_libc/stdio/mktemp.c b/lib/nbsd_libc/stdio/mktemp.c
deleted file mode 100644 (file)
index 6eb71b0..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*     $NetBSD: mktemp.c,v 1.19 2003/08/07 16:43:28 agc Exp $  */
-
-/*
- * Copyright (c) 1987, 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)mktemp.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: mktemp.c,v 1.19 2003/08/07 16:43:28 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include "reentrant.h"
-#include "local.h"
-
-char *
-_mktemp(path)
-       char *path;
-{
-
-       _DIAGASSERT(path != NULL);
-
-       return (__gettemp(path, (int *)NULL, 0) ? path : (char *)NULL);
-}
-
-__warn_references(mktemp,
-    "warning: mktemp() possibly used unsafely, use mkstemp() or mkdtemp()")
-
-char *
-mktemp(path)
-       char *path;
-{
-
-       _DIAGASSERT(path != NULL);
-
-       return (__gettemp(path, (int *)NULL, 0) ? path : (char *)NULL);
-}
diff --git a/lib/nbsd_libc/stdio/perror.c b/lib/nbsd_libc/stdio/perror.c
deleted file mode 100644 (file)
index de38e88..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*     $NetBSD: perror.c,v 1.24 2006/01/26 11:13:42 kleink Exp $       */
-
-/*
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)perror.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: perror.c,v 1.24 2006/01/26 11:13:42 kleink Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include <string.h>
-#include "extern.h"
-
-/*
- * Since perror() is not allowed to change the contents of strerror()'s
- * static buffer, both functions supply their own buffers to strerror_r().
- */
-
-void
-perror(const char *s)
-{
-       const char *separator;
-       char buf[NL_TEXTMAX];
-
-       if (s == NULL)
-               s = "";
-       if (*s == '\0')
-               separator = "";
-       else
-               separator = ": ";
-
-       (void)strerror_r(errno, buf, sizeof(buf));
-       (void)fprintf(stderr, "%s%s%s\n", s, separator, buf);
-}
diff --git a/lib/nbsd_libc/stdio/printf.c b/lib/nbsd_libc/stdio/printf.c
deleted file mode 100644 (file)
index 1c195ff..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*     $NetBSD: printf.c,v 1.11 2003/08/07 16:43:29 agc Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)printf.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: printf.c,v 1.11 2003/08/07 16:43:29 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-int
-printf(char const *fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       va_start(ap, fmt);
-       ret = vfprintf(stdout, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/lib/nbsd_libc/stdio/putc.c b/lib/nbsd_libc/stdio/putc.c
deleted file mode 100644 (file)
index b3d6a5a..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*     $NetBSD: putc.c,v 1.11 2003/08/07 16:43:29 agc Exp $    */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)putc.c     8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: putc.c,v 1.11 2003/08/07 16:43:29 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-/*
- * A subroutine version of the macro putc.
- */
-#undef putc
-#undef putc_unlocked
-
-int
-putc(c, fp)
-       int c;
-       FILE *fp;
-{
-       int r;
-
-       _DIAGASSERT(fp != NULL);
-
-       FLOCKFILE(fp);
-       r = __sputc(c, fp);
-       FUNLOCKFILE(fp);
-       return r;
-}
-
-int
-putc_unlocked(c, fp)
-       int c;
-       FILE *fp;
-{
-
-       _DIAGASSERT(fp != NULL);
-
-       return (__sputc(c, fp));
-}
diff --git a/lib/nbsd_libc/stdio/putchar.c b/lib/nbsd_libc/stdio/putchar.c
deleted file mode 100644 (file)
index 4f7aca9..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*     $NetBSD: putchar.c,v 1.9 2003/08/07 16:43:29 agc Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)putchar.c  8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: putchar.c,v 1.9 2003/08/07 16:43:29 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-#undef putchar
-#undef putchar_unlocked
-
-/*
- * A subroutine version of the macro putchar
- */
-int
-putchar(c)
-       int c;
-{
-       FILE *fp = stdout;
-        int r;
-
-       FLOCKFILE(fp);
-       r = __sputc(c, fp);
-       FUNLOCKFILE(fp);
-       return r;
-}
-
-int
-putchar_unlocked(c)
-       int c;
-{
-       return (__sputc(c, stdout));
-}
diff --git a/lib/nbsd_libc/stdio/puts.c b/lib/nbsd_libc/stdio/puts.c
deleted file mode 100644 (file)
index 810b96c..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*     $NetBSD: puts.c,v 1.15 2006/03/17 02:25:23 chris Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)puts.c     8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: puts.c,v 1.15 2006/03/17 02:25:23 chris Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include "fvwrite.h"
-#include "reentrant.h"
-#include "local.h"
-
-/*
- * Write the given string to stdout, appending a newline.
- */
-int
-puts(s)
-       char const *s;
-{
-       size_t c;
-       struct __suio uio;
-       struct __siov iov[2];
-       int r;
-
-       _DIAGASSERT(s != NULL);
-
-       if (s == NULL)
-               s = "(null)";
-
-       c = strlen(s);
-
-       iov[0].iov_base = __UNCONST(s);
-       iov[0].iov_len = c;
-       iov[1].iov_base = __UNCONST("\n");
-       iov[1].iov_len = 1;
-       uio.uio_resid = c + 1;
-       uio.uio_iov = &iov[0];
-       uio.uio_iovcnt = 2;
-       FLOCKFILE(stdout);
-       r = __sfvwrite(stdout, &uio);
-       FUNLOCKFILE(stdout);
-       return (r ? EOF : '\n');
-}
diff --git a/lib/nbsd_libc/stdio/remove.c b/lib/nbsd_libc/stdio/remove.c
deleted file mode 100644 (file)
index f006cd5..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*     $NetBSD: remove.c,v 1.13 2003/08/07 16:43:30 agc Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)remove.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: remove.c,v 1.13 2003/08/07 16:43:30 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <unistd.h>
-
-int
-remove(file)
-       const char *file;
-{
-       struct stat sb;
-
-       _DIAGASSERT(file != NULL);
-
-       if (lstat(file, &sb) < 0)
-               return (-1);
-
-       /*
-        * The file system may prohibit using unlink(2) on directories,
-        * so always use rmdir(2) in that case.
-        */
-       if (S_ISDIR(sb.st_mode))
-               return (rmdir(file));
-       else
-               return (unlink(file));
-}
diff --git a/lib/nbsd_libc/stdio/rewind.c b/lib/nbsd_libc/stdio/rewind.c
deleted file mode 100644 (file)
index 899ec58..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*     $NetBSD: rewind.c,v 1.13 2003/08/07 16:43:30 agc Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)rewind.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: rewind.c,v 1.13 2003/08/07 16:43:30 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-void
-rewind(fp)
-       FILE *fp;
-{
-
-       _DIAGASSERT(fp != NULL);
-
-       FLOCKFILE(fp);
-       (void) fseek(fp, 0L, SEEK_SET);
-       __sclearerr(fp);
-       FUNLOCKFILE(fp);
-}
diff --git a/lib/nbsd_libc/stdio/scanf.c b/lib/nbsd_libc/stdio/scanf.c
deleted file mode 100644 (file)
index 1fbf753..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*     $NetBSD: scanf.c,v 1.12 2003/08/07 16:43:31 agc Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)scanf.c    8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: scanf.c,v 1.12 2003/08/07 16:43:31 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "reentrant.h"
-#include "local.h"
-
-int
-scanf(char const *fmt, ...)
-{
-       int ret;
-       va_list ap;
-
-       _DIAGASSERT(fmt != NULL);
-
-       va_start(ap, fmt);
-       ret = __svfscanf(stdin, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/lib/nbsd_libc/stdio/setbuf.c b/lib/nbsd_libc/stdio/setbuf.c
deleted file mode 100644 (file)
index 08c23c0..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*     $NetBSD: setbuf.c,v 1.9 2003/08/07 16:43:31 agc Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)setbuf.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: setbuf.c,v 1.9 2003/08/07 16:43:31 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-void
-setbuf(fp, buf)
-       FILE *fp;
-       char *buf;
-{
-
-       _DIAGASSERT(fp != NULL);
-       /* buf may be NULL */
-
-       (void) setvbuf(fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
-}
diff --git a/lib/nbsd_libc/stdio/setvbuf.c b/lib/nbsd_libc/stdio/setvbuf.c
deleted file mode 100644 (file)
index 957e043..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*     $NetBSD: setvbuf.c,v 1.17 2003/08/07 16:43:31 agc Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)setvbuf.c  8.2 (Berkeley) 11/16/93";
-#else
-__RCSID("$NetBSD: setvbuf.c,v 1.17 2003/08/07 16:43:31 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include "reentrant.h"
-#include "local.h"
-
-/*
- * Set one of the three kinds of buffering, optionally including
- * a buffer.
- */
-int
-setvbuf(fp, buf, mode, size)
-       FILE *fp;
-       char *buf;
-       int mode;
-       size_t size;
-{
-       int ret, flags;
-       size_t iosize;
-       int ttyflag;
-
-       _DIAGASSERT(fp != NULL);
-       /* buf may be NULL */
-
-       /*
-        * Verify arguments.  The `int' limit on `size' is due to this
-        * particular implementation.  Note, buf and size are ignored
-        * when setting _IONBF.
-        */
-       if (mode != _IONBF)
-               if ((mode != _IOFBF && mode != _IOLBF) || (int)size < 0)
-                       return (-1);
-
-       FLOCKFILE(fp);
-       /*
-        * Write current buffer, if any.  Discard unread input (including
-        * ungetc data), cancel line buffering, and free old buffer if
-        * malloc()ed.  We also clear any eof condition, as if this were
-        * a seek.
-        */
-       ret = 0;
-       (void)__sflush(fp);
-       if (HASUB(fp))
-               FREEUB(fp);
-       WCIO_FREE(fp);
-       fp->_r = fp->_lbfsize = 0;
-       flags = fp->_flags;
-       if (flags & __SMBF)
-               free((void *)fp->_bf._base);
-       flags &= ~(__SLBF | __SNBF | __SMBF | __SOPT | __SNPT | __SEOF);
-
-       /* If setting unbuffered mode, skip all the hard work. */
-       if (mode == _IONBF)
-               goto nbf;
-
-       /*
-        * Find optimal I/O size for seek optimization.  This also returns
-        * a `tty flag' to suggest that we check isatty(fd), but we do not
-        * care since our caller told us how to buffer.
-        */
-       flags |= __swhatbuf(fp, &iosize, &ttyflag);
-       if (size == 0) {
-               buf = NULL;     /* force local allocation */
-               size = iosize;
-       }
-
-       /* Allocate buffer if needed. */
-       if (buf == NULL) {
-               if ((buf = malloc(size)) == NULL) {
-                       /*
-                        * Unable to honor user's request.  We will return
-                        * failure, but try again with file system size.
-                        */
-                       ret = -1;
-                       if (size != iosize) {
-                               size = iosize;
-                               buf = malloc(size);
-                       }
-               }
-               if (buf == NULL) {
-                       /* No luck; switch to unbuffered I/O. */
-nbf:
-                       fp->_flags = flags | __SNBF;
-                       fp->_w = 0;
-                       fp->_bf._base = fp->_p = fp->_nbuf;
-                       fp->_bf._size = 1;
-                       FUNLOCKFILE(fp);
-                       return (ret);
-               }
-               flags |= __SMBF;
-       }
-
-       /*
-        * Kill any seek optimization if the buffer is not the
-        * right size.
-        *
-        * SHOULD WE ALLOW MULTIPLES HERE (i.e., ok iff (size % iosize) == 0)?
-        */
-       if (size != iosize)
-               flags |= __SNPT;
-
-       /*
-        * Fix up the FILE fields, and set __cleanup for output flush on
-        * exit (since we are buffered in some way).
-        */
-       if (mode == _IOLBF)
-               flags |= __SLBF;
-       fp->_flags = flags;
-       fp->_bf._base = fp->_p = (unsigned char *)buf;
-       fp->_bf._size = size;
-       /* fp->_lbfsize is still 0 */
-       if (flags & __SWR) {
-               /*
-                * Begin or continue writing: see __swsetup().  Note
-                * that __SNBF is impossible (it was handled earlier).
-                */
-               if (flags & __SLBF) {
-                       fp->_w = 0;
-                       fp->_lbfsize = -fp->_bf._size;
-               } else
-                       fp->_w = size;
-       } else {
-               /* begin/continue reading, or stay in intermediate state */
-               fp->_w = 0;
-       }
-       __cleanup = _cleanup;
-
-       FUNLOCKFILE(fp);
-       return (ret);
-}
diff --git a/lib/nbsd_libc/stdio/snprintf.c b/lib/nbsd_libc/stdio/snprintf.c
deleted file mode 100644 (file)
index a3f59fe..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*     $NetBSD: snprintf.c,v 1.22 2007/10/26 19:48:14 christos Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: snprintf.c,v 1.22 2007/10/26 19:48:14 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "reentrant.h"
-#include "local.h"
-
-#if defined(_FORTIFY_SOURCE) && !defined(__lint__)
-#undef snprintf
-#define snprintf _snprintf
-#endif
-
-#ifdef __weak_alias
-__weak_alias(snprintf,_snprintf)
-#endif
-
-int
-snprintf(char *str, size_t n, char const *fmt, ...)
-{
-       int ret;
-       va_list ap;
-       FILE f;
-       struct __sfileext fext;
-       unsigned char dummy[1];
-
-       _DIAGASSERT(n == 0 || str != NULL);
-       _DIAGASSERT(fmt != NULL);
-
-       if ((int)n < 0) {
-               errno = EINVAL;
-               return (-1);
-       }
-       va_start(ap, fmt);
-       _FILEEXT_SETUP(&f, &fext);
-       f._file = -1;
-       f._flags = __SWR | __SSTR;
-       if (n == 0) {
-               f._bf._base = f._p = dummy;
-               f._bf._size = f._w = 0;
-       } else {
-               f._bf._base = f._p = (unsigned char *)str;
-               f._bf._size = f._w = n - 1;
-       }
-       ret = __vfprintf_unlocked(&f, fmt, ap);
-       *f._p = 0;
-       va_end(ap);
-       return (ret);
-}
diff --git a/lib/nbsd_libc/stdio/sprintf.c b/lib/nbsd_libc/stdio/sprintf.c
deleted file mode 100644 (file)
index 8045e9c..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*     $NetBSD: sprintf.c,v 1.15 2007/06/03 17:39:26 christos Exp $    */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)sprintf.c  8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: sprintf.c,v 1.15 2007/06/03 17:39:26 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "reentrant.h"
-#include "local.h"
-
-#ifdef _FORTIFY_SOURCE
-#undef sprintf
-#endif
-
-int
-sprintf(char *str, char const *fmt, ...)
-{
-       int ret;
-       va_list ap;
-       FILE f;
-       struct __sfileext fext;
-
-       _DIAGASSERT(str != NULL);
-       _DIAGASSERT(fmt != NULL);
-
-       _FILEEXT_SETUP(&f, &fext);
-       f._file = -1;
-       f._flags = __SWR | __SSTR;
-       f._bf._base = f._p = (unsigned char *)str;
-       f._bf._size = f._w = INT_MAX;
-       va_start(ap, fmt);
-       ret = __vfprintf_unlocked(&f, fmt, ap);
-       va_end(ap);
-       *f._p = 0;
-       return (ret);
-}
diff --git a/lib/nbsd_libc/stdio/sscanf.c b/lib/nbsd_libc/stdio/sscanf.c
deleted file mode 100644 (file)
index 42463ff..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*     $NetBSD: sscanf.c,v 1.17 2010/01/11 20:39:29 joerg Exp $        */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)sscanf.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: sscanf.c,v 1.17 2010/01/11 20:39:29 joerg Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "reentrant.h"
-#include "local.h"
-
-static int eofread __P((void *, char *, int));
-
-/* ARGSUSED */
-static int
-eofread(cookie, buf, len)
-       void *cookie;
-       char *buf;
-       int len;
-{
-
-       return (0);
-}
-
-int
-sscanf(const char *str, char const *fmt, ...)
-{
-       int ret;
-       va_list ap;
-       FILE f;
-       struct __sfileext fext;
-
-       _DIAGASSERT(str != NULL);
-       _DIAGASSERT(fmt != NULL);
-
-       _FILEEXT_SETUP(&f, &fext);
-       f._flags = __SRD;
-       f._bf._base = f._p = __UNCONST(str);
-       f._bf._size = f._r = strlen(str);
-       f._read = eofread;
-       _UB(&f)._base = NULL;
-       va_start(ap, fmt);
-       ret = __svfscanf_unlocked(&f, fmt, ap);
-       va_end(ap);
-       return (ret);
-}
diff --git a/lib/nbsd_libc/stdio/tmpfile.c b/lib/nbsd_libc/stdio/tmpfile.c
deleted file mode 100644 (file)
index 86b6853..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*     $NetBSD: tmpfile.c,v 1.11 2003/08/07 16:43:33 agc Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)tmpfile.c  8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: tmpfile.c,v 1.11 2003/08/07 16:43:33 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <paths.h>
-
-FILE *
-tmpfile()
-{
-       sigset_t set, oset;
-       FILE *fp;
-       int fd, sverrno;
-#define        TRAILER "tmp.XXXXXXXXXX"
-       char buf[sizeof(_PATH_TMP) + sizeof(TRAILER)];
-
-       (void)memcpy(buf, _PATH_TMP, sizeof(_PATH_TMP) - 1);
-       (void)memcpy(buf + sizeof(_PATH_TMP) - 1, TRAILER, sizeof(TRAILER));
-
-       sigfillset(&set);
-       (void)sigprocmask(SIG_BLOCK, &set, &oset);
-
-       fd = mkstemp(buf);
-       if (fd != -1)
-               (void)unlink(buf);
-
-       (void)sigprocmask(SIG_SETMASK, &oset, NULL);
-
-       if (fd == -1)
-               return (NULL);
-
-       if ((fp = fdopen(fd, "w+")) == NULL) {
-               sverrno = errno;
-               (void)close(fd);
-               errno = sverrno;
-               return (NULL);
-       }
-       return (fp);
-}
diff --git a/lib/nbsd_libc/stdio/tmpnam.c b/lib/nbsd_libc/stdio/tmpnam.c
deleted file mode 100644 (file)
index ac42baf..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*     $NetBSD: tmpnam.c,v 1.14 2003/08/07 16:43:33 agc Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)tmpnam.c   8.3 (Berkeley) 3/28/94";
-#else
-__RCSID("$NetBSD: tmpnam.c,v 1.14 2003/08/07 16:43:33 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-#include <sys/types.h>
-#include <stdio.h>
-#include <unistd.h>
-#include "reentrant.h"
-#include "local.h"
-
-__warn_references(tmpnam,
-    "warning: tmpnam() possibly used unsafely, use mkstemp() or mkdtemp()")
-
-char *
-tmpnam(s)
-       char *s;
-{
-       static u_long tmpcount;
-       static char buf[L_tmpnam];
-
-       if (s == NULL)
-               s = buf;
-       (void)snprintf(s, L_tmpnam, "%stmp.%lu.XXXXXXXXXX", P_tmpdir, tmpcount);
-       ++tmpcount;
-       return (_mktemp(s));
-}
diff --git a/lib/nbsd_libc/stdio/ungetc.c b/lib/nbsd_libc/stdio/ungetc.c
deleted file mode 100644 (file)
index 10eb301..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-/*     $NetBSD: ungetc.c,v 1.16 2009/10/25 20:44:13 christos Exp $     */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)ungetc.c   8.2 (Berkeley) 11/3/93";
-#else
-__RCSID("$NetBSD: ungetc.c,v 1.16 2009/10/25 20:44:13 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "reentrant.h"
-#include "local.h"
-
-static int __submore __P((FILE *));
-/*
- * Expand the ungetc buffer `in place'.  That is, adjust fp->_p when
- * the buffer moves, so that it points the same distance from the end,
- * and move the bytes in the buffer around as necessary so that they
- * are all at the end (stack-style).
- */
-static int
-__submore(fp)
-       FILE *fp;
-{
-       int i;
-       unsigned char *p;
-
-       _DIAGASSERT(fp != NULL);
-
-       if (_UB(fp)._base == fp->_ubuf) {
-               /*
-                * Get a new buffer (rather than expanding the old one).
-                */
-               if ((p = malloc((size_t)BUFSIZ)) == NULL)
-                       return (EOF);
-               _UB(fp)._base = p;
-               _UB(fp)._size = BUFSIZ;
-               p += BUFSIZ - sizeof(fp->_ubuf);
-               for (i = sizeof(fp->_ubuf); --i >= 0;)
-                       p[i] = fp->_ubuf[i];
-               fp->_p = p;
-               return (0);
-       }
-       i = _UB(fp)._size;
-       p = realloc(_UB(fp)._base, (size_t)(i << 1));
-       if (p == NULL)
-               return (EOF);
-       /* no overlap (hence can use memcpy) because we doubled the size */
-       (void)memcpy((p + i), p, (size_t)i);
-       fp->_p = p + i;
-       _UB(fp)._base = p;
-       _UB(fp)._size = i << 1;
-       return (0);
-}
-
-int
-ungetc(c, fp)
-       int c;
-       FILE *fp;
-{
-
-       _DIAGASSERT(fp != NULL);
-
-       if (c == EOF)
-               return (EOF);
-       if (!__sdidinit)
-               __sinit();
-       FLOCKFILE(fp);
-       _SET_ORIENTATION(fp, -1);
-       if ((fp->_flags & __SRD) == 0) {
-               /*
-                * Not already reading: no good unless reading-and-writing.
-                * Otherwise, flush any current write stuff.
-                */
-               if ((fp->_flags & __SRW) == 0) {
-                       FUNLOCKFILE(fp);
-                       return (EOF);
-               }
-               if (fp->_flags & __SWR) {
-                       if (__sflush(fp)) {
-                               FUNLOCKFILE(fp);
-                               return (EOF);
-                       }
-                       fp->_flags &= ~__SWR;
-                       fp->_w = 0;
-                       fp->_lbfsize = 0;
-               }
-               fp->_flags |= __SRD;
-       }
-       c = (unsigned char)c;
-
-       /*
-        * If we are in the middle of ungetc'ing, just continue.
-        * This may require expanding the current ungetc buffer.
-        */
-       if (HASUB(fp)) {
-               if (fp->_r >= _UB(fp)._size && __submore(fp)) {
-                       FUNLOCKFILE(fp);
-                       return (EOF);
-               }
-               *--fp->_p = c;
-               fp->_r++;
-               FUNLOCKFILE(fp);
-               return (c);
-       }
-       fp->_flags &= ~__SEOF;
-
-       /*
-        * If we can handle this by simply backing up, do so,
-        * but never replace the original character.
-        * (This makes sscanf() work when scanning `const' data.)
-        */
-       if (fp->_bf._base != NULL && fp->_p > fp->_bf._base &&
-           fp->_p[-1] == c) {
-               fp->_p--;
-               fp->_r++;
-               FUNLOCKFILE(fp);
-               return (c);
-       }
-
-       /*
-        * Create an ungetc buffer.
-        * Initially, we will use the `reserve' buffer.
-        */
-       fp->_ur = fp->_r;
-       fp->_up = fp->_p;
-       _UB(fp)._base = fp->_ubuf;
-       _UB(fp)._size = sizeof(fp->_ubuf);
-       fp->_ubuf[sizeof(fp->_ubuf) - 1] = c;
-       fp->_p = &fp->_ubuf[sizeof(fp->_ubuf) - 1];
-       fp->_r = 1;
-       FUNLOCKFILE(fp);
-       return (c);
-}
diff --git a/lib/nbsd_libc/stdio/vfprintf.c b/lib/nbsd_libc/stdio/vfprintf.c
deleted file mode 100644 (file)
index ae11e25..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#define NARROW
-#include "vfwprintf.c"
diff --git a/lib/nbsd_libc/stdio/vprintf.c b/lib/nbsd_libc/stdio/vprintf.c
deleted file mode 100644 (file)
index 7118840..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*     $NetBSD: vprintf.c,v 1.10 2003/08/07 16:43:34 agc Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)vprintf.c  8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: vprintf.c,v 1.10 2003/08/07 16:43:34 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-
-int
-vprintf(fmt, ap)
-       char const *fmt;
-       _BSD_VA_LIST_ ap;
-{
-
-       _DIAGASSERT(fmt != NULL);
-
-       return (vfprintf(stdout, fmt, ap));
-}
diff --git a/lib/nbsd_libc/stdio/vscanf.c b/lib/nbsd_libc/stdio/vscanf.c
deleted file mode 100644 (file)
index 6959b5e..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*     $NetBSD: vscanf.c,v 1.12 2003/08/07 16:43:35 agc Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Donn Seeley at UUNET Technologies, Inc.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)vscanf.c   8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: vscanf.c,v 1.12 2003/08/07 16:43:35 agc Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-
-#include "reentrant.h"
-#include "local.h"
-
-int
-vscanf(fmt, ap)
-       const char *fmt;
-       _BSD_VA_LIST_ ap;
-{
-
-       _DIAGASSERT(fmt != NULL);
-
-       return (__svfscanf(stdin, fmt, ap));
-}
diff --git a/lib/nbsd_libc/stdio/vsnprintf.c b/lib/nbsd_libc/stdio/vsnprintf.c
deleted file mode 100644 (file)
index e967847..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-/*     $NetBSD: vsnprintf.c,v 1.22 2007/10/26 19:48:14 christos Exp $  */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)vsnprintf.c        8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: vsnprintf.c,v 1.22 2007/10/26 19:48:14 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-#if defined(_FORTIFY_SOURCE) && !defined(__lint__)
-#undef vsnprintf
-#define vsnprintf _vsnprintf
-#endif
-
-#ifdef __weak_alias
-__weak_alias(vsnprintf,_vsnprintf)
-#endif
-
-int
-vsnprintf(str, n, fmt, ap)
-       char *str;
-       size_t n;
-       const char *fmt;
-       _BSD_VA_LIST_ ap;
-{
-       int ret;
-       FILE f;
-       struct __sfileext fext;
-       unsigned char dummy[1];
-
-       _DIAGASSERT(n == 0 || str != NULL);
-       _DIAGASSERT(fmt != NULL);
-
-       if ((int)n < 0) {
-               errno = EINVAL;
-               return (-1);
-       }
-
-       _FILEEXT_SETUP(&f, &fext);
-       f._file = -1;
-       f._flags = __SWR | __SSTR;
-       if (n == 0) {
-               f._bf._base = f._p = dummy;
-               f._bf._size = f._w = 0;
-       } else {
-               f._bf._base = f._p = (unsigned char *)str;
-               f._bf._size = f._w = n - 1;
-       }
-       ret = __vfprintf_unlocked(&f, fmt, ap);
-       *f._p = 0;
-       return (ret);
-}
diff --git a/lib/nbsd_libc/stdio/vsprintf.c b/lib/nbsd_libc/stdio/vsprintf.c
deleted file mode 100644 (file)
index ad0fb5b..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*     $NetBSD: vsprintf.c,v 1.15 2007/06/03 17:39:27 christos Exp $   */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)vsprintf.c 8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: vsprintf.c,v 1.15 2007/06/03 17:39:27 christos Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <limits.h>
-#include <stdio.h>
-#include "reentrant.h"
-#include "local.h"
-
-#ifdef _FORTIFY_SOURCE
-#undef vsprintf
-#endif
-
-int
-vsprintf(str, fmt, ap)
-       char *str;
-       const char *fmt;
-       _BSD_VA_LIST_ ap;
-{
-       int ret;
-       FILE f;
-       struct __sfileext fext;
-
-       _DIAGASSERT(str != NULL);
-       _DIAGASSERT(fmt != NULL);
-
-       _FILEEXT_SETUP(&f, &fext);
-       f._file = -1;
-       f._flags = __SWR | __SSTR;
-       f._bf._base = f._p = (unsigned char *)str;
-       f._bf._size = f._w = INT_MAX;
-       ret = __vfprintf_unlocked(&f, fmt, ap);
-       *f._p = 0;
-       return (ret);
-}
diff --git a/lib/nbsd_libc/stdio/vsscanf.c b/lib/nbsd_libc/stdio/vsscanf.c
deleted file mode 100644 (file)
index 1069fc7..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*     $NetBSD: vsscanf.c,v 1.15 2010/01/11 20:39:29 joerg Exp $       */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Donn Seeley at UUNET Technologies, Inc.
- *
- * 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. 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/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)vsscanf.c  8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: vsscanf.c,v 1.15 2010/01/11 20:39:29 joerg Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#include <assert.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include "reentrant.h"
-#include "local.h"
-
-static int eofread __P((void *, char *, int));
-
-/* ARGSUSED */
-static int
-eofread(cookie, buf, len)
-       void *cookie;
-       char *buf;
-       int len;
-{
-       return (0);
-}
-
-int
-vsscanf(str, fmt, ap)
-       const char *str;
-       const char *fmt;
-       _BSD_VA_LIST_ ap;
-{
-       FILE f;
-       struct __sfileext fext;
-
-       _DIAGASSERT(str != NULL);
-       _DIAGASSERT(fmt != NULL);
-
-       _FILEEXT_SETUP(&f, &fext);
-       f._flags = __SRD;
-       f._bf._base = f._p = __UNCONST(str);
-       f._bf._size = f._r = strlen(str);
-       f._read = eofread;
-       _UB(&f)._base = NULL;
-       return (__svfscanf_unlocked(&f, fmt, ap));
-}
diff --git a/lib/nbsd_libc/sys-minix/environ.c b/lib/nbsd_libc/sys-minix/environ.c
deleted file mode 100644 (file)
index 7e7fe73..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * environ.c - define the variable environ
- */
-/* $Header$ */
-/*
- * This file defines the variable environ and initializes it with a magic
- * value.  The C run-time start-off routine tests whether the variable
- * environ is initialized with this value.  If it is not, it is assumed
- * that it is defined by the user.  Only two bytes are tested, since we
- * don't know the endian-ness and alignment restrictions of the machine.
- * This means that the low-order two-bytes should be equal to the
- * high-order two-bytes on machines with four-byte pointers.  In fact, all
- * the bytes in the pointer are the same, just in case.
- */
-
-#if _EM_PSIZE==2
-char **environ = (char **) 0x5353;
-#else
-char **environ = (char **) 0x53535353;
-#endif
diff --git a/lib/nbsd_libc/sys-minix/sizeup.c b/lib/nbsd_libc/sys-minix/sizeup.c
deleted file mode 100644 (file)
index ea84307..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <sys/cdefs.h>
-#include "namespace.h"
-#include <lib.h>
-#include <minix/u64.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <minix/type.h>
-#include <minix/minlib.h>
-#include <minix/partition.h>
-#include <sys/ioc_disk.h>
-
-#include <unistd.h>
-
-/*================================================================
- *                    minix_sizeup  -  determine device size
- *===============================================================*/
-int minix_sizeup(device, bytes)
-char *device;
-u64_t *bytes;
-{
-  int fd;
-  struct partition entry;
-  struct stat st;
-
-  if ((fd = open(device, O_RDONLY)) == -1) {
-        if (errno != ENOENT)
-                perror("sizeup open");
-        return -1;
-  }
-  if (ioctl(fd, DIOCGETP, &entry) == -1) {
-        perror("sizeup ioctl");
-        if(fstat(fd, &st) < 0) {
-                perror("fstat");
-                entry.size = cvu64(0);
-        } else {
-                entry.size = cvu64(st.st_size);
-        }
-  }
-  close(fd);
-  *bytes = entry.size;
-  return 0;
-}
diff --git a/lib/nbsd_libcompat_minix/configfile.c b/lib/nbsd_libcompat_minix/configfile.c
deleted file mode 100644 (file)
index 4c6300f..0000000
+++ /dev/null
@@ -1,574 +0,0 @@
-/*     config_read(), _delete(), _length() - Generic config file routines.
- *                                                     Author: Kees J. Bot
- *                                                             5 Jun 1999
- */
-#define nil ((void*)0)
-#if __minix_vmd
-#include <minix/stubs.h>
-#else
-#define fstat _fstat
-#define stat _stat
-#endif
-#include <sys/types.h>
-#include <stdio.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <time.h>
-#include <sys/stat.h>
-#if __minix_vmd
-#include <minix/asciictype.h>
-#else
-#include <ctype.h>
-#endif
-#define _c /* not const */
-#include <configfile.h>
-
-typedef struct configfile {    /* List of (included) configuration files. */
-       struct configfile *next;        /* A list indeed. */
-       time_t          ctime;          /* Last changed time, -1 if no file. */
-       char            name[1];        /* File name. */
-} configfile_t;
-
-/* Size of a configfile_t given a file name of length 'len'. */
-#define configfilesize(len)    (offsetof(configfile_t, name) + 1 + (len))
-
-typedef struct firstconfig {   /* First file and first word share a slot. */
-       configfile_t    *filelist;
-       char            new;            /* Set when created. */
-       config_t        config1;
-} firstconfig_t;
-
-/* Size of a config_t given a word of lenght 'len'.  Same for firstconfig_t. */
-#define config0size()          (offsetof(config_t, word))
-#define configsize(len)                (config0size() + 1 + (len))
-#define firstconfigsize(len)   \
-                       (offsetof(firstconfig_t, config1) + configsize(len))
-
-/* Translate address of first config word to enclosing firstconfig_t and vv. */
-#define cfg2fcfg(p)    \
-    ((firstconfig_t *) ((char *) (p) - offsetof(firstconfig_t, config1)))
-#define fcfg2cfg(p)    (&(p)->config1)
-
-/* Variables used while building data. */
-static configfile_t *c_files;          /* List of (included) config files. */
-static int c_flags;                    /* Flags argument of config_read(). */
-static FILE *c_fp;                     /* Current open file. */
-static char *c_file;                   /* Current open file name. */
-static unsigned c_line;                        /* Current line number. */
-static int c;                          /* Next character. */
-
-static void *allocate(void *mem, size_t size)
-/* Like realloc(), but checked. */
-{
-    if ((mem= realloc(mem, size)) == nil) {
-       fprintf(stderr, "\"%s\", line %u: Out of memory\n", c_file, c_line);
-       exit(1);
-    }
-    return mem;
-}
-
-#define deallocate(mem)        free(mem)
-
-static void delete_filelist(configfile_t *cfgf)
-/* Delete configuration file list. */
-{
-    void *junk;
-
-    while (cfgf != nil) {
-       junk= cfgf;
-       cfgf= cfgf->next;
-       deallocate(junk);
-    }
-}
-
-static void delete_config(config_t *cfg)
-/* Delete configuration file data. */
-{
-    config_t *next, *list, *junk;
-
-    next= cfg;
-    list= nil;
-    for (;;) {
-       if (next != nil) {
-           /* Push the 'next' chain in reverse on the 'list' chain, putting
-            * a leaf cell (next == nil) on top of 'list'.
-            */
-           junk= next;
-           next= next->next;
-           junk->next= list;
-           list= junk;
-       } else
-       if (list != nil) {
-           /* Delete the leaf cell.  If it has a sublist then that becomes
-            * the 'next' chain.
-            */
-           junk= list;
-           next= list->list;
-           list= list->next;
-           deallocate(junk);
-       } else {
-           /* Both chains are gone. */
-           break;
-       }
-    }
-}
-
-void config_delete(config_t *cfg1)
-/* Delete configuration file data, being careful with the odd first one. */
-{
-    firstconfig_t *fcfg= cfg2fcfg(cfg1);
-
-    delete_filelist(fcfg->filelist);
-    delete_config(fcfg->config1.next);
-    delete_config(fcfg->config1.list);
-    deallocate(fcfg);
-}
-
-static void nextc(void)
-/* Read the next character of the current file into 'c'. */
-{
-    if (c == '\n') c_line++;
-    c= getc(c_fp);
-    if (c == EOF && ferror(c_fp)) {
-       fprintf(stderr, "\"%s\", line %u: %s\n",
-           c_file, c_line, strerror(errno));
-       exit(1);
-    }
-}
-
-static void skipwhite(void)
-/* Skip whitespace and comments. */
-{
-    while (isspace(c)) {
-       nextc();
-       if (c == '#') {
-           do nextc(); while (c != EOF && c != '\n');
-       }
-    }
-}
-
-static void parse_err(void)
-/* Tell user that you can't parse past the current character. */
-{
-    char sc[2];
-
-    sc[0]= c;
-    sc[1]= 0;
-    fprintf(stderr, "\"%s\", line %u: parse error at '%s'\n",
-       c_file, c_line, c == EOF ? "EOF" : sc);
-    exit(1);
-}
-
-static config_t *read_word(void)
-/* Read a word or string. */
-{
-    config_t *w;
-    size_t i, len;
-    int q;
-    static char SPECIAL[] = "!#$%&*+-./:<=>?[\\]^_|~";
-
-    i= 0;
-    len= 32;
-    w= allocate(nil, configsize(32));
-    w->next= nil;
-    w->list= nil;
-    w->file= c_file;
-    w->line= c_line;
-    w->flags= 0;
-
-    /* Is it a quoted string? */
-    if (c == '\'' || c == '"') {
-       q= c;   /* yes */
-       nextc();
-    } else {
-       q= -1;  /* no */
-    }
-
-    for (;;) {
-       if (i == len) {
-           len+= 32;
-           w= allocate(w, configsize(len));
-       }
-
-       if (q == -1) {
-           /* A word consists of letters, numbers and a few special chars. */
-           if (!isalnum(c) && c < 0x80 && strchr(SPECIAL, c) == nil) break;
-       } else {
-           /* Strings are made up of anything except newlines. */
-           if (c == EOF || c == '\n') {
-               fprintf(stderr,
-                   "\"%s\", line %u: string at line %u not closed\n",
-                   c_file, c_line, w->line);
-               exit(1);
-               break;
-           }
-           if (c == q) {       /* Closing quote? */
-               nextc();
-               break;
-           }
-       }
-
-       if (c != '\\') {        /* Simply add non-escapes. */
-           w->word[i++]= c;
-           nextc();
-       } else {                /* Interpret an escape. */
-           nextc();
-           if (isspace(c)) {
-               skipwhite();
-               continue;
-           }
-
-           if (c_flags & CFG_ESCAPED) {
-               w->word[i++]= '\\';     /* Keep the \ for the caller. */
-               if (i == len) {
-                   len+= 32;
-                   w= allocate(w, configsize(len));
-               }
-               w->flags |= CFG_ESCAPED;
-           }
-
-           if (isdigit(c)) {           /* Octal escape */
-               int n= 3;
-               int d= 0;
-
-               do {
-                   d= d * 010 + (c - '0');
-                   nextc();
-               } while (--n > 0 && isdigit(c));
-               w->word[i++]= d;
-           } else
-           if (c == 'x' || c == 'X') { /* Hex escape */
-               int n= 2;
-               int d= 0;
-
-               nextc();
-               if (!isxdigit(c)) {
-                   fprintf(stderr, "\"%s\", line %u: bad hex escape\n",
-                       c_file, c_line);
-                   exit(1);
-               }
-               do {
-                   d= d * 0x10 + (islower(c) ? (c - 'a' + 0xa) :
-                                   isupper(c) ? (c - 'A' + 0xA) :
-                                   (c - '0'));
-                   nextc();
-               } while (--n > 0 && isxdigit(c));
-               w->word[i++]= d;
-           } else {
-               switch (c) {
-               case 'a':       c= '\a';        break;
-               case 'b':       c= '\b';        break;
-               case 'e':       c= '\033';      break;
-               case 'f':       c= '\f';        break;
-               case 'n':       c= '\n';        break;
-               case 'r':       c= '\r';        break;
-               case 's':       c= ' ';         break;
-               case 't':       c= '\t';        break;
-               case 'v':       c= '\v';        break;
-               default:        /* Anything else is kept as-is. */;
-               }
-               w->word[i++]= c;
-               nextc();
-           }
-       }
-    }
-    w->word[i]= 0;
-    if (q != -1) {
-       w->flags |= CFG_STRING;
-    } else {
-       int f;
-       char *end;
-       static char base[]= { 0, 010, 10, 0x10 };
-
-       if (i == 0) parse_err();
-
-       /* Can the word be used as a number? */
-       for (f= 0; f < 4; f++) {
-           (void) strtol(w->word, &end, base[f]);
-           if (*end == 0) w->flags |= 1 << (f + 0);
-           (void) strtoul(w->word, &end, base[f]);
-           if (*end == 0) w->flags |= 1 << (f + 4);
-       }
-    }
-    return allocate(w, configsize(i));
-}
-
-static config_t *read_file(const char *file);
-static config_t *read_list(void);
-
-static config_t *read_line(void)
-/* Read and return one line of the config file. */
-{
-    config_t *cline, **pcline, *clist;
-
-    cline= nil;
-    pcline= &cline;
-
-    for (;;) {
-       skipwhite();
-
-       if (c == EOF || c == '}') {
-if(0)      if (cline != nil) parse_err();
-           break;
-       } else
-       if (c == ';') {
-           nextc();
-           if (cline != nil) break;
-       } else
-       if (cline != nil && c == '{') {
-           /* A sublist. */
-           nextc();
-           clist= allocate(nil, config0size());
-           clist->next= nil;
-           clist->file= c_file;
-           clist->line= c_line;
-           clist->list= read_list();
-           clist->flags= CFG_SUBLIST;
-           *pcline= clist;
-           pcline= &clist->next;
-           if (c != '}') parse_err();
-           nextc();
-       } else {
-           *pcline= read_word();
-           pcline= &(*pcline)->next;
-       }
-    }
-    return cline;
-}
-
-static config_t *read_list(void)
-/* Read and return a list of config file commands. */
-{
-    config_t *clist, **pclist, *cline;
-
-    clist= nil;
-    pclist= &clist;
-
-    while ((cline= read_line()) != nil) {
-       if (strcmp(cline->word, "include") == 0) {
-           config_t *file= cline->next;
-           if (file == nil || file->next != nil || !config_isatom(file)) {
-               fprintf(stderr,
-                   "\"%s\", line %u: 'include' command requires an argument\n",
-                   c_file, cline->line);
-               exit(1);
-           }
-           if (file->flags & CFG_ESCAPED) {
-               char *p, *q;
-               p= q= file->word;
-               for (;;) {
-                   if ((*q = *p) == '\\') *q = *++p;
-                   if (*q == 0) break;
-                   p++;
-                   q++;
-               }
-           }
-           file= read_file(file->word);
-           delete_config(cline);
-           *pclist= file;
-           while (*pclist != nil) pclist= &(*pclist)->next;
-       } else {
-           config_t *cfg= allocate(nil, config0size());
-           cfg->next= nil;
-           cfg->list= cline;
-           cfg->file= cline->file;
-           cfg->line= cline->line;
-           cfg->flags= CFG_SUBLIST;
-           *pclist= cfg;
-           pclist= &cfg->next;
-       }
-    }
-    return clist;
-}
-
-static config_t *read_file(const char *file)
-/* Read and return a configuration file. */
-{
-    configfile_t *cfgf;
-    config_t *cfg;
-    struct stat st;
-    FILE *old_fp;      /* old_* variables store current file context. */
-    char *old_file;
-    unsigned old_line;
-    int old_c;
-    size_t n;
-    char *slash;
-
-    old_fp= c_fp;
-    old_file= c_file;
-    old_line= c_line;
-    old_c= c;
-
-    n= 0;
-    if (file[0] != '/' && old_file != nil
-                       && (slash= strrchr(old_file, '/')) != nil) {
-       n= slash - old_file + 1;
-    }
-    cfgf= allocate(nil, configfilesize(n + strlen(file)));
-    memcpy(cfgf->name, old_file, n);
-    strcpy(cfgf->name + n, file);
-    cfgf->next= c_files;
-    c_files= cfgf;
-
-    c_file= cfgf->name;
-    c_line= 0;
-
-    if ((c_fp= fopen(file, "r")) == nil || fstat(fileno(c_fp), &st) < 0) {
-       if (errno != ENOENT) {
-           fprintf(stderr, "\"%s\", line 1: %s\n", file, strerror(errno));
-           exit(1);
-       }
-       cfgf->ctime= -1;
-       c= EOF;
-    } else {
-       cfgf->ctime= st.st_ctime;
-       c= '\n';
-    }
-
-    cfg= read_list();
-    if (c != EOF) parse_err();
-
-    if (c_fp != nil) fclose(c_fp);
-    c_fp= old_fp;
-    c_file= old_file;
-    c_line= old_line;
-    c= old_c;
-    return cfg;
-}
-
-config_t *config_read(const char *file, int flags, config_t *cfg)
-/* Read and parse a configuration file. */
-{
-    if (cfg != nil) {
-       /* First check if any of the involved files has changed. */
-       firstconfig_t *fcfg;
-       configfile_t *cfgf;
-       struct stat st;
-
-       fcfg= cfg2fcfg(cfg);
-       for (cfgf= fcfg->filelist; cfgf != nil; cfgf= cfgf->next) {
-           if (stat(cfgf->name, &st) < 0) {
-               if (errno != ENOENT) break;
-               st.st_ctime= -1;
-           }
-           if (st.st_ctime != cfgf->ctime) break;
-       }
-
-       if (cfgf == nil) return cfg;    /* Everything as it was. */
-       config_delete(cfg);             /* Otherwise delete and reread. */
-    }
-
-    errno= 0;
-    c_files= nil;
-    c_flags= flags;
-    cfg= read_file(file);
-
-    if (cfg != nil) {
-       /* Change first word to have a hidden pointer to a file list. */
-       size_t len= strlen(cfg->word);
-       firstconfig_t *fcfg;
-
-       fcfg= allocate(cfg, firstconfigsize(len));
-       memmove(&fcfg->config1, fcfg, configsize(len));
-       fcfg->filelist= c_files;
-       fcfg->new= 1;
-       return fcfg2cfg(fcfg);
-    }
-    /* Couldn't read (errno != 0) of nothing read (errno == 0). */
-    delete_filelist(c_files);
-    delete_config(cfg);
-    return nil;
-}
-
-int config_renewed(config_t *cfg)
-{
-    int new;
-
-    if (cfg == nil) {
-       new= 1;
-    } else {
-       new= cfg2fcfg(cfg)->new;
-       cfg2fcfg(cfg)->new= 0;
-    }
-    return new;
-}
-
-size_t config_length(config_t *cfg)
-/* Count the number of items on a list. */
-{
-    size_t n= 0;
-
-    while (cfg != nil) {
-       n++;
-       cfg= cfg->next;
-    }
-    return n;
-}
-
-#if TEST
-#include <unistd.h>
-
-static void print_list(int indent, config_t *cfg);
-
-static void print_words(int indent, config_t *cfg)
-{
-    while (cfg != nil) {
-       if (config_isatom(cfg)) {
-           if (config_isstring(cfg)) fputc('"', stdout);
-           printf("%s", cfg->word);
-           if (config_isstring(cfg)) fputc('"', stdout);
-       } else {
-           printf("{\n");
-           print_list(indent+4, cfg->list);
-           printf("%*s}", indent, "");
-       }
-       cfg= cfg->next;
-       if (cfg != nil) fputc(' ', stdout);
-    }
-    printf(";\n");
-}
-
-static void print_list(int indent, config_t *cfg)
-{
-    while (cfg != nil) {
-       if (!config_issub(cfg)) {
-           fprintf(stderr, "Cell at \"%s\", line %u is not a sublist\n");
-           break;
-       }
-       printf("%*s", indent, "");
-       print_words(indent, cfg->list);
-       cfg= cfg->next;
-    }
-}
-
-static void print_config(config_t *cfg)
-{
-    if (!config_renewed(cfg)) {
-       printf("# Config didn't change\n");
-    } else {
-       print_list(0, cfg);
-    }
-}
-
-int main(int argc, char **argv)
-{
-    config_t *cfg;
-    int c;
-
-    if (argc != 2) {
-       fprintf(stderr, "One config file name please\n");
-       exit(1);
-    }
-
-    cfg= nil;
-    do {
-       cfg= config_read(argv[1], CFG_ESCAPED, cfg);
-       print_config(cfg);
-       if (!isatty(0)) break;
-       while ((c= getchar()) != EOF && c != '\n') {}
-    } while (c != EOF);
-    return 0;
-}
-#endif /* TEST */
diff --git a/lib/nbsd_libcompat_minix/cuserid.c b/lib/nbsd_libcompat_minix/cuserid.c
deleted file mode 100644 (file)
index 47640e7..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*  cuserid(3)
- *
- *  Author: Terrence W. Holm          Sept. 1987
- */
-
-#include <lib.h>
-#include <pwd.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#ifndef  L_cuserid
-#define  L_cuserid   9
-#endif
-
-char *cuserid(user_name)
-char *user_name;
-{
-  PRIVATE char userid[L_cuserid];
-  struct passwd *pw_entry;
-
-  if (user_name == (char *)NULL) user_name = userid;
-
-  pw_entry = getpwuid(geteuid());
-
-  if (pw_entry == (struct passwd *)NULL) {
-       *user_name = '\0';
-       return((char *)NULL);
-  }
-  strcpy(user_name, pw_entry->pw_name);
-
-  return(user_name);
-}
diff --git a/lib/nbsd_libcompat_minix/include/compat/a.out.h b/lib/nbsd_libcompat_minix/include/compat/a.out.h
deleted file mode 100644 (file)
index 5e66fac..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/* The <a.out> header file describes the format of executable files. */
-
-#ifndef _AOUT_H
-#define _AOUT_H
-
-struct exec {                  /* a.out header */
-  unsigned char        a_magic[2];     /* magic number */
-  unsigned char        a_flags;        /* flags, see below */
-  unsigned char        a_cpu;          /* cpu id */
-  unsigned char        a_hdrlen;       /* length of header */
-  unsigned char        a_unused;       /* reserved for future use */
-  unsigned short a_version;    /* version stamp (not used at present) */
-  long         a_text;         /* size of text segement in bytes */
-  long         a_data;         /* size of data segment in bytes */
-  long         a_bss;          /* size of bss segment in bytes */
-  long         a_entry;        /* entry point */
-  long         a_total;        /* total memory allocated */
-  long         a_syms;         /* size of symbol table */
-
-  /* SHORT FORM ENDS HERE */
-  long         a_trsize;       /* text relocation size */
-  long         a_drsize;       /* data relocation size */
-  long         a_tbase;        /* text relocation base */
-  long         a_dbase;        /* data relocation base */
-};
-
-#define A_MAGIC0      (unsigned char) 0x01
-#define A_MAGIC1      (unsigned char) 0x03
-#define BADMAG(X)     ((X).a_magic[0] != A_MAGIC0 ||(X).a_magic[1] != A_MAGIC1)
-
-/* CPU Id of TARGET machine (byte order coded in low order two bits) */
-#define A_NONE 0x00    /* unknown */
-#define A_I8086        0x04    /* intel i8086/8088 */
-#define A_M68K 0x0B    /* motorola m68000 */
-#define A_NS16K        0x0C    /* national semiconductor 16032 */
-#define A_I80386 0x10  /* intel i80386 */
-#define A_SPARC        0x17    /* Sun SPARC */
-
-#define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */
-#define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */
-
-/* Flags. */
-#define A_UZP  0x01    /* unmapped zero page (pages) */
-#define A_PAL  0x02    /* page aligned executable */
-#define A_NSYM 0x04    /* new style symbol table */
-#define A_IMG   0x08   /* image instead of executable (e.g. root FS) */
-#define A_EXEC 0x10    /* executable */
-#define A_SEP  0x20    /* separate I/D */
-#define A_PURE 0x40    /* pure text */         /* not used */
-#define A_TOVLY        0x80    /* text overlay */      /* not used */
-
-/* Offsets of various things. */
-#define A_MINHDR       32
-#define        A_TEXTPOS(X)    ((long)(X).a_hdrlen)
-#define A_DATAPOS(X)   (A_TEXTPOS(X) + (X).a_text)
-#define        A_HASRELS(X)    ((X).a_hdrlen > (unsigned char) A_MINHDR)
-#define A_HASEXT(X)    ((X).a_hdrlen > (unsigned char) (A_MINHDR +  8))
-#define A_HASLNS(X)    ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16))
-#define A_HASTOFF(X)   ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24))
-#define A_TRELPOS(X)   (A_DATAPOS(X) + (X).a_data)
-#define A_DRELPOS(X)   (A_TRELPOS(X) + (X).a_trsize)
-#define A_SYMPOS(X)    (A_TRELPOS(X) + (A_HASRELS(X) ? \
-                       ((X).a_trsize + (X).a_drsize) : 0))
-
-struct reloc {
-  long r_vaddr;                        /* virtual address of reference */
-  unsigned short r_symndx;     /* internal segnum or extern symbol num */
-  unsigned short r_type;       /* relocation type */
-};
-
-/* r_type values: */
-#define R_ABBS         0
-#define R_RELLBYTE     2
-#define R_PCRBYTE      3
-#define R_RELWORD      4
-#define R_PCRWORD      5
-#define R_RELLONG      6
-#define R_PCRLONG      7
-#define R_REL3BYTE     8
-#define R_KBRANCHE     9
-
-/* r_symndx for internal segments */
-#define S_ABS          ((unsigned short)-1)
-#define S_TEXT         ((unsigned short)-2)
-#define S_DATA         ((unsigned short)-3)
-#define S_BSS          ((unsigned short)-4)
-
-struct nlist {                 /* symbol table entry */
-  char n_name[8];              /* symbol name */
-  long n_value;                        /* value */
-  unsigned char        n_sclass;       /* storage class */
-  unsigned char        n_numaux;       /* number of auxiliary entries (not used) */
-  unsigned short n_type;       /* language base and derived type (not used) */
-};
-
-/* Low bits of storage class (section). */
-#define        N_SECT            07    /* section mask */
-#define N_UNDF           00    /* undefined */
-#define N_ABS            01    /* absolute */
-#define N_TEXT           02    /* text */
-#define N_DATA           03    /* data */
-#define        N_BSS             04    /* bss */
-#define N_COMM           05    /* (common) */
-
-/* High bits of storage class. */
-#define N_CLASS                0370    /* storage class mask */
-#define C_NULL
-#define C_EXT          0020    /* external symbol */
-#define C_STAT         0030    /* static */
-
-/* Function prototypes. */
-#ifndef _MINIX_ANSI_H
-#include <minix/ansi.h>
-#endif
-
-_PROTOTYPE( int nlist, (char *_file, struct nlist *_nl)                        );
-
-#endif /* _AOUT_H */
diff --git a/lib/nbsd_libcompat_minix/include/configfile.h b/lib/nbsd_libcompat_minix/include/configfile.h
deleted file mode 100644 (file)
index f380180..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*     configfile.h - Generic configuration file format.
- *                                                     Author: Kees J. Bot
- *                                                             5 Jun 1999
- */
-#ifndef _CONFIGFILE_H
-#define _CONFIGFILE_H
-
-/* Data can only be modified inside the library. */
-#ifndef _c
-#define _c     const
-#endif
-
-typedef _c struct config {     /* Contents of a generic configuration file. */
-_c     struct config   *next;          /* Next configuration file thing. */
-_c     struct config   *list;          /* For a { sublist }. */
-       const char      *file;          /* File and line where this is found. */
-       unsigned        line;
-       int             flags;          /* Special flags. */
-       char            word[1];        /* Payload. */
-} config_t;
-
-#define CFG_CLONG      0x0001          /* strtol(word, &end, 0) is valid. */
-#define CFG_OLONG      0x0002          /* strtol(word, &end, 010). */
-#define CFG_DLONG      0x0004          /* strtol(word, &end, 10). */
-#define CFG_XLONG      0x0008          /* strtol(word, &end, 0x10). */
-#define CFG_CULONG     0x0010          /* strtoul(word, &end, 0). */
-#define CFG_OULONG     0x0020          /* strtoul(word, &end, 010). */
-#define CFG_DULONG     0x0040          /* strtoul(word, &end, 10). */
-#define CFG_XULONG     0x0080          /* strtoul(word, &end, 0x10). */
-#define CFG_STRING     0x0100          /* The word is enclosed in quotes. */
-#define CFG_SUBLIST    0x0200          /* This is a sublist, so no word. */
-#define CFG_ESCAPED    0x0400          /* Escapes are still marked with \. */
-
-config_t *config_read(const char *_file, int flags, config_t *_cfg);
-void config_delete(config_t *_cfg);
-int config_renewed(config_t *_cfg);
-size_t config_length(config_t *_cfg);
-#define config_issub(cfg)      (!!((cfg)->flags & CFG_SUBLIST))
-#define config_isatom(cfg)     (!config_issub(cfg))
-#define config_isstring(cfg)   (!!((cfg)->flags & CFG_STRING))
-
-#undef _c
-
-#endif /* _CONFIGFILE_H */
diff --git a/lib/nbsd_libcompat_minix/nlist.c b/lib/nbsd_libcompat_minix/nlist.c
deleted file mode 100644 (file)
index 4901032..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * "nlist.c", Peter Valkenburg, january 1989.
- */
-#include <lib.h>
-#include <string.h>
-#include <a.out.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#define fail(fp)       (fclose(fp), -1)        /* ret. exp. when nlist fails */
-
-_PROTOTYPE( int nlist, (char *file, struct nlist nl[]));
-
-/*
- * Nlist fills fields n_sclass and n_value of array nl with values found in
- * non-stripped executable file.  Entries that are not found have their
- * n_value/n_sclass fields set to 0.  Nl ends with a 0 or nul string n_name.
- * The return value is -1 on failure, else the number of entries not found.
- */
-int nlist(file, nl)
-char *file;
-struct nlist nl[];
-{
-       int nents, nsrch, nfound, i;
-       struct nlist nlent;
-       FILE *fp;
-       struct exec hd;
-
-       /* open executable with namelist */
-       if ((fp = fopen(file, "r")) == NULL)
-               return -1;
-               
-       /* get header and seek to start of namelist */  
-       if (fread((char *) &hd, sizeof(struct exec), 1, fp) != 1 ||
-           BADMAG(hd) || fseek(fp, A_SYMPOS(hd), SEEK_SET) != 0)
-               return fail(fp);
-       
-       /* determine number of entries searched for & reset fields */
-       nsrch = 0;
-       while (nl[nsrch].n_name != NULL && *(nl[nsrch].n_name) != '\0') {
-               nl[nsrch].n_sclass = 0;
-               nl[nsrch].n_value = 0;
-               nl[nsrch].n_type = 0;           /* for compatability */
-               nsrch++;
-       }
-
-       /* loop through namelist & fill in user array */
-       nfound = 0;
-       for (nents = (hd.a_syms & 0xFFFF) / sizeof(struct nlist);
-            nents > 0; nents--) {
-               if (nsrch == nfound)
-                       break;                  /* no need to look further */
-               if (fread((char *) &nlent, sizeof(struct nlist), 1, fp) != 1)
-                       return fail(fp);          
-               for (i = 0; i < nsrch; i++)
-                       if (nl[i].n_sclass == 0 &&
-                           strncmp(nl[i].n_name, nlent.n_name,
-                                   sizeof(nlent.n_name)) == 0) {
-                               nl[i] = nlent;
-                               nfound++;
-                               break;
-                       }
-       }
-
-       (void) fclose(fp);
-       
-       return nsrch - nfound;
-}
diff --git a/lib/nbsd_libcompat_minix/stderr.c b/lib/nbsd_libcompat_minix/stderr.c
deleted file mode 100644 (file)
index fd7f65b..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <lib.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-void std_err(const char *s)
-{
-  register const char *p = s;
-
-  while (*p != 0) p++;
-  write(2, s, (int) (p - s));
-}
diff --git a/lib/nbsd_libm/Makefile b/lib/nbsd_libm/Makefile
deleted file mode 100644 (file)
index 3c3de53..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-#  $NetBSD: Makefile,v 1.101 2011/01/12 23:03:56 joerg Exp $
-#
-#  @(#)Makefile 5.1beta 93/09/24
-#
-#  ====================================================
-#  Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-#
-#  Developed at SunPro, a Sun Microsystems, Inc. business.
-#  Permission to use, copy, modify, and distribute this
-#  software is freely granted, provided that this notice
-#  is preserved.
-#  ====================================================
-#
-#
-
-#
-# There are two options in making libm at fdlibm compile time:
-#      _IEEE_LIBM      --- IEEE libm; smaller, and somewhat faster
-#      _MULTI_LIBM     --- Support multi-standard at runtime by
-#                          imposing wrapper functions defined in
-#                          fdlibm.h:
-#                              _IEEE_MODE      -- IEEE
-#                              _XOPEN_MODE     -- X/OPEN
-#                              _POSIX_MODE     -- POSIX/ANSI
-#                              _SVID3_MODE     -- SVID
-#
-# Here is how to set up CPPFLAGS to create the desired libm at
-# compile time:
-#
-#      CPPFLAGS = -D_IEEE_LIBM         ... IEEE libm (recommended)
-#      CPPFLAGS = -D_SVID3_MODE        ... Multi-standard supported
-#                                          libm with SVID as the
-#                                          default standard
-#      CPPFLAGS = -D_XOPEN_MODE        ... Multi-standard supported
-#                                          libm with XOPEN as the
-#                                          default standard
-#      CPPFLAGS = -D_POSIX_MODE        ... Multi-standard supported
-#                                          libm with POSIX as the
-#                                          default standard
-#      CPPFLAGS =                      ... Multi-standard supported
-#                                          libm with IEEE as the
-#                                          default standard
-#
-
-USE_SHLIBDIR=  yes
-
-# require this for the value of I387_LIBM from mk.conf, if set.
-.include <bsd.own.mk>
-
-.if (${MACHINE_ARCH} == "alpha")
-.PATH: ${.CURDIR}/arch/alpha
-ARCH_SRCS = s_copysign.S s_copysignf.S lrint.S
-.elif ((${MACHINE_ARCH} == "i386") || (${MACHINE_ARCH} == "x86_64"))
-
-.if (${MACHINE_ARCH} == "x86_64")
-.PATH: ${.CURDIR}/arch/x86_64
-.endif
-.PATH: ${.CURDIR}/arch/i387
-
-COMMON_SRCS+= fenv.c s_nextafterl.c s_nexttoward.c
-ARCH_SRCS = e_acos.S e_asin.S e_atan2.S e_exp.S e_expf.S e_fmod.S e_log.S \
-           e_logf.S e_log10.S e_log10f.S e_log2.S e_log2f.S e_remainder.S \
-           e_remainderf.S e_scalb.S e_scalbf.S e_sqrt.S e_sqrtf.S s_atan.S \
-           s_atanf.S s_ceil.S s_ceilf.S s_copysign.S s_copysignf.S s_cos.S \
-           s_cosf.S s_finite.S s_finitef.S s_floor.S s_floorf.S s_ilogb.S \
-           s_ilogbf.S s_log1p.S s_log1pf.S s_logb.S s_logbf.S s_rint.S \
-           s_rintf.S s_scalbn.S s_scalbnf.S s_significand.S \
-           s_significandf.S s_sin.S s_sinf.S s_tan.S s_tanf.S lrint.S
-# do not pick up the i387 asm version, it is incorrect
-s_modf.o s_modf.pico s_modf.po s_modf.d: s_modf.c
-
-.if (${MACHINE_ARCH} == "i386")
-SUBDIR=arch/i387
-.endif
-.elif (${MACHINE_ARCH} == "m68k")
-.if defined(M68060)
-.PATH: ${.CURDIR}/arch/m68060
-.include "${.CURDIR}/arch/m68060/Makefile.list"
-COPTS+=-m68060
-.PATH: ${.CURDIR}/arch/m68k
-ARCH_SRCS += s_ceil.S s_copysign.S s_finite.S s_floor.S s_rint.S
-.elif defined(M68040)
-.PATH: ${.CURDIR}/arch/m68k
-COPTS+=-m68040
-ARCH_SRCS = s_copysign.S s_finite.S
-.else
-.if (${MKSOFTFLOAT} != "yes")
-.PATH: ${.CURDIR}/arch/mc68881 ${.CURDIR}/arch/m68k
-ARCH_SRCS = e_acos.S e_asin.S e_atanh.S e_cosh.S e_exp.S e_fmod.S e_log.S \
-           e_log10.S e_remainder.S e_scalb.S e_sinh.S e_sqrt.S s_atan.S \
-           s_ceil.S s_copysign.S s_cos.S s_expm1.S s_finite.S s_floor.S \
-           s_log1p.S s_logb.S s_rint.S s_scalbn.S s_sin.S s_tan.S s_tanh.S
-.endif
-.endif
-# end of m68k
-.elif (${MACHINE_ARCH} == "vax")
-#.PATH:        ${.CURDIR}/arch/vax
-
-#NOIEEE_ARCH= n_infnan.S n_argred.S n_sqrt.S
-#ARCH_SRCS = n_atan2.S n_cabs.S n_cbrt.S n_support.S n_sincos.S n_tan.S
-# XXX - ripped out due to lack of the insn polyd in the Mariah chip,
-# and emulation code isn't written yet.
-WARNS?=4
-.endif
-
-WARNS?=4
-
-.PATH: ${.CURDIR}/man
-.PATH: ${.CURDIR}/src
-.PATH: ${.CURDIR}/noieee_src
-
-.if (${MACHINE_ARCH} != "vax")
-CPPFLAGS+= -D_MULTI_LIBM -D_POSIX_MODE
-# XXX noieee libm is gross
-COPTS+=        -fno-strict-aliasing
-.endif
-CPPFLAGS+=-DLIBM_SCCS
-
-LIB=   m
-COMMON_SRCS+= e_acos.c e_acosf.c e_acosh.c e_acoshf.c e_asin.c e_asinf.c \
-       e_atan2.c e_atan2f.c e_atanh.c e_atanhf.c e_cosh.c e_coshf.c e_exp.c \
-       e_expf.c e_fmod.c e_fmodf.c e_hypot.c e_hypotf.c e_j0.c e_j0f.c \
-       e_j1.c e_j1f.c e_jn.c e_jnf.c e_lgamma_r.c e_lgammaf_r.c e_log.c \
-       e_log2.c e_log10.c e_log10f.c e_log2f.c e_logf.c e_pow.c e_powf.c \
-       e_rem_pio2.c e_rem_pio2f.c e_remainder.c e_remainderf.c e_scalb.c \
-       e_scalbf.c e_sinh.c e_sinhf.c e_sqrt.c e_sqrtf.c \
-       k_cos.c k_cosf.c k_rem_pio2.c k_rem_pio2f.c k_sin.c k_sinf.c \
-       k_standard.c k_tan.c k_tanf.c \
-       s_asinh.c s_asinhf.c s_atan.c s_atanf.c s_cbrt.c s_cbrtf.c s_ceil.c \
-       s_ceilf.c s_copysign.c s_copysignf.c s_copysignl.c s_cos.c s_cosf.c s_erf.c \
-       s_erff.c s_exp2.c s_exp2f.c s_expm1.c s_expm1f.c s_fabsf.c s_fabsl.c \
-       s_finite.c s_finitef.c \
-       s_floor.c s_floorf.c s_frexpf.c s_ilogb.c s_ilogbf.c \
-       s_isinff.c s_isnanf.c s_ldexpf.c s_lib_version.c s_log1p.c \
-       s_log1pf.c s_logb.c s_logbf.c s_matherr.c s_modff.c s_nextafter.c \
-       s_nextafterf.c s_rint.c s_rintf.c s_round.c s_roundf.c s_scalbn.c \
-       s_scalbnf.c s_signgam.c s_significand.c s_significandf.c s_sin.c \
-       s_sinf.c s_tan.c s_tanf.c s_tanh.c s_tanhf.c s_trunc.c s_truncf.c \
-       w_acos.c w_acosf.c w_acosh.c w_acoshf.c w_asin.c w_asinf.c w_atan2.c \
-       w_atan2f.c w_atanh.c w_atanhf.c w_cosh.c w_coshf.c \
-       w_drem.c w_dremf.c w_exp.c w_expf.c w_fmod.c w_fmodf.c w_gamma.c \
-       w_gamma_r.c w_gammaf.c w_gammaf_r.c w_hypot.c w_hypotf.c w_j0.c \
-       w_j0f.c w_j1.c w_j1f.c w_jn.c w_jnf.c w_lgamma.c w_lgamma_r.c \
-       w_lgammaf.c w_lgammaf_r.c w_log.c w_log10.c w_log10f.c w_log2.c \
-       w_log2f.c w_logf.c \
-       w_pow.c w_powf.c w_remainder.c w_remainderf.c w_scalb.c w_scalbf.c \
-       w_sinh.c w_sinhf.c w_sqrt.c w_sqrtf.c \
-       lrint.c lrintf.c llrint.c llrintf.c lround.c lroundf.c llround.c \
-       llroundf.c s_frexp.c s_ldexp.c s_modf.c \
-       s_fmax.c s_fmaxf.c s_fmaxl.c s_fmin.c s_fminf.c s_fminl.c s_fdim.c
-
-.PATH: ${.CURDIR}/compat
-COMMON_SRCS+= compat_cabs.c compat_cabsf.c
-# XXX our compatibility cabs() is different!
-.if defined(HAVE_GCC) && ${HAVE_GCC} == 4
-COPTS.compat_cabs.c=   -fno-builtin-cabs
-COPTS.compat_cabsf.c=  -fno-builtin-cabsf
-.endif
-
-# math routines for non-IEEE architectures.
-NOIEEE_SRCS = n_asincos.c n_acosh.c n_asinh.c n_atan.c n_atanh.c n_cosh.c \
-       n_erf.c n_exp.c n_exp__E.c n_expm1.c n_floor.c n_fmod.c n_gamma.c \
-       n_lgamma.c n_j0.c n_j1.c n_jn.c n_log.c n_log10.c n_log1p.c \
-       n_log__L.c n_pow.c n_sinh.c n_tanh.c \
-       n_sincos.c n_tan.c \
-       n_round.c n_roundf.c n_lround.c n_lroundf.c \
-       n_fmax.c n_fmaxf.c n_fmin.c n_fminf.c
-#      n_sqrt.c n_argred.c n_infnan.c n_atan2.c n_cabs.c n_cbrt.c n_support.c
-
-
-# NetBSD's C library supplies these functions:
-#COMMON_SRCS+= s_fabs.c s_frexp.c s_isinf.c s_isnan.c s_ldexp.c s_modf.c
-
-.if (${MACHINE_ARCH} == "vax")
-SRCS=  ${NOIEEE_SRCS} ${NOIEEE_ARCH}
-.else
-SRCS=  ${COMMON_SRCS}
-.endif
-
-.ifdef ARCH_ADDS
-SRCS+= ${ARCH_ADDS}
-.endif
-
-# Substitute common sources with any arch specific sources
-.for i in ${ARCH_SRCS} ${NOIEEE_ARCH}
-    SRCS:=${SRCS:S/^${i:S/.S/.c/}/$i/}
-.endfor
-
-.if (${MACHINE_ARCH} == "vax") # XXX until POLYD is written.
-.PATH: ${.CURDIR}/arch/vax
-SRCS:=${SRCS} n_sqrt.S n_argred.S n_infnan.S n_atan2.S n_cabs.S n_cbrt.S \
-       n_support.S
-.endif
-
-.if (${MACHINE_ARCH} == "i386")
-# XXX this gets miscompiled. There should be a better fix.
-COPTS.s_tanh.c+= -O0
-.endif
-
-MAN+=  acos.3 acosh.3 asin.3 asinh.3 atan.3 atan2.3 atanh.3 ceil.3 \
-       cos.3 cosh.3 erf.3 exp.3 fabs.3 floor.3 fmod.3 frexp.3 hypot.3 ieee.3 \
-       ieee_test.3 isinff.3 j0.3 ldexp.3 lgamma.3 lrint.3 \
-       math.3 modf.3 rint.3 round.3 sin.3 sinh.3 \
-       sqrt.3 tan.3 tanh.3 trunc.3 fmax.3 fdim.3
-
-# fenv.h interface
-MAN+=  feclearexcept.3 feenableexcept.3 fegetenv.3 fegetround.3 fenv.3
-MLINKS+=feclearexcept.3 fegetexceptflag.3      \
-       feclearexcept.3 feraiseexcept.3         \
-       feclearexcept.3 fesetexceptflag.3       \
-       feclearexcept.3 fetestexcept.3
-MLINKS+=feenableexcept.3 fedisableexcept.3     \
-       feenableexcept.3 fegetexcept.3
-MLINKS+=fegetenv.3 feholdexcept.3              \
-       fegetenv.3 fesetenv.3                   \
-       fegetenv.3 feupdateenv.3
-MLINKS+=fegetround.3 fesetround.3
-
-MLINKS+=acos.3 acosf.3
-MLINKS+=acosh.3 acoshf.3
-MLINKS+=asin.3 asinf.3
-MLINKS+=asinh.3 asinhf.3
-MLINKS+=atan.3 atanf.3
-MLINKS+=atan2.3 atan2f.3
-MLINKS+=atanh.3 atanhf.3
-MLINKS+=ceil.3 ceilf.3
-MLINKS+=cos.3 cosf.3
-MLINKS+=cosh.3 coshf.3
-MLINKS+=erf.3 erff.3 erf.3 erfc.3 erf.3 erfcf.3
-MLINKS+=exp.3 expf.3 exp.3 expm1.3 exp.3 expm1f.3                      \
-       exp.3 exp2.3 exp.3 exp2f.3                                      \
-       exp.3 log.3 exp.3 logf.3                                        \
-       exp.3 log10.3 exp.3 log10f.3                                    \
-       exp.3 log1p.3 exp.3 log1pf.3                                    \
-       exp.3 pow.3 exp.3 powf.3                                        \
-       exp.3 log2.3 exp.3 log2f.3
-MLINKS+=fabs.3 fabsf.3
-MLINKS+=floor.3 floorf.3
-MLINKS+=fmod.3 fmodf.3
-MLINKS+=hypot.3 hypotf.3
-MLINKS+=ieee.3 copysign.3 ieee.3 copysignf.3 ieee.3 copysignl.3        \
-       ieee.3 finite.3 ieee.3 finitef.3                                \
-       ieee.3 ilogb.3 ieee.3 ilogbf.3                                  \
-       ieee.3 nextafter.3 ieee.3 nextafterf.3 ieee.3 nextafterl.3      \
-       ieee.3 nexttoward.3                                             \
-       ieee.3 remainder.3 ieee.3 remainderf.3                          \
-       ieee.3 scalbn.3 ieee.3 scalbnf.3
-MLINKS+=ieee_test.3 logb.3 ieee_test.3 logbf.3
-MLINKS+=ieee_test.3 scalb.3 ieee_test.3 scalbf.3
-MLINKS+=ieee_test.3 significand.3 ieee_test.3 significandf.3
-MLINKS+=isinff.3 isnanf.3
-MLINKS+=j0.3 j0f.3 j0.3 j1.3 j0.3 j1f.3 j0.3 jn.3 j0.3 jnf.3 \
-       j0.3 y0.3 j0.3 y0f.3 j0.3 y1.3 j0.3 y1f.3 j0.3 yn.3 j0.3 ynf.3
-MLINKS+=lgamma.3 lgammaf.3 lgamma.3 lgamma_r.3 lgamma.3 lgammaf_r.3 \
-       lgamma.3 gamma.3 lgamma.3 gammaf.3 lgamma.3 gamma_r.3 \
-       lgamma.3 gammaf_r.3
-MLINKS+=lrint.3 lrintf.3 lrint.3 llrint.3 lrint.3 llrintf.3
-MLINKS+=rint.3 rintf.3
-MLINKS+=sin.3 sinf.3
-MLINKS+=sinf.3 sinhf.3
-MLINKS+=sqrt.3 sqrtf.3 sqrt.3 cbrt.3 sqrt.3 cbrtf.3
-MLINKS+=tan.3 tanf.3
-MLINKS+=tanh.3 tanhf.3
-MLINKS+=round.3 roundf.3
-MLINKS+=trunc.3 truncf.3
-MLINKS+=fmax.3 fmaxl.3
-MLINKS+=fmax.3 fmaxf.3
-MLINKS+=fmax.3 fmin.3
-MLINKS+=fmax.3 fminl.3
-MLINKS+=fmax.3 fminf.3
-MLINKS+=fdim.3 fdiml.3
-MLINKS+=fdim.3 fdimf.3
-
-.if (${MKCOMPLEX} != "no")
-.include "${.CURDIR}/complex/Makefile.inc"
-.endif
-
-.include "${.CURDIR}/gen/Makefile.inc"
-.include <bsd.lib.mk>
-.include <bsd.subdir.mk>
diff --git a/lib/nbsd_libm/noieee_src/mathimpl.h b/lib/nbsd_libm/noieee_src/mathimpl.h
deleted file mode 100644 (file)
index 92e578f..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*     $NetBSD: mathimpl.h,v 1.9 2008/05/01 15:33:15 christos Exp $    */
-/*
- * 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. 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.
- *
- *     @(#)mathimpl.h  8.1 (Berkeley) 6/4/93
- */
-#ifndef _NOIEEE_SRC_MATHIMPL_H_
-#define _NOIEEE_SRC_MATHIMPL_H_
-
-#include <sys/cdefs.h>
-#include <math.h>
-#include <stdint.h>
-
-#if defined(__vax__) || defined(tahoe)
-
-/* Deal with different ways to concatenate in cpp */
-#define cat3(a,b,c)    a ## b ## c
-
-/* Deal with vax/tahoe byte order issues */
-#  ifdef __vax__
-#    define    cat3t(a,b,c) cat3(a,b,c)
-#  else
-#    define    cat3t(a,b,c) cat3(a,c,b)
-#  endif
-
-#  define vccast(name) (cat3(__,name,x).d)
-
-   /*
-    * Define a constant to high precision on a Vax or Tahoe.
-    *
-    * Args are the name to define, the decimal floating point value,
-    * four 16-bit chunks of the float value in hex
-    * (because the vax and tahoe differ in float format!), the power
-    * of 2 of the hex-float exponent, and the hex-float mantissa.
-    * Most of these arguments are not used at compile time; they are
-    * used in a post-check to make sure the constants were compiled
-    * correctly.
-    *
-    * People who want to use the constant will have to do their own
-    *     #define foo vccast(foo)
-    * since CPP cannot do this for them from inside another macro (sigh).
-    * We define "vccast" if this needs doing.
-    */
-#ifdef _LIBM_DECLARE
-#  define vc(name, value, x1,x2,x3,x4, bexp, xval) \
-    const union { uint32_t l[2]; double d; } cat3(__,name,x) = { \
-       .l = { [0] = cat3t(0x,x1,x2), [1] = cat3t(0x,x3,x4) } };
-#elif defined(_LIBM_STATIC)
-#  define vc(name, value, x1,x2,x3,x4, bexp, xval) \
-    static const union { uint32_t l[2]; double d; } cat3(__,name,x) = { \
-       .l = { [0] = cat3t(0x,x1,x2), [1] = cat3t(0x,x3,x4) } };
-#else
-#  define vc(name, value, x1,x2,x3,x4, bexp, xval) \
-       extern const union { uint32_t l[2]; double d; } cat3(__,name,x);
-#endif
-#  define ic(name, value, bexp, xval) 
-
-#else  /* __vax__ or tahoe */
-
-   /* Hooray, we have an IEEE machine */
-#  undef vccast
-#  define vc(name, value, x1,x2,x3,x4, bexp, xval) 
-
-#ifdef _LIBM_DECLARE
-#  define ic(name, value, bexp, xval) \
-       const double __CONCAT(__,name) = value;
-#elif _LIBM_STATIC
-#  define ic(name, value, bexp, xval) \
-       static const double __CONCAT(__,name) = value;
-#else
-#  define ic(name, value, bexp, xval) \
-       extern const double __CONCAT(__,name);
-#endif
-
-#endif /* defined(__vax__)||defined(tahoe) */
-
-
-/*
- * Functions internal to the math package, yet not static.
- */
-extern double  __exp__E(double, double);
-extern double  __log__L(double);
-extern int     infnan(int);
-
-struct Double {double a, b;};
-double __exp__D(double, double);
-struct Double __log__D(double);
-
-#endif /* _NOIEEE_SRC_MATHIMPL_H_ */
diff --git a/lib/nbsd_libm/noieee_src/n_j1.c b/lib/nbsd_libm/noieee_src/n_j1.c
deleted file mode 100644 (file)
index 9f824ce..0000000
+++ /dev/null
@@ -1,448 +0,0 @@
-/*     $NetBSD: n_j1.c,v 1.6 2003/08/07 16:44:51 agc Exp $     */
-/*-
- * Copyright (c) 1992, 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. 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.
- */
-
-#ifndef lint
-#if 0
-static char sccsid[] = "@(#)j1.c       8.2 (Berkeley) 11/30/93";
-#endif
-#endif /* not lint */
-
-/*
- * 16 December 1992
- * Minor modifications by Peter McIlroy to adapt non-IEEE architecture.
- */
-
-/*
- * ====================================================
- * Copyright (C) 1992 by Sun Microsystems, Inc.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- *
- * ******************* WARNING ********************
- * This is an alpha version of SunPro's FDLIBM (Freely
- * Distributable Math Library) for IEEE double precision
- * arithmetic. FDLIBM is a basic math library written
- * in C that runs on machines that conform to IEEE
- * Standard 754/854. This alpha version is distributed
- * for testing purpose. Those who use this software
- * should report any bugs to
- *
- *             fdlibm-comments@sunpro.eng.sun.com
- *
- * -- K.C. Ng, Oct 12, 1992
- * ************************************************
- */
-
-/* double j1(double x), y1(double x)
- * Bessel function of the first and second kinds of order zero.
- * Method -- j1(x):
- *     1. For tiny x, we use j1(x) = x/2 - x^3/16 + x^5/384 - ...
- *     2. Reduce x to |x| since j1(x)=-j1(-x),  and
- *        for x in (0,2)
- *             j1(x) = x/2 + x*z*R0/S0,  where z = x*x;
- *        (precision:  |j1/x - 1/2 - R0/S0 |<2**-61.51 )
- *        for x in (2,inf)
- *             j1(x) = sqrt(2/(pi*x))*(p1(x)*cos(x1)-q1(x)*sin(x1))
- *             y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- *        where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
- *        as follows:
- *             cos(x1) =  cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
- *                     =  1/sqrt(2) * (sin(x) - cos(x))
- *             sin(x1) =  sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
- *                     = -1/sqrt(2) * (sin(x) + cos(x))
- *        (To avoid cancellation, use
- *             sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
- *         to compute the worse one.)
- *
- *     3 Special cases
- *             j1(nan)= nan
- *             j1(0) = 0
- *             j1(inf) = 0
- *
- * Method -- y1(x):
- *     1. screen out x<=0 cases: y1(0)=-inf, y1(x<0)=NaN
- *     2. For x<2.
- *        Since
- *             y1(x) = 2/pi*(j1(x)*(ln(x/2)+Euler)-1/x-x/2+5/64*x^3-...)
- *        therefore y1(x)-2/pi*j1(x)*ln(x)-1/x is an odd function.
- *        We use the following function to approximate y1,
- *             y1(x) = x*U(z)/V(z) + (2/pi)*(j1(x)*ln(x)-1/x), z= x^2
- *        where for x in [0,2] (abs err less than 2**-65.89)
- *             U(z) = u0 + u1*z + ... + u4*z^4
- *             V(z) = 1  + v1*z + ... + v5*z^5
- *        Note: For tiny x, 1/x dominate y1 and hence
- *             y1(tiny) = -2/pi/tiny, (choose tiny<2**-54)
- *     3. For x>=2.
- *             y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x1)+q1(x)*cos(x1))
- *        where x1 = x-3*pi/4. It is better to compute sin(x1),cos(x1)
- *        by method mentioned above.
- */
-
-#include "mathimpl.h"
-#include <float.h>
-#include <errno.h>
-
-#if defined(__vax__) || defined(tahoe)
-#define _IEEE  0
-#else
-#define _IEEE  1
-#define infnan(x) (0.0)
-#endif
-
-static double pone (double), qone (double);
-
-static const double
-huge    = 1e300,
-zero    = 0.0,
-one    = 1.0,
-invsqrtpi= 5.641895835477562869480794515607725858441e-0001,
-tpi    = 0.636619772367581343075535053490057448,
-
-       /* R0/S0 on [0,2] */
-r00 =  -6.250000000000000020842322918309200910191e-0002,
-r01 =   1.407056669551897148204830386691427791200e-0003,
-r02 =  -1.599556310840356073980727783817809847071e-0005,
-r03 =   4.967279996095844750387702652791615403527e-0008,
-s01 =   1.915375995383634614394860200531091839635e-0002,
-s02 =   1.859467855886309024045655476348872850396e-0004,
-s03 =   1.177184640426236767593432585906758230822e-0006,
-s04 =   5.046362570762170559046714468225101016915e-0009,
-s05 =   1.235422744261379203512624973117299248281e-0011;
-
-#define two_129        6.80564733841876926e+038        /* 2^129 */
-#define two_m54        5.55111512312578270e-017        /* 2^-54 */
-
-double
-j1(double x)
-{
-       double z, s,c,ss,cc,r,u,v,y;
-       y = fabs(x);
-       if (!finite(x)) {               /* Inf or NaN */
-               if (_IEEE && x != x)
-                       return(x);
-               else
-                       return (copysign(x, zero));
-       }
-       y = fabs(x);
-       if (y >= 2) {                   /* |x| >= 2.0 */
-               s = sin(y);
-               c = cos(y);
-               ss = -s-c;
-               cc = s-c;
-               if (y < .5*DBL_MAX) {   /* make sure y+y not overflow */
-                   z = cos(y+y);
-                   if ((s*c)<zero) cc = z/ss;
-                   else            ss = z/cc;
-               }
-       /*
-        * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
-        * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
-        */
-#if !defined(__vax__) && !defined(tahoe)
-               if (y > two_129)         /* x > 2^129 */
-                       z = (invsqrtpi*cc)/sqrt(y);
-               else
-#endif /* defined(__vax__) || defined(tahoe) */
-               {
-                   u = pone(y); v = qone(y);
-                   z = invsqrtpi*(u*cc-v*ss)/sqrt(y);
-               }
-               if (x < 0) return -z;
-               else     return  z;
-       }
-       if (y < 7.450580596923828125e-009) {    /* |x|<2**-27 */
-           if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */
-       }
-       z = x*x;
-       r =  z*(r00+z*(r01+z*(r02+z*r03)));
-       s =  one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05))));
-       r *= x;
-       return (x*0.5+r/s);
-}
-
-static const double u0[5] = {
-  -1.960570906462389484206891092512047539632e-0001,
-   5.044387166398112572026169863174882070274e-0002,
-  -1.912568958757635383926261729464141209569e-0003,
-   2.352526005616105109577368905595045204577e-0005,
-   -9.190991580398788465315411784276789663849e-0008,
-};
-static const double v0[5] = {
-   1.991673182366499064031901734535479833387e-0002,
-   2.025525810251351806268483867032781294682e-0004,
-   1.356088010975162198085369545564475416398e-0006,
-   6.227414523646214811803898435084697863445e-0009,
-   1.665592462079920695971450872592458916421e-0011,
-};
-
-double
-y1(double x)
-{
-       double z, s, c, ss, cc, u, v;
-    /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
-       if (!finite(x)) {
-               if (!_IEEE) return (infnan(EDOM));
-               else if (x < 0)
-                       return(zero/zero);
-               else if (x > 0)
-                       return (0);
-               else
-                       return(x);
-       }
-       if (x <= 0) {
-               if (_IEEE && x == 0) return -one/zero;
-               else if(x == 0) return(infnan(-ERANGE));
-               else if(_IEEE) return (zero/zero);
-               else return(infnan(EDOM));
-       }
-        if (x >= 2) {                   /* |x| >= 2.0 */
-                s = sin(x);
-                c = cos(x);
-                ss = -s-c;
-                cc = s-c;
-               if (x < .5 * DBL_MAX) { /* make sure x+x not overflow */
-                    z = cos(x+x);
-                    if ((s*c)>zero) cc = z/ss;
-                    else            ss = z/cc;
-                }
-        /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
-         * where x0 = x-3pi/4
-         *      Better formula:
-         *              cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
-         *                      =  1/sqrt(2) * (sin(x) - cos(x))
-         *              sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
-         *                      = -1/sqrt(2) * (cos(x) + sin(x))
-         * To avoid cancellation, use
-         *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
-         * to compute the worse one.
-         */
-                if (_IEEE && x>two_129) {
-                       z = (invsqrtpi*ss)/sqrt(x);
-                } else {
-                    u = pone(x); v = qone(x);
-                    z = invsqrtpi*(u*ss+v*cc)/sqrt(x);
-                }
-                return z;
-        }
-        if (x <= two_m54) {    /* x < 2**-54 */
-            return (-tpi/x);
-        }
-        z = x*x;
-        u = u0[0]+z*(u0[1]+z*(u0[2]+z*(u0[3]+z*u0[4])));
-        v = one+z*(v0[0]+z*(v0[1]+z*(v0[2]+z*(v0[3]+z*v0[4]))));
-        return (x*(u/v) + tpi*(j1(x)*log(x)-one/x));
-}
-
-/* For x >= 8, the asymptotic expansions of pone is
- *     1 + 15/128 s^2 - 4725/2^15 s^4 - ...,   where s = 1/x.
- * We approximate pone by
- *     pone(x) = 1 + (R/S)
- * where  R = pr0 + pr1*s^2 + pr2*s^4 + ... + pr5*s^10
- *       S = 1 + ps0*s^2 + ... + ps4*s^10
- * and
- *     | pone(x)-1-R/S | <= 2  ** ( -60.06)
- */
-
-static const double pr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-   0.0,
-   1.171874999999886486643746274751925399540e-0001,
-   1.323948065930735690925827997575471527252e+0001,
-   4.120518543073785433325860184116512799375e+0002,
-   3.874745389139605254931106878336700275601e+0003,
-   7.914479540318917214253998253147871806507e+0003,
-};
-static const double ps8[5] = {
-   1.142073703756784104235066368252692471887e+0002,
-   3.650930834208534511135396060708677099382e+0003,
-   3.695620602690334708579444954937638371808e+0004,
-   9.760279359349508334916300080109196824151e+0004,
-   3.080427206278887984185421142572315054499e+0004,
-};
-
-static const double pr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-   1.319905195562435287967533851581013807103e-0011,
-   1.171874931906140985709584817065144884218e-0001,
-   6.802751278684328781830052995333841452280e+0000,
-   1.083081829901891089952869437126160568246e+0002,
-   5.176361395331997166796512844100442096318e+0002,
-   5.287152013633375676874794230748055786553e+0002,
-};
-static const double ps5[5] = {
-   5.928059872211313557747989128353699746120e+0001,
-   9.914014187336144114070148769222018425781e+0002,
-   5.353266952914879348427003712029704477451e+0003,
-   7.844690317495512717451367787640014588422e+0003,
-   1.504046888103610723953792002716816255382e+0003,
-};
-
-static const double pr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-   3.025039161373736032825049903408701962756e-0009,
-   1.171868655672535980750284752227495879921e-0001,
-   3.932977500333156527232725812363183251138e+0000,
-   3.511940355916369600741054592597098912682e+0001,
-   9.105501107507812029367749771053045219094e+0001,
-   4.855906851973649494139275085628195457113e+0001,
-};
-static const double ps3[5] = {
-   3.479130950012515114598605916318694946754e+0001,
-   3.367624587478257581844639171605788622549e+0002,
-   1.046871399757751279180649307467612538415e+0003,
-   8.908113463982564638443204408234739237639e+0002,
-   1.037879324396392739952487012284401031859e+0002,
-};
-
-static const double pr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-   1.077108301068737449490056513753865482831e-0007,
-   1.171762194626833490512746348050035171545e-0001,
-   2.368514966676087902251125130227221462134e+0000,
-   1.224261091482612280835153832574115951447e+0001,
-   1.769397112716877301904532320376586509782e+0001,
-   5.073523125888185399030700509321145995160e+0000,
-};
-static const double ps2[5] = {
-   2.143648593638214170243114358933327983793e+0001,
-   1.252902271684027493309211410842525120355e+0002,
-   2.322764690571628159027850677565128301361e+0002,
-   1.176793732871470939654351793502076106651e+0002,
-   8.364638933716182492500902115164881195742e+0000,
-};
-
-static double
-pone(double x)
-{
-       const double *p,*q;
-       double z,r,s;
-       if (x >= 8.0)                      {p = pr8; q= ps8;}
-       else if (x >= 4.54545211791992188) {p = pr5; q= ps5;}
-       else if (x >= 2.85714149475097656) {p = pr3; q= ps3;}
-       else /* if (x >= 2.0) */           {p = pr2; q= ps2;}
-       z = one/(x*x);
-       r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
-       s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
-       return (one + r/s);
-}
-
-
-/* For x >= 8, the asymptotic expansions of qone is
- *     3/8 s - 105/1024 s^3 - ..., where s = 1/x.
- * We approximate pone by
- *     qone(x) = s*(0.375 + (R/S))
- * where  R = qr1*s^2 + qr2*s^4 + ... + qr5*s^10
- *       S = 1 + qs1*s^2 + ... + qs6*s^12
- * and
- *     | qone(x)/s -0.375-R/S | <= 2  ** ( -61.13)
- */
-
-static const double qr8[6] = { /* for x in [inf, 8]=1/[0,0.125] */
-   0.0,
-  -1.025390624999927207385863635575804210817e-0001,
-  -1.627175345445899724355852152103771510209e+0001,
-  -7.596017225139501519843072766973047217159e+0002,
-  -1.184980667024295901645301570813228628541e+0004,
-  -4.843851242857503225866761992518949647041e+0004,
-};
-static const double qs8[6] = {
-   1.613953697007229231029079421446916397904e+0002,
-   7.825385999233484705298782500926834217525e+0003,
-   1.338753362872495800748094112937868089032e+0005,
-   7.196577236832409151461363171617204036929e+0005,
-   6.666012326177764020898162762642290294625e+0005,
-  -2.944902643038346618211973470809456636830e+0005,
-};
-
-static const double qr5[6] = { /* for x in [8,4.5454]=1/[0.125,0.22001] */
-  -2.089799311417640889742251585097264715678e-0011,
-  -1.025390502413754195402736294609692303708e-0001,
-  -8.056448281239359746193011295417408828404e+0000,
-  -1.836696074748883785606784430098756513222e+0002,
-  -1.373193760655081612991329358017247355921e+0003,
-  -2.612444404532156676659706427295870995743e+0003,
-};
-static const double qs5[6] = {
-   8.127655013843357670881559763225310973118e+0001,
-   1.991798734604859732508048816860471197220e+0003,
-   1.746848519249089131627491835267411777366e+0004,
-   4.985142709103522808438758919150738000353e+0004,
-   2.794807516389181249227113445299675335543e+0004,
-  -4.719183547951285076111596613593553911065e+0003,
-};
-
-static const double qr3[6] = {/* for x in [4.547,2.8571]=1/[0.2199,0.35001] */
-  -5.078312264617665927595954813341838734288e-0009,
-  -1.025378298208370901410560259001035577681e-0001,
-  -4.610115811394734131557983832055607679242e+0000,
-  -5.784722165627836421815348508816936196402e+0001,
-  -2.282445407376317023842545937526967035712e+0002,
-  -2.192101284789093123936441805496580237676e+0002,
-};
-static const double qs3[6] = {
-   4.766515503237295155392317984171640809318e+0001,
-   6.738651126766996691330687210949984203167e+0002,
-   3.380152866795263466426219644231687474174e+0003,
-   5.547729097207227642358288160210745890345e+0003,
-   1.903119193388108072238947732674639066045e+0003,
-  -1.352011914443073322978097159157678748982e+0002,
-};
-
-static const double qr2[6] = {/* for x in [2.8570,2]=1/[0.3499,0.5] */
-  -1.783817275109588656126772316921194887979e-0007,
-  -1.025170426079855506812435356168903694433e-0001,
-  -2.752205682781874520495702498875020485552e+0000,
-  -1.966361626437037351076756351268110418862e+0001,
-  -4.232531333728305108194363846333841480336e+0001,
-  -2.137192117037040574661406572497288723430e+0001,
-};
-static const double qs2[6] = {
-   2.953336290605238495019307530224241335502e+0001,
-   2.529815499821905343698811319455305266409e+0002,
-   7.575028348686454070022561120722815892346e+0002,
-   7.393932053204672479746835719678434981599e+0002,
-   1.559490033366661142496448853793707126179e+0002,
-  -4.959498988226281813825263003231704397158e+0000,
-};
-
-static double
-qone(double x)
-{
-       const double *p,*q;
-       double s,r,z;
-       if (x >= 8.0)                      {p = qr8; q= qs8;}
-       else if (x >= 4.54545211791992188) {p = qr5; q= qs5;}
-       else if (x >= 2.85714149475097656) {p = qr3; q= qs3;}
-       else /* if (x >= 2.0) */           {p = qr2; q= qs2;}
-       z = one/(x*x);
-       r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
-       s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5])))));
-       return (.375 + r/s)/x;
-}
diff --git a/lib/nbsd_libminlib/dhcp_gettag.c b/lib/nbsd_libminlib/dhcp_gettag.c
deleted file mode 100644 (file)
index 3dcb6e8..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*     dhcp_gettag()                                   Author: Kees J. Bot
- *                                                             1 Dec 2000
- */
-#define nil ((void*)0)
-#include <stddef.h>
-#include <string.h>
-#include <sys/types.h>
-#include <net/hton.h>
-#include <net/gen/in.h>
-#include <net/gen/dhcp.h>
-
-#define arraysize(a)   (sizeof(a) / sizeof((a)[0]))
-
-int dhcp_gettag(dhcp_t *dp, int searchtag, u8_t **pdata, size_t *plen)
-{
-    /* Find a tag in the options field, or possibly in the file or sname
-     * fields.  Return true iff found, and return the data and/or length if
-     * their pointers are non-null.
-     */
-    u8_t *p;
-    u8_t *optfield[3];
-    size_t optlen[3];
-    int i, tag, len;
-
-    /* The DHCP magic number must be correct, or no tags. */
-    if (dp->magic != DHCP_MAGIC) return 0;
-
-    optfield[0]= dp->options;
-    optlen[0]= arraysize(dp->options);
-    optfield[1]= dp->file;
-    optlen[1]= 0;              /* Unknown if used for options yet. */
-    optfield[2]= dp->sname;
-    optlen[2]= 0;
-
-    for (i= 0; i < 3; i++) {
-       p= optfield[i];
-       while (p < optfield[i] + optlen[i]) {
-           tag= *p++;
-           if (tag == 255) break;
-           len= tag == 0 ? 0 : *p++;
-           if (tag == searchtag) {
-               if (pdata != nil) *pdata= p;
-               if (plen != nil) *plen= len;
-               return 1;
-           }
-           if (tag == DHCP_TAG_OVERLOAD) {
-               /* There are also options in the file or sname field. */
-               if (*p & 1) optlen[1]= arraysize(dp->file);
-               if (*p & 2) optlen[1]= arraysize(dp->sname);
-           }
-           p += len;
-       }
-    }
-    return 0;
-}
diff --git a/lib/nbsd_libminlib/dhcp_settag.c b/lib/nbsd_libminlib/dhcp_settag.c
deleted file mode 100644 (file)
index 7cba82d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*     dhcp_init(), dhcp_settag()                      Author: Kees J. Bot
- *                                                             1 Dec 2000
- */
-#define nil ((void*)0)
-#include <stddef.h>
-#include <string.h>
-#include <sys/types.h>
-#include <net/hton.h>
-#include <net/gen/in.h>
-#include <net/gen/dhcp.h>
-
-#define arraysize(a)   (sizeof(a) / sizeof((a)[0]))
-#define arraylimit(a)  ((a) + arraysize(a))
-
-void dhcp_init(dhcp_t *dp)
-{
-    /* Initialize a DHCP packet. */
-    memset(dp, 0, offsetof(dhcp_t, magic));
-    dp->magic= DHCP_MAGIC;
-    memset(dp->options, 255, sizeof(dp->options));
-}
-
-int dhcp_settag(dhcp_t *dp, int tag, void *data, size_t len)
-{
-    /* Add a tag to a DHCP packet.  No padding.  Only do the options field.
-     * (This is Minix, we don't need megabytes of silly bits of data.)
-     * The length may be zero to delete a tag.
-     */
-    u8_t *p;
-    int n;
-
-    if (tag <= 0 || tag >= 255) return 0;
-
-    for (p= dp->options; p < arraylimit(dp->options) && *p != 255; p += n) {
-       n= 1 + 1 + p[1];
-       if (*p == tag) {
-           /* The tag is already there, remove it so it gets replaced. */
-           memmove(p, p + n, arraylimit(dp->options) - (p + n));
-           memset(arraylimit(dp->options) - n, 255, n);
-           n= 0;
-       }
-    }
-
-    /* Add tag. */
-    if (len == 0) {
-       /* We're merely deleting a tag. */
-    } else
-    if (p + 1 + 1 + len <= arraylimit(dp->options)) {
-       *p++ = tag;
-       *p++ = len;
-       memcpy(p, data, len);
-    } else {
-       /* Oops, it didn't fit?  Is this really Minix??? */
-       return 0;
-    }
-    return 1;
-}
diff --git a/lib/nbsd_libminlib/fslib.c b/lib/nbsd_libminlib/fslib.c
deleted file mode 100644 (file)
index 0ef6ad3..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/* fslib.c - routines needed by fs and fs utilities */
-
-#include <minix/config.h>      /* for unused stuff in <minix/type.h> :-( */
-#include <minix/ansi.h>
-#include <limits.h>
-#include <dirent.h>
-#include <sys/types.h>
-#include <minix/const.h>
-#include <minix/type.h>                /* for unshort :-( */
-#include "mfs/const.h"         /* depends of -I flag in Makefile */
-#include "mfs/type.h"          /* ditto */
-#include "mfs/inode.h"         /* ditto */
-#include "mfs/super.h"
-#include <minix/fslib.h>
-
-/* The next routine is copied from fsck.c and mkfs.c...  (Re)define some
- * things for consistency.  Some things should be done better.
- */
-
-/* Convert from bit count to a block count. The usual expression
- *
- *     (nr_bits + (1 << BITMAPSHIFT) - 1) >> BITMAPSHIFT
- *
- * doesn't work because of overflow.
- *
- * Other overflow bugs, such as the expression for N_ILIST overflowing when
- * s_inodes is just over V*_INODES_PER_BLOCK less than the maximum+1, are not
- * fixed yet, because that number of inodes is silly.
- */
-/* The above comment doesn't all apply now bit_t is long.  Overflow is now
- * unlikely, but negative bit counts are now possible (though unlikely)
- * and give silly results.
- */ 
-PUBLIC int bitmapsize(nr_bits, block_size)
-bit_t nr_bits;
-int block_size;
-{
-  int nr_blocks;
-
-  nr_blocks = (int) (nr_bits / FS_BITS_PER_BLOCK(block_size));
-  if (((bit_t) nr_blocks * FS_BITS_PER_BLOCK(block_size)) < nr_bits) ++nr_blocks;
-  return(nr_blocks);
-}
-
-
-/*===========================================================================*
- *                             conv2                                        *
- *===========================================================================*/
-PUBLIC unsigned conv2(norm, w)
-int norm;                      /* TRUE if no swap, FALSE for byte swap */
-int w;                         /* promotion of 16-bit word to be swapped */
-{
-/* Possibly swap a 16-bit word between 8086 and 68000 byte order. */
-
-  if (norm) return( (unsigned) w & 0xFFFF);
-  return( ((w&BYTE) << 8) | ( (w>>8) & BYTE));
-}
-
-
-/*===========================================================================*
- *                             conv4                                        *
- *===========================================================================*/
-PUBLIC long conv4(norm, x)
-int norm;                      /* TRUE if no swap, FALSE for byte swap */
-long x;                                /* 32-bit long to be byte swapped */
-{
-/* Possibly swap a 32-bit long between 8086 and 68000 byte order. */
-
-  unsigned lo, hi;
-  long l;
-  
-  if (norm) return(x);                 /* byte order was already ok */
-  lo = conv2(FALSE, (int) x & 0xFFFF); /* low-order half, byte swapped */
-  hi = conv2(FALSE, (int) (x>>16) & 0xFFFF);   /* high-order half, swapped */
-  l = ( (long) lo <<16) | hi;
-  return(l);
-}
-
-
-/*===========================================================================*
- *                             conv_inode                                   *
- *===========================================================================*/
-PUBLIC void conv_inode(rip, dip, dip2, rw_flag, magic)
-register struct inode *rip;    /* pointer to the in-core inode struct */
-register d1_inode *dip;                /* pointer to the V1 on-disk inode struct */
-register d2_inode *dip2;       /* pointer to the V2 on-disk inode struct */
-int rw_flag;                   /* READING or WRITING */
-int magic;                     /* magic number of file system */
-{ 
-/* Copy the inode from the disk block to the in-core table or vice versa.
- * If the fourth parameter below is FALSE, the bytes are swapped.
- */
-  switch (magic) {
-       case SUPER_MAGIC:       old_icopy(rip, dip,  rw_flag, TRUE);    break;
-       case SUPER_REV:         old_icopy(rip, dip,  rw_flag, FALSE);   break;
-       case SUPER_V3:
-       case SUPER_V2:          new_icopy(rip, dip2, rw_flag, TRUE);    break;
-       case SUPER_V2_REV:      new_icopy(rip, dip2, rw_flag, FALSE);   break;
-  } 
-}
-
-
-/*===========================================================================*
- *                             old_icopy                                    *
- *===========================================================================*/
-PUBLIC void old_icopy(rip, dip, direction, norm)
-register struct inode *rip;    /* pointer to the in-core inode struct */
-register d1_inode *dip;                /* pointer to the d1_inode inode struct */
-int direction;                 /* READING (from disk) or WRITING (to disk) */
-int norm;                      /* TRUE = do not swap bytes; FALSE = swap */
-
-{
-/* 4 different on-disk inode layouts are supported, one for each combination
- * of V1.x/V2.x * bytes-swapped/not-swapped.  When an inode is read or written
- * this routine handles the conversions so that the information in the inode
- * table is independent of the disk structure from which the inode came.
- * The old_icopy routine copies to and from V1 disks.
- */
-
-  int i;
-
-  if (direction == READING) {
-       /* Copy V1.x inode to the in-core table, swapping bytes if need be. */
-       rip->i_mode    = conv2(norm, dip->d1_mode);
-       rip->i_uid     = conv2(norm,dip->d1_uid );
-       rip->i_size    = conv4(norm,dip->d1_size);
-       rip->i_mtime   = conv4(norm,dip->d1_mtime);
-       rip->i_atime   = 0;
-       rip->i_ctime   = 0;
-       rip->i_nlinks  = (nlink_t) dip->d1_nlinks;      /* 1 char */
-       rip->i_gid     = (gid_t) dip->d1_gid;           /* 1 char */
-       rip->i_ndzones = V1_NR_DZONES;
-       rip->i_nindirs = V1_INDIRECTS;
-       for (i = 0; i < V1_NR_TZONES; i++)
-               rip->i_zone[i] = conv2(norm, (int) dip->d1_zone[i]);
-  } else {
-       /* Copying V1.x inode to disk from the in-core table. */
-       dip->d1_mode   = conv2(norm,rip->i_mode);
-       dip->d1_uid    = conv2(norm,rip->i_uid );
-       dip->d1_size   = conv4(norm,rip->i_size);
-       dip->d1_mtime  = conv4(norm,rip->i_mtime);
-       dip->d1_nlinks = (nlink_t) rip->i_nlinks;       /* 1 char */
-       dip->d1_gid    = (gid_t) rip->i_gid;            /* 1 char */
-       for (i = 0; i < V1_NR_TZONES; i++)
-               dip->d1_zone[i] = conv2(norm, (int) rip->i_zone[i]);
-  }
-}
-
-
-/*===========================================================================*
- *                             new_icopy                                    *
- *===========================================================================*/
-PUBLIC void new_icopy(rip, dip, direction, norm)
-register struct inode *rip;    /* pointer to the in-core inode struct */
-register d2_inode *dip;        /* pointer to the d2_inode struct */
-int direction;                 /* READING (from disk) or WRITING (to disk) */
-int norm;                      /* TRUE = do not swap bytes; FALSE = swap */
-
-{
-/* Same as old_icopy, but to/from V2 disk layout. */
-
-  int i;
-
-  if (direction == READING) {
-       /* Copy V2.x inode to the in-core table, swapping bytes if need be. */
-       rip->i_mode    = conv2(norm,dip->d2_mode);
-       rip->i_uid     = conv4(norm,dip->d2_uid );
-       rip->i_nlinks  = conv2(norm,(int) dip->d2_nlinks);
-       rip->i_gid     = conv4(norm,(int) dip->d2_gid );
-       rip->i_size    = conv4(norm,dip->d2_size);
-       rip->i_atime   = conv4(norm,dip->d2_atime);
-       rip->i_ctime   = conv4(norm,dip->d2_ctime);
-       rip->i_mtime   = conv4(norm,dip->d2_mtime);
-       rip->i_ndzones = V2_NR_DZONES;
-       rip->i_nindirs = V2_INDIRECTS(rip->i_sp->s_block_size);
-       for (i = 0; i < V2_NR_TZONES; i++)
-               rip->i_zone[i] = conv4(norm, (long) dip->d2_zone[i]);
-  } else {
-       /* Copying V2.x inode to disk from the in-core table. */
-       dip->d2_mode   = conv2(norm,rip->i_mode);
-       dip->d2_uid    = conv4(norm,rip->i_uid );
-       dip->d2_nlinks = conv2(norm,rip->i_nlinks);
-       dip->d2_gid    = conv4(norm,rip->i_gid );
-       dip->d2_size   = conv4(norm,rip->i_size);
-       dip->d2_atime  = conv4(norm,rip->i_atime);
-       dip->d2_ctime  = conv4(norm,rip->i_ctime);
-       dip->d2_mtime  = conv4(norm,rip->i_mtime);
-       for (i = 0; i < V2_NR_TZONES; i++)
-               dip->d2_zone[i] = conv4(norm, (long) rip->i_zone[i]);
-  }
-}
diff --git a/lib/nbsd_libminlib/fsversion.c b/lib/nbsd_libminlib/fsversion.c
deleted file mode 100644 (file)
index 4941899..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/* This procedure examines a file system and figures out whether it is
- * version 1 or version 2.  It returns the result as an int.  If the
- * file system is neither, it returns -1.  A typical call is:
- *
- *     n = fsversion("/dev/hd1", "df");
- *
- * The first argument is the special file for the file system. 
- * The second is the program name, which is used in error messages.
- */
-
-#include <sys/types.h>
-#include <minix/config.h>
-#include <minix/const.h>
-#include <minix/minlib.h>
-#include <minix/type.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "mfs/const.h"
-
-static char super[SUPER_BLOCK_BYTES];
-
-#define MAGIC_OFFSET_MFS 0x18
-#define MAGIC_OFFSET_EXT 0x38
-#define MAGIC_VALUE_EXT2       0xef53
-
-static int check_super(off_t offset, unsigned short magic)
-{
-  return (memcmp(super + offset, &magic, sizeof(magic)) == 0) ? 1 : 0;
-}
-
-int fsversion(dev, prog)
-char *dev, *prog;
-{
-  int fd;
-
-  if ((fd = open(dev, O_RDONLY)) < 0) {
-       std_err(prog);
-       std_err(" cannot open ");
-       perror(dev);
-       return(-1);
-  }
-
-  lseek(fd, (off_t) SUPER_BLOCK_BYTES, SEEK_SET);      /* skip boot block */
-  if (read(fd, (char *) &super, sizeof(super)) != sizeof(super)) {
-       std_err(prog);
-       std_err(" cannot read super block on ");
-       perror(dev);
-       close(fd);
-       return(-1);
-  }
-  close(fd);
-  
-  /* first check MFS, a valid MFS may look like EXT but not vice versa */
-  if (check_super(MAGIC_OFFSET_MFS, SUPER_MAGIC))      return FSVERSION_MFS1;
-  if (check_super(MAGIC_OFFSET_MFS, SUPER_V2))         return FSVERSION_MFS2;
-  if (check_super(MAGIC_OFFSET_MFS, SUPER_V3))         return FSVERSION_MFS3;
-  if (check_super(MAGIC_OFFSET_EXT, MAGIC_VALUE_EXT2)) return FSVERSION_EXT2;
-  
-  return(-1);
-}
diff --git a/lib/nbsd_libminlib/gcov.c b/lib/nbsd_libminlib/gcov.c
deleted file mode 100644 (file)
index 5ce8a39..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <minix/gcov.h>
-
-int gcov_flush_svr(char *buff, int buff_sz, int server_nr)
-{
-       message msg;
-
-       msg.GCOV_BUFF_P = buff;
-       msg.GCOV_BUFF_SZ = buff_sz;
-       msg.GCOV_PID = server_nr;
-
-       /* Make the call to server. It will call the gcov library,
-        * buffer the stdio requests, and copy the buffer to this user
-        * space
-        */
-       return _syscall(VFS_PROC_NR, GCOV_FLUSH, &msg);
-}
-
-
-/* wrappers for file system calls from gcc libgcov library.
-   Default calls are wrapped. In libsys, an alternative
-   implementation for servers is used.
-*/
-
-FILE *_gcov_fopen(char *name, char *mode){
-       return fopen(name, mode);
-}
-
-
-size_t _gcov_fread(void *ptr, size_t itemsize, size_t nitems
-        , FILE *stream){
-        return fread(ptr, itemsize, nitems, stream);
-}
-
-size_t _gcov_fwrite(void *ptr, size_t itemsize, size_t nitems
-        , FILE *stream){
-       return fwrite(ptr, itemsize, nitems, stream);
-}
-
-int _gcov_fclose(FILE *stream){
-       return fclose(stream);
-}
-
-int _gcov_fseek(FILE *stream, long offset, int ptrname){
-        return fseek(stream, offset, ptrname);
-}
-
-char *_gcov_getenv(const char *name){
-        return getenv(name);
-}
-
diff --git a/lib/nbsd_libminlib/gcov_flush.c b/lib/nbsd_libminlib/gcov_flush.c
deleted file mode 100644 (file)
index 60e678c..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <minix/gcov.h>
-
-void __gcov_flush(void)
-{
-        /* A version of __gcov_flush for cases in which no gcc -lgcov
-         * is given; i.e. non-gcc or gcc without active gcov.
-         */
-        ;
-}
-
diff --git a/lib/nbsd_libminlib/i386/_cpuid.S b/lib/nbsd_libminlib/i386/_cpuid.S
deleted file mode 100644 (file)
index 9b0929f..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/* _cpuid() - interface to cpuid instruction */
-
-
-/* void _cpuid(u32_t *eax, u32_t *ebx, u32_t *ecx, u32_t *edx); */
-/* 0 for OK, nonzero for unsupported */
-
-#include <machine/asm.h>
-
-ENTRY(_cpuid)
-/* save work registers */
-       push    %ebp
-       push    %ebx
-
-/* set eax parameter to cpuid and execute cpuid */
-       movl    12(%esp), %ebp
-       mov     (%ebp), %eax
-       movl    16(%esp), %ebp
-       mov     (%ebp), %ebx
-       movl    20(%esp), %ebp
-       mov     (%ebp), %ecx
-       movl    24(%esp), %ebp
-       mov     (%ebp), %edx
-
-.byte  0x0F, 0xA2      /* CPUID */
-
-/* store results in pointer arguments */
-       movl    12(%esp), %ebp
-       movl    %eax, (%ebp)
-       movl    16(%esp), %ebp
-       movl    %ebx, (%ebp)
-       movl    20(%esp), %ebp
-       movl    %ecx, (%ebp)
-       movl    24(%esp), %ebp
-       movl    %edx, (%ebp)
-
-/* restore registers */
-       pop     %ebx
-       pop     %ebp
-
-       ret
diff --git a/lib/nbsd_libminlib/i386/get_bp.S b/lib/nbsd_libminlib/i386/get_bp.S
deleted file mode 100644 (file)
index 8b0a2de..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* get_bp.s */
-/* */
-/* return EBP in EAX */
-/* */
-/* Created:    Sep 7, 1992 by Philip Homburg */
-
-#include <machine/asm.h>
-
-ENTRY(get_bp)
-       movl    %ebp, %eax
-       ret
-
-/* $PchId: get_bp.ack.s,v 1.3 1996/02/23 08:30:52 philip Exp $ */
diff --git a/lib/nbsd_libminlib/i386/getprocessor.S b/lib/nbsd_libminlib/i386/getprocessor.S
deleted file mode 100644 (file)
index f1daeba..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*     getprocessor() - determine processor type       Author: Kees J. Bot */
-/*                                                             26 Jan 1994 */
-#include <machine/asm.h>
-
-/* int getprocessor(void); */
-/*     Return 386, 486, 586, ... */
-ENTRY(getprocessor)
-       push    %ebp
-       movl    %esp, %ebp
-       andl    $0xFFFFFFFC, %esp       /* Align stack to avoid AC fault */
-       movl    $0x00040000, %ecx       /* Try to flip the AC bit introduced on the 486 */
-       call    flip
-       movl    $386, %eax      /* 386 if it didn't react to "flipping" */
-       je      gotprocessor
-       movl    $0x00200000, %ecx       /* Try to flip the ID bit introduced on the 586 */
-       call    flip
-       movl    $486, %eax      /* 486 if it didn't react */
-       je      gotprocessor
-       pushf
-       pusha   /* Save the world */
-       movl    $1, %eax
-.byte  0x0F, 0xA2      /* CPUID instruction tells the processor type */
-       andb    $0x0F, %ah      /* Extract the family (5, 6, ...) */
-       movzbl  %ah, %eax
-       cmpl    $15, %eax       /* 15: extended family */
-       jne     direct
-       movl    $6, %eax        /* Make it 686 */
-direct:
-       imull   $100, %eax      /* 500, 600, ... */
-       addl    $86, %eax       /* 586, 686, ... */
-       movl    %eax, 7*4(%esp) /* Pass eax through */
-       popa
-       popf
-gotprocessor:
-       leave
-       ret
-
-flip:
-       pushf   /* Push eflags */
-       pop     %eax    /* eax = eflags */
-       movl    %eax, %edx      /* Save original eflags */
-       xorl    %ecx, %eax      /* Flip the bit to test */
-       push    %eax    /* Push modified eflags value */
-       popf    /* Load modified eflags register */
-       pushf
-       pop     %eax    /* Get it again */
-       push    %edx
-       popf    /* Restore original eflags register */
-       xorl    %edx, %eax      /* See if the bit changed */
-       testl   %ecx, %eax
-       ret
diff --git a/lib/nbsd_libminlib/i386/oneC_sum.S b/lib/nbsd_libminlib/i386/oneC_sum.S
deleted file mode 100644 (file)
index 518fa00..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-/*     oneC_sum() - One complement`s checksum          Author: Kees J. Bot */
-/*                                                             9 May 1995 */
-/* See RFC 1071, "Computing the Internet checksum" */
-/* See also the C version of this code. */
-#include <machine/asm.h>
-
-ENTRY(oneC_sum)
-       push    %ebp
-       movl    %esp, %ebp
-       push    %esi
-       push    %edi
-       movzwl  8(%ebp), %eax   /* Checksum of previous block */
-       movl    12(%ebp), %esi  /* Data to compute checksum over */
-       movl    16(%ebp), %edi  /* Number of bytes */
-
-       xorl    %edx, %edx
-       xorb    %cl, %cl
-align:
-       testl   $3, %esi        /* Is the data aligned? */
-       je      aligned
-       testl   %edi, %edi
-       je      0f
-       movb    (%esi), %dl     /* Rotate the first unaligned bytes */
-       decl    %edi    /* into the edx register */
-0:
-       incl    %esi
-       rorl    $8, %edx
-       rorl    $8, %eax        /* Rotate the checksum likewise */
-       addb    $8, %cl /* Number of bits rotated */
-       jmp     align
-aligned:
-       addl    %edx, %eax      /* Summate the unaligned bytes */
-       adcl    $0, %eax        /* Add carry back in for one`s complement */
-
-       jmp     add6test
-_ALIGN_TEXT
-add6:
-       addl    (%esi), %eax    /* Six times unrolled loop, see below */
-       adcl    4(%esi), %eax
-       adcl    8(%esi), %eax
-       adcl    12(%esi), %eax
-       adcl    16(%esi), %eax
-       adcl    20(%esi), %eax
-       adcl    $0, %eax
-       addl    $24, %esi
-add6test:
-       subl    $24, %edi
-       jae     add6
-       addl    $24, %edi
-
-       jmp     add1test
-_ALIGN_TEXT
-add1:
-       addl    (%esi), %eax    /* while ((edi -= 4) >= 0) */
-       adcl    $0, %eax        /*      eax += *esi++; */
-       addl    $4, %esi        /* edi += 4; */
-add1test:
-       subl    $4, %edi
-       jae     add1
-       addl    $4, %edi
-
-       je      done    /* Are there extra bytes? */
-       movl    (%esi), %edx    /* Load extra bytes in a full dword */
-       andl    mask-4(,%edi,4), %edx   /* Mask off excess */
-       addl    %edx, %eax      /* Add in the last bits */
-       adcl    $0, %eax
-done:
-       roll    %cl, %eax       /* Undo the rotation at the beginning */
-       movl    %eax, %edx
-       shrl    $16, %eax
-       addw    %dx, %ax        /* Add the two words in eax to form */
-       adcw    $0, %ax /* a 16 bit sum */
-       pop     %edi
-       pop     %esi
-       pop     %ebp
-       ret
-
-#ifdef __ACK__
-.rom
-#else
-.data
-#endif
-.balign 4
-mask:
-.long  0x000000FF, 0x0000FFFF, 0x00FFFFFF
-
-/* */
-/* $PchId: oneC_sum.ack.s,v 1.2 1996/03/12 19:33:51 philip Exp $ */
diff --git a/lib/nbsd_libminlib/i386/read_tsc.S b/lib/nbsd_libminlib/i386/read_tsc.S
deleted file mode 100644 (file)
index 81ab97d..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*  */
-/* sections */
-#include <machine/asm.h>
-
-/**===========================================================================* */
-/* PUBLIC void read_tsc(unsigned long *high, unsigned long *low); */
-/* Read the cycle counter of the CPU. Pentium and up.  */
-ENTRY(read_tsc)
-       push    %edx
-       push    %eax
-.byte  0x0f    /* this is the RDTSC instruction  */
-.byte  0x31    /* it places the TSC in EDX:EAX */
-       push    %ebp
-       movl    16(%esp), %ebp
-       movl    %edx, (%ebp)
-       movl    20(%esp), %ebp
-       movl    %eax, (%ebp)
-       pop     %ebp
-       pop     %eax
-       pop     %edx
-       ret
-
-/**===========================================================================* */
-/* PUBLIC void read_host_time_ns(unsigned long *high, unsigned long *low); */
-/* access real time in ns from host in vmware. */
-ENTRY(read_host_time_ns)
-        pushl   %edx
-        pushl   %eax
-        pushl   %ecx
-        movl    $0x10001, %ecx
-.byte  0x0f    /* this is the RDTSC instruction  */
-.byte  0x31    /* it places the TSC in EDX:EAX */
-        pushl   %ebp
-        movl    20(%esp), %ebp
-        movl    %edx, (%ebp)
-        movl    24(%esp), %ebp
-        movl    %eax, (%ebp)
-        popl    %ebp
-        popl    %ecx
-        popl    %eax
-        popl    %edx
-        ret
diff --git a/lib/nbsd_libminlib/i386/read_tsc_64.c b/lib/nbsd_libminlib/i386/read_tsc_64.c
deleted file mode 100644 (file)
index 63faa10..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-
-#include <minix/u64.h>
-#include <minix/minlib.h>
-
-/* Utility function to work directly with u64_t
- * By Antonio Mancina
- */
-void read_tsc_64(t)
-u64_t* t;
-{
-    u32_t lo, hi;
-    read_tsc (&hi, &lo);
-    *t = make64 (lo, hi);
-}
-
diff --git a/lib/nbsd_libminlib/itoa.c b/lib/nbsd_libminlib/itoa.c
deleted file mode 100644 (file)
index f78717d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <lib.h>
-/* Integer to ASCII for signed decimal integers. */
-
-PRIVATE int next;
-PRIVATE char qbuf[8];
-
-_PROTOTYPE( char *itoa, (int n));
-
-char *itoa(n)
-int n;
-{
-  register int r, k;
-  int flag = 0;
-
-  next = 0;
-  if (n < 0) {
-       qbuf[next++] = '-';
-       n = -n;
-  }
-  if (n == 0) {
-       qbuf[next++] = '0';
-  } else {
-       k = 10000;
-       while (k > 0) {
-               r = n / k;
-               if (flag || r > 0) {
-                       qbuf[next++] = '0' + r;
-                       flag = 1;
-               }
-               n -= r * k;
-               k = k / 10;
-       }
-  }
-  qbuf[next] = 0;
-  return(qbuf);
-}
diff --git a/lib/nbsd_libminlib/paramvalue.c b/lib/nbsd_libminlib/paramvalue.c
deleted file mode 100644 (file)
index ae76ee9..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*     paramvalue() - decode kernel parameter values   Author: Kees J. Bot
- *                                                             7 May 1994
- * The kernel returns the results of parameter queries
- * by the XXQUERYPARAM svrctl calls as an array of hex digits, like this:
- * "75020000,080C0000".  These are the values of two four-byte variables.
- * Paramvalue() decodes such a string.
- */
-#define nil 0
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <minix/queryparam.h>
-
-size_t paramvalue(char **value, void *address, size_t size)
-/* Decode the string *value storing the result in the object at address with
- * the given size.  *value is left at the next parameter, *address is padded
- * with zeros if needed, and the actual size of the value is returned.
- */
-{
-       unsigned char *addr= address;
-       char *v= *value;
-       int nibble;
-       size_t n;
-
-       n= 0;
-
-       while (*v != 0 && *v != ',') {
-               nibble= *v++ - '0';
-               if (nibble > 0x9) nibble= nibble + '0' - 'A' + 0xA;
-               if (nibble > 0xF) nibble= nibble + 'A' - 'a';
-               if (size > 0) {
-                       if (n % 2 == 0) {
-                               *addr= nibble << 4;
-                       } else {
-                               *addr++|= nibble;
-                               size--;
-                       }
-                       n++;
-               }
-       }
-       while (size > 0) { *addr++= 0; size--; }
-       while (*v != 0 && *v++ != ',') {}
-       *value= v;
-       return n / 2;
-}
-
-
-/*
- * $PchId: paramvalue.c,v 1.3 1996/02/22 09:15:56 philip Exp $
- */
diff --git a/lib/nbsd_libminlib/tools.h b/lib/nbsd_libminlib/tools.h
deleted file mode 100644 (file)
index a69db0e..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-#ifndef _INCLUDE_TOOLS_H
-#define _INCLUDE_TOOLS_H 1
-
-/* Constants describing the disk */
-#define SECTOR_SIZE    512
-#define SECTOR_SHIFT   9
-#define RATIO(b)       ((b)/SECTOR_SIZE)
-#define ISO_SECTOR_SIZE        2048
-#define ISO_PVD_OFFSET 16
-#define HRATIO         (SECTOR_SIZE / HCLICK_SIZE)
-#define PARAMSEC       1       /* sector containing boot parameters */
-#define DSKBASE                0x1E    /* floppy disk parameter vector */
-#define DSKPARSIZE     11      /* there are this many bytes of parameters */
-#define ESC            '\33'   /* escape key */
-#define HEADERSEG      0x0060  /* place for an array of struct exec's */
-#define MINIXSEG       0x0080  /* MINIX loaded here (rounded up to a click) */
-#define BOOTSEG                0x07C0  /* bootstraps are loaded here */
-#define SIGNATURE      0xAA55  /* proper bootstraps have this signature */
-#define SIGNATPOS      510     /* offset within bootblock */
-#define FREESEG                0x0800  /* Memory from FREESEG to cseg is free */
-#define MSEC_PER_TICK  55      /* 18.2 ticks per second */
-
-/* Scan codes for four different keyboards (from kernel/keyboard.c) */
-#define DUTCH_EXT_SCAN   32    /* 'd' */
-#define OLIVETTI_SCAN    12    /* '=' key on olivetti */
-#define STANDARD_SCAN    13    /* '=' key on IBM */
-#define US_EXT_SCAN      22    /* 'u' */
-
-/* Other */
-#define ROOT_INO ((ino_t) 1)   /* Inode nr of root dir. */
-#define IM_NAME_MAX       63
-
-/* Variables */
-#ifndef EXTERN
-#define EXTERN extern
-#endif
-
-typedef struct vector {
-  u16_t offset;
-  u16_t segment;
-} vector;
-
-struct image_header {
-  char name[IM_NAME_MAX + 1];  /* Null terminated. */
-  struct exec process;
-};
-
-EXTERN vector rem_part;                /* boot partition table entry */
-EXTERN u16_t cseg, dseg;       /* code and data segment of the boot program */
-EXTERN u32_t runsize;          /* size of this program */
-EXTERN u16_t device;           /* drive being booted from */
-EXTERN u16_t heads, sectors;   /* the drive's number of heads and sectors */
-extern u16_t eqscancode;       /* Set by peek/getch() if they see a '=' */
-
-/* Sticky attributes */
-#define E_SPECIAL      0x01    /* These are known to the program */
-#define E_DEV          0x02    /* The value is a device name */
-#define E_RESERVED     0x04    /* May not be set by user, e.g. scancode */
-#define E_STICKY       0x07    /* Don't go once set */
-
-/* Volatile attributes */
-#define E_VAR          0x08    /* Variable */
-#define E_FUNCTION     0x10    /* Function definition */
-
-typedef struct environment {
-  struct environment *next;
-  char flags;
-  char *name;                  /* name = value */
-  char *arg;                   /* name(arg) {value} */
-  char *value;
-  char *defval;                        /* Safehouse for default values */
-} environment;
-
-/* External variables */
-EXTERN environment *env;       /* Lists the environment */
-EXTERN int fsok;               /* True if the boot device contains an FS */
-EXTERN u32_t lowsec;           /* Offset to the file system on the boot dev */
-
-#if defined(_MINIX) || defined(__minix) || defined(__ACK__)
-/* Prototypes */
-_PROTOTYPE( off_t r_super, (void));
-_PROTOTYPE( void r_stat, (Ino_t _inum, struct stat *_stp ));
-_PROTOTYPE( ino_t r_readdir, (char *_name ));
-_PROTOTYPE( off_t r_vir2abs, (off_t _virblk ));
-_PROTOTYPE( ino_t r_lookup, (Ino_t _cwd, char *_path ));
-#endif
-
-#ifdef _MONHEAD
-_PROTOTYPE( void readerr, (off_t _sec, int _err ));
-_PROTOTYPE( int numprefix, (char *_s, char **_ps ));
-_PROTOTYPE( int numeric, (char *_s ));
-_PROTOTYPE( dev_t name2dev, (char *_name ));
-_PROTOTYPE( int delay, (char *_msec ));
-_PROTOTYPE( char *unix_err, (int _err ));
-_PROTOTYPE( void init_cache, (void));
-_PROTOTYPE( void invalidate_cache, (void));
-_PROTOTYPE( char *b_value, (char *_name ));
-_PROTOTYPE( void raw_copy, (int _doff, int _dseg, int _soff, int _sseg,
-                                               int _count));
-_PROTOTYPE( void raw_clear, (int _off, int _seg, int _count));
-_PROTOTYPE( void bootstrap, (int _device, int _partoff, int _partseg));
-
-_PROTOTYPE( long a2l, (char *_a ));
-_PROTOTYPE( char *ul2a, (u32_t _n ));
-_PROTOTYPE( char *u2a, (int _n1 ));
-
-/* Functions defined in monhead.s and usable by other files. */
-_PROTOTYPE( void reset_video, (int color));
-_PROTOTYPE( int dev_geometry, (void));
-_PROTOTYPE( u16_t get_ext_memsize, (void));
-_PROTOTYPE( u16_t get_low_memsize, (void));
-_PROTOTYPE( u16_t get_processor, (void));
-_PROTOTYPE( u32_t get_tick, (void));
-_PROTOTYPE( u16_t get_video, (void));
-_PROTOTYPE( u16_t get_word, (int _off, int _seg));
-_PROTOTYPE( int getchar, (void));
-_PROTOTYPE( void minix, (void));
-_PROTOTYPE( void minix86, (int _kcs, int _kds, char *_bpar, int _psize));
-_PROTOTYPE( void minix386, (int _kcs, int _kds, char *_bpar, int _psize));
-_PROTOTYPE( int peekchar, (void));
-_PROTOTYPE( void put_word, (int _off, int _seg, int _word));
-_PROTOTYPE( int putchar, (char _c));
-_PROTOTYPE( int readsectors, (int _off, int _seg, off_t _adr, int _ct));
-_PROTOTYPE( void reboot, (void));
-_PROTOTYPE( void relocate, (void));
-_PROTOTYPE( int writesectors, (int _off, int _seg, off_t _adr, int _ct));
-#endif
-
-#endif
diff --git a/lib/nbsd_libminlib/u64util.c b/lib/nbsd_libminlib/u64util.c
deleted file mode 100644 (file)
index 05b8436..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Few u64 utils implemented in C
- * Author: Gautam BT
- */
-#include <minix/u64.h>
-
-#if !defined(__LONG_LONG_SUPPORTED)
-u64_t rrotate64(u64_t x, unsigned short b)
-{
-       u64_t r, t;
-
-       b %= 64;
-
-       if(b == 32) {
-               r.lo = x.hi;
-               r.hi = x.lo;
-               return r;
-       }else if(b < 32) {
-               r.lo = (x.lo >> b) | (x.hi << (32 - b));                
-               r.hi = (x.hi >> b) | (x.lo << (32 - b));                
-               return r;
-       }else {
-               /* Rotate by 32 bits first then rotate by remaining */
-               t.lo = x.hi;
-               t.hi = x.lo;
-               b = b - 32;
-               r.lo = (t.lo >> b) | (t.hi << (32 - b));                
-               r.hi = (t.hi >> b) | (t.lo << (32 - b));                
-               return r;
-       }
-}
-
-u64_t rshift64(u64_t x, unsigned short b)
-{
-       u64_t r;
-
-       if(b >= 64)
-               return make64(0,0);
-
-       if(b >= 32) {
-               r.hi = 0;
-               r.lo = x.hi >> (b - 32);
-       }else {
-               r.lo = (x.lo >> b) | (x.hi << (32 - b));                
-               r.hi = (x.hi >> b);             
-       }
-       return r;
-}
-
-u64_t xor64(u64_t a, u64_t b)
-{
-       u64_t r;
-       r.hi = a.hi ^ b.hi;
-       r.lo = a.lo ^ b.lo;
-
-       return r;
-}
-
-u64_t and64(u64_t a, u64_t b)
-{
-       u64_t r;
-       r.hi = a.hi & b.hi;
-       r.lo = a.lo & b.lo;
-
-       return r;
-}
-
-u64_t not64(u64_t a)
-{
-       u64_t r;
-
-       r.hi = ~a.hi;
-       r.lo = ~a.lo;
-
-       return r;
-}
-#else
-
-#if !defined(__LONG_LONG_SUPPORTED)
-#error "ERROR: These functions require long long support"
-#endif
-
-u64_t rrotate64(u64_t x, unsigned short b)
-{
-       b %= 64;
-       if ((b &= 63) == 0)
-               return x;
-       return (x >> b) | (x << (64 - b));
-}
-
-u64_t rshift64(u64_t x, unsigned short b)
-{
-       if (b >= 64)
-               return 0;
-       return x >> b;
-}
-
-u64_t xor64(u64_t a, u64_t b)
-{
-       return a ^ b;
-}
-
-u64_t and64(u64_t a, u64_t b)
-{
-       return a & b;
-}
-
-u64_t not64(u64_t a)
-{
-       return ~a;
-}
-#endif
-
index f4f52cdcf623acb05cb0e6255240d14068b41421..8b4d19daf0ed691f884a0ea0de269a3ab2082d3d 100644 (file)
@@ -1,5 +1,3 @@
-.include <minix.newlibc.mk>
-
 CPPFLAGS+= -D_NETBSD_SOURCE -D__NBSD_LIBC=1
 
 BINDIR?=        /usr/libexec
index 8cc48047f553a723c2242e135c02eadf1d0cad65..32ca190ac8924c0b8d846223fc77d5a73ecb3413 100644 (file)
@@ -1,6 +1,6 @@
 MAN=   acd.1 anm.1 ar.1 ash.1 asize.1 at.1 banner.1 basename.1 \
        bsfilt.1 cal.1 \
-       calendar.1 cat.1 cawf.1 cc.1  chgrp.1 \
+       calendar.1 cat.1 cawf.1 chgrp.1 \
        chmem.1 chmod.1 cksum.1 clear.1 cmp.1 comm.1 compress.1 \
        cp.1 crc.1 crontab.1 ctags.1 dd.1 dev2name.1 \
        df.1 dhrystone.1 dosdir.1 dosread.1 doswrite.1 du.1 \
diff --git a/man/man1/cc.1 b/man/man1/cc.1
deleted file mode 100644 (file)
index e1ff133..0000000
+++ /dev/null
@@ -1,588 +0,0 @@
-.TH CC 1
-.SH NAME
-cc \- MINIX 3 C compiler
-.SH SYNOPSIS
-.in +.5i
-.ti -.5i
-.BR cc |\c
-.BR pc |\c
-.BR m2
-.RB [ "\-D \fIname\fR[\fB=\fIvalue" ]]
-\&...
-.RB [ "\-U \fIname" ]
-\&...
-.RB [ "\-I \fIdirectory" ]
-\&...
-.RB [ \-.\fIsuffix ]
-\&...
-.RB [ \-c ]
-.RB [ \-E ]
-.RB [ \-P ]
-.RB [ \-S ]
-.RB [ \-c.\fIsuffix ]
-.RB [ \-O ]
-.RB [ \-O\fIlevel ]
-.RB [ \-OS ]
-.RB [ \-OT ]
-.RB [ \-g ]
-.RB [ \-n ]
-.RB [ \-a ]
-.RB [ \-R ]
-.RB [ \-A ]
-.RB [ \-s ]
-.RB [ \-fsoft ]
-.RB [ \-fnone ]
-.RB [ \-w ]
-.RB [ \-wo ]
-.RB [ \-ws ]
-.RB [ \-wa ]
-.RB [ \-3 ]
-.RB [ \-_ ]
-.RB [ \-W\fIname\fB\-\fIoption ]
-\&...
-.RB [ \-m\fIarch ]
-.RB [ "\-o \fIoutfile" ]
-.RB [ "\-L \fIdirectory" ]
-\&...
-.RB [ \-i ]
-.RB [ \-sep ]
-.RB [ \-com ]
-.RB [ \-r ]
-.RB [ "\-stack \fIsize" ]
-.I operand
-\&...
-.sp .4v
-.ti -.5i
-(Minix-86 subset:)
-.ti -.5i
-.BR cc |\c
-.BR pc |\c
-.BR m2
-.RB [ "\-D\fIname\fR[\fB=\fIvalue" ]]
-\&...
-.RB [ "\-U\fIname" ]
-\&...
-.RB [ "\-I\fIdirectory" ]
-\&...
-.RB [ \-.o ]
-\&...
-.RB [ \-c ]
-.RB [ \-E ]
-.RB [ \-P ]
-.RB [ \-S ]
-.RB [ \-c.\fIsuffix ]
-.RB [ \-O ]
-.RB [ \-O\fIlevel ]
-.RB [ \-n ]
-.RB [ \-a ]
-.RB [ \-R ]
-.RB [ \-A ]
-.RB [ \-s ]
-.RB [ \-f ]
-.RB [ \-w ]
-.RB [ \-wo ]
-.RB [ \-ws ]
-.RB [ \-wa ]
-.RB [ \-3 ]
-.RB [ \-_ ]
-\&...
-.RB [ \-m ]
-.RB [ "\-o \fIoutfile" ]
-.RB [ "\-L\fIdirectory" ]
-\&...
-.RB [ \-i ]
-.RB [ \-sep ]
-.RB [ \-com ]
-.I operand
-\&...
-.in -.5i
-.SH DESCRIPTION
-.BR Cc ,
-.BR pc ,
-and
-.BR m2
-are the call names of the MINIX 3 C, Pascal, and Modula-2 compilers from
-the Amsterdam Compiler Kit (ACK).
-.PP
-All these call names are links to the
-.B acd
-driver program.
-.B Acd
-uses the driver description file
-.B /usr/lib/descr
-that describes the steps necessary to compile a source file.  The
-.BR acd (1)
-manual page describes a few more flags, like
-.BR \-v ,
-that may be useful for debugging compiler problems.
-.PP
-Minix-86 uses a C program as the compiler driver.  This driver is not as
-flexible as the one implemented with the
-.B acd
-driver, and offers a smaller number of options.  The second line of
-the synopsis above shows the options that the Minix-86 driver supports.  The
-rest of this manual page is geared towards the
-.B acd
-driver.  People writing software for Minix-86, or that should be
-portable to all MINIX 3 versions should stick to the options listed under
-the Minix-86 compiler.
-.SH OPTIONS
-The transformations done by the compiler are modified by the following
-options.  They are a superset of the options required by \s-2POSIX\s+2,
-with the MINIX 3 or compiler specific ones are marked as such.  Options
-for one specific compiler are ignored for others.  Read the OPTIONS section
-of
-.BR acd (1)
-for the driver specific options.
-.PP
-.TP
-.BI \-D " name\fR[\fB=\fIvalue\fR]"
-Same as if
-.BI #define " name value"
-had been given.
-.B 1
-is assumed if
-.I value
-is omitted.  This argument, like all the other double arguments, may also
-be given as a single argument.  (I.e. either as
-.BI \-D "\0name"
-or
-.BI \-D name\fR.)
-(The Minix-86 driver is not so flexible, the proper form can be seen in
-the synopsis.)
-.TP
-.BI \-U " \fIname"
-Undefine the pre-defined symbol
-.IR name .
-.TP
-.BI \-I " directory"
-Extend the include directory path with the given directory.  These
-directories are searched for include files in the given order before the
-standard places.  The standard place for the C compiler is
-.BR /usr/include ,
-and for the Modula-2 compiler it is
-.BR /usr/lib/m2 .
-.TP
-.BI \-. suffix
-Act as if a source file with the given suffix is present on the command line.
-For each language found on the command line the appropriate libraries are
-selected.  The first language mentioned selects the runtime startoff.
-The call name of the driver also chooses the language, so \fBcc\fP is an
-implicit
-.BR \-.c .
-The runtime startoff can be omitted by specifying
-.B \-.o
-for those rare cases where you want to supply your own startoff.  (MINIX 3)
-.TP
-.B \-c
-Transform the input files to object files and stop.  The
-.B \-o
-option may be used under MINIX 3 to set the name of the object file.
-.BR Make (1)
-likes this, because
-.BI "cc \-c" " dir/file" .c
-puts
-.IB file .o
-in the current directory, but
-.BI "cc \-c" " dir/file" .c
-.BI \-o " dir/file" .o
-puts the
-.B .o
-file where
-.B make
-expects it to be by its builtin
-.B .c.o
-rule.
-(Minix-86 can only use
-.B \-o
-to name an executable.)
-.TP
-.B \-E
-Run the preprocessor over the input files and send the result to standard
-output or the file named by
-.BR \-o .
-Standard input is read if an input file is named "\fB\-\fR".
-.TP
-.B \-P
-Run the preprocessor over the input files and put the result to files
-with the suffix
-.BR .i .
-File and line number information is omitted from the output.  Use
-.B \-P \-E
-under MINIX 3 to omit this info for
-.B \-E
-too.
-.TP
-.B \-S
-Transform the input files to assembly files with suffix
-.BR .s .
-.TP
-.BI \-c. suffix
-Transform the input files to files with the given suffix.  This can only
-succeed if there is a valid transformation from the input file to the
-given suffix.  The same goes for
-.B \-c
-and other options that are just special cases of this option, except for
-.BR \-P ,
-.B \-c.i
-keeps the line number info.  The option
-.B \-c.a
-makes the driver transform the input files to object files and add them to a
-library.  (So you do not need to know how the archiver works.)  Note that you
-need to give object files as arguments if you want to replace old object
-files.  Transformed files are added under a (unique) temporary name.  With
-.B \-o
-you can name the library.  (MINIX 3)  (Minix-86 can't do
-.BR \-c.a .)
-.TP
-.B \-O
-Optimize code.  This option is a no-op, because all the compilers already
-use the
-.BR \-O1
-optimization level to get code of reasonable quality.  Use
-.BR \-O0
-to turn off optimization to speed up compilation at debug time.
-.TP
-.BI \-O level
-Compile with the given optimization level.  (MINIX 3)
-.PP
-.B \-OS
-.br
-.B \-OT
-.RS
-Optimize for space or for time.  (MINIX 3)
-.RE
-.TP
-.B \-g
-Compile the C source with debugging information.  (The way
-.BR \-g ,
-.B \-s
-and
-.B \-O
-interact is left unspecified.)
-.TP
-.B \-n
-Omit the file and line number tracking that is used for runtime error reports
-from Pascal or Modula-2 programs.  The
-.B \-n
-flag is normally used to compile library modules, but may also be useful to
-make a program smaller and faster once debugged.  (Pascal & Modula-2)
-.TP
-.B \-a
-Enable assertions, i.e. statements of the form \fBassert\fI\ test\fR
-that cause a descriptive runtime error if the boolean expression
-.I test
-evaluates false.  (Pascal & Modula-2)
-.TP
-.B \-R
-Disable runtime checks like overflow checking.  (Pascal & Modula-2)
-.TP
-.B \-A
-Enable array bound checks.  (Pascal & Modula-2)
-.TP
-.B \-s
-Strip the resulting executable of its symbol table.
-.PP
-.B \-fsoft
-.br
-.B \-f
-.RS
-Use software floating point instead of hardware floating point.  This is
-a loader flag, but in general it is best to specify this flag in all
-phases of the compilation.  (MINIX 3)
-.RE
-.TP
-.B \-fnone
-Ignored.  Used under Minix-vmd to omit floating point printing/scanning
-code.  The standard MINIX 3 compiler figures this out automatically using
-a special loader trick.  (MINIX 3)
-.TP
-.B \-w
-Do not produce warnings about dubious C language constructs.  Normally
-the compiler is configured to do the maximum amount of checking
-without being too annoying.  (MINIX 3)
-.TP
-.B \-wo
-Omit warnings about old (K&R) style.  (MINIX 3)
-.TP
-.B \-ws
-Omit strict warnings.  (MINIX 3)
-.TP
-.B \-wa
-Omit all warnings.  (MINIX 3)
-.TP
-.B \-3
-Only accept 3rd edition Modula-2.  (Modula-2)
-.TP
-.B \-_
-Allow underscores in Pascal or Modula-2 identifiers, but not at the beginning
-of an identifier.  (Pascal & Modula-2)
-.TP
-.BI \-W name \- option
-If
-.I name
-is the name of the compiler this driver is working for, then
-.I option
-is activated for that compiler.  See below for a per-compiler list.  Any other
-.B \-W
-option is ignored.  (\fB\-W\fP is described by \s-2POSIX\s+2 as an optional
-flag to send options to the different compiler passes with a totally
-different (and nicely ignored) syntax as described here.)  (Minix-86 ignores
-any
-.B \-W
-flag.)
-.TP
-.B \-m
-Under Minix-86 this option transforms the function declarations (prototypes)
-to the old K&R form, i.e. the arguments declarations are removed.  This saves
-a lot of memory in the compiler and may allow a large program to be compiled.
-One must make sure that function arguments are properly type-cast where
-necessary.  (MINIX 3)
-.TP
-.BI \-m arch
-Set the target architecture for a cross compiler.  Normally the compiler
-produces code for the same architecture it itself is compiled for.  The
-.B ARCH
-environment variable may also be used to set the architecture.  Architectures
-names are:
-.B i86
-(Intel 8086 and 286),
-.B i386
-(Intel 386, 486, ...),
-.B m68000
-(Motorola MC68000 & MC68010, 16-bit ints),
-.B m68010
-(Motorola MC68000 & MC68010, 32-bit ints),
-.B m68020
-(Motorola MC68020, 32-bit ints),
-.B sparc
-(Sun SPARC).  (MINIX 3)  (Ignored under Minix-86.)
-.TP
-.BI \-o " outfile"
-Set the output file for the
-.BR \-c ,
-.BR \-c.a ,
-and
-.BR \-E
-options, or choose the executable name instead of the default
-.BR a.out .
-(Minix-86 can only choose the executable name.)
-.TP
-.BI \-L " directory"
-Extend the library search path with
-.IR directory .
-These directories are searched for libraries named by
-.B \-l
-in the given order before the standard places.  The standard places are
-.B /lib/\c
-.IR arch ,
-and
-.B /usr/lib/\c
-.IR arch .
-The search for libaries in directories added with
-.B \-L
-looks in
-.IB directory /\c
-.IR arch
-and
-.I directory
-itself.
-.RI ( Arch
-is the machine architecture name.  This is
-MINIX 3 dependent, compilers on other systems usually only look in
-.IR directory .)
-(Minix-86 only has
-.B /lib
-and
-.B /usr/lib
-as the standard places.)
-.PP
-.B \-sep
-.br
-.B \-com
-.RS
-Create a Separate I&D or a common I&D executable.  The text segment of a
-separate I&D executable is read-only and shareable.  For an
-.B i86
-binary this also means that the text and data segment can each be 64
-kilobytes large instead of just 64 kilobytes together.  Separate I&D is the
-default.  Common I&D is probably only useful for the bootstraps.  The
-.B \-i
-option has the same meaning as
-.BR \-sep ,
-but should no longer be used.
-(MINIX 3)
-.RE
-.TP
-.B \-r
-Makes the loader produce a relocatable object file, i.e. a file that
-may be loaded again.  The runtime startoff and the default libraries are
-omitted, only the files mentioned are combined.  (MINIX 3)
-.TP
-.BI \-stack " size"
-Allow the process
-.I size
-bytes of heap and stack.
-.I Size
-is a C-style decimal, octal, or hexadecimal number, optionally followed by
-the multipliers
-.BR m ,
-.BR k ,
-.BR w ,
-and
-.B b
-for mega (1024*1024), kilo (1024), "word" (2 or 4), and byte (1).  Uppercase
-letters are accepted too.  A size of
-.B 32kw
-is used by default, translating to 64k for
-.BR i86 ,
-and 132k for other architectures.  Too large a size is rounded down to keep
-the data segment within 64 kilobytes for the
-.BR i86 .
-(MINIX 3)
-.SH OPERANDS
-All leftover operands are treated as files to be compiled, with one
-exception.  The construct
-.BI \-l " library"
-is used to denote a library, usually
-.BI lib library .a\fR,
-that is to be searched in the directories mentioned with
-.B \-L
-or the standard places.  These libraries keep their place among the
-(transformed) input files when presented to the loader.  (It is a common
-mistake to write
-.BR "cc\ \-lcurses\ x.c"
-instead of
-.BR "cc\ x.c\ \-lcurses" .)
-.SH IMPLEMENTATION
-The MINIX 3 compiler implementation uses the ACK compilers adapted for use
-under MINIX 3 as described below.  Read
-.BR ACK (7)
-for more detailed information on the ACK compilers themselves.
-.SS "Feature test macros"
-The preprocessors are given these arguments to define feature test macros:
-.B \-D__ACK__
-tells what compiler is used.
-.B \-D__minix
-tells that this is MINIX 3.
-.BI \-D__ arch
-tells the architecture.
-(More macros are defined, but they are only to be used in the include files.)
-.PP
-The symbols above are predefined by the preprocessor so that your program is
-able to "sense" the environment it is in.  It is also possible for your
-program to do the opposite, to tell what kind of environment it likes to
-have.  By default,
-.B cc
-compiles a standard C program.  If you want the extensions described in
-POSIX.1 to become visible, then you have to set
-.BR _POSIX_SOURCE " to " 1
-at the start of your program.
-To enable \s-2UNIX\s+2 or MINIX 3 extensions you need to also set
-.BR _MINIX " to " 1 .
-If you don't want to clutter your source files with these symbols then you
-can use
-.B cc \-D_MINIX \-D_POSIX_SOURCE
-to get the POSIX.1 and the MINIX 3 extensions.
-.SS "Preprocessing"
-Pascal, Modula-2, EM source (see below), and Assembly source are
-preprocessed by the C preprocessor if the very first character in the file
-is a '\fB#\fP' character.
-.SS "Assembly dialects"
-No two compilers use the same assembly language.  To be able to use the same
-assembly dialect for the low level support routines an assembly converter is
-provided.  The input of this converter can be of type
-.BR ack ,
-.BR ncc ,
-or
-.BR bas ,
-and the output can be of type
-.BR ack ,
-.BR ncc ,
-or
-.BR gnu .
-The suffix of the file tells the assembly dialect (see below), or one can
-use the option
-.BI \-Was\- dialect
-to tell the driver what the dialect of a plain
-.B .s
-file is.  The assembly converter is not as smart as the assembler, the
-translation is more or less a text substitution.  It leaves a lot of
-checking to the target assembler.  You have to restrict yourself to a subset
-that is understood by both assemblers.  The ACK assembler for instance
-doesn't care if you use `ax' or `eax' for a 32 bit register, it looks at the
-instruction type.  The GNU assembler doesn't like this, so you have to use
-the proper register name in ACK assembly that is to be translated to GNU
-assembly.  Expressions are converted as is, even if the operator precedence
-rules of the two assembly languages differ.  So use parentheses.  The
-converter does promise one thing: compiler output can be properly
-translated.  (Note that under Minix-86
-.B \-W
-is ignored.  All assembly should therefore be in the "ncc" dialect.)
-.SH FILES
-.TP 10
-.B /usr/lib/descr
-The compiler description file.
-.TP
-.B .c
-Suffix of a C source file.
-.TP
-.B .mod
-Modula-2.
-.TP
-.B .p
-Pascal.
-.TP
-.B .i
-Preprocessed C source.
-.TP
-.B .k
-ACK machine independent compact EM code produced by the C, Pascal, or
-Modula-2 front end (or any other ACK front end.)  The ACK compilers are
-based on the UNCOL idea where several front ends compile to a common
-intermediate language, and several back ends transform the intermediate
-language to the target machine language.  The ACK intermediate language
-is named "EM".
-.TP
-.B .m
-Peephole optimized EM.
-.TP
-.B .gk
-Result of the (optional) EM global optimizer.
-.TP
-.B .g
-Result of the second EM peephole optimizer used after the global optimizer.
-.TP
-.B .e
-Human readable EM.  (Human created or decoded compact EM.)
-.TP
-.B .s
-Target machine assembly.  (Current compiler dialect.)
-.TP
-.B .ack.s
-ACK assembly.
-.TP
-.B .ncc.s
-ACK Xenix style assembly.  This dialect is used by the 16 bit ACK ANSI C
-compiler.
-.TP
-.B .gnu.s
-GNU assembly.
-.TP
-.B .bas.s
-BCC assembly.  (Used by the Bruce Evans' BCC compiler, for many years the
-compiler for Minix-386.)
-.TP
-.B .o
-Object code.
-.TP
-.B .a
-Object code library.
-.TP
-.B a.out
-Default output executable.
-.SH "SEE ALSO"
-.BR acd (1),
-.BR ACK (7).
-.SH AUTHOR
-Kees J. Bot (kjb@cs.vu.nl)
index 199879adb6d543d8f3487acfb2ed59a87b889a12..e0118973b44a12f5ec11f1da134481a10a5e9728 100644 (file)
@@ -1,4 +1,4 @@
-MAN=   as.1x awk.1x dis88.1x elle.1x elvis.1x kermit.1x \
+MAN=   awk.1x dis88.1x elle.1x elvis.1x kermit.1x \
        macros.1x mined.1x
 
 .include <bsd.man.mk>
diff --git a/man/man1x/as.1x b/man/man1x/as.1x
deleted file mode 100644 (file)
index 0445c1b..0000000
+++ /dev/null
@@ -1,412 +0,0 @@
-.so mnx.mac
-.TH AS 1x
-.\" unchecked (kjb)
-.CD "as \(en assembler"
-.SE "AS\(emASSEMBLER [IBM]"
-.SP 1
-.PP
-This document describes the language accepted by the 80386 assembler
-that is part of the Amsterdam Compiler Kit.  Note that only the syntax is
-described, only a few 386 instructions are shown as examples.
-.SS "Tokens, Numbers, Character Constants, and Strings"
-.PP
-The syntax of numbers is the same as in C.
-The constants 32, 040, and 0x20 all represent the same number, but are
-written in decimal, octal, and hex, respectively.
-The rules for character constants and strings are also the same as in C.
-For example, \(fma\(fm is a character constant.
-A typical string is "string".
-Expressions may be formed with C operators, but must use [ and ] for
-parentheses.  (Normal parentheses are claimed by the operand syntax.)
-.SS "Symbols"
-.PP
-Symbols contain letters and digits, as well as three special characters:
-dot, tilde, and underscore.
-The first character may not be a digit or tilde.
-.PP
-The names of the 80386 registers are reserved.  These are:
-.HS
-~~~al, bl, cl, dl
-.br
-~~~ah, bh, ch, dh
-.br
-~~~ax, bx, cx, dx, eax, ebx, ecx, edx
-.br
-~~~si, di, bp, sp, esi, edi, ebp, esp
-.br
-~~~cs, ds, ss, es, fs, gs
-.HS
-The xx and exx variants of the eight general registers are treated as
-synonyms by the assembler.  Normally "ax" is the 16-bit low half of the
-32-bit "eax" register.  The assembler determines if a 16 or 32 bit
-operation is meant solely by looking at the instruction or the
-instruction prefixes.  It is however best to use the proper registers
-when writing assembly to not confuse those who read the code.
-.HS
-The last group of 6 segment registers are used for selector + offset mode
-addressing, in which the effective address is at a given offset in one of
-the 6 segments.
-.PP
-Names of instructions and pseudo-ops are not reserved.  
-Alphabetic characters in opcodes and pseudo-ops must be in lower case.
-.SS "Separators"
-.PP
-Commas, blanks, and tabs are separators and can be interspersed freely 
-between tokens, but not within tokens.
-Commas are only legal between operands.
-.SS "Comments"
-.PP
-The comment character is \*(OQ!\*(CQ.  
-The rest of the line is ignored.
-.SS "Opcodes"
-.PP
-The opcodes are listed below.
-Notes: (1) Different names for the same instruction are separated by \*(OQ/\*(CQ.
-(2) Square brackets ([]) indicate that 0 or 1 of the enclosed characters 
-can be included.
-(3) Curly brackets ({}) work similarly, except that one of the
-enclosed characters \fImust\fR be included.
-Thus square brackets indicate an option, whereas curly brackets indicate
-that a choice must be made.
-.sp
-.if t .ta 0.25i 1.2i 3i
-.if n .ta 2 10 24
-.nf
-.B "Data Transfer"
-.HS
-       mov[b]  dest, source    ! Move word/byte from source to dest
-       pop     dest    ! Pop stack 
-       push    source  ! Push stack 
-       xchg[b] op1, op2        ! Exchange word/byte 
-       xlat            ! Translate 
-       o16             ! Operate on a 16 bit object instead of 32 bit
-
-.B "Input/Output"
-.HS
-       in[b]   source  ! Input from source I/O port
-       in[b]           ! Input from DX I/O port
-       out[b]  dest    ! Output to dest I/O port
-       out[b]          ! Output to DX I/O port
-
-.B "Address Object"
-.HS
-       lds     reg,source      ! Load reg and DS from source
-       les     reg,source      ! Load reg and ES from source
-       lea     reg,source      ! Load effect address of source to reg and DS
-       {cdsefg}seg             ! Specify seg register for next instruction
-       a16             ! Use 16 bit addressing mode instead of 32 bit
-
-.B "Flag Transfer"
-.HS
-       lahf            ! Load AH from flag register
-       popf            ! Pop flags 
-       pushf           ! Push flags 
-       sahf            ! Store AH in flag register
-
-.B "Addition"
-.HS
-       aaa             ! Adjust result of BCD addition
-       add[b]  dest,source     ! Add 
-       adc[b]  dest,source     ! Add with carry 
-       daa             ! Decimal Adjust after addition
-       inc[b]  dest    ! Increment by 1
-
-.B "Subtraction"
-.HS
-       aas             ! Adjust result of BCD subtraction
-       sub[b]  dest,source     ! Subtract 
-       sbb[b]  dest,source     ! Subtract with borrow from dest
-       das             ! Decimal adjust after subtraction
-       dec[b]  dest    ! Decrement by one
-       neg[b]  dest    ! Negate 
-       cmp[b]  dest,source     ! Compare
-
-.B "Multiplication"
-.HS
-       aam             ! Adjust result of BCD multiply
-       imul[b] source  ! Signed multiply
-       mul[b]  source  ! Unsigned multiply
-
-.B "Division"
-.HS
-       aad             ! Adjust AX for BCD division
-       o16 cbw         ! Sign extend AL into AH
-       o16 cwd         ! Sign extend AX into DX
-       cwde            ! Sign extend AX into EAX
-       cdq             ! Sign extend EAX into EDX
-       idiv[b] source  ! Signed divide
-       div[b]  source  ! Unsigned divide
-
-.B "Logical"
-.HS
-       and[b]  dest,source     ! Logical and
-       not[b]  dest    ! Logical not
-       or[b]   dest,source     ! Logical inclusive or
-       test[b] dest,source     ! Logical test
-       xor[b]  dest,source     ! Logical exclusive or
-
-.B "Shift"
-.HS
-       sal[b]/shl[b]   dest,CL ! Shift logical left
-       sar[b]  dest,CL ! Shift arithmetic right
-       shr[b]  dest,CL ! Shift logical right
-
-.B "Rotate"
-.HS
-       rcl[b]  dest,CL ! Rotate left, with carry
-       rcr[b]  dest,CL ! Rotate right, with carry
-       rol[b]  dest,CL ! Rotate left
-       ror[b]  dest,CL ! Rotate right
-
-.B "String Manipulation"
-.HS
-       cmps[b]         ! Compare string element ds:esi with es:edi
-       lods[b]         ! Load from ds:esi into AL, AX, or EAX
-       movs[b]         ! Move from ds:esi to es:edi
-       rep             ! Repeat next instruction until ECX=0
-       repe/repz               ! Repeat next instruction until ECX=0 and ZF=1
-       repne/repnz             ! Repeat next instruction until ECX!=0 and ZF=0
-       scas[b]         ! Compare ds:esi with AL/AX/EAX
-       stos[b]         ! Store AL/AX/EAX in es:edi
-
-.fi
-.B "Control Transfer"
-.PP
-\fIAs\fR accepts a number of special jump opcodes that can assemble to
-instructions with either a byte displacement, which can only reach to targets
-within \(mi126 to +129 bytes of the branch, or an instruction with a 32-bit
-displacement.  The assembler automatically chooses a byte or word displacement
-instruction.
-.PP
-The English translation of the opcodes should be obvious, with
-\*(OQl(ess)\*(CQ and \*(OQg(reater)\*(CQ for signed comparisions, and
-\*(OQb(elow)\*(CQ and \*(OQa(bove)*(CQ for unsigned comparisions.  There are
-lots of synonyms to allow you to write "jump if not that" instead of "jump
-if this".
-.PP
-The \*(OQcall\*(CQ, \*(OQjmp\*(CQ, and \*(OQret\*(CQ instructions can be 
-either intrasegment or
-intersegment.  The intersegment versions are indicated with 
-the suffix \*(OQf\*(CQ.
-
-.if t .ta 0.25i 1.2i 3i
-.if n .ta 2 10 24
-.nf
-.B Unconditional
-.HS
-       jmp[f]  dest    ! jump to dest (8 or 32-bit displacement)
-       call[f] dest    ! call procedure
-       ret[f]          ! return from procedure
-
-.B "Conditional"
-.HS
-       ja/jnbe         ! if above/not below or equal (unsigned)
-       jae/jnb/jnc             ! if above or equal/not below/not carry (uns.)
-       jb/jnae/jc              ! if not above nor equal/below/carry (unsigned)
-       jbe/jna         ! if below or equal/not above (unsigned)
-       jg/jnle         ! if greater/not less nor equal (signed)
-       jge/jnl         ! if greater or equal/not less (signed)
-       jl/jnqe         ! if less/not greater nor equal (signed)
-       jle/jgl         ! if less or equal/not greater (signed)
-       je/jz           ! if equal/zero
-       jne/jnz         ! if not equal/not zero
-       jno             ! if overflow not set
-       jo              ! if overflow set
-       jnp/jpo         ! if parity not set/parity odd
-       jp/jpe          ! if parity set/parity even
-       jns             ! if sign not set
-       js              ! if sign set
-
-.B "Iteration Control"
-.HS
-       jcxz    dest    ! jump if ECX = 0
-       loop    dest    ! Decrement ECX and jump if CX != 0
-       loope/loopz     dest    ! Decrement ECX and jump if ECX = 0 and ZF = 1
-       loopne/loopnz   dest    ! Decrement ECX and jump if ECX != 0 and ZF = 0
-
-.B "Interrupt"
-.HS
-       int     n       ! Software interrupt n
-       into            ! Interrupt if overflow set
-       iretd           ! Return from interrupt
-
-.B "Flag Operations"
-.HS
-       clc             ! Clear carry flag
-       cld             ! Clear direction flag
-       cli             ! Clear interrupt enable flag
-       cmc             ! Complement carry flag
-       stc             ! Set carry flag
-       std             ! Set direction flag
-       sti             ! Set interrupt enable flag
-
-.fi
-.SS "Location Counter"
-.PP
-The special symbol \*(OQ.\*(CQ is the location counter and its value 
-is the address of the first byte of the instruction in which the symbol 
-appears and can be used in expressions.
-.SS "Segments"
-.PP
-There are four different assembly segments: text, rom, data and bss.
-Segments are declared and selected by the \fI.sect\fR pseudo-op.  It is
-customary to declare all segments at the top of an assembly file like
-this:
-.HS
-~~~.sect .text; .sect .rom; .sect .data; .sect .bss
-.HS
-The assembler accepts up to 16 different segments, but
-.MX
-expects only four to be used.  Anything can in principle be assembled
-into any segment, but the
-.MX
-bss segment may only contain uninitialized data.
-Note that the \*(OQ.\*(CQ symbol refers to the location in the current
-segment.
-.SS "Labels"
-.PP
-There are two types: name and numeric.  Name labels consist of a name
-followed by a colon (:).
-.PP
-The numeric labels are single digits.  The nearest 0: label may be
-referenced as 0f in the forward direction, or 0b backwards.
-.SS "Statement Syntax"
-.PP
-Each line consists of a single statement.
-Blank or comment lines are allowed.
-.SS "Instruction Statements"
-.PP
-The most general form of an instruction is
-.HS
-~~~label: opcode operand1, operand2    ! comment
-.HS
-.SS "Expression Semantics"
-.PP
-.tr ~~
-The following operators can be used:
-+ \(mi * / & | ^ ~ << (shift left) >> (shift right) \(mi (unary minus).
-.tr ~
-32-bit integer arithmetic is used.  
-Division produces a truncated quotient.
-.SS "Addressing Modes"
-.PP
-Below is a list of the addressing modes supported.
-Each one is followed by an example.
-.HS
-.ta 0.25i 3i
-.nf
-       constant        mov eax, 123456
-       direct access   mov eax, (counter)
-       register        mov eax, esi
-       indirect        mov eax, (esi)
-       base + disp.    mov eax, 6(ebp)
-       scaled index    mov eax, (4*esi)
-       base + index    mov eax, (ebp)(2*esi)
-       base + index + disp.    mov eax, 10(edi)(1*esi)
-.HS
-.fi
-Any of the constants or symbols may be replacement by expressions.  Direct
-access, constants and displacements may be any type of expression.  A scaled
-index with scale 1 may be written without the \*(OQ1*\*(CQ.
-.SS "Call and Jmp"
-.PP
-The \*(OQcall\*(CQ and \*(OQjmp\*(CQ instructions can be interpreted
-as a load into the instruction pointer.
-.HS
-.ta 0.25i 3i
-.nf
-       call _routine   ! Direct, intrasegment
-       call (subloc)   ! Indirect, intrasegment
-       call 6(ebp)     ! Indirect, intrasegment
-       call ebx        ! Direct, intrasegment
-       call (ebx)      ! Indirect, intrasegment
-       callf (subloc)  ! Indirect, intersegment
-       callf seg:offs  ! Direct, intersegment
-.HS
-.fi
-.SP 1
-.SS "Symbol Assigment"
-.SP 1
-.PP
-Symbols can acquire values in one of two ways.
-Using a symbol as a label sets it to \*(OQ.\*(CQ for the current
-segment with type relocatable.  
-Alternative, a symbol may be given a name via an assignment of the form
-.HS
-~~~symbol = expression 
-.HS
-in which the symbol is assigned the value and type of its arguments.
-.SP 1
-.SS "Storage Allocation"
-.SP 1
-.PP
-Space can be reserved for bytes, words, and longs using pseudo-ops.
-They take one or more operands, and for each generate a value
-whose size is a byte, word (2 bytes) or long (4 bytes).  For example:
-.HS
-.if t .ta 0.25i 3i
-.if n .ta 2 24
-       .data1 2, 6     ! allocate 2 bytes initialized to 2 and 6
-.br
-       .data2 3, 0x10  ! allocate 2 words initialized to 3 and 16
-.br
-       .data4 010      ! allocate a longword initialized to 8
-.br
-       .space 40       ! allocates 40 bytes of zeros
-.HS
-allocates 50 (decimal) bytes of storage, initializing the first two
-bytes to 2 and 6, the next two words to 3 and 16, then one longword with
-value 8 (010 octal), last 40 bytes of zeros.
-.SS "String Allocation"
-.PP
-The pseudo-ops \fI.ascii\fR and \fI.asciz\fR
-take one string argument and generate the ASCII character
-codes for the letters in the string. 
-The latter automatically terminates the string with a null (0) byte.
-For example,
-.HS
-~~~.ascii "hello"
-.br
-~~~.asciz "world\en"
-.HS
-.SS "Alignment"
-.PP
-Sometimes it is necessary to force the next item to begin at a word, longword
-or even a 16 byte address boundary.
-The \fI.align\fR pseudo-op zero or more null byte if the current location
-is a multiple of the argument of .align.
-.SS "Segment Control"
-.PP
-Every item assembled goes in one of the four segments: text, rom, data,
-or bss.  By using the \fI.sect\fR pseudo-op with argument
-\fI.text, .rom, .data\fR or \fI.bss\fR, the programmer can force the
-next items to go in a particular segment.
-.SS "External Names"
-.PP
-A symbol can be given global scope by including it in a \fI.define\fR pseudo-op.
-Multiple names may be listed, separate by commas.
-It must be used to export symbols defined in the current program.
-Names not defined in the current program are treated as "undefined
-external" automatically, although it is customary to make this explicit
-with the \fI.extern\fR pseudo-op.
-.SS "Common"
-.PP
-The \fI.comm\fR pseudo-op declares storage that can be common to more than 
-one module.  There are two arguments: a name and an absolute expression giving
-the size in bytes of the area named by the symbol.  
-The type of the symbol becomes
-external.  The statement can appear in any segment.
-If you think this has something to do with FORTRAN, you are right.
-.SS "Examples"
-.PP
-In the kernel directory, there are several assembly code files that are
-worth inspecting as examples.
-However, note that these files, are designed to first be
-run through the C preprocessor.  (The very first character is a # to signal
-this.)  Thus they contain numerous constructs
-that are not pure assembler.
-For true assembler examples, compile any C program provided with 
-.MX
-using the \fB\(enS\fR flag.
-This will result in an assembly language file with a suffix with the same
-name as the C source file, but ending with the .s suffix.
diff --git a/man/man7/ACK.7 b/man/man7/ACK.7
deleted file mode 100644 (file)
index 6c35227..0000000
+++ /dev/null
@@ -1,2090 +0,0 @@
-.TH ACK 7
-.SH NAME
-ACK \- Additional information on the Amsterdam Compiler Kit compilers
-.SH DESCRIPTION
-.de SP
-.if t .sp 0.4
-.if n .sp
-..
-.de XS
-.SP
-.in +.5i
-.nf
-..
-.de XE
-.fi
-.in -.5i
-.SP
-..
-.de NS
-.PP
-.B ANS\ \\$1
-..
-.de UX
-\s-2UNIX\s+2
-..
-.de MX
-.if n MINIX 3
-.if t \s-1MINIX 3\s-1
-..
-.if n .ds Mx MINIX 3
-.if t .ds Mx \s-1MINIX 3\s-1
-.if n .ds Mp Minix-PC
-.if t .ds Mx \s-2MINIX-PC\s+2
-.if n .ds Mv Minix-vmd
-.if t .ds Mv \s-1MINIX 3\s-1-vmd
-.if n .ds Cw \fR
-.if t .ds Cw \fC
-.de CW
-.if n .ft R
-.if t .ft C
-..
-.\"
-These are the details on the Amsterdam Compiler Kit compilers for the
-languages C, Modula-2, and Pascal.  The design decisions that were made
-where the respective standards allowed or mandated this, and the extensions
-that were implemented.
-.SH "ANSI C REPORT"
-This section specifies the implementation-defined behavior of the ANSI-C
-compiler as required by ANS X3.159-1989.
-.NS A.6.3.1
-.IP \(bu
-Diagnostics are placed on the standard error output.  They have the
-following specification:
-.XS
-"<file>", line <nr>: [(<class>)] <diagnostic>
-.XE
-There are three classes of diagnostics: 'error', 'strict' and 'warning'.
-When the class is 'error', the class specification is absent.
-The class 'strict' is used for violations of the standard which are
-not severe enough to stop compilation, for example the occurrence
-of non white-space after an '#endif' preprocessing
-directive.  The class 'warning' is used for legal but dubious
-constructions, for example the declaration of a structure-tag in a
-parameter type list.
-.NS A.6.3.2
-.IP \(bu
-The function 'main' can have zero or two parameters.  When it has two
-parameters, the first parameter is an integer specifying the number of
-arguments on the command line (including the command).  The second
-parameter is a pointer to an array of pointers to the arguments
-(as strings).
-.IP \(bu
-Interactive devices are terminals.
-.NS A.6.3.3
-.IP \(bu
-The number of significant characters is 64.
-Corresponding upper-case and lower-case letters are different.
-.NS A.6.3.4
-.IP \(bu
-The compiler assumes ASCII-characters in both the source and execution
-character set.
-.IP \(bu
-There are no multibyte characters.
-.IP \(bu
-There are 8 bits in a character.
-.IP \(bu
-Character constants that cannot be represented in 8 bits
-are truncated.
-.IP \(bu
-Character constants that are more than 1 character wide will have the
-first character specified in the least significant byte.
-.IP \(bu
-The only supported locale is 'C'.
-.IP \(bu
-A plain 'char' has the same range of values as 'signed char'.
-.NS A.6.3.5
-.IP \(bu
-The i80x86 and 68000 both have a two's complement binary-number system.
-Shorts are 2 bytes; ints are 2 bytes under 16-bits \*(Mp and 68000 \*(Mx, 4
-bytes under 32-bits \*(Mp; longs occupy 4 bytes.
-.IP \(bu
-Converting an integer to a shorter signed integer is implemented by
-ignoring the high-order byte(s) of the former.
-Converting a unsigned integer to a signed integer of the same type is
-only done in administration.  This means that the bit-pattern remains
-unchanged.
-.IP \(bu
-The result of bitwise operations on signed integers are what can be
-expected on a two's complement machine.
-.IP \(bu
-When either operand is negative, the result of the / operator is the
-largest integer less than or equal to the algebraic quotient.
-The sign of the remainder on integer division is the sign of the
-enumerator.
-.IP \(bu
-The right-shift of a negative value is negative.
-.NS A.6.3.6
-.IP \(bu
-The compiler uses IEEE format for floating-point numbers.
-High-precision floating-point is used for constant folding.
-.IP \(bu
-Truncation is done to the nearest floating-point number that can
-be represented.
-.NS A.6.3.7
-.IP \(bu
-The type of the sizeof-operator (also known as size_t) is 'unsigned int'.
-.IP \(bu
-Casting an integer to a pointer or vice versa has no effect in
-bit-pattern when the sizes are equal.  Otherwise the value will be
-truncated or zero-extended (depending on the direction of the
-conversion and the relative sizes).
-.IP \(bu
-The type of a 'ptrdiff_t' is 'int' on \*(Mp, and 'long' on the 68000
-\*(Mx versions.
-.NS A.6.3.8
-.IP \(bu
-Since the front end has only limited control over the registers, it can
-only make it more likely that variables that are declared as
-registers also end up in registers.  The only things that can possibly be
-put into registers are plain ints and pointers.
-.NS A.6.3.9
-.IP \(bu
-When a member of a union object is accessed using a member of a
-different type, the resulting value will usually be garbage.  The
-compiler makes no effort to catch these errors.
-.IP \(bu
-The alignment of types under 16-bit \*(Mp is 1 byte for characters and 2
-bytes for all other types.  Under other MINIX 3 versions 'int' and smaller
-types are aligned to a multiple of their size, bigger scalar types are
-aligned like 'int'.  Arrays have the same alignment as their elements;
-structs and unions are aligned like their field with the worst alignment.
-.IP \(bu
-A plain 'int' bit-field is taken as a 'signed int'.  This means that
-a field with a size 1 bit-field can only store the values 0 and \(mi1.
-.IP \(bu
-In bit-fields, high-order bits are allocated first.
-.IP \(bu
-An enum has the same size as a plain 'int'.
-.NS A.6.3.10
-.IP \(bu
-An access to a volatile object is either a load or a store.  Just
-mentioning a volatile variable is not enough.
-E.g. the statement 'x;' where x is declared volatile, does not
-constitute an access.  When a volatile object should be read, but its
-value ignored, 'if (x);' should do the trick.
-.NS A.6.3.11
-.IP \(bu
-There is no fixed limit on the number of declarators that may modify an
-arithmetic, structure or union type, although specifying too many may
-cause the compiler to run out of memory.
-.NS A.6.3.12
-.IP \(bu
-The maximum number of cases in a switch-statement is in the order of
-1e9, although the compiler may run out of memory somewhat earlier.
-.NS A.6.3.13
-.IP \(bu
-Since both the preprocessor and the compiler assume ASCII-characters, 
-a single character constant in a conditional-inclusion directive
-matches the same value in the execution character set.
-.IP \(bu
-The preprocessor recognizes \fI\(enI...\fR command-line options.  The
-directories thus specified are searched first.  After that, /usr/include is
-visited.
-.IP \(bu
-Quoted names are first looked for in the directory in which the file
-which does the include resides.
-.IP \(bu
-The characters in a h- or q- char-sequence are taken to be
-.UX
-paths.
-.IP \(bu
-Neither the front-end nor the preprocessor know any pragmas.
-.IP \(bu
-Since the compiler runs on 
-.MX ,
-_\^_DATE_\^_ and _\^_TIME_\^_ will always be
-defined.
-.NS A.6.3.14
-.IP \(bu
-NULL is defined as ((void *)0).  This in order to detect dubious
-constructions like 'int x = NULL;'.
-.IP \(bu
-The diagnostic printed by 'assert' is as follows:
-.XS
-Assertion "<expr>" failed, file "<file>", line <line>
-.XE
-where <expr> is the argument to the assert macro, printed as string.
-(the <file> and <line> should be clear)
-.IP \(bu
-The sets for character test macros for the C locale are as follows:
-.XS
-.ta +\w'isalnum    'u
-\fBName        Set\fR
-\fIisalnum\fR  0-9A-Za-z
-\fIisalpha\fR  A-Za-z
-\fIiscntrl\fR  \e000-\e037\e177
-\fIislower\fR  a-z
-\fIisupper\fR  A-Z
-\fIisprint\fR  \e040-\e176
-.DT
-.XE
-As an addition, there is an \fIisascii\fR macro, which tests whether a character
-is an ASCII character.  Characters in the range from \e000 to \e177 are ASCII
-characters.
-.IP \(bu
-The behavior of ACK mathematical functions on domain error is as follows:
-.XS
-.ta +\w'log10   'u
-\fBName        Returns\fR
-\fIasin\fR     0.0
-\fIacos\fR     0.0
-\fIatan2\fR    0.0
-\fIfmod\fR     0.0
-\fIlog\fR      \(miHUGE_VAL
-\fIlog10\fR    \(miHUGE_VAL
-\fIpow\fR      0.0
-\fIsqrt\fR     0.0
-.DT
-.XE
-\*(Mv uses the BSD4.4 C library and the Sun FDLIBM C math library instead
-of the ACK library.  See
-.BR math (3)
-for details about the math functions.  The \*(Mv libraries offer at
-least the same functionality as the ACK library.
-.IP \(bu
-Underflow range errors do not cause \fIerrno\fR to be set.
-.IP \(bu
-The function \fIfmod\fR returns 0.0 and sets \fIerrno\fR to EDOM when the second
-argument is 0.0.
-.IP \(bu
-The set of signals for the \fIsignal\fR function is as described by
-.BR sigaction (2).
-.IP \(bu
-A text-stream need not end in a new-line character.
-.IP \(bu
-White space characters before a new-line appear when read in.
-.IP \(bu
-There may be any number of null characters appended to a binary
-stream.
-.IP \(bu
-The file position indicator of an append mode stream is initially
-positioned at the beginning of the file.
-.IP \(bu
-A write on a text stream does not cause the associated file to be
-truncated beyond that point.
-.IP \(bu
-The buffering intended by the standard is fully supported.
-.IP \(bu
-A zero-length file actually exists.
-.IP \(bu
-A file name can consist of any character, except for the '\e0' and
-the '/'.
-.IP \(bu
-A file can be open multiple times.
-.IP \(bu
-When a \fIremove\fR is done on an open file, reading and writing behave
-just as can be expected from a non-removed file.  When the associated
-stream is closed, however, all written data will be lost.
-.IP \(bu
-When a file exists prior to a call to \fIrename\fR, it is removed.
-.IP \(bu
-The %p conversion in \fIfprintf\fR has the same effect as %#x on \*(Mp and
-%#lx on the 68000 versions of \*(Mx.
-.IP \(bu
-The %p conversion in \fIfscanf\fR has the same effect as %x on \*(Mp and
-%lx on the 68000 versions of \*(Mx.
-.IP \(bu
-A \(mi character that is neither the first nor the last character in the
-scanlist for %[ conversion is taken to be a range indicator.  When the
-first character has a higher ASCII-value than the second, the \(mi will
-just be put into the scanlist.
-.IP \(bu
-The value of \fIerrno\fR when \fIfgetpos\fR or \fIftell\fR failed is that of \fIlseek\fR.
-This means:
-.XS
-.ta +\w'ESPIPE   'u +\w'\- 'u
-EBADF  \-      when the stream is not valid
-ESPIPE \-      when fildes is associated with a pipe
-EINVAL \-      the resulting file pointer would be negative
-.XE
-.IP \(bu
-The messages generated by \fIperror\fR depend on the value of \fIerrno\fR.
-The mapping of errors to strings is done by \fIstrerror\fR.
-.IP \(bu
-When the requested size is zero, \fImalloc\fR, \fIcalloc\fR and \fIrealloc\fR
-return a null-pointer under \*(Mx.  Under \*(Mv a unique non-null pointer is
-returned.
-.IP \(bu
-When \fIabort\fR is called, output buffers will be flushed.  Temporary files
-(made with the \fItmpfile\fR function) will have disappeared when SIGABRT
-is not caught or ignored.
-.IP \(bu
-The \fIexit\fR function returns the low-order eight bits of its argument
-to the environment.
-.IP \(bu
-The predefined environment names are controlled by the user.
-Setting environment variables is done through the \fIputenv\fR function.
-This function accepts a pointer to char as its argument.
-To set, for example, the environment variable TERM to a230 one writes
-.XS
-static char terminal[] = "TERM=a230";
-putenv(terminal);
-.XE
-The argument to \fIputenv\fR is stored in an internal table, so malloc'ed
-strings cannot be freed until another call to \fIputenv\fR (which sets the
-same environment variable) is made.  The argument to \fIputenv\fR must be
-writable, which means that officially, the argument cannot be a string
-constant.
-The function returns 1 if it fails, 0 otherwise.
-.LP
-.IP \(bu
-The argument to \fIsystem\fR is passed as argument to \fI/bin/sh \(enc\fR.
-.IP \(bu
-The strings returned by \fIstrerror\fR depend on \fIerrno\fR.  They are
-listed in
-.BR intro (2).
-Everything else causes \fIstrerror\fR to return "unknown error" under \*(Mx,
-or the result of sprintf("Error %d", errno) under \*(Mv.
-.IP \(bu
-The local time zone is per default GMT.  This can be
-changed through the TZ environment variable, e.g. TZ=EST6.
-See
-.BR TZ (5).
-.IP \(bu
-The \fIclock\fR function returns the number of ticks since process
-startup.
-.SS References
-.IP [1]
-ANS X3.159-1989
-.ft I
-American National Standard for Information Systems -
-Programming Language C
-.ft R
-.SH "THE MINIX MODULA-2 COMPILER"
-This section describes the implementation-specific features of the
-.MX
-Modula-2 compiler.
-It is not intended to teach Modula-2 programming.
-For a description of the Modula-2 language,
-the reader is referred to [1].
-.SS "The language implemented"
-.PP
-This paragraph discusses the deviations from the Modula-2 language as described
-in the 'Report on The Programming Language Modula-2',
-as it appeared in [1],
-from now on referred to as 'the Report'.
-Also,
-the Report sometimes leaves room for interpretation.
-The section numbers
-mentioned are the section numbers of the Report.
-.SS "Syntax (section 2)"
-.PP
-The syntax recognized is that of the Report,
-with some extensions to
-also recognize the syntax of an earlier definition,
-given in [2].
-Only one compilation unit per file is accepted.
-.SS "Vocabulary and Representation (section 3)"
-.PP
-The input '\*(Cw10..\fR' is parsed as two tokens: '\*(Cw10\fR' and '\*(Cw..\fR'.
-.PP
-The empty string \*(Cw""\fR has type
-.XS
-.CW
-ARRAY [0 .. 0] OF CHAR
-.ft P
-.XE
-and contains one character: \*(Cw0C\fR.
-.PP
-When the text of a comment starts with a '\*(Cw$\fR',
-it may be a pragma.
-Currently,
-the following pragmas exist:
-.nf
-.SP
-.CW
-(*$F      (F stands for Foreign) *)
-(*$R[+|-] (Runtime checks, on or off, default on) *)
-(*$A[+|-] (Array bound checks, on or off, default off) *)
-(*$U      (Allow for underscores within identifiers) *)
-.ft P
-.SP
-.fi
-The Foreign pragma is only meaningful in a \*(CwDEFINITION MODULE\fR,
-and indicates that this
-\*(CwDEFINITION MODULE\fR describes an interface to a module written in another
-language (for instance C or Pascal).
-Runtime checks that can be disabled are:
-range checks,
-\*(CwCARDINAL\fR overflow checks,
-checks when assigning a \*(CwCARDINAL\fR to an \*(CwINTEGER\fR and vice versa,
-and checks that \*(CwFOR\fR-loop control-variables are not changed
-in the body of the loop.
-Array bound checks can be enabled,
-because many EM implementations do not
-implement the array bound checking of the EM array instructions.
-When enabled,
-the compiler generates a check before generating an
-EM array instruction.
-Even when underscores are enabled,
-they still may not start an identifier.
-.PP
-Constants of type \*(CwLONGINT\fR are integers with a suffix letter \*(CwD\fR
-(for instance \*(Cw1987D\fR).
-Constants of type \*(CwLONGREAL\fR have suffix \*(CwD\fR if a scale factor is missing,
-or have \*(CwD\fR in place of \*(CwE\fR in the scale factor (f.i. \*(Cw1.0D\fR,
-\*(Cw0.314D1\fR).
-This addition was made,
-because there was no way to indicate long constants,
-and also because the addition was made in Wirth's newest Modula-2 compiler.
-.SS "Declarations and scope rules (section 4)"
-.PP
-Standard identifiers are predeclared,
-and valid in all
-parts of a program.
-They are called \fIpervasive\fR.
-Unfortunately,
-the Report does not state how this pervasiveness is accomplished.
-However,
-page 87 of [1] states: 'Standard identifiers are automatically
-imported into all modules'.
-Our implementation therefore allows
-redeclarations of standard identifiers within procedures,
-but not within
-modules.
-.SS "Constant expressions (section 5)"
-.PP
-Each operand of a constant expression must be a constant:
-a string,
-a number,
-a set,
-an enumeration literal,
-a qualifier denoting a
-constant expression,
-a type transfer with a constant argument,
-or one of the standard procedures
-\*(CwABS\fR,
-\*(CwCAP\fR,
-\*(CwCHR\fR,
-\*(CwLONG\fR,
-\*(CwMAX\fR,
-\*(CwMIN\fR,
-\*(CwODD\fR,
-\*(CwORD\fR,
-\*(CwSIZE\fR,
-\*(CwSHORT\fR,
-\*(CwTSIZE\fR,
-or \*(CwVAL\fR,
-with constant argument(s);
-\*(CwTSIZE\fR and \*(CwSIZE\fR may also have a variable as argument.
-.SS "Type declarations (section 6)"
-.LP
-.ft I
-1. Basic types (section 6.1)
-.PP
-The type \*(CwCHAR\fR includes the ASCII character set as a subset.
-Values range from
-\*(Cw0C\fR to \*(Cw377C\fR,
-not from \*(Cw0C\fR to \*(Cw177C\fR.
-.LP
-.ft I
-2. Enumerations (section 6.2)
-.PP
-The maximum number of enumeration literals in any one enumeration type
-is \*(CwMAX(INTEGER)\fR.
-.LP
-.ft I
-3. Record types (section 6.5)
-.PP
-The syntax of variant sections in [1] is different from the one in [2].
-Our implementation recognizes both,
-giving a warning for the older one.
-.LP
-.ft I
-4. Set types (section 6.6)
-.PP
-The only limitation imposed by the compiler is that the base type of the
-set must be a subrange type,
-an enumeration type,
-\*(CwCHAR\fR,
-or \*(CwBOOLEAN\fR.
-So,
-the lower bound may be negative.
-However,
-if a negative lower bound is used,
-the compiler gives a warning of the \fIrestricted\fR class.
-.PP
-The standard type \*(CwBITSET\fR is defined as
-.XS
-.CW
-TYPE BITSET = SET OF [0 .. 8*SIZE(INTEGER)-1];
-.ft P
-.XE
-.SS "Expressions (section 8)"
-.LP
-.ft I
-1. Operators (section 8.2)
-.LP
-.ft I
-1.1. Arithmetic operators (section 8.2.1)
-.PP
-The Report does not specify the priority of the unary
-operators \*(Cw+\fR or \*(Cw-\fR:
-It does not specify whether
-.XS
-.CW
-- 1 + 1
-.ft P
-.XE
-means
-.XS
-.CW
-- (1 + 1)
-.ft P
-.XE
-or
-.XS
-.CW
-(-1) + 1
-.ft P
-.XE
-The
-.MX
-Modula-2 compiler implements the second alternative.
-.SS "Statements (section 9)"
-.LP
-.ft I
-1. Assignments (section 9.1)
-.PP
-The Report does not define the evaluation order in an assignment.
-Our compiler certainly chooses an evaluation order,
-but it is explicitly left undefined.
-Therefore,
-programs that depend on it may cease to work later.
-.PP
-The types \*(CwINTEGER\fR and \*(CwCARDINAL\fR are assignment-compatible with
-\*(CwLONGINT\fR,
-and \*(CwREAL\fR is assignment-compatible with \*(CwLONGREAL\fR.
-.LP
-.ft I
-2. Case statements (section 9.5)
-.PP
-The size of the type of the case-expression must be less than or equal to
-the word-size.
-.PP
-The Report does not specify what happens if the value of the case-expression
-does not occur as a label of any case,
-and there is no \*(CwELSE\fR-part.
-In our implementation,
-this results in a runtime error.
-.LP
-.ft I
-3. For statements (section 9.8)
-.PP
-The Report does not specify the legal types for a control variable.
-Our implementation allows the basic types (except \*(CwREAL\fR),
-enumeration types,
-and subranges.
-A runtime warning is generated when the value of the control variable
-is changed by the statement sequence that forms the body of the loop,
-unless runtime checking is disabled.
-.LP
-.ft I
-4. Return and exit statements (section 9.11)
-.PP
-The Report does not specify which result-types are legal.
-Our implementation allows any result type.
-.SS "Procedure declarations (section 10)"
-.PP
-Function procedures must exit through a RETURN statement,
-or a runtime error occurs.
-.LP
-.ft I
-1. Standard procedures (section 10.2)
-.PP
-Our implementation supports \*(CwNEW\fR and \*(CwDISPOSE\fR
-for backwards compatibility,
-but issues warnings for their use.
-.PP
-Also,
-some new standard procedures were added,
-similar to the new standard procedures in Wirth's newest compiler:
-.IP \-
-\*(CwLONG\fR converts an argument of type \*(CwINTEGER\fR or \*(CwREAL\fR to the
-types \*(CwLONGINT\fR or \*(CwLONGREAL\fR.
-.IP \-
-\*(CwSHORT\fR performs the inverse transformation,
-without range checks.
-.IP \-
-\*(CwFLOATD\fR is analogous to \*(CwFLOAT\fR,
-but yields a result of type
-\*(CwLONGREAL\fR.
-.IP \-
-\*(CwTRUNCD\fR is analogous to \*(CwTRUNC\fR,
-but yields a result of type
-\*(CwLONGINT\fR.
-.SS "System-dependent facilities (section 12)"
-.PP
-The type \*(CwBYTE\fR is added to the \*(CwSYSTEM\fR module.
-It occupies a storage unit of 8 bits.
-\*(CwARRAY OF BYTE\fR has a similar effect to \*(CwARRAY OF WORD\fR,
-but is safer.
-In some obscure cases the \*(CwARRAY OF WORD\fR mechanism does not quite
-work properly.
-.PP
-The procedure \*(CwIOTRANSFER\fR is not implemented.
-.SS "Backwards compatibility"
-.PP
-Besides recognizing the language as described in [1],
-the compiler recognizes most of the language described in [2],
-for backwards compatibility.
-It warns the user for old-fashioned
-constructions (constructions that [1] does not allow).
-If the \fI\(en3\fR option is passed to \fIm2\fR,
-this backwards compatibility feature is disabled.
-.SS "Compile time errors"
-.PP
-The compile time error messages are intended to be self-explanatory,
-and not listed here.
-The compiler also sometimes issues warnings,
-recognizable by a warning-classification between parentheses.
-There are 3 classifications:
-.IP "(old-fashioned use)"
-.br
-These warnings are given on constructions that are not allowed by [1],
-but are allowed by [2].
-.IP (strict)
-.br
-These warnings are given on constructions that are supported by the
-.MX
-Modula-2 compiler,
-but might not be supported by others.
-Examples: functions returning structured types,
-SET types of subranges with
-negative lower bound.
-.IP (warning)
-.br
-The other warnings,
-such as warnings about variables that are never assigned,
-never used,
-etc.
-.SS "Runtime errors"
-.PP
-The \fITraps\fR module enables the user to install his own runtime
-error handler.
-The default one just displays what happened and exits.
-Basically,
-a trap handler is just a procedure that takes an INTEGER as
-parameter.
-The INTEGER is the trap number.
-This INTEGER can be one of the
-EM trap numbers,
-listed in [3],
-or one of the numbers listed in the
-\fITraps\fR definition module.
-.PP
-The following runtime errors may occur:
-.IP "array bound error"
-.br
-This error is detected if the \fI\(enA\fR option is given to \fIm2\fR.
-.IP "range bound error"
-.br
-Range bound errors are always detected,
-unless runtime checks are disabled.
-.IP "set bound error"
-.IP "cardinal overflow"
-.br
-This error is detected,
-unless runtime checks are disabled.
-.IP "cardinal underflow"
-.br
-This error is detected,
-unless runtime checks are disabled.
-.IP "divide by 0"
-.IP "divide by 0.0"
-.IP "conversion error"
-.br
-This error occurs when assigning a negative value of type INTEGER to a
-variable of type CARDINAL,
-or when assigning a value of CARDINAL that is > MAX(INTEGER),
-to a variable of type INTEGER.
-It is detected,
-unless runtime checking is disabled.
-.IP "heap overflow"
-.br
-This might happen when ALLOCATE fails.
-.IP "case error"
-.br
-This error occurs when non of the cases in a CASE statement are selected,
-and the CASE statement has no ELSE part.
-.IP "stack size of process too large"
-.br
-This is most likely to happen if the reserved space for a coroutine stack
-is too small.
-In this case,
-increase the size of the area given to
-\*(CwNEWPROCESS\fR.
-It can also happen if the stack needed for the main
-process is too large and there are coroutines.
-In this case,
-the only fix is to reduce the stack size needed by the main process,
-f.i. by avoiding local arrays.
-.IP "too many nested traps + handlers"
-.br
-This error can only occur when the user has installed his own trap handler.
-It means that during execution of the trap handler another trap has occurred,
-and that several times.
-In some cases,
-this is an error because of overflow of some internal tables.
-.IP "no RETURN from function procedure"
-.br
-This error occurs when a function procedure does not return properly
-('falls' through).
-.IP "illegal instruction"
-.br
-This error might occur when you use floating point operations on an
-implementation that does not have floating point.
-.PP
-In addition,
-some of the library modules may give error messages.
-The \fBTraps\fR-module has a suitable mechanism for this.
-.SS "The procedure call interface"
-.PP
-Parameters are pushed on the stack in reversed order.
-For VAR parameters,
-its address is passed,
-for value parameters its value.
-The only exception to this rule is with conformant arrays.
-For conformant arrays,
-the address is passed,
-and an array descriptor is
-passed.
-The descriptor is an EM array descriptor.
-It consists of three
-fields: the lower bound (always 0),
-upper bound \(mi lower bound,
-and the size of the elements.
-The descriptor is pushed first.
-If the parameter is a value parameter,
-the called routine must make sure
-that its value is never changed,
-for instance by making its own copy
-of the array.
-.PP
-When the size of the return value of a function procedure is larger than
-the maximum of \*(CwSIZE(LONGREAL)\fR and twice the pointer-size,
-the caller reserves this space on the stack,
-above the parameters.
-Callee then stores
-its result there,
-and returns no other value.
-.SS "The Modula-2 runtime library"
-.PP
-The definition modules of the modules available in the
-.MX
-Modula-2 runtime library reside in the directory \fI/usr/lib/ack/m2\fR.
-.SS References
-.IP [1]
-Niklaus Wirth,
-.ft I
-Programming in Modula-2, third, corrected edition,
-.ft R
-Springer-Verlag, Berlin (1985)
-.IP [2]
-Niklaus Wirth,
-.ft I
-Programming in Modula-2,
-.ft R
-Stringer-Verlag, Berlin (1983)
-.IP [3]
-A.S.Tanenbaum, J.W.Stevenson, Hans van Staveren, E.G.Keizer,
-.ft I
-Description of a machine architecture for use with block structured languages,
-.ft R
-Informatica rapport IR-81, Vrije Universiteit, Amsterdam
-.SH "THE MINIX PASCAL COMPILER"
-.PP
-.de IT
-.PP
-.B BS\ \\$1:
-..
-.de IS
-.PP
-.in +.5i
-..
-.PP
-This section refers to the (1982) BSI standard for Pascal [1].
-.MX
-Pascal complies with the requirements of level 1 of BS 6192: 1982, with
-the exceptions as listed in this section.
-.PP
-The standard requires an accompanying document describing the
-implementation-defined and implementation-dependent features,
-the reaction on errors and the extensions to standard Pascal.
-These four items will be treated in the rest of this section.
-.SS "Implementation-defined features"
-.PP
-For each implementation-defined feature mentioned in the BSI standard
-we give the section number, the quotation from that section and the definition.
-First we quote the definition of implementation-defined:
-.PP
-.RS
-Possibly differing between processors, but defined for any particular
-processor.
-.RE
-.IT 6.1.7
-Each string-character shall denote an implementation-defined value of the
-required char-type.
-.IS
-All 7-bit ASCII characters except linefeed LF (10) are allowed.
-.IT 6.4.2.2
-The values of type real shall be an implementation-defined subset
-of the real numbers denoted as specified by 6.1.5 by the signed-real values.
-.IS
-The set of real values range from a low of \(mi1.7976931348623157e+308 to
-a high of 1.7976931348623157e+308.
-.IT 6.4.2.2
-The type char shall be the enumeration of a set of implementation-defined
-characters, some possibly without graphic representations.
-.IS
-The 7-bit ASCII character set is used, where LF (10) denotes the
-end-of-line marker on text-files.
-.IT 6.4.2.2
-The ordinal numbers of the character values shall be values of integer-type,
-that are implementation-defined, and that are determined by mapping
-the character values on to consecutive non-negative integer values
-starting at zero.
-.IS
-The normal ASCII ordering is used: ord('0')=48, ord('A')=65, ord('a')=97, etc.
-.IT 6.6.5.2
-The post-assertions imply corresponding activities on the external entities,
-if any, to which the file-variables are bound.
-These activities, and the
-point at which they are actually performed, shall be
-implementation-defined.
-.IS
-The reading and writing writing of objects on files is buffered.
-This means that when a program terminates abnormally, I/O may be
-unfinished.
-Terminal I/O is unbuffered.
-Files are closed whenever they are rewritten or reset, or on
-program termination.
-.IT 6.7.2.2
-The predefined constant \fImaxint\fR shall be of integer-type and shall denote
-an implementation-defined value, that satisfies the following conditions:
-.IP (a)
-All integral values in the closed interval from \fI\(mimaxint\fR to \fI+maxint\fR
-shall be values of the integer-type.
-.IP (b)
-Any monadic operation performed on an integer value in this interval
-shall be correctly performed according to the mathematical rules for
-integer arithmetic.
-.IP (c)
-Any dyadic integer operation on two integer values in this same interval
-shall be correctly performed according to the mathematical rules for
-integer arithmetic, provided that the result is also in this interval.
-.IP (d)
-Any relational operation on two integer values in this same interval
-shall be correctly performed according to the mathematical rules for
-integer arithmetic.
-.SP
-The representation of integers under 16-bit \*(Mp or under 68000 \*(Mx
-is a 16-bit word using two's complement arithmetic.  The integers range
-from \(mi32768 to +32767.  Under 32-bit \*(Mp a 32-bit integer is used
-ranging from \(mi2147483648 to +2147483647.
-.IT 6.7.2.2
-The result of the real arithmetic operators and functions shall be
-approximations to the corresponding mathematical results.
-The accuracy of
-this approximation shall be implementation-defined
-.IS
-The default size of reals is 8 bytes, the accuracy is 11 bits for the exponent,
-and 53 bits for the mantissa.
-This gives an accuracy of about 16 digits.
-and exponents ranging from \(mi307 to +307.
-.IT 6.9.3.1
-The default TotalWidth values for integer, Boolean and real types
-shall be implementation-defined.
-.IS
-The defaults are:
-.XS
-.ta +\w'Boolean   'u +\w'14  'u
-integer        6       (16-bit)
-integer        11      (32-bit)
-Boolean        5
-real   14
-.DT
-.XE
-.IT 6.9.3.4.1
-ExpDigits, the number of digits written in an exponent part of a real,
-shall be implementation-defined.
-.IS
-ExpDigits is defined as 3.
-.IT 6.9.3.4.1
-The character written as part of the representation of
-a real to indicate the beginning of the exponent part shall be
-implementation-defined, either 'E' or 'e'.
-.IS
-The exponent part starts with 'e'.
-.IT 6.9.3.5
-The case of the characters written as representation of the
-Boolean values shall be implementation-defined.
-.IS
-The representations of true and false are 'true' and 'false'.
-.IT 6.9.5
-The effect caused by the standard procedure page
-on a text file shall be implementation-defined.
-.IS
-The ASCII character form feed FF (12) is written.
-.IT 6.10
-The binding of the variables denoted by the program-parameters
-to entities external to the program shall be implementation-defined if
-the variable is of a file-type.
-.IS
-The program parameters must be files and all, except input and output,
-must be declared as such in the program block.
-.PP
-The program parameters input and output, if specified, will correspond
-with the UNIX streams 'standard input' and 'standard output'.
-.PP
-The other program parameters will be mapped to the argument strings
-provided by the caller of this program.
-The argument strings are supposed to be path names of the files to be
-opened or created.
-The order of the program parameters determines the mapping:
-the first parameter is mapped onto the first argument string, etc.
-Note that input and output are ignored in this mapping.
-.PP
-The mapping is recalculated each time a program parameter
-is opened for reading or writing by a call to the standard procedures
-reset or rewrite.
-This gives the programmer the opportunity to manipulate the list
-of string arguments using the external procedures argc, argv and argshift
-available in the Pascal library.
-.IT 6.10
-The effect of an explicit use of reset or rewrite
-on the standard text files input or output shall be implementation-defined.
-.IS
-The procedures reset and rewrite are no-ops
-if applied to input or output.
-.in 0
-.SS "Implementation-dependent features"
-.PP
-For each implementation-dependent feature mentioned in the BSI standard,
-we give the section number, the quotation from that section and the way
-this feature is treated by the 
-.MX
-Pascal system.
-First we quote the definition of 'implementation-dependent':
-.PP
-.RS
-Possibly differing between processors and not necessarily defined for any
-particular processor.
-.RE
-.IT 6.7.2.1
-The order of evaluation of the operands of a dyadic operator
-shall be implementation-dependent.
-.IS
-Operands are always evaluated, so the program part
-.XS
-if (p<>nil) and (p^.value<>0) then
-.XE
-is probably incorrect.
-.PP
-The left-hand operand of a dyadic operator is almost always evaluated
-before the right-hand side.
-Some peculiar evaluations exist for the following cases:
-.IP 1.
-The modulo operation is performed by a library routine to
-check for negative values of the right operand.
-.IP 2.
-The expression
-.XS
-set1 <= set2
-.XE
-where set1 and set2 are compatible set types is evaluated in the
-following steps:
-.XS
-.ta +\w'\-  'u
-\-     evaluate set2;
-\-     evaluate set1;
-\-     compute set2+set1;
-\-     test set2 and set2+set1 for equality.
-.DT
-.XE
-.IP 3.
-The expression
-.XS
-set1 >= set2
-.XE
-where set1 and set2 are compatible set types is evaluated in the following steps:
-.XS
-.ta +\w'\-  'u
-\-     evaluate set1;
-\-     evaluate set2;
-\-     compute set1+set2;
-\-     test set1 and set1+set2 for equality.
-.DT
-.XE
-.IT 6.7.3
-The order of evaluation, accessing and binding
-of the actual-parameters for functions
-shall be implementation-dependent.
-.IS
-The order of evaluation is from right to left.
-.IT 6.8.2.2
-The decision as to the order of accessing the variable and evaluating
-the expression in an assignment-statement, shall be
-implementation-dependent.
-.IS
-The expression is evaluated first.
-.IT 6.8.2.3
-The order of evaluation and binding of the actual-parameters for procedures
-shall be implementation-dependent.
-.IS
-The same as for functions.
-.IT 6.9.5
-The effect of inspecting a text file to which the page
-procedure was applied during generation is
-implementation-dependent.
-.IS
-The formfeed character written by page is
-treated like a normal character, with ordinal value 12.
-.IT 6.10
-The binding of the variables denoted by the program-parameters
-to entities external to the program shall be implementation-dependent unless
-the variable is of a file-type.
-.IS
-Only variables of a file-type are allowed as program parameters.
-.in 0
-.SS "Error handling"
-.PP
-There are three classes of errors to be distinguished.
-In the first class are the error messages generated by the compiler.
-The second class consists of the occasional errors generated by the other
-programs involved in the compilation process.
-Errors of the third class are the errors as defined in the standard by:
-.PP
-.RS
-An error is a violation by a program of the requirements of this standard
-that a processor is permitted to leave undetected.
-.RE
-.LP
-.ft I
-Compiler errors
-.PP
-Error are written on the standard error output.
-Each line has the form:
-.XS
-<file>, line <number>: <description>
-.XE
-Every time the compiler detects an error that does not have influence
-on the code produced by the compiler or on the syntax decisions, a warning
-messages is given.
-If only warnings are generated, compilation proceeds and probably results
-in a correctly compiled program.
-.PP
-Sometimes the compiler produces several errors for the same line.
-They are only shown up to a maximum of 5 errors per line.
-Warning are also shown up to a maximum of 5 per line.
-.PP
-Extensive treatment of these errors is outside the scope of this manual.
-.LP
-.ft I
-Runtime errors
-.PP
-Errors detected at run time cause an error message to be generated on the
-diagnostic output stream (UNIX file descriptor 2).
-The message consists of the name of the program followed by a message
-describing the error, possibly followed by the source line number.
-Unless the \fI\(enn\fR option is turned on, the compiler generates code to keep track
-of which source line causes which instructions to be generated.
-.PP
-For each error mentioned in the standard we give the section number,
-the quotation from that section and the way it is processed by the
-Pascal-compiler or runtime system.
-.PP
-For detected errors the corresponding message
-and trap number are given.
-Trap numbers are useful for exception-handling routines.
-Normally, each error causes the program to terminate.
-By using exception-handling routines one can
-ignore errors or perform alternate actions.
-Only some of the errors can be ignored
-by restarting the failing instruction.
-These errors are marked as non-fatal,
-all others as fatal.
-A list of errors with trap number between 0 and 63
-(EM errors) can be found in [2].
-Errors with trap number between 64 and 127 (Pascal errors) are listed below.
-.IT 6.4.6
-It shall be an error if a value of type T2 must be
-assignment-compatible with type T1, while
-T1 and T2 are compatible ordinal-types and the value of
-type T2 is not in the closed interval specified by T1.
-.IS
-The compiler distinguishes between array-index expressions and the other
-places where assignment-compatibility is required.
-.PP
-Array subscripting errors are only detected when the 'A' option is used.
-In the other cases, a range bound error occurs when the value of type T2
-is not in the closed interval specified by T1, unless range checks are
-disabled.
-.IT 6.4.6
-It shall be an error if a value of type T2 must be
-assignment-compatible with type T1, while T1 and T2 are compatible
-set-types and any member of the value of type T2
-is not in the closed interval specified by the base-type
-of the type T1.
-.IS
-This error is not detected.
-.IT 6.5.3.3
-It shall be an error if a component of a variant-part of a variant,
-where the selector of the variant-part is not a field,
-is accessed unless the variant is active for the entirety of each
-reference and access to each component of the variant.
-.IS
-This error is not detected.
-.IT 6.5.4
-It shall be an error if
-the pointer-variable of an identified-variable either denotes a
-nil-value or is undefined.
-.IS
-This error is not detected.
-.IT 6.5.4
-It shall be an error to remove the identifying-value of an identified
-variable from its pointer-type when a reference to the variable exists.
-.IS
-When the identified variable is an element of the record-variable-list of
-a with-statement, a warning is given at compile-time.
-Otherwise, this error is not detected.
-.IT 6.5.5
-It shall be an error to alter the value of a file-variable f when a
-reference to the buffer-variable f^ exists.
-.IS
-When f is altered when it is an element of the record-variable-list of a
-with-statement, a warning is given.
-When a buffer-variable is used as a
-variable-parameter, an error is given.
-This is done at compile-time.
-.IT 6.6.5.2
-It shall be an error if
-the stated pre-assertion does not hold immediately
-prior to any use of the file handling procedures
-rewrite, put, reset and get.
-.IS
-For each of these four operations the pre-assertions
-can be reformulated as:
-.XS
-.ta +\w'rewrite(f):  'u
-rewrite(f):    no pre-assertion.
-put(f):        f is opened for writing and f^ is not undefined.
-reset(f):      f exists.
-get(f):        f is opened for reading and eof(f) is false.
-.DT
-.XE
-The following errors are detected for these operations:
-.SP
-rewrite(f):
-.in +6
-.ti -3
-more args expected, trap 64, fatal:
-.br
-f is a program-parameter and the corresponding
-file name is not supplied by the caller of the program.
-.ti -3
-rewrite error, trap 101, fatal:
-.br
-the caller of the program lacks the necessary
-access rights to create the file in the file system
-or operating system problems like table overflow
-prevent creation of the file.
-.in -6
-.SP
-put(f):
-.in +6
-.ti -3
-file not yet open, trap 72, fatal:
-.br
-reset or rewrite are never applied to the file.
-The checks performed by the run time system are not foolproof.
-.ti -3
-not writable, trap 96, fatal:
-.br
-f is opened for reading.
-.ti -3
-write error, trap 104, fatal:
-.br
-probably caused by file system problems.
-For instance, the file storage is exhausted.
-Because I/O is buffered to improve performance,
-it might happen that this error occurs if the
-file is closed.
-Files are closed whenever they are rewritten or reset, or on
-program termination.
-.in -6
-.SP
-reset(f):
-.in +6
-.ti -3
-more args expected, trap 64, fatal:
-.br
-same as for rewrite(f).
-.ti -3
-reset error, trap 100, fatal:
-.br
-f does not exist, or the caller has insufficient access rights, or
-operating system tables are exhausted.
-.in -6
-.SP
-get(f):
-.in +6
-.ti -3
-file not yet open, trap 72, fatal:
-.br
-as for put(f).
-.ti -3
-not readable, trap 97, fatal:
-.br
-f is opened for writing.
-.ti -3
-end of file, trap 98, fatal:
-.br
-eof(f) is true just before the call to get(f).
-.ti -3
-read error, trap 103, fatal:
-.br
-unlikely to happen.
-Probably caused by hardware problems
-or by errors elsewhere in your program that destroyed
-the file information maintained by the run time system.
-.ti -3
-truncated, trap 99, fatal:
-.br
-the file is not properly formed by an integer
-number of file elements.
-For instance, the size of a file of integer is odd.
-.ti -3
-non-ASCII char read, trap 106, non-fatal:
-.br
-the character value of the next character-type
-file element is out of range (0..127).
-Only for text files.
-.in -6
-.IT 6.6.5.3
-It shall be an error if a variant of a variant-part within the new
-variable becomes active and a different variant of the variant-part is
-one of the specified variants.
-.IS
-This error is not detected.
-.IT 6.6.5.3
-It shall be an error to use dispose(q) if the identifying variable has been
-allocated using the form new(p,c1,...,cn).
-.IS
-This error is not detected.
-However, this error can cause more memory
-to be freed then was allocated.
-Dispose causes a fatal trap 73 when memory already on the free
-list is freed again.
-.IT 6.6.5.3
-It shall be an error to use dispose(q,k1,...,km) if the identifying
-variable has been allocated using the form new(p,c1,...,cn) and m is not
-equal to n.
-.IS
-This error is not detected.
-However, this error can cause more memory
-to be freed then was allocated.
-Dispose causes a fatal trap 73 when memory already on the free
-list is freed again.
-.IT 6.6.5.3
-It shall be an error if the variants of a variable to be disposed
-are different from those specified by the case-constants to dispose.
-.IS
-This error is not detected.
-.IT 6.6.5.3
-It shall be an error if the value of the pointer parameter of dispose has
-nil-value or is undefined.
-.IS
-This error is detected for nil-value (dispose error, trap 73, fatal).
-.IT 6.6.5.3
-It shall be an error if a variable created using the second form of new is
-accessed by the identified variable of the variable-access of a factor,
-of an assignment-statement, or of an actual-parameter.
-.IS
-This error is not detected.
-.IT 6.6.6.2
-It shall be an error if the value of sqr(x) does not exist.
-.IS
-This error is detected for real-type arguments (real overflow,
-trap 4, non-fatal).
-.IT 6.6.6.2
-It shall be an error if x in ln(x) is smaller than or equal to 0.
-.IS
-This error is detected (error in ln, trap 66, non-fatal)
-.IT 6.6.6.2
-It shall be an error if x in sqrt(x) is smaller than 0.
-.IS
-This error is detected (error in sqrt, trap 67, non-fatal)
-.SP
-In addition to these errors, overflow in the expression exp(x) is
-detected (error in exp, trap 65, non-fatal; real overflow, trap 4, non-fatal)
-.IT 6.6.6.3
-It shall be an error if
-the integer value of trunc(x) does not exist.
-.IS
-This error is detected (conversion error, trap 10, non-fatal).
-.IT 6.6.6.3
-It shall be an error if
-the integer value of round(x) does not exist.
-.IS
-This error is detected (conversion error, trap 10, non-fatal).
-.IT 6.6.6.4
-It shall be an error if
-the integer value of ord(x) does not exist.
-.IS
-This error can not occur, because the compiler will not allow
-such ordinal types.
-.IT 6.6.6.4
-It shall be an error if
-the character value of chr(x) does not exist.
-.IS
-This error is detected (range bound error, trap 1, non-fatal).
-.IT 6.6.6.4
-It shall be an error if the value of succ(x) does not exist.
-.IS
-Same comments as for chr(x).
-.IT 6.6.6.4
-It shall be an error if the value of pred(x) does not exist.
-.IS
-Same comments as for chr(x).
-.IT 6.6.6.5
-It shall be an error if f in eof(f) is undefined.
-.IS
-This error is detected (file not yet open, trap 72, fatal).
-.IT 6.6.6.5
-It shall be an error if
-f in eoln(f) is undefined, or if eof(f) is true at that time.
-.IS
-The following errors may occur:
-.IS
-file not yet open, trap 72, fatal;
-.br
-not readable, trap 97, fatal;
-.br
-end of file, trap 98, fatal.
-.IT 6.7.1
-It shall be an error if a variable-access used as an operand
-in an expression is undefined at the time of its use.
-.IS
-The compiler performs some limited checks to see if identifiers are
-used before they are set.
-Since it can not always be sure (one could, for
-instance, jump out of a loop), only a warning is generated.
-When an
-expression contains a function-call, an error occurs if the
-function is not assigned at run-time.
-.IT 6.7.2.2
-A term of the form x/y shall be an error if y is zero.
-.IS
-This error is detected (divide by 0.0, trap 7, non-fatal).
-.IT 6.7.2.2
-It shall be an error if j is zero in 'i div j'.
-.IS
-This error is detected (divide by 0, trap 6, non-fatal).
-.IT 6.7.2.2
-It shall be an error if
-j is zero or negative in i MOD j.
-.IS
-This error is detected (only positive j in 'i mod j', trap 71, non-fatal).
-.IT 6.7.2.2
-It shall be an error if the result of any operation on integer
-operands is not performed according to the mathematical
-rules for integer arithmetic.
-.IS
-This implementation does not detect integer overflow.
-.IT 6.8.3.5
-It shall be an error if none of the case-constants is equal to the
-value of the case-index upon entry to the case-statement.
-.IS
-This error is detected (case error, trap 20, fatal).
-.IT 6.9.1
-It shall be an error if the sequence of characters read looking for an
-integer does not form a signed-integer as specified in 6.1.5.
-.IS
-This error is detected (digit expected, trap 105, non-fatal).
-.IT 6.9.1
-It shall be an error if the sequence of characters read looking for a
-real does not form a signed-number as specified in 6.1.5.
-.IS
-This error is detected (digit expected, trap 105, non-fatal).
-.IT 6.9.1
-When read is applied to f, it shall be an error if the buffer-variable f^
-is undefined or the pre-assertions for get do not hold.
-.IS
-This error is detected (see get(f)).
-.IT 6.9.3
-When write is applied to a text file f, it shall be an error if f is
-undefined or f is opened for reading.
-.IS
-This error is detected (see put(f)).
-Furthermore, this error is also
-detected when f is not a text file.
-.IT 6.9.3.1
-The values of TotalWidth or FracDigits shall be greater than or equal to
-one; it shall be an error if either value is less then one.
-.IS
-When either value is less than zero, an error (illegal field width, trap
-75, non-fatal) occurs.
-Zero values are allowed, in order to maintain some
-compatibility with the old 
-.MX
-Pascal compiler.
-.IT 6.9.5
-It shall be an error if the pre-assertion required for writeln(f) doe not
-hold prior to the invocation of page(f);
-.IS
-This error is detected (see put(f)).
-.in 0
-.SS "Extensions to the standard"
-.LP
-.ft I
-1. External routines
-.LP
-Except for the required directive 'forward' the 
-.MX
-Pascal compiler recognizes
-the directive 'extern'.
-This directive tells the compiler that the procedure block of this
-procedure will not be present in the current program.
-The code for the body of this procedure must be included at a later
-stage of the compilation process.
-.PP
-This feature allows one to build libraries containing often used routines.
-These routines do not have to be included in all the programs using them.
-Maintenance is much simpler if there is only one library module to be
-changed instead of many Pascal programs.
-.PP
-Another advantage is that these library modules may be written in a different
-language, for instance C.
-.PP
-The use of external routines, however, is dangerous.
-The compiler normally checks for the correct number and type of parameters
-when a procedure is called and for the result type of functions.
-If an external routine is called these checks are not sufficient,
-because the compiler can not check whether the procedure heading of the
-external routine as given in the Pascal program matches the actual routine
-implementation.
-It should be the loader's task to check this.
-However, the current loaders are not that smart.
-.PP
-For those who wish the use the interface between C and Pascal we
-give an incomplete list of corresponding formal parameters in C and Pascal.
-.SP
-.XS
-.ta +\w'function a(pars):type   'u
-\fBPascal      C\fR
-a:integer      int a
-a:char int a
-a:boolean      int a
-a:real double a
-a:^type        type *a
-var a:type     type *a
-procedure a(pars)      struct {
-            void (*a)() ;
-            char *static_link ;
-       }
-function a(pars):type  struct {
-            type (*a)() ;
-            char *static_link ;
-       }
-.DT
-.XE
-The Pascal runtime system uses the following algorithm when calling
-function/procedures passed as parameters.
-.XS
-if (static_link) {
-       (*a)(static_link, pars);
-} else {
-       (*a)(pars);
-}
-.XE
-.LP
-.ft I
-2. Separate compilation.
-.LP
-The compiler is able to (separately) compile a collection of declarations,
-procedures and functions to form a library.
-The library may be linked with the main program, compiled later.
-The syntax of these modules is
-.XS
-.in +\w'module = 'u
-.ti -\w'module = 'u
-module = [constant-definition-part]
-[type-definition-part]
-[var-declaration-part]
-[procedure-and-function-declaration-part]
-.in -\w'module = 'u
-.XE
-The compiler accepts a program or a module:
-.XS
-unit = program | module
-.XE
-All variables declared outside a module must be imported
-by parameters, even the files input and output.
-Access to a variable declared in a module is only possible
-using the procedures and functions declared in that same module.
-By giving the correct procedure/function heading followed by the
-directive 'extern' you may use procedures and functions declared in
-other units.
-.LP
-.ft I
-3. Assertions.
-.LP
-When the s-option is off, 
-.MX
-Pascal compiler recognizes an additional
-statement, the assertion.
-Assertions can be used as an aid in debugging
-and documentation.
-The syntax is:
-.XS
-assertion = 'assert' Boolean-expression
-.XE
-An assertion is a simple-statement, so
-.XS
-.in +\w'simple-statement = ['u
-.ti -\w'simple-statement = ['u
-simple-statement = [assignment-statement |
-procedure-statement |
-goto-statement |
-assertion
-.in -\w'['u
-]
-.in -\w'simple-statement = 'u
-.XE
-An assertion causes an error if the Boolean-expression is false.
-That is its only purpose.
-It does not change any of the variables, at least it should not.
-Therefore, do not use functions with side-effects in the Boolean-expression.
-If the a-option is turned on, then assertions are skipped by the
-compiler. 'assert' is not a word-symbol (keyword) and may be used as identifier.
-However, assignment to a variable and calling of a procedure with that
-name will be impossible.
-If the s-option is turned on, the compiler will not know a thing about
-assertions, so using assertions will then give a parse error.
-.LP
-.ft I
-4. Additional procedures.
-.LP
-Three additional standard procedures are available:
-.IP "halt:"
-a call of this procedure is equivalent to jumping to the
-end of your program.
-It is always the last statement executed.
-The exit status of the program may be supplied
-as optional argument.
-If not, it will be zero.
-.IP release:
-.IP mark:
-for most applications it is sufficient to use the heap as second stack.
-Mark and release are suited for this type of use, more suited than dispose.
-mark(p), with p of type pointer, stores the current value of the
-heap pointer in p. release(p), with p initialized by a call
-of mark(p), restores the heap pointer to its old value.
-All the heap objects, created by calls of new between the call of
-mark and the call of release, are removed and the space they used
-can be reallocated.
-Never use mark and release together with dispose!
-.RE
-.LP
-.ft I
-5. UNIX interfacing.
-.LP
-If the c-option is turned on, then some special features are available
-to simplify an interface with the UNIX environment.
-First of all, the compiler allows you to use a different type
-of string constants.
-These string constants are delimited by double quotes ('"').
-To put a double quote into these strings, you must repeat the double quote,
-like the single quote in normal string constants.
-These special string constants are terminated by a zero byte (chr(0)).
-The type of these constants is a pointer to a packed array of characters,
-with lower bound 1 and unknown upper bound.
-.br
-Secondly, the compiler predefines a new type identifier 'string' denoting
-this just described string type.
-.PP
-The only thing you can do with these features is declaration of
-constants and variables of type 'string'.
-String objects may not be allocated on the heap and string pointers
-may not be de-referenced.
-Still these strings are very useful in combination with external routines.
-The procedure write is extended to print these zero-terminated
-strings correctly.
-.LP
-.ft I
-6. Double length (32 bit) integers.
-.LP
-If the d-option is turned on, then the additional type 'long' is known
-to the compiler.
-Long variables have integer values in the
-range \(mi2147483648 .. +2147483647.
-Long constants can not be declared.
-Longs can not be used as control-variables.
-It is not allowed to form subranges of type long.
-All operations allowed on integers are also
-allowed on longs and are indicated by the same
-operators: '+', '-', '*', '/', 'div', 'mod'.
-The procedures read and write have been extended to handle long
-arguments correctly.
-It is possible to read longs from a file of integers
-and vice-versa, but only if longs and integers have the same size.
-The default width for longs is 11.
-The standard procedures 'abs' and 'sqr' have been extended to work
-on long arguments.
-Conversion from integer to long, long to real,
-real to long and long to integer are automatic, like the conversion
-from integer to real.
-These conversions may cause a
-.PP
-.RS
-conversion error, trap 10, non-fatal
-.RE
-.LP
-.ft I
-7. Underscore as letter.
-.LP
-The character '_' may be used in forming identifiers, if the u- or U-option
-is turned on.
-It is forbidden to start identifiers with underscores, since
-this may cause name-clashes with run-time routines.
-.LP
-.ft I
-8. Zero field width in write.
-.LP
-Zero TotalWidth arguments are allowed.
-In this case, no characters are written for
-character, string or Boolean type arguments.
-A zero FracDigits
-argument for fixed-point representation of reals causes the fraction and
-the character '.' to be suppressed.
-.LP
-.ft I
-9. Pre-processing.
-.LP
-If the very first character of a file containing a Pascal
-program is the sharp ('#', ASCII 23(hex)) the file is preprocessed
-in the same way as C programs.
-Lines beginning with a '#' are taken as preprocessor command lines
-and not fed to the Pascal compiler proper.
-C style comments, /*......*/, are removed by the C preprocessor,
-thus C comments inside Pascal programs are also removed when they
-are fed through the preprocessor.
-.in 0
-.SS "Deviations from the standard"
-.PP
-.MX
-Pascal deviates from the standard in the following ways:
-.IP 1.
-Standard procedures and functions are not allowed as parameters in 
-.MX
-Pascal.
-You can obtain the same result with negligible loss of performance
-by declaring some user routines like:
-.XS
-.CW
-function sine(x:real):real;
-begin
-    sine:=sin(x)
-end;
-.ft R
-.XE
-.IP 2.
-The standard procedures read, readln, write and writeln are implemented as
-word-symbols, and can therefore not be redeclared.
-.SS "Compiler options"
-.PP
-Some options of the compiler may be controlled by using '{$....}'.
-Each option consists of a lower case letter followed by +, \(mi or an unsigned
-number.
-Options are separated by commas.
-The following options exist:
-.IP a+/\(mi
-This option switches assertions on and off.
-If this option is on, then code is included to test these assertions
-at run time.
-Default +.
-.IP c+/\(mi
-This option, if on, allows you to use C-type string constants
-surrounded by double quotes.
-Moreover, a new type identifier 'string' is predefined.
-Default \(mi.
-.IP d+/\(mi
-This option, if on, allows you to use variables of type 'long'.
-Default \(mi.
-.IP i<num>
-.br
-With this flag the setsize for a set of integers can be
-manipulated.
-The number must be the number of bits per set.
-The default value is 16.
-.IP l+/\(mi
-If + then code is inserted to keep track of the source line number.
-When this flag is switched on and off, an incorrect line number may appear
-if the error occurs in a part of your program for which this flag is off.
-Default +.
-.IP r+/\(mi
-If + then code is inserted to check subrange variables against
-lower and upper subrange limits.
-Default +.
-.IP s+/\(mi
-If + then the compiler will hunt for places in your program
-where non-standard features are used, and for each place found
-it will generate a warning.
-Default \(mi.
-.IP t+/\(mi
-If + then each time a procedure is entered, the routine 'procentry' is
-called, and each time a procedure exits, the procedure 'procexit' is
-called.
-Both 'procentry' and 'procexit' have a 'string' as parameter.
-This means that when a user specifies his or her own procedures, the c-option
-must be used.
-Default procedures are present in the run time library.
-Default \(mi.
-.IP u+/\(mi
-If + then the character '_' is treated like a letter,
-so that it may be used in identifiers.
-Procedure and function identifiers are not allowed to start with an
-underscore because they may collide with library routine names.
-Default \(mi.
-.PP
-Some of these flags (c, d, i, s, u, C and U) are only effective when
-they appear before the 'program' symbol.
-The others may be switched
-on and off.
-.PP
-A very powerful debugging tool is the knowledge that inaccessible statements
-and useless tests are removed by the optimizer.
-For instance, a statement like:
-.XS
-.CW
-if debug then
-    writeln('initialization done');
-.ft R
-.XE
-is completely removed by the optimizer if debug is a constant with
-value false.
-The first line is removed if debug is a constant with value true.
-Of course, if debug is a variable nothing can be removed.
-.SS "Library routines"
-.PP
-The following library of external routines for Pascal programs is available:
-.nf
-.SP
-.CW
-.ta 12n
-const  bufsize = ?;
-type   br1 =  1..bufsize;
-       br2 =  0..bufsize;
-       br3 = -1..bufsize;
-       ok = -1..0;
-       buf = packed array[br1] of char;
-       alfa = packed array[1..8] of char;
-       string = ^packed array[1..?] of char;
-       filetype = file of ?;
-       long = ?;
-.SP
-{all routines must be declared extern}
-.SP
-function       argc:integer;
-function       argv(i:integer):string;
-function       environ(i:integer):string;
-procedure      argshift;
-.SP
-procedure      buff(var f:filetype);
-procedure      nobuff(var f:filetype);
-procedure      notext(var f:text);
-procedure      diag(var f:text);
-procedure      pcreat(var f:text; s:string);
-procedure      popen(var f:text; s:string);
-procedure      pclose(var f:filetype);
-.SP
-procedure      trap(err:integer);
-procedure      encaps(procedure p; procedure q(n:integer));
-.SP
-function       perrno:integer;
-function       uread(fd:integer; var b:buf; len:br1):br3;
-function       uwrite(fd:integer; var b:buf; len:br1):br3;
-.SP
-function       strbuf(var b:buf):string;
-function       strtobuf(s:string; var b:buf; len:br1):br2;
-function       strlen(s:string):integer;
-function       strfetch(s:string; i:integer):char;
-procedure      strstore(s:string; i:integer; c:char);
-.SP
-function       clock:integer;
-.fi
-.ft R
-.PP
-This library contains some often used external routines for Pascal programs.
-The routines can be divided into several categories:
-.PP
-.ti -2
-Argument control:
-.RS
-.IP argc 10
-Gives the number of arguments provided when the program is called.
-.IP argv
-Selects the specified argument from the argument list and returns a
-pointer to it.
-This pointer is nil if the index is out of bounds (<0 or >=argc).
-.IP environ
-Returns a pointer to the i-th environment string (i>=0).
-Returns nil
-if i is beyond the end of the environment list (UNIX version 7).
-.IP argshift
-Effectively deletes the first argument from the argument list.
-Its function is equivalent to \fIshift\fR in the UNIX shell: argv[2] becomes
-argv[1], argv[3] becomes argv[2], etc.
-It is a useful procedure to skip optional flag arguments.
-Note that the matching of arguments and files
-is done at the time a file is opened by a call to reset or rewrite.
-.PP
-.ti -2
-Additional file handling routines:
-.IP buff
-Turn on buffering of a file.
-Not very useful, because all
-files are buffered except standard output to a terminal and diagnostic output.
-Input files are always buffered.
-.IP nobuff
-Turn off buffering of an output file.
-It causes the current contents of the
-buffer to be flushed.
-.IP notext
-Only useful for input files.
-End of line characters are not replaced by a space and character codes out of
-the ASCII range (0..127) do not cause an error message.
-.IP diag
-Initialize a file for output on the diagnostic output stream (fd=2).
-Output is not buffered.
-.IP pcreat
-The same as rewrite(f), except that you must provide the file name yourself.
-The name must be zero terminated.
-Only text files are allowed.
-.IP popen
-The same as reset(f), except that you must provide the file name yourself.
-The name must be zero terminated.
-Only text files are allowed.
-.IP pclose
-Gives you the opportunity to close files hidden in records or arrays.
-All other files are closed automatically.
-.PP
-.ti -2
-String handling:
-.IP strbuf
-Type conversion from character array to string.
-It is your own responsibility that the string is zero terminated.
-.IP strtobuf
-Copy string into buffer until the string terminating zero byte
-is found or until the buffer if full, whatever comes first.
-The zero byte is also copied.
-The number of copied characters, excluding the zero byte, is returned.
-So if
-the result is equal to the buffer length, then the end of buffer is reached
-before the end of string.
-.IP strlen
-Returns the string length excluding the terminating zero byte.
-.IP strfetch
-Fetches the i-th character from a string.
-There is no check against the string length.
-.IP strstore
-Stores a character in a string.
-There is no check against
-string length, so this is a dangerous procedure.
-.PP
-.ti -2
-Trap handling:
-.PP
-These routines allow you to handle almost all
-the possible error situations yourself.
-You may define your own trap handler, replacing the
-default handler that produces an error message and quits.
-You may also generate traps yourself.
-.IP trap
-Trap generates the trap passed as argument (0..252).
-The trap numbers 128..252 may be used freely.
-The others are reserved.
-.IP encaps
-Encapsulate the execution of \fIp\fR with the trap handler \fIq\fR.
-Encaps replaces the previous trap handler by \fIq\fR, calls \fIp\fR
-and restores
-the previous handler when \fIp\fR returns.
-If, during the execution of \fIp\fR, a trap occurs,
-then \fIq\fR is called with the trap number as parameter.
-For the duration of \fIq\fR the previous trap handler is restored, so that
-you may handle only some of the errors in \fIq\fR.
-All the other errors must
-then be raised again by a call to \fItrap\fR.
-.br
-Encapsulations may be nested: you may encapsulate a procedure while executing
-an encapsulated routine.
-.br
-Jumping out of an encapsulated procedure (non-local goto) is dangerous,
-because the previous trap handler must be restored.
-Therefore, you may only jump out of procedure \fIp\fR from inside \fIq\fR and
-you may only jump out of one level of encapsulation.
-If you want to exit several levels of encapsulation, use traps.
-See pc_prlib(7) for lists of trap numbers
-for EM machine errors and Pascal run time system errors.
-Note that \fIp\fR may not have parameters.
-.PP
-.ti -2
-UNIX system calls:
-.IP uread
-Equal to the read system call.
-Its normal name is blocked by the standard Pascal routine read.
-.IP uwrite
-As above but for write(2).
-.IP perrno
-Because external data references are not possible in Pascal,
-this routine returns the global variable \fIerrno\fR, indicating the result of
-the last system call.
-.PP
-.ti -2
-Miscellaneous:
-.IP clock
-Return the number of ticks of user and system time consumed by the program.
-.PP
-The following program presents an example of how these routines can be used.
-This program is equivalent to the UNIX command cat(1).
-.nf
-.SP
-.CW
-{$c+}
-.CW
-program cat(input,inp,output);
-.CW
-var    inp:text;
-.CW
-       s:string;
-.SP
-.CW
-function argc:integer; extern;
-.CW
-function argv(i:integer):string; extern;
-.CW
-procedure argshift; extern;
-.CW
-function strlen(s:string):integer; extern;
-.CW
-function strfetch(s:string; i:integer):char; extern;
-.SP
-.CW
-procedure copy(var fi:text);
-.CW
-var c:char;
-.CW
-begin reset(fi);
-.CW
-  while not eof(fi) do
-.CW
-  begin
-.CW
-    while not eoln(fi) do
-.CW
-    begin
-.CW
-      read(fi,c);
-.CW
-      write(c)
-.CW
-    end;
-.CW
-    readln(fi);
-.CW
-    writeln
-.CW
-  end
-.CW
-end;
-.SP
-.CW
-begin  {main}
-.CW
-  if argc = 1 then
-.CW
-       copy(input)
-.CW
-  else
-.CW
-    repeat
-.CW
-      s := argv(1);
-.CW
-      if (strlen(s) = 1) and (strfetch(s,1) = '-')
-.CW
-      then copy(input)
-.CW
-      else copy(inp);
-.CW
-      argshift;
-.CW
-    until argc <= 1;
-.CW
-end.
-.fi
-.ft R
-.PP
-Another example gives some idea of the way to manage trap handling:
-.nf
-.SP
-.CW
-program bigreal(output);
-.CW
-const EFOVFL=4;
-.CW
-var trapped:boolean;
-.CW
-.SP
-.CW
-procedure encaps(procedure p; procedure q(n:integer)); extern;
-.CW
-procedure trap(n:integer); extern;
-.CW
-.SP
-.CW
-procedure traphandler(n:integer);
-.CW
-begin if n=EFOVFL then trapped:=true else trap(n) end;
-.CW
-.SP
-.CW
-procedure work;
-.CW
-var i,j:real;
-.CW
-begin trapped:=false; i:=1;
-.CW
-  while not trapped do
-.CW
-    begin j:=i; i:=i*2 end;
-.CW
-  writeln('bigreal = ',j);
-.CW
-end;
-.CW
-.SP
-.CW
-begin
-.CW
-  encaps(work,traphandler);
-.CW
-end.
-.fi
-.ft R
-.PP
-Two routines may cause fatal error messages to be generated.
-These are:
-.IP pcreat
-Rewrite error (trap 77) if the file cannot be created.
-.IP popen
-Reset error (trap 76) if the file cannot be opened for reading
-.SS References
-.IP [1]
-BSI standard BS 6192: 1982 (ISO 7185).
-.IP [2]
-A.S.Tanenbaum, J.W.Stevenson, Hans van Staveren, E.G.Keizer,
-"Description of a machine architecture for use with block structured languages",
-Informatica rapport IR-81.
index 1a59859b76a289ca2c22f49b14e4a25d030e6cc5..7a14c36d2cfd7343ef028ff9b0ca235e07b85c2b 100644 (file)
@@ -1,4 +1,4 @@
-MAN=   ACK.7 ascii.7 environ.7 hier.7 man.7  \
+MAN=   ascii.7 environ.7 hier.7 man.7  \
            \
            \
            \
diff --git a/nbsd_include/Makefile b/nbsd_include/Makefile
deleted file mode 100644 (file)
index 04309c7..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-#      $NetBSD: Makefile,v 1.133 2010/07/31 21:47:53 joerg Exp $
-#      @(#)Makefile    8.2 (Berkeley) 1/4/94
-
-# Doing a make includes builds /usr/include
-
-NOOBJ=         # defined
-
-# Missing: mp.h
-
-.if defined(__MINIX)
-# Avoid installing: kvm.h lwp.h sa.h (latter not installed anyway)
-INCS=  a.out.h aio.h ar.h assert.h atomic.h \
-       bitstring.h bm.h cdbr.h cdbw.h complex.h cpio.h ctype.h \
-       db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \
-       fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \
-       inttypes.h iso646.h langinfo.h libgen.h \
-       limits.h link.h link_aout.h link_elf.h locale.h \
-       login_cap.h malloc.h math.h md2.h \
-       memory.h mntopts.h monetary.h mpool.h mqueue.h \
-       ndbm.h netconfig.h netdb.h netgroup.h nlist.h nl_types.h nsswitch.h \
-       paths.h pwd.h randomid.h ranlib.h re_comp.h regex.h regexp.h \
-       resolv.h res_update.h rmt.h sched.h search.h semaphore.h setjmp.h \
-       sgtty.h signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \
-       strings.h stringlist.h struct.h sysexits.h tar.h time.h \
-       ttyent.h tzfile.h ucontext.h ulimit.h unistd.h util.h utime.h utmp.h \
-       utmpx.h uuid.h varargs.h vis.h wchar.h wctype.h wordexp.h
-
-INCS +=        ufs/chfs/chfs.h ufs/chfs/chfs_args.h ufs/chfs/chfs_inode.h \
-       ufs/chfs/chfs_pool.h ufs/chfs/debug.h ufs/chfs/ebh.h \
-       ufs/chfs/ebh_media.h ufs/chfs/ebh_misc.h ufs/chfs/media.h \
-       ufs/ext2fs/ext2fs.h ufs/ext2fs/ext2fs_dinode.h \
-       ufs/ext2fs/ext2fs_dir.h ufs/ext2fs/ext2fs_extern.h \
-       ufs/ffs/ffs_extern.h ufs/ffs/fs.h ufs/lfs/lfs.h \
-       ufs/lfs/lfs_extern.h ufs/mfs/mfs_extern.h ufs/mfs/mfsnode.h \
-       ufs/ufs/dinode.h ufs/ufs/dir.h ufs/ufs/dirhash.h \
-       ufs/ufs/extattr.h ufs/ufs/inode.h ufs/ufs/quota.h \
-       ufs/ufs/quota1.h ufs/ufs/quota2.h ufs/ufs/ufs_bswap.h \
-       ufs/ufs/ufs_extern.h ufs/ufs/ufs_quota.h ufs/ufs/ufs_wapbl.h \
-       ufs/ufs/ufsmount.h \
-
-.else
-INCS=  a.out.h aio.h ar.h assert.h atomic.h \
-       bitstring.h bm.h cdbr.h cdbw.h complex.h cpio.h ctype.h \
-       db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \
-       fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \
-       inttypes.h iso646.h kvm.h langinfo.h libgen.h \
-       limits.h link.h link_aout.h link_elf.h locale.h \
-       login_cap.h lwp.h malloc.h math.h md2.h \
-       memory.h mntopts.h monetary.h mpool.h mqueue.h \
-       ndbm.h netconfig.h netdb.h netgroup.h nlist.h nl_types.h nsswitch.h \
-       paths.h pwd.h randomid.h ranlib.h re_comp.h regex.h regexp.h \
-       resolv.h res_update.h rmt.h sched.h search.h semaphore.h setjmp.h \
-       sgtty.h signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \
-       strings.h stringlist.h struct.h sysexits.h tar.h time.h \
-       ttyent.h tzfile.h ucontext.h ulimit.h unistd.h util.h utime.h utmp.h \
-       utmpx.h uuid.h varargs.h vis.h wchar.h wctype.h wordexp.h
-.endif
-INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \
-       arpa/telnet.h arpa/tftp.h
-INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \
-       protocols/talkd.h protocols/timed.h
-
-INCS+= hesiod.h
-
-INCS+= rpcsvc/yp_prot.h rpcsvc/ypclnt.h
-
-INCS+=  ssp/ssp.h ssp/stdio.h ssp/string.h ssp/strings.h ssp/unistd.h
-
-.if (${MACHINE_ARCH} != "vax")
-INCS+= ieeefp.h
-.endif
-
-.include <bsd.own.mk>
-
-
-INCSDIR=       /usr/include
-
-.if defined(__MINIX)
-# RPC is not compiled in the libc. This include also needs
-# rpcgen, which can be compiled if needed.
-.else
-SUBDIR=                rpc
-.endif
-.if defined(__MINIX)
-SUBDIR+=       prop
-.else
-SUBDIR+=       ../common/include/prop
-.endif
-
-.if defined(__MINIX)
-.include "${MINIXSRCDIR}/common/include/Makefile.inc"
-SUBDIR+=       arch/${MACHINE}
-SUBDIR+=       arch sys minix
-SUBDIR+=       net netinet netinet6
-.endif
-
-.include <bsd.prog.mk>
-.include <bsd.subdir.mk>
diff --git a/nbsd_include/a.out.h b/nbsd_include/a.out.h
deleted file mode 100644 (file)
index 912cc3d..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*     $NetBSD: a.out.h,v 1.20 2009/08/16 17:12:47 pgoyette Exp $      */
-
-/*-
- * Copyright (c) 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. 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.
- *
- *     @(#)a.out.h     8.1 (Berkeley) 6/2/93
- */
-
-/*-
- * Copyright (c) 1993 Theo de Raadt.  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.
- *
- * 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, PROUREMENT 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.
- *
- *     @(#)a.out.h     8.1 (Berkeley) 6/2/93
- */
-
-#ifndef        _AOUT_H_
-#define        _AOUT_H_
-
-#ifdef __minix
-#include <compat/a.out.h>
-#else /* !__minix */
-
-#include <sys/exec_aout.h>
-
-#define        _AOUT_INCLUDE_
-#include <nlist.h>
-
-#endif /* !__minix */
-#endif /* !_AOUT_H_ */
diff --git a/nbsd_include/ar.h b/nbsd_include/ar.h
deleted file mode 100644 (file)
index 37d7347..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*     $NetBSD: ar.h,v 1.5 2003/08/07 09:44:09 agc Exp $       */
-
-/*-
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * This code is derived from software contributed to Berkeley by
- * Hugh Smith at The University of Guelph.
- *
- * 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. 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.
- *
- *     @(#)ar.h        8.2 (Berkeley) 1/21/94
- */
-
-#ifndef _AR_H_
-#define        _AR_H_
-
-/* Pre-4BSD archives had these magic numbers in them. */
-#define        OARMAG1 0177555
-#define        OARMAG2 0177545
-
-#define        ARMAG           "!<arch>\n"     /* ar "magic number" */
-#define        SARMAG          8               /* strlen(ARMAG); */
-
-#define        AR_EFMT1        "#1/"           /* extended format #1 */
-
-struct ar_hdr {
-       char ar_name[16];               /* name */
-       char ar_date[12];               /* modification time */
-       char ar_uid[6];                 /* user id */
-       char ar_gid[6];                 /* group id */
-       char ar_mode[8];                /* octal file permissions */
-       char ar_size[10];               /* size in bytes */
-#define        ARFMAG  "`\n"
-       char ar_fmag[2];                /* consistency check */
-};
-
-#endif /* !_AR_H_ */
diff --git a/nbsd_include/arch/Makefile b/nbsd_include/arch/Makefile
deleted file mode 100644 (file)
index d9989a0..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#      $NetBSD: Makefile,v 1.40 2009/12/13 05:01:33 nakayama Exp $
-
-# For now, we install the machine and arch includes, and symlink 'machine'
-# to the location of the machine includes (usually).
-#
-# Eventually, we should install everything.
-
-.include <bsd.own.mk>
-
-SUBDIR=        ${MACHINE}
-ARCHSUBDIR= ${MACHINE_CPU}
-
-.if ${ARCHSUBDIR} == "mips64"
-ARCHSUBDIR= mips
-.endif
-.if ${ARCHSUBDIR} == "powerpc64"
-ARCHSUBDIR= powerpc
-.endif
-
-.if ${MACHINE} != ${ARCHSUBDIR}
-.if exists(${ARCHSUBDIR})
-SUBDIR+= ${ARCHSUBDIR}
-.endif
-.endif
-.if ${MACHINE} == sparc
-SUBDIR+= sparc64
-.endif
-.if (${MACHINE} == hpcmips || ${MACHINE} == hpcsh)
-SUBDIR+= hpc
-.endif
-.if (${MACHINE} == sun2 || ${MACHINE} == sun3)
-SUBDIR+= sun68k
-.endif
-.if defined(XEN_BUILD)
-SUBDIR+= xen
-.endif
-
-#SUBDIR=acorn26 acorn32 algor alpha amiga amigappc arm arc atari \
-#      bebox \
-#      cats cesfic cobalt \
-#      dreamcast \
-#      evbarm evbmips evbppc evbsh3 ews4800mips\
-#      hp300 hpc hpcarm hpcmips hpcsh \
-#      i386 iyonix \
-#      luna68k \
-#      m68k mac68k macppc mips mipsco mmeye mvme68k \
-#      netwinder news68k newsmips next68k \
-#      ofppc \
-#      pmax powerpc prep \
-#      sandpoint sbmips sgimips sh3 shark sparc sparc64 sun2 sun3 sun68k \
-#      rs6000 \
-#      vax \
-#      x68k x86_64 xen \
-#      zaurus
-
-INCSYMLINKS= ${MACHINE} /usr/include/machine
-
-INCSYMLINKS+= machine/float.h /usr/include/float.h \
-       machine/stdarg.h /usr/include/stdarg.h
-
-
-.include <bsd.inc.mk>
diff --git a/nbsd_include/arch/i386/Makefile b/nbsd_include/arch/i386/Makefile
deleted file mode 100644 (file)
index 4aa9208..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#      $NetBSD: Makefile,v 1.38 2009/08/30 02:00:56 dyoung Exp $
-
-
-SUBDIR=        include ../x86/include
-
-.include <bsd.subdir.mk>
diff --git a/nbsd_include/arpa/inet.h b/nbsd_include/arpa/inet.h
deleted file mode 100644 (file)
index 0f2e9f2..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-/*     $NetBSD: inet.h,v 1.24 2008/06/21 20:12:49 christos Exp $       */
-
-/*
- * ++Copyright++ 1983, 1993
- * -
- * 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. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * -
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- * 
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- * -
- * --Copyright--
- */
-
-/*%
- *     @(#)inet.h      8.1 (Berkeley) 6/2/93
- *     Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp
- */
-
-#ifndef _ARPA_INET_H_
-#define        _ARPA_INET_H_
-
-/* External definitions for functions in inet(3) */
-
-#include <sys/ansi.h>
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <sys/types.h>
-
-#include <netinet/in.h>
-
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
-    defined(_NETBSD_SOURCE)
-#ifndef socklen_t
-typedef __socklen_t    socklen_t;
-#define socklen_t      __socklen_t
-#endif
-#endif /* _POSIX_C_SOURCE >= 200112 || XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */
-
-__BEGIN_DECLS
-in_addr_t       inet_addr(const char *);
-in_addr_t       inet_lnaof(struct in_addr);
-struct in_addr  inet_makeaddr(in_addr_t, in_addr_t);
-in_addr_t       inet_netof(struct in_addr);
-in_addr_t       inet_network(const char *);
-char           *inet_ntoa(struct in_addr);
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
-    defined(_NETBSD_SOURCE)
-const char     *inet_ntop(int, const void * __restrict,
-                               char * __restrict, socklen_t);
-int             inet_pton(int, const char * __restrict,
-                               void * __restrict);
-#endif
-#if defined(_NETBSD_SOURCE)
-int             inet_aton(const char *, struct in_addr *);
-char *          inet_neta(u_long, char *, size_t);
-char           *inet_net_ntop(int, const void *, int, char *, size_t);
-int             inet_net_pton(int, const char *, void *, size_t);
-char           *inet_cidr_ntop(int, const void *, int, char *, size_t);
-int             inet_cidr_pton(int, const char *, void *, int *);
-u_int           inet_nsap_addr(const char *, u_char *, int);
-char           *inet_nsap_ntoa(int, const u_char *, char *);
-#endif
-__END_DECLS
-
-#endif /* _ARPA_INET_H_ */
diff --git a/nbsd_include/arpa/nameser.h b/nbsd_include/arpa/nameser.h
deleted file mode 100644 (file)
index 1fcdbb9..0000000
+++ /dev/null
@@ -1,681 +0,0 @@
-/*     $NetBSD: nameser.h,v 1.25 2009/04/12 17:07:34 christos Exp $    */
-
-/*
- * Portions Copyright (C) 2004, 2005, 2008, 2009  Internet Systems Consortium, Inc. ("ISC")
- * Portions Copyright (C) 1996-2003  Internet Software Consortium.
- *
- * Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Copyright (c) 1983, 1989, 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. 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: nameser.h,v 1.16 2009/03/03 01:52:48 each Exp
- */
-
-#ifndef _ARPA_NAMESER_H_
-#define _ARPA_NAMESER_H_
-
-#define BIND_4_COMPAT
-
-#include <sys/param.h>
-#if (!defined(BSD)) || (BSD < 199306)
-# include <sys/bitypes.h>
-#else
-# include <sys/types.h>
-#endif
-#include <sys/cdefs.h>
-
-/*%
- * Revision information.  This is the release date in YYYYMMDD format.
- * It can change every day so the right thing to do with it is use it
- * in preprocessor commands such as "#if (__NAMESER > 19931104)".  Do not
- * compare for equality; rather, use it to determine whether your libbind.a
- * contains a new enough lib/nameser/ to support the feature you need.
- */
-
-#define __NAMESER      20090302        /*%< New interface version stamp. */
-/*
- * Define constants based on RFC0883, RFC1034, RFC 1035
- */
-#define NS_PACKETSZ    512     /*%< default UDP packet size */
-#define NS_MAXDNAME    1025    /*%< maximum domain name (presentation format)*/
-#define NS_MAXMSG      65535   /*%< maximum message size */
-#define NS_MAXCDNAME   255     /*%< maximum compressed domain name */
-#define NS_MAXLABEL    63      /*%< maximum length of domain label */
-#define NS_MAXLABELS   128     /*%< theoretical max #/labels per domain name */
-#define NS_MAXNNAME    256     /*%< maximum uncompressed (binary) domain name*/
-#define        NS_MAXPADDR     (sizeof "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
-#define NS_HFIXEDSZ    12      /*%< #/bytes of fixed data in header */
-#define NS_QFIXEDSZ    4       /*%< #/bytes of fixed data in query */
-#define NS_RRFIXEDSZ   10      /*%< #/bytes of fixed data in r record */
-#define NS_INT32SZ     4       /*%< #/bytes of data in a uint32_t */
-#define NS_INT16SZ     2       /*%< #/bytes of data in a uint16_t */
-#define NS_INT8SZ      1       /*%< #/bytes of data in a u_int8_t */
-#define NS_INADDRSZ    4       /*%< IPv4 T_A */
-#define NS_IN6ADDRSZ   16      /*%< IPv6 T_AAAA */
-#define NS_CMPRSFLGS   0xc0    /*%< Flag bits indicating name compression. */
-#define NS_DEFAULTPORT 53      /*%< For both TCP and UDP. */
-
-/*
- * These can be expanded with synonyms, just keep ns_parse.c:ns_parserecord()
- * in synch with it.
- */
-typedef enum __ns_sect {
-       ns_s_qd = 0,            /*%< Query: Question. */
-       ns_s_zn = 0,            /*%< Update: Zone. */
-       ns_s_an = 1,            /*%< Query: Answer. */
-       ns_s_pr = 1,            /*%< Update: Prerequisites. */
-       ns_s_ns = 2,            /*%< Query: Name servers. */
-       ns_s_ud = 2,            /*%< Update: Update. */
-       ns_s_ar = 3,            /*%< Query|Update: Additional records. */
-       ns_s_max = 4
-} ns_sect;
-
-/*%
- * Network name (compressed or not) type.  Equivilent to a pointer when used
- * in a function prototype.  Can be const'd.
- */
-typedef u_char ns_nname[NS_MAXNNAME];
-typedef const u_char *ns_nname_ct;
-typedef u_char *ns_nname_t;
-
-struct ns_namemap { ns_nname_ct base; int len; };
-typedef struct ns_namemap *ns_namemap_t;
-typedef const struct ns_namemap *ns_namemap_ct;
-
-/*%
- * This is a message handle.  It is caller allocated and has no dynamic data.
- * This structure is intended to be opaque to all but ns_parse.c, thus the
- * leading _'s on the member names.  Use the accessor functions, not the _'s.
- */
-typedef struct __ns_msg {
-       const u_char    *_msg, *_eom;
-       uint16_t        _id, _flags, _counts[ns_s_max];
-       const u_char    *_sections[ns_s_max];
-       ns_sect         _sect;
-       int             _rrnum;
-       const u_char    *_msg_ptr;
-} ns_msg;
-
-/*
- * This is a newmsg handle, used when constructing new messages with
- * ns_newmsg_init, et al.
- */
-struct ns_newmsg {
-       ns_msg          msg;
-       const u_char    *dnptrs[25];
-       const u_char    **lastdnptr;
-};
-typedef struct ns_newmsg ns_newmsg;
-
-/* Private data structure - do not use from outside library. */
-struct _ns_flagdata {  int mask, shift;  };
-extern struct _ns_flagdata _ns_flagdata[];
-
-/* Accessor macros - this is part of the public interface. */
-
-#define ns_msg_id(handle) ((handle)._id + 0)
-#define ns_msg_base(handle) ((handle)._msg + 0)
-#define ns_msg_end(handle) ((handle)._eom + 0)
-#define ns_msg_size(handle) ((size_t)((handle)._eom - (handle)._msg))
-#define ns_msg_count(handle, section) ((handle)._counts[section] + 0)
-
-/*%
- * This is a parsed record.  It is caller allocated and has no dynamic data.
- */
-typedef        struct __ns_rr {
-       char            name[NS_MAXDNAME];
-       uint16_t        type;
-       uint16_t        rr_class;
-       uint32_t        ttl;
-       uint16_t        rdlength;
-       const u_char *  rdata;
-} ns_rr;
-
-/*
- * Same thing, but using uncompressed network binary names, and real C types.
- */
-typedef        struct __ns_rr2 {
-       ns_nname        nname;
-       size_t          nnamel;
-       int             type;
-       int             rr_class;
-       u_int           ttl;
-       int             rdlength;
-       const u_char *  rdata;
-} ns_rr2;
-
-/* Accessor macros - this is part of the public interface. */
-#define ns_rr_name(rr) (((rr).name[0] != '\0') ? (rr).name : ".")
-#define ns_rr_nname(rr)        ((const ns_nname_t)(rr).nname)
-#define ns_rr_nnamel(rr) ((rr).nnamel + 0)
-#define ns_rr_type(rr) ((ns_type)((rr).type + 0))
-#define ns_rr_class(rr)        ((ns_class)((rr).rr_class + 0))
-#define ns_rr_ttl(rr)  ((u_long)(rr).ttl + 0)
-#define ns_rr_rdlen(rr)        ((size_t)(rr).rdlength + 0)
-#define ns_rr_rdata(rr)        ((rr).rdata + 0)
-
-/*%
- * These don't have to be in the same order as in the packet flags word,
- * and they can even overlap in some cases, but they will need to be kept
- * in synch with ns_parse.c:ns_flagdata[].
- */
-typedef enum __ns_flag {
-       ns_f_qr,                /*%< Question/Response. */
-       ns_f_opcode,            /*%< Operation code. */
-       ns_f_aa,                /*%< Authoritative Answer. */
-       ns_f_tc,                /*%< Truncation occurred. */
-       ns_f_rd,                /*%< Recursion Desired. */
-       ns_f_ra,                /*%< Recursion Available. */
-       ns_f_z,                 /*%< MBZ. */
-       ns_f_ad,                /*%< Authentic Data (DNSSEC). */
-       ns_f_cd,                /*%< Checking Disabled (DNSSEC). */
-       ns_f_rcode,             /*%< Response code. */
-       ns_f_max
-} ns_flag;
-
-/*%
- * Currently defined opcodes.
- */
-typedef enum __ns_opcode {
-       ns_o_query = 0,         /*%< Standard query. */
-       ns_o_iquery = 1,        /*%< Inverse query (deprecated/unsupported). */
-       ns_o_status = 2,        /*%< Name server status query (unsupported). */
-                               /* Opcode 3 is undefined/reserved. */
-       ns_o_notify = 4,        /*%< Zone change notification. */
-       ns_o_update = 5,        /*%< Zone update message. */
-       ns_o_max = 6
-} ns_opcode;
-
-/*%
- * Currently defined response codes.
- */
-typedef        enum __ns_rcode {
-       ns_r_noerror = 0,       /*%< No error occurred. */
-       ns_r_formerr = 1,       /*%< Format error. */
-       ns_r_servfail = 2,      /*%< Server failure. */
-       ns_r_nxdomain = 3,      /*%< Name error. */
-       ns_r_notimpl = 4,       /*%< Unimplemented. */
-       ns_r_refused = 5,       /*%< Operation refused. */
-       /* these are for BIND_UPDATE */
-       ns_r_yxdomain = 6,      /*%< Name exists */
-       ns_r_yxrrset = 7,       /*%< RRset exists */
-       ns_r_nxrrset = 8,       /*%< RRset does not exist */
-       ns_r_notauth = 9,       /*%< Not authoritative for zone */
-       ns_r_notzone = 10,      /*%< Zone of record different from zone section */
-       ns_r_max = 11,
-       /* The following are EDNS extended rcodes */
-       ns_r_badvers = 16,
-       /* The following are TSIG errors */
-       ns_r_badsig = 16,
-       ns_r_badkey = 17,
-       ns_r_badtime = 18
-} ns_rcode;
-
-/* BIND_UPDATE */
-typedef enum __ns_update_operation {
-       ns_uop_delete = 0,
-       ns_uop_add = 1,
-       ns_uop_max = 2
-} ns_update_operation;
-
-/*%
- * This structure is used for TSIG authenticated messages
- */
-struct ns_tsig_key {
-       char name[NS_MAXDNAME], alg[NS_MAXDNAME];
-       unsigned char *data;
-       int len;
-};
-typedef struct ns_tsig_key ns_tsig_key;
-
-/*%
- * This structure is used for TSIG authenticated TCP messages
- */
-struct ns_tcp_tsig_state {
-       int counter;
-       struct dst_key *key;
-       void *ctx;
-       unsigned char sig[NS_PACKETSZ];
-       int siglen;
-};
-typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
-
-#define NS_TSIG_FUDGE 300
-#define NS_TSIG_TCP_COUNT 100
-#define NS_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
-
-#define NS_TSIG_ERROR_NO_TSIG -10
-#define NS_TSIG_ERROR_NO_SPACE -11
-#define NS_TSIG_ERROR_FORMERR -12
-
-/*%
- * Currently defined type values for resources and queries.
- */
-typedef enum __ns_type {
-       ns_t_invalid = 0,       /*%< Cookie. */
-       ns_t_a = 1,             /*%< Host address. */
-       ns_t_ns = 2,            /*%< Authoritative server. */
-       ns_t_md = 3,            /*%< Mail destination. */
-       ns_t_mf = 4,            /*%< Mail forwarder. */
-       ns_t_cname = 5,         /*%< Canonical name. */
-       ns_t_soa = 6,           /*%< Start of authority zone. */
-       ns_t_mb = 7,            /*%< Mailbox domain name. */
-       ns_t_mg = 8,            /*%< Mail group member. */
-       ns_t_mr = 9,            /*%< Mail rename name. */
-       ns_t_null = 10,         /*%< Null resource record. */
-       ns_t_wks = 11,          /*%< Well known service. */
-       ns_t_ptr = 12,          /*%< Domain name pointer. */
-       ns_t_hinfo = 13,        /*%< Host information. */
-       ns_t_minfo = 14,        /*%< Mailbox information. */
-       ns_t_mx = 15,           /*%< Mail routing information. */
-       ns_t_txt = 16,          /*%< Text strings. */
-       ns_t_rp = 17,           /*%< Responsible person. */
-       ns_t_afsdb = 18,        /*%< AFS cell database. */
-       ns_t_x25 = 19,          /*%< X_25 calling address. */
-       ns_t_isdn = 20,         /*%< ISDN calling address. */
-       ns_t_rt = 21,           /*%< Router. */
-       ns_t_nsap = 22,         /*%< NSAP address. */
-       ns_t_nsap_ptr = 23,     /*%< Reverse NSAP lookup (deprecated). */
-       ns_t_sig = 24,          /*%< Security signature. */
-       ns_t_key = 25,          /*%< Security key. */
-       ns_t_px = 26,           /*%< X.400 mail mapping. */
-       ns_t_gpos = 27,         /*%< Geographical position (withdrawn). */
-       ns_t_aaaa = 28,         /*%< IPv6 Address. */
-       ns_t_loc = 29,          /*%< Location Information. */
-       ns_t_nxt = 30,          /*%< Next domain (security). */
-       ns_t_eid = 31,          /*%< Endpoint identifier. */
-       ns_t_nimloc = 32,       /*%< Nimrod Locator. */
-       ns_t_srv = 33,          /*%< Server Selection. */
-       ns_t_atma = 34,         /*%< ATM Address */
-       ns_t_naptr = 35,        /*%< Naming Authority PoinTeR */
-       ns_t_kx = 36,           /*%< Key Exchange */
-       ns_t_cert = 37,         /*%< Certification record */
-       ns_t_a6 = 38,           /*%< IPv6 address (experimental) */
-       ns_t_dname = 39,        /*%< Non-terminal DNAME */
-       ns_t_sink = 40,         /*%< Kitchen sink (experimentatl) */
-       ns_t_opt = 41,          /*%< EDNS0 option (meta-RR) */
-       ns_t_apl = 42,          /*%< Address prefix list (RFC3123) */
-       ns_t_ds = 43,           /*%< Delegation Signer */
-       ns_t_sshfp = 44,        /*%< SSH Fingerprint */
-       ns_t_ipseckey = 45,     /*%< IPSEC Key */
-       ns_t_rrsig = 46,        /*%< RRset Signature */
-       ns_t_nsec = 47,         /*%< Negative security */
-       ns_t_dnskey = 48,       /*%< DNS Key */
-       ns_t_dhcid = 49,        /*%< Dynamic host configuratin identifier */
-       ns_t_nsec3 = 50,        /*%< Negative security type 3 */
-       ns_t_nsec3param = 51,   /*%< Negative security type 3 parameters */
-       ns_t_hip = 55,          /*%< Host Identity Protocol */
-       ns_t_spf = 99,          /*%< Sender Policy Framework */
-       ns_t_tkey = 249,        /*%< Transaction key */
-       ns_t_tsig = 250,        /*%< Transaction signature. */
-       ns_t_ixfr = 251,        /*%< Incremental zone transfer. */
-       ns_t_axfr = 252,        /*%< Transfer zone of authority. */
-       ns_t_mailb = 253,       /*%< Transfer mailbox records. */
-       ns_t_maila = 254,       /*%< Transfer mail agent records. */
-       ns_t_any = 255,         /*%< Wildcard match. */
-       ns_t_zxfr = 256,        /*%< BIND-specific, nonstandard. */
-       ns_t_dlv = 32769,       /*%< DNSSEC look-aside validatation. */
-       ns_t_max = 65536
-} ns_type;
-
-/* Exclusively a QTYPE? (not also an RTYPE) */
-#define        ns_t_qt_p(t) (ns_t_xfr_p(t) || (t) == ns_t_any || \
-                     (t) == ns_t_mailb || (t) == ns_t_maila)
-/* Some kind of meta-RR? (not a QTYPE, but also not an RTYPE) */
-#define        ns_t_mrr_p(t) ((t) == ns_t_tsig || (t) == ns_t_opt)
-/* Exclusively an RTYPE? (not also a QTYPE or a meta-RR) */
-#define ns_t_rr_p(t) (!ns_t_qt_p(t) && !ns_t_mrr_p(t))
-#define ns_t_udp_p(t) ((t) != ns_t_axfr && (t) != ns_t_zxfr)
-#define ns_t_xfr_p(t) ((t) == ns_t_axfr || (t) == ns_t_ixfr || \
-                      (t) == ns_t_zxfr)
-
-/*%
- * Values for class field
- */
-typedef enum __ns_class {
-       ns_c_invalid = 0,       /*%< Cookie. */
-       ns_c_in = 1,            /*%< Internet. */
-       ns_c_2 = 2,             /*%< unallocated/unsupported. */
-       ns_c_chaos = 3,         /*%< MIT Chaos-net. */
-       ns_c_hs = 4,            /*%< MIT Hesiod. */
-       /* Query class values which do not appear in resource records */
-       ns_c_none = 254,        /*%< for prereq. sections in update requests */
-       ns_c_any = 255,         /*%< Wildcard match. */
-       ns_c_max = 65536
-} ns_class;
-
-/* DNSSEC constants. */
-
-typedef enum __ns_key_types {
-       ns_kt_rsa = 1,          /*%< key type RSA/MD5 */
-       ns_kt_dh  = 2,          /*%< Diffie Hellman */
-       ns_kt_dsa = 3,          /*%< Digital Signature Standard (MANDATORY) */
-       ns_kt_private = 254     /*%< Private key type starts with OID */
-} ns_key_types;
-
-typedef enum __ns_cert_types {
-       cert_t_pkix = 1,        /*%< PKIX (X.509v3) */
-       cert_t_spki = 2,        /*%< SPKI */
-       cert_t_pgp  = 3,        /*%< PGP */
-       cert_t_url  = 253,      /*%< URL private type */
-       cert_t_oid  = 254       /*%< OID private type */
-} ns_cert_types;
-
-/* Flags field of the KEY RR rdata. */
-#define        NS_KEY_TYPEMASK         0xC000  /*%< Mask for "type" bits */
-#define        NS_KEY_TYPE_AUTH_CONF   0x0000  /*%< Key usable for both */
-#define        NS_KEY_TYPE_CONF_ONLY   0x8000  /*%< Key usable for confidentiality */
-#define        NS_KEY_TYPE_AUTH_ONLY   0x4000  /*%< Key usable for authentication */
-#define        NS_KEY_TYPE_NO_KEY      0xC000  /*%< No key usable for either; no key */
-/* The type bits can also be interpreted independently, as single bits: */
-#define        NS_KEY_NO_AUTH          0x8000  /*%< Key unusable for authentication */
-#define        NS_KEY_NO_CONF          0x4000  /*%< Key unusable for confidentiality */
-#define        NS_KEY_RESERVED2        0x2000  /* Security is *mandatory* if bit=0 */
-#define        NS_KEY_EXTENDED_FLAGS   0x1000  /*%< reserved - must be zero */
-#define        NS_KEY_RESERVED4        0x0800  /*%< reserved - must be zero */
-#define        NS_KEY_RESERVED5        0x0400  /*%< reserved - must be zero */
-#define        NS_KEY_NAME_TYPE        0x0300  /*%< these bits determine the type */
-#define        NS_KEY_NAME_USER        0x0000  /*%< key is assoc. with user */
-#define        NS_KEY_NAME_ENTITY      0x0200  /*%< key is assoc. with entity eg host */
-#define        NS_KEY_NAME_ZONE        0x0100  /*%< key is zone key */
-#define        NS_KEY_NAME_RESERVED    0x0300  /*%< reserved meaning */
-#define        NS_KEY_RESERVED8        0x0080  /*%< reserved - must be zero */
-#define        NS_KEY_RESERVED9        0x0040  /*%< reserved - must be zero */
-#define        NS_KEY_RESERVED10       0x0020  /*%< reserved - must be zero */
-#define        NS_KEY_RESERVED11       0x0010  /*%< reserved - must be zero */
-#define        NS_KEY_SIGNATORYMASK    0x000F  /*%< key can sign RR's of same name */
-#define        NS_KEY_RESERVED_BITMASK ( NS_KEY_RESERVED2 | \
-                                 NS_KEY_RESERVED4 | \
-                                 NS_KEY_RESERVED5 | \
-                                 NS_KEY_RESERVED8 | \
-                                 NS_KEY_RESERVED9 | \
-                                 NS_KEY_RESERVED10 | \
-                                 NS_KEY_RESERVED11 )
-#define NS_KEY_RESERVED_BITMASK2 0xFFFF /*%< no bits defined here */
-
-/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */
-#define        NS_ALG_MD5RSA           1       /*%< MD5 with RSA */
-#define        NS_ALG_DH               2       /*%< Diffie Hellman KEY */
-#define        NS_ALG_DSA              3       /*%< DSA KEY */
-#define        NS_ALG_DSS              NS_ALG_DSA
-#define        NS_ALG_EXPIRE_ONLY      253     /*%< No alg, no security */
-#define        NS_ALG_PRIVATE_OID      254     /*%< Key begins with OID giving alg */
-
-/* Protocol values  */
-/* value 0 is reserved */
-#define NS_KEY_PROT_TLS         1
-#define NS_KEY_PROT_EMAIL       2
-#define NS_KEY_PROT_DNSSEC      3
-#define NS_KEY_PROT_IPSEC       4
-#define NS_KEY_PROT_ANY                255
-
-/* Signatures */
-#define        NS_MD5RSA_MIN_BITS       512    /*%< Size of a mod or exp in bits */
-#define        NS_MD5RSA_MAX_BITS      4096
-       /* Total of binary mod and exp */
-#define        NS_MD5RSA_MAX_BYTES     ((NS_MD5RSA_MAX_BITS+7/8)*2+3)
-       /* Max length of text sig block */
-#define        NS_MD5RSA_MAX_BASE64    (((NS_MD5RSA_MAX_BYTES+2)/3)*4)
-#define NS_MD5RSA_MIN_SIZE     ((NS_MD5RSA_MIN_BITS+7)/8)
-#define NS_MD5RSA_MAX_SIZE     ((NS_MD5RSA_MAX_BITS+7)/8)
-
-#define NS_DSA_SIG_SIZE         41
-#define NS_DSA_MIN_SIZE         213
-#define NS_DSA_MAX_BYTES        405
-
-/* Offsets into SIG record rdata to find various values */
-#define        NS_SIG_TYPE     0       /*%< Type flags */
-#define        NS_SIG_ALG      2       /*%< Algorithm */
-#define        NS_SIG_LABELS   3       /*%< How many labels in name */
-#define        NS_SIG_OTTL     4       /*%< Original TTL */
-#define        NS_SIG_EXPIR    8       /*%< Expiration time */
-#define        NS_SIG_SIGNED   12      /*%< Signature time */
-#define        NS_SIG_FOOT     16      /*%< Key footprint */
-#define        NS_SIG_SIGNER   18      /*%< Domain name of who signed it */
-
-/* How RR types are represented as bit-flags in NXT records */
-#define        NS_NXT_BITS 8
-#define        NS_NXT_BIT_SET(  n,p) (p[(n)/NS_NXT_BITS] |=  (0x80>>((n)%NS_NXT_BITS)))
-#define        NS_NXT_BIT_CLEAR(n,p) (p[(n)/NS_NXT_BITS] &= ~(0x80>>((n)%NS_NXT_BITS)))
-#define        NS_NXT_BIT_ISSET(n,p) (p[(n)/NS_NXT_BITS] &   (0x80>>((n)%NS_NXT_BITS)))
-#define NS_NXT_MAX 127
-
-/*%
- * EDNS0 extended flags and option codes, host order.
- */
-#define NS_OPT_DNSSEC_OK       0x8000U
-#define NS_OPT_NSID             3
-
-/*%
- * Inline versions of get/put short/long.  Pointer is advanced.
- */
-#define NS_GET16(s, cp) do { \
-       const u_char *t_cp = (const u_char *)(cp); \
-       (s) = ((uint16_t)t_cp[0] << 8) \
-           | ((uint16_t)t_cp[1]) \
-           ; \
-       (cp) += NS_INT16SZ; \
-} while (/*CONSTCOND*/0)
-
-#define NS_GET32(l, cp) do { \
-       const u_char *t_cp = (const u_char *)(cp); \
-       (l) = ((uint32_t)t_cp[0] << 24) \
-           | ((uint32_t)t_cp[1] << 16) \
-           | ((uint32_t)t_cp[2] << 8) \
-           | ((uint32_t)t_cp[3]) \
-           ; \
-       (cp) += NS_INT32SZ; \
-} while (/*CONSTCOND*/0)
-
-#define NS_PUT16(s, cp) do { \
-       uint32_t t_s = (uint32_t)(s); \
-       u_char *t_cp = (u_char *)(cp); \
-       *t_cp++ = t_s >> 8; \
-       *t_cp   = t_s; \
-       (cp) += NS_INT16SZ; \
-} while (/*CONSTCOND*/0)
-
-#define NS_PUT32(l, cp) do { \
-       uint32_t t_l = (uint32_t)(l); \
-       u_char *t_cp = (u_char *)(cp); \
-       *t_cp++ = t_l >> 24; \
-       *t_cp++ = t_l >> 16; \
-       *t_cp++ = t_l >> 8; \
-       *t_cp   = t_l; \
-       (cp) += NS_INT32SZ; \
-} while (/*CONSTCOND*/0)
-
-/*%
- * ANSI C identifier hiding for bind's lib/nameser.
- */
-#define        ns_msg_getflag          __ns_msg_getflag
-#define ns_get16               __ns_get16
-#define ns_get32               __ns_get32
-#define ns_put16               __ns_put16
-#define ns_put32               __ns_put32
-#define ns_initparse           __ns_initparse
-#define ns_skiprr              __ns_skiprr
-#define ns_parserr             __ns_parserr
-#define ns_parserr2            __ns_parserr2
-#define        ns_sprintrr             __ns_sprintrr
-#define        ns_sprintrrf            __ns_sprintrrf
-#define        ns_format_ttl           __ns_format_ttl
-#define        ns_parse_ttl            __ns_parse_ttl
-#define ns_datetosecs          __ns_datetosecs
-#define        ns_name_ntol            __ns_name_ntol
-#define        ns_name_ntop            __ns_name_ntop
-#define        ns_name_pton            __ns_name_pton
-#define        ns_name_pton2           __ns_name_pton2
-#define        ns_name_unpack          __ns_name_unpack
-#define        ns_name_unpack2         __ns_name_unpack2
-#define        ns_name_pack            __ns_name_pack
-#define        ns_name_compress        __ns_name_compress
-#define        ns_name_uncompress      __ns_name_uncompress
-#define        ns_name_skip            __ns_name_skip
-#define        ns_name_rollback        __ns_name_rollback
-#define        ns_name_length          __ns_name_length
-#define        ns_name_eq              __ns_name_eq
-#define        ns_name_owned           __ns_name_owned
-#define        ns_name_map             __ns_name_map
-#define        ns_name_labels          __ns_name_labels
-#define        ns_sign                 __ns_sign
-#define        ns_sign2                __ns_sign2
-#define        ns_sign_tcp             __ns_sign_tcp
-#define        ns_sign_tcp2            __ns_sign_tcp2
-#define        ns_sign_tcp_init        __ns_sign_tcp_init
-#define ns_find_tsig           __ns_find_tsig
-#define        ns_verify               __ns_verify
-#define        ns_verify_tcp           __ns_verify_tcp
-#define        ns_verify_tcp_init      __ns_verify_tcp_init
-#define        ns_samedomain           __ns_samedomain
-#define        ns_subdomain            __ns_subdomain
-#define        ns_makecanon            __ns_makecanon
-#define        ns_samename             __ns_samename
-#define        ns_newmsg_init          __ns_newmsg_init
-#define        ns_newmsg_copy          __ns_newmsg_copy
-#define        ns_newmsg_id            __ns_newmsg_id
-#define        ns_newmsg_flag          __ns_newmsg_flag
-#define        ns_newmsg_q             __ns_newmsg_q
-#define        ns_newmsg_rr            __ns_newmsg_rr
-#define        ns_newmsg_done          __ns_newmsg_done
-#define        ns_rdata_unpack         __ns_rdata_unpack
-#define        ns_rdata_equal          __ns_rdata_equal
-#define        ns_rdata_refers         __ns_rdata_refers
-
-__BEGIN_DECLS
-int            ns_msg_getflag(ns_msg, int);
-uint16_t       ns_get16(const u_char *);
-uint32_t       ns_get32(const u_char *);
-void           ns_put16(uint16_t, u_char *);
-void           ns_put32(uint32_t, u_char *);
-int            ns_initparse(const u_char *, int, ns_msg *);
-int            ns_skiprr(const u_char *, const u_char *, ns_sect, int);
-int            ns_parserr(ns_msg *, ns_sect, int, ns_rr *);
-int            ns_parserr2(ns_msg *, ns_sect, int, ns_rr2 *);
-int            ns_sprintrr(const ns_msg *, const ns_rr *,
-                                const char *, const char *, char *, size_t);
-int            ns_sprintrrf(const u_char *, size_t, const char *,
-                                 ns_class, ns_type, u_long, const u_char *,
-                                 size_t, const char *, const char *,
-                                 char *, size_t);
-int            ns_format_ttl(u_long, char *, size_t);
-int            ns_parse_ttl(const char *, u_long *);
-uint32_t       ns_datetosecs(const char *cp, int *errp);
-int            ns_name_ntol(const u_char *, u_char *, size_t);
-int            ns_name_ntop(const u_char *, char *, size_t);
-int            ns_name_pton(const char *, u_char *, size_t);
-int            ns_name_pton2(const char *, u_char *, size_t, size_t *);
-int            ns_name_unpack(const u_char *, const u_char *,
-                                   const u_char *, u_char *, size_t);
-int            ns_name_unpack2(const u_char *, const u_char *,
-                                    const u_char *, u_char *, size_t,
-                                    size_t *);
-int            ns_name_pack(const u_char *, u_char *, int,
-                                 const u_char **, const u_char **);
-int            ns_name_uncompress(const u_char *, const u_char *,
-                                       const u_char *, char *, size_t);
-int            ns_name_compress(const char *, u_char *, size_t,
-                                     const u_char **, const u_char **);
-int            ns_name_skip(const u_char **, const u_char *);
-void           ns_name_rollback(const u_char *, const u_char **,
-                                     const u_char **);
-#ifndef __LIBC12_SOURCE__
-int            ns_sign(u_char *, int *, int, int, void *,
-                            const u_char *, int, u_char *, int *, time_t)
-    __RENAME(__ns_sign50);
-int            ns_sign2(u_char *, int *, int, int, void *,
-                             const u_char *, int, u_char *, int *, time_t,
-                             u_char **, u_char **)
-    __RENAME(__ns_sign250);
-#endif
-ssize_t                ns_name_length(ns_nname_ct, size_t);
-int            ns_name_eq(ns_nname_ct, size_t, ns_nname_ct, size_t);
-int            ns_name_owned(ns_namemap_ct, int, ns_namemap_ct, int);
-int            ns_name_map(ns_nname_ct, size_t, ns_namemap_t, int);
-int            ns_name_labels(ns_nname_ct, size_t);
-int            ns_sign_tcp(u_char *, int *, int, int,
-                                ns_tcp_tsig_state *, int);
-int            ns_sign_tcp2(u_char *, int *, int, int,
-                                 ns_tcp_tsig_state *, int,
-                                 u_char **, u_char **);
-int            ns_sign_tcp_init(void *, const u_char *, int,
-                                       ns_tcp_tsig_state *);
-u_char         *ns_find_tsig(u_char *, u_char *);
-#ifndef __LIBC12_SOURCE__
-int            ns_verify(u_char *, int *, void *,
-                              const u_char *, int, u_char *, int *,
-                              time_t *, int)
-    __RENAME(__ns_verify50);
-#endif
-int            ns_verify_tcp(u_char *, int *, ns_tcp_tsig_state *, int);
-int            ns_verify_tcp_init(void *, const u_char *, int,
-                                       ns_tcp_tsig_state *);
-int            ns_samedomain(const char *, const char *);
-int            ns_subdomain(const char *, const char *);
-int            ns_makecanon(const char *, char *, size_t);
-int            ns_samename(const char *, const char *);
-int            ns_newmsg_init(u_char *buffer, size_t bufsiz, ns_newmsg *);
-int            ns_newmsg_copy(ns_newmsg *, ns_msg *);
-void           ns_newmsg_id(ns_newmsg *handle, uint16_t id);
-void           ns_newmsg_flag(ns_newmsg *handle, ns_flag flag, u_int value);
-int            ns_newmsg_q(ns_newmsg *handle, ns_nname_ct qname,
-                           ns_type qtype, ns_class qclass);
-int            ns_newmsg_rr(ns_newmsg *handle, ns_sect sect,
-                            ns_nname_ct name, ns_type type,
-                            ns_class rr_class, uint32_t ttl,
-                            uint16_t rdlen, const u_char *rdata);
-size_t         ns_newmsg_done(ns_newmsg *handle);
-ssize_t                ns_rdata_unpack(const u_char *, const u_char *, ns_type,
-                               const u_char *, size_t, u_char *, size_t);
-int            ns_rdata_equal(ns_type,
-                              const u_char *, size_t,
-                              const u_char *, size_t);
-int            ns_rdata_refers(ns_type,
-                               const u_char *, size_t,
-                               const u_char *);
-__END_DECLS
-
-#ifdef BIND_4_COMPAT
-#include <arpa/nameser_compat.h>
-#endif
-
-#endif /* !_ARPA_NAMESER_H_ */
diff --git a/nbsd_include/assert.h b/nbsd_include/assert.h
deleted file mode 100644 (file)
index 95d3034..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*     $NetBSD: assert.h,v 1.20 2008/11/02 14:27:44 christos Exp $     */
-
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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. 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.
- *
- *     @(#)assert.h    8.2 (Berkeley) 1/21/94
- */
-
-/*
- * Unlike other ANSI header files, <assert.h> may usefully be included
- * multiple times, with and without NDEBUG defined.
- */
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <sys/null.h>
-
-#undef assert
-
-#ifdef NDEBUG
-# ifndef __lint__
-#  define assert(e)    (__static_cast(void,0))
-# else /* !__lint__ */
-#  define assert(e)
-# endif /* __lint__ */
-#else /* !NDEBUG */
-# if __STDC__
-#  define assert(e)                                                    \
-       ((e) ? __static_cast(void,0) : __assert13(__FILE__, __LINE__,   \
-                                                 __assert_function__, #e))
-# else /* PCC */
-#  define assert(e)                                                    \
-       ((e) ? __static_cast(void,0) : __assert13(__FILE__, __LINE__,   \
-                                                 __assert_function__, "e"))
-# endif /* !__STDC__ */
-#endif /* NDEBUG */
-
-#undef _DIAGASSERT
-#if !defined(_DIAGNOSTIC)
-# if !defined(__lint__)
-#  define _DIAGASSERT(e) (__static_cast(void,0))
-# else /* !__lint__ */
-#  define _DIAGASSERT(e)
-# endif /* __lint__ */
-#else /* _DIAGNOSTIC */
-# if __STDC__
-#  define _DIAGASSERT(e)                                               \
-       ((e) ? __static_cast(void,0) : __diagassert13(__FILE__, __LINE__, \
-                                                     __assert_function__, #e))
-# else /* !__STDC__ */
-#  define _DIAGASSERT(e)                                               \
-       ((e) ? __static_cast(void,0) : __diagassert13(__FILE__, __LINE__, \
-                                                     __assert_function__, "e"))
-# endif
-#endif /* _DIAGNOSTIC */
-
-
-#if defined(__lint__)
-#define        __assert_function__     (__static_cast(const void *,0))
-#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#define        __assert_function__     __func__
-#elif __GNUC_PREREQ__(2, 6)
-#define        __assert_function__     __PRETTY_FUNCTION__
-#else
-#define        __assert_function__     (__static_cast(const void *,0))
-#endif
-
-#ifndef __ASSERT_DECLARED
-#define __ASSERT_DECLARED
-__BEGIN_DECLS
-void __assert(const char *, int, const char *);
-void __assert13(const char *, int, const char *, const char *);
-void __diagassert(const char *, int, const char *);
-void __diagassert13(const char *, int, const char *, const char *);
-__END_DECLS
-#endif /* __ASSERT_DECLARED */
diff --git a/nbsd_include/complex.h b/nbsd_include/complex.h
deleted file mode 100644 (file)
index 332be6f..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */
-
-/*
- * Written by Matthias Drochner.
- * Public domain.
- */
-
-#ifndef        _COMPLEX_H
-#define        _COMPLEX_H
-
-#define complex _Complex
-#define _Complex_I 1.0fi
-#define I _Complex_I
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-
-/* 7.3.5 Trigonometric functions */
-/* 7.3.5.1 The cacos functions */
-double complex cacos(double complex);
-float complex cacosf(float complex);
-
-/* 7.3.5.2 The casin functions */
-double complex casin(double complex);
-float complex casinf(float complex);
-
-/* 7.3.5.1 The catan functions */
-double complex catan(double complex);
-float complex catanf(float complex);
-
-/* 7.3.5.1 The ccos functions */
-double complex ccos(double complex);
-float complex ccosf(float complex);
-
-/* 7.3.5.1 The csin functions */
-double complex csin(double complex);
-float complex csinf(float complex);
-
-/* 7.3.5.1 The ctan functions */
-double complex ctan(double complex);
-float complex ctanf(float complex);
-
-/* 7.3.6 Hyperbolic functions */
-/* 7.3.6.1 The cacosh functions */
-double complex cacosh(double complex);
-float complex cacoshf(float complex);
-
-/* 7.3.6.2 The casinh functions */
-double complex casinh(double complex);
-float complex casinhf(float complex);
-
-/* 7.3.6.3 The catanh functions */
-double complex catanh(double complex);
-float complex catanhf(float complex);
-
-/* 7.3.6.4 The ccosh functions */
-double complex ccosh(double complex);
-float complex ccoshf(float complex);
-
-/* 7.3.6.5 The csinh functions */
-double complex csinh(double complex);
-float complex csinhf(float complex);
-
-/* 7.3.6.6 The ctanh functions */
-double complex ctanh(double complex);
-float complex ctanhf(float complex);
-
-/* 7.3.7 Exponential and logarithmic functions */
-/* 7.3.7.1 The cexp functions */
-double complex cexp(double complex);
-float complex cexpf(float complex);
-
-/* 7.3.7.2 The clog functions */
-double complex clog(double complex);
-float complex clogf(float complex);
-
-/* 7.3.8 Power and absolute-value functions */
-/* 7.3.8.1 The cabs functions */
-#ifndef __LIBM0_SOURCE__
-/* avoid conflict with historical cabs(struct complex) */
-double cabs(double complex) __RENAME(__c99_cabs);
-float cabsf(float complex) __RENAME(__c99_cabsf);
-#endif
-
-/* 7.3.8.2 The cpow functions */
-double complex cpow(double complex, double complex);
-float complex cpowf(float complex, float complex);
-
-/* 7.3.8.3 The csqrt functions */
-double complex csqrt(double complex);
-float complex csqrtf(float complex);
-
-/* 7.3.9 Manipulation functions */
-/* 7.3.9.1 The carg functions */ 
-double carg(double complex);
-float cargf(float complex);
-
-/* 7.3.9.2 The cimag functions */
-double cimag(double complex);
-float cimagf(float complex);
-long double cimagl(long double complex);
-
-/* 7.3.9.3 The conj functions */
-double complex conj(double complex);
-float complex conjf(float complex);
-long double complex conjl(long double complex);
-
-/* 7.3.9.4 The cproj functions */
-double complex cproj(double complex);
-float complex cprojf(float complex);
-long double complex cprojl(long double complex);
-
-/* 7.3.9.5 The creal functions */
-double creal(double complex);
-float crealf(float complex);
-long double creall(long double complex);
-
-__END_DECLS
-
-#endif /* ! _COMPLEX_H */
diff --git a/nbsd_include/ctype.h b/nbsd_include/ctype.h
deleted file mode 100644 (file)
index daef1b8..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*     $NetBSD: ctype.h,v 1.31 2010/06/01 13:52:08 tnozaki Exp $       */
-
-/*
- * Copyright (c) 1989 The Regents of the University of California.
- * All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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. 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.
- *
- *     @(#)ctype.h     5.3 (Berkeley) 4/3/91
- */
-
-#ifndef _CTYPE_H_
-#define _CTYPE_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-
-__BEGIN_DECLS
-int    isalnum(int);
-int    isalpha(int);
-int    iscntrl(int);
-int    isdigit(int);
-int    isgraph(int);
-int    islower(int);
-int    isprint(int);
-int    ispunct(int);
-int    isspace(int);
-int    isupper(int);
-int    isxdigit(int);
-int    tolower(int);
-int    toupper(int);
-
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-int    isascii(int);
-int    toascii(int);
-int    _tolower(int);
-int    _toupper(int);
-#endif
-
-#if defined(_ISOC99_SOURCE) || (_POSIX_C_SOURCE - 0) > 200112L || \
-    (_XOPEN_SOURCE - 0) > 600 || defined(_NETBSD_SOURCE)
-int    isblank(int);
-#endif
-__END_DECLS
-
-#if defined(_NETBSD_SOURCE) && !defined(_CTYPE_NOINLINE)
-#include <sys/ctype_inline.h>
-#endif
-
-#endif /* !_CTYPE_H_ */
diff --git a/nbsd_include/db.h b/nbsd_include/db.h
deleted file mode 100644 (file)
index 6e2fb7d..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*     $NetBSD: db.h,v 1.24 2008/08/26 21:18:38 joerg Exp $    */
-
-/*-
- * Copyright (c) 1990, 1993, 1994
- *     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. 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.
- *
- *     @(#)db.h        8.7 (Berkeley) 6/16/94
- */
-
-#ifndef _DB_H_
-#define        _DB_H_
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-
-#include <limits.h>
-
-#define        RET_ERROR       -1              /* Return values. */
-#define        RET_SUCCESS      0
-#define        RET_SPECIAL      1
-
-#define        MAX_PAGE_NUMBER 0xffffffff      /* >= # of pages in a file */
-typedef uint32_t       pgno_t;
-#define        MAX_PAGE_OFFSET 65535           /* >= # of bytes in a page */
-typedef uint16_t       indx_t;
-#define        MAX_REC_NUMBER  0xffffffff      /* >= # of records in a tree */
-typedef uint32_t       recno_t;
-
-/* Key/data structure -- a Data-Base Thang. */
-typedef struct {
-       void    *data;                  /* data */
-       size_t   size;                  /* data length */
-} DBT;
-
-/* Routine flags. */
-#define        R_CURSOR        1               /* del, put, seq */
-#define        __R_UNUSED      2               /* UNUSED */
-#define        R_FIRST         3               /* seq */
-#define        R_IAFTER        4               /* put (RECNO) */
-#define        R_IBEFORE       5               /* put (RECNO) */
-#define        R_LAST          6               /* seq (BTREE, RECNO) */
-#define        R_NEXT          7               /* seq */
-#define        R_NOOVERWRITE   8               /* put */
-#define        R_PREV          9               /* seq (BTREE, RECNO) */
-#define        R_SETCURSOR     10              /* put (RECNO) */
-#define        R_RECNOSYNC     11              /* sync (RECNO) */
-
-typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
-
-/*
- * !!!
- * The following flags are included in the dbopen(3) call as part of the
- * open(2) flags.  In order to avoid conflicts with the open flags, start
- * at the top of the 16 or 32-bit number space and work our way down.  If
- * the open flags were significantly expanded in the future, it could be
- * a problem.  Wish I'd left another flags word in the dbopen call.
- *
- * !!!
- * None of this stuff is implemented yet.  The only reason that it's here
- * is so that the access methods can skip copying the key/data pair when
- * the DB_LOCK flag isn't set.
- */
-#if UINT_MAX > 65535
-#define        DB_LOCK         0x20000000      /* Do locking. */
-#define        DB_SHMEM        0x40000000      /* Use shared memory. */
-#define        DB_TXN          0x80000000      /* Do transactions. */
-#else
-#define        DB_LOCK             0x2000      /* Do locking. */
-#define        DB_SHMEM            0x4000      /* Use shared memory. */
-#define        DB_TXN              0x8000      /* Do transactions. */
-#endif
-
-/* Access method description structure. */
-typedef struct __db {
-       DBTYPE type;                    /* Underlying db type. */
-       int (*close)    (struct __db *);
-       int (*del)      (const struct __db *, const DBT *, unsigned int);
-       int (*get)      (const struct __db *, const DBT *, DBT *, unsigned int);
-       int (*put)      (const struct __db *, DBT *, const DBT *, unsigned int);
-       int (*seq)      (const struct __db *, DBT *, DBT *, unsigned int);
-       int (*sync)     (const struct __db *, unsigned int);
-       void *internal;                 /* Access method private. */
-       int (*fd)       (const struct __db *);
-} DB;
-
-#define        BTREEMAGIC      0x053162
-#define        BTREEVERSION    3
-
-/* Structure used to pass parameters to the btree routines. */
-typedef struct {
-#define        R_DUP           0x01    /* duplicate keys */
-       unsigned long   flags;
-       unsigned int    cachesize;      /* bytes to cache */
-       int             maxkeypage;     /* maximum keys per page */
-       int             minkeypage;     /* minimum keys per page */
-       unsigned int    psize;          /* page size */
-       int     (*compare)      /* comparison function */
-               (const DBT *, const DBT *);
-       size_t  (*prefix)       /* prefix function */
-               (const DBT *, const DBT *);
-       int     lorder;         /* byte order */
-} BTREEINFO;
-
-#define        HASHMAGIC       0x061561
-#define        HASHVERSION     2
-
-/* Structure used to pass parameters to the hashing routines. */
-typedef struct {
-       unsigned int    bsize;          /* bucket size */
-       unsigned int    ffactor;        /* fill factor */
-       unsigned int    nelem;          /* number of elements */
-       unsigned int    cachesize;      /* bytes to cache */
-       uint32_t                /* hash function */
-               (*hash)(const void *, size_t);
-       int     lorder;         /* byte order */
-} HASHINFO;
-
-/* Structure used to pass parameters to the record routines. */
-typedef struct {
-#define        R_FIXEDLEN      0x01    /* fixed-length records */
-#define        R_NOKEY         0x02    /* key not required */
-#define        R_SNAPSHOT      0x04    /* snapshot the input */
-       unsigned long   flags;
-       unsigned int    cachesize;      /* bytes to cache */
-       unsigned int    psize;          /* page size */
-       int             lorder;         /* byte order */
-       size_t          reclen;         /* record length (fixed-length records) */
-       uint8_t         bval;           /* delimiting byte (variable-length records */
-       char            *bfname;        /* btree file name */ 
-} RECNOINFO;
-
-#ifdef __DBINTERFACE_PRIVATE
-/*
- * Little endian <==> big endian 32-bit swap macros.
- *     M_32_SWAP       swap a memory location
- *     P_32_SWAP       swap a referenced memory location
- *     P_32_COPY       swap from one location to another
- */
-#define        M_32_SWAP(a) {                                                  \
-       uint32_t _tmp = a;                                              \
-       ((char *)(void *)&a)[0] = ((char *)(void *)&_tmp)[3];           \
-       ((char *)(void *)&a)[1] = ((char *)(void *)&_tmp)[2];           \
-       ((char *)(void *)&a)[2] = ((char *)(void *)&_tmp)[1];           \
-       ((char *)(void *)&a)[3] = ((char *)(void *)&_tmp)[0];           \
-}
-#define        P_32_SWAP(a) {                                                  \
-       char  _tmp[4];                                                  \
-       _tmp[0] = ((char *)(void *)a)[0];                               \
-       _tmp[1] = ((char *)(void *)a)[1];                               \
-       _tmp[2] = ((char *)(void *)a)[2];                               \
-       _tmp[3] = ((char *)(void *)a)[3];                               \
-       ((char *)(void *)a)[0] = _tmp[3];                               \
-       ((char *)(void *)a)[1] = _tmp[2];                               \
-       ((char *)(void *)a)[2] = _tmp[1];                               \
-       ((char *)(void *)a)[3] = _tmp[0];                               \
-}
-#define        P_32_COPY(a, b) {                                               \
-       ((char *)(void *)&(b))[0] = ((char *)(void *)&(a))[3];          \
-       ((char *)(void *)&(b))[1] = ((char *)(void *)&(a))[2];          \
-       ((char *)(void *)&(b))[2] = ((char *)(void *)&(a))[1];          \
-       ((char *)(void *)&(b))[3] = ((char *)(void *)&(a))[0];          \
-}
-
-/*
- * Little endian <==> big endian 16-bit swap macros.
- *     M_16_SWAP       swap a memory location
- *     P_16_SWAP       swap a referenced memory location
- *     P_16_COPY       swap from one location to another
- */
-#define        M_16_SWAP(a) {                                                  \
-       uint16_t _tmp = a;                                              \
-       ((char *)(void *)&a)[0] = ((char *)(void *)&_tmp)[1];           \
-       ((char *)(void *)&a)[1] = ((char *)(void *)&_tmp)[0];           \
-}
-#define        P_16_SWAP(a) {                                                  \
-       char  _tmp[2];                                                  \
-       _tmp[0] = ((char *)(void *)a)[0];                               \
-       _tmp[1] = ((char *)(void *)a)[1];                               \
-       ((char *)(void *)a)[0] = _tmp[1];                               \
-       ((char *)(void *)a)[1] = _tmp[0];                               \
-}
-#define        P_16_COPY(a, b) {                                               \
-       ((char *)(void *)&(b))[0] = ((char *)(void *)&(a))[1];          \
-       ((char *)(void *)&(b))[1] = ((char *)(void *)&(a))[0];          \
-}
-#endif
-
-__BEGIN_DECLS
-DB *dbopen(const char *, int, mode_t, DBTYPE, const void *);
-
-#ifdef __DBINTERFACE_PRIVATE
-
-#define _DBMASK(a) (~((1ULL << (sizeof(a) * NBBY)) - 1))
-#define _DBFIT(a, t) _DIAGASSERT(((a) & _DBMASK(t)) == 0)
-
-DB     *__bt_open(const char *, int, mode_t, const BTREEINFO *, int);
-DB     *__hash_open(const char *, int, mode_t, const HASHINFO *, int);
-DB     *__rec_open(const char *, int, mode_t, const RECNOINFO *, int);
-void    __dbpanic(DB *);
-#endif
-__END_DECLS
-#endif /* !_DB_H_ */
diff --git a/nbsd_include/dirent.h b/nbsd_include/dirent.h
deleted file mode 100644 (file)
index f1c2ae3..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*     $NetBSD: dirent.h,v 1.34 2010/09/26 02:26:59 yamt Exp $ */
-
-/*-
- * Copyright (c) 1989, 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. 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.
- *
- *     @(#)dirent.h    8.2 (Berkeley) 7/28/94
- */
-
-#ifndef _DIRENT_H_
-#define _DIRENT_H_
-
-#include <sys/featuretest.h>
-#include <sys/types.h>
-
-/*
- * The kernel defines the format of directory entries returned by 
- * the getdents(2) system call.
- */
-#include <sys/dirent.h>
-
-#ifndef __minix
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-#define        d_ino           d_fileno        /* backward compatibility */
-#endif
-#endif /* !__minix */
-
-typedef struct _dirdesc DIR;
-
-#if defined(_NETBSD_SOURCE)
-
-/* definitions for library routines operating on directories. */
-#define        DIRBLKSIZ       1024
-
-/* structure describing an open directory. */
-struct _dirdesc {
-       int     dd_fd;          /* file descriptor associated with directory */
-       long    dd_loc;         /* offset in current buffer */
-       long    dd_size;        /* amount of data returned by getdents */
-       char    *dd_buf;        /* data buffer */
-       int     dd_len;         /* size of data buffer */
-       off_t   dd_seek;        /* magic cookie returned by getdents */
-       void    *dd_internal;   /* state for seekdir/telldir */
-       int     dd_flags;       /* flags for readdir */
-       void    *dd_lock;       /* lock for concurrent access */
-};
-
-#define        dirfd(dirp)     ((dirp)->dd_fd)
-
-/* flags for __opendir2() */
-#define DTF_HIDEW      0x0001  /* hide whiteout entries */
-#define DTF_NODUP      0x0002  /* don't return duplicate names */
-#define DTF_REWIND     0x0004  /* rewind after reading union stack */
-#define __DTF_READALL  0x0008  /* everything has been read */
-#define __DTF_RETRY_ON_BADCOOKIE 0x0001        /* retry on EINVAL
-                                       (only valid with __DTF_READALL) */
-
-#include <sys/null.h>
-
-#endif
-
-#ifndef _KERNEL
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int closedir(DIR *);
-void rewinddir(DIR *);
-#ifndef __LIBC12_SOURCE__
-DIR *opendir(const char *) __RENAME(__opendir30);
-struct dirent *readdir(DIR *) __RENAME(__readdir30);
-int readdir_r(DIR * __restrict, struct dirent * __restrict,
-    struct dirent ** __restrict) __RENAME(__readdir_r30);
-#endif
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-void seekdir(DIR *, long);
-long telldir(DIR *);
-#endif /* defined(_NETBSD_SOURCE) || defined(_XOPEN_SOURCE) */
-#if defined(_NETBSD_SOURCE)
-#ifndef __LIBC12_SOURCE__
-DIR *fdopendir(int);
-DIR *__opendir2(const char *, int) __RENAME(__opendir230);
-int scandir(const char *, struct dirent ***,
-    int (*)(const struct dirent *), int (*)(const void *, const void *))
-    __RENAME(__scandir30);
-int getdents(int, char *, size_t) __RENAME(__getdents30);
-int alphasort(const void *, const void *) __RENAME(__alphasort30);
-#endif
-#endif /* defined(_NETBSD_SOURCE) */
-__END_DECLS
-
-#endif /* !_KERNEL */
-
-#endif /* !_DIRENT_H_ */
diff --git a/nbsd_include/err.h b/nbsd_include/err.h
deleted file mode 100644 (file)
index b29a971..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*     $NetBSD: err.h,v 1.15 2010/02/25 18:37:12 joerg Exp $   */
-
-/*-
- * Copyright (c) 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. 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.
- *
- *     @(#)err.h       8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _ERR_H_
-#define        _ERR_H_
-
-/*
- * Don't use va_list in the err/warn prototypes.   Va_list is typedef'd in two
- * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
- * of them here we may collide with the utility's includes.  It's unreasonable
- * for utilities to have to include one of them to include err.h, so we get
- * _BSD_VA_LIST_ from <machine/ansi.h> and use it.
- */
-#include <machine/ansi.h>
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-__dead void    err(int, const char *, ...)
-                    __printflike(2, 3) __dead;
-__dead void    verr(int, const char *, _BSD_VA_LIST_)
-                   __printflike(2, 0) __dead;
-__dead void    errx(int, const char *, ...)
-                    __printflike(2, 3) __dead;
-__dead void    verrx(int, const char *, _BSD_VA_LIST_)
-                   __printflike(2, 0) __dead;
-void           warn(const char *, ...)
-                   __printflike(1, 2);
-void           vwarn(const char *, _BSD_VA_LIST_)
-                   __printflike(1, 0);
-void           warnx(const char *, ...)
-                   __printflike(1, 2);
-void           vwarnx(const char *, _BSD_VA_LIST_)
-                   __printflike(1, 0);
-__END_DECLS
-
-#endif /* !_ERR_H_ */
diff --git a/nbsd_include/errno.h b/nbsd_include/errno.h
deleted file mode 100644 (file)
index d343d63..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/*     $NetBSD: errno.h,v 1.11 2008/03/03 06:57:48 dholland Exp $      */
-
-/*
- * Copyright (c) 1982, 1986, 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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. 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: @(#)errno.h       8.5 (Berkeley) 1/21/94
- */
-
-#ifndef _ERRNO_H_
-#define _ERRNO_H_
-
-#include <sys/cdefs.h>
-#include <sys/errno.h>
-#include <sys/featuretest.h>
-
-__BEGIN_DECLS
-
-/* note: this appears in both errno.h and signal.h */
-#ifndef __errno
-int *__errno(void);
-#define __errno __errno
-#endif
-
-#ifndef errno
-#define errno (*__errno())
-#endif
-
-#if defined(_NETBSD_SOURCE)
-#ifndef __LIBC12_SOURCE__
-extern const int sys_nerr __RENAME(__sys_nerr14);
-extern const char *const *sys_errlist __RENAME(__sys_errlist14);
-#endif
-#endif
-__END_DECLS
-
-#endif /* !_ERRNO_H_ */
diff --git a/nbsd_include/fenv.h b/nbsd_include/fenv.h
deleted file mode 100644 (file)
index dcae51e..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*     $NetBSD: fenv.h,v 1.2 2010/08/02 17:49:04 joerg Exp $   */
-/*
- * Copyright (c) 2010 The NetBSD Foundation, Inc.
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#if !defined(__i386__) && !defined(__amd64__)
-#error "fenv.h is currently not supported for this architecture"
-#endif
-
-#ifndef _FENV_H_
-#define _FENV_H_
-
-#include <machine/fenv.h>
-
-__BEGIN_DECLS
-
-/* Function prototypes */
-int    feclearexcept(int);
-int    fegetexceptflag(fexcept_t *, int);
-int    feraiseexcept(int);
-int    fesetexceptflag(const fexcept_t *, int);
-int    fetestexcept(int);
-int    fegetround(void);
-int    fesetround(int);
-int    fegetenv(fenv_t *);
-int    feholdexcept(fenv_t *);
-int    fesetenv(const fenv_t *);
-int    feupdateenv(const fenv_t *);
-
-#if defined(_NETBSD_SOURCE) || defined(_GNU_SOURCE)
-
-int    feenableexcept(int mask);
-int    fedisableexcept(int mask);
-int    fegetexcept(void);
-
-#endif /* _NETBDS_SOURCE || _GNU_SOURCE */
-
-__END_DECLS
-
-#endif /* ! _FENV_H_ */
diff --git a/nbsd_include/fnmatch.h b/nbsd_include/fnmatch.h
deleted file mode 100644 (file)
index b7533d5..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*     $NetBSD: fnmatch.h,v 1.12 2005/02/03 04:39:32 perry Exp $       */
-
-/*-
- * Copyright (c) 1992, 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. 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.
- *
- *     @(#)fnmatch.h   8.1 (Berkeley) 6/2/93
- */
-
-#ifndef        _FNMATCH_H_
-#define        _FNMATCH_H_
-
-#include <sys/featuretest.h>
-
-#define        FNM_NOMATCH     1       /* Match failed. */
-#define        FNM_NOSYS       2       /* Function not implemented. */
-
-#define        FNM_NOESCAPE    0x01    /* Disable backslash escaping. */
-#define        FNM_PATHNAME    0x02    /* Slash must be matched by slash. */
-#define        FNM_PERIOD      0x04    /* Period must be matched by period. */
-#if defined(_NETBSD_SOURCE)
-#define        FNM_CASEFOLD    0x08    /* Pattern is matched case-insensitive */
-#define        FNM_LEADING_DIR 0x10    /* Ignore /<tail> after Imatch. */
-#endif
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int     fnmatch(const char *, const char *, int);
-__END_DECLS
-
-#endif /* !_FNMATCH_H_ */
diff --git a/nbsd_include/fts.h b/nbsd_include/fts.h
deleted file mode 100644 (file)
index 36301b4..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*     $NetBSD: fts.h,v 1.19 2009/08/16 19:33:38 christos Exp $        */
-
-/*
- * Copyright (c) 1989, 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. 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.
- *
- *     @(#)fts.h       8.3 (Berkeley) 8/14/94
- */
-
-#ifndef        _FTS_H_
-#define        _FTS_H_
-
-#ifndef        __fts_stat_t
-#define        __fts_stat_t    struct stat
-#endif
-#ifndef        __fts_nlink_t
-#define        __fts_nlink_t   nlink_t
-#endif
-#ifndef        __fts_ino_t
-#define        __fts_ino_t     ino_t
-#endif
-#ifndef        __fts_length_t
-#define        __fts_length_t  unsigned int
-#endif
-#ifndef        __fts_number_t
-#define        __fts_number_t  int64_t
-#endif
-#ifndef        __fts_dev_t
-#define        __fts_dev_t     dev_t
-#endif
-#ifndef        __fts_level_t
-#define        __fts_level_t   int
-#endif
-
-typedef struct {
-       struct _ftsent *fts_cur;        /* current node */
-       struct _ftsent *fts_child;      /* linked list of children */
-       struct _ftsent **fts_array;     /* sort array */
-       dev_t fts_dev;                  /* starting device # */
-       char *fts_path;                 /* path for this descent */
-       int fts_rfd;                    /* fd for root */
-       unsigned int fts_pathlen;       /* sizeof(path) */
-       unsigned int fts_nitems;        /* elements in the sort array */
-       int (*fts_compar)               /* compare function */
-               (const struct _ftsent **, const struct _ftsent **);
-
-#define        FTS_COMFOLLOW   0x001           /* follow command line symlinks */
-#define        FTS_LOGICAL     0x002           /* logical walk */
-#define        FTS_NOCHDIR     0x004           /* don't change directories */
-#define        FTS_NOSTAT      0x008           /* don't get stat info */
-#define        FTS_PHYSICAL    0x010           /* physical walk */
-#define        FTS_SEEDOT      0x020           /* return dot and dot-dot */
-#define        FTS_XDEV        0x040           /* don't cross devices */
-#ifndef __minix
-#define        FTS_WHITEOUT    0x080           /* return whiteout information */
-#endif 
-#define        FTS_OPTIONMASK  0x0ff           /* valid user option mask */
-
-#define        FTS_NAMEONLY    0x100           /* (private) child names only */
-#define        FTS_STOP        0x200           /* (private) unrecoverable error */
-       int fts_options;                /* fts_open options, global flags */
-} FTS;
-
-typedef struct _ftsent {
-       struct _ftsent *fts_cycle;      /* cycle node */
-       struct _ftsent *fts_parent;     /* parent directory */
-       struct _ftsent *fts_link;       /* next file in directory */
-       __fts_number_t fts_number;      /* local numeric value */
-       void *fts_pointer;              /* local address value */
-       char *fts_accpath;              /* access path */
-       char *fts_path;                 /* root path */
-       int fts_errno;                  /* errno for this node */
-       int fts_symfd;                  /* fd for symlink */
-       __fts_length_t fts_pathlen;     /* strlen(fts_path) */
-       __fts_length_t fts_namelen;     /* strlen(fts_name) */
-
-       __fts_ino_t fts_ino;            /* inode */
-       __fts_dev_t fts_dev;            /* device */
-       __fts_nlink_t fts_nlink;        /* link count */
-
-#define        FTS_ROOTPARENTLEVEL     -1
-#define        FTS_ROOTLEVEL            0
-       __fts_level_t fts_level;                /* depth (-1 to N) */
-
-#define        FTS_D            1              /* preorder directory */
-#define        FTS_DC           2              /* directory that causes cycles */
-#define        FTS_DEFAULT      3              /* none of the above */
-#define        FTS_DNR          4              /* unreadable directory */
-#define        FTS_DOT          5              /* dot or dot-dot */
-#define        FTS_DP           6              /* postorder directory */
-#define        FTS_ERR          7              /* error; errno is set */
-#define        FTS_F            8              /* regular file */
-#define        FTS_INIT         9              /* initialized only */
-#define        FTS_NS          10              /* stat(2) failed */
-#define        FTS_NSOK        11              /* no stat(2) requested */
-#define        FTS_SL          12              /* symbolic link */
-#define        FTS_SLNONE      13              /* symbolic link without target */
-#define        FTS_W           14              /* whiteout object */
-       unsigned short fts_info;        /* user flags for FTSENT structure */
-
-#define        FTS_DONTCHDIR    0x01           /* don't chdir .. to the parent */
-#define        FTS_SYMFOLLOW    0x02           /* followed a symlink to get here */
-#define        FTS_ISW          0x04           /* this is a whiteout object */
-       unsigned short fts_flags;       /* private flags for FTSENT structure */
-
-#define        FTS_AGAIN        1              /* read node again */
-#define        FTS_FOLLOW       2              /* follow symbolic link */
-#define        FTS_NOINSTR      3              /* no instructions */
-#define        FTS_SKIP         4              /* discard node */
-       unsigned short fts_instr;       /* fts_set() instructions */
-
-       __fts_stat_t *fts_statp;        /* stat(2) information */
-       char fts_name[1];               /* file name */
-} FTSENT;
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-#ifndef        __LIBC12_SOURCE__
-FTSENT *fts_children(FTS *, int)               __RENAME(__fts_children60);
-int     fts_close(FTS *)                       __RENAME(__fts_close60);
-FTS    *fts_open(char * const *, int,
-    int (*)(const FTSENT **, const FTSENT **)) __RENAME(__fts_open60);
-FTSENT *fts_read(FTS *)                        __RENAME(__fts_read60);
-int     fts_set(FTS *, FTSENT *, int)          __RENAME(__fts_set60);
-#endif
-__END_DECLS
-
-#endif /* !_FTS_H_ */
diff --git a/nbsd_include/getopt.h b/nbsd_include/getopt.h
deleted file mode 100644 (file)
index 71409fe..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*     $NetBSD: getopt.h,v 1.11 2008/04/28 20:22:54 martin Exp $       */
-
-/*-
- * Copyright (c) 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Dieter Baron and Thomas Klausner.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _GETOPT_H_
-#define _GETOPT_H_
-
-#include <sys/cdefs.h>
-#include <unistd.h>
-
-/*
- * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
- */
-#define no_argument        0
-#define required_argument  1
-#define optional_argument  2
-
-struct option {
-       /* name of long option */
-       const char *name;
-       /*
-        * one of no_argument, required_argument, and optional_argument:
-        * whether option takes an argument
-        */
-       int has_arg;
-       /* if not NULL, set *flag to val when option found */
-       int *flag;
-       /* if flag not NULL, value to set *flag to; else return value */
-       int val;
-};
-
-__BEGIN_DECLS
-int getopt_long(int, char * const *, const char *,
-    const struct option *, int *);
-__END_DECLS
-#endif /* !_GETOPT_H_ */
diff --git a/nbsd_include/glob.h b/nbsd_include/glob.h
deleted file mode 100644 (file)
index 1111a1c..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*     $NetBSD: glob.h,v 1.26 2010/09/06 14:38:56 christos Exp $       */
-
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Guido van Rossum.
- *
- * 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. 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.
- *
- *     @(#)glob.h      8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _GLOB_H_
-#define        _GLOB_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#ifndef __gl_size_t
-#define __gl_size_t    size_t
-#endif
-#ifndef __gl_stat_t
-#define __gl_stat_t    struct stat
-#endif
-
-typedef struct {
-       __gl_size_t gl_pathc;   /* Count of total paths so far. */
-       __gl_size_t gl_matchc;  /* Count of paths matching pattern. */
-       __gl_size_t gl_offs;    /* Reserved at beginning of gl_pathv. */
-       int gl_flags;           /* Copy of flags parameter to glob. */
-       char **gl_pathv;        /* List of paths matching pattern. */
-                               /* Copy of errfunc parameter to glob. */
-       int (*gl_errfunc)(const char *, int);
-
-       /*
-        * Alternate filesystem access methods for glob; replacement
-        * versions of closedir(3), readdir(3), opendir(3), stat(2)
-        * and lstat(2).
-        */
-       void (*gl_closedir)(void *);
-       struct dirent *(*gl_readdir)(void *);   
-       void *(*gl_opendir)(const char *);
-       int (*gl_lstat)(const char *, __gl_stat_t *);
-       int (*gl_stat)(const char *, __gl_stat_t *);
-} glob_t;
-
-#define        GLOB_APPEND     0x0001  /* Append to output from previous call. */
-#define        GLOB_DOOFFS     0x0002  /* Use gl_offs. */
-#define        GLOB_ERR        0x0004  /* Return on error. */
-#define        GLOB_MARK       0x0008  /* Append / to matching directories. */
-#define        GLOB_NOCHECK    0x0010  /* Return pattern itself if nothing matches. */
-#define        GLOB_NOSORT     0x0020  /* Don't sort. */
-#define        GLOB_NOESCAPE   0x1000  /* Disable backslash escaping. */
-
-#define        GLOB_NOSPACE    (-1)    /* Malloc call failed. */
-#define        GLOB_ABORTED    (-2)    /* Unignored error. */
-#define        GLOB_NOMATCH    (-3)    /* No match, and GLOB_NOCHECK was not set. */
-#define        GLOB_NOSYS      (-4)    /* Implementation does not support function. */
-
-#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
-#define        GLOB_ALTDIRFUNC 0x0040  /* Use alternately specified directory funcs. */
-#define        GLOB_BRACE      0x0080  /* Expand braces ala csh. */
-#define        GLOB_MAGCHAR    0x0100  /* Pattern had globbing characters. */
-#define        GLOB_NOMAGIC    0x0200  /* GLOB_NOCHECK without magic chars (csh). */
-#define        GLOB_LIMIT      0x0400  /* Limit memory used by matches to ARG_MAX */
-#define        GLOB_TILDE      0x0800  /* Expand tilde names from the passwd file. */
-/*     GLOB_NOESCAPE   0x1000  above */
-#define        GLOB_PERIOD     0x2000  /* Allow metachars to match leading periods. */
-#define        GLOB_NO_DOTDIRS 0x4000  /* Make . and .. vanish from wildcards. */
-#define        GLOB_STAR       0x8000  /* Use glob ** to recurse directories */
-#define        GLOB_QUOTE      0       /* source compatibility */
-
-#define        GLOB_ABEND      GLOB_ABORTED    /* source compatibility */
-#endif
-
-__BEGIN_DECLS
-#ifndef __LIBC12_SOURCE__
-int    glob(const char * __restrict, int,
-    int (*)(const char *, int), glob_t * __restrict)    __RENAME(__glob30);
-void   globfree(glob_t *)                               __RENAME(__globfree30);
-#endif
-#ifdef _NETBSD_SOURCE
-int    glob_pattern_p(const char *, int);
-#endif
-__END_DECLS
-
-#endif /* !_GLOB_H_ */
diff --git a/nbsd_include/grp.h b/nbsd_include/grp.h
deleted file mode 100644 (file)
index 9c74784..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*     $NetBSD: grp.h,v 1.24 2007/10/19 15:58:52 christos Exp $        */
-
-/*-
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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. 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.
- *
- *     @(#)grp.h       8.2 (Berkeley) 1/21/94
- */
-
-#ifndef _GRP_H_
-#define        _GRP_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <sys/types.h>
-
-#if defined(_NETBSD_SOURCE)
-#define        _PATH_GROUP             "/etc/group"
-#endif
-
-struct group {
-       __aconst char *gr_name;                 /* group name */
-       __aconst char *gr_passwd;               /* group password */
-       gid_t   gr_gid;                         /* group id */
-       __aconst char *__aconst *gr_mem;        /* group members */
-};
-
-__BEGIN_DECLS
-struct group   *getgrgid(gid_t);
-struct group   *getgrnam(const char *);
-#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
-int             getgrgid_r(gid_t, struct group *, char *, size_t,
-                               struct group **);
-int             getgrnam_r(const char *, struct group *, char *, size_t,
-                               struct group **);
-#endif
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-struct group   *getgrent(void);
-void            setgrent(void);
-void            endgrent(void);
-#endif
-#if defined(_NETBSD_SOURCE)
-void            setgrfile(const char *);
-int             setgroupent(int);
-int             getgrent_r(struct group *, char *, size_t, struct group **);
-const char     *group_from_gid(gid_t, int);
-int             gid_from_group(const char *, gid_t *);
-int             pwcache_groupdb(int (*)(int), void (*)(void),
-                                   struct group * (*)(const char *),
-                                   struct group * (*)(gid_t));
-#endif
-__END_DECLS
-
-#endif /* !_GRP_H_ */
diff --git a/nbsd_include/ifaddrs.h b/nbsd_include/ifaddrs.h
deleted file mode 100644 (file)
index d9ac733..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*     $NetBSD: ifaddrs.h,v 1.5 2005/02/03 04:39:32 perry Exp $        */
-
-/*
- * Copyright (c) 1995, 1999
- *     Berkeley Software Design, Inc.  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.
- *
- * THIS SOFTWARE IS PROVIDED BY Berkeley Software Design, Inc. ``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 Berkeley Software Design, Inc. 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.
- *
- *     BSDI ifaddrs.h,v 2.5 2000/02/23 14:51:59 dab Exp
- */
-
-#ifndef        _IFADDRS_H_
-#define        _IFADDRS_H_
-
-struct ifaddrs {
-       struct ifaddrs  *ifa_next;
-       char            *ifa_name;
-       u_int            ifa_flags;
-       struct sockaddr *ifa_addr;
-       struct sockaddr *ifa_netmask;
-       struct sockaddr *ifa_dstaddr;
-       void            *ifa_data;
-};
-
-/*
- * This may have been defined in <net/if.h>.  Note that if <net/if.h> is
- * to be included it must be included before this header file.
- */
-#ifndef        ifa_broadaddr
-#define        ifa_broadaddr   ifa_dstaddr     /* broadcast address interface */
-#endif
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int getifaddrs(struct ifaddrs **);
-void freeifaddrs(struct ifaddrs *);
-__END_DECLS
-
-#endif /* !_IFADDRS_H_ */
diff --git a/nbsd_include/inttypes.h b/nbsd_include/inttypes.h
deleted file mode 100644 (file)
index 8c08a40..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*     $NetBSD: inttypes.h,v 1.7 2009/11/15 22:21:03 christos Exp $    */
-
-/*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _INTTYPES_H_
-#define _INTTYPES_H_
-
-#include <sys/cdefs.h>
-#include <sys/inttypes.h>
-#include <machine/ansi.h>
-
-#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
-typedef        _BSD_WCHAR_T_   wchar_t;
-#undef _BSD_WCHAR_T_
-#endif
-
-__BEGIN_DECLS
-intmax_t       strtoimax(const char * __restrict,
-                   char ** __restrict, int);
-uintmax_t      strtoumax(const char * __restrict,
-                   char ** __restrict, int);
-intmax_t       wcstoimax(const wchar_t * __restrict,
-                   wchar_t ** __restrict, int);
-uintmax_t      wcstoumax(const wchar_t * __restrict,
-                   wchar_t ** __restrict, int);
-
-intmax_t       imaxabs(intmax_t);
-
-typedef struct {
-       intmax_t quot;
-       intmax_t rem;
-} imaxdiv_t;
-
-imaxdiv_t      imaxdiv(intmax_t, intmax_t);
-__END_DECLS
-
-#endif /* !_INTTYPES_H_ */
diff --git a/nbsd_include/libgen.h b/nbsd_include/libgen.h
deleted file mode 100644 (file)
index 7a4985e..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*     $NetBSD: libgen.h,v 1.5 2008/05/10 22:37:42 christos Exp $      */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _LIBGEN_H_
-#define _LIBGEN_H_
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-char   *basename(char *);
-char   *dirname(char *);
-__END_DECLS
-
-#endif /* !_LIBGEN_H_ */
diff --git a/nbsd_include/limits.h b/nbsd_include/limits.h
deleted file mode 100644 (file)
index 447fa8a..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*     $NetBSD: limits.h,v 1.29 2010/06/07 13:52:29 tnozaki Exp $      */
-
-/*
- * 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. 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.
- *
- *     @(#)limits.h    8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _LIMITS_H_
-#define        _LIMITS_H_
-
-#include <sys/featuretest.h>
-
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-#define        _POSIX_AIO_LISTIO_MAX   2
-#define        _POSIX_AIO_MAX          1
-#define        _POSIX_ARG_MAX          4096
-#define        _POSIX_CHILD_MAX        25
-#define        _POSIX_HOST_NAME_MAX    255
-#define        _POSIX_LINK_MAX         8
-#define        _POSIX_LOGIN_NAME_MAX   9
-#define        _POSIX_MAX_CANON        255
-#define        _POSIX_MAX_INPUT        255
-#define        _POSIX_MQ_OPEN_MAX      8
-#define        _POSIX_MQ_PRIO_MAX      32
-#define        _POSIX_NAME_MAX         14
-#define        _POSIX_NGROUPS_MAX      8
-#define        _POSIX_OPEN_MAX         20
-#define        _POSIX_PATH_MAX         256
-#define        _POSIX_PIPE_BUF         512
-#define        _POSIX_RE_DUP_MAX       255
-#define        _POSIX_SSIZE_MAX        32767
-#define        _POSIX_STREAM_MAX       8
-#define        _POSIX_SYMLINK_MAX      255
-#define        _POSIX_SYMLOOP_MAX      8
-#define        _POSIX_THREAD_DESTRUCTOR_ITERATIONS     4
-#define        _POSIX_THREAD_KEYS_MAX  128
-#define        _POSIX_THREAD_THREADS_MAX               64
-#define        _POSIX_TIMER_MAX        32
-#define        _POSIX_TTY_NAME_MAX     9
-#define        _POSIX_TZNAME_MAX       6
-
-#define        _POSIX2_BC_BASE_MAX     99
-#define        _POSIX2_BC_DIM_MAX      2048
-#define        _POSIX2_BC_SCALE_MAX    99
-#define        _POSIX2_BC_STRING_MAX   1000
-#define        _POSIX2_CHARCLASS_NAME_MAX      14
-#define        _POSIX2_COLL_WEIGHTS_MAX        2
-#define        _POSIX2_EXPR_NEST_MAX   32
-#define        _POSIX2_LINE_MAX        2048
-#define        _POSIX2_RE_DUP_MAX      255
-
-/*
- * X/Open CAE Specifications,
- * adopted in IEEE Std 1003.1-2001 XSI.
- */
-#if (_POSIX_C_SOURCE - 0) >= 200112L || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-#define        _XOPEN_IOV_MAX          16
-#define        _XOPEN_NAME_MAX         256
-#define        _XOPEN_PATH_MAX         1024
-
-#define PASS_MAX               128             /* Legacy */
-
-#define CHARCLASS_NAME_MAX     14
-#define NL_ARGMAX              9
-#define NL_LANGMAX             14
-#define NL_MSGMAX              32767
-#define NL_NMAX                        1
-#define NL_SETMAX              255
-#define NL_TEXTMAX             2048
-
-       /* IEEE Std 1003.1-2001 TSF */
-#define        _GETGR_R_SIZE_MAX       1024
-#define        _GETPW_R_SIZE_MAX       1024
-
-/* Always ensure that this is consistent with <stdio.h> */
-#ifndef TMP_MAX
-#define TMP_MAX                        308915776       /* Legacy */
-#endif
-#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */
-
-#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
-
-#define MB_LEN_MAX             32      /* Allow ISO/IEC 2022 */
-
-#include <machine/limits.h>
-#include <sys/syslimits.h>
-
-#ifdef __minix
-#define SYMLOOP_MAX            16
-#define SYMLINK_MAX            1024
-#endif
-
-#endif /* !_LIMITS_H_ */
diff --git a/nbsd_include/locale.h b/nbsd_include/locale.h
deleted file mode 100644 (file)
index 59c6879..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*     $NetBSD: locale.h,v 1.17 2010/06/07 13:52:29 tnozaki Exp $      */
-
-/*
- * Copyright (c) 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. 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.
- *
- *     @(#)locale.h    8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _LOCALE_H_
-#define _LOCALE_H_
-
-struct lconv {
-       char    *decimal_point;
-       char    *thousands_sep;
-       char    *grouping;
-       char    *int_curr_symbol;
-       char    *currency_symbol;
-       char    *mon_decimal_point;
-       char    *mon_thousands_sep;
-       char    *mon_grouping;
-       char    *positive_sign;
-       char    *negative_sign;
-       char    int_frac_digits;
-       char    frac_digits;
-       char    p_cs_precedes;
-       char    p_sep_by_space;
-       char    n_cs_precedes;
-       char    n_sep_by_space;
-       char    p_sign_posn;
-       char    n_sign_posn;
-       char    int_p_cs_precedes;
-       char    int_n_cs_precedes;
-       char    int_p_sep_by_space;
-       char    int_n_sep_by_space;
-       char    int_p_sign_posn;
-       char    int_n_sign_posn;
-};
-
-#include <sys/null.h>
-
-#define        LC_ALL          0
-#define        LC_COLLATE      1
-#define        LC_CTYPE        2
-#define        LC_MONETARY     3
-#define        LC_NUMERIC      4
-#define        LC_TIME         5
-#define LC_MESSAGES    6
-
-#define        _LC_LAST        7               /* marks end */
-
-#include <sys/cdefs.h>
-
-#ifdef __SETLOCALE_SOURCE__
-
-typedef struct _locale_impl_t          *_locale_t;
-
-#define _LC_GLOBAL_LOCALE              ((_locale_t)-1)
-
-#endif
-
-__BEGIN_DECLS
-struct lconv *localeconv(void);
-char *setlocale(int, const char *) __RENAME(__setlocale50);
-__END_DECLS
-
-#endif /* _LOCALE_H_ */
diff --git a/nbsd_include/math.h b/nbsd_include/math.h
deleted file mode 100644 (file)
index fe0251c..0000000
+++ /dev/null
@@ -1,498 +0,0 @@
-/*     $NetBSD: math.h,v 1.53 2010/09/15 16:11:30 christos Exp $       */
-
-/*
- * ====================================================
- * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
- *
- * Developed at SunPro, a Sun Microsystems, Inc. business.
- * Permission to use, copy, modify, and distribute this
- * software is freely granted, provided that this notice
- * is preserved.
- * ====================================================
- */
-
-/*
- * @(#)fdlibm.h 5.1 93/09/24
- */
-
-#ifndef _MATH_H_
-#define _MATH_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-
-union __float_u {
-       unsigned char __dummy[sizeof(float)];
-       float __val;
-};
-
-union __double_u {
-       unsigned char __dummy[sizeof(double)];
-       double __val;
-};
-
-union __long_double_u {
-       unsigned char __dummy[sizeof(long double)];
-       long double __val;
-};
-
-#include <machine/math.h>              /* may use __float_u, __double_u,
-                                          or __long_double_u */
-
-#ifdef __HAVE_LONG_DOUBLE
-#define        __fpmacro_unary_floating(__name, __arg0)                        \
-       /* LINTED */                                                    \
-       ((sizeof (__arg0) == sizeof (float))                            \
-       ?       __ ## __name ## f (__arg0)                              \
-       : (sizeof (__arg0) == sizeof (double))                          \
-       ?       __ ## __name ## d (__arg0)                              \
-       :       __ ## __name ## l (__arg0))
-#else
-#define        __fpmacro_unary_floating(__name, __arg0)                        \
-       /* LINTED */                                                    \
-       ((sizeof (__arg0) == sizeof (float))                            \
-       ?       __ ## __name ## f (__arg0)                              \
-       :       __ ## __name ## d (__arg0))
-#endif /* __HAVE_LONG_DOUBLE */
-
-/*
- * ANSI/POSIX
- */
-/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
-#if __GNUC_PREREQ__(3, 3)
-#define HUGE_VAL       __builtin_huge_val()
-#else
-extern const union __double_u __infinity;
-#define HUGE_VAL       __infinity.__val
-#endif
-
-/*
- * ISO C99
- */
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
-    !defined(_XOPEN_SOURCE) || \
-    ((__STDC_VERSION__ - 0) >= 199901L) || \
-    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
-    ((_XOPEN_SOURCE  - 0) >= 600) || \
-    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
-/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
-#if __GNUC_PREREQ__(3, 3)
-#define        HUGE_VALF       __builtin_huge_valf()
-#define        HUGE_VALL       __builtin_huge_vall()
-#else
-extern const union __float_u __infinityf;
-#define        HUGE_VALF       __infinityf.__val
-
-extern const union __long_double_u __infinityl;
-#define        HUGE_VALL       __infinityl.__val
-#endif
-
-/* 7.12#4 INFINITY */
-#if __GNUC_PREREQ__(3, 3)
-#define        INFINITY        __builtin_inff()
-#elif defined(__INFINITY)
-#define        INFINITY        __INFINITY      /* float constant which overflows */
-#else
-#define        INFINITY        HUGE_VALF       /* positive infinity */
-#endif /* __INFINITY */
-
-/* 7.12#5 NAN: a quiet NaN, if supported */
-#ifdef __HAVE_NANF
-#if __GNUC_PREREQ__(3,3)
-#define        NAN     __builtin_nanf("")
-#else
-extern const union __float_u __nanf;
-#define        NAN             __nanf.__val
-#endif
-#endif /* __HAVE_NANF */
-
-/* 7.12#6 number classification macros */
-#define        FP_INFINITE     0x00
-#define        FP_NAN          0x01
-#define        FP_NORMAL       0x02
-#define        FP_SUBNORMAL    0x03
-#define        FP_ZERO         0x04
-/* NetBSD extensions */
-#define        _FP_LOMD        0x80            /* range for machine-specific classes */
-#define        _FP_HIMD        0xff
-
-#endif /* !_ANSI_SOURCE && ... */
-
-/*
- * XOPEN/SVID
- */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-#define        M_E             2.7182818284590452354   /* e */
-#define        M_LOG2E         1.4426950408889634074   /* log 2e */
-#define        M_LOG10E        0.43429448190325182765  /* log 10e */
-#define        M_LN2           0.69314718055994530942  /* log e2 */
-#define        M_LN10          2.30258509299404568402  /* log e10 */
-#define        M_PI            3.14159265358979323846  /* pi */
-#define        M_PI_2          1.57079632679489661923  /* pi/2 */
-#define        M_PI_4          0.78539816339744830962  /* pi/4 */
-#define        M_1_PI          0.31830988618379067154  /* 1/pi */
-#define        M_2_PI          0.63661977236758134308  /* 2/pi */
-#define        M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
-#define        M_SQRT2         1.41421356237309504880  /* sqrt(2) */
-#define        M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
-
-#define        MAXFLOAT        ((float)3.40282346638528860e+38)
-extern int signgam;
-#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
-
-#if defined(_NETBSD_SOURCE)
-enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
-
-#define _LIB_VERSION_TYPE enum fdversion
-#define _LIB_VERSION _fdlib_version
-
-/* if global variable _LIB_VERSION is not desirable, one may
- * change the following to be a constant by:
- *     #define _LIB_VERSION_TYPE const enum version
- * In that case, after one initializes the value _LIB_VERSION (see
- * s_lib_version.c) during compile time, it cannot be modified
- * in the middle of a program
- */
-extern  _LIB_VERSION_TYPE  _LIB_VERSION;
-
-#define _IEEE_  fdlibm_ieee
-#define _SVID_  fdlibm_svid
-#define _XOPEN_ fdlibm_xopen
-#define _POSIX_ fdlibm_posix
-
-#ifndef __cplusplus
-struct exception {
-       int type;
-       const char *name;
-       double arg1;
-       double arg2;
-       double retval;
-};
-#endif
-
-#define        HUGE            MAXFLOAT
-
-/*
- * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
- * (one may replace the following line by "#include <values.h>")
- */
-
-#define X_TLOSS                1.41484755040568800000e+16
-
-#define        DOMAIN          1
-#define        SING            2
-#define        OVERFLOW        3
-#define        UNDERFLOW       4
-#define        TLOSS           5
-#define        PLOSS           6
-
-#endif /* _NETBSD_SOURCE */
-
-__BEGIN_DECLS
-/*
- * ANSI/POSIX
- */
-double acos(double);
-double asin(double);
-double atan(double);
-double atan2(double, double);
-double cos(double);
-double sin(double);
-double tan(double);
-
-double cosh(double);
-double sinh(double);
-double tanh(double);
-
-double exp(double);
-double exp2(double);
-double frexp(double, int *);
-double ldexp(double, int);
-double log(double);
-double log2(double);
-double log10(double);
-double modf(double, double *);
-
-double pow(double, double);
-double sqrt(double);
-
-double ceil(double);
-double fabs(double);
-double floor(double);
-double fmod(double, double);
-
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-double erf(double);
-double erfc(double);
-double gamma(double);
-double hypot(double, double);
-int    finite(double);
-double j0(double);
-double j1(double);
-double jn(int, double);
-double lgamma(double);
-double y0(double);
-double y1(double);
-double yn(int, double);
-
-#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-double acosh(double);
-double asinh(double);
-double atanh(double);
-double cbrt(double);
-double expm1(double);
-int    ilogb(double);
-double log1p(double);
-double logb(double);
-double nextafter(double, double);
-double remainder(double, double);
-double rint(double);
-double scalb(double, double);
-#endif /* (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)*/
-#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
-
-/*
- * ISO C99
- */
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
-    !defined(_XOPEN_SOURCE) || \
-    ((__STDC_VERSION__ - 0) >= 199901L) || \
-    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
-    ((_XOPEN_SOURCE  - 0) >= 600) || \
-    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
-/* 7.12.3.1 int fpclassify(real-floating x) */
-#define        fpclassify(__x) __fpmacro_unary_floating(fpclassify, __x)
-
-/* 7.12.3.2 int isfinite(real-floating x) */
-#define        isfinite(__x)   __fpmacro_unary_floating(isfinite, __x)
-
-/* 7.12.3.5 int isnormal(real-floating x) */
-#define        isnormal(__x)   (fpclassify(__x) == FP_NORMAL)
-
-/* 7.12.3.6 int signbit(real-floating x) */
-#define        signbit(__x)    __fpmacro_unary_floating(signbit, __x)
-
-/* 7.12.4 trigonometric */
-
-float  acosf(float);
-float  asinf(float);
-float  atanf(float);
-float  atan2f(float, float);
-float  cosf(float);
-float  sinf(float);
-float  tanf(float);
-
-/* 7.12.5 hyperbolic */
-
-float  acoshf(float);
-float  asinhf(float);
-float  atanhf(float);
-float  coshf(float);
-float  sinhf(float);
-float  tanhf(float);
-
-/* 7.12.6 exp / log */
-
-float  expf(float);
-float  exp2f(float);
-float  expm1f(float);
-float  frexpf(float, int *);
-int    ilogbf(float);
-float  ldexpf(float, int);
-float  logf(float);
-float  log2f(float);
-float  log10f(float);
-float  log1pf(float);
-float  logbf(float);
-float  modff(float, float *);
-float  scalbnf(float, int);
-
-/* 7.12.7 power / absolute */
-
-float  cbrtf(float);
-float  fabsf(float);
-long double    fabsl(long double);
-float  hypotf(float, float);
-float  powf(float, float);
-float  sqrtf(float);
-
-/* 7.12.8 error / gamma */
-
-float  erff(float);
-float  erfcf(float);
-float  lgammaf(float);
-
-/* 7.12.9 nearest integer */
-
-float  ceilf(float);
-float  floorf(float);
-float  rintf(float);
-double round(double);
-float  roundf(float);
-double trunc(double);
-float  truncf(float);
-long int       lrint(double);
-long int       lrintf(float);
-/* LONGLONG */
-long long int  llrint(double);
-/* LONGLONG */
-long long int  llrintf(float);
-long int       lround(double);
-long int       lroundf(float);
-/* LONGLONG */
-long long int  llround(double);
-/* LONGLONG */
-long long int  llroundf(float);
-
-/* 7.12.10 remainder */
-
-float  fmodf(float, float);
-float  remainderf(float, float);
-
-/* 7.12.11 manipulation */
-
-float  copysignf(float, float);
-long double    copysignl(long double, long double);
-double nan(const char *);
-float  nanf(const char *);
-long double    nanl(const char *);
-float  nextafterf(float, float);
-long double     nextafterl(long double, long double);
-double nexttoward(double, long double);
-
-/* 7.12.14 comparison */
-
-#define isunordered(x, y)      (isnan(x) || isnan(y))
-#define isgreater(x, y)                (!isunordered((x), (y)) && (x) > (y))
-#define isgreaterequal(x, y)   (!isunordered((x), (y)) && (x) >= (y))
-#define isless(x, y)           (!isunordered((x), (y)) && (x) < (y))
-#define islessequal(x, y)      (!isunordered((x), (y)) && (x) <= (y))
-#define islessgreater(x, y)    (!isunordered((x), (y)) && \
-                                ((x) > (y) || (y) > (x)))
-double fdim(double, double);
-double fmax(double, double);
-double fmin(double, double);
-float  fdimf(float, float);
-float  fmaxf(float, float);
-float  fminf(float, float);
-long double fdiml(long double, long double);
-long double fmaxl(long double, long double);
-long double fminl(long double, long double);
-
-#endif /* !_ANSI_SOURCE && ... */
-
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) || \
-    !defined(_XOPEN_SOURCE) || \
-    ((__STDC_VERSION__ - 0) >= 199901L) || \
-    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
-    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
-/* 7.12.3.3 int isinf(real-floating x) */
-#ifdef __isinf
-#define        isinf(__x)      __isinf(__x)
-#else
-#define        isinf(__x)      __fpmacro_unary_floating(isinf, __x)
-#endif
-
-/* 7.12.3.4 int isnan(real-floating x) */
-#ifdef __isnan
-#define        isnan(__x)      __isnan(__x)
-#else
-#define        isnan(__x)      __fpmacro_unary_floating(isnan, __x)
-#endif
-#endif /* !_ANSI_SOURCE && ... */
-
-#if defined(_NETBSD_SOURCE)
-#ifndef __cplusplus
-int    matherr(struct exception *);
-#endif
-
-/*
- * IEEE Test Vector
- */
-double significand(double);
-
-/*
- * Functions callable from C, intended to support IEEE arithmetic.
- */
-double copysign(double, double);
-double scalbn(double, int);
-
-/*
- * BSD math library entry points
- */
-double drem(double, double);
-
-#endif /* _NETBSD_SOURCE */
-
-#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)
-/*
- * Reentrant version of gamma & lgamma; passes signgam back by reference
- * as the second argument; user must allocate space for signgam.
- */
-double gamma_r(double, int *);
-double lgamma_r(double, int *);
-#endif /* _NETBSD_SOURCE || _REENTRANT */
-
-
-#if defined(_NETBSD_SOURCE)
-
-/* float versions of ANSI/POSIX functions */
-
-float  gammaf(float);
-int    isinff(float);
-int    isnanf(float);
-int    finitef(float);
-float  j0f(float);
-float  j1f(float);
-float  jnf(int, float);
-float  y0f(float);
-float  y1f(float);
-float  ynf(int, float);
-
-float  scalbf(float, float);
-
-/*
- * float version of IEEE Test Vector
- */
-float  significandf(float);
-
-/*
- * float versions of BSD math library entry points
- */
-float  dremf(float, float);
-#endif /* _NETBSD_SOURCE */
-
-#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)
-/*
- * Float versions of reentrant version of gamma & lgamma; passes
- * signgam back by reference as the second argument; user must
- * allocate space for signgam.
- */
-float  gammaf_r(float, int *);
-float  lgammaf_r(float, int *);
-#endif /* !... || _REENTRANT */
-
-/*
- * Library implementation
- */
-int    __fpclassifyf(float);
-int    __fpclassifyd(double);
-int    __isfinitef(float);
-int    __isfinited(double);
-int    __isinff(float);
-int    __isinfd(double);
-int    __isnanf(float);
-int    __isnand(double);
-int    __signbitf(float);
-int    __signbitd(double);
-
-#ifdef __HAVE_LONG_DOUBLE
-int    __fpclassifyl(long double);
-int    __isfinitel(long double);
-int    __isinfl(long double);
-int    __isnanl(long double);
-int    __signbitl(long double);
-#endif
-__END_DECLS
-
-#endif /* _MATH_H_ */
diff --git a/nbsd_include/minix/dirent.h b/nbsd_include/minix/dirent.h
deleted file mode 100644 (file)
index 06cbdc0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*     dirent.h - Declarations for directory reading routines.
- *                                                     Author: Kees J. Bot
- *                                                             24 Apr 1989
- *
- * Note: The V7 format directory entries used under Minix must be transformed
- * into a struct dirent with a d_name of at least 15 characters.  Given that
- * we have to transform V7 entries anyhow it is little trouble to let the
- * routines understand the so-called "flex" directory format too.
- */
-
-#ifndef _DIRENT_H
-#define _DIRENT_H
-
-#include <sys/cdefs.h>
-
-       /* Name of length len needs _EXTENT(len) extra slots. */
-#define _EXTENT(len)   (((len) + 5) >> 3)
-
-/* The block size must be at least 1024 bytes, because otherwise
- * the superblock (at 1024 bytes) overlaps with other filesystem data.
- */
-#define _MIN_BLOCK_SIZE                 1024
-
-/* The below is allocated in some parts of the system as the largest
- * a filesystem block can be. For instance, the boot monitor allocates
- * 3 of these blocks and has to fit within 64kB, so this can't be
- * increased without taking that into account.
- */
-#define _MAX_BLOCK_SIZE                 4096
-
-/* This is the block size for the fixed versions of the filesystem (V1/V2) */
-#define _STATIC_BLOCK_SIZE     1024
-
-#endif /* _DIRENT_H */
diff --git a/nbsd_include/minix/types.h b/nbsd_include/minix/types.h
deleted file mode 100644 (file)
index 68c6b67..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _MINIX_TYPES_H_
-#define _MINIX_TYPES_H_
-
-/* Dummy file used in legacy (and shared) minix includes. */
-#include <minix/ansi.h>
-#include <sys/types.h>
-#include <sys/sigtypes.h>
-
-#endif
diff --git a/nbsd_include/mpool.h b/nbsd_include/mpool.h
deleted file mode 100644 (file)
index 800efae..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*     $NetBSD: mpool.h,v 1.13 2008/08/26 21:18:38 joerg Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993, 1994
- *     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. 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.
- *
- *     @(#)mpool.h     8.2 (Berkeley) 7/14/94
- */
-
-#ifndef _MPOOL_H_
-#define _MPOOL_H_
-
-#include <sys/cdefs.h>
-#include <sys/queue.h>
-
-/*
- * The memory pool scheme is a simple one.  Each in-memory page is referenced
- * by a bucket which is threaded in up to two of three ways.  All active pages
- * are threaded on a hash chain (hashed by page number) and an lru chain.
- * Inactive pages are threaded on a free chain.  Each reference to a memory
- * pool is handed an opaque MPOOL cookie which stores all of this information.
- */
-#define        HASHSIZE        128
-#define        HASHKEY(pgno)   ((pgno - 1) % HASHSIZE)
-
-/* The BKT structures are the elements of the queues. */
-typedef struct _bkt {
-       CIRCLEQ_ENTRY(_bkt) hq;         /* hash queue */
-       CIRCLEQ_ENTRY(_bkt) q;          /* lru queue */
-       void    *page;                  /* page */
-       pgno_t   pgno;                  /* page number */
-
-#define        MPOOL_DIRTY     0x01            /* page needs to be written */
-#define        MPOOL_PINNED    0x02            /* page is pinned into memory */
-       uint8_t flags;                  /* flags */
-} BKT;
-
-typedef struct MPOOL {
-       CIRCLEQ_HEAD(_lqh, _bkt) lqh;   /* lru queue head */
-                                       /* hash queue array */
-       CIRCLEQ_HEAD(_hqh, _bkt) hqh[HASHSIZE];
-       pgno_t  curcache;               /* current number of cached pages */
-       pgno_t  maxcache;               /* max number of cached pages */
-       pgno_t  npages;                 /* number of pages in the file */
-       unsigned long   pagesize;               /* file page size */
-       int     fd;                     /* file descriptor */
-                                       /* page in conversion routine */
-       void    (*pgin)(void *, pgno_t, void *);
-                                       /* page out conversion routine */
-       void    (*pgout)(void *, pgno_t, void *);
-       void    *pgcookie;              /* cookie for page in/out routines */
-#ifdef STATISTICS
-       unsigned long   cachehit;
-       unsigned long   cachemiss;
-       unsigned long   pagealloc;
-       unsigned long   pageflush;
-       unsigned long   pageget;
-       unsigned long   pagenew;
-       unsigned long   pageput;
-       unsigned long   pageread;
-       unsigned long   pagewrite;
-#endif
-} MPOOL;
-
-__BEGIN_DECLS
-MPOOL  *mpool_open(void *, int, pgno_t, pgno_t);
-void    mpool_filter(MPOOL *, void (*)(void *, pgno_t, void *),
-           void (*)(void *, pgno_t, void *), void *);
-void   *mpool_new(MPOOL *, pgno_t *);
-void   *mpool_get(MPOOL *, pgno_t, unsigned int);
-int     mpool_put(MPOOL *, void *, unsigned int);
-int     mpool_sync(MPOOL *);
-int     mpool_close(MPOOL *);
-#ifdef STATISTICS
-void    mpool_stat(MPOOL *);
-#endif
-__END_DECLS
-
-#endif /* _MPOOL_H_ */
diff --git a/nbsd_include/ndbm.h b/nbsd_include/ndbm.h
deleted file mode 100644 (file)
index 23b993d..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*     $NetBSD: ndbm.h,v 1.15 2010/02/03 15:34:40 roy Exp $    */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Margo Seltzer.
- *
- * 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. 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.
- *
- *     @(#)ndbm.h      8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _NDBM_H_
-#define        _NDBM_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <stdint.h>
-#include <db.h>
-
-#if defined(_NETBSD_SOURCE)
-/* Map dbm interface onto db(3). */
-#define DBM_RDONLY     O_RDONLY
-#endif
-
-/* Flags to dbm_store(). */
-#define DBM_INSERT      0
-#define DBM_REPLACE     1
-
-#if defined(_NETBSD_SOURCE)
-/*
- * The db(3) support for ndbm(3) always appends this suffix to the
- * file name to avoid overwriting the user's original database.
- */
-#define        DBM_SUFFIX      ".db"
-#endif
-
-typedef struct {
-       void    *dptr;
-       size_t   dsize;         /* XPG4.2 */
-} datum;
-
-typedef DB DBM;
-#if defined(_NETBSD_SOURCE)
-#define        dbm_pagfno(a)   DBM_PAGFNO_NOT_AVAILABLE
-#endif
-
-__BEGIN_DECLS
-void    dbm_close(DBM *);
-DBM    *dbm_open(const char *, int, mode_t);
-int     dbm_error(DBM *);
-int     dbm_clearerr(DBM *);
-#if defined(_NETBSD_SOURCE)
-int     dbm_dirfno(DBM *);
-#endif
-#ifndef __LIBC12_SOURCE__
-int     dbm_delete(DBM *, datum)               __RENAME(__dbm_delete13);
-datum   dbm_fetch(DBM *, datum)                __RENAME(__dbm_fetch13);
-datum   dbm_firstkey(DBM *)                    __RENAME(__dbm_firstkey13);
-datum   dbm_nextkey(DBM *)                     __RENAME(__dbm_nextkey13);
-int     dbm_store(DBM *, datum, datum, int)    __RENAME(__dbm_store13);
-#endif
-__END_DECLS
-
-#endif /* !_NDBM_H_ */
diff --git a/nbsd_include/net/hton.h b/nbsd_include/net/hton.h
deleted file mode 100644 (file)
index bc03601..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/*
- * Dummy file for Minix old includes compatibility.
- */
-#include <sys/cdefs.h>
-#include <sys/endian.h>
diff --git a/nbsd_include/net/if.h b/nbsd_include/net/if.h
deleted file mode 100644 (file)
index 39446f2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _NET_IF_H_
-#define _NET_IF_H_
-
-#define        IFF_UP          0x0001          /* interface is up */
-
-#endif /* _NET_IF_H_ */
diff --git a/nbsd_include/net/netlib.h b/nbsd_include/net/netlib.h
deleted file mode 100644 (file)
index 6477cde..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-net/netlib.h
-*/
-
-#ifndef _NET__NETLIB_H_
-#define _NET__NETLIB_H_
-
-#define IPSTAT_DEVICE  "/dev/ipstat"
-#define ETH_DEVICE     "/dev/eth"
-#define IP_DEVICE      "/dev/ip"
-#define TCP_DEVICE     "/dev/tcp"
-#define UDP_DEVICE     "/dev/udp"
-#define UDS_DEVICE     "/dev/uds"
-
-#endif /* _NET__NETLIB_H_ */
diff --git a/nbsd_include/netdb.h b/nbsd_include/netdb.h
deleted file mode 100644 (file)
index 98a150d..0000000
+++ /dev/null
@@ -1,358 +0,0 @@
-/*     $NetBSD: netdb.h,v 1.64 2010/05/05 17:12:29 christos Exp $      */
-
-/*
- * ++Copyright++ 1980, 1983, 1988, 1993
- * -
- * Copyright (c) 1980, 1983, 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. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * -
- * Portions Copyright (c) 1993 by Digital Equipment Corporation.
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies, and that
- * the name of Digital Equipment Corporation not be used in advertising or
- * publicity pertaining to distribution of the document or software without
- * specific, written prior permission.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS.   IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- * -
- * Portions Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
- * 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 WIDE Project and
- *    its contributors.
- * 4. Neither the name of the project 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 PROJECT 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 PROJECT 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.
- * -
- * --Copyright--
- */
-
-/*
- *      @(#)netdb.h    8.1 (Berkeley) 6/2/93
- *     Id: netdb.h,v 1.22 2008/02/28 05:34:17 marka Exp
- */
-
-#ifndef _NETDB_H_
-#define        _NETDB_H_
-
-#include <machine/ansi.h>
-#include <machine/endian_machdep.h>
-#include <sys/ansi.h>
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <inttypes.h>
-/*
- * Data types
- */
-#ifndef socklen_t
-typedef __socklen_t    socklen_t;
-#define        socklen_t       __socklen_t
-#endif
-
-#ifdef  _BSD_SIZE_T_
-typedef _BSD_SIZE_T_   size_t;
-#undef  _BSD_SIZE_T_
-#endif
-
-#if defined(_NETBSD_SOURCE)
-#ifndef _PATH_HEQUIV
-#define        _PATH_HEQUIV    "/etc/hosts.equiv"
-#endif
-#ifndef _PATH_HOSTS
-#define        _PATH_HOSTS     "/etc/hosts"
-#endif
-#ifndef _PATH_NETWORKS
-#define        _PATH_NETWORKS  "/etc/networks"
-#endif
-#ifndef _PATH_PROTOCOLS
-#define        _PATH_PROTOCOLS "/etc/protocols"
-#endif
-#ifndef _PATH_SERVICES
-#define        _PATH_SERVICES  "/etc/services"
-#endif
-#ifndef _PATH_SERVICES_CDB
-#define        _PATH_SERVICES_CDB "/var/db/services.cdb"
-#endif
-#ifndef _PATH_SERVICES_DB
-#define        _PATH_SERVICES_DB "/var/db/services.db"
-#endif
-#ifdef __minix
-#define        _PATH_SERVACCES "/etc/serv.access"
-#endif
-#endif
-
-__BEGIN_DECLS
-extern int h_errno;
-extern int * __h_errno(void);
-#ifdef _REENTRANT
-#define        h_errno (*__h_errno())
-#endif
-__END_DECLS
-
-/*%
- * Structures returned by network data base library.  All addresses are
- * supplied in host order, and returned in network order (suitable for
- * use in system calls).
- */
-struct hostent {
-       char    *h_name;        /*%< official name of host */
-       char    **h_aliases;    /*%< alias list */
-       int     h_addrtype;     /*%< host address type */
-       int     h_length;       /*%< length of address */
-       char    **h_addr_list;  /*%< list of addresses from name server */
-#define        h_addr  h_addr_list[0]  /*%< address, for backward compatiblity */
-};
-
-/*%
- * Assumption here is that a network number
- * fits in an unsigned long -- probably a poor one.
- */
-struct netent {
-       char            *n_name;        /*%< official name of net */
-       char            **n_aliases;    /*%< alias list */
-       int             n_addrtype;     /*%< net address type */
-#if (defined(__sparc__) && defined(_LP64)) || \
-    (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _BIG_ENDIAN))
-       int             __n_pad0;       /* ABI compatibility */
-#endif
-       uint32_t        n_net;          /*%< network # */
-#if defined(__alpha__) || (defined(__i386__) && defined(_LP64)) || \
-    (defined(__sh__) && defined(_LP64) && (_BYTE_ORDER == _LITTLE_ENDIAN))
-       int             __n_pad0;       /* ABI compatibility */
-#endif
-};
-
-struct servent {
-       char    *s_name;        /*%< official service name */
-       char    **s_aliases;    /*%< alias list */
-       int     s_port;         /*%< port # */
-       char    *s_proto;       /*%< protocol to use */
-};
-
-struct protoent {
-       char    *p_name;        /*%< official protocol name */
-       char    **p_aliases;    /*%< alias list */
-       int     p_proto;        /*%< protocol # */
-};
-
-/*
- * Note: ai_addrlen used to be a size_t, per RFC 2553.
- * In XNS5.2, and subsequently in POSIX-2001 and
- * draft-ietf-ipngwg-rfc2553bis-02.txt it was changed to a socklen_t.
- * To accommodate for this while preserving binary compatibility with the
- * old interface, we prepend or append 32 bits of padding, depending on
- * the (LP64) architecture's endianness.
- *
- * This should be deleted the next time the libc major number is
- * incremented.
- */
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
-    defined(_NETBSD_SOURCE)
-struct addrinfo {
-       int             ai_flags;       /*%< AI_PASSIVE, AI_CANONNAME */
-       int             ai_family;      /*%< PF_xxx */
-       int             ai_socktype;    /*%< SOCK_xxx */
-       int             ai_protocol;    /*%< 0 or IPPROTO_xxx for IPv4 and IPv6 */
-#if defined(__sparc__) && defined(_LP64)
-       int             __ai_pad0;      /* ABI compatibility */
-#endif
-       socklen_t        ai_addrlen;    /*%< length of ai_addr */
-#if defined(__alpha__) || (defined(__i386__) && defined(_LP64))
-       int             __ai_pad0;      /* ABI compatibility */
-#endif
-       char            *ai_canonname;  /*%< canonical name for hostname */
-       struct sockaddr *ai_addr;       /*%< binary address */
-       struct addrinfo *ai_next;       /*%< next structure in linked list */
-};
-#endif
-
-/*%
- * Error return codes from gethostbyname() and gethostbyaddr()
- * (left in extern int h_errno).
- */
-
-#if defined(_NETBSD_SOURCE)
-#define        NETDB_INTERNAL  -1      /*%< see errno */
-#define        NETDB_SUCCESS   0       /*%< no problem */
-#endif
-#define        NO_ADDRESS      NO_DATA         /* no address, look for MX record */
-#define        HOST_NOT_FOUND  1 /*%< Authoritative Answer Host not found */
-#define        TRY_AGAIN       2 /*%< Non-Authoritive Host not found, or SERVERFAIL */
-#define        NO_RECOVERY     3 /*%< Non recoverable errors, FORMERR, REFUSED, NOTIMP */
-#define        NO_DATA         4 /*%< Valid name, no data record of requested type */
-#if defined(_NETBSD_SOURCE)
-#define        NO_ADDRESS      NO_DATA         /*%< no address, look for MX record */
-#endif
-
-/*
- * Error return codes from getaddrinfo()
- */
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
-    defined(_NETBSD_SOURCE)
-#define        EAI_ADDRFAMILY   1      /*%< address family for hostname not supported */
-#define        EAI_AGAIN        2      /*%< temporary failure in name resolution */
-#define        EAI_BADFLAGS     3      /*%< invalid value for ai_flags */
-#define        EAI_FAIL         4      /*%< non-recoverable failure in name resolution */
-#define        EAI_FAMILY       5      /*%< ai_family not supported */
-#define        EAI_MEMORY       6      /*%< memory allocation failure */
-#define        EAI_NODATA       7      /*%< no address associated with hostname */
-#define        EAI_NONAME       8      /*%< hostname nor servname provided, or not known */
-#define        EAI_SERVICE      9      /*%< servname not supported for ai_socktype */
-#define        EAI_SOCKTYPE    10      /*%< ai_socktype not supported */
-#define        EAI_SYSTEM      11      /*%< system error returned in errno */
-#define        EAI_BADHINTS    12      /* invalid value for hints */
-#define        EAI_PROTOCOL    13      /* resolved protocol is unknown */
-#define        EAI_OVERFLOW    14      /* argument buffer overflow */
-#define        EAI_MAX         15
-#endif /* _POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE >= 520 || _NETBSD_SOURCE */
-
-/*%
- * Flag values for getaddrinfo()
- */
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
-    defined(_NETBSD_SOURCE)
-#define        AI_PASSIVE      0x00000001 /* get address to use bind() */
-#define        AI_CANONNAME    0x00000002 /* fill ai_canonname */
-#define        AI_NUMERICHOST  0x00000004 /* prevent host name resolution */
-#define        AI_NUMERICSERV  0x00000008 /* prevent service name resolution */
-/* valid flags for addrinfo (not a standard def, apps should not use it) */
-#define        AI_MASK \
-    (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV)
-#endif
-
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
-    defined(_NETBSD_SOURCE)
-/*%
- * Constants for getnameinfo()
- */
-#if defined(_NETBSD_SOURCE)
-#define        NI_MAXHOST      1025
-#define        NI_MAXSERV      32
-#endif
-
-/*%
- * Flag values for getnameinfo()
- */
-#define        NI_NOFQDN       0x00000001
-#define        NI_NUMERICHOST  0x00000002
-#define        NI_NAMEREQD     0x00000004
-#define        NI_NUMERICSERV  0x00000008
-#define        NI_DGRAM        0x00000010
-#define        NI_WITHSCOPEID  0x00000020
-#define        NI_NUMERICSCOPE 0x00000040
-
-/*%
- * Scope delimit character
- */
-#if defined(_NETBSD_SOURCE)
-#define        SCOPE_DELIMITER '%'
-#endif
-#endif /* (_POSIX_C_SOURCE - 0) >= 200112L || ... */
-
-__BEGIN_DECLS
-void           endhostent(void);
-void           endnetent(void);
-void           endprotoent(void);
-void           endservent(void);
-#if (_XOPEN_SOURCE - 0) >= 520 && (_XOPEN_SOURCE - 0) < 600 || \
-    defined(_NETBSD_SOURCE)
-#if 0 /* we do not ship this */
-void           freehostent(struct hostent *);
-#endif
-#endif
-struct hostent *gethostbyaddr(const char *, socklen_t, int);
-struct hostent *gethostbyname(const char *);
-#if defined(_NETBSD_SOURCE)
-struct hostent *gethostbyname2(const char *, int);
-#endif
-struct hostent *gethostent(void);
-struct netent  *getnetbyaddr(uint32_t, int);
-struct netent  *getnetbyname(const char *);
-struct netent  *getnetent(void);
-struct protoent        *getprotobyname(const char *);
-struct protoent        *getprotobynumber(int);
-struct protoent        *getprotoent(void);
-struct servent *getservbyname(const char *, const char *);
-struct servent *getservbyport(int, const char *);
-struct servent *getservent(void);
-#if defined(_NETBSD_SOURCE)
-void           herror(const char *);
-const char     *hstrerror(int);
-#endif
-void           sethostent(int);
-#if defined(_NETBSD_SOURCE)
-/* void                sethostfile(const char *); */
-#endif
-void           setnetent(int);
-void           setprotoent(int);
-void           setservent(int);
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 520 || \
-    defined(_NETBSD_SOURCE)
-int            getaddrinfo(const char * __restrict, const char * __restrict,
-                                const struct addrinfo * __restrict,
-                                struct addrinfo ** __restrict);
-int            getnameinfo(const struct sockaddr * __restrict, socklen_t,
-                                char * __restrict, socklen_t,
-                                char * __restrict, socklen_t, int);
-struct addrinfo *allocaddrinfo(socklen_t);
-void           freeaddrinfo(struct addrinfo *);
-const char     *gai_strerror(int);
-#endif
-__END_DECLS
-
-#endif /* !_NETDB_H_ */
diff --git a/nbsd_include/netinet/in.h b/nbsd_include/netinet/in.h
deleted file mode 100644 (file)
index ba9d45c..0000000
+++ /dev/null
@@ -1,512 +0,0 @@
-/*     $NetBSD: in.h,v 1.86 2009/09/14 10:36:50 degroote Exp $ */
-
-/*
- * Copyright (c) 1982, 1986, 1990, 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. 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.
- *
- *     @(#)in.h        8.3 (Berkeley) 1/3/94
- */
-
-/*
- * Constants and structures defined by the internet system,
- * Per RFC 790, September 1981, and numerous additions.
- */
-
-#ifndef _NETINET_IN_H_
-#define        _NETINET_IN_H_
-
-#include <machine/int_types.h>
-
-#ifndef uint8_t
-typedef __uint8_t      uint8_t;
-#define        uint8_t         __uint8_t
-#endif
-
-#ifndef uint32_t
-typedef __uint32_t     uint32_t;
-#define        uint32_t        __uint32_t
-#endif
-
-#include <sys/ansi.h>
-
-#ifndef in_addr_t
-typedef __in_addr_t    in_addr_t;
-#define        in_addr_t       __in_addr_t
-#endif
-
-#ifndef in_port_t
-typedef __in_port_t    in_port_t;
-#define        in_port_t       __in_port_t
-#endif
-
-#ifndef sa_family_t
-typedef __sa_family_t  sa_family_t;
-#define        sa_family_t     __sa_family_t
-#endif
-
-/*
- * Protocols
- */
-#define        IPPROTO_IP              0               /* dummy for IP */
-#define        IPPROTO_HOPOPTS         0               /* IP6 hop-by-hop options */
-#define        IPPROTO_ICMP            1               /* control message protocol */
-#define        IPPROTO_IGMP            2               /* group mgmt protocol */
-#define        IPPROTO_GGP             3               /* gateway^2 (deprecated) */
-#define        IPPROTO_IPV4            4               /* IP header */
-#define        IPPROTO_IPIP            4               /* IP inside IP */
-#define        IPPROTO_TCP             6               /* tcp */
-#define        IPPROTO_EGP             8               /* exterior gateway protocol */
-#define        IPPROTO_PUP             12              /* pup */
-#define        IPPROTO_UDP             17              /* user datagram protocol */
-#define        IPPROTO_IDP             22              /* xns idp */
-#define        IPPROTO_TP              29              /* tp-4 w/ class negotiation */
-#define        IPPROTO_IPV6            41              /* IP6 header */
-#define        IPPROTO_ROUTING         43              /* IP6 routing header */
-#define        IPPROTO_FRAGMENT        44              /* IP6 fragmentation header */
-#define        IPPROTO_RSVP            46              /* resource reservation */
-#define        IPPROTO_GRE             47              /* GRE encaps RFC 1701 */
-#define        IPPROTO_ESP             50              /* encap. security payload */
-#define        IPPROTO_AH              51              /* authentication header */
-#define        IPPROTO_MOBILE          55              /* IP Mobility RFC 2004 */
-#define        IPPROTO_IPV6_ICMP       58              /* IPv6 ICMP */
-#define        IPPROTO_ICMPV6          58              /* ICMP6 */
-#define        IPPROTO_NONE            59              /* IP6 no next header */
-#define        IPPROTO_DSTOPTS         60              /* IP6 destination option */
-#define        IPPROTO_EON             80              /* ISO cnlp */
-#define        IPPROTO_ETHERIP         97              /* Ethernet-in-IP */
-#define        IPPROTO_ENCAP           98              /* encapsulation header */
-#define        IPPROTO_PIM             103             /* Protocol indep. multicast */
-#define        IPPROTO_IPCOMP          108             /* IP Payload Comp. Protocol */
-#define        IPPROTO_VRRP            112             /* VRRP RFC 2338 */
-#define        IPPROTO_CARP            112             /* Common Address Resolution Protocol */
-#define IPPROTO_PFSYNC      240     /* PFSYNC */
-#define        IPPROTO_RAW             255             /* raw IP packet */
-#define        IPPROTO_MAX             256
-
-/* last return value of *_input(), meaning "all job for this pkt is done".  */
-#define        IPPROTO_DONE            257
-
-/* sysctl placeholder for (FAST_)IPSEC */
-#define CTL_IPPROTO_IPSEC      258
-
-
-/*
- * Local port number conventions:
- *
- * Ports < IPPORT_RESERVED are reserved for privileged processes (e.g. root),
- * unless a kernel is compiled with IPNOPRIVPORTS defined.
- *
- * When a user does a bind(2) or connect(2) with a port number of zero,
- * a non-conflicting local port address is chosen.
- *
- * The default range is IPPORT_ANONMIN to IPPORT_ANONMAX, although
- * that is settable by sysctl(3); net.inet.ip.anonportmin and
- * net.inet.ip.anonportmax respectively.
- *
- * A user may set the IPPROTO_IP option IP_PORTRANGE to change this
- * default assignment range.
- *
- * The value IP_PORTRANGE_DEFAULT causes the default behavior.
- *
- * The value IP_PORTRANGE_HIGH is the same as IP_PORTRANGE_DEFAULT,
- * and exists only for FreeBSD compatibility purposes.
- *
- * The value IP_PORTRANGE_LOW changes the range to the "low" are
- * that is (by convention) restricted to privileged processes.
- * This convention is based on "vouchsafe" principles only.
- * It is only secure if you trust the remote host to restrict these ports.
- * The range is IPPORT_RESERVEDMIN to IPPORT_RESERVEDMAX.
- */
-
-#define        IPPORT_RESERVED         1024
-#define        IPPORT_ANONMIN          49152
-#define        IPPORT_ANONMAX          65535
-#define        IPPORT_RESERVEDMIN      600
-#define        IPPORT_RESERVEDMAX      (IPPORT_RESERVED-1)
-
-/*
- * Internet address (a structure for historical reasons)
- */
-struct in_addr {
-       in_addr_t s_addr;
-} __packed;
-
-/*
- * Definitions of bits in internet address integers.
- * On subnets, the decomposition of addresses to host and net parts
- * is done according to subnet mask, not the masks here.
- *
- * By byte-swapping the constants, we avoid ever having to byte-swap IP
- * addresses inside the kernel.  Unfortunately, user-level programs rely
- * on these macros not doing byte-swapping.
- */
-#ifdef _KERNEL
-#define        __IPADDR(x)     ((uint32_t) htonl((uint32_t)(x)))
-#else
-#define        __IPADDR(x)     ((uint32_t)(x))
-#endif
-
-#define        IN_CLASSA(i)            (((uint32_t)(i) & __IPADDR(0x80000000)) == \
-                                __IPADDR(0x00000000))
-#define        IN_CLASSA_NET           __IPADDR(0xff000000)
-#define        IN_CLASSA_NSHIFT        24
-#define        IN_CLASSA_HOST          __IPADDR(0x00ffffff)
-#define        IN_CLASSA_MAX           128
-
-#define        IN_CLASSB(i)            (((uint32_t)(i) & __IPADDR(0xc0000000)) == \
-                                __IPADDR(0x80000000))
-#define        IN_CLASSB_NET           __IPADDR(0xffff0000)
-#define        IN_CLASSB_NSHIFT        16
-#define        IN_CLASSB_HOST          __IPADDR(0x0000ffff)
-#define        IN_CLASSB_MAX           65536
-
-#define        IN_CLASSC(i)            (((uint32_t)(i) & __IPADDR(0xe0000000)) == \
-                                __IPADDR(0xc0000000))
-#define        IN_CLASSC_NET           __IPADDR(0xffffff00)
-#define        IN_CLASSC_NSHIFT        8
-#define        IN_CLASSC_HOST          __IPADDR(0x000000ff)
-
-#define        IN_CLASSD(i)            (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
-                                __IPADDR(0xe0000000))
-/* These ones aren't really net and host fields, but routing needn't know. */
-#define        IN_CLASSD_NET           __IPADDR(0xf0000000)
-#define        IN_CLASSD_NSHIFT        28
-#define        IN_CLASSD_HOST          __IPADDR(0x0fffffff)
-#define        IN_MULTICAST(i)         IN_CLASSD(i)
-
-#define        IN_EXPERIMENTAL(i)      (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
-                                __IPADDR(0xf0000000))
-#define        IN_BADCLASS(i)          (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
-                                __IPADDR(0xf0000000))
-
-#define IN_LINKLOCAL(i)        (((uint32_t)(i) & __IPADDR(0xffff0000)) == \
-                        __IPADDR(0xa9fe0000))
-
-#define        IN_PRIVATE(i)   ((((uint32_t)(i) & __IPADDR(0xff000000)) ==     \
-                         __IPADDR(0x0a000000)) ||                      \
-                        (((uint32_t)(i) & __IPADDR(0xfff00000)) ==     \
-                         __IPADDR(0xac100000)) ||                      \
-                        (((uint32_t)(i) & __IPADDR(0xffff0000)) ==     \
-                         __IPADDR(0xc0a80000)))
-
-#define        IN_LOCAL_GROUP(i)       (((uint32_t)(i) & __IPADDR(0xffffff00)) == \
-                                __IPADDR(0xe0000000))
-
-#define        IN_ANY_LOCAL(i)         (IN_LINKLOCAL(i) || IN_LOCAL_GROUP(i))
-
-#define        INADDR_ANY              __IPADDR(0x00000000)
-#define        INADDR_LOOPBACK         __IPADDR(0x7f000001)
-#define        INADDR_BROADCAST        __IPADDR(0xffffffff)    /* must be masked */
-#define        INADDR_NONE             __IPADDR(0xffffffff)    /* -1 return */
-
-#define        INADDR_UNSPEC_GROUP     __IPADDR(0xe0000000)    /* 224.0.0.0 */
-#define        INADDR_ALLHOSTS_GROUP   __IPADDR(0xe0000001)    /* 224.0.0.1 */
-#define        INADDR_ALLRTRS_GROUP    __IPADDR(0xe0000002)    /* 224.0.0.2 */
-#define        INADDR_CARP_GROUP       __IPADDR(0xe0000012)    /* 224.0.0.18 */
-#define        INADDR_MAX_LOCAL_GROUP  __IPADDR(0xe00000ff)    /* 224.0.0.255 */
-
-#define        IN_LOOPBACKNET          127                     /* official! */
-
-/*
- * Socket address, internet style.
- */
-#ifdef __minix
-struct sockaddr_in
-{
-       sa_family_t     sin_family;
-       in_port_t       sin_port;
-       struct in_addr  sin_addr;
-};
-#else /* !__minix */
-struct sockaddr_in {
-       uint8_t         sin_len;
-       sa_family_t     sin_family;
-       in_port_t       sin_port;
-       struct in_addr  sin_addr;
-       __int8_t        sin_zero[8];
-};
-#endif /* !__minix */
-
-#define        INET_ADDRSTRLEN                 16
-
-#ifndef __minix
-/*
- * Structure used to describe IP options.
- * Used to store options internally, to pass them to a process,
- * or to restore options retrieved earlier.
- * The ip_dst is used for the first-hop gateway when using a source route
- * (this gets put into the header proper).
- */
-struct ip_opts {
-       struct in_addr  ip_dst;         /* first hop, 0 w/o src rt */
-#if defined(__cplusplus)
-       __int8_t        Ip_opts[40];    /* actually variable in size */
-#else
-       __int8_t        ip_opts[40];    /* actually variable in size */
-#endif
-};
-#endif /* __minix */
-
-/*
- * Options for use with [gs]etsockopt at the IP level.
- * First word of comment is data type; bool is stored in int.
- */
-#ifndef __minix
-#define        IP_OPTIONS              1    /* buf/ip_opts; set/get IP options */
-#define        IP_HDRINCL              2    /* int; header is included with data */
-#define        IP_TOS                  3    /* int; IP type of service and preced. */
-#define        IP_TTL                  4    /* int; IP time to live */
-#define        IP_RECVOPTS             5    /* bool; receive all IP opts w/dgram */
-#define        IP_RECVRETOPTS          6    /* bool; receive IP opts for response */
-#define        IP_RECVDSTADDR          7    /* bool; receive IP dst addr w/dgram */
-#define        IP_RETOPTS              8    /* ip_opts; set/get IP options */
-#define        IP_MULTICAST_IF         9    /* in_addr; set/get IP multicast i/f  */
-#define        IP_MULTICAST_TTL        10   /* u_char; set/get IP multicast ttl */
-#define        IP_MULTICAST_LOOP       11   /* u_char; set/get IP multicast loopback */
-#endif /* !__minix */
-#define        IP_ADD_MEMBERSHIP       12   /* ip_mreq; add an IP group membership */
-#define        IP_DROP_MEMBERSHIP      13   /* ip_mreq; drop an IP group membership */
-#ifndef __minix
-#define        IP_PORTRANGE            19   /* int; range to use for ephemeral port */
-#define        IP_RECVIF               20   /* bool; receive reception if w/dgram */
-#define        IP_ERRORMTU             21   /* int; get MTU of last xmit = EMSGSIZE */
-#if 1 /*IPSEC*/
-#define        IP_IPSEC_POLICY         22 /* struct; get/set security policy */
-#endif
-#define        IP_RECVTTL              23   /* bool; receive IP TTL w/dgram */
-#define        IP_MINTTL               24   /* minimum TTL for packet or drop */
-#endif /* !__minix */
-
-#ifndef __minix
-/*
- * Defaults and limits for options
- */
-#define        IP_DEFAULT_MULTICAST_TTL  1     /* normally limit m'casts to 1 hop  */
-#define        IP_DEFAULT_MULTICAST_LOOP 1     /* normally hear sends if a member  */
-#define        IP_MAX_MEMBERSHIPS      20      /* per socket; must fit in one mbuf */
-#endif /* !__minix */
-
-/*
- * Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
- */
-struct ip_mreq {
-       struct  in_addr imr_multiaddr;  /* IP multicast address of group */
-       struct  in_addr imr_interface;  /* local IP address of interface */
-};
-
-#ifndef __minix
-/*
- * Argument for IP_PORTRANGE:
- * - which range to search when port is unspecified at bind() or connect()
- */
-#define        IP_PORTRANGE_DEFAULT    0       /* default range */
-#define        IP_PORTRANGE_HIGH       1       /* same as DEFAULT (FreeBSD compat) */
-#define        IP_PORTRANGE_LOW        2       /* use privileged range */
-
-#if defined(_NETBSD_SOURCE)
-/*
- * Definitions for inet sysctl operations.
- *
- * Third level is protocol number.
- * Fourth level is desired variable within that protocol.
- */
-#define        IPPROTO_MAXID   (IPPROTO_AH + 1)        /* don't list to IPPROTO_MAX */
-
-#define        CTL_IPPROTO_NAMES { \
-       { "ip", CTLTYPE_NODE }, \
-       { "icmp", CTLTYPE_NODE }, \
-       { "igmp", CTLTYPE_NODE }, \
-       { "ggp", CTLTYPE_NODE }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { "tcp", CTLTYPE_NODE }, \
-       { 0, 0 }, \
-       { "egp", CTLTYPE_NODE }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { "pup", CTLTYPE_NODE }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { "udp", CTLTYPE_NODE }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { "idp", CTLTYPE_NODE }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { "ipsec", CTLTYPE_NODE }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { 0, 0 }, \
-       { "pim", CTLTYPE_NODE }, \
-}
-
-/*
- * Names for IP sysctl objects
- */
-#define        IPCTL_FORWARDING        1       /* act as router */
-#define        IPCTL_SENDREDIRECTS     2       /* may send redirects when forwarding */
-#define        IPCTL_DEFTTL            3       /* default TTL */
-#ifdef notyet
-#define        IPCTL_DEFMTU            4       /* default MTU */
-#endif
-#define        IPCTL_FORWSRCRT         5       /* forward source-routed packets */
-#define        IPCTL_DIRECTEDBCAST     6       /* default broadcast behavior */
-#define        IPCTL_ALLOWSRCRT        7       /* allow/drop all source-routed pkts */
-#define        IPCTL_SUBNETSARELOCAL   8       /* treat subnets as local addresses */
-#define        IPCTL_MTUDISC           9       /* allow path MTU discovery */
-#define        IPCTL_ANONPORTMIN      10       /* minimum ephemeral port */
-#define        IPCTL_ANONPORTMAX      11       /* maximum ephemeral port */
-#define        IPCTL_MTUDISCTIMEOUT   12       /* allow path MTU discovery */
-#define        IPCTL_MAXFLOWS         13       /* maximum ip flows allowed */
-#define        IPCTL_HOSTZEROBROADCAST 14      /* is host zero a broadcast addr? */
-#define        IPCTL_GIF_TTL          15       /* default TTL for gif encap packet */
-#define        IPCTL_LOWPORTMIN       16       /* minimum reserved port */
-#define        IPCTL_LOWPORTMAX       17       /* maximum reserved port */
-#define        IPCTL_MAXFRAGPACKETS   18       /* max packets reassembly queue */
-#define        IPCTL_GRE_TTL          19       /* default TTL for gre encap packet */
-#define        IPCTL_CHECKINTERFACE   20       /* drop pkts in from 'wrong' iface */
-#define        IPCTL_IFQ              21       /* ipintrq node */
-#define        IPCTL_RANDOMID         22       /* use random IP ids (if configured) */
-#define        IPCTL_LOOPBACKCKSUM    23       /* do IP checksum on loopback */
-#define        IPCTL_STATS             24      /* IP statistics */
-#define        IPCTL_MAXID            25
-
-#define        IPCTL_NAMES { \
-       { 0, 0 }, \
-       { "forwarding", CTLTYPE_INT }, \
-       { "redirect", CTLTYPE_INT }, \
-       { "ttl", CTLTYPE_INT }, \
-       { "mtu", CTLTYPE_INT }, \
-       { "forwsrcrt", CTLTYPE_INT }, \
-       { "directed-broadcast", CTLTYPE_INT }, \
-       { "allowsrcrt", CTLTYPE_INT }, \
-       { "subnetsarelocal", CTLTYPE_INT }, \
-       { "mtudisc", CTLTYPE_INT }, \
-       { "anonportmin", CTLTYPE_INT }, \
-       { "anonportmax", CTLTYPE_INT }, \
-       { "mtudisctimeout", CTLTYPE_INT }, \
-       { "maxflows", CTLTYPE_INT }, \
-       { "hostzerobroadcast", CTLTYPE_INT }, \
-       { "gifttl", CTLTYPE_INT }, \
-       { "lowportmin", CTLTYPE_INT }, \
-       { "lowportmax", CTLTYPE_INT }, \
-       { "maxfragpackets", CTLTYPE_INT }, \
-       { "grettl", CTLTYPE_INT }, \
-       { "checkinterface", CTLTYPE_INT }, \
-       { "ifq", CTLTYPE_NODE }, \
-       { "random_id", CTLTYPE_INT }, \
-       { "do_loopback_cksum", CTLTYPE_INT }, \
-       { "stats", CTLTYPE_STRUCT }, \
-}
-#endif /* _NETBSD_SOURCE */
-#endif /* __minix */
-
-/* INET6 stuff */
-#define        __KAME_NETINET_IN_H_INCLUDED_
-#include <netinet6/in6.h>
-#undef __KAME_NETINET_IN_H_INCLUDED_
-
-#endif /* !_NETINET_IN_H_ */
diff --git a/nbsd_include/netinet/tcp.h b/nbsd_include/netinet/tcp.h
deleted file mode 100644 (file)
index 17a0540..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*     $NetBSD: tcp.h,v 1.28 2007/12/25 18:33:47 perry Exp $   */
-
-/*
- * Copyright (c) 1982, 1986, 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. 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.
- *
- *     @(#)tcp.h       8.1 (Berkeley) 6/10/93
- */
-
-#ifndef _NETINET_TCP_H_
-#define _NETINET_TCP_H_
-
-#include <sys/featuretest.h>
-
-#if defined(_NETBSD_SOURCE)
-
-typedef u_int32_t tcp_seq;
-/*
- * TCP header.
- * Per RFC 793, September, 1981.
- * Updated by RFC 3168, September, 2001.
- */
-struct tcphdr {
-       u_int16_t th_sport;             /* source port */
-       u_int16_t th_dport;             /* destination port */
-       tcp_seq   th_seq;               /* sequence number */
-       tcp_seq   th_ack;               /* acknowledgement number */
-#if BYTE_ORDER == LITTLE_ENDIAN
-       /*LINTED non-portable bitfields*/
-       u_int8_t  th_x2:4,              /* (unused) */
-                 th_off:4;             /* data offset */
-#endif
-#if BYTE_ORDER == BIG_ENDIAN
-       /*LINTED non-portable bitfields*/
-       u_int8_t  th_off:4,             /* data offset */
-                 th_x2:4;              /* (unused) */
-#endif
-       u_int8_t  th_flags;
-#define        TH_FIN    0x01
-#define        TH_SYN    0x02
-#define        TH_RST    0x04
-#define        TH_PUSH   0x08
-#define        TH_ACK    0x10
-#define        TH_URG    0x20
-#define        TH_ECE    0x40
-#define        TH_CWR    0x80
-       u_int16_t th_win;                       /* window */
-       u_int16_t th_sum;                       /* checksum */
-       u_int16_t th_urp;                       /* urgent pointer */
-} __packed;
-
-#define        TCPOPT_EOL              0
-#define        TCPOPT_NOP              1
-#define        TCPOPT_MAXSEG           2
-#define           TCPOLEN_MAXSEG               4
-#define        TCPOPT_WINDOW           3
-#define           TCPOLEN_WINDOW               3
-#define        TCPOPT_SACK_PERMITTED   4               /* Experimental */
-#define           TCPOLEN_SACK_PERMITTED       2
-#define        TCPOPT_SACK             5               /* Experimental */
-#define        TCPOPT_TIMESTAMP        8
-#define           TCPOLEN_TIMESTAMP            10
-#define           TCPOLEN_TSTAMP_APPA          (TCPOLEN_TIMESTAMP+2) /* appendix A */
-
-#define TCPOPT_TSTAMP_HDR      \
-    (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
-
-#define        TCPOPT_SIGNATURE        19              /* Keyed MD5: RFC 2385 */
-#define           TCPOLEN_SIGNATURE            18
-#define    TCPOLEN_SIGLEN              (TCPOLEN_SIGNATURE+2) /* padding */
-
-#define MAX_TCPOPTLEN  40      /* max # bytes that go in options */
-
-/*
- * Default maximum segment size for TCP.
- * This is defined by RFC 1112 Sec 4.2.2.6.
- */
-#define        TCP_MSS         536
-
-#define        TCP_MINMSS      216
-
-#define        TCP_MAXWIN      65535   /* largest value for (unscaled) window */
-
-#define        TCP_MAX_WINSHIFT        14      /* maximum window shift */
-
-#define        TCP_MAXBURST    4       /* maximum segments in a burst */
-
-#endif /* _NETBSD_SOURCE */
-
-/*
- * User-settable options (used with setsockopt).
- */
-#define        TCP_NODELAY     1       /* don't delay send to coalesce packets */
-
-#endif /* !_NETINET_TCP_H_ */
diff --git a/nbsd_include/paths.h b/nbsd_include/paths.h
deleted file mode 100644 (file)
index 410f920..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*     $NetBSD: paths.h,v 1.39 2010/12/29 15:53:57 pooka Exp $ */
-
-/*
- * Copyright (c) 1989, 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. 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.
- *
- *     @(#)paths.h     8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _PATHS_H_
-#define        _PATHS_H_
-
-/*
- * Default user search path.
- * Set by login(1), rshd(8), rexecd(8)
- * Used by execvp(3) absent PATH from the environ(7)
- */
-#ifdef RESCUEDIR
-#define        _PATH_DEFPATH   RESCUEDIR ":/usr/bin:/bin:/usr/pkg/bin:/usr/local/bin"
-#else
-#define        _PATH_DEFPATH   "/usr/bin:/bin:/usr/pkg/bin:/usr/local/bin"
-#endif
-
-/*
- * All standard utilities path.
- * Set by init(8) for system programs & scripts (e.g. /etc/rc)
- * Used by ttyaction(3), whereis(1)
- */
-#define        _PATH_STDPATH \
-       "/usr/bin:/bin:/usr/sbin:/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin"
-
-#define        _PATH_AUDIO     "/dev/audio"
-#define        _PATH_AUDIO0    "/dev/audio0"
-#define        _PATH_AUDIOCTL  "/dev/audioctl"
-#define        _PATH_AUDIOCTL0 "/dev/audioctl0"
-#define        _PATH_BPF       "/dev/bpf"
-#define        _PATH_CLOCKCTL  "/dev/clockctl"
-#define        _PATH_CONSOLE   "/dev/console"
-#define        _PATH_CONSTTY   "/dev/constty"
-#define        _PATH_CSMAPPER  "/usr/share/i18n/csmapper"
-#define        _PATH_DEFTAPE   "/dev/nrst0"
-#define        _PATH_DEVDB     "/var/run/dev.db"
-#define        _PATH_DEVNULL   "/dev/null"
-#define        _PATH_DRUM      "/dev/drum"
-#define        _PATH_ESDB      "/usr/share/i18n/esdb"
-#define        _PATH_FTPUSERS  "/etc/ftpusers"
-#define        _PATH_GETTYTAB  "/etc/gettytab"
-#define        _PATH_I18NMODULE "/usr/lib/i18n"
-#define        _PATH_ICONV     "/usr/share/i18n/iconv"
-#define        _PATH_KMEM      "/dev/kmem"
-#define        _PATH_KSYMS     "/dev/ksyms"
-#define        _PATH_KVMDB     "/var/db/kvm.db"
-#define        _PATH_LOCALE    "/usr/share/locale"
-#define        _PATH_MAILDIR   "/var/mail"
-#define        _PATH_MAN       "/usr/share/man"
-#define        _PATH_MEM       "/dev/mem"
-#define        _PATH_MIXER     "/dev/mixer"
-#define        _PATH_MIXER0    "/dev/mixer0"
-#define        _PATH_NOLOGIN   "/etc/nologin"
-#define _PATH_POWER    "/dev/power"
-#define        _PATH_PRINTCAP  "/etc/printcap"
-#define        _PATH_PUD       "/dev/pud"
-#define        _PATH_PUFFS     "/dev/puffs"
-#define        _PATH_RANDOM    "/dev/random"
-#define        _PATH_SENDMAIL  "/usr/sbin/sendmail"
-#define        _PATH_SHELLS    "/etc/shells"
-#define        _PATH_SKEYKEYS  "/etc/skeykeys"
-#define        _PATH_SOUND     "/dev/sound"
-#define        _PATH_SOUND0    "/dev/sound0"
-#define        _PATH_SYSMON    "/dev/sysmon"
-#define        _PATH_TTY       "/dev/tty"
-#define        _PATH_UNIX      "/netbsd"
-#define        _PATH_URANDOM   "/dev/urandom"
-#define        _PATH_VIDEO     "/dev/video"
-#define        _PATH_VIDEO0    "/dev/video0"
-
-/*
- * Provide trailing slash, since mostly used for building pathnames.
- * See the __CONCAT() macro from <sys/cdefs.h> for cpp examples.
- */
-#define        _PATH_DEV       "/dev/"
-#define        _PATH_DEV_PTS   "/dev/pts/"
-#define        _PATH_EMUL_AOUT "/emul/aout/"
-#define        _PATH_TMP       "/tmp/"
-#define        _PATH_VARDB     "/var/db/"
-#define        _PATH_VARRUN    "/var/run/"
-#define        _PATH_VARTMP    "/var/tmp/"
-
-/*
- * Paths that may change if RESCUEDIR is defined.
- * Used by tools in /rescue.
- */
-#ifdef RESCUEDIR
-#define        _PATH_BSHELL    RESCUEDIR "/sh"
-#define        _PATH_CSHELL    RESCUEDIR "/csh"
-#define        _PATH_VI        RESCUEDIR "/vi"
-#else
-#define        _PATH_BSHELL    "/bin/sh"
-#define        _PATH_CSHELL    "/bin/csh"
-#define        _PATH_VI        "/usr/bin/vi"
-#endif
-
-#ifdef __minix
-#include <minix/paths.h>
-#endif /* !__minix */
-
-#endif /* !_PATHS_H_ */
-
diff --git a/nbsd_include/pwd.h b/nbsd_include/pwd.h
deleted file mode 100644 (file)
index 4a471f0..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*     $NetBSD: pwd.h,v 1.42 2009/01/11 03:04:12 christos Exp $        */
-
-/*-
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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. 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.
- *
- *     @(#)pwd.h       8.2 (Berkeley) 1/21/94
- */
-
-/*-
- * Portions Copyright(C) 1995, Jason Downs.  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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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(S) 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 _PWD_H_
-#define        _PWD_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <sys/types.h>
-
-#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
-#define        _PATH_PASSWD            "/etc/passwd"
-#define        _PATH_MASTERPASSWD      "/etc/master.passwd"
-#define        _PATH_MASTERPASSWD_LOCK "/etc/ptmp"
-
-#define        _PATH_PASSWD_CONF       "/etc/passwd.conf"
-#define        _PATH_PASSWDCONF        _PATH_PASSWD_CONF       /* XXX: compat */
-#define        _PATH_USERMGMT_CONF     "/etc/usermgmt.conf"
-
-#define        _PATH_MP_DB             "/etc/pwd.db"
-#define        _PATH_SMP_DB            "/etc/spwd.db"
-
-#define        _PATH_PWD_MKDB          "/usr/sbin/pwd_mkdb"
-
-#define        _PW_KEYBYNAME           '1'     /* stored by name */
-#define        _PW_KEYBYNUM            '2'     /* stored by entry in the "file" */
-#define        _PW_KEYBYUID            '3'     /* stored by uid */
-
-#define        _PASSWORD_EFMT1         '_'     /* extended DES encryption format */
-#define        _PASSWORD_NONDES        '$'     /* non-DES encryption formats */
-
-#define        _PASSWORD_LEN           128     /* max length, not counting NUL */
-
-#define _PASSWORD_NOUID                0x01    /* flag for no specified uid. */
-#define _PASSWORD_NOGID                0x02    /* flag for no specified gid. */
-#define _PASSWORD_NOCHG                0x04    /* flag for no specified change. */
-#define _PASSWORD_NOEXP                0x08    /* flag for no specified expire. */
-
-#define _PASSWORD_OLDFMT       0x10    /* flag to expect an old style entry */
-#define _PASSWORD_NOWARN       0x20    /* no warnings for bad entries */
-
-#define _PASSWORD_WARNDAYS     14      /* days to warn about expiry */
-#define _PASSWORD_CHGNOW       -1      /* special day to force password
-                                        * change at next login */
-#endif
-
-struct passwd {
-       __aconst char *pw_name;         /* user name */
-       __aconst char *pw_passwd;       /* encrypted password */
-       uid_t          pw_uid;          /* user uid */
-       gid_t          pw_gid;          /* user gid */
-       time_t         pw_change;       /* password change time */
-       __aconst char *pw_class;        /* user login class */
-       __aconst char *pw_gecos;        /* general information */
-       __aconst char *pw_dir;          /* home directory */
-       __aconst char *pw_shell;        /* default shell */
-       time_t         pw_expire;       /* account expiration */
-};
-
-__BEGIN_DECLS
-#ifndef __LIBC12_SOURCE__
-struct passwd  *getpwuid(uid_t) __RENAME(__getpwuid50);
-struct passwd  *getpwnam(const char *) __RENAME(__getpwnam50);
-#endif
-#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
-#ifndef __LIBC12_SOURCE__
-int             getpwnam_r(const char *, struct passwd *, char *, size_t,
-    struct passwd **) __RENAME(__getpwnam_r50);
-int             getpwuid_r(uid_t, struct passwd *, char *, size_t,
-    struct passwd **) __RENAME(__getpwuid_r50);
-#endif
-#endif
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-#ifndef __LIBC12_SOURCE__
-struct passwd  *getpwent(void) __RENAME(__getpwent50);
-#endif
-void            setpwent(void);
-void            endpwent(void);
-#endif
-#if defined(_NETBSD_SOURCE)
-int             pw_gensalt(char *, size_t, const char *, const char *);
-#ifndef __LIBC12_SOURCE__
-int             pw_scan(char *, struct passwd *, int *) __RENAME(__pw_scan50);
-int             getpwent_r(struct passwd *, char *, size_t, struct passwd **)
-    __RENAME(__getpwent_r50);
-#endif
-int             setpassent(int);
-const char     *user_from_uid(uid_t, int);
-int             uid_from_user(const char *, uid_t *);
-#ifndef __LIBC12_SOURCE__
-int             pwcache_userdb(int (*)(int), void (*)(void),
-    struct passwd * (*)(const char *), struct passwd * (*)(uid_t))
-    __RENAME(__pwcache_userdb50);
-#endif
-#endif
-__END_DECLS
-
-#endif /* !_PWD_H_ */
diff --git a/nbsd_include/regex.h b/nbsd_include/regex.h
deleted file mode 100644 (file)
index b02a82e..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/*     $NetBSD: regex.h,v 1.13 2005/09/13 01:44:32 christos Exp $      */
-
-/*-
- * Copyright (c) 1992, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer of the University of Toronto.
- *
- * 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. 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.
- *
- *     @(#)regex.h     8.2 (Berkeley) 1/3/94
- */
-
-/*-
- * Copyright (c) 1992 Henry Spencer.
- *
- * This code is derived from software contributed to Berkeley by
- * Henry Spencer of the University of Toronto.
- *
- * 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.
- *
- *     @(#)regex.h     8.2 (Berkeley) 1/3/94
- */
-
-#ifndef _REGEX_H_
-#define        _REGEX_H_
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-/* types */
-typedef off_t regoff_t;
-
-typedef struct {
-       int re_magic;
-       size_t re_nsub;         /* number of parenthesized subexpressions */
-       const char *re_endp;    /* end pointer for REG_PEND */
-       struct re_guts *re_g;   /* none of your business :-) */
-} regex_t;
-
-typedef struct {
-       regoff_t rm_so;         /* start of match */
-       regoff_t rm_eo;         /* end of match */
-} regmatch_t;
-
-/* regcomp() flags */
-#define        REG_BASIC       0000
-#define        REG_EXTENDED    0001
-#define        REG_ICASE       0002
-#define        REG_NOSUB       0004
-#define        REG_NEWLINE     0010
-#define        REG_NOSPEC      0020
-#define        REG_PEND        0040
-#define        REG_DUMP        0200
-
-/* regerror() flags */
-#define        REG_NOMATCH      1
-#define        REG_BADPAT       2
-#define        REG_ECOLLATE     3
-#define        REG_ECTYPE       4
-#define        REG_EESCAPE      5
-#define        REG_ESUBREG      6
-#define        REG_EBRACK       7
-#define        REG_EPAREN       8
-#define        REG_EBRACE       9
-#define        REG_BADBR       10
-#define        REG_ERANGE      11
-#define        REG_ESPACE      12
-#define        REG_BADRPT      13
-#define        REG_EMPTY       14
-#define        REG_ASSERT      15
-#define        REG_INVARG      16
-#define        REG_ENOSYS      17
-#define        REG_ATOI        255     /* convert name to number (!) */
-#define        REG_ITOA        0400    /* convert number to name (!) */
-
-/* regexec() flags */
-#define        REG_NOTBOL      00001
-#define        REG_NOTEOL      00002
-#define        REG_STARTEND    00004
-#define        REG_TRACE       00400   /* tracing of execution */
-#define        REG_LARGE       01000   /* force large representation */
-#define        REG_BACKR       02000   /* force use of backref code */
-
-__BEGIN_DECLS
-int    regcomp(regex_t * __restrict, const char * __restrict, int);
-size_t regerror(int, const regex_t * __restrict, char * __restrict, size_t);
-int    regexec(const regex_t * __restrict,
-           const char * __restrict, size_t, regmatch_t [], int);
-void   regfree(regex_t *);
-__END_DECLS
-
-#endif /* !_REGEX_H_ */
diff --git a/nbsd_include/regexp.h b/nbsd_include/regexp.h
deleted file mode 100644 (file)
index b79955c..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*     $NetBSD: regexp.h,v 1.7 2005/02/03 04:39:32 perry Exp $ */
-
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley
- * by Henry Spencer.
- *
- * 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. 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.
- *
- *     @(#)regexp.h    8.1 (Berkeley) 6/2/93
- */
-
-/*
- * Copyright (c) 1986 by University of Toronto.
- *
- * This code is derived from software contributed to Berkeley
- * by Henry Spencer.
- *
- * 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.
- *
- *     @(#)regexp.h    8.1 (Berkeley) 6/2/93
- */
-
-#ifndef        _REGEXP_H_
-#define        _REGEXP_H_
-
-/*
- * Definitions etc. for regexp(3) routines.
- *
- * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
- * not the System V one.
- */
-#define NSUBEXP  10
-typedef struct regexp {
-       char *startp[NSUBEXP];
-       char *endp[NSUBEXP];
-       char regstart;          /* Internal use only. */
-       char reganch;           /* Internal use only. */
-       char *regmust;          /* Internal use only. */
-       int regmlen;            /* Internal use only. */
-       char program[1];        /* Unwarranted chumminess with compiler. */
-} regexp;
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-#ifdef __LIBCOMPAT_SOURCE__
-regexp *__compat_regcomp(const char *);
-int __compat_regexec(const  regexp *, const char *);
-void __compat_regsub(const  regexp *, const char *, char *);
-void __compat_regerror(const char *);
-#endif
-regexp *regcomp(const char *) __RENAME(__compat_regcomp);
-int regexec(const  regexp *, const char *) __RENAME(__compat_regexec);
-void regsub(const  regexp *, const char *, char *) __RENAME(__compat_regsub);
-void regerror(const char *) __RENAME(__compat_regerror);
-__END_DECLS
-
-#endif /* !_REGEXP_H_ */
diff --git a/nbsd_include/resolv.h b/nbsd_include/resolv.h
deleted file mode 100644 (file)
index c5325f8..0000000
+++ /dev/null
@@ -1,509 +0,0 @@
-/*     $NetBSD: resolv.h,v 1.38 2009/10/24 17:23:34 christos Exp $     */
-
-/*
- * Portions Copyright (C) 2004, 2005, 2008, 2009  Internet Systems Consortium, Inc. ("ISC")
- * Portions Copyright (C) 1995-2003  Internet Software Consortium.
- *
- * Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
- * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
- * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * Copyright (c) 1983, 1987, 1989
- *    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. 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.
- */
-
-/*%
- *     @(#)resolv.h    8.1 (Berkeley) 6/2/93
- *     Id: resolv.h,v 1.30 2009/03/03 01:52:48 each Exp
- */
-
-#ifndef _RESOLV_H_
-#define        _RESOLV_H_
-
-#include <sys/param.h>
-#if (!defined(BSD)) || (BSD < 199306)
-# include <sys/bitypes.h>
-#else
-#include <sys/types.h>
-#endif
-#include <sys/cdefs.h>
-#include <sys/socket.h>
-#include <stdio.h>
-#include <arpa/nameser.h>
-
-/*%
- * Revision information.  This is the release date in YYYYMMDD format.
- * It can change every day so the right thing to do with it is use it
- * in preprocessor commands such as "#if (__RES > 19931104)".  Do not
- * compare for equality; rather, use it to determine whether your resolver
- * is new enough to contain a certain feature.
- */
-
-#define        __RES   20090302
-
-/*%
- * This used to be defined in res_query.c, now it's in herror.c.
- * [XXX no it's not.  It's in irs/irs_data.c]
- * It was
- * never extern'd by any *.h file before it was placed here.  For thread
- * aware programs, the last h_errno value set is stored in res->h_errno.
- *
- * XXX:        There doesn't seem to be a good reason for exposing RES_SET_H_ERRNO
- *     (and __h_errno_set) to the public via <resolv.h>.
- * XXX:        __h_errno_set is really part of IRS, not part of the resolver.
- *     If somebody wants to build and use a resolver that doesn't use IRS,
- *     what do they do?  Perhaps something like
- *             #ifdef WANT_IRS
- *             # define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
- *             #else
- *             # define RES_SET_H_ERRNO(r,x) (h_errno = (r)->res_h_errno = (x))
- *             #endif
- */
-
-#define RES_SET_H_ERRNO(r,x) __h_errno_set(r,x)
-struct __res_state; /*%< forward */
-__BEGIN_DECLS
-void __h_errno_set(struct __res_state *, int);
-__END_DECLS
-
-/*%
- * Resolver configuration file.
- * Normally not present, but may contain the address of the
- * initial name server(s) to query and the domain search list.
- */
-
-#ifndef _PATH_RESCONF
-#define _PATH_RESCONF        "/etc/resolv.conf"
-#endif
-
-typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
-       res_sendhookact;
-
-typedef res_sendhookact (*res_send_qhook)(struct sockaddr * const *,
-                                             const u_char **, int *,
-                                             u_char *, int, int *);
-
-typedef res_sendhookact (*res_send_rhook)(const struct sockaddr *,
-                                             const u_char *, int, u_char *,
-                                             int, int *);
-
-struct res_sym {
-       int             number;    /*%< Identifying number, like T_MX */
-       const char *    name;      /*%< Its symbolic name, like "MX" */
-       const char *    humanname; /*%< Its fun name, like "mail exchanger" */
-};
-
-/*%
- * Global defines and variables for resolver stub.
- */
-#define        MAXNS                   3       /*%< max # name servers we'll track */
-#define        MAXDFLSRCH              3       /*%< # default domain levels to try */
-#define        MAXDNSRCH               6       /*%< max # domains in search path */
-#define        LOCALDOMAINPARTS        2       /*%< min levels in name that is "local" */
-#define        RES_TIMEOUT             5       /*%< min. seconds between retries */
-#define        MAXRESOLVSORT           10      /*%< number of net to sort on */
-#define        RES_MAXNDOTS            15      /*%< should reflect bit field size */
-#define        RES_MAXRETRANS          30      /*%< only for resolv.conf/RES_OPTIONS */
-#define        RES_MAXRETRY            5       /*%< only for resolv.conf/RES_OPTIONS */
-#define        RES_DFLRETRY            2       /*%< Default #/tries. */
-#define        RES_MAXTIME             65535   /*%< Infinity, in milliseconds. */
-
-struct __res_state_ext;
-
-struct __res_state {
-       int     retrans;                /*%< retransmission time interval */
-       int     retry;                  /*%< number of times to retransmit */
-#ifdef sun
-       u_int   options;                /*%< option flags - see below. */
-#else
-       u_long  options;                /*%< option flags - see below. */
-#endif
-       int     nscount;                /*%< number of name servers */
-       struct sockaddr_in
-               nsaddr_list[MAXNS];     /*%< address of name server */
-#define        nsaddr  nsaddr_list[0]          /*%< for backward compatibility */
-       u_short id;                     /*%< current message id */
-       char    *dnsrch[MAXDNSRCH+1];   /*%< components of domain to search */
-       char    defdname[256];          /*%< default domain (deprecated) */
-#ifdef sun
-       u_int   pfcode;                 /*%< RES_PRF_ flags - see below. */
-#else
-       u_long  pfcode;                 /*%< RES_PRF_ flags - see below. */
-#endif
-       unsigned ndots:4;               /*%< threshold for initial abs. query */
-       unsigned nsort:4;               /*%< number of elements in sort_list[] */
-       char    unused[3];
-       struct {
-               struct in_addr  addr;
-               uint32_t        mask;
-       } sort_list[MAXRESOLVSORT];
-#ifdef __OLD_RES_STATE
-       char lookups[4];
-#else
-       res_send_qhook qhook;           /*%< query hook */
-       res_send_rhook rhook;           /*%< response hook */
-       int     res_h_errno;            /*%< last one set for this context */
-       int     _vcsock;                /*%< PRIVATE: for res_send VC i/o */
-       u_int   _flags;                 /*%< PRIVATE: see below */
-       u_int   _pad;                   /*%< make _u 64 bit aligned */
-       union {
-               /* On an 32-bit arch this means 512b total. */
-               char    pad[56 - 4*sizeof (int) - 3*sizeof (void *)];
-               struct {
-                       uint16_t                nscount;
-                       uint16_t                nstimes[MAXNS]; /*%< ms. */
-                       int                     nssocks[MAXNS];
-                       struct __res_state_ext *ext;    /*%< extention for IPv6 */
-               } _ext;
-       } _u;
-       u_char  *_rnd;                  /*%< PRIVATE: random state */
-#endif
-};
-
-typedef struct __res_state *res_state;
-
-union res_sockaddr_union {
-       struct sockaddr_in      sin;
-#ifdef IN6ADDR_ANY_INIT
-       struct sockaddr_in6     sin6;
-#endif
-#ifdef ISC_ALIGN64
-       int64_t                 __align64;      /*%< 64bit alignment */
-#else
-       int32_t                 __align32;      /*%< 32bit alignment */
-#endif
-       char                    __space[128];   /* max size */
-};
-
-/*%
- * Resolver flags (used to be discrete per-module statics ints).
- */
-#define        RES_F_VC        0x00000001      /*%< socket is TCP */
-#define        RES_F_CONN      0x00000002      /*%< socket is connected */
-#define        RES_F_EDNS0ERR  0x00000004      /*%< EDNS0 caused errors */
-#define        RES_F__UNUSED   0x00000008      /*%< (unused) */
-#define        RES_F_LASTMASK  0x000000F0      /*%< ordinal server of last res_nsend */
-#define        RES_F_LASTSHIFT 4               /*%< bit position of LASTMASK "flag" */
-#define        RES_GETLAST(res) (((res)._flags & RES_F_LASTMASK) >> RES_F_LASTSHIFT)
-
-/* res_findzonecut2() options */
-#define        RES_EXHAUSTIVE  0x00000001      /*%< always do all queries */
-#define        RES_IPV4ONLY    0x00000002      /*%< IPv4 only */
-#define        RES_IPV6ONLY    0x00000004      /*%< IPv6 only */
-
-/*%
- * Resolver options (keep these in synch with res_debug.c, please)
- */
-#define RES_INIT       0x00000001      /*%< address initialized */
-#define RES_DEBUG      0x00000002      /*%< print debug messages */
-#define RES_AAONLY     0x00000004      /*%< authoritative answers only (!IMPL)*/
-#define RES_USEVC      0x00000008      /*%< use virtual circuit */
-#define RES_PRIMARY    0x00000010      /*%< query primary server only (!IMPL) */
-#define RES_IGNTC      0x00000020      /*%< ignore trucation errors */
-#define RES_RECURSE    0x00000040      /*%< recursion desired */
-#define RES_DEFNAMES   0x00000080      /*%< use default domain name */
-#define RES_STAYOPEN   0x00000100      /*%< Keep TCP socket open */
-#define RES_DNSRCH     0x00000200      /*%< search up local domain tree */
-#define        RES_INSECURE1   0x00000400      /*%< type 1 security disabled */
-#define        RES_INSECURE2   0x00000800      /*%< type 2 security disabled */
-#define        RES_NOALIASES   0x00001000      /*%< shuts off HOSTALIASES feature */
-#define        RES_USE_INET6   0x00002000      /*%< use/map IPv6 in gethostbyname() */
-#define RES_ROTATE     0x00004000      /*%< rotate ns list after each query */
-#define        RES_NOCHECKNAME 0x00008000      /*%< do not check names for sanity. */
-#define        RES_KEEPTSIG    0x00010000      /*%< do not strip TSIG records */
-#define        RES_BLAST       0x00020000      /*%< blast all recursive servers */
-#define RES_NSID       0x00040000      /*%< request name server ID */
-#define RES_NOTLDQUERY 0x00100000      /*%< don't unqualified name as a tld */
-#define RES_USE_DNSSEC 0x00200000      /*%< use DNSSEC using OK bit in OPT */
-/* #define RES_DEBUG2  0x00400000 */   /* nslookup internal */
-/* KAME extensions: use higher bit to avoid conflict with ISC use */
-#define RES_USE_DNAME  0x10000000      /*%< use DNAME */
-#define RES_USE_EDNS0  0x40000000      /*%< use EDNS0 if configured */
-#define RES_NO_NIBBLE2 0x80000000      /*%< disable alternate nibble lookup */
-
-#define RES_DEFAULT    (RES_RECURSE | RES_DEFNAMES | \
-                        RES_DNSRCH | RES_NO_NIBBLE2)
-
-/*%
- * Resolver "pfcode" values.  Used by dig.
- */
-#define RES_PRF_STATS  0x00000001
-#define RES_PRF_UPDATE 0x00000002
-#define RES_PRF_CLASS   0x00000004
-#define RES_PRF_CMD    0x00000008
-#define RES_PRF_QUES   0x00000010
-#define RES_PRF_ANS    0x00000020
-#define RES_PRF_AUTH   0x00000040
-#define RES_PRF_ADD    0x00000080
-#define RES_PRF_HEAD1  0x00000100
-#define RES_PRF_HEAD2  0x00000200
-#define RES_PRF_TTLID  0x00000400
-#define RES_PRF_HEADX  0x00000800
-#define RES_PRF_QUERY  0x00001000
-#define RES_PRF_REPLY  0x00002000
-#define RES_PRF_INIT   0x00004000
-#define RES_PRF_TRUNC  0x00008000
-/*                     0x00010000      */
-
-/* Things involving an internal (static) resolver context. */
-__BEGIN_DECLS
-extern struct __res_state *__res_get_state(void);
-extern void __res_put_state(struct __res_state *);
-
-/*
- * Source and Binary compatibility; _res will not work properly
- * with multi-threaded programs.
- */
-extern struct __res_state *__res_state(void);
-#define _res (*__res_state())
-
-__END_DECLS
-
-#ifndef __BIND_NOSTATIC
-#define fp_nquery              __fp_nquery
-#define fp_query               __fp_query
-#define hostalias              __hostalias
-#define p_query                        __p_query
-#define res_close              __res_close
-#define res_isourserver                __res_isourserver
-#define        res_opt                 __res_opt
-#define        res_querydomain         __res_querydomain
-#define res_send               __res_send
-#define res_sendsigned         __res_sendsigned
-
-#ifdef notdef
-/* NetBSD protects these via weak symbols. */
-#define        res_init                __res_init
-#define        res_query               __res_query
-#define        res_mkquery             __res_mkquery
-#define        dn_expand               __dn_expand
-#define        res_search              __res_search
-#endif
-
-__BEGIN_DECLS
-void           fp_nquery(const u_char *, int, FILE *);
-void           fp_query(const u_char *, FILE *);
-const char *   hostalias(const char *);
-void           p_query(const u_char *);
-void           res_close(void);
-int            res_init(void);
-int            res_opt(int, u_char *, int, int);
-int            res_isourserver(const struct sockaddr_in *);
-int            res_mkquery(int, const char *, int, int, const u_char *,
-                                int, const u_char *, u_char *, int);
-int            res_query(const char *, int, int, u_char *, int);
-int            res_querydomain(const char *, const char *, int, int,
-                                    u_char *, int);
-int            res_search(const char *, int, int, u_char *, int);
-int            res_send(const u_char *, int, u_char *, int);
-int            res_sendsigned(const u_char *, int, ns_tsig_key *,
-                                   u_char *, int);
-__END_DECLS
-#endif
-
-#if !defined(SHARED_LIBBIND) || defined(LIB)
-/*
- * If libbind is a shared object (well, DLL anyway)
- * these externs break the linker when resolv.h is
- * included by a lib client (like named)
- * Make them go away if a client is including this
- *
- */
-extern const struct res_sym __p_key_syms[];
-extern const struct res_sym __p_cert_syms[];
-extern const struct res_sym __p_class_syms[];
-extern const struct res_sym __p_type_syms[];
-extern const struct res_sym __p_rcode_syms[];
-#endif /* SHARED_LIBBIND */
-
-#define b64_ntop               __b64_ntop
-#define b64_pton               __b64_pton
-#define dn_comp                        __dn_comp
-#define dn_count_labels                __dn_count_labels
-#define dn_skipname            __dn_skipname
-#define fp_resstat             __fp_resstat
-#define loc_aton               __loc_aton
-#define loc_ntoa               __loc_ntoa
-#define p_cdname               __p_cdname
-#define p_cdnname              __p_cdnname
-#define p_class                        __p_class
-#define p_fqname               __p_fqname
-#define p_fqnname              __p_fqnname
-#define p_option               __p_option
-#define p_secstodate           __p_secstodate
-#define p_section              __p_section
-#define p_time                 __p_time
-#define p_type                 __p_type
-#define p_rcode                        __p_rcode
-#define p_sockun               __p_sockun
-#define putlong                        __putlong
-#define putshort               __putshort
-#define        res_check               __res_check
-#define res_dnok               __res_dnok
-#define res_findzonecut                __res_findzonecut
-#define res_findzonecut2       __res_findzonecut2
-#define res_hnok               __res_hnok
-#define res_hostalias          __res_hostalias
-#define res_mailok             __res_mailok
-#define res_nameinquery                __res_nameinquery
-#define res_nclose             __res_nclose
-#define res_ninit              __res_ninit
-#define res_nmkquery           __res_nmkquery
-#define res_pquery             __res_pquery
-#define res_nquery             __res_nquery
-#define res_nquerydomain       __res_nquerydomain
-#define res_nsearch            __res_nsearch
-#define res_nsend              __res_nsend
-#define res_nsendsigned                __res_nsendsigned
-#define res_nisourserver       __res_nisourserver
-#define res_ownok              __res_ownok
-#define res_queriesmatch       __res_queriesmatch
-#define res_rndinit            __res_rndinit
-#define res_randomid           __res_randomid
-#define res_nrandomid          __res_nrandomid
-#define sym_ntop               __sym_ntop
-#define sym_ntos               __sym_ntos
-#define sym_ston               __sym_ston
-#define res_nopt               __res_nopt
-#define res_nopt_rdata         __res_nopt_rdata
-#define res_ndestroy           __res_ndestroy
-#define        res_nametoclass         __res_nametoclass
-#define        res_nametotype          __res_nametotype
-#define        res_setservers          __res_setservers
-#define        res_getservers          __res_getservers
-#define        res_buildprotolist      __res_buildprotolist
-#define        res_destroyprotolist    __res_destroyprotolist
-#define        res_destroyservicelist  __res_destroyservicelist
-#define        res_get_nibblesuffix    __res_get_nibblesuffix
-#define        res_get_nibblesuffix2   __res_get_nibblesuffix2
-#define        res_ourserver_p         __res_ourserver_p
-#define        res_protocolname        __res_protocolname
-#define        res_protocolnumber      __res_protocolnumber
-#define        res_send_setqhook       __res_send_setqhook
-#define        res_send_setrhook       __res_send_setrhook
-#define        res_servicename         __res_servicename
-#define        res_servicenumber       __res_servicenumber
-__BEGIN_DECLS
-int            res_hnok(const char *);
-int            res_ownok(const char *);
-int            res_mailok(const char *);
-struct timespec;
-int            res_check(res_state, struct timespec *);
-int            res_dnok(const char *);
-int            sym_ston(const struct res_sym *, const char *, int *);
-const char *   sym_ntos(const struct res_sym *, int, int *);
-const char *   sym_ntop(const struct res_sym *, int, int *);
-int            b64_ntop(u_char const *, size_t, char *, size_t);
-int            b64_pton(char const *, u_char *, size_t);
-int            loc_aton(const char *, u_char *);
-const char *   loc_ntoa(const u_char *, char *);
-int            dn_skipname(const u_char *, const u_char *);
-void           putlong(uint32_t, u_char *);
-void           putshort(uint16_t, u_char *);
-#ifndef __ultrix__
-uint16_t       _getshort(const u_char *);
-uint32_t       _getlong(const u_char *);
-#endif
-const char *   p_class(int);
-const char *   p_time(uint32_t);
-const char *   p_type(int);
-const char *   p_rcode(int);
-const char *   p_sockun(union res_sockaddr_union, char *, size_t);
-const u_char * p_cdnname(const u_char *, const u_char *, int, FILE *);
-const u_char * p_cdname(const u_char *, const u_char *, FILE *);
-const u_char * p_fqnname(const u_char *, const u_char *,
-                              int, char *, int);
-const u_char * p_fqname(const u_char *, const u_char *, FILE *);
-const char *   p_option(u_long);
-char *         p_secstodate(u_long);
-int            dn_count_labels(const char *);
-int            dn_comp(const char *, u_char *, int, u_char **, u_char **);
-int            dn_expand(const u_char *, const u_char *, const u_char *,
-                              char *, int);
-void           res_rndinit(res_state);
-u_int          res_randomid(void);
-u_int          res_nrandomid(res_state);
-int            res_nameinquery(const char *, int, int, const u_char *,
-                                    const u_char *);
-int            res_queriesmatch(const u_char *, const u_char *,
-                                     const u_char *, const u_char *);
-const char *   p_section(int, int);
-/* Things involving a resolver context. */
-int            res_ninit(res_state);
-int            res_nisourserver(const res_state, const struct sockaddr_in *);
-void           fp_resstat(const res_state, FILE *);
-void           res_pquery(const res_state, const u_char *, int, FILE *);
-const char *   res_hostalias(const res_state, const char *, char *, size_t);
-int            res_nquery(res_state, const char *, int, int, u_char *, int);
-int            res_nsearch(res_state, const char *, int, int, u_char *, int);
-int            res_nquerydomain(res_state, const char *, const char *,
-                                     int, int, u_char *, int);
-int            res_nmkquery(res_state, int, const char *, int, int,
-                                 const u_char *, int, const u_char *,
-                                 u_char *, int);
-int            res_nsend(res_state, const u_char *, int, u_char *, int);
-int            res_nsendsigned(res_state, const u_char *, int,
-                                    ns_tsig_key *, u_char *, int);
-int            res_findzonecut(res_state, const char *, ns_class, int,
-                                    char *, size_t, struct in_addr *, int);
-int            res_findzonecut2(res_state, const char *, ns_class, int,
-                                     char *, size_t,
-                                     union res_sockaddr_union *, int);
-void           res_nclose(res_state);
-int            res_nopt(res_state, int, u_char *, int, int);
-int            res_nopt_rdata(res_state, int, u_char *, int, u_char *,
-                                   u_short, u_short, u_char *);
-void           res_send_setqhook(res_send_qhook);
-void           res_send_setrhook(res_send_rhook);
-int            __res_vinit(res_state, int);
-void           res_destroyservicelist(void);
-const char *   res_servicename(uint16_t, const char *);
-const char *   res_protocolname(int);
-void           res_destroyprotolist(void);
-void           res_buildprotolist(void);
-const char *   res_get_nibblesuffix(res_state);
-const char *   res_get_nibblesuffix2(res_state);
-void           res_ndestroy(res_state);
-uint16_t       res_nametoclass(const char *, int *);
-uint16_t       res_nametotype(const char *, int *);
-void           res_setservers(res_state,
-                                   const union res_sockaddr_union *, int);
-int            res_getservers(res_state,
-                                   union res_sockaddr_union *, int);
-__END_DECLS
-
-#endif /* !_RESOLV_H_ */
diff --git a/nbsd_include/setjmp.h b/nbsd_include/setjmp.h
deleted file mode 100644 (file)
index b951235..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/*     $NetBSD: setjmp.h,v 1.25 2009/08/12 04:57:36 matt Exp $ */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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. 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.
- *
- *     @(#)setjmp.h    8.2 (Berkeley) 1/21/94
- */
-
-#ifndef _SETJMP_H_
-#define _SETJMP_H_
-
-#include <sys/featuretest.h>
-
-#include <machine/setjmp.h>
-
-#ifndef _JB_ATTRIBUTES
-#define _JB_ATTRIBUTES /**/
-#else
-#endif
-#ifndef _BSD_JBSLOT_T_
-#define        _BSD_JBSLOT_T_  long
-#endif
-
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-typedef _BSD_JBSLOT_T_ sigjmp_buf[_JBLEN + 1] _JB_ATTRIBUTES;
-#endif /* not ANSI */
-
-typedef _BSD_JBSLOT_T_ jmp_buf[_JBLEN] _JB_ATTRIBUTES;
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-#ifndef __LIBC12_SOURCE__
-int    setjmp(jmp_buf)                  __RENAME(__setjmp14);
-void   longjmp(jmp_buf, int)            __RENAME(__longjmp14) __dead;
-
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-int    sigsetjmp(sigjmp_buf, int)      __RENAME(__sigsetjmp14);
-void   siglongjmp(sigjmp_buf, int)      __RENAME(__siglongjmp14) __dead;
-#endif /* not ANSI */
-#endif /* __LIBC12_SOURCE__ */
-
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-int    _setjmp(jmp_buf);
-void   _longjmp(jmp_buf, int) __dead;
-#endif
-
-#if defined(_NETBSD_SOURCE)
-void   longjmperror(void);
-#endif
-__END_DECLS
-
-#endif /* !_SETJMP_H_ */
diff --git a/nbsd_include/sgtty.h b/nbsd_include/sgtty.h
deleted file mode 100644 (file)
index 1ac3100..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*     $NetBSD: sgtty.h,v 1.8 2005/02/03 04:39:32 perry Exp $  */
-
-/*
- * Copyright (c) 1985, 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. 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.
- *
- *     @(#)sgtty.h     8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _SGTTY_H_
-#define _SGTTY_H_
-
-#ifndef USE_OLD_TTY
-#define        USE_OLD_TTY
-#endif
-#include <sys/ioctl.h>
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int gtty(int, struct sgttyb *);
-int stty(int, struct sgttyb *);
-__END_DECLS
-
-#endif /* _SGTTY_H_ */
diff --git a/nbsd_include/signal.h b/nbsd_include/signal.h
deleted file mode 100644 (file)
index 3d225cb..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-/*     $NetBSD: signal.h,v 1.54 2010/08/27 08:40:38 christos Exp $     */
-
-/*-
- * Copyright (c) 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. 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.
- *
- *     @(#)signal.h    8.3 (Berkeley) 3/30/94
- */
-
-#ifndef _SIGNAL_H_
-#define _SIGNAL_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-#include <sys/types.h>
-#endif
-
-#include <sys/signal.h>
-
-#if defined(_NETBSD_SOURCE)
-extern const char *const *sys_signame __RENAME(__sys_signame14);
-#ifndef __SYS_SIGLIST_DECLARED
-#define __SYS_SIGLIST_DECLARED
-/* also in unistd.h */
-extern const char *const *sys_siglist __RENAME(__sys_siglist14);
-#endif /* __SYS_SIGLIST_DECLARED */
-extern const int sys_nsig __RENAME(__sys_nsig14);
-#endif
-
-__BEGIN_DECLS
-int    raise(int);
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-int    kill(pid_t, int);
-int    __libc_sigaction14(int, const struct sigaction * __restrict,
-           struct sigaction * __restrict);
-
-#ifndef __minix
-#if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_NETBSD_SOURCE)
-int    pthread_sigmask(int, const sigset_t * __restrict,
-           sigset_t * __restrict);
-int    pthread_kill(pthread_t, int);
-int    __libc_thr_sigsetmask(int, const sigset_t * __restrict,
-           sigset_t * __restrict);
-#ifndef __LIBPTHREAD_SOURCE__
-#define        pthread_sigmask         __libc_thr_sigsetmask
-#endif /* __LIBPTHREAD_SOURCE__ */
-#endif
-#endif /* __minix */
-
-#ifndef __LIBC12_SOURCE__
-int    sigaction(int, const struct sigaction * __restrict,
-    struct sigaction * __restrict) __RENAME(__sigaction14);
-#if defined(__minix) && defined(_SYSTEM)
-#define sigaddset(set, sig)    __sigaddset((set), (sig))
-#define sigdelset(set, sig)    __sigdelset((set), (sig))
-#define sigemptyset(set)       __sigemptyset((set))
-#define sigfillset(set)                __sigfillset((set))
-#define sigismember(set, sig)  __sigismember((set), (sig))
-#else
-int    sigaddset(sigset_t *, int) __RENAME(__sigaddset14);
-int    sigdelset(sigset_t *, int) __RENAME(__sigdelset14);
-int    sigemptyset(sigset_t *) __RENAME(__sigemptyset14);
-int    sigfillset(sigset_t *) __RENAME(__sigfillset14);
-int    sigismember(const sigset_t *, int) __RENAME(__sigismember14);
-#endif
-int    sigpending(sigset_t *) __RENAME(__sigpending14);
-int    sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict)
-    __RENAME(__sigprocmask14);
-int    sigsuspend(const sigset_t *) __RENAME(__sigsuspend14);
-
-#if defined(__c99inline) || defined(__SIGSETOPS_BODY)
-
-#if defined(__SIGSETOPS_BODY)
-#undef __c99inline
-#define        __c99inline
-#endif
-
-/* note: this appears in both errno.h and signal.h */
-#ifndef __errno
-int *__errno(void);
-#define __errno __errno
-#endif
-
-/* the same as "errno" - but signal.h is not allowed to define that */
-#ifndef ___errno
-#define ___errno (*__errno())
-#endif
-
-#if !defined(__minix) || !defined(_SYSTEM)
-__c99inline int
-sigaddset(sigset_t *set, int signo)
-{
-       if (signo <= 0 || signo >= _NSIG) {
-               ___errno = 22;                  /* EINVAL */
-               return (-1);
-       }
-       __sigaddset(set, signo);
-       return (0);
-}
-
-__c99inline int
-sigdelset(sigset_t *set, int signo)
-{
-       if (signo <= 0 || signo >= _NSIG) {
-               ___errno = 22;                  /* EINVAL */
-               return (-1);
-       }
-       __sigdelset(set, signo);
-       return (0);
-}
-
-__c99inline int
-sigismember(const sigset_t *set, int signo)
-{
-       if (signo <= 0 || signo >= _NSIG) {
-               ___errno = 22;                  /* EINVAL */
-               return (-1);
-       }
-       return (__sigismember(set, signo));
-}
-
-__c99inline int
-sigemptyset(sigset_t *set)
-{
-       __sigemptyset(set);
-       return (0);
-}
-
-__c99inline int
-sigfillset(sigset_t *set)
-{
-       __sigfillset(set);
-       return (0);
-}
-#endif /* !defined(__minix) || !defined(_SYSTEM) */
-#endif /* __c99inline */
-#endif /* !__LIBC12_SOURCE__ */
-
-/*
- * X/Open CAE Specification Issue 4 Version 2
- */      
-#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
-    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-int    killpg(pid_t, int);
-int    siginterrupt(int, int);
-#ifndef __minix
-int    sigstack(const struct sigstack *, struct sigstack *);
-#ifndef __LIBC12_SOURCE__
-int    sigaltstack(const stack_t * __restrict, stack_t * __restrict)
-    __RENAME(__sigaltstack14);
-#endif
-#endif /* !__minix */
-int    sighold(int);
-int    sigignore(int);
-int    sigpause(int);
-int    sigrelse(int);
-void   (*sigset (int, void (*)(int)))(int);
-#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
-
-
-/*
- * X/Open CAE Specification Issue 5; IEEE Std 1003.1b-1993 (POSIX)
- */      
-#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_NETBSD_SOURCE)
-#ifndef __minix 
-int    sigwait (const sigset_t * __restrict, int * __restrict);
-int    sigwaitinfo(const sigset_t * __restrict, siginfo_t * __restrict);
-#endif /* !__minix */
-void   psiginfo(const siginfo_t *, const char *);
-
-#ifndef __minix
-#ifndef __LIBC12_SOURCE__
-struct timespec;
-int    sigtimedwait(const sigset_t * __restrict,
-    siginfo_t * __restrict, const struct timespec * __restrict)
-    __RENAME(__sigtimedwait50);
-int    __sigtimedwait(const sigset_t * __restrict,
-    siginfo_t * __restrict, struct timespec * __restrict)
-    __RENAME(____sigtimedwait50);
-#endif
-#endif /* !__minix */
-#endif /* _POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE_EXTENDED || ... */
-
-
-#if defined(_NETBSD_SOURCE)
-#ifndef __minix
-#ifndef __PSIGNAL_DECLARED
-#define __PSIGNAL_DECLARED
-/* also in unistd.h */
-void   psignal(int, const char *);
-#endif /* __PSIGNAL_DECLARED */
-#endif /* !__minix */
-int    sigblock(int);
-int    sigsetmask(int);
-#endif /* _NETBSD_SOURCE */
-
-#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
-__END_DECLS
-
-#endif /* !_SIGNAL_H_ */
diff --git a/nbsd_include/stdbool.h b/nbsd_include/stdbool.h
deleted file mode 100644 (file)
index a1fb896..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*     $NetBSD: stdbool.h,v 1.3 2008/04/28 20:22:54 martin Exp $       */
-
-/*-
- * Copyright (c) 2002 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of Wasabi Systems, Inc.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _STDBOOL_H_
-#define        _STDBOOL_H_
-
-#ifndef __cplusplus
-#define        bool    _Bool
-
-#define        true    1
-#define        false   0
-#else
-#define        bool    bool
-
-#define        true    true
-#define        false   false
-#endif /* __cplusplus */
-
-#define        __bool_true_false_are_defined   1
-
-#endif /* _STDBOOL_H_ */
diff --git a/nbsd_include/stddef.h b/nbsd_include/stddef.h
deleted file mode 100644 (file)
index e7635ad..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*     $NetBSD: stddef.h,v 1.16 2009/11/15 22:21:03 christos Exp $     */
-
-/*-
- * Copyright (c) 1990, 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. 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.
- *
- *     @(#)stddef.h    8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _STDDEF_H_
-#define _STDDEF_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <machine/ansi.h>
-
-typedef        _BSD_PTRDIFF_T_ ptrdiff_t;
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_    size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
-typedef        _BSD_WCHAR_T_   wchar_t;
-#undef _BSD_WCHAR_T_
-#endif
-
-#include <sys/null.h>
-
-#if __GNUC_PREREQ__(4, 0)
-#define        offsetof(type, member)  __builtin_offsetof(type, member)
-#elif !defined(__cplusplus)
-#define        offsetof(type, member)  ((size_t)(unsigned long)(&((type *)0)->member))
-#else
-#if !__GNUC_PREREQ__(3, 4)
-#define __offsetof__(a) a
-#endif
-#define        offsetof(type, member) __offsetof__((reinterpret_cast<size_t> \
-    (&reinterpret_cast<const volatile char &>(static_cast<type *>(0)->member))))
-#endif  
-#endif /* _STDDEF_H_ */
diff --git a/nbsd_include/stdio.h b/nbsd_include/stdio.h
deleted file mode 100644 (file)
index 341de8b..0000000
+++ /dev/null
@@ -1,520 +0,0 @@
-/*     $NetBSD: stdio.h,v 1.78 2010/09/24 09:21:53 tnozaki Exp $       */
-
-/*-
- * Copyright (c) 1990, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chris Torek.
- *
- * 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. 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.
- *
- *     @(#)stdio.h     8.5 (Berkeley) 4/29/95
- */
-
-#ifndef        _STDIO_H_
-#define        _STDIO_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <sys/ansi.h>
-
-#include <machine/ansi.h>
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_    size_t;
-#undef _BSD_SIZE_T_
-#endif
-#ifdef _BSD_SSIZE_T_
-typedef        _BSD_SSIZE_T_   ssize_t;
-#undef _BSD_SSIZE_T_
-#endif
-
-#include <sys/null.h>
-
-/*      
- * This is fairly grotesque, but pure ANSI code must not inspect the
- * innards of an fpos_t anyway.  The library internally uses off_t,
- * which we assume is exactly as big as eight chars.
- */
-#if (!defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__)) || defined(_LIBC)
-typedef __off_t fpos_t;
-#else
-typedef struct __sfpos {
-       __off_t _pos;
-} fpos_t;
-#endif
-
-#define        _FSTDIO                 /* Define for new stdio with functions. */
-
-/*
- * NB: to fit things in six character monocase externals, the stdio
- * code uses the prefix `__s' for stdio objects, typically followed
- * by a three-character attempt at a mnemonic.
- */
-
-/* stdio buffers */
-struct __sbuf {
-       unsigned char *_base;
-       int     _size;
-};
-
-/*
- * stdio state variables.
- *
- * The following always hold:
- *
- *     if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
- *             _lbfsize is -_bf._size, else _lbfsize is 0
- *     if _flags&__SRD, _w is 0
- *     if _flags&__SWR, _r is 0
- *
- * This ensures that the getc and putc macros (or inline functions) never
- * try to write or read from a file that is in `read' or `write' mode.
- * (Moreover, they can, and do, automatically switch from read mode to
- * write mode, and back, on "r+" and "w+" files.)
- *
- * _lbfsize is used only to make the inline line-buffered output stream
- * code as compact as possible.
- *
- * _ub, _up, and _ur are used when ungetc() pushes back more characters
- * than fit in the current _bf, or when ungetc() pushes back a character
- * that does not match the previous one in _bf.  When this happens,
- * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
- * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
- *
- * NB: see WARNING above before changing the layout of this structure!
- */
-typedef        struct __sFILE {
-       unsigned char *_p;      /* current position in (some) buffer */
-       int     _r;             /* read space left for getc() */
-       int     _w;             /* write space left for putc() */
-       unsigned short _flags;  /* flags, below; this FILE is free if 0 */
-       short   _file;          /* fileno, if Unix descriptor, else -1 */
-       struct  __sbuf _bf;     /* the buffer (at least 1 byte, if !NULL) */
-       int     _lbfsize;       /* 0 or -_bf._size, for inline putc */
-
-       /* operations */
-       void    *_cookie;       /* cookie passed to io functions */
-       int     (*_close)(void *);
-       int     (*_read) (void *, char *, int);
-       fpos_t  (*_seek) (void *, fpos_t, int);
-       int     (*_write)(void *, const char *, int);
-
-       /* file extension */
-       struct  __sbuf _ext;
-
-       /* separate buffer for long sequences of ungetc() */
-       unsigned char *_up;     /* saved _p when _p is doing ungetc data */
-       int     _ur;            /* saved _r when _r is counting ungetc data */
-
-       /* tricks to meet minimum requirements even when malloc() fails */
-       unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
-       unsigned char _nbuf[1]; /* guarantee a getc() buffer */
-
-       /* Formerly used by fgetln/fgetwln; kept for binary compatibility */
-       struct  __sbuf _lb__unused;
-
-       /* Unix stdio files get aligned to block boundaries on fseek() */
-       int     _blksize;       /* stat.st_blksize (may be != _bf._size) */
-       fpos_t  _offset;        /* current lseek offset */
-} FILE;
-
-__BEGIN_DECLS
-extern FILE __sF[];
-__END_DECLS
-
-#define        __SLBF  0x0001          /* line buffered */
-#define        __SNBF  0x0002          /* unbuffered */
-#define        __SRD   0x0004          /* OK to read */
-#define        __SWR   0x0008          /* OK to write */
-       /* RD and WR are never simultaneously asserted */
-#define        __SRW   0x0010          /* open for reading & writing */
-#define        __SEOF  0x0020          /* found EOF */
-#define        __SERR  0x0040          /* found error */
-#define        __SMBF  0x0080          /* _buf is from malloc */
-#define        __SAPP  0x0100          /* fdopen()ed in append mode */
-#define        __SSTR  0x0200          /* this is an sprintf/snprintf string */
-#define        __SOPT  0x0400          /* do fseek() optimization */
-#define        __SNPT  0x0800          /* do not do fseek() optimization */
-#define        __SOFF  0x1000          /* set iff _offset is in fact correct */
-#define        __SMOD  0x2000          /* true => fgetln modified _p text */
-#define        __SALC  0x4000          /* allocate string space dynamically */
-
-/*
- * The following three definitions are for ANSI C, which took them
- * from System V, which brilliantly took internal interface macros and
- * made them official arguments to setvbuf(), without renaming them.
- * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
- *
- * Although numbered as their counterparts above, the implementation
- * does not rely on this.
- */
-#define        _IOFBF  0               /* setvbuf should set fully buffered */
-#define        _IOLBF  1               /* setvbuf should set line buffered */
-#define        _IONBF  2               /* setvbuf should set unbuffered */
-
-#define        BUFSIZ  1024            /* size of buffer used by setbuf */
-#define        EOF     (-1)
-
-/*
- * FOPEN_MAX is a minimum maximum, and is the number of streams that
- * stdio can provide without attempting to allocate further resources
- * (which could fail).  Do not use this for anything.
- */
-                               /* must be == _POSIX_STREAM_MAX <limits.h> */
-#define        FOPEN_MAX       20      /* must be <= OPEN_MAX <sys/syslimits.h> */
-#define        FILENAME_MAX    255     /* must be <= PATH_MAX <sys/syslimits.h> */
-
-/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-#define        P_tmpdir        "/var/tmp/"
-#endif
-#define        L_tmpnam        1024    /* XXX must be == PATH_MAX */
-/* Always ensure that this is consistent with <limits.h> */
-#ifndef TMP_MAX
-#define TMP_MAX                        308915776       /* Legacy */
-#endif
-
-/* Always ensure that these are consistent with <fcntl.h> and <unistd.h>! */
-#ifndef SEEK_SET
-#define        SEEK_SET        0       /* set file offset to offset */
-#endif
-#ifndef SEEK_CUR
-#define        SEEK_CUR        1       /* set file offset to current plus offset */
-#endif
-#ifndef SEEK_END
-#define        SEEK_END        2       /* set file offset to EOF plus offset */
-#endif
-
-#define        stdin   (&__sF[0])
-#define        stdout  (&__sF[1])
-#define        stderr  (&__sF[2])
-
-/*
- * Functions defined in ANSI C standard.
- */
-__BEGIN_DECLS
-void    clearerr(FILE *);
-int     fclose(FILE *);
-int     feof(FILE *);
-int     ferror(FILE *);
-int     fflush(FILE *);
-int     fgetc(FILE *);
-int     fgetpos(FILE * __restrict, fpos_t * __restrict);
-char   *fgets(char * __restrict, int, FILE * __restrict);
-FILE   *fopen(const char * __restrict , const char * __restrict);
-int     fprintf(FILE * __restrict , const char * __restrict, ...)
-               __printflike(2, 3);
-int     fputc(int, FILE *);
-int     fputs(const char * __restrict, FILE * __restrict);
-size_t  fread(void * __restrict, size_t, size_t, FILE * __restrict);
-FILE   *freopen(const char * __restrict, const char * __restrict,
-           FILE * __restrict);
-int     fscanf(FILE * __restrict, const char * __restrict, ...)
-               __scanflike(2, 3);
-int     fseek(FILE *, long, int);
-int     fsetpos(FILE *, const fpos_t *);
-long    ftell(FILE *);
-size_t  fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
-int     getc(FILE *);
-int     getchar(void);
-ssize_t         getdelim(char ** __restrict, size_t * __restrict, int,
-           FILE * __restrict);
-ssize_t         getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
-void    perror(const char *);
-int     printf(const char * __restrict, ...)
-               __printflike(1, 2);
-int     putc(int, FILE *);
-int     putchar(int);
-int     puts(const char *);
-int     remove(const char *);
-void    rewind(FILE *);
-int     scanf(const char * __restrict, ...)
-               __scanflike(1, 2);
-void    setbuf(FILE * __restrict, char * __restrict);
-int     setvbuf(FILE * __restrict, char * __restrict, int, size_t);
-int     sscanf(const char * __restrict, const char * __restrict, ...)
-               __scanflike(2, 3);
-FILE   *tmpfile(void);
-int     ungetc(int, FILE *);
-int     vfprintf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_)
-               __printflike(2, 0);
-int     vprintf(const char * __restrict, _BSD_VA_LIST_)
-               __printflike(1, 0);
-
-#ifndef __AUDIT__
-char   *gets(char *);
-int     sprintf(char * __restrict, const char * __restrict, ...)
-               __printflike(2, 3);
-char   *tmpnam(char *);
-int     vsprintf(char * __restrict, const char * __restrict,
-    _BSD_VA_LIST_)
-               __printflike(2, 0);
-#endif
-
-#if !defined(__minix) && (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))
-int     rename (const char *, const char *) __RENAME(__posix_rename);
-#else
-int     rename (const char *, const char *);
-#endif
-__END_DECLS
-
-/*
- * IEEE Std 1003.1-90
- */
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-#define        L_ctermid       1024    /* size for ctermid(); PATH_MAX */
-#define L_cuserid      9       /* size for cuserid(); UT_NAMESIZE + 1 */
-
-__BEGIN_DECLS
-char   *ctermid(char *);
-#ifndef __CUSERID_DECLARED
-#define __CUSERID_DECLARED
-/* also declared in unistd.h */
-char   *cuserid(char *);
-#endif /* __CUSERID_DECLARED */
-FILE   *fdopen(int, const char *);
-int     fileno(FILE *);
-__END_DECLS
-#endif /* not ANSI */
-
-/*
- * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
- */
-#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
-__BEGIN_DECLS
-void   flockfile(FILE *);
-int    ftrylockfile(FILE *);
-void   funlockfile(FILE *);
-int    getc_unlocked(FILE *);
-int    getchar_unlocked(void);
-int    putc_unlocked(int, FILE *);
-int    putchar_unlocked(int);
-__END_DECLS
-#endif /* _POSIX_C_SOURCE >= 1995056 || _XOPEN_SOURCE >= 500 || ... */
-
-/*
- * Functions defined in POSIX 1003.2 and XPG2 or later.
- */
-#if (_POSIX_C_SOURCE - 0) >= 2 || (_XOPEN_SOURCE - 0) >= 2 || \
-    defined(_NETBSD_SOURCE)
-__BEGIN_DECLS
-int     pclose(FILE *);
-FILE   *popen(const char *, const char *);
-__END_DECLS
-#endif
-
-/*
- * Functions defined in ISO XPG4.2, ISO C99, POSIX 1003.1-2001 or later.
- */
-#if ((__STDC_VERSION__ - 0) >= 199901L) || \
-    ((_POSIX_C_SOURCE - 0) >= 200112L) || \
-    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
-    ((_XOPEN_SOURCE - 0) >= 500) || \
-    defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
-__BEGIN_DECLS
-int     snprintf(char * __restrict, size_t, const char * __restrict, ...)
-               __printflike(3, 4);
-int     vsnprintf(char * __restrict, size_t, const char * __restrict,
-           _BSD_VA_LIST_)
-               __printflike(3, 0);
-__END_DECLS
-#endif
-
-/*
- * Functions defined in XPG4.2.
- */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-__BEGIN_DECLS
-int     getw(FILE *);
-int     putw(int, FILE *);
-
-#ifndef __AUDIT__
-char   *tempnam(const char *, const char *);
-#endif
-__END_DECLS
-#endif
-
-/*
- * X/Open CAE Specification Issue 5 Version 2
- */
-#if (_XOPEN_SOURCE - 0) >= 500 || defined(_LARGEFILE_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-#ifndef        off_t
-typedef        __off_t         off_t;
-#define        off_t           __off_t
-#endif /* off_t */
-
-__BEGIN_DECLS
-int     fseeko(FILE *, off_t, int);
-off_t   ftello(FILE *);
-__END_DECLS
-#endif /* _XOPEN_SOURCE >= 500 || _LARGEFILE_SOURCE || _NETBSD_SOURCE */
-
-/*
- * Functions defined in ISO C99.  Still put under _NETBSD_SOURCE due to
- * backward compatible.
- */
-#if defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
-__BEGIN_DECLS
-int     vscanf(const char * __restrict, _BSD_VA_LIST_)
-               __scanflike(1, 0);
-int     vfscanf(FILE * __restrict, const char * __restrict, _BSD_VA_LIST_)
-               __scanflike(2, 0);
-int     vsscanf(const char * __restrict, const char * __restrict,
-    _BSD_VA_LIST_)
-    __scanflike(2, 0);
-__END_DECLS
-#endif /* _ISOC99_SOURCE || _NETBSD_SOURCE */
-
-/*
- * Routines that are purely local.
- */
-#if defined(_NETBSD_SOURCE)
-
-#define        FPARSELN_UNESCESC       0x01
-#define        FPARSELN_UNESCCONT      0x02
-#define        FPARSELN_UNESCCOMM      0x04
-#define        FPARSELN_UNESCREST      0x08
-#define        FPARSELN_UNESCALL       0x0f
-
-__BEGIN_DECLS
-int     asprintf(char ** __restrict, const char * __restrict, ...)
-               __printflike(2, 3);
-char   *fgetln(FILE * __restrict, size_t * __restrict);
-char   *fparseln(FILE *, size_t *, size_t *, const char[3], int);
-int     fpurge(FILE *);
-void    setbuffer(FILE *, char *, int);
-int     setlinebuf(FILE *);
-int     vasprintf(char ** __restrict, const char * __restrict,
-    _BSD_VA_LIST_)
-               __printflike(2, 0);
-const char *fmtcheck(const char *, const char *)
-               __format_arg(2);
-__END_DECLS
-
-/*
- * Stdio function-access interface.
- */
-__BEGIN_DECLS
-FILE   *funopen(const void *,
-               int (*)(void *, char *, int),
-               int (*)(void *, const char *, int),
-               fpos_t (*)(void *, fpos_t, int),
-               int (*)(void *));
-__END_DECLS
-#define        fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
-#define        fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
-#endif /* _NETBSD_SOURCE */
-
-/*
- * Functions internal to the implementation.
- */
-__BEGIN_DECLS
-int    __srget(FILE *);
-int    __swbuf(int, FILE *);
-__END_DECLS
-
-/*
- * The __sfoo macros are here so that we can 
- * define function versions in the C library.
- */
-#define        __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
-#if defined(__GNUC__) && defined(__STDC__)
-static __inline int __sputc(int _c, FILE *_p) {
-       if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
-               return (*_p->_p++ = _c);
-       else
-               return (__swbuf(_c, _p));
-}
-#else
-/*
- * This has been tuned to generate reasonable code on the vax using pcc.
- */
-#define        __sputc(c, p) \
-       (--(p)->_w < 0 ? \
-               (p)->_w >= (p)->_lbfsize ? \
-                       (*(p)->_p = (c)), *(p)->_p != '\n' ? \
-                               (int)*(p)->_p++ : \
-                               __swbuf('\n', p) : \
-                       __swbuf((int)(c), p) : \
-               (*(p)->_p = (c), (int)*(p)->_p++))
-#endif
-
-#define        __sfeof(p)      (((p)->_flags & __SEOF) != 0)
-#define        __sferror(p)    (((p)->_flags & __SERR) != 0)
-#define        __sclearerr(p)  ((void)((p)->_flags &= ~(__SERR|__SEOF)))
-#define        __sfileno(p)    \
-    ((p)->_file == -1 ? -1 : (int)(unsigned short)(p)->_file)
-
-#ifndef __lint__
-#if !defined(_REENTRANT) && !defined(_PTHREADS)
-#define        feof(p)         __sfeof(p)
-#define        ferror(p)       __sferror(p)
-#define        clearerr(p)     __sclearerr(p)
-
-#define        getc(fp)        __sgetc(fp)
-#define putc(x, fp)    __sputc(x, fp)
-#endif /* !_REENTRANT && !_PTHREADS */
-#endif /* __lint__ */
-
-#define        getchar()       getc(stdin)
-#define        putchar(x)      putc(x, stdout)
-
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-#if !defined(_REENTRANT) && !defined(_PTHREADS)
-#define        fileno(p)       __sfileno(p)
-#endif /* !_REENTRANT && !_PTHREADS */
-#endif /* !_ANSI_SOURCE */
-
-#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
-int     vdprintf(int, const char * __restrict, _BSD_VA_LIST_)
-               __printflike(2, 0);
-int     dprintf(int, const char * __restrict, ...)
-               __printflike(2, 3);
-#endif /* (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE) */
-
-#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
-#define getc_unlocked(fp)      __sgetc(fp)
-#define putc_unlocked(x, fp)   __sputc(x, fp)
-
-#define getchar_unlocked()     getc_unlocked(stdin)
-#define putchar_unlocked(x)    putc_unlocked(x, stdout)
-#endif /* _POSIX_C_SOURCE >= 199506 || _XOPEN_SOURCE >= 500 || _REENTRANT... */
-
-#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \
-    defined(_NETBSD_SOURCE)
-FILE *fmemopen(void * __restrict, size_t, const char * __restrict);
-#endif
-
-#if _FORTIFY_SOURCE > 0
-#include <ssp/stdio.h>
-#endif
-
-#endif /* _STDIO_H_ */
diff --git a/nbsd_include/stdlib.h b/nbsd_include/stdlib.h
deleted file mode 100644 (file)
index 63d3347..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
-/*     $NetBSD: stdlib.h,v 1.94 2010/12/22 19:47:56 jruoho Exp $       */
-
-/*-
- * Copyright (c) 1990, 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. 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.
- *
- *     @(#)stdlib.h    8.5 (Berkeley) 5/19/95
- */
-
-#ifndef _STDLIB_H_
-#define _STDLIB_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-
-#if defined(_NETBSD_SOURCE)
-#include <sys/types.h>         /* for quad_t, etc. */
-#endif
-
-#include <machine/ansi.h>
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_    size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
-typedef        _BSD_WCHAR_T_   wchar_t;
-#undef _BSD_WCHAR_T_
-#endif
-
-typedef struct {
-       int quot;               /* quotient */
-       int rem;                /* remainder */
-} div_t;
-
-typedef struct {
-       long quot;              /* quotient */
-       long rem;               /* remainder */
-} ldiv_t;
-
-#if !defined(_ANSI_SOURCE) && \
-    (defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
-     defined(_NETBSD_SOURCE))
-typedef struct {
-       /* LONGLONG */
-       long long int quot;     /* quotient */
-       /* LONGLONG */
-       long long int rem;      /* remainder */
-} lldiv_t;
-#endif
-
-#if defined(_NETBSD_SOURCE)
-typedef struct {
-       quad_t quot;            /* quotient */
-       quad_t rem;             /* remainder */
-} qdiv_t;
-#endif
-
-
-#include <sys/null.h>
-
-#define        EXIT_FAILURE    1
-#define        EXIT_SUCCESS    0
-
-#define        RAND_MAX        0x7fffffff
-
-extern size_t __mb_cur_max;
-#define        MB_CUR_MAX      __mb_cur_max
-
-__BEGIN_DECLS
-__dead  void _Exit(int);
-__dead  void abort(void);
-__pure  int abs(int);
-int     atexit(void (*)(void));
-double  atof(const char *);
-int     atoi(const char *);
-long    atol(const char *);
-#ifndef __BSEARCH_DECLARED
-#define __BSEARCH_DECLARED
-/* also in search.h */
-void   *bsearch(const void *, const void *, size_t, size_t,
-    int (*)(const void *, const void *));
-#endif /* __BSEARCH_DECLARED */
-void   *calloc(size_t, size_t);
-div_t   div(int, int);
-__dead  void exit(int);
-void    free(void *);
-__aconst char *getenv(const char *);
-__pure long
-        labs(long);
-ldiv_t  ldiv(long, long);
-void   *malloc(size_t);
-void    qsort(void *, size_t, size_t, int (*)(const void *, const void *));
-int     rand(void);
-void   *realloc(void *, size_t);
-void    srand(unsigned);
-double  strtod(const char * __restrict, char ** __restrict);
-long    strtol(const char * __restrict, char ** __restrict, int);
-unsigned long
-        strtoul(const char * __restrict, char ** __restrict, int);
-int     system(const char *);
-
-/* These are currently just stubs. */
-int     mblen(const char *, size_t);
-size_t  mbstowcs(wchar_t * __restrict, const char * __restrict, size_t);
-int     wctomb(char *, wchar_t);
-int     mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
-size_t  wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
-
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-
-
-/*
- * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
- */
-#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
-int     rand_r(unsigned int *);
-#endif
-
-
-/*
- * X/Open Portability Guide >= Issue 4
- */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-double  drand48(void);
-double  erand48(unsigned short[3]);
-long    jrand48(unsigned short[3]);
-void    lcong48(unsigned short[7]);
-long    lrand48(void);
-long    mrand48(void);
-long    nrand48(unsigned short[3]);
-unsigned short *
-        seed48(unsigned short[3]);
-void    srand48(long);
-
-int     putenv(char *);
-#endif
-
-
-/*
- * X/Open Portability Guide >= Issue 4 Version 2
- */
-#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
-    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-long    a64l(const char *);
-char   *l64a(long);
-
-char   *initstate(unsigned long, char *, size_t);
-long    random(void);
-char   *setstate(char *);
-void    srandom(unsigned long);
-#ifdef _NETBSD_SOURCE
-#define        RANDOM_MAX      0x7fffffff      /* (((long)1 << 31) - 1) */
-#endif
-
-char   *mkdtemp(char *);
-int     mkstemp(char *);
-char   *mktemp(char *)
-#ifdef __MKTEMP_OK__
-       __RENAME(_mktemp)
-#endif
-       ;
-
-int     setkey(const char *);
-
-char   *realpath(const char *, char *);
-
-int     ttyslot(void);
-
-void   *valloc(size_t);                /* obsoleted by malloc() */
-
-int     grantpt(int);
-int     unlockpt(int);
-char   *ptsname(int);
-#endif
-
-/*
- * ISO C99
- */
-#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
-    defined(_NETBSD_SOURCE)
-/* LONGLONG */
-long long int  atoll(const char *);
-/* LONGLONG */
-long long int  llabs(long long int);
-/* LONGLONG */
-lldiv_t                lldiv(long long int, long long int);
-/* LONGLONG */
-long long int  strtoll(const char * __restrict, char ** __restrict, int);
-/* LONGLONG */
-unsigned long long int
-               strtoull(const char * __restrict, char ** __restrict, int);
-float          strtof(const char * __restrict, char ** __restrict);
-long double    strtold(const char * __restrict, char ** __restrict);
-#endif
-
-/*
- * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
- */
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \
-    defined(_NETBSD_SOURCE)
-int     setenv(const char *, const char *, int);
-#ifndef __LIBC12_SOURCE__
-int     unsetenv(const char *) __RENAME(__unsetenv13);
-#endif
-
-int     posix_openpt(int);
-int     posix_memalign(void **, size_t, size_t);
-#endif
-
-/*
- * Implementation-defined extensions
- */
-#if defined(_NETBSD_SOURCE)
-#if defined(alloca) && (alloca == __builtin_alloca) && \
-       defined(__GNUC__) && (__GNUC__ < 2)
-void   *alloca(int);     /* built-in for gcc */
-#elif defined(__PCC__) && !defined(__GNUC__)
-#define alloca(size) __builtin_alloca(size)
-#elif (__GNUC__ >= 2)
-#define alloca(size) __builtin_alloca(size)
-#else
-void   *alloca(size_t);
-#endif /* __GNUC__ */
-
-uint32_t arc4random(void);
-void    arc4random_stir(void);
-void    arc4random_addrandom(u_char *, int);
-char   *getbsize(int *, long *);
-char   *cgetcap(char *, const char *, int);
-int     cgetclose(void);
-int     cgetent(char **, const char * const *, const char *);
-int     cgetfirst(char **, const char * const *);
-int     cgetmatch(const char *, const char *);
-int     cgetnext(char **, const char * const *);
-int     cgetnum(char *, const char *, long *);
-int     cgetset(const char *);
-int     cgetstr(char *, const char *, char **);
-int     cgetustr(char *, const char *, char **);
-void    csetexpandtc(int);
-
-int     daemon(int, int);
-#ifndef __minix
-#ifndef __LIBC12_SOURCE__
-__aconst char *devname(dev_t, mode_t) __RENAME(__devname50);
-#endif
-#endif /* !__minix */
-
-#define        HN_DECIMAL              0x01
-#define        HN_NOSPACE              0x02
-#define        HN_B                    0x04
-#define        HN_DIVISOR_1000         0x08
-
-#define        HN_GETSCALE             0x10
-#define        HN_AUTOSCALE            0x20
-
-int     humanize_number(char *, size_t, int64_t, const char *, int, int);
-int     dehumanize_number(const char *, int64_t *);
-
-#ifndef __minix
-devmajor_t getdevmajor(const char *, mode_t);
-#endif /* !__minix */
-int     getloadavg(double [], int);
-
-int     getenv_r(const char *, char *, size_t);
-
-void    cfree(void *);
-
-int     heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
-int     mergesort(void *, size_t, size_t,
-           int (*)(const void *, const void *));
-int     radixsort(const unsigned char **, int, const unsigned char *,
-           unsigned);
-int     sradixsort(const unsigned char **, int, const unsigned char *,
-           unsigned);
-
-void    mi_vector_hash(const void * __restrict, size_t, uint32_t,
-           uint32_t[3]);
-
-void    setproctitle(const char *, ...)
-           __printflike(1, 2);
-const char *getprogname(void) __constfunc;
-void   setprogname(const char *);
-
-quad_t  qabs(quad_t);
-quad_t  strtoq(const char * __restrict, char ** __restrict, int);
-u_quad_t strtouq(const char * __restrict, char ** __restrict, int);
-
-       /* LONGLONG */
-long long strsuftoll(const char *, const char *, long long, long long);
-       /* LONGLONG */
-long long strsuftollx(const char *, const char *, long long, long long,
-                       char *, size_t);
-
-int     l64a_r(long, char *, int);
-
-size_t shquote(const char *, char *, size_t);
-size_t shquotev(int, char * const *, char *, size_t);
-#endif /* _NETBSD_SOURCE */
-#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
-
-#if defined(_NETBSD_SOURCE)
-qdiv_t  qdiv(quad_t, quad_t);
-#endif
-__END_DECLS
-
-#endif /* !_STDLIB_H_ */
diff --git a/nbsd_include/string.h b/nbsd_include/string.h
deleted file mode 100644 (file)
index 98825fb..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*     $NetBSD: string.h,v 1.39 2009/07/22 19:48:27 kleink Exp $       */
-
-/*-
- * Copyright (c) 1990, 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. 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.
- *
- *     @(#)string.h    8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _STRING_H_
-#define        _STRING_H_
-#include <machine/ansi.h>
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_    size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-#include <sys/null.h>
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-
-__BEGIN_DECLS
-void   *memchr(const void *, int, size_t);
-int     memcmp(const void *, const void *, size_t);
-void   *memcpy(void * __restrict, const void * __restrict, size_t);
-void   *memmove(void *, const void *, size_t);
-void   *memset(void *, int, size_t);
-char   *strcat(char * __restrict, const char * __restrict);
-char   *strchr(const char *, int);
-int     strcmp(const char *, const char *);
-int     strcoll(const char *, const char *);
-char   *strcpy(char * __restrict, const char * __restrict);
-size_t  strcspn(const char *, const char *);
-__aconst char *strerror(int);
-size_t  strlen(const char *);
-char   *strncat(char * __restrict, const char * __restrict, size_t);
-int     strncmp(const char *, const char *, size_t);
-char   *strncpy(char * __restrict, const char * __restrict, size_t);
-char   *strpbrk(const char *, const char *);
-char   *strrchr(const char *, int);
-size_t  strspn(const char *, const char *);
-char   *strstr(const char *, const char *);
-char   *strtok(char * __restrict, const char * __restrict);
-#if (_POSIX_C_SOURCE - 0 >= 199506L) || (_XOPEN_SOURCE - 0 >= 500) || \
-    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
-char   *strtok_r(char *, const char *, char **);
-int     strerror_r(int, char *, size_t);
-#endif /* _POSIX_C_SOURCE >= 199506 || XOPEN_SOURCE >= 500 || ... */
-size_t  strxfrm(char * __restrict, const char * __restrict, size_t);
-
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-void   *memccpy(void *, const void *, int, size_t);
-char   *strdup(const char *);
-#endif
-
-#if (_POSIX_C_SOURCE - 0 >= 200809L) || (_XOPEN_SOURCE - 0 >= 700) || \
-    defined(_NETBSD_SOURCE)
-char   *stpcpy(char * __restrict, const char * __restrict);
-char   *stpncpy(char * __restrict, const char * __restrict, size_t);
-size_t strnlen(const char *, size_t);
-#ifndef __STRSIGNAL_DECLARED
-#define __STRSIGNAL_DECLARED
-/* also in unistd.h */
-__aconst char *strsignal(int);
-#endif /* __STRSIGNAL_DECLARED */
-/*
- * For POSIX compliance, we still need:
- * strcoll_l
- * strerror_l
- * strxfrm_l
- */
-#endif
-
-#if defined(_NETBSD_SOURCE)
-#include <strings.h>           /* for backwards-compatibilty */
-void   *memmem(const void *, size_t, const void *, size_t);
-char   *strcasestr(const char *, const char *);
-size_t  strlcat(char *, const char *, size_t);
-size_t  strlcpy(char *, const char *, size_t);
-char   *strsep(char **, const char *);
-char   *stresep(char **, const char *, int);
-char   *strndup(const char *, size_t);
-void   *memrchr(const void *, int, size_t);
-#endif
-__END_DECLS
-
-#if _FORTIFY_SOURCE > 0
-#include <ssp/string.h>
-#endif
-#endif /* !defined(_STRING_H_) */
diff --git a/nbsd_include/strings.h b/nbsd_include/strings.h
deleted file mode 100644 (file)
index dc90dcb..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*     $NetBSD: strings.h,v 1.17 2009/08/19 04:22:53 yamt Exp $        */
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _STRINGS_H_
-#define _STRINGS_H_
-
-#include <machine/ansi.h>
-#include <sys/featuretest.h>
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_    size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-#if defined(_NETBSD_SOURCE)
-#include <sys/null.h>
-#endif
-
-#include <sys/cdefs.h>
-
-#include <stdint.h>
-
-__BEGIN_DECLS
-int     bcmp(const void *, const void *, size_t);
-void    bcopy(const void *, void *, size_t);
-void    bzero(void *, size_t);
-int     ffs(int);
-char   *index(const char *, int);
-unsigned int   popcount(unsigned int) __constfunc;
-unsigned int   popcountl(unsigned long) __constfunc;
-unsigned int   popcountll(unsigned long long) __constfunc;
-unsigned int   popcount32(uint32_t) __constfunc;
-unsigned int   popcount64(uint64_t) __constfunc;
-char   *rindex(const char *, int);
-int     strcasecmp(const char *, const char *);
-int     strncasecmp(const char *, const char *, size_t);
-__END_DECLS
-
-#if defined(_NETBSD_SOURCE)
-#include <string.h>
-#endif
-
-#if _FORTIFY_SOURCE > 0
-#include <ssp/strings.h>
-#endif
-#endif /* !defined(_STRINGS_H_) */
diff --git a/nbsd_include/sys/Makefile b/nbsd_include/sys/Makefile
deleted file mode 100644 (file)
index 02af884..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#      $NetBSD: Makefile,v 1.126 2010/03/01 21:10:13 darran Exp $
-
-NETBSDINCSDIR= /usr/include
-INCSDIR= /usr/include/sys
-
-.include <bsd.sys.mk>
-
-
-# Present only in minix
-INCS+= ioc_net.h statfs.h
-
-INCS+= ansi.h atomic.h \
-       bitops.h bswap.h \
-       cdefs.h cdefs_aout.h cdefs_elf.h ctype_bits.h ctype_inline.h \
-       dirent.h \
-       endian.h errno.h \
-       fcntl.h fd_set.h featuretest.h file.h \
-       float_ieee754.h gcq.h gmon.h hash.h \
-       ieee754.h inttypes.h ioctl.h ipc.h \
-       localedef.h \
-       md4.h md5.h \
-       mman.h mount.h \
-       null.h \
-       param.h poll.h ptrace.h \
-       ptree.h \
-       queue.h \
-       rbtree.h resource.h rmd160.h \
-       select.h sha1.h \
-       sha2.h siginfo.h signal.h sigtypes.h \
-       reboot.h sem.h shm.h socket.h \
-       stat.h statvfs.h \
-       sysctl.h stdint.h \
-       syslimits.h syslog.h \
-       termios.h time.h times.h \
-       tree.h ttycom.h ttydefaults.h \
-       types.h \
-       ucontext.h ucred.h uio.h un.h unistd.h utsname.h uuid.h \
-       wait.h
-
-INCSYMLINKS=\
-       sys/fcntl.h ${NETBSDINCSDIR}/fcntl.h \
-       sys/poll.h ${NETBSDINCSDIR}/poll.h \
-       sys/stdint.h ${NETBSDINCSDIR}/stdint.h \
-       sys/syslog.h ${NETBSDINCSDIR}/syslog.h \
-       sys/termios.h ${NETBSDINCSDIR}/termios.h \
-       sys/rmd160.h ${NETBSDINCSDIR}/rmd160.h \
-       sys/sha1.h ${NETBSDINCSDIR}/sha1.h \
-       sys/sha2.h ${NETBSDINCSDIR}/sha2.h \
-       sys/md4.h ${NETBSDINCSDIR}/md4.h \
-       sys/md5.h ${NETBSDINCSDIR}/md5.h \
-       sys/exec_elf.h ${NETBSDINCSDIR}/elf.h \
-
-
-#INCSYMLINKS+= ../soundcard.h ${INCSDIR}/soundcard.h
-
-namei: namei.src gennameih.awk
-       ${TOOL_AWK} -f gennameih.awk < namei.src
-
-.include <bsd.own.mk>
-.include "${MINIXSRCDIR}/common/include/sys/Makefile.inc"
-
-.include <bsd.files.mk>
-.include <bsd.kinc.mk>
diff --git a/nbsd_include/sys/cdefs.h b/nbsd_include/sys/cdefs.h
deleted file mode 100644 (file)
index 3dee9c6..0000000
+++ /dev/null
@@ -1,490 +0,0 @@
-/*     $NetBSD: cdefs.h,v 1.81 2010/12/25 22:30:52 joerg Exp $ */
-
-/*
- * Copyright (c) 1991, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Berkeley Software Design, Inc.
- *
- * 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. 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.
- *
- *     @(#)cdefs.h     8.8 (Berkeley) 1/9/95
- */
-
-#ifndef        _SYS_CDEFS_H_
-#define        _SYS_CDEFS_H_
-
-/*
- * Macro to test if we're using a GNU C compiler of a specific vintage
- * or later, for e.g. features that appeared in a particular version
- * of GNU C.  Usage:
- *
- *     #if __GNUC_PREREQ__(major, minor)
- *     ...cool feature...
- *     #else
- *     ...delete feature...
- *     #endif
- */
-#ifdef __GNUC__
-#define        __GNUC_PREREQ__(x, y)                                           \
-       ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) ||                  \
-        (__GNUC__ > (x)))
-#else
-#define        __GNUC_PREREQ__(x, y)   0
-#endif
-
-#include <machine/cdefs.h>
-#ifdef __ELF__
-#include <sys/cdefs_elf.h>
-#else
-#include <sys/cdefs_aout.h>
-#endif
-
-/*
- * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
- * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
- * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
- * in between its arguments.  __CONCAT can also concatenate double-quoted
- * strings produced by the __STRING macro, but this only works with ANSI C.
- */
-
-#define        ___STRING(x)    __STRING(x)
-#define        ___CONCAT(x,y)  __CONCAT(x,y)
-
-#if __STDC__ || defined(__cplusplus)
-#define        __P(protos)     protos          /* full-blown ANSI C */
-#define        __CONCAT(x,y)   x ## y
-#define        __STRING(x)     #x
-
-#define        __const         const           /* define reserved names to standard */
-#define        __signed        signed
-#define        __volatile      volatile
-#if defined(__cplusplus) || defined(__PCC__)
-#define        __inline        inline          /* convert to C++/C99 keyword */
-#else
-#if !defined(__GNUC__) && !defined(__lint__)
-#define        __inline                        /* delete GCC keyword */
-#endif /* !__GNUC__  && !__lint__ */
-#endif /* !__cplusplus */
-
-#else  /* !(__STDC__ || __cplusplus) */
-#define        __P(protos)     ()              /* traditional C preprocessor */
-#define        __CONCAT(x,y)   x/**/y
-#define        __STRING(x)     "x"
-
-#ifndef __GNUC__
-#define        __const                         /* delete pseudo-ANSI C keywords */
-#define        __inline
-#define        __signed
-#define        __volatile
-#endif /* !__GNUC__ */
-
-/*
- * In non-ANSI C environments, new programs will want ANSI-only C keywords
- * deleted from the program and old programs will want them left alone.
- * Programs using the ANSI C keywords const, inline etc. as normal
- * identifiers should define -DNO_ANSI_KEYWORDS.
- */
-#ifndef        NO_ANSI_KEYWORDS
-#define        const           __const         /* convert ANSI C keywords */
-#define        inline          __inline
-#define        signed          __signed
-#define        volatile        __volatile
-#endif /* !NO_ANSI_KEYWORDS */
-#endif /* !(__STDC__ || __cplusplus) */
-
-/*
- * Used for internal auditing of the NetBSD source tree.
- */
-#ifdef __AUDIT__
-#define        __aconst        __const
-#else
-#define        __aconst
-#endif
-
-/*
- * The following macro is used to remove const cast-away warnings
- * from gcc -Wcast-qual; it should be used with caution because it
- * can hide valid errors; in particular most valid uses are in
- * situations where the API requires it, not to cast away string
- * constants. We don't use *intptr_t on purpose here and we are
- * explicit about unsigned long so that we don't have additional
- * dependencies.
- */
-#define __UNCONST(a)   ((void *)(unsigned long)(const void *)(a))
-
-/*
- * The following macro is used to remove the volatile cast-away warnings
- * from gcc -Wcast-qual; as above it should be used with caution
- * because it can hide valid errors or warnings.  Valid uses include
- * making it possible to pass a volatile pointer to memset().
- * For the same reasons as above, we use unsigned long and not intptr_t.
- */
-#define __UNVOLATILE(a)        ((void *)(unsigned long)(volatile void *)(a))
-
-/*
- * GCC2 provides __extension__ to suppress warnings for various GNU C
- * language extensions under "-ansi -pedantic".
- */
-#if !__GNUC_PREREQ__(2, 0)
-#define        __extension__           /* delete __extension__ if non-gcc or gcc1 */
-#endif
-
-/*
- * GCC1 and some versions of GCC2 declare dead (non-returning) and
- * pure (no side effects) functions using "volatile" and "const";
- * unfortunately, these then cause warnings under "-ansi -pedantic".
- * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
- * these work for GNU C++ (modulo a slight glitch in the C++ grammar
- * in the distribution version of 2.5.5).
- *
- * GCC defines a pure function as depending only on its arguments and
- * global variables.  Typical examples are strlen and sqrt.
- *
- * GCC defines a const function as depending only on its arguments.
- * Therefore calling a const function again with identical arguments
- * will always produce the same result.
- *
- * Rounding modes for floating point operations are considered global
- * variables and prevent sqrt from being a const function.
- *
- * Calls to const functions can be optimised away and moved around
- * without limitations.
- */
-#if !__GNUC_PREREQ__(2, 0)
-#define __attribute__(x)
-#endif
-
-#if __GNUC_PREREQ__(2, 5)
-#define        __dead          __attribute__((__noreturn__))
-#elif defined(__GNUC__)
-#define        __dead          __volatile
-#else
-#define        __dead
-#endif
-
-#if __GNUC_PREREQ__(2, 96)
-#define        __pure          __attribute__((__pure__))
-#elif defined(__GNUC__)
-#define        __pure          __const
-#else
-#define        __pure
-#endif
-
-#if __GNUC_PREREQ__(2, 5)
-#define        __constfunc     __attribute__((__const__))
-#else
-#define        __constfunc
-#endif
-
-#if __GNUC_PREREQ__(3, 0)
-#define        __noinline      __attribute__((__noinline__))
-#else
-#define        __noinline      /* nothing */
-#endif
-
-#if __GNUC_PREREQ__(2, 7)
-#define        __unused        __attribute__((__unused__))
-#else
-#define        __unused        /* delete */
-#endif
-
-#if __GNUC_PREREQ__(3, 1)
-#define        __used          __attribute__((__used__))
-#else
-#define        __used          __unused
-#endif
-
-#if defined(__cplusplus)
-#define        __BEGIN_EXTERN_C        extern "C" {
-#define        __END_EXTERN_C          }
-#define        __static_cast(x,y)      static_cast<x>(y)
-#else
-#define        __BEGIN_EXTERN_C
-#define        __END_EXTERN_C
-#define        __static_cast(x,y)      (x)y
-#endif
-
-#if __GNUC_PREREQ__(4, 0)
-#  define __dso_public __attribute__((__visibility__("default")))
-#  define __dso_hidden __attribute__((__visibility__("hidden")))
-#  define __BEGIN_PUBLIC_DECLS \
-       _Pragma("GCC visibility push(default)") __BEGIN_EXTERN_C
-#  define __END_PUBLIC_DECLS   __END_EXTERN_C _Pragma("GCC visibility pop")
-#  define __BEGIN_HIDDEN_DECLS \
-       _Pragma("GCC visibility push(hidden)") __BEGIN_EXTERN_C
-#  define __END_HIDDEN_DECLS   __END_EXTERN_C _Pragma("GCC visibility pop")
-#else
-#  define __dso_public
-#  define __dso_hidden
-#  define __BEGIN_PUBLIC_DECLS __BEGIN_EXTERN_C
-#  define __END_PUBLIC_DECLS   __END_EXTERN_C
-#  define __BEGIN_HIDDEN_DECLS __BEGIN_EXTERN_C
-#  define __END_HIDDEN_DECLS   __END_EXTERN_C
-#endif
-
-#define        __BEGIN_DECLS           __BEGIN_PUBLIC_DECLS
-#define        __END_DECLS             __END_PUBLIC_DECLS
-
-/*
- * Non-static C99 inline functions are optional bodies.  They don't
- * create global symbols if not used, but can be replaced if desirable.
- * This differs from the behavior of GCC before version 4.3.  The nearest
- * equivalent for older GCC is `extern inline'.  For newer GCC, use the
- * gnu_inline attribute additionally to get the old behavior.
- *
- * For C99 compilers other than GCC, the C99 behavior is expected.
- */
-#if defined(__GNUC__) && defined(__GNUC_STDC_INLINE__)
-#define        __c99inline     extern __attribute__((__gnu_inline__)) __inline
-#elif defined(__GNUC__)
-#define        __c99inline     extern __inline
-#elif defined(__STDC_VERSION__)
-#define        __c99inline     __inline
-#endif
-
-#if defined(__lint__)
-#define        __packed        __packed
-#define        __aligned(x)    /* delete */
-#define        __section(x)    /* delete */
-#elif __GNUC_PREREQ__(2, 7)
-#define        __packed        __attribute__((__packed__))
-#define        __aligned(x)    __attribute__((__aligned__(x)))
-#define        __section(x)    __attribute__((__section__(x)))
-#elif defined(__PCC__)
-#define        __packed        _Pragma("packed 1")
-#define        __aligned(x)    _Pragma("aligned " __STRING(x))
-#define        __section(x)    _Pragma("section " ## x)
-#else
-#define        __packed        error: no __packed for this compiler
-#define        __aligned(x)    error: no __aligned for this compiler
-#define        __section(x)    error: no __section for this compiler
-#endif
-
-/*
- * C99 defines the restrict type qualifier keyword, which was made available
- * in GCC 2.92.
- */
-#if defined(__lint__)
-#define        __restrict      /* delete __restrict when not supported */
-#elif __STDC_VERSION__ >= 199901L
-#define        __restrict      restrict
-#elif !__GNUC_PREREQ__(2, 92)
-#define        __restrict      /* delete __restrict when not supported */
-#endif
-
-/*
- * C99 defines __func__ predefined identifier, which was made available
- * in GCC 2.95.
- */
-#if !(__STDC_VERSION__ >= 199901L)
-#if __GNUC_PREREQ__(2, 6)
-#define        __func__        __PRETTY_FUNCTION__
-#elif __GNUC_PREREQ__(2, 4)
-#define        __func__        __FUNCTION__
-#else
-#define        __func__        ""
-#endif
-#endif /* !(__STDC_VERSION__ >= 199901L) */
-
-#if defined(_KERNEL)
-#if defined(NO_KERNEL_RCSIDS)
-#undef __KERNEL_RCSID
-#define        __KERNEL_RCSID(_n, _s)          /* nothing */
-#endif /* NO_KERNEL_RCSIDS */
-#endif /* _KERNEL */
-
-#if !defined(_STANDALONE) && !defined(_KERNEL)
-#if defined(__GNUC__) || defined(__PCC__)
-#define        __RENAME(x)     ___RENAME(x)
-#else
-#ifdef __lint__
-#define        __RENAME(x)     __symbolrename(x)
-#else
-#error "No function renaming possible"
-#endif /* __lint__ */
-#endif /* __GNUC__ */
-#else /* _STANDALONE || _KERNEL */
-#define        __RENAME(x)     no renaming in kernel or standalone environment
-#endif
-
-/*
- * A barrier to stop the optimizer from moving code or assume live
- * register values. This is gcc specific, the version is more or less
- * arbitrary, might work with older compilers.
- */
-#if __GNUC_PREREQ__(2, 95)
-#define        __insn_barrier()        __asm __volatile("":::"memory")
-#else
-#define        __insn_barrier()        /* */
-#endif
-
-/*
- * GNU C version 2.96 adds explicit branch prediction so that
- * the CPU back-end can hint the processor and also so that
- * code blocks can be reordered such that the predicted path
- * sees a more linear flow, thus improving cache behavior, etc.
- *
- * The following two macros provide us with a way to use this
- * compiler feature.  Use __predict_true() if you expect the expression
- * to evaluate to true, and __predict_false() if you expect the
- * expression to evaluate to false.
- *
- * A few notes about usage:
- *
- *     * Generally, __predict_false() error condition checks (unless
- *       you have some _strong_ reason to do otherwise, in which case
- *       document it), and/or __predict_true() `no-error' condition
- *       checks, assuming you want to optimize for the no-error case.
- *
- *     * Other than that, if you don't know the likelihood of a test
- *       succeeding from empirical or other `hard' evidence, don't
- *       make predictions.
- *
- *     * These are meant to be used in places that are run `a lot'.
- *       It is wasteful to make predictions in code that is run
- *       seldomly (e.g. at subsystem initialization time) as the
- *       basic block reordering that this affects can often generate
- *       larger code.
- */
-#if __GNUC_PREREQ__(2, 96)
-#define        __predict_true(exp)     __builtin_expect((exp) != 0, 1)
-#define        __predict_false(exp)    __builtin_expect((exp) != 0, 0)
-#else
-#define        __predict_true(exp)     (exp)
-#define        __predict_false(exp)    (exp)
-#endif
-
-/*
- * Compiler-dependent macros to declare that functions take printf-like
- * or scanf-like arguments.  They are null except for versions of gcc
- * that are known to support the features properly (old versions of gcc-2
- * didn't permit keeping the keywords out of the application namespace).
- */
-#if __GNUC_PREREQ__(2, 7)
-#define __printflike(fmtarg, firstvararg)      \
-           __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
-#define __scanflike(fmtarg, firstvararg)       \
-           __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
-#define __format_arg(fmtarg)    __attribute__((__format_arg__ (fmtarg)))
-#else
-#define __printflike(fmtarg, firstvararg)      /* nothing */
-#define __scanflike(fmtarg, firstvararg)       /* nothing */
-#define __format_arg(fmtarg)                   /* nothing */
-#endif
-
-/*
- * Macros for manipulating "link sets".  Link sets are arrays of pointers
- * to objects, which are gathered up by the linker.
- *
- * Object format-specific code has provided us with the following macros:
- *
- *     __link_set_add_text(set, sym)
- *             Add a reference to the .text symbol `sym' to `set'.
- *
- *     __link_set_add_rodata(set, sym)
- *             Add a reference to the .rodata symbol `sym' to `set'.
- *
- *     __link_set_add_data(set, sym)
- *             Add a reference to the .data symbol `sym' to `set'.
- *
- *     __link_set_add_bss(set, sym)
- *             Add a reference to the .bss symbol `sym' to `set'.
- *
- *     __link_set_decl(set, ptype)
- *             Provide an extern declaration of the set `set', which
- *             contains an array of the pointer type `ptype'.  This
- *             macro must be used by any code which wishes to reference
- *             the elements of a link set.
- *
- *     __link_set_start(set)
- *             This points to the first slot in the link set.
- *
- *     __link_set_end(set)
- *             This points to the (non-existent) slot after the last
- *             entry in the link set.
- *
- *     __link_set_count(set)
- *             Count the number of entries in link set `set'.
- *
- * In addition, we provide the following macros for accessing link sets:
- *
- *     __link_set_foreach(pvar, set)
- *             Iterate over the link set `set'.  Because a link set is
- *             an array of pointers, pvar must be declared as "type **pvar",
- *             and the actual entry accessed as "*pvar".
- *
- *     __link_set_entry(set, idx)
- *             Access the link set entry at index `idx' from set `set'.
- */
-#define        __link_set_foreach(pvar, set)                                   \
-       for (pvar = __link_set_start(set); pvar < __link_set_end(set); pvar++)
-
-#define        __link_set_entry(set, idx)      (__link_set_begin(set)[idx])
-
-/*
- * Return the number of elements in a statically-allocated array,
- * __x.
- */
-#define        __arraycount(__x)       (sizeof(__x) / sizeof(__x[0]))
-
-/* __BIT(n): nth bit, where __BIT(0) == 0x1. */
-#define        __BIT(__n)      \
-    (((uintmax_t)(__n) >= NBBY * sizeof(uintmax_t)) ? 0 : ((uintmax_t)1 << (uintmax_t)(__n)))
-
-/* __BITS(m, n): bits m through n, m < n. */
-#define        __BITS(__m, __n)        \
-       ((__BIT(MAX((__m), (__n)) + 1) - 1) ^ (__BIT(MIN((__m), (__n))) - 1))
-
-/* find least significant bit that is set */
-#define        __LOWEST_SET_BIT(__mask) ((((__mask) - 1) & (__mask)) ^ (__mask))
-
-#define        __PRIuBIT       PRIuMAX
-#define        __PRIuBITS      __PRIuBIT
-
-#define        __PRIxBIT       PRIxMAX
-#define        __PRIxBITS      __PRIxBIT
-
-#define        __SHIFTOUT(__x, __mask) (((__x) & (__mask)) / __LOWEST_SET_BIT(__mask))
-#define        __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask))
-#define        __SHIFTOUT_MASK(__mask) __SHIFTOUT((__mask), (__mask))
-
-/*
- * Only to be used in other headers that are included from both c or c++
- * NOT to be used in code.
- */
-#ifdef __cplusplus
-#define __CAST(__dt, __st)     static_cast<__dt>(__st)
-#else
-#define __CAST(__dt, __st)     ((__dt)(__st))
-#endif
-
-#ifdef _MINIX
-/* If compiling in Minix tree, Minix ANSI definitions are always useful. */
-#include <minix/ansi.h>
-#endif
-
-#endif /* !_SYS_CDEFS_H_ */
diff --git a/nbsd_include/sys/file.h b/nbsd_include/sys/file.h
deleted file mode 100644 (file)
index 96a0cfa..0000000
+++ /dev/null
@@ -1,169 +0,0 @@
-/*     $NetBSD: file.h,v 1.71 2009/12/24 19:01:12 elad Exp $   */
-
-/*-
- * Copyright (c) 2009 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Andrew Doran.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-/*
- * Copyright (c) 1982, 1986, 1989, 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. 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.
- *
- *     @(#)file.h      8.3 (Berkeley) 1/9/95
- */
-
-#ifndef _SYS_FILE_H_
-#define        _SYS_FILE_H_
-
-#include <sys/fcntl.h>
-#include <sys/unistd.h>
-
-#ifdef _KERNEL
-#include <sys/mallocvar.h>
-#include <sys/queue.h>
-#include <sys/mutex.h>
-#include <sys/condvar.h>
-
-struct proc;
-struct lwp;
-struct uio;
-struct iovec;
-struct stat;
-struct knote;
-
-/*
- * Kernel file descriptor.  One entry for each open kernel vnode and
- * socket.
- *
- * This structure is exported via the KERN_FILE and KERN_FILE2 sysctl
- * calls.  Only add members to the end, do not delete them.
- */
-struct file {
-       off_t           f_offset;       /* first, is 64-bit */
-       kauth_cred_t    f_cred;         /* creds associated with descriptor */
-       const struct fileops {
-               int     (*fo_read)      (struct file *, off_t *, struct uio *,
-                                           kauth_cred_t, int);
-               int     (*fo_write)     (struct file *, off_t *, struct uio *,
-                                           kauth_cred_t, int);
-               int     (*fo_ioctl)     (struct file *, u_long, void *);
-               int     (*fo_fcntl)     (struct file *, u_int, void *);
-               int     (*fo_poll)      (struct file *, int);
-               int     (*fo_stat)      (struct file *, struct stat *);
-               int     (*fo_close)     (struct file *);
-               int     (*fo_kqfilter)  (struct file *, struct knote *);
-               void    (*fo_restart)   (struct file *);
-               void    (*fo_spare1)    (void);
-               void    (*fo_spare2)    (void);
-       } *f_ops;
-       void            *f_data;        /* descriptor data, e.g. vnode/socket */
-       LIST_ENTRY(file) f_list;        /* list of active files */
-       kmutex_t        f_lock;         /* lock on structure */
-       int             f_flag;         /* see fcntl.h */
-       u_int           f_marker;       /* traversal marker (sysctl) */
-#define        DTYPE_VNODE     1               /* file */
-#define        DTYPE_SOCKET    2               /* communications endpoint */
-#define        DTYPE_PIPE      3               /* pipe */
-#define        DTYPE_KQUEUE    4               /* event queue */
-#define        DTYPE_MISC      5               /* misc file descriptor type */
-#define        DTYPE_CRYPTO    6               /* crypto */
-#define        DTYPE_MQUEUE    7               /* message queue */
-#define DTYPE_NAMES \
-    "0", "file", "socket", "pipe", "kqueue", "misc", "crypto", "mqueue"
-       u_int           f_type;         /* descriptor type */
-       u_int           f_advice;       /* access pattern hint; UVM_ADV_* */
-       u_int           f_count;        /* reference count */
-       u_int           f_msgcount;     /* references from message queue */
-       u_int           f_unpcount;     /* deferred close: see uipc_usrreq.c */
-       SLIST_ENTRY(file) f_unplist;    /* deferred close: see uipc_usrreq.c */
-};
-
-/*
- * Flags for fo_read and fo_write and do_fileread/write/v
- */
-#define        FOF_UPDATE_OFFSET       0x0001  /* update the file offset */
-#define        FOF_IOV_SYSSPACE        0x0100  /* iov structure in kernel memory */
-
-LIST_HEAD(filelist, file);
-extern struct filelist filehead;       /* head of list of open files */
-extern u_int           maxfiles;       /* kernel limit on # of open files */
-extern u_int           nfiles;         /* actual number of open files */
-
-extern const struct fileops vnops;     /* vnode operations for files */
-
-int    dofileread(int, struct file *, void *, size_t,
-           off_t *, int, register_t *);
-int    dofilewrite(int, struct file *, const void *,
-           size_t, off_t *, int, register_t *);
-
-int    do_filereadv(int, const struct iovec *, int, off_t *,
-           int, register_t *);
-int    do_filewritev(int, const struct iovec *, int, off_t *,
-           int, register_t *);
-
-int    fsetown(pid_t *, u_long, const void *);
-int    fgetown(pid_t, u_long, void *);
-void   fownsignal(pid_t, int, int, int, void *);
-
-/* Commonly used fileops */
-int    fnullop_fcntl(struct file *, u_int, void *);
-int    fnullop_poll(struct file *, int);
-int    fnullop_kqfilter(struct file *, struct knote *);
-int    fbadop_read(struct file *, off_t *, struct uio *, kauth_cred_t, int);
-int    fbadop_write(struct file *, off_t *, struct uio *, kauth_cred_t, int);
-int    fbadop_ioctl(struct file *, u_long, void *);
-int    fbadop_close(struct file *);
-int    fbadop_stat(struct file *, struct stat *);
-void   fnullop_restart(struct file *);
-
-#endif /* _KERNEL */
-
-#endif /* _SYS_FILE_H_ */
diff --git a/nbsd_include/sys/ioctl.h b/nbsd_include/sys/ioctl.h
deleted file mode 100644 (file)
index da3ae0b..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*     sys/ioctl.h - All ioctl() command codes.        Author: Kees J. Bot
- *                                                             23 Nov 2002
- *
- * This header file includes all other ioctl command code headers.
- */
-
-#ifndef _S_IOCTL_H
-#define _S_IOCTL_H
-
-/* A driver that uses ioctls claims a character for its series of commands.
- * For instance:  #define TCGETS  _IOR('T',  8, struct termios)
- * This is a terminal ioctl that uses the character 'T'.  The character(s)
- * used in each header file are shown in the comment following.
- */
-
-#include <sys/ioc_tty.h>       /* 'T' 't' 'k'          */
-#include <sys/ioc_net.h>       /* 'n'                  */
-#include <sys/ioc_disk.h>      /* 'd'                  */
-#include <sys/ioc_file.h>      /* 'f'                  */
-#include <sys/ioc_memory.h>    /* 'm'                  */
-#include <sys/ioc_tape.h>      /* 'M'                  */
-#include <sys/ioc_sound.h>     /* 's'                  */
-
-#if defined(_NETBSD_SOURCE)
-#define                TIOCDRAIN       TCDRAIN
-#define                TIOCGETA        TCGETS
-#define                TIOCSETA        TCSETS
-#define                TIOCSETAW       TCSETSW
-#define                TIOCSETAF       TCSETSF
-#endif
-
-#endif /* _S_IOCTL_H */
diff --git a/nbsd_include/sys/ipc.h b/nbsd_include/sys/ipc.h
deleted file mode 100644 (file)
index ae52b64..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * SVID compatible ipc.h file
- */
-
-#ifndef _SYS_IPC_H_
-#define _SYS_IPC_H_
-
-#include <sys/featuretest.h>
-#include <sys/types.h>
-
-/* Data structure used to pass permission information to IPC operations. */
-struct ipc_perm
-{
-       key_t key;                      /* Key. */
-       uid_t uid;                      /* Owner's user ID. */
-       gid_t  gid;                     /* Owner's group ID. */
-       uid_t cuid;                     /* Creator's user ID. */
-       gid_t  cgid;                    /* Creator's group ID. */
-       unsigned short int mode;        /* Reader/write permission. */
-       unsigned short int __seq;       /* Sequence number. */
-};
-
-/* X/Open required constants (same values as system 5) */
-#define        IPC_CREAT       001000  /* create entry if key does not exist */
-#define        IPC_EXCL        002000  /* fail if key exists */
-#define        IPC_NOWAIT      004000  /* error if request must wait */
-
-#define        IPC_PRIVATE     (key_t)0 /* private key */
-
-#define        IPC_RMID        0       /* remove identifier */
-#define        IPC_SET         1       /* set options */
-#define        IPC_STAT        2       /* get options */
-
-#ifdef __minix
-#define IPC_INFO       3       /* See ipcs. */
-#endif /* !__minix */
-
-/*
- * Macro to convert between ipc ids and array indices or sequence ids.
- */
-#if defined(_NETBSD_SOURCE)
-#define        IXSEQ_TO_IPCID(ix,perm) (((perm._seq) << 16) | (ix & 0xffff))
-#endif
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-key_t  ftok(const char *, int);
-__END_DECLS
-
-#endif /* !_SYS_IPC_H_ */
diff --git a/nbsd_include/sys/mman.h b/nbsd_include/sys/mman.h
deleted file mode 100644 (file)
index 4a28810..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#ifndef _SYS_MMAN_H_
-#define _SYS_MMAN_H_
-
-#include <sys/featuretest.h>
-
-#include <machine/ansi.h>
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_    size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-#include <sys/ansi.h>
-
-#ifndef        mode_t
-typedef        __mode_t        mode_t;
-#define        mode_t          __mode_t
-#endif
-
-#ifndef        off_t
-typedef        __off_t         off_t;          /* file offset */
-#define        off_t           __off_t
-#endif
-
-
-/*
- * Protections are chosen from these bits, or-ed together
- */
-#define PROT_NONE       0x00    /* no permissions */
-#define PROT_READ       0x01    /* pages can be read */
-#define PROT_WRITE      0x02    /* pages can be written */
-#define PROT_EXEC       0x04    /* pages can be executed */
-
-/*
- * Flags contain sharing type and options.
- * Sharing types; choose one.
- */
-#ifndef __minix
-#define        MAP_SHARED      0x0001  /* share changes */
-#endif
-#define        MAP_PRIVATE     0x0002  /* changes are private */
-
-/*
- * Mapping type
- */
-#define MAP_ANON       0x0004  /* anonymous memory */
-
-/*
- * Minix specific flags.
- */
-#define MAP_PREALLOC   0x0008          /* not on-demand */
-#define MAP_CONTIG     0x0010          /* contiguous in physical memory */
-#define MAP_LOWER16M   0x0020          /* physically below 16MB */
-#define MAP_ALIGN64K   0x0040          /* physically aligned at 64kB */
-#define MAP_LOWER1M    0x0080          /* physically below 16MB */
-#define        MAP_ALIGNMENT_64KB      MAP_ALIGN64K
-#define        MAP_IPC_SHARED  0x0100  /* share changes */
-
-/*
- * Error indicator returned by mmap(2)
- */
-#define        MAP_FAILED      ((void *) -1)   /* mmap() failed */
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-#ifndef __minix
-void * mmap(void *, size_t, int, int, int, off_t);
-int    munmap(void *, size_t);
-#else
-void * minix_mmap(void *, size_t, int, int, int, off_t);
-int    minix_munmap(void *, size_t);
-int            minix_munmap_text(void *, size_t);
-void *         vm_remap(int d, int s, void *da, void *sa, size_t si);
-void *         vm_remap_ro(int d, int s, void *da, void *sa, size_t si);
-int            vm_unmap(int endpt, void *addr);
-unsigned long  vm_getphys(int endpt, void *addr);
-u8_t           vm_getrefcount(int endpt, void *addr);
-#endif /* __minix */
-__END_DECLS
-
-#endif /* !_SYS_MMAN_H_ */
diff --git a/nbsd_include/sys/null.h b/nbsd_include/sys/null.h
deleted file mode 100644 (file)
index 18836fc..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/*     $NetBSD: null.h,v 1.8 2009/10/13 17:19:00 dsl Exp $     */
-
-#ifndef _SYS_NULL_H_
-#define _SYS_NULL_H_
-#ifndef        NULL
-#if !defined(__GNUG__) || __GNUG__ < 2 || (__GNUG__ == 2 && __GNUC_MINOR__ < 90)
-#if !defined(__cplusplus)
-#define        NULL    ((void *)0)
-#else
-#define        NULL    0
-#endif /* !__cplusplus */
-#else
-#define        NULL    __null
-#endif
-#endif
-#endif /* _SYS_NULL_H_ */
diff --git a/nbsd_include/sys/param.h b/nbsd_include/sys/param.h
deleted file mode 100644 (file)
index b750a3e..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-#ifndef _SYS_PARAM_H_
-#define        _SYS_PARAM_H_
-
-/*
- * Historic BSD #defines -- probably will remain untouched for all time.
- */
-#define        BSD     199506          /* System version (year & month). */
-#define        BSD4_3  1
-#ifndef __minix
-#define        BSD4_4  1
-#endif
-
-/*
- *     #define __NetBSD_Version__ MMmmrrpp00
- *
- *     M = major version
- *     m = minor version; a minor number of 99 indicates current.
- *     r = 0 (*)
- *     p = patchlevel
- *
- * When new releases are made, src/gnu/usr.bin/groff/tmac/mdoc.local
- * needs to be updated and the changes sent back to the groff maintainers.
- *
- * (*) Up to 2.0I "release" used to be "",A-Z,Z[A-Z] but numeric
- *             e.g. NetBSD-1.2D  = 102040000 ('D' == 4)
- *     NetBSD-2.0H     (200080000) was changed on 20041001 to:
- *     2.99.9          (299000900)
- */
-
-#define        __NetBSD_Version__      599002900       /* NetBSD 5.99.29 */
-
-#define __NetBSD_Prereq__(M,m,p) (((((M) * 100000000) + \
-    (m) * 1000000) + (p) * 100) <= __NetBSD_Version__)
-
-/*
- * Historical NetBSD #define
- *
- * NetBSD 1.4 was the last release for which this value was incremented.
- * The value is now permanently fixed at 199905. It will never be
- * changed again.
- *
- * New code must use __NetBSD_Version__ instead, and should not even
- * count on NetBSD being defined.
- *
- */
-
-#define        NetBSD  199905          /* NetBSD version (year & month). */
-
-#include <sys/null.h>
-
-#ifndef __ASSEMBLER__
-#include <sys/inttypes.h>
-#include <sys/types.h>
-
-/*
- * Machine-independent constants (some used in following include files).
- * Redefined constants are from POSIX 1003.1 limits file.
- *
- * MAXCOMLEN should be >= sizeof(ac_comm) (see <acct.h>)
- * MAXHOSTNAMELEN should be >= (_POSIX_HOST_NAME_MAX + 1) (see <limits.h>)
- * MAXLOGNAME should be >= UT_NAMESIZE (see <utmp.h>)
- */
-#include <sys/syslimits.h>
-
-
-#define        MAXCOMLEN       16              /* max command name remembered */
-#define        MAXINTERP       PATH_MAX        /* max interpreter file name length */
-/* DEPRECATED: use LOGIN_NAME_MAX instead. */
-#define        MAXLOGNAME      (LOGIN_NAME_MAX - 1) /* max login name length */
-#ifndef __minix
-#define        NCARGS          ARG_MAX         /* max bytes for an exec function */
-#endif
-#define        NGROUPS         NGROUPS_MAX     /* max number groups */
-#define        NOGROUP         65535           /* marker for empty group set member */
-
-#define        MAXHOSTNAMELEN  256             /* max hostname size */
-
-#ifndef NOFILE
-#define        NOFILE          OPEN_MAX        /* max open files per process */
-#endif
-#ifndef MAXUPRC                                /* max simultaneous processes */
-#define        MAXUPRC         CHILD_MAX       /* POSIX 1003.1-compliant default */
-#else
-#if (MAXUPRC - 0) < CHILD_MAX
-#error MAXUPRC less than CHILD_MAX.  See options(4) for details.
-#endif /* (MAXUPRC - 0) < CHILD_MAX */
-#endif /* !defined(MAXUPRC) */
-
-/* Signals. */
-#include <sys/signal.h>
-
-/* Machine type dependent parameters. */
-#include <machine/param.h>
-#include <machine/limits.h>
-
-/* pages ("clicks") to disk blocks */
-#define        ctod(x)         ((x) << (PGSHIFT - DEV_BSHIFT))
-#define        dtoc(x)         ((x) >> (PGSHIFT - DEV_BSHIFT))
-
-/* bytes to pages */
-#define        ctob(x)         ((x) << PGSHIFT)
-#define        btoc(x)         (((x) + PGOFSET) >> PGSHIFT)
-
-/* bytes to disk blocks */
-#define        dbtob(x)        ((x) << DEV_BSHIFT)
-#define        btodb(x)        ((x) >> DEV_BSHIFT)
-
-#ifndef COHERENCY_UNIT
-#define        COHERENCY_UNIT          64
-#endif
-#ifndef CACHE_LINE_SIZE
-#define        CACHE_LINE_SIZE         64
-#endif
-#ifndef MAXCPUS
-#define        MAXCPUS                 32
-#endif
-#ifndef MAX_LWP_PER_PROC
-#define        MAX_LWP_PER_PROC        8000
-#endif
-
-/*
- * Miscellaneous.
- */
-#define        NBPW    sizeof(int)     /* number of bytes per word (integer) */
-
-#define        CMASK   022             /* default file mask: S_IWGRP|S_IWOTH */
-#define        NODEV   (dev_t)(-1)     /* non-existent device */
-
-#define        CBLOCK  64              /* Clist block size, must be a power of 2. */
-#define        CBQSIZE (CBLOCK/NBBY)   /* Quote bytes/cblock - can do better. */
-                               /* Data chars/clist. */
-#define        CBSIZE  (CBLOCK - (int)sizeof(struct cblock *) - CBQSIZE)
-#define        CROUND  (CBLOCK - 1)    /* Clist rounding. */
-
-/*
- * File system parameters and macros.
- *
- * The file system is made out of blocks of at most MAXBSIZE units, with
- * smaller units (fragments) only in the last direct block.  MAXBSIZE
- * primarily determines the size of buffers in the buffer pool.  It may be
- * made larger without any effect on existing file systems; however making
- * it smaller may make some file systems unmountable.
- */
-#ifndef MAXBSIZE                               /* XXX */
-#define        MAXBSIZE        MAXPHYS
-#endif
-#define        MAXFRAG         8
-
-/*
- * MAXPATHLEN defines the longest permissible path length after expanding
- * symbolic links. It is used to allocate a temporary buffer from the buffer
- * pool in which to do the name expansion, hence should be a power of two,
- * and must be less than or equal to MAXBSIZE.  MAXSYMLINKS defines the
- * maximum number of symbolic links that may be expanded in a path name.
- * It should be set high enough to allow all legitimate uses, but halt
- * infinite loops reasonably quickly.
- *
- * MAXSYMLINKS should be >= _POSIX_SYMLOOP_MAX (see <limits.h>)
- */
-#define        MAXPATHLEN      PATH_MAX
-#define        MAXSYMLINKS     32
-
-/* Bit map related macros. */
-#define        setbit(a,i)     ((a)[(i)/NBBY] |= 1<<((i)%NBBY))
-#define        clrbit(a,i)     ((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
-#define        isset(a,i)      ((a)[(i)/NBBY] & (1<<((i)%NBBY)))
-#define        isclr(a,i)      (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
-
-/* Macros for counting and rounding. */
-#ifndef howmany
-#define        howmany(x, y)   (((x)+((y)-1))/(y))
-#endif
-#define        roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
-#define        rounddown(x,y)  (((x)/(y))*(y))
-#define        roundup2(x, m)  (((x) + (m) - 1) & ~((m) - 1))
-#define        powerof2(x)     ((((x)-1)&(x))==0)
-
-/* Macros for min/max. */
-#define        MIN(a,b)        ((/*CONSTCOND*/(a)<(b))?(a):(b))
-#define        MAX(a,b)        ((/*CONSTCOND*/(a)>(b))?(a):(b))
-
-#endif /* !__ASSEMBLER__ */
-
-#endif /* !_SYS_PARAM_H_ */
diff --git a/nbsd_include/sys/poll.h b/nbsd_include/sys/poll.h
deleted file mode 100644 (file)
index 6e93bed..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*     $NetBSD: poll.h,v 1.3 2008/04/29 05:46:08 martin Exp $  */
-
-/*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _NBCOMPAT_POLL_H_
-#define        _NBCOMPAT_POLL_H_
-
-typedef unsigned int   nfds_t;
-
-#define INFTIM -1
-
-struct pollfd {
-       int     fd;             /* file descriptor */
-       short   events;         /* events to look for */
-       short   revents;        /* events returned */
-};
-
-/*
- * Testable events (may be specified in events field).
- */
-#define        POLLIN          0x0001
-#define        POLLPRI         0x0002
-#define        POLLOUT         0x0004
-#define        POLLRDNORM      0x0040
-#define        POLLWRNORM      POLLOUT
-#define        POLLRDBAND      0x0080
-#define        POLLWRBAND      0x0100
-
-/*
- * Non-testable events (may not be specified in events field).
- */
-#define        POLLERR         0x0008
-#define        POLLHUP         0x0010
-#define        POLLNVAL        0x0020
-
-__BEGIN_DECLS
-int    poll (struct pollfd *, nfds_t, int);
-__END_DECLS
-
-#endif /* !_NBCOMPAT_POLL_H_ */
diff --git a/nbsd_include/sys/ptrace.h b/nbsd_include/sys/ptrace.h
deleted file mode 100644 (file)
index 59c1a44..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/* <sys/ptrace.h>
- * definitions for ptrace(2) 
- */
-
-#ifndef _PTRACE_H
-#define _PTRACE_H
-
-/* Trace requests. */
-#define T_STOP        -1       /* stop the process */
-#define T_OK           0       /* enable tracing by parent for this process */
-#define T_GETINS       1       /* return value from instruction space */
-#define T_GETDATA      2       /* return value from data space */
-#define T_GETUSER      3       /* return value from user process table */
-#define        T_SETINS        4       /* set value from instruction space */
-#define T_SETDATA      5       /* set value from data space */
-#define T_SETUSER      6       /* set value in user process table */
-#define T_RESUME       7       /* resume execution */
-#define T_EXIT         8       /* exit */
-#define T_STEP         9       /* set trace bit */
-#define T_SYSCALL      10      /* trace system call */
-#define T_ATTACH       11      /* attach to a running process */
-#define T_DETACH       12      /* detach from a traced process */
-#define T_SETOPT       13      /* set trace options */
-#define T_GETRANGE     14      /* get range of values */
-#define T_SETRANGE     15      /* set range of values */
-#define T_DUMPCORE      16      /* dumps the core for the process with the given pid */
-
-#define T_READB_INS    100     /* Read a byte from the text segment of an
-                                * untraced process (only for root)
-                                */
-#define T_WRITEB_INS   101     /* Write a byte in the text segment of an
-                                * untraced process (only for root)
-                                */
-
-/* Trace options. */
-#define TO_TRACEFORK   0x1     /* automatically attach to forked children */
-#define TO_ALTEXEC     0x2     /* send SIGSTOP on successful exec() */
-#define TO_NOEXEC      0x4     /* do not send signal on successful exec() */
-
-/* Trace spaces. */
-#define TS_INS         0       /* text space */
-#define TS_DATA                1       /* data space */
-
-/* Trance range structure. */
-struct ptrace_range {
-  int pr_space;                        /* space in traced process */
-  long pr_addr;                        /* address in traced process */
-  void *pr_ptr;                        /* buffer in caller process */
-  size_t pr_size;              /* size of range, in bytes */
-};
-
-/* Function Prototypes. */
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-long ptrace(int _req, pid_t _pid, long _addr, long _data);
-__END_DECLS
-
-#endif /* _PTRACE_H */
diff --git a/nbsd_include/sys/queue.h b/nbsd_include/sys/queue.h
deleted file mode 100644 (file)
index 91a8342..0000000
+++ /dev/null
@@ -1,744 +0,0 @@
-/*     $NetBSD: queue.h,v 1.52 2009/04/20 09:56:08 mschuett Exp $      */
-
-/*
- * Copyright (c) 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. 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.
- *
- *     @(#)queue.h     8.5 (Berkeley) 8/20/94
- */
-
-#ifndef        _SYS_QUEUE_H_
-#define        _SYS_QUEUE_H_
-
-#include <sys/null.h>
-
-/*
- * This file defines five types of data structures: singly-linked lists,
- * lists, simple queues, tail queues, and circular queues.
- *
- * A singly-linked list is headed by a single forward pointer. The
- * elements are singly linked for minimum space and pointer manipulation
- * overhead at the expense of O(n) removal for arbitrary elements. New
- * elements can be added to the list after an existing element or at the
- * head of the list.  Elements being removed from the head of the list
- * should use the explicit macro for this purpose for optimum
- * efficiency. A singly-linked list may only be traversed in the forward
- * direction.  Singly-linked lists are ideal for applications with large
- * datasets and few or no removals or for implementing a LIFO queue.
- *
- * A list is headed by a single forward pointer (or an array of forward
- * pointers for a hash table header). The elements are doubly linked
- * so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before
- * or after an existing element or at the head of the list. A list
- * may only be traversed in the forward direction.
- *
- * A simple queue is headed by a pair of pointers, one the head of the
- * list and the other to the tail of the list. The elements are singly
- * linked to save space, so elements can only be removed from the
- * head of the list. New elements can be added to the list after
- * an existing element, at the head of the list, or at the end of the
- * list. A simple queue may only be traversed in the forward direction.
- *
- * A tail queue is headed by a pair of pointers, one to the head of the
- * list and the other to the tail of the list. The elements are doubly
- * linked so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before or
- * after an existing element, at the head of the list, or at the end of
- * the list. A tail queue may be traversed in either direction.
- *
- * A circle queue is headed by a pair of pointers, one to the head of the
- * list and the other to the tail of the list. The elements are doubly
- * linked so that an arbitrary element can be removed without a need to
- * traverse the list. New elements can be added to the list before or after
- * an existing element, at the head of the list, or at the end of the list.
- * A circle queue may be traversed in either direction, but has a more
- * complex end of list detection.
- *
- * For details on the use of these macros, see the queue(3) manual page.
- */
-
-/*
- * List definitions.
- */
-#define        LIST_HEAD(name, type)                                           \
-struct name {                                                          \
-       struct type *lh_first;  /* first element */                     \
-}
-
-#define        LIST_HEAD_INITIALIZER(head)                                     \
-       { NULL }
-
-#define        LIST_ENTRY(type)                                                \
-struct {                                                               \
-       struct type *le_next;   /* next element */                      \
-       struct type **le_prev;  /* address of previous next element */  \
-}
-
-/*
- * List functions.
- */
-#if defined(_KERNEL) && defined(QUEUEDEBUG)
-#define        QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)                   \
-       if ((head)->lh_first &&                                         \
-           (head)->lh_first->field.le_prev != &(head)->lh_first)       \
-               panic("LIST_INSERT_HEAD %p %s:%d", (head), __FILE__, __LINE__);
-#define        QUEUEDEBUG_LIST_OP(elm, field)                                  \
-       if ((elm)->field.le_next &&                                     \
-           (elm)->field.le_next->field.le_prev !=                      \
-           &(elm)->field.le_next)                                      \
-               panic("LIST_* forw %p %s:%d", (elm), __FILE__, __LINE__);\
-       if (*(elm)->field.le_prev != (elm))                             \
-               panic("LIST_* back %p %s:%d", (elm), __FILE__, __LINE__);
-#define        QUEUEDEBUG_LIST_POSTREMOVE(elm, field)                          \
-       (elm)->field.le_next = (void *)1L;                              \
-       (elm)->field.le_prev = (void *)1L;
-#else
-#define        QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)
-#define        QUEUEDEBUG_LIST_OP(elm, field)
-#define        QUEUEDEBUG_LIST_POSTREMOVE(elm, field)
-#endif
-
-#define        LIST_INIT(head) do {                                            \
-       (head)->lh_first = NULL;                                        \
-} while (/*CONSTCOND*/0)
-
-#define        LIST_INSERT_AFTER(listelm, elm, field) do {                     \
-       QUEUEDEBUG_LIST_OP((listelm), field)                            \
-       if (((elm)->field.le_next = (listelm)->field.le_next) != NULL)  \
-               (listelm)->field.le_next->field.le_prev =               \
-                   &(elm)->field.le_next;                              \
-       (listelm)->field.le_next = (elm);                               \
-       (elm)->field.le_prev = &(listelm)->field.le_next;               \
-} while (/*CONSTCOND*/0)
-
-#define        LIST_INSERT_BEFORE(listelm, elm, field) do {                    \
-       QUEUEDEBUG_LIST_OP((listelm), field)                            \
-       (elm)->field.le_prev = (listelm)->field.le_prev;                \
-       (elm)->field.le_next = (listelm);                               \
-       *(listelm)->field.le_prev = (elm);                              \
-       (listelm)->field.le_prev = &(elm)->field.le_next;               \
-} while (/*CONSTCOND*/0)
-
-#define        LIST_INSERT_HEAD(head, elm, field) do {                         \
-       QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field)               \
-       if (((elm)->field.le_next = (head)->lh_first) != NULL)          \
-               (head)->lh_first->field.le_prev = &(elm)->field.le_next;\
-       (head)->lh_first = (elm);                                       \
-       (elm)->field.le_prev = &(head)->lh_first;                       \
-} while (/*CONSTCOND*/0)
-
-#define        LIST_REMOVE(elm, field) do {                                    \
-       QUEUEDEBUG_LIST_OP((elm), field)                                \
-       if ((elm)->field.le_next != NULL)                               \
-               (elm)->field.le_next->field.le_prev =                   \
-                   (elm)->field.le_prev;                               \
-       *(elm)->field.le_prev = (elm)->field.le_next;                   \
-       QUEUEDEBUG_LIST_POSTREMOVE((elm), field)                        \
-} while (/*CONSTCOND*/0)
-
-#define        LIST_FOREACH(var, head, field)                                  \
-       for ((var) = ((head)->lh_first);                                \
-               (var);                                                  \
-               (var) = ((var)->field.le_next))
-
-#define        LIST_FOREACH_SAFE(var, head, field, tvar)                       \
-       for ((var) = LIST_FIRST((head));                                \
-               (var) && ((tvar) = LIST_NEXT((var), field), 1);         \
-               (var) = (tvar))
-
-/*
- * List access methods.
- */
-#define        LIST_EMPTY(head)                ((head)->lh_first == NULL)
-#define        LIST_FIRST(head)                ((head)->lh_first)
-#define        LIST_NEXT(elm, field)           ((elm)->field.le_next)
-
-
-/*
- * Singly-linked List definitions.
- */
-#define        SLIST_HEAD(name, type)                                          \
-struct name {                                                          \
-       struct type *slh_first; /* first element */                     \
-}
-
-#define        SLIST_HEAD_INITIALIZER(head)                                    \
-       { NULL }
-
-#define        SLIST_ENTRY(type)                                               \
-struct {                                                               \
-       struct type *sle_next;  /* next element */                      \
-}
-
-/*
- * Singly-linked List functions.
- */
-#define        SLIST_INIT(head) do {                                           \
-       (head)->slh_first = NULL;                                       \
-} while (/*CONSTCOND*/0)
-
-#define        SLIST_INSERT_AFTER(slistelm, elm, field) do {                   \
-       (elm)->field.sle_next = (slistelm)->field.sle_next;             \
-       (slistelm)->field.sle_next = (elm);                             \
-} while (/*CONSTCOND*/0)
-
-#define        SLIST_INSERT_HEAD(head, elm, field) do {                        \
-       (elm)->field.sle_next = (head)->slh_first;                      \
-       (head)->slh_first = (elm);                                      \
-} while (/*CONSTCOND*/0)
-
-#define        SLIST_REMOVE_HEAD(head, field) do {                             \
-       (head)->slh_first = (head)->slh_first->field.sle_next;          \
-} while (/*CONSTCOND*/0)
-
-#define        SLIST_REMOVE(head, elm, type, field) do {                       \
-       if ((head)->slh_first == (elm)) {                               \
-               SLIST_REMOVE_HEAD((head), field);                       \
-       }                                                               \
-       else {                                                          \
-               struct type *curelm = (head)->slh_first;                \
-               while(curelm->field.sle_next != (elm))                  \
-                       curelm = curelm->field.sle_next;                \
-               curelm->field.sle_next =                                \
-                   curelm->field.sle_next->field.sle_next;             \
-       }                                                               \
-} while (/*CONSTCOND*/0)
-
-#define        SLIST_REMOVE_AFTER(slistelm, field) do {                        \
-       (slistelm)->field.sle_next =                                    \
-           SLIST_NEXT(SLIST_NEXT((slistelm), field), field);           \
-} while (/*CONSTCOND*/0)
-
-#define        SLIST_FOREACH(var, head, field)                                 \
-       for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next)
-
-#define        SLIST_FOREACH_SAFE(var, head, field, tvar)                      \
-       for ((var) = SLIST_FIRST((head));                               \
-           (var) && ((tvar) = SLIST_NEXT((var), field), 1);            \
-           (var) = (tvar))
-
-/*
- * Singly-linked List access methods.
- */
-#define        SLIST_EMPTY(head)       ((head)->slh_first == NULL)
-#define        SLIST_FIRST(head)       ((head)->slh_first)
-#define        SLIST_NEXT(elm, field)  ((elm)->field.sle_next)
-
-
-/*
- * Singly-linked Tail queue declarations.
- */
-#define        STAILQ_HEAD(name, type)                                 \
-struct name {                                                          \
-       struct type *stqh_first;        /* first element */                     \
-       struct type **stqh_last;        /* addr of last next element */         \
-}
-
-#define        STAILQ_HEAD_INITIALIZER(head)                                   \
-       { NULL, &(head).stqh_first }
-
-#define        STAILQ_ENTRY(type)                                              \
-struct {                                                               \
-       struct type *stqe_next; /* next element */                      \
-}
-
-/*
- * Singly-linked Tail queue functions.
- */
-#define        STAILQ_INIT(head) do {                                          \
-       (head)->stqh_first = NULL;                                      \
-       (head)->stqh_last = &(head)->stqh_first;                                \
-} while (/*CONSTCOND*/0)
-
-#define        STAILQ_INSERT_HEAD(head, elm, field) do {                       \
-       if (((elm)->field.stqe_next = (head)->stqh_first) == NULL)      \
-               (head)->stqh_last = &(elm)->field.stqe_next;            \
-       (head)->stqh_first = (elm);                                     \
-} while (/*CONSTCOND*/0)
-
-#define        STAILQ_INSERT_TAIL(head, elm, field) do {                       \
-       (elm)->field.stqe_next = NULL;                                  \
-       *(head)->stqh_last = (elm);                                     \
-       (head)->stqh_last = &(elm)->field.stqe_next;                    \
-} while (/*CONSTCOND*/0)
-
-#define        STAILQ_INSERT_AFTER(head, listelm, elm, field) do {             \
-       if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\
-               (head)->stqh_last = &(elm)->field.stqe_next;            \
-       (listelm)->field.stqe_next = (elm);                             \
-} while (/*CONSTCOND*/0)
-
-#define        STAILQ_REMOVE_HEAD(head, field) do {                            \
-       if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \
-               (head)->stqh_last = &(head)->stqh_first;                        \
-} while (/*CONSTCOND*/0)
-
-#define        STAILQ_REMOVE(head, elm, type, field) do {                      \
-       if ((head)->stqh_first == (elm)) {                              \
-               STAILQ_REMOVE_HEAD((head), field);                      \
-       } else {                                                        \
-               struct type *curelm = (head)->stqh_first;               \
-               while (curelm->field.stqe_next != (elm))                        \
-                       curelm = curelm->field.stqe_next;               \
-               if ((curelm->field.stqe_next =                          \
-                       curelm->field.stqe_next->field.stqe_next) == NULL) \
-                           (head)->stqh_last = &(curelm)->field.stqe_next; \
-       }                                                               \
-} while (/*CONSTCOND*/0)
-
-#define        STAILQ_FOREACH(var, head, field)                                \
-       for ((var) = ((head)->stqh_first);                              \
-               (var);                                                  \
-               (var) = ((var)->field.stqe_next))
-
-#define        STAILQ_FOREACH_SAFE(var, head, field, tvar)                     \
-       for ((var) = STAILQ_FIRST((head));                              \
-           (var) && ((tvar) = STAILQ_NEXT((var), field), 1);           \
-           (var) = (tvar))
-
-#define        STAILQ_CONCAT(head1, head2) do {                                \
-       if (!STAILQ_EMPTY((head2))) {                                   \
-               *(head1)->stqh_last = (head2)->stqh_first;              \
-               (head1)->stqh_last = (head2)->stqh_last;                \
-               STAILQ_INIT((head2));                                   \
-       }                                                               \
-} while (/*CONSTCOND*/0)
-
-#define        STAILQ_LAST(head, type, field)                                  \
-       (STAILQ_EMPTY((head)) ?                                         \
-               NULL :                                                  \
-               ((struct type *)(void *)                                \
-               ((char *)((head)->stqh_last) - offsetof(struct type, field))))
-
-/*
- * Singly-linked Tail queue access methods.
- */
-#define        STAILQ_EMPTY(head)      ((head)->stqh_first == NULL)
-#define        STAILQ_FIRST(head)      ((head)->stqh_first)
-#define        STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
-
-
-/*
- * Simple queue definitions.
- */
-#define        SIMPLEQ_HEAD(name, type)                                        \
-struct name {                                                          \
-       struct type *sqh_first; /* first element */                     \
-       struct type **sqh_last; /* addr of last next element */         \
-}
-
-#define        SIMPLEQ_HEAD_INITIALIZER(head)                                  \
-       { NULL, &(head).sqh_first }
-
-#define        SIMPLEQ_ENTRY(type)                                             \
-struct {                                                               \
-       struct type *sqe_next;  /* next element */                      \
-}
-
-/*
- * Simple queue functions.
- */
-#define        SIMPLEQ_INIT(head) do {                                         \
-       (head)->sqh_first = NULL;                                       \
-       (head)->sqh_last = &(head)->sqh_first;                          \
-} while (/*CONSTCOND*/0)
-
-#define        SIMPLEQ_INSERT_HEAD(head, elm, field) do {                      \
-       if (((elm)->field.sqe_next = (head)->sqh_first) == NULL)        \
-               (head)->sqh_last = &(elm)->field.sqe_next;              \
-       (head)->sqh_first = (elm);                                      \
-} while (/*CONSTCOND*/0)
-
-#define        SIMPLEQ_INSERT_TAIL(head, elm, field) do {                      \
-       (elm)->field.sqe_next = NULL;                                   \
-       *(head)->sqh_last = (elm);                                      \
-       (head)->sqh_last = &(elm)->field.sqe_next;                      \
-} while (/*CONSTCOND*/0)
-
-#define        SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do {            \
-       if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\
-               (head)->sqh_last = &(elm)->field.sqe_next;              \
-       (listelm)->field.sqe_next = (elm);                              \
-} while (/*CONSTCOND*/0)
-
-#define        SIMPLEQ_REMOVE_HEAD(head, field) do {                           \
-       if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \
-               (head)->sqh_last = &(head)->sqh_first;                  \
-} while (/*CONSTCOND*/0)
-
-#define        SIMPLEQ_REMOVE(head, elm, type, field) do {                     \
-       if ((head)->sqh_first == (elm)) {                               \
-               SIMPLEQ_REMOVE_HEAD((head), field);                     \
-       } else {                                                        \
-               struct type *curelm = (head)->sqh_first;                \
-               while (curelm->field.sqe_next != (elm))                 \
-                       curelm = curelm->field.sqe_next;                \
-               if ((curelm->field.sqe_next =                           \
-                       curelm->field.sqe_next->field.sqe_next) == NULL) \
-                           (head)->sqh_last = &(curelm)->field.sqe_next; \
-       }                                                               \
-} while (/*CONSTCOND*/0)
-
-#define        SIMPLEQ_FOREACH(var, head, field)                               \
-       for ((var) = ((head)->sqh_first);                               \
-               (var);                                                  \
-               (var) = ((var)->field.sqe_next))
-
-#define        SIMPLEQ_FOREACH_SAFE(var, head, field, next)                    \
-       for ((var) = ((head)->sqh_first);                               \
-               (var) && ((next = ((var)->field.sqe_next)), 1);         \
-               (var) = (next))
-
-#define        SIMPLEQ_CONCAT(head1, head2) do {                               \
-       if (!SIMPLEQ_EMPTY((head2))) {                                  \
-               *(head1)->sqh_last = (head2)->sqh_first;                \
-               (head1)->sqh_last = (head2)->sqh_last;          \
-               SIMPLEQ_INIT((head2));                                  \
-       }                                                               \
-} while (/*CONSTCOND*/0)
-
-#define        SIMPLEQ_LAST(head, type, field)                                 \
-       (SIMPLEQ_EMPTY((head)) ?                                                \
-               NULL :                                                  \
-               ((struct type *)(void *)                                \
-               ((char *)((head)->sqh_last) - offsetof(struct type, field))))
-
-/*
- * Simple queue access methods.
- */
-#define        SIMPLEQ_EMPTY(head)             ((head)->sqh_first == NULL)
-#define        SIMPLEQ_FIRST(head)             ((head)->sqh_first)
-#define        SIMPLEQ_NEXT(elm, field)        ((elm)->field.sqe_next)
-
-
-/*
- * Tail queue definitions.
- */
-#define        _TAILQ_HEAD(name, type, qual)                                   \
-struct name {                                                          \
-       qual type *tqh_first;           /* first element */             \
-       qual type *qual *tqh_last;      /* addr of last next element */ \
-}
-#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
-
-#define        TAILQ_HEAD_INITIALIZER(head)                                    \
-       { NULL, &(head).tqh_first }
-
-#define        _TAILQ_ENTRY(type, qual)                                        \
-struct {                                                               \
-       qual type *tqe_next;            /* next element */              \
-       qual type *qual *tqe_prev;      /* address of previous next element */\
-}
-#define TAILQ_ENTRY(type)      _TAILQ_ENTRY(struct type,)
-
-/*
- * Tail queue functions.
- */
-#if defined(_KERNEL) && defined(QUEUEDEBUG)
-#define        QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)                  \
-       if ((head)->tqh_first &&                                        \
-           (head)->tqh_first->field.tqe_prev != &(head)->tqh_first)    \
-               panic("TAILQ_INSERT_HEAD %p %s:%d", (head), __FILE__, __LINE__);
-#define        QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)                  \
-       if (*(head)->tqh_last != NULL)                                  \
-               panic("TAILQ_INSERT_TAIL %p %s:%d", (head), __FILE__, __LINE__);
-#define        QUEUEDEBUG_TAILQ_OP(elm, field)                                 \
-       if ((elm)->field.tqe_next &&                                    \
-           (elm)->field.tqe_next->field.tqe_prev !=                    \
-           &(elm)->field.tqe_next)                                     \
-               panic("TAILQ_* forw %p %s:%d", (elm), __FILE__, __LINE__);\
-       if (*(elm)->field.tqe_prev != (elm))                            \
-               panic("TAILQ_* back %p %s:%d", (elm), __FILE__, __LINE__);
-#define        QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)                    \
-       if ((elm)->field.tqe_next == NULL &&                            \
-           (head)->tqh_last != &(elm)->field.tqe_next)                 \
-               panic("TAILQ_PREREMOVE head %p elm %p %s:%d",           \
-                     (head), (elm), __FILE__, __LINE__);
-#define        QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)                         \
-       (elm)->field.tqe_next = (void *)1L;                             \
-       (elm)->field.tqe_prev = (void *)1L;
-#else
-#define        QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)
-#define        QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)
-#define        QUEUEDEBUG_TAILQ_OP(elm, field)
-#define        QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field)
-#define        QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field)
-#endif
-
-#define        TAILQ_INIT(head) do {                                           \
-       (head)->tqh_first = NULL;                                       \
-       (head)->tqh_last = &(head)->tqh_first;                          \
-} while (/*CONSTCOND*/0)
-
-#define        TAILQ_INSERT_HEAD(head, elm, field) do {                        \
-       QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field)              \
-       if (((elm)->field.tqe_next = (head)->tqh_first) != NULL)        \
-               (head)->tqh_first->field.tqe_prev =                     \
-                   &(elm)->field.tqe_next;                             \
-       else                                                            \
-               (head)->tqh_last = &(elm)->field.tqe_next;              \
-       (head)->tqh_first = (elm);                                      \
-       (elm)->field.tqe_prev = &(head)->tqh_first;                     \
-} while (/*CONSTCOND*/0)
-
-#define        TAILQ_INSERT_TAIL(head, elm, field) do {                        \
-       QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field)              \
-       (elm)->field.tqe_next = NULL;                                   \
-       (elm)->field.tqe_prev = (head)->tqh_last;                       \
-       *(head)->tqh_last = (elm);                                      \
-       (head)->tqh_last = &(elm)->field.tqe_next;                      \
-} while (/*CONSTCOND*/0)
-
-#define        TAILQ_INSERT_AFTER(head, listelm, elm, field) do {              \
-       QUEUEDEBUG_TAILQ_OP((listelm), field)                           \
-       if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
-               (elm)->field.tqe_next->field.tqe_prev =                 \
-                   &(elm)->field.tqe_next;                             \
-       else                                                            \
-               (head)->tqh_last = &(elm)->field.tqe_next;              \
-       (listelm)->field.tqe_next = (elm);                              \
-       (elm)->field.tqe_prev = &(listelm)->field.tqe_next;             \
-} while (/*CONSTCOND*/0)
-
-#define        TAILQ_INSERT_BEFORE(listelm, elm, field) do {                   \
-       QUEUEDEBUG_TAILQ_OP((listelm), field)                           \
-       (elm)->field.tqe_prev = (listelm)->field.tqe_prev;              \
-       (elm)->field.tqe_next = (listelm);                              \
-       *(listelm)->field.tqe_prev = (elm);                             \
-       (listelm)->field.tqe_prev = &(elm)->field.tqe_next;             \
-} while (/*CONSTCOND*/0)
-
-#define        TAILQ_REMOVE(head, elm, field) do {                             \
-       QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field)                \
-       QUEUEDEBUG_TAILQ_OP((elm), field)                               \
-       if (((elm)->field.tqe_next) != NULL)                            \
-               (elm)->field.tqe_next->field.tqe_prev =                 \
-                   (elm)->field.tqe_prev;                              \
-       else                                                            \
-               (head)->tqh_last = (elm)->field.tqe_prev;               \
-       *(elm)->field.tqe_prev = (elm)->field.tqe_next;                 \
-       QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field);                      \
-} while (/*CONSTCOND*/0)
-
-#define        TAILQ_FOREACH(var, head, field)                                 \
-       for ((var) = ((head)->tqh_first);                               \
-               (var);                                                  \
-               (var) = ((var)->field.tqe_next))
-
-#define        TAILQ_FOREACH_SAFE(var, head, field, next)                      \
-       for ((var) = ((head)->tqh_first);                               \
-               (var) != NULL && ((next) = TAILQ_NEXT(var, field), 1);  \
-               (var) = (next))
-
-#define        TAILQ_FOREACH_REVERSE(var, head, headname, field)               \
-       for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last));    \
-               (var);                                                  \
-               (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
-
-#define        TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev)    \
-       for ((var) = TAILQ_LAST((head), headname);                      \
-               (var) && ((prev) = TAILQ_PREV((var), headname, field), 1);\
-               (var) = (prev))
-
-#define        TAILQ_CONCAT(head1, head2, field) do {                          \
-       if (!TAILQ_EMPTY(head2)) {                                      \
-               *(head1)->tqh_last = (head2)->tqh_first;                \
-               (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
-               (head1)->tqh_last = (head2)->tqh_last;                  \
-               TAILQ_INIT((head2));                                    \
-       }                                                               \
-} while (/*CONSTCOND*/0)
-
-/*
- * Tail queue access methods.
- */
-#define        TAILQ_EMPTY(head)               ((head)->tqh_first == NULL)
-#define        TAILQ_FIRST(head)               ((head)->tqh_first)
-#define        TAILQ_NEXT(elm, field)          ((elm)->field.tqe_next)
-
-#define        TAILQ_LAST(head, headname) \
-       (*(((struct headname *)((head)->tqh_last))->tqh_last))
-#define        TAILQ_PREV(elm, headname, field) \
-       (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
-
-
-/*
- * Circular queue definitions.
- */
-#if defined(_KERNEL) && defined(QUEUEDEBUG)
-#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)                           \
-       if ((head)->cqh_first != (void *)(head) &&                      \
-           (head)->cqh_first->field.cqe_prev != (void *)(head))        \
-               panic("CIRCLEQ head forw %p %s:%d", (head),             \
-                     __FILE__, __LINE__);                              \
-       if ((head)->cqh_last != (void *)(head) &&                       \
-           (head)->cqh_last->field.cqe_next != (void *)(head))         \
-               panic("CIRCLEQ head back %p %s:%d", (head),             \
-                     __FILE__, __LINE__);
-#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)                       \
-       if ((elm)->field.cqe_next == (void *)(head)) {                  \
-               if ((head)->cqh_last != (elm))                          \
-                       panic("CIRCLEQ elm last %p %s:%d", (elm),       \
-                             __FILE__, __LINE__);                      \
-       } else {                                                        \
-               if ((elm)->field.cqe_next->field.cqe_prev != (elm))     \
-                       panic("CIRCLEQ elm forw %p %s:%d", (elm),       \
-                             __FILE__, __LINE__);                      \
-       }                                                               \
-       if ((elm)->field.cqe_prev == (void *)(head)) {                  \
-               if ((head)->cqh_first != (elm))                         \
-                       panic("CIRCLEQ elm first %p %s:%d", (elm),      \
-                             __FILE__, __LINE__);                      \
-       } else {                                                        \
-               if ((elm)->field.cqe_prev->field.cqe_next != (elm))     \
-                       panic("CIRCLEQ elm prev %p %s:%d", (elm),       \
-                             __FILE__, __LINE__);                      \
-       }
-#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)                      \
-       (elm)->field.cqe_next = (void *)1L;                             \
-       (elm)->field.cqe_prev = (void *)1L;
-#else
-#define QUEUEDEBUG_CIRCLEQ_HEAD(head, field)
-#define QUEUEDEBUG_CIRCLEQ_ELM(head, elm, field)
-#define QUEUEDEBUG_CIRCLEQ_POSTREMOVE(elm, field)
-#endif
-
-#define        CIRCLEQ_HEAD(name, type)                                        \
-struct name {                                                          \
-       struct type *cqh_first;         /* first element */             \
-       struct type *cqh_last;          /* last element */              \
-}
-
-#define        CIRCLEQ_HEAD_INITIALIZER(head)                                  \
-       { (void *)&head, (void *)&head }
-
-#define        CIRCLEQ_ENTRY(type)                                             \
-struct {                                                               \
-       struct type *cqe_next;          /* next element */              \
-       struct type *cqe_prev;          /* previous element */          \
-}
-
-/*
- * Circular queue functions.
- */
-#define        CIRCLEQ_INIT(head) do {                                         \
-       (head)->cqh_first = (void *)(head);                             \
-       (head)->cqh_last = (void *)(head);                              \
-} while (/*CONSTCOND*/0)
-
-#define        CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do {            \
-       QUEUEDEBUG_CIRCLEQ_HEAD((head), field)                          \
-       QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)                \
-       (elm)->field.cqe_next = (listelm)->field.cqe_next;              \
-       (elm)->field.cqe_prev = (listelm);                              \
-       if ((listelm)->field.cqe_next == (void *)(head))                \
-               (head)->cqh_last = (elm);                               \
-       else                                                            \
-               (listelm)->field.cqe_next->field.cqe_prev = (elm);      \
-       (listelm)->field.cqe_next = (elm);                              \
-} while (/*CONSTCOND*/0)
-
-#define        CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do {           \
-       QUEUEDEBUG_CIRCLEQ_HEAD((head), field)                          \
-       QUEUEDEBUG_CIRCLEQ_ELM((head), (listelm), field)                \
-       (elm)->field.cqe_next = (listelm);                              \
-       (elm)->field.cqe_prev = (listelm)->field.cqe_prev;              \
-       if ((listelm)->field.cqe_prev == (void *)(head))                \
-               (head)->cqh_first = (elm);                              \
-       else                                                            \
-               (listelm)->field.cqe_prev->field.cqe_next = (elm);      \
-       (listelm)->field.cqe_prev = (elm);                              \
-} while (/*CONSTCOND*/0)
-
-#define        CIRCLEQ_INSERT_HEAD(head, elm, field) do {                      \
-       QUEUEDEBUG_CIRCLEQ_HEAD((head), field)                          \
-       (elm)->field.cqe_next = (head)->cqh_first;                      \
-       (elm)->field.cqe_prev = (void *)(head);                         \
-       if ((head)->cqh_last == (void *)(head))                         \
-               (head)->cqh_last = (elm);                               \
-       else                                                            \
-               (head)->cqh_first->field.cqe_prev = (elm);              \
-       (head)->cqh_first = (elm);                                      \
-} while (/*CONSTCOND*/0)
-
-#define        CIRCLEQ_INSERT_TAIL(head, elm, field) do {                      \
-       QUEUEDEBUG_CIRCLEQ_HEAD((head), field)                          \
-       (elm)->field.cqe_next = (void *)(head);                         \
-       (elm)->field.cqe_prev = (head)->cqh_last;                       \
-       if ((head)->cqh_first == (void *)(head))                        \
-               (head)->cqh_first = (elm);                              \
-       else                                                            \
-               (head)->cqh_last->field.cqe_next = (elm);               \
-       (head)->cqh_last = (elm);                                       \
-} while (/*CONSTCOND*/0)
-
-#define        CIRCLEQ_REMOVE(head, elm, field) do {                           \
-       QUEUEDEBUG_CIRCLEQ_HEAD((head), field)                          \
-       QUEUEDEBUG_CIRCLEQ_ELM((head), (elm), field)                    \
-       if ((elm)->field.cqe_next == (void *)(head))                    \
-               (head)->cqh_last = (elm)->field.cqe_prev;               \
-       else                                                            \
-               (elm)->field.cqe_next->field.cqe_prev =                 \
-                   (elm)->field.cqe_prev;                              \
-       if ((elm)->field.cqe_prev == (void *)(head))                    \
-               (head)->cqh_first = (elm)->field.cqe_next;              \
-       else                                                            \
-               (elm)->field.cqe_prev->field.cqe_next =                 \
-                   (elm)->field.cqe_next;                              \
-       QUEUEDEBUG_CIRCLEQ_POSTREMOVE((elm), field)                     \
-} while (/*CONSTCOND*/0)
-
-#define        CIRCLEQ_FOREACH(var, head, field)                               \
-       for ((var) = ((head)->cqh_first);                               \
-               (var) != (const void *)(head);                          \
-               (var) = ((var)->field.cqe_next))
-
-#define        CIRCLEQ_FOREACH_REVERSE(var, head, field)                       \
-       for ((var) = ((head)->cqh_last);                                \
-               (var) != (const void *)(head);                          \
-               (var) = ((var)->field.cqe_prev))
-
-/*
- * Circular queue access methods.
- */
-#define        CIRCLEQ_EMPTY(head)             ((head)->cqh_first == (void *)(head))
-#define        CIRCLEQ_FIRST(head)             ((head)->cqh_first)
-#define        CIRCLEQ_LAST(head)              ((head)->cqh_last)
-#define        CIRCLEQ_NEXT(elm, field)        ((elm)->field.cqe_next)
-#define        CIRCLEQ_PREV(elm, field)        ((elm)->field.cqe_prev)
-
-#define CIRCLEQ_LOOP_NEXT(head, elm, field)                            \
-       (((elm)->field.cqe_next == (void *)(head))                      \
-           ? ((head)->cqh_first)                                       \
-           : (elm->field.cqe_next))
-#define CIRCLEQ_LOOP_PREV(head, elm, field)                            \
-       (((elm)->field.cqe_prev == (void *)(head))                      \
-           ? ((head)->cqh_last)                                        \
-           : (elm->field.cqe_prev))
-
-#endif /* !_SYS_QUEUE_H_ */
diff --git a/nbsd_include/sys/resource.h b/nbsd_include/sys/resource.h
deleted file mode 100644 (file)
index 2aef2e8..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef _SYS_RESOURCE_H_
-#define        _SYS_RESOURCE_H_
-
-#include <sys/featuretest.h>
-#include <sys/time.h>
-
-/*
- * Process priority specifications to get/setpriority.
- */
-#define        PRIO_MIN        -20
-#define        PRIO_MAX        20
-
-#define        PRIO_PROCESS    0
-#define        PRIO_PGRP       1
-#define        PRIO_USER       2
-
-/*
- * Resource limits
- */
-#define RLIMIT_CORE    1
-#define RLIMIT_CPU     2
-#define RLIMIT_DATA    3
-#define RLIMIT_FSIZE   4
-#define RLIMIT_NOFILE  5
-#define RLIMIT_STACK   6
-#define RLIMIT_AS      7
-#define        RLIMIT_VMEM     RLIMIT_AS       /* common alias */
-
-#if defined(_NETBSD_SOURCE)
-#define        RLIM_NLIMITS    8               /* number of resource limits */
-#endif
-
-#define RLIM_INFINITY ((rlim_t) -1)
-#define RLIM_SAVED_CUR RLIM_INFINITY
-#define RLIM_SAVED_MAX RLIM_INFINITY
-
-struct rlimit
-{
-       rlim_t rlim_cur;
-       rlim_t rlim_max;
-};
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int    getpriority(int, int);
-int    getrlimit(int, struct rlimit *);
-int    setpriority(int, int, int);
-__END_DECLS
-
-#endif /* !_SYS_RESOURCE_H_ */
diff --git a/nbsd_include/sys/select.h b/nbsd_include/sys/select.h
deleted file mode 100644 (file)
index e4ba9ce..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*     $NetBSD: select.h,v 1.36 2009/11/11 09:48:51 rmind Exp $        */
-
-/*-
- * Copyright (c) 1992, 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. 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.
- *
- *     @(#)select.h    8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _SYS_SELECT_H_
-#define        _SYS_SELECT_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <sys/fd_set.h>
-
-#ifdef _KERNEL
-#include <sys/selinfo.h>               /* for struct selinfo */
-#include <sys/signal.h>                        /* for sigset_t */
-
-struct lwp;
-struct proc;
-struct timespec;
-struct cpu_info;
-struct socket;
-
-int    selcommon(register_t *, int, fd_set *, fd_set *, fd_set *,
-    struct timespec *, sigset_t *);
-void   selrecord(struct lwp *selector, struct selinfo *);
-void   selnotify(struct selinfo *, int, long);
-void   selsysinit(struct cpu_info *);
-void   selinit(struct selinfo *);
-void   seldestroy(struct selinfo *);
-int    pollsock(struct socket *, const struct timespec *, int);
-
-#else /* _KERNEL */
-
-#include <sys/sigtypes.h>
-#include <time.h>
-
-__BEGIN_DECLS
-#ifndef __LIBC12_SOURCE__
-#ifndef __minix
-int    pselect(int, fd_set * __restrict, fd_set * __restrict,
-    fd_set * __restrict, const struct timespec * __restrict,
-    const sigset_t * __restrict) __RENAME(__pselect50);
-#endif /* !__minix */
-int    select(int, fd_set * __restrict, fd_set * __restrict,
-    fd_set * __restrict, struct timeval * __restrict) __RENAME(__select50);
-#endif /* __LIBC12_SOURCE__ */
-__END_DECLS
-#endif /* _KERNEL */
-
-#ifdef _MINIX
-/* possible select() operation types; read, write, errors */
-/* (FS/driver internal use only) */
-#define SEL_RD         (1 << 0)
-#define SEL_WR         (1 << 1)
-#define SEL_ERR                (1 << 2)
-#define SEL_NOTIFY     (1 << 3) /* not a real select operation */
-#endif
-
-#endif /* !_SYS_SELECT_H_ */
diff --git a/nbsd_include/sys/sem.h b/nbsd_include/sys/sem.h
deleted file mode 100644 (file)
index 05971dd..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/*     $NetBSD: sem.h,v 1.29 2009/01/19 19:39:41 christos Exp $        */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-/*
- * SVID compatible sem.h file
- *
- * Author: Daniel Boulet
- */
-
-#ifndef _SYS_SEM_H_
-#define _SYS_SEM_H_
-
-#include <sys/featuretest.h>
-
-#include <sys/ipc.h>
-
-struct semid_ds {
-       struct ipc_perm sem_perm;             /* operation permission struct */
-       time_t          sem_otime;            /* last semop() time */
-       unsigned long int __unused1;
-       time_t          sem_ctime;            /* last time changed by semctl() */
-       unsigned long int __unused2;
-       unsigned long int sem_nsems;          /* number of semaphores in set */
-       unsigned long int __unused3;
-       unsigned long int __unused4;
-};
-
-/*
- * semop's sops parameter structure
- */
-struct sembuf {
-       unsigned short  sem_num;        /* semaphore # */
-       short           sem_op;         /* semaphore operation */
-       short           sem_flg;        /* operation flags */
-};
-#define SEM_UNDO       0x1000          /* undo changes on process exit */
-
-/*
- * commands for semctl
- */
-#define GETPID          11              /* get sempid */
-#define GETVAL          12              /* get semval */
-#define GETALL          13              /* get all semval's */
-#define GETNCNT         14              /* get semncnt */
-#define GETZCNT         15              /* get semzcnt */
-#define SETVAL          16              /* set semval */
-#define SETALL          17              /* set all semval's */
-
-#ifdef __USE_MISC
-
-/* ipcs ctl cmds */
-# define SEM_STAT 18
-# define SEM_INFO 19
-
-/*
- * semaphore info struct
- */
-struct seminfo {
-       int32_t semmap;         /* # of entries in semaphore map */
-       int32_t semmni;         /* # of semaphore identifiers */
-       int32_t semmns;         /* # of semaphores in system */
-       int32_t semmnu;         /* # of undo structures in system */
-       int32_t semmsl;         /* max # of semaphores per id */
-       int32_t semopm;         /* max # of operations per semop call */
-       int32_t semume;         /* max # of undo entries per process */
-       int32_t semusz;         /* size in bytes of undo structure */
-       int32_t semvmx;         /* semaphore maximum value */
-       int32_t semaem;         /* adjust on exit max value */
-};
-
-#endif /* __USE_MISC */
-
-/*
- * Configuration parameters
- */
-#define SEMMNI 128
-#define SEMMSL 250
-#define SEMMNS (SEMMSL*SEMMNI)
-
-#define SEMOPM 32
-#define SEMVMX 32767
-
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int    semctl(int, int, int, ...);
-int    semget(key_t, int, int);
-int    semop(int, struct sembuf *, size_t);
-__END_DECLS
-
-#endif /* !_SYS_SEM_H_ */
diff --git a/nbsd_include/sys/shm.h b/nbsd_include/sys/shm.h
deleted file mode 100644 (file)
index 2003c72..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*     $NetBSD: shm.h,v 1.48 2009/01/19 19:39:41 christos Exp $        */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
- * NASA Ames Research Center.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-/*
- * Copyright (c) 1994 Adam Glass
- * 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 Adam Glass.
- * 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.
- */
-
-/*
- * As defined+described in "X/Open System Interfaces and Headers"
- *                         Issue 4, p. XXX
- */
-
-#ifndef _SYS_SHM_H_
-#define _SYS_SHM_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-
-#include <sys/ipc.h>
-
-#define        SHM_RDONLY      010000  /* Attach read-only (else read-write) */
-#define        SHM_RND         020000  /* Round attach address to SHMLBA */
-
-/* Segment low boundry address multiple */
-#define        SHMLBA          getpagesize()
-#define SHMMNI 4096
-#define SHMSEG 32              /* max shared segs per process */
-
-typedef unsigned int   shmatt_t;
-
-struct shmid_ds {
-       struct ipc_perm shm_perm;       /* operation permission structure */
-       size_t          shm_segsz;      /* size of segment in bytes */
-       time_t          shm_atime;      /* time of last shmat() */
-       time_t          shm_dtime;      /* time of last shmdt() */
-       time_t          shm_ctime;      /* time of last change by shmctl() */
-       pid_t           shm_cpid;       /* process ID of creator */
-       pid_t           shm_lpid;       /* process ID of last shm operation */
-       shmatt_t        shm_nattch;     /* number of current attaches */
-};
-
-
-/* shm_mode upper byte flags */
-#define SHM_DEST 01000                 /* segment will be destroyed on last detach */
-#define SHM_LOCKED 02000               /* segment will not be swapped */
-
-/* ipcs ctl commands */
-#define SHM_STAT       13
-#define SHM_INFO       14
-
-
-#if defined(_NETBSD_SOURCE) || defined(__minix)
-/*
- * Permission definitions used in shmflag arguments to shmat(2) and shmget(2).
- * Provided for source compatibility only; do not use in new code!
- */
-#define        SHM_R           0400
-#define        SHM_W           0200
-
-/*
- * System 5 style catch-all structure for shared memory constants that
- * might be of interest to user programs.  Do we really want/need this?
- */
-struct shminfo {
-       unsigned long int shmmax;       /* max shared memory segment size (bytes) */
-       unsigned long int shmmin;       /* min shared memory segment size (bytes) */
-       unsigned long int shmmni;       /* max number of shared memory identifiers */
-       unsigned long int shmseg;       /* max shared memory segments per process */
-       unsigned long int shmall;       /* max amount of shared memory (pages) */
-};
-
-#ifdef __minix
-struct shm_info
-{
-       int used_ids;
-       unsigned long int shm_tot;  /* total allocated shm */
-       unsigned long int shm_rss;  /* total resident shm */
-       unsigned long int shm_swp;  /* total swapped shm */
-       unsigned long int swap_attempts;
-       unsigned long int swap_successes;
-};
-#endif /* __minix */
-
-#endif /* _NETBSD_SOURCE */
-
-__BEGIN_DECLS
-void   *shmat(int, const void *, int);
-int    shmctl(int, int, struct shmid_ds *) __RENAME(__shmctl50);
-int    shmdt(const void *);
-int    shmget(key_t, size_t, int);
-__END_DECLS
-
-#endif /* !_SYS_SHM_H_ */
diff --git a/nbsd_include/sys/signal.h b/nbsd_include/sys/signal.h
deleted file mode 100644 (file)
index f9bc91f..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-#ifndef        _SYS_SIGNAL_H_
-#define        _SYS_SIGNAL_H_
-
-#include <sys/featuretest.h>
-#include <sys/sigtypes.h>
-
-#define _NSIG          26
-#define NSIG _NSIG
-
-
-/* Regular signals. */
-#define SIGHUP             1   /* hangup */
-#define SIGINT             2   /* interrupt (DEL) */
-#define SIGQUIT            3   /* quit (ASCII FS) */
-#define SIGILL             4   /* illegal instruction */
-#define SIGTRAP            5   /* trace trap (not reset when caught) */
-#define SIGABRT            6   /* IOT instruction */
-#define SIGBUS             7   /* bus error */
-#define SIGFPE             8   /* floating point exception */
-#define SIGKILL            9   /* kill (cannot be caught or ignored) */
-#define SIGUSR1           10   /* user defined signal # 1 */
-#define SIGSEGV           11   /* segmentation violation */
-#define SIGUSR2           12   /* user defined signal # 2 */
-#define SIGPIPE           13   /* write on a pipe with no one to read it */
-#define SIGALRM           14   /* alarm clock */
-#define SIGTERM           15   /* software termination signal from kill */
-#define SIGEMT           16    /* EMT instruction */
-#define SIGCHLD           17   /* child process terminated or stopped */
-#define SIGWINCH         21    /* window size has changed */
-#define SIGVTALRM         24   /* virtual alarm */
-#define SIGPROF           25   /* profiler alarm */
-
-/* POSIX requires the following signals to be defined, even if they are
- * not supported.  Here are the definitions, but they are not supported.
- */
-#define SIGCONT           18   /* continue if stopped */
-#define SIGSTOP           19   /* stop signal */
-#define SIGTSTP           20   /* interactive stop signal */
-#define SIGTTIN           22   /* background process wants to read */
-#define SIGTTOU           23   /* background process wants to write */
-
-#ifdef _MINIX
-#define SIGIOT             SIGABRT /* for people who speak PDP-11 */
-
-/* MINIX specific signals. These signals are not used by user proceses, 
- * but meant to inform system processes, like the PM, about system events.
- * The order here determines the order signals are processed by system
- * processes in user-space. Higher-priority signals should be first.
- */
-/* Signals delivered by a signal manager. */
-#define SIGSNDELAY       26    /* end of delay for signal delivery */
-
-#define SIGS_FIRST       SIGHUP      /* first system signal */
-#define SIGS_LAST        SIGSNDELAY   /* last system signal */
-#define IS_SIGS(signo)    (signo>=SIGS_FIRST && signo<=SIGS_LAST)
-
-/* Signals delivered by the kernel. */
-#define SIGKMEM                  27    /* kernel memory request pending */
-#define SIGKMESS         28    /* new kernel message */
-#define SIGKSIGSM        29    /* kernel signal pending for signal manager */
-#define SIGKSIG          30    /* kernel signal pending */
-
-#define SIGK_FIRST       SIGKMEM      /* first kernel signal */
-#define SIGK_LAST        SIGKSIG     /* last kernel signal */
-#define IS_SIGK(signo)    (signo>=SIGK_FIRST && signo<=SIGK_LAST)
-
-/* Termination signals for Minix system processes. */
-#define SIGS_IS_LETHAL(sig) \
-    (sig == SIGILL || sig == SIGBUS || sig == SIGFPE || sig == SIGSEGV \
-    || sig == SIGEMT || sig == SIGABRT)
-#define SIGS_IS_TERMINATION(sig) (SIGS_IS_LETHAL(sig) \
-    || (sig == SIGKILL || sig == SIGPIPE))
-#define SIGS_IS_STACKTRACE(sig) (SIGS_IS_LETHAL(sig) && sig != SIGABRT)
-
-#endif
-
-#include <sys/cdefs.h>
-
-typedef void (*__sighandler_t)(int);
-
-/* Macros used as function pointers. */
-#define SIG_ERR    ((__sighandler_t) -1)       /* error return */
-#define SIG_DFL           ((__sighandler_t)  0)        /* default signal handling */
-#define SIG_IGN           ((__sighandler_t)  1)        /* ignore signal */
-#define SIG_HOLD   ((__sighandler_t)  2)       /* block signal */
-#define SIG_CATCH  ((__sighandler_t)  3)       /* catch signal */
-
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-
-#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_NETBSD_SOURCE)
-#include <sys/siginfo.h>
-#endif
-
-#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
-    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-#include <sys/ucontext.h>
-#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
-
-/*
- * Signal vector "template" used in sigaction call.
- */
-struct sigaction {
-       union {
-               void (*_sa_handler)(int);
-#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_NETBSD_SOURCE)
-               void (*_sa_sigaction)(int, siginfo_t *, void *);
-#endif
-       } _sa_u;        /* signal handler */
-       sigset_t sa_mask;               /* signal mask to apply */
-       int     sa_flags;               /* see signal options below */
-};
-
-#define sa_handler _sa_u._sa_handler
-#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_NETBSD_SOURCE)
-#define sa_sigaction _sa_u._sa_sigaction
-#endif
-
-#include <machine/signal.h>    /* sigcontext; codes for SIGILL, SIGFPE */
-
-/* Fields for sa_flags. */
-#define SA_ONSTACK   0x0001    /* deliver signal on alternate stack */
-#define SA_RESETHAND 0x0002    /* reset signal handler when signal caught */
-#define SA_NODEFER   0x0004    /* don't block signal while catching it */
-#define SA_RESTART   0x0008    /* automatic system call restart */
-#define SA_SIGINFO   0x0010    /* extended signal handling */
-#define SA_NOCLDWAIT 0x0020    /* don't create zombies */
-#define SA_NOCLDSTOP 0x0040    /* don't receive SIGCHLD when child stops */
-
-/* POSIX requires these values for use with sigprocmask(2). */
-#define SIG_BLOCK          0   /* for blocking signals */
-#define SIG_UNBLOCK        1   /* for unblocking signals */
-#define SIG_SETMASK        2   /* for setting the signal mask */
-#define SIG_INQUIRE        4   /* for internal use only */
-
-#if defined(_NETBSD_SOURCE)
-typedef        void (*sig_t)(int);     /* type of signal function */
-#endif
-
-#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
-    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-/*
- * Flags used with stack_t/struct sigaltstack.
- */
-#define SS_ONSTACK      1      /* Process is executing on an alternate stack */
-#define SS_DISABLE      2      /* Alternate stack is disabled */
-
-#define MINSIGSTKSZ    2048    /* Minimal stack size is 2k */
-#define        SIGSTKSZ        (MINSIGSTKSZ + 32768)   /* recommended stack size */
-#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
-
-#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
-    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-/*
- * Structure used in sigstack call.
- */
-struct sigstack {
-       void    *ss_sp;                 /* signal stack pointer */
-       int     ss_onstack;             /* current status */
-};
-#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
-
-#if defined(_NETBSD_SOURCE) && !defined(_KERNEL)
-/*
- * Macro for converting signal number to a mask suitable for
- * sigblock().
- */
-#define sigmask(n)     __sigmask(n)
-
-#define        BADSIG          SIG_ERR
-#endif /* _NETBSD_SOURCE */
-
-#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_NETBSD_SOURCE)
-struct sigevent {
-       int     sigev_notify;
-       int     sigev_signo;
-       union sigval    sigev_value;
-       void    (*sigev_notify_function)(union sigval);
-       void /* pthread_attr_t */       *sigev_notify_attributes;
-};
-
-#define SIGEV_NONE     0
-#define SIGEV_SIGNAL   1
-#define SIGEV_THREAD   2
-#if defined(_NETBSD_SOURCE)
-#define SIGEV_SA       3
-#endif
-#endif /* (_POSIX_C_SOURCE - 0) >= 199309L || ... */
-
-#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
-
-/*
- * For historical reasons; programs expect signal's return value to be
- * defined by <sys/signal.h>.
- */
-__BEGIN_DECLS
-void   (*signal(int, void (*)(int)))(int);
-__END_DECLS
-#endif /* !_SYS_SIGNAL_H_ */
-
-
-
-
diff --git a/nbsd_include/sys/socket.h b/nbsd_include/sys/socket.h
deleted file mode 100644 (file)
index a738ce8..0000000
+++ /dev/null
@@ -1,309 +0,0 @@
-#ifndef _SYS_SOCKET_H_
-#define        _SYS_SOCKET_H_
-
-#include <sys/featuretest.h>
-
-/*
- * Definitions related to sockets: types, address families, options.
- */
-
-/*
- * Data types.
- */
-#include <sys/ansi.h>
-
-#ifndef sa_family_t
-typedef __sa_family_t  sa_family_t;
-#define sa_family_t    __sa_family_t
-#endif
-
-#ifndef socklen_t
-typedef __socklen_t    socklen_t;
-#define socklen_t      __socklen_t
-#endif
-
-#include <machine/ansi.h>
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_    size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-#ifdef _BSD_SSIZE_T_
-typedef        _BSD_SSIZE_T_   ssize_t;
-#undef _BSD_SSIZE_T_
-#endif
-
-#include <sys/uio.h>
-
-/*
- * Socket types.
- */
-#define        SOCK_STREAM     1               /* stream socket */
-#define        SOCK_DGRAM      2               /* datagram socket */
-#define        SOCK_RAW        3               /* raw-protocol interface */
-#define        SOCK_RDM        4               /* reliably-delivered message */
-#define        SOCK_SEQPACKET  5               /* sequenced packet stream */
-
-/*
- * Option flags per-socket.
- */
-#define        SO_DEBUG        0x0001          /* turn on debugging info recording */
-#define        SO_REUSEADDR    0x0004          /* allow local address reuse */
-#define        SO_KEEPALIVE    0x0008          /* keep connections alive */
-#define        SO_TYPE         0x0010          /* get socket type */
-
-#define SO_PASSCRED    0x0012
-#define SO_PEERCRED    0x0014
-
-#define SO_SNDBUF      0x1001          /* send buffer size */
-#define SO_RCVBUF      0x1002          /* receive buffer size */
-#define        SO_ERROR        0x1007          /* get error status and clear */
-
-
-/*
- * Level number for (get/set)sockopt() to apply to socket itself.
- */
-#define        SOL_SOCKET      0xffff          /* options for socket level */
-
-/*
- * Address families.
- */
-#define        AF_UNSPEC       0               /* unspecified */
-#define        AF_LOCAL        1               /* local to host */
-#define        AF_UNIX         AF_LOCAL        /* backward compatibility */
-#define        AF_INET         2               /* internetwork: UDP, TCP, etc. */
-#define        AF_IMPLINK      3               /* arpanet imp addresses */
-#define        AF_PUP          4               /* pup protocols: e.g. BSP */
-#define        AF_CHAOS        5               /* mit CHAOS protocols */
-#define        AF_NS           6               /* XEROX NS protocols */
-#define        AF_ISO          7               /* ISO protocols */
-#define        AF_OSI          AF_ISO
-#define        AF_ECMA         8               /* european computer manufacturers */
-#define        AF_DATAKIT      9               /* datakit protocols */
-#define        AF_CCITT        10              /* CCITT protocols, X.25 etc */
-#define        AF_SNA          11              /* IBM SNA */
-#define AF_DECnet      12              /* DECnet */
-#define AF_DLI         13              /* DEC Direct data link interface */
-#define AF_LAT         14              /* LAT */
-#define        AF_HYLINK       15              /* NSC Hyperchannel */
-#define        AF_APPLETALK    16              /* Apple Talk */
-#define        AF_ROUTE        17              /* Internal Routing Protocol */
-#define        AF_LINK         18              /* Link layer interface */
-#if defined(_NETBSD_SOURCE)
-#define        pseudo_AF_XTP   19              /* eXpress Transfer Protocol (no AF) */
-#endif
-#define        AF_COIP         20              /* connection-oriented IP, aka ST II */
-#define        AF_CNT          21              /* Computer Network Technology */
-#if defined(_NETBSD_SOURCE)
-#define pseudo_AF_RTIP 22              /* Help Identify RTIP packets */
-#endif
-#define        AF_IPX          23              /* Novell Internet Protocol */
-#define        AF_INET6        24              /* IP version 6 */
-#if defined(_NETBSD_SOURCE)
-#define pseudo_AF_PIP  25              /* Help Identify PIP packets */
-#endif
-#define AF_ISDN                26              /* Integrated Services Digital Network*/
-#define AF_E164                AF_ISDN         /* CCITT E.164 recommendation */
-#define AF_NATM                27              /* native ATM access */
-#define AF_ARP         28              /* (rev.) addr. res. prot. (RFC 826) */
-#if defined(_NETBSD_SOURCE)
-#define pseudo_AF_KEY  29              /* Internal key management protocol  */
-#define        pseudo_AF_HDRCMPLT 30           /* Used by BPF to not rewrite hdrs
-                                          in interface output routine */
-#endif
-#define AF_BLUETOOTH   31              /* Bluetooth: HCI, SCO, L2CAP, RFCOMM */
-#define        AF_IEEE80211    32              /* IEEE80211 */
-
-#define        AF_MAX          33
-
-#ifndef        gid_t
-typedef        __gid_t         gid_t;          /* group id */
-#define        gid_t           __gid_t
-#endif
-
-#ifndef        uid_t
-typedef        __uid_t         uid_t;          /* user id */
-#define        uid_t           __uid_t
-#endif
-
-#include <sys/ucred.h>
-
-/*
- * Structure used by kernel to store most
- * addresses.
- */
-struct sockaddr
-{
-       sa_family_t     sa_family;
-       char            sa_data[8];     /* Big enough for sockaddr_in */
-};
-
-/*
- * RFC 2553: protocol-independent placeholder for socket addresses
- */
-#define _SS_MAXSIZE    128
-#define _SS_ALIGNSIZE  (sizeof(__int64_t))
-#define _SS_PAD1SIZE   (_SS_ALIGNSIZE - 1)
-#define _SS_PAD2SIZE   (_SS_MAXSIZE - 1 - \
-                               _SS_PAD1SIZE - _SS_ALIGNSIZE)
-
-#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-struct sockaddr_storage {
-       sa_family_t     ss_family;      /* address family */
-       char            __ss_pad1[_SS_PAD1SIZE];
-       __int64_t     __ss_align;/* force desired structure storage alignment */
-       char            __ss_pad2[_SS_PAD2SIZE];
-};
-#define        sstosa(__ss)    ((struct sockaddr *)(__ss))
-#define        sstocsa(__ss)   ((const struct sockaddr *)(__ss))
-#endif /* _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
-
-/*
- * Protocol families, same as address families for now.
- */
-#define        PF_UNSPEC       AF_UNSPEC
-#define        PF_LOCAL        AF_LOCAL
-#define        PF_UNIX         PF_LOCAL        /* backward compatibility */
-#define PF_FILE                PF_LOCAL        /* Minix compatibility */
-#define        PF_INET         AF_INET
-#define        PF_IMPLINK      AF_IMPLINK
-#define        PF_PUP          AF_PUP
-#define        PF_CHAOS        AF_CHAOS
-#define        PF_NS           AF_NS
-#define        PF_ISO          AF_ISO
-#define        PF_OSI          AF_ISO
-#define        PF_ECMA         AF_ECMA
-#define        PF_DATAKIT      AF_DATAKIT
-#define        PF_CCITT        AF_CCITT
-#define        PF_SNA          AF_SNA
-#define PF_DECnet      AF_DECnet
-#define PF_DLI         AF_DLI
-#define PF_LAT         AF_LAT
-#define        PF_HYLINK       AF_HYLINK
-#define        PF_APPLETALK    AF_APPLETALK
-#define        PF_ROUTE        AF_ROUTE
-#define        PF_LINK         AF_LINK
-#if defined(_NETBSD_SOURCE)
-#define        PF_XTP          pseudo_AF_XTP   /* really just proto family, no AF */
-#endif
-#define        PF_COIP         AF_COIP
-#define        PF_CNT          AF_CNT
-#define        PF_INET6        AF_INET6
-#define        PF_IPX          AF_IPX          /* same format as AF_NS */
-#if defined(_NETBSD_SOURCE)
-#define PF_RTIP                pseudo_AF_RTIP  /* same format as AF_INET */
-#define PF_PIP         pseudo_AF_PIP
-#endif
-#define PF_ISDN                AF_ISDN         /* same as E164 */
-#define PF_E164                AF_E164
-#define PF_NATM                AF_NATM
-#define PF_ARP         AF_ARP
-#if defined(_NETBSD_SOURCE)
-#define PF_KEY                 pseudo_AF_KEY   /* like PF_ROUTE, only for key mgmt */
-#endif
-#define PF_BLUETOOTH   AF_BLUETOOTH
-
-#define        PF_MAX          AF_MAX
-
-/*
- * Message header for recvmsg and sendmsg calls.
- * Used value-result for recvmsg, value only for sendmsg.
- */
-struct msghdr {
-       void            *msg_name;      /* optional address */
-       socklen_t       msg_namelen;    /* size of address */
-       struct iovec    *msg_iov;       /* scatter/gather array */
-       int             msg_iovlen;     /* # elements in msg_iov */
-       void            *msg_control;   /* ancillary data, see below */
-       socklen_t       msg_controllen; /* ancillary data buffer len */
-       int             msg_flags;      /* flags on received message */
-};
-
-/*
- * Header for ancillary data objects in msg_control buffer.
- * Used for additional information with/about a datagram
- * not expressible by flags.  The format is a sequence
- * of message elements headed by cmsghdr structures.
- */
-struct cmsghdr {
-       socklen_t       cmsg_len;       /* data byte count, including hdr */
-       int             cmsg_level;     /* originating protocol */
-       int             cmsg_type;      /* protocol-specific type */
-/* followed by u_char  cmsg_data[]; */
-};
-
-#define CMSG_FIRSTHDR(mhdr)                                    \
-       ( (mhdr)->msg_controllen >= sizeof(struct cmsghdr) ?    \
-               (struct cmsghdr *)(mhdr)->msg_control :         \
-               (struct cmsghdr *)NULL )
-
-#define CMSG_ALIGN(len)                                                \
-       ( (len % sizeof(long) == 0) ?                           \
-               len :                                           \
-               len + sizeof(long) - (len  % sizeof(long)) )
-
-#define CMSG_NXTHDR(mhdr, cmsg)                                        \
-       ( ((cmsg) == NULL) ? CMSG_FIRSTHDR(mhdr) :                      \
-               (((unsigned char *)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len) \
-               + CMSG_ALIGN(sizeof(struct cmsghdr)) >                  \
-               (unsigned char *)((mhdr)->msg_control) +                \
-               (mhdr)->msg_controllen) ?                               \
-               (struct cmsghdr *)NULL :                                \
-               (struct cmsghdr *)((unsigned char *)(cmsg) +            \
-               CMSG_ALIGN((cmsg)->cmsg_len))) )
-
-#define CMSG_DATA(cmsg) \
-       ( (unsigned char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr)) )
-
-#define CMSG_SPACE(l)  (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(l))
-#define CMSG_LEN(l)    (CMSG_ALIGN(sizeof(struct cmsghdr)) + (l))
-
-/* "Socket"-level control message types: */
-#define SCM_RIGHTS     0x01
-#define SCM_CREDENTIALS        0x02
-#define SCM_SECURITY   0x04
-
-
-/*
- * Types of socket shutdown(2).
- */
-#define        SHUT_RD         0               /* Disallow further receives. */
-#define        SHUT_WR         1               /* Disallow further sends. */
-#define        SHUT_RDWR       2               /* Disallow further sends/receives. */
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int    __cmsg_alignbytes(void);
-__END_DECLS
-
-__BEGIN_DECLS
-int    accept(int, struct sockaddr * __restrict, socklen_t * __restrict);
-int    bind(int, const struct sockaddr *, socklen_t);
-int    connect(int, const struct sockaddr *, socklen_t);
-int    getpeername(int, struct sockaddr * __restrict, socklen_t * __restrict);
-int    getsockname(int, struct sockaddr * __restrict, socklen_t * __restrict);
-int    getsockopt(int, int, int, void *__restrict, socklen_t * __restrict);
-int    listen(int, int);
-ssize_t        recv(int, void *, size_t, int);
-ssize_t        recvfrom(int, void *__restrict, size_t, int,
-           struct sockaddr * __restrict, socklen_t * __restrict);
-ssize_t        recvmsg(int, struct msghdr *, int);
-ssize_t        send(int, const void *, size_t, int);
-ssize_t        sendto(int, const void *,
-           size_t, int, const struct sockaddr *, socklen_t);
-ssize_t        sendmsg(int, const struct msghdr *, int);
-int    setsockopt(int, int, int, const void *, socklen_t);
-int    shutdown(int, int);
-int    sockatmark(int);
-int    socket(int, int, int);
-int    socketpair(int, int, int, int *);
-__END_DECLS
-
-#define MSG_OOB         0x0001  /* process out-of-band data */
-#define MSG_PEEK        0x0002  /* peek at incoming message */
-#define MSG_DONTROUTE   0x0004  /* send without using routing tables */
-#define MSG_EOR         0x0008         /* complete record */
-
-#endif /* !_SYS_SOCKET_H_ */
diff --git a/nbsd_include/sys/stat.h b/nbsd_include/sys/stat.h
deleted file mode 100644 (file)
index c10014e..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-#ifndef _SYS_STAT_H_
-#define        _SYS_STAT_H_
-
-#include <sys/featuretest.h>
-#include <sys/types.h>         /* XXX */
-
-#if defined(_NETBSD_SOURCE)
-#include <sys/time.h>
-#endif
-
-
-struct stat {
-  big_dev_t     st_dev;               /* inode's device */
-  big_mode_t    st_mode;              /* inode protection mode */
-  big_ino_t    st_ino;               /* inode's number */
-  big_nlink_t   st_nlink;             /* number of hard links */
-  big_uid_t     st_uid;               /* user ID of the file's owner */
-  big_gid_t     st_gid;               /* group ID of the file's group */
-  big_dev_t     st_rdev;              /* device type */
-#if defined(_NETBSD_SOURCE)
-  struct    timespec st_atimespec;/* time of last access */
-  struct    timespec st_mtimespec;/* time of last data modification */
-  struct    timespec st_ctimespec;/* time of last file status change */
-  struct    timespec st_birthtimespec; /* time of creation */
-#else
-  time_t    st_atime;             /* time of last access */
-  long      st_atimensec;         /* nsec of last access */
-  time_t    st_mtime;             /* time of last data modification */
-  long      st_mtimensec;         /* nsec of last data modification */
-  time_t    st_ctime;             /* time of last file status change */
-  long      st_ctimensec;         /* nsec of last file status change */
-  time_t    st_birthtime;         /* time of creation */
-  long      st_birthtimensec;     /* nsec of time of creation */
-#endif
-  big_off_t st_size;           /* file size, in bytes */
-  blkcnt_t  st_blocks;         /* blocks allocated for file */
-  blksize_t st_blksize;                /* optimal blocksize for I/O */
-  u32_t     st_flags;          /* user defined flags for file */
-  u32_t     st_gen;            /* file generation number */
-  u32_t     st_spare[2];
-};
-
-
-struct minix_prev_stat {
-  short st_dev;                        /* major/minor device number */
-  ino_t st_ino;                        /* i-node number */
-  mode_t st_mode;              /* file mode, protection bits, etc. */
-  nlink_t st_nlink;            /* # links; */
-  short st_uid;                        /* uid of the file's owner */
-  short int st_gid;            /* gid; TEMPORARY HACK: should be gid_t */
-  short st_rdev;
-  off_t st_size;               /* file size */
-  time_t st_atime;             /* time of last access */
-  time_t st_mtime;             /* time of last data modification */
-  time_t st_ctime;             /* time of last file status change */
-};
-
-
-#if defined(_NETBSD_SOURCE)
-/* XXX after updating stat struct we don't want to update all the code */
-#define st_atime               st_atimespec.tv_sec
-#define st_mtime               st_mtimespec.tv_sec
-#define st_ctime               st_ctimespec.tv_sec
-#define st_birthtime            st_birthtimespec.tv_sec
-#define st_atimensec            st_atimespec.tv_nsec
-#define st_mtimensec            st_mtimespec.tv_nsec
-#define st_ctimensec            st_ctimespec.tv_nsec
-#define st_birthtimensec        st_birthtimespec.tv_nsec
-#endif
-
-
-#define        S_ISUID 0004000                 /* set user id on execution */
-#define        S_ISGID 0002000                 /* set group id on execution */
-#if defined(_NETBSD_SOURCE)
-#define        S_ISTXT 0001000                 /* sticky bit */
-#endif
-
-#define        S_IRWXU 0000700                 /* RWX mask for owner */
-#define        S_IRUSR 0000400                 /* R for owner */
-#define        S_IWUSR 0000200                 /* W for owner */
-#define        S_IXUSR 0000100                 /* X for owner */
-
-#if defined(_NETBSD_SOURCE)
-#define        S_IREAD         S_IRUSR
-#define        S_IWRITE        S_IWUSR
-#define        S_IEXEC         S_IXUSR
-#endif
-
-#define        S_IRWXG 0000070                 /* RWX mask for group */
-#define        S_IRGRP 0000040                 /* R for group */
-#define        S_IWGRP 0000020                 /* W for group */
-#define        S_IXGRP 0000010                 /* X for group */
-
-#define        S_IRWXO 0000007                 /* RWX mask for other */
-#define        S_IROTH 0000004                 /* R for other */
-#define        S_IWOTH 0000002                 /* W for other */
-#define        S_IXOTH 0000001                 /* X for other */
-
-#define        _S_IFMT   0170000               /* type of file mask */
-#define        _S_IFIFO  0010000               /* named pipe (fifo) */
-#define        _S_IFCHR  0020000               /* character special */
-#define        _S_IFDIR  0040000               /* directory */
-#define        _S_IFBLK  0060000               /* block special */
-#define        _S_IFREG  0100000               /* regular */
-#define        _S_IFLNK  0120000               /* symbolic link */
-#define        _S_IFSOCK 0140000               /* socket */
-#define        _S_ISVTX  0001000               /* save swapped text even after use */
-
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-#define        S_IFMT   _S_IFMT
-#define        S_IFIFO  _S_IFIFO
-#define        S_IFCHR  _S_IFCHR
-#define        S_IFDIR  _S_IFDIR
-#define        S_IFBLK  _S_IFBLK
-#define        S_IFREG  _S_IFREG
-#define        S_IFLNK  _S_IFLNK
-#define        S_ISVTX  _S_ISVTX
-#endif
-#if ((_XOPEN_SOURCE - 0) >= 600) || defined(_NETBSD_SOURCE)
-#define        S_IFSOCK _S_IFSOCK
-#endif
-
-#define        S_ISDIR(m)      (((m) & _S_IFMT) == _S_IFDIR)   /* directory */
-#define        S_ISCHR(m)      (((m) & _S_IFMT) == _S_IFCHR)   /* char special */
-#define        S_ISBLK(m)      (((m) & _S_IFMT) == _S_IFBLK)   /* block special */
-#define        S_ISREG(m)      (((m) & _S_IFMT) == _S_IFREG)   /* regular file */
-#define        S_ISFIFO(m)     (((m) & _S_IFMT) == _S_IFIFO)   /* fifo */
-#if ((_POSIX_C_SOURCE - 0) >= 200112L) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-#define        S_ISLNK(m)      (((m) & _S_IFMT) == _S_IFLNK)   /* symbolic link */
-#endif
-#if ((_POSIX_C_SOURCE - 0) >= 200112L) || ((_XOPEN_SOURCE - 0) >= 600) || \
-    defined(_NETBSD_SOURCE)
-#define        S_ISSOCK(m)     (((m) & _S_IFMT) == _S_IFSOCK)  /* socket */
-#endif
-
-#if defined(_NETBSD_SOURCE)
-#define        ACCESSPERMS     (S_IRWXU|S_IRWXG|S_IRWXO)       /* 0777 */
-                                                       /* 7777 */
-#define        ALLPERMS        (S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO)
-                                                       /* 0666 */
-#define        DEFFILEMODE     (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
-
-#define S_BLKSIZE      512             /* block size used in the stat struct */
-
-/*
- * Definitions of flags stored in file flags word.
- *
- * Super-user and owner changeable flags.
- */
-#define        UF_SETTABLE     0x0000ffff      /* mask of owner changeable flags */
-#define        UF_NODUMP       0x00000001      /* do not dump file */
-#define        UF_IMMUTABLE    0x00000002      /* file may not be changed */
-#define        UF_APPEND       0x00000004      /* writes to file may only append */
-#define UF_OPAQUE      0x00000008      /* directory is opaque wrt. union */
-
-/*
- * Super-user changeable flags.
- */
-#define        SF_SETTABLE     0xffff0000      /* mask of superuser changeable flags */
-#define        SF_ARCHIVED     0x00010000      /* file is archived */
-#define        SF_IMMUTABLE    0x00020000      /* file may not be changed */
-#define        SF_APPEND       0x00040000      /* writes to file may only append */
-
-#endif /* _NETBSD_SOURCE */
-
-#if defined(__minix)
-#include <machine/vmparam.h>
-/* Convenient constant to use when st_blocksize field is required. */
-#define MINIX_ST_BLKSIZE PAGE_SIZE
-#endif
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int    chmod(const char *, mode_t);
-int    mkdir(const char *, mode_t);
-int    mkfifo(const char *, mode_t);
-#ifndef __LIBC12_SOURCE__
-int    stat(const char *, struct stat *) __RENAME(__stat50);
-int    fstat(int, struct stat *) __RENAME(__fstat50);
-#endif
-mode_t umask(mode_t);
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-int    fchmod(int, mode_t);
-#ifndef __LIBC12_SOURCE__
-int    lstat(const char *, struct stat *) __RENAME(__lstat50);
-int    mknod(const char *, mode_t, dev_t) __RENAME(__mknod50);
-#endif
-#endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */
-__END_DECLS
-
-#endif /* !_SYS_STAT_H_ */
diff --git a/nbsd_include/sys/statfs.h b/nbsd_include/sys/statfs.h
deleted file mode 100644 (file)
index 064f0eb..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Data for fstatfs() call. */
-
-#ifndef _STATFS_H
-#define _STATFS_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-struct statfs {
-  off_t f_bsize;               /* file system block size */
-};
-
-int fstatfs(int fd, struct statfs *st);
-
-#endif /* _STATFS_H */
diff --git a/nbsd_include/sys/statvfs.h b/nbsd_include/sys/statvfs.h
deleted file mode 100644 (file)
index b68d3dc..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef        _SYS_STATVFS_H_
-#define        _SYS_STATVFS_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <sys/stdint.h>
-#include <machine/ansi.h>
-#include <sys/ansi.h>
-
-#define        _VFS_NAMELEN    32
-#define        _VFS_MNAMELEN   1024
-
-#ifndef        fsblkcnt_t
-typedef        __fsblkcnt_t    fsblkcnt_t;     /* fs block count (statvfs) */
-#define        fsblkcnt_t      __fsblkcnt_t
-#endif
-
-#ifndef        fsfilcnt_t
-typedef        __fsfilcnt_t    fsfilcnt_t;     /* fs file count */
-#define        fsfilcnt_t      __fsfilcnt_t
-#endif
-
-#ifndef        uid_t
-typedef        __uid_t         uid_t;          /* user id */
-#define        uid_t           __uid_t
-#endif
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_            size_t;
-#define        _SIZE_T
-#undef _BSD_SIZE_T_
-#endif
-
-struct statvfs {
-       unsigned long f_bsize;  /* File system block size. */
-       unsigned long f_frsize; /* Fundamental file system block size. */
-       fsblkcnt_t    f_blocks; /* Total number of blocks on file system */
-                            /* in units of f_frsize. */
-       fsblkcnt_t    f_bfree;  /* Total number of free blocks. */
-       fsblkcnt_t    f_bavail; /* Number of free blocks available to */
-                               /* non-privileged process. */
-       fsfilcnt_t    f_files;  /* Total number of file serial numbers. */
-       fsfilcnt_t    f_ffree;  /* Total number of free file serial numbers. */
-       fsfilcnt_t    f_favail; /* Number of file serial numbers available */
-                                    /* to non-privileged process. */
-       unsigned long f_fsid;        /* File system ID. */
-       unsigned long f_flag;        /* Bit mask of f_flag values. */
-       unsigned long f_namemax;     /* Maximum filename length. */
-       unsigned char __padding[32]; /* Padding for future compatibility */
-};
-
-/* Possible values for statvfs->f_flag */
-#define ST_RDONLY 0x1
-#define ST_NOSUID 0x2
-#ifdef __minix
-#define ST_NOTRUNC 0x4
-#endif /* !__minix*/
-
-__BEGIN_DECLS
-int    statvfs(const char *__restrict, struct statvfs *__restrict);
-int    fstatvfs(int, struct statvfs *);
-__END_DECLS
-
-#endif /* _SYS_STATVFS_H_ */
diff --git a/nbsd_include/sys/time.h b/nbsd_include/sys/time.h
deleted file mode 100644 (file)
index d7b1e70..0000000
+++ /dev/null
@@ -1,266 +0,0 @@
-#ifndef _SYS_TIME_H_
-#define        _SYS_TIME_H_
-
-#include <sys/featuretest.h>
-#include <sys/types.h>
-
-/*
- * Structure returned by gettimeofday(2) system call,
- * and used in other calls.
- */
-struct timeval {
-       time_t          tv_sec;         /* seconds */
-       suseconds_t     tv_usec;        /* and microseconds */
-};
-
-/*
- * Structure defined by POSIX.1b to be like a timeval.
- */
-struct timespec {
-       time_t  tv_sec;         /* seconds */
-       long    tv_nsec;        /* and nanoseconds */
-};
-
-#if defined(_NETBSD_SOURCE)
-#define        TIMEVAL_TO_TIMESPEC(tv, ts) do {                                \
-       (ts)->tv_sec = (tv)->tv_sec;                                    \
-       (ts)->tv_nsec = (tv)->tv_usec * 1000;                           \
-} while (/*CONSTCOND*/0)
-#define        TIMESPEC_TO_TIMEVAL(tv, ts) do {                                \
-       (tv)->tv_sec = (ts)->tv_sec;                                    \
-       (tv)->tv_usec = (suseconds_t)(ts)->tv_nsec / 1000;              \
-} while (/*CONSTCOND*/0)
-
-/*
- * Note: timezone is obsolete. All timezone handling is now in
- * userland. Its just here for back compatibility.
- */
-struct timezone {
-       int     tz_minuteswest; /* minutes west of Greenwich */
-       int     tz_dsttime;     /* type of dst correction */
-};
-
-/* Operations on timevals. */
-#define        timerclear(tvp)         (tvp)->tv_sec = (tvp)->tv_usec = 0L
-#define        timerisset(tvp)         ((tvp)->tv_sec || (tvp)->tv_usec)
-#define        timercmp(tvp, uvp, cmp)                                         \
-       (((tvp)->tv_sec == (uvp)->tv_sec) ?                             \
-           ((tvp)->tv_usec cmp (uvp)->tv_usec) :                       \
-           ((tvp)->tv_sec cmp (uvp)->tv_sec))
-#define        timeradd(tvp, uvp, vvp)                                         \
-       do {                                                            \
-               (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec;          \
-               (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec;       \
-               if ((vvp)->tv_usec >= 1000000) {                        \
-                       (vvp)->tv_sec++;                                \
-                       (vvp)->tv_usec -= 1000000;                      \
-               }                                                       \
-       } while (/* CONSTCOND */ 0)
-#define        timersub(tvp, uvp, vvp)                                         \
-       do {                                                            \
-               (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec;          \
-               (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec;       \
-               if ((vvp)->tv_usec < 0) {                               \
-                       (vvp)->tv_sec--;                                \
-                       (vvp)->tv_usec += 1000000;                      \
-               }                                                       \
-       } while (/* CONSTCOND */ 0)
-
-
-/*
- * hide bintime for _STANDALONE because this header is used for hpcboot.exe,
- * which is built with compilers which don't recognize LL suffix.
- *     http://mail-index.NetBSD.org/tech-userlevel/2008/02/27/msg000181.html
- */
-#if !defined(_STANDALONE)
-struct bintime {
-       time_t  sec;
-       uint64_t frac;
-};
-
-static __inline void
-bintime_addx(struct bintime *bt, uint64_t x)
-{
-       uint64_t u;
-
-       u = bt->frac;
-       bt->frac += x;
-       if (u > bt->frac)
-               bt->sec++;
-}
-
-static __inline void
-bintime_add(struct bintime *bt, const struct bintime *bt2)
-{
-       uint64_t u;
-
-       u = bt->frac;
-       bt->frac += bt2->frac;
-       if (u > bt->frac)
-               bt->sec++;
-       bt->sec += bt2->sec;
-}
-
-static __inline void
-bintime_sub(struct bintime *bt, const struct bintime *bt2)
-{
-       uint64_t u;
-
-       u = bt->frac;
-       bt->frac -= bt2->frac;
-       if (u < bt->frac)
-               bt->sec--;
-       bt->sec -= bt2->sec;
-}
-
-/*-
- * Background information:
- *
- * When converting between timestamps on parallel timescales of differing
- * resolutions it is historical and scientific practice to round down rather
- * than doing 4/5 rounding.
- *
- *   The date changes at midnight, not at noon.
- *
- *   Even at 15:59:59.999999999 it's not four'o'clock.
- *
- *   time_second ticks after N.999999999 not after N.4999999999
- */
-
-static __inline void
-bintime2timespec(const struct bintime *bt, struct timespec *ts)
-{
-
-       ts->tv_sec = bt->sec;
-       ts->tv_nsec =
-           (long)(((uint64_t)1000000000 * (uint32_t)(bt->frac >> 32)) >> 32);
-}
-
-static __inline void
-timespec2bintime(const struct timespec *ts, struct bintime *bt)
-{
-
-       bt->sec = ts->tv_sec;
-       /* 18446744073 = int(2^64 / 1000000000) */
-       bt->frac = ts->tv_nsec * (uint64_t)18446744073LL; 
-}
-
-static __inline void
-bintime2timeval(const struct bintime *bt, struct timeval *tv)
-{
-
-       tv->tv_sec = bt->sec;
-       tv->tv_usec =
-           (suseconds_t)(((uint64_t)1000000 * (uint32_t)(bt->frac >> 32)) >> 32);
-}
-
-static __inline void
-timeval2bintime(const struct timeval *tv, struct bintime *bt)
-{
-
-       bt->sec = tv->tv_sec;
-       /* 18446744073709 = int(2^64 / 1000000) */
-       bt->frac = tv->tv_usec * (uint64_t)18446744073709LL;
-}
-#endif /* !defined(_STANDALONE) */
-
-/* Operations on timespecs. */
-#define        timespecclear(tsp)      (tsp)->tv_sec = (time_t)((tsp)->tv_nsec = 0L)
-#define        timespecisset(tsp)      ((tsp)->tv_sec || (tsp)->tv_nsec)
-#define        timespeccmp(tsp, usp, cmp)                                      \
-       (((tsp)->tv_sec == (usp)->tv_sec) ?                             \
-           ((tsp)->tv_nsec cmp (usp)->tv_nsec) :                       \
-           ((tsp)->tv_sec cmp (usp)->tv_sec))
-#define        timespecadd(tsp, usp, vsp)                                      \
-       do {                                                            \
-               (vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec;          \
-               (vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec;       \
-               if ((vsp)->tv_nsec >= 1000000000L) {                    \
-                       (vsp)->tv_sec++;                                \
-                       (vsp)->tv_nsec -= 1000000000L;                  \
-               }                                                       \
-       } while (/* CONSTCOND */ 0)
-#define        timespecsub(tsp, usp, vsp)                                      \
-       do {                                                            \
-               (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;          \
-               (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;       \
-               if ((vsp)->tv_nsec < 0) {                               \
-                       (vsp)->tv_sec--;                                \
-                       (vsp)->tv_nsec += 1000000000L;                  \
-               }                                                       \
-       } while (/* CONSTCOND */ 0)
-#define timespec2ns(x) (((uint64_t)(x)->tv_sec) * 1000000000L + (x)->tv_nsec)
-#endif /* _NETBSD_SOURCE */
-
-/*
- * Names of the interval timers, and structure
- * defining a timer setting.
- */
-#define        ITIMER_REAL     0
-#define        ITIMER_VIRTUAL  1
-#define        ITIMER_PROF     2
-
-struct itimerval {
-       struct  timeval it_interval;    /* timer interval */
-       struct  timeval it_value;       /* current value */
-};
-
-/*
- * Structure defined by POSIX.1b to be like a itimerval, but with
- * timespecs. Used in the timer_*() system calls.
- */
-struct itimerspec {
-       struct  timespec it_interval;
-       struct  timespec it_value;
-};
-
-#ifndef __minix
-#define        CLOCK_REALTIME  0
-#define        CLOCK_VIRTUAL   1
-#define        CLOCK_PROF      2
-#define        CLOCK_MONOTONIC 3
-#endif
-
-#if defined(_NETBSD_SOURCE)
-#define        TIMER_RELTIME   0x0     /* relative timer */
-#endif
-#define        TIMER_ABSTIME   0x1     /* absolute timer */
-
-#ifdef _KERNEL
-#include <sys/timevar.h>
-#else /* !_KERNEL */
-#ifndef _STANDALONE
-#if (_POSIX_C_SOURCE - 0) >= 200112L || \
-    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
-    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-#include <sys/select.h>
-#endif
-
-#include <sys/cdefs.h>
-#include <time.h>
-
-__BEGIN_DECLS
-#ifndef __LIBC12_SOURCE__
-#if (_POSIX_C_SOURCE - 0) >= 200112L || \
-    defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-int    getitimer(int, struct itimerval *) __RENAME(__getitimer50);
-int    gettimeofday(struct timeval * __restrict, void *__restrict);
-int    setitimer(int, const struct itimerval * __restrict,
-           struct itimerval * __restrict) __RENAME(__setitimer50);
-#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */
-
-#if defined(_NETBSD_SOURCE) || defined(HAVE_NBTOOL_CONFIG_H)
-#ifndef __minix
-int    adjtime(const struct timeval *, struct timeval *) __RENAME(__adjtime50);
-int    futimes(int, const struct timeval [2]) __RENAME(__futimes50);
-int    lutimes(const char *, const struct timeval [2]) __RENAME(__lutimes50);
-#endif /* !__minix */
-int    settimeofday(const struct timeval * __restrict,
-           const void *__restrict) __RENAME(__settimeofday50);
-#endif /* _NETBSD_SOURCE */
-#endif /* __LIBC12_SOURCE__ */
-__END_DECLS
-
-#endif /* !_STANDALONE */
-#endif /* !_KERNEL */
-#endif /* !_SYS_TIME_H_ */
diff --git a/nbsd_include/sys/times.h b/nbsd_include/sys/times.h
deleted file mode 100644 (file)
index c90a283..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifndef        _SYS_TIMES_H_
-#define        _SYS_TIMES_H_
-
-#include <machine/ansi.h>
-
-#ifdef _BSD_CLOCK_T_
-typedef        _BSD_CLOCK_T_   clock_t;
-#undef _BSD_CLOCK_T_
-#endif
-
-struct tms {
-       clock_t tms_utime;      /* User CPU time */
-       clock_t tms_stime;      /* System CPU time */
-       clock_t tms_cutime;     /* User CPU time of terminated child procs */
-       clock_t tms_cstime;     /* System CPU time of terminated child procs */
-};
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-clock_t times(struct tms *);
-__END_DECLS
-
-#endif /* !_SYS_TIMES_H_ */
diff --git a/nbsd_include/sys/types.h b/nbsd_include/sys/types.h
deleted file mode 100644 (file)
index 9dcf4fd..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-/*     $NetBSD: types.h,v 1.86 2009/03/07 21:59:25 ad Exp $    */
-
-/*-
- * Copyright (c) 1982, 1986, 1991, 1993, 1994
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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. 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.
- *
- *     @(#)types.h     8.4 (Berkeley) 1/21/94
- */
-
-#ifndef _SYS_TYPES_H_
-#define        _SYS_TYPES_H_
-
-#include <sys/featuretest.h>
-
-/* Machine type dependent parameters. */
-#include <machine/types.h>
-
-#include <machine/ansi.h>
-#include <machine/int_types.h>
-
-#include <sys/ansi.h>
-
-#ifndef        int8_t
-typedef        __int8_t        int8_t;
-#define        int8_t          __int8_t
-#endif
-
-#ifndef        uint8_t
-typedef        __uint8_t       uint8_t;
-#define        uint8_t         __uint8_t
-#endif
-
-#ifndef        int16_t
-typedef        __int16_t       int16_t;
-#define        int16_t         __int16_t
-#endif
-
-#ifndef        uint16_t
-typedef        __uint16_t      uint16_t;
-#define        uint16_t        __uint16_t
-#endif
-
-#ifndef        int32_t
-typedef        __int32_t       int32_t;
-#define        int32_t         __int32_t
-#endif
-
-#ifndef        uint32_t
-typedef        __uint32_t      uint32_t;
-#define        uint32_t        __uint32_t
-#endif
-
-#ifndef        int64_t
-typedef        __int64_t       int64_t;
-#define        int64_t         __int64_t
-#endif
-
-#ifndef        uint64_t
-typedef        __uint64_t      uint64_t;
-#define        uint64_t        __uint64_t
-#endif
-
-typedef        uint8_t         u_int8_t;
-typedef        uint16_t        u_int16_t;
-typedef        uint32_t        u_int32_t;
-typedef        uint64_t        u_int64_t;
-
-#ifdef __minix
-typedef uint8_t        u8_t;
-typedef uint16_t       u16_t;
-typedef uint32_t       u32_t;
-typedef uint64_t       u64_t;
-
-typedef int8_t         i8_t;
-typedef int16_t                i16_t;
-typedef int32_t                i32_t;
-typedef int64_t                i64_t;
-
-typedef uint64_t       big_ino_t;
-typedef int64_t                big_off_t;
-typedef u32_t          big_dev_t;
-typedef u32_t          big_gid_t;
-typedef u32_t          big_mode_t;
-typedef u32_t          big_nlink_t;
-typedef u32_t          big_uid_t;
-
-
-/* some Minix specific types that do not conflict with posix */
-typedef u32_t zone_t;      /* zone number */
-typedef u32_t block_t;     /* block number */
-typedef u32_t bit_t;       /* bit number in a bit map */
-typedef u16_t zone1_t;     /* zone number for V1 file systems */
-typedef u32_t bitchunk_t; /* collection of bits in a bitmap */
-
-/* ANSI C makes writing down the promotion of unsigned types very messy.  When
- * sizeof(short) == sizeof(int), there is no promotion, so the type stays
- * unsigned.  When the compiler is not ANSI, there is usually no loss of
- * unsignedness, and there are usually no prototypes so the promoted type
- * doesn't matter.  The use of types like Ino_t is an attempt to use ints
- * (which are not promoted) while providing information to the reader.
- */
-
-typedef unsigned long  Ino_t;
-
-#endif /* __minix */
-
-#include <machine/endian.h>
-
-#if defined(_NETBSD_SOURCE)
-typedef        unsigned char   u_char;
-typedef        unsigned short  u_short;
-typedef        unsigned int    u_int;
-typedef        unsigned long   u_long;
-
-typedef unsigned char  unchar;         /* Sys V compatibility */
-typedef        unsigned short  ushort;         /* Sys V compatibility */
-typedef        unsigned int    uint;           /* Sys V compatibility */
-typedef unsigned long  ulong;          /* Sys V compatibility */
-#endif
-
-typedef        uint64_t        u_quad_t;       /* quads */
-typedef        int64_t         quad_t;
-typedef        quad_t *        qaddr_t;
-
-/*
- * The types longlong_t and u_longlong_t exist for use with the
- * Sun-derived XDR routines involving these types, and their usage
- * in other contexts is discouraged.  Further note that these types
- * may not be equivalent to "long long" and "unsigned long long",
- * they are only guaranteed to be signed and unsigned 64-bit types
- * respectively.  Portable programs that need 64-bit types should use
- * the C99 types int64_t and uint64_t instead.
- */
-
-typedef        int64_t         longlong_t;     /* for XDR */
-typedef        uint64_t        u_longlong_t;   /* for XDR */
-
-typedef        int64_t         blkcnt_t;       /* fs block count */
-typedef        uint32_t        blksize_t;      /* fs optimal block size */
-
-#ifndef        fsblkcnt_t
-typedef        __fsblkcnt_t    fsblkcnt_t;     /* fs block count (statvfs) */
-#define fsblkcnt_t     __fsblkcnt_t
-#endif
-
-#ifndef        fsfilcnt_t
-typedef        __fsfilcnt_t    fsfilcnt_t;     /* fs file count */
-#define fsfilcnt_t     __fsfilcnt_t
-#endif
-
-#if !defined(_KERNEL) && !defined(_STANDALONE)
-/* We don't and shouldn't use caddr_t in the kernel anymore */
-#ifndef        caddr_t
-typedef        __caddr_t       caddr_t;        /* core address */
-#define        caddr_t         __caddr_t
-#endif
-#endif
-
-#ifdef __daddr_t
-typedef        __daddr_t       daddr_t;        /* disk address */
-#undef __daddr_t
-#else
-typedef        int64_t         daddr_t;        /* disk address */
-#endif
-
-
-typedef        uint32_t        dev_t;          /* device number */
-typedef        uint32_t        fixpt_t;        /* fixed point number */
-
-#ifndef        gid_t
-typedef        __gid_t         gid_t;          /* group id */
-#define        gid_t           __gid_t
-#endif
-
-typedef        int             idtype_t;       /* type of the id */
-typedef        uint32_t        id_t;           /* group id, process id or user id */
-typedef        unsigned long   ino_t;          /* inode number */
-typedef        long            key_t;          /* IPC key (for Sys V IPC) */
-
-#ifndef        mode_t
-typedef        __mode_t        mode_t;         /* permissions */
-#define        mode_t          __mode_t
-#endif
-
-typedef        short           nlink_t;        /* link count */
-
-#ifndef        off_t
-typedef        __off_t         off_t;          /* file offset */
-#define        off_t           __off_t
-#endif
-
-#ifndef        pid_t
-typedef        __pid_t         pid_t;          /* process id */
-#define        pid_t           __pid_t
-#endif
-
-typedef int32_t                lwpid_t;        /* LWP id */
-typedef unsigned long  rlim_t;         /* resource limit */
-typedef        int32_t         segsz_t;        /* segment size */
-typedef        int32_t         swblk_t;        /* swap offset */
-
-#ifndef        uid_t
-typedef        __uid_t         uid_t;          /* user id */
-#define        uid_t           __uid_t
-#endif
-
-
-typedef int            mqd_t;
-
-typedef        unsigned long   cpuid_t;
-
-typedef        int             psetid_t;
-
-#if defined(_KERNEL) || defined(_STANDALONE)
-/*
- * Boolean type definitions for the kernel environment.  User-space
- * boolean definitions are found in <stdbool.h>.
- */
-#define bool   _Bool
-#define true   1
-#define false  0
-
-/*
- * Deprecated Mach-style boolean_t type.  Should not be used by new code.
- */
-typedef int    boolean_t;
-#ifndef TRUE
-#define        TRUE    1
-#endif
-#ifndef FALSE
-#define        FALSE   0
-#endif
-
-#endif /* _KERNEL || _STANDALONE */
-
-#if defined(_KERNEL) || defined(_LIBC)
-/*
- * semctl(2)'s argument structure.  This is here for the benefit of
- * <sys/syscallargs.h>.  It is not in the user's namespace in SUSv2.
- * The SUSv2 semctl(2) takes variable arguments.
- */
-union __semun {
-       int             val;            /* value for SETVAL */
-       struct semid_ds *buf;           /* buffer for IPC_STAT & IPC_SET */
-       unsigned short  *array;         /* array for GETALL & SETALL */
-};
-#include <sys/stdint.h>
-#endif /* _KERNEL || _LIBC */
-
-/*
- * These belong in unistd.h, but are placed here too to ensure that
- * long arguments will be promoted to off_t if the program fails to
- * include that header or explicitly cast them to off_t.
- */
-#if defined(_NETBSD_SOURCE)
-#ifndef __OFF_T_SYSCALLS_DECLARED
-#define __OFF_T_SYSCALLS_DECLARED
-#ifndef _KERNEL
-#include <sys/cdefs.h>
-__BEGIN_DECLS
-off_t   lseek(int, off_t, int);
-int     ftruncate(int, off_t);
-int     truncate(const char *, off_t);
-__END_DECLS
-#endif /* !_KERNEL */
-#endif /* __OFF_T_SYSCALLS_DECLARED */
-#endif /* defined(_NETBSD_SOURCE) */
-
-#if defined(_NETBSD_SOURCE)
-typedef int32_t __devmajor_t, __devminor_t;
-#define devmajor_t __devmajor_t
-#define devminor_t __devminor_t
-#define NODEVMAJOR (-1)
-
-/* Major, minor numbers, dev_t's. */
-#define MAJOR              8    /* major device = (dev>>MAJOR) & 0377 */
-#define MINOR              0    /* minor device = (dev>>MINOR) & 0377 */
-#define minor(dev)      ((devminor_t)(((dev) >> MINOR) & 0xff))
-#define major(dev)      ((devmajor_t)(((dev) >> MAJOR) & 0xff))
-#define makedev(major, minor)   \
-                        ((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
-
-#endif
-
-#ifdef _BSD_CLOCK_T_
-typedef        _BSD_CLOCK_T_           clock_t;
-#undef _BSD_CLOCK_T_
-#endif
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_            size_t;
-#define _SIZE_T
-#undef _BSD_SIZE_T_
-#endif
-
-#ifdef _BSD_SSIZE_T_
-typedef        _BSD_SSIZE_T_           ssize_t;
-#undef _BSD_SSIZE_T_
-#endif
-
-#ifdef _BSD_TIME_T_
-typedef        _BSD_TIME_T_            time_t;
-#undef _BSD_TIME_T_
-#endif
-
-#ifdef _BSD_CLOCKID_T_
-typedef        _BSD_CLOCKID_T_         clockid_t;
-#undef _BSD_CLOCKID_T_
-#endif
-
-#ifndef __minix
-#ifdef _BSD_TIMER_T_
-typedef        _BSD_TIMER_T_           timer_t;
-#undef _BSD_TIMER_T_
-#endif
-#endif
-
-#ifdef _BSD_SUSECONDS_T_
-typedef        _BSD_SUSECONDS_T_       suseconds_t;
-#undef _BSD_SUSECONDS_T_
-#endif
-
-#ifdef _BSD_USECONDS_T_
-typedef        _BSD_USECONDS_T_        useconds_t;
-#undef _BSD_USECONDS_T_
-#endif
-
-#ifdef _NETBSD_SOURCE
-#include <sys/fd_set.h>
-#define        NBBY    __NBBY
-
-typedef struct kauth_cred *kauth_cred_t;
-
-typedef int pri_t;
-
-#endif
-
-#if defined(__STDC__) && (defined(_KERNEL) || defined(_KMEMUSER))
-/*
- * Forward structure declarations for function prototypes.  We include the
- * common structures that cross subsystem boundaries here; others are mostly
- * used in the same place that the structure is defined.
- */
-struct lwp;
-typedef struct lwp lwp_t;
-struct user;
-struct __ucontext;
-struct proc;
-typedef struct proc proc_t;
-struct pgrp;
-struct rusage;
-struct file;
-typedef struct file file_t;
-struct buf;
-typedef struct buf buf_t;
-struct tty;
-struct uio;
-#endif
-
-#ifdef _KERNEL
-#define SET(t, f)      ((t) |= (f))
-#define        ISSET(t, f)     ((t) & (f))
-#define        CLR(t, f)       ((t) &= ~(f))
-#endif
-
-#ifndef __minix
-#if !defined(_KERNEL) && !defined(_STANDALONE)
-#if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_NETBSD_SOURCE)
-#include <pthread_types.h>
-#endif
-#endif
-#endif /* !__minix */
-
-#endif /* !_SYS_TYPES_H_ */
diff --git a/nbsd_include/sys/ucontext.h b/nbsd_include/sys/ucontext.h
deleted file mode 100644 (file)
index dc2d293..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef _SYS_UCONTEXT_H_
-#define _SYS_UCONTEXT_H_
-
-#include <sys/sigtypes.h>
-#include <machine/mcontext.h>
-
-typedef struct __ucontext ucontext_t;
-
-struct __ucontext {
-  unsigned int uc_flags;  /* Properties of ucontext */
-  ucontext_t *uc_link;    /* Next context to resume when current is finished */
-  mcontext_t uc_mcontext; /* Machine state */
-  sigset_t uc_sigmask;    /* Signals blocked in this context */
-  stack_t uc_stack;       /* The stack used by this context */
-};
-
-#ifndef _UC_UCONTEXT_ALIGN
-#define _UC_UCONTEXT_ALIGN (~0)
-#endif
-
-#define UCF_SWAPPED    001 /* Context has been swapped in by swapcontext(3) */
-#define UCF_IGNFPU     002 /* Ignore FPU context by get or setcontext(3) */
-#define UCF_IGNSIGM    004 /* Ignore signal mask by get or setcontext(3) */
-
-#define NCARGS 6
-
-#ifdef __minix
-__BEGIN_DECLS
-void resumecontext(ucontext_t *ucp);
-
-/* These functions get and set ucontext structure through PM/kernel. They don't
- * manipulate the stack. */
-int getuctx(ucontext_t *ucp);
-int setuctx(const ucontext_t *ucp);
-__END_DECLS
-#endif /* __minix */
-
-#endif /* !_SYS_UCONTEXT_H_ */
diff --git a/nbsd_include/sys/ucred.h b/nbsd_include/sys/ucred.h
deleted file mode 100644 (file)
index 3dfe8c1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#ifndef __SYS_UCRED_H
-#define __SYS_UCRED_H
-
-struct ucred_old
-{
-       pid_t   pid;
-       short   uid;
-       char   gid;
-};
-
-struct ucred
-{
-       pid_t   pid;
-       uid_t   uid;
-       gid_t   gid;
-};
-
-/* Userland's view of credentials. This should not change */
-struct uucred {
-        unsigned short  cr_unused;              /* not used, compat */
-        uid_t           cr_uid;                 /* effective user id */
-        gid_t           cr_gid;                 /* effective group id */
-        short           cr_ngroups;             /* number of groups */
-        gid_t           cr_groups[NGROUPS_MAX];     /* groups */
-};
-
-#endif
diff --git a/nbsd_include/sys/uio.h b/nbsd_include/sys/uio.h
deleted file mode 100644 (file)
index f85a2d1..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef _SYS_UIO_H_
-#define        _SYS_UIO_H_
-
-#include <machine/ansi.h>
-#include <sys/featuretest.h>
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_    size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-#ifdef _BSD_SSIZE_T_
-typedef        _BSD_SSIZE_T_   ssize_t;
-#undef _BSD_SSIZE_T_
-#endif
-
-struct iovec {
-       void    *iov_base;      /* Base address. */
-       size_t   iov_len;       /* Length. */
-};
-
-#if defined(_NETBSD_SOURCE)
-/*
- * Limits
- */
-/* Deprecated: use IOV_MAX from <limits.h> instead. */
-#define UIO_MAXIOV     1024            /* max 1K of iov's */
-#endif /* _NETBSD_SOURCE */
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-ssize_t        readv(int, const struct iovec *, int);
-ssize_t        writev(int, const struct iovec *, int);
-__END_DECLS
-
-#endif /* !_SYS_UIO_H_ */
diff --git a/nbsd_include/sys/un.h b/nbsd_include/sys/un.h
deleted file mode 100644 (file)
index c3c4b71..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef _SYS_UN_H_
-#define _SYS_UN_H_
-
-#include <sys/ansi.h>
-#include <sys/featuretest.h>
-#include <sys/types.h>
-
-#ifndef sa_family_t
-typedef __sa_family_t  sa_family_t;
-#define sa_family_t    __sa_family_t
-#endif
-
-#define UNIX_PATH_MAX 127
-
-/*
- * Definitions for UNIX IPC domain.
- */
-struct sockaddr_un {
-       sa_family_t     sun_family;
-       char            sun_path[UNIX_PATH_MAX];
-};
-
-#include <string.h>
-
-/* Compute the actual length of a struct sockaddr_un pointed
- * to by 'unp'. sun_path must be NULL terminated. Length does
- * not include the NULL byte. This is not a POSIX standard
- * definition, but BSD and Linux have it, so it is here for 
- * compatibility.
- */
-#define SUN_LEN(unp) \
-((size_t)((sizeof(*(unp)) - sizeof((unp)->sun_path)) + strlen((unp)->sun_path)))
-
-#endif /* _SYS_UN_H_ */
diff --git a/nbsd_include/sys/utsname.h b/nbsd_include/sys/utsname.h
deleted file mode 100644 (file)
index 0338c27..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef        _SYS_UTSNAME_H_
-#define        _SYS_UTSNAME_H_
-
-#include <sys/featuretest.h>
-
-#define        _SYS_NMLN       256
-
-#if defined(_NETBSD_SOURCE)
-#define        SYS_NMLN        _SYS_NMLN
-#endif
-
-struct utsname {
-       char    sysname[_SYS_NMLN];     /* Name of this OS. */
-       char    nodename[_SYS_NMLN];    /* Name of this network node. */
-       char    release[_SYS_NMLN];     /* Release level. */
-       char    version[_SYS_NMLN];     /* Version level. */
-       char    machine[_SYS_NMLN];     /* Hardware type. */
-       char    arch[_SYS_NMLN];
-};
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int    uname(struct utsname *);
-#ifdef __minix
-int    sysuname(int _req, int _field, char *_value, size_t _len);
-#endif
-__END_DECLS
-
-#ifdef __minix
-/* req: Get or set a string. */
-#define _UTS_GET       0
-#define _UTS_SET       1
-
-/* field: What field to get or set.  These values can't be changed lightly. */
-#define _UTS_ARCH      0
-#define _UTS_KERNEL    1
-#define _UTS_MACHINE   2
-#define _UTS_HOSTNAME  3
-#define _UTS_NODENAME  4
-#define _UTS_RELEASE   5
-#define _UTS_VERSION   6
-#define _UTS_SYSNAME   7
-#define _UTS_BUS       8
-#define _UTS_MAX       9       /* Number of strings. */
-#endif /* __minix */
-
-#endif /* !_SYS_UTSNAME_H_ */
diff --git a/nbsd_include/sys/wait.h b/nbsd_include/sys/wait.h
deleted file mode 100644 (file)
index 1326102..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef _SYS_WAIT_H_
-#define _SYS_WAIT_H_
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <sys/featuretest.h>
-
-/* The <sys/wait.h> header contains macros related to wait(). The value
- * returned by wait() and waitpid() depends on whether the process 
- * terminated by an exit() call, was killed by a signal, or was stopped
- * due to job control, as follows:
- *
- *                              High byte   Low byte
- *                             +---------------------+
- *     exit(status)            |  status  |    0     |
- *                             +---------------------+
- *      killed by signal       |    0     |  signal  |
- *                             +---------------------+
- *     stopped (job control)   |  signal  |   0177   |
- *                             +---------------------+
- */
-
-/*
- * Macros to test the exit status returned by wait
- * and extract the relevant values.
- */
-
-#define _LOW(v)                ( (v) & 0377)
-#define _HIGH(v)       ( ((v) >> 8) & 0377)
-
-#define WIFEXITED(s)   (_LOW(s) == 0)                      /* normal exit */
-#define WEXITSTATUS(s) (_HIGH(s))                          /* exit status */
-#define WTERMSIG(s)    (_LOW(s) & 0177)                    /* sig value */
-#define WIFSIGNALED(s) ((((unsigned int)(s)-1) & 0xFFFFU) < 0xFFU) /* signaled */
-#define WIFSTOPPED(s)  (_LOW(s) == 0177)                   /* stopped */
-#define WSTOPSIG(s)    (_HIGH(s) & 0377)                   /* stop signal */
-
-/*
- * Option bits for the third argument of waitpid.  WNOHANG causes the
- * wait to not hang if there are no stopped or terminated processes, rather
- * returning an error indication in this case (pid==0).  WUNTRACED
- * indicates that the caller should receive status about untraced children
- * which stop due to signals.  If children are stopped and a wait without
- * this option is done, it is as though they were still running... nothing
- * about them is returned.
- */
-#define WNOHANG                0x00000001      /* don't hang in wait */
-#define WUNTRACED      0x00000002      /* tell about stopped,
-                                          untraced children */
-
-/* POSIX extensions and 4.2/4.3 compatibility: */
-
-/*
- * Tokens for special values of the "pid" parameter to waitpid.
- */
-#define        WAIT_ANY        (-1)    /* any process */
-#define        WAIT_MYPGRP     0       /* any process in my process group */
-
-__BEGIN_DECLS
-pid_t  wait(int *);
-pid_t  waitpid(pid_t, int *, int);
-__END_DECLS
-
-#endif /* !_SYS_WAIT_H_ */
diff --git a/nbsd_include/sysexits.h b/nbsd_include/sysexits.h
deleted file mode 100644 (file)
index 8dfc9f7..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-/*     $NetBSD: sysexits.h,v 1.7 2005/09/30 20:56:19 rpaulo Exp $      */
-
-/*
- * Copyright (c) 1987, 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. 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.
- *
- *     @(#)sysexits.h  8.1 (Berkeley) 6/2/93
- */
-
-#ifndef        _SYSEXITS_H_
-#define        _SYSEXITS_H_
-
-/*
- *  SYSEXITS.H -- Exit status codes for system programs.
- *
- *     This include file attempts to categorize possible error
- *     exit statuses for system programs, notably delivermail
- *     and the Berkeley network.
- *
- *     Error numbers begin at EX__BASE to reduce the possibility of
- *     clashing with other exit statuses that random programs may
- *     already return.  The meaning of the codes is approximately
- *     as follows:
- *
- *     EX_USAGE -- The command was used incorrectly, e.g., with
- *             the wrong number of arguments, a bad flag, a bad
- *             syntax in a parameter, or whatever.
- *     EX_DATAERR -- The input data was incorrect in some way.
- *             This should only be used for user's data & not
- *             system files.
- *     EX_NOINPUT -- An input file (not a system file) did not
- *             exist or was not readable.  This could also include
- *             errors like "No message" to a mailer (if it cared
- *             to catch it).
- *     EX_NOUSER -- The user specified did not exist.  This might
- *             be used for mail addresses or remote logins.
- *     EX_NOHOST -- The host specified did not exist.  This is used
- *             in mail addresses or network requests.
- *     EX_UNAVAILABLE -- A service is unavailable.  This can occur
- *             if a support program or file does not exist.  This
- *             can also be used as a catchall message when something
- *             you wanted to do doesn't work, but you don't know
- *             why.
- *     EX_SOFTWARE -- An internal software error has been detected.
- *             This should be limited to non-operating system related
- *             errors as possible.
- *     EX_OSERR -- An operating system error has been detected.
- *             This is intended to be used for such things as "cannot
- *             fork", "cannot create pipe", or the like.  It includes
- *             things like getuid returning a user that does not
- *             exist in the passwd file.
- *     EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
- *             etc.) does not exist, cannot be opened, or has some
- *             sort of error (e.g., syntax error).
- *     EX_CANTCREAT -- A (user specified) output file cannot be
- *             created.
- *     EX_IOERR -- An error occurred while doing I/O on some file.
- *     EX_TEMPFAIL -- temporary failure, indicating something that
- *             is not really an error.  In sendmail, this means
- *             that a mailer (e.g.) could not create a connection,
- *             and the request should be reattempted later.
- *     EX_PROTOCOL -- the remote system returned something that
- *             was "not possible" during a protocol exchange.
- *     EX_NOPERM -- You did not have sufficient permission to
- *             perform the operation.  This is not intended for
- *             file system problems, which should use NOINPUT or
- *             CANTCREAT, but rather for higher level permissions.
- *
- *     Please update the sysexits(3) man page after adding more entries.
- */
-
-#define EX_OK          0       /* successful termination */
-
-#define EX__BASE       64      /* base value for error messages */
-
-#define EX_USAGE       64      /* command line usage error */
-#define EX_DATAERR     65      /* data format error */
-#define EX_NOINPUT     66      /* cannot open input */
-#define EX_NOUSER      67      /* addressee unknown */
-#define EX_NOHOST      68      /* host name unknown */
-#define EX_UNAVAILABLE 69      /* service unavailable */
-#define EX_SOFTWARE    70      /* internal software error */
-#define EX_OSERR       71      /* system error (e.g., can't fork) */
-#define EX_OSFILE      72      /* critical OS file missing */
-#define EX_CANTCREAT   73      /* can't create (user) output file */
-#define EX_IOERR       74      /* input/output error */
-#define EX_TEMPFAIL    75      /* temp failure; user is invited to retry */
-#define EX_PROTOCOL    76      /* remote error in protocol */
-#define EX_NOPERM      77      /* permission denied */
-#define EX_CONFIG      78      /* configuration error */
-
-#define EX__MAX        78      /* maximum listed value */
-
-#endif /* !_SYSEXITS_H_ */
diff --git a/nbsd_include/tar.h b/nbsd_include/tar.h
deleted file mode 100644 (file)
index 8e77417..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*     $NetBSD: tar.h,v 1.4 2003/08/07 09:44:11 agc Exp $      */
-
-/*-
- * Copyright (c) 1994
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Chuck Karish of Mindcraft, Inc.
- *
- * 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. 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.
- *
- *     @(#)tar.h       8.2 (Berkeley) 1/4/94
- */
-
-#ifndef _TAR_H
-#define _TAR_H
-
-#define        TMAGIC          "ustar" /* ustar and a null */
-#define        TMAGLEN         6
-#define        TVERSION        "00"    /* 00 and no null */
-#define        TVERSLEN        2
-
-/* Values used in typeflag field */
-#define        REGTYPE         '0'     /* Regular file */
-#define        AREGTYPE        '\0'    /* Regular file */
-#define        LNKTYPE         '1'     /* Link */
-#define        SYMTYPE         '2'     /* Reserved */
-#define        CHRTYPE         '3'     /* Character special */
-#define        BLKTYPE         '4'     /* Block special */
-#define        DIRTYPE         '5'     /* Directory */
-#define        FIFOTYPE        '6'     /* FIFO special */
-#define        CONTTYPE        '7'     /* Reserved */
-
-/* Bits used in the mode field - values in octal */
-#define        TSUID           04000   /* Set UID on execution */
-#define        TSGID           02000   /* Set GID on execution */
-#define        TSVTX           01000   /* Reserved */
-                               /* File permissions */
-#define        TUREAD          00400   /* Read by owner */
-#define        TUWRITE         00200   /* Write by owner */
-#define        TUEXEC          00100   /* Execute/Search by owner */
-#define        TGREAD          00040   /* Read by group */
-#define        TGWRITE         00020   /* Write by group */
-#define        TGEXEC          00010   /* Execute/Search by group */
-#define        TOREAD          00004   /* Read by other */
-#define        TOWRITE         00002   /* Write by other */
-#define        TOEXEC          00001   /* Execute/Search by other */
-
-#endif
diff --git a/nbsd_include/time.h b/nbsd_include/time.h
deleted file mode 100644 (file)
index 7360bc6..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-/*     $NetBSD: time.h,v 1.40 2010/12/16 18:36:47 christos Exp $       */
-
-/*
- * Copyright (c) 1989, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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. 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.
- *
- *     @(#)time.h      8.3 (Berkeley) 1/21/94
- */
-
-#ifndef _TIME_H_
-#define        _TIME_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <machine/ansi.h>
-
-#include <sys/null.h>
-
-#ifdef _BSD_CLOCK_T_
-typedef        _BSD_CLOCK_T_   clock_t;
-#undef _BSD_CLOCK_T_
-#endif
-
-#ifdef _BSD_TIME_T_
-typedef        _BSD_TIME_T_    time_t;
-#undef _BSD_TIME_T_
-#endif
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_    size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-#ifdef _BSD_CLOCKID_T_
-typedef        _BSD_CLOCKID_T_ clockid_t;
-#undef _BSD_CLOCKID_T_
-#endif
-
-#ifndef __minix
-#ifdef _BSD_TIMER_T_
-typedef        _BSD_TIMER_T_   timer_t;
-#undef _BSD_TIMER_T_
-#endif
-#endif /* !__minix */
-
-#ifdef __minix
-#define CLOCKS_PER_SEC 60
-#else
-#define CLOCKS_PER_SEC 100
-#endif
-
-struct tm {
-       int     tm_sec;         /* seconds after the minute [0-61] */
-       int     tm_min;         /* minutes after the hour [0-59] */
-       int     tm_hour;        /* hours since midnight [0-23] */
-       int     tm_mday;        /* day of the month [1-31] */
-       int     tm_mon;         /* months since January [0-11] */
-       int     tm_year;        /* years since 1900 */
-       int     tm_wday;        /* days since Sunday [0-6] */
-       int     tm_yday;        /* days since January 1 [0-365] */
-       int     tm_isdst;       /* Daylight Savings Time flag */
-       long    tm_gmtoff;      /* offset from UTC in seconds */
-       __aconst char *tm_zone; /* timezone abbreviation */
-};
-
-__BEGIN_DECLS
-char *asctime(const struct tm *);
-clock_t clock(void);
-#ifndef __LIBC12_SOURCE__
-char *ctime(const time_t *) __RENAME(__ctime50);
-double difftime(time_t, time_t) __RENAME(__difftime50);
-struct tm *gmtime(const time_t *) __RENAME(__gmtime50);
-#ifndef __MINIX
-struct tm *localtime(const time_t *) __RENAME(__locatime50);
-#else
-struct tm *localtime(const time_t *) __RENAME(__localtime50);
-#endif
-time_t time(time_t *) __RENAME(__time50);
-time_t mktime(struct tm *) __RENAME(__mktime50);
-#endif
-size_t strftime(char * __restrict, size_t, const char * __restrict,
-    const struct tm * __restrict)
-    __attribute__((__format__(__strftime__, 3, 0)));
-
-#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-#ifndef __LIBC12_SOURCE__
-/*
- * CLK_TCK uses libc's internal __sysconf() to retrieve the machine's
- * HZ. The value of _SC_CLK_TCK is 39 -- we hard code it so we do not
- * need to include unistd.h
- */
-long __sysconf(int);
-#ifdef __minix
-#define CLK_TCK                (__sysconf(3))
-#else
-#define CLK_TCK                (__sysconf(39))
-#endif /* !__minix */
-#endif
-#endif
-
-extern __aconst char *tzname[2];
-#ifndef __LIBC12_SOURCE__
-void tzset(void) __RENAME(__tzset50);
-#endif
-
-/*
- * X/Open Portability Guide >= Issue 4
- */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-extern int daylight;
-#ifndef __LIBC12_SOURCE__
-extern long int timezone __RENAME(__timezone13);
-#endif
-char *strptime(const char * __restrict, const char * __restrict,
-    struct tm * __restrict);
-#endif
-
-#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
-    defined(_NETBSD_SOURCE)
-struct tm *getdate(const char *);
-extern int getdate_err;
-#endif
-
-#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_NETBSD_SOURCE)
-#include <sys/time.h>          /* XXX for struct timespec */
-struct sigevent;
-struct itimerspec;
-#ifndef __LIBC12_SOURCE__
-#ifndef __minix
-int clock_getres(clockid_t, struct timespec *)
-    __RENAME(__clock_getres50);
-int clock_gettime(clockid_t, struct timespec *)
-    __RENAME(__clock_gettime50);
-int clock_settime(clockid_t, const struct timespec *)
-    __RENAME(__clock_settime50);
-#endif /* !__minix */
-int nanosleep(const struct timespec *, struct timespec *)
-    __RENAME(__nanosleep50);
-#ifndef __minix
-int timer_gettime(timer_t, struct itimerspec *) __RENAME(__timer_gettime50);
-int timer_settime(timer_t, int, const struct itimerspec * __restrict, 
-    struct itimerspec * __restrict) __RENAME(__timer_settime50);
-#endif /* !__minix */ 
-#endif
-#ifndef __minix
-int timer_create(clockid_t, struct sigevent * __restrict,
-    timer_t * __restrict);
-int timer_delete(timer_t);
-int timer_getoverrun(timer_t);
-#endif /* __minix */
-#endif /* _POSIX_C_SOURCE >= 199309 || _XOPEN_SOURCE >= 500 || ... */
-
-#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
-char *asctime_r(const struct tm * __restrict, char * __restrict);
-#ifndef __LIBC12_SOURCE__
-char *ctime_r(const time_t *, char *) __RENAME(__ctime_r50);
-struct tm *gmtime_r(const time_t * __restrict, struct tm * __restrict)
-    __RENAME(__gmtime_r50);
-struct tm *localtime_r(const time_t * __restrict, struct tm * __restrict)
-    __RENAME(__localtime_r50);
-#endif
-#endif
-
-#if defined(_NETBSD_SOURCE)
-
-typedef struct __state *timezone_t;
-
-#ifndef __LIBC12_SOURCE__
-time_t time2posix(time_t) __RENAME(__time2posix50);
-time_t posix2time(time_t) __RENAME(__posix2time50);
-time_t timegm(struct tm *) __RENAME(__timegm50);
-time_t timeoff(struct tm *, long) __RENAME(__timeoff50);
-time_t timelocal(struct tm *) __RENAME(__timelocal50);
-struct tm *offtime(const time_t *, long) __RENAME(__offtime50);
-void tzsetwall(void) __RENAME(__tzsetwall50);
-
-struct tm *offtime_r(const time_t *, long, struct tm *) __RENAME(__offtime_r50);
-struct tm *localtime_rz(const timezone_t, const time_t * __restrict,
-    struct tm * __restrict) __RENAME(__localtime_rz50);
-char *ctime_rz(const timezone_t, const time_t *, char *) __RENAME(__ctime_rz50);
-time_t mktime_z(const timezone_t, struct tm *) __RENAME(__mktime_z50);
-time_t timelocal_z(const timezone_t, struct tm *) __RENAME(__timelocal_z50);
-time_t time2posix_z(const timezone_t, time_t) __RENAME(__time2posix_z50);
-time_t posix2time_z(const timezone_t, time_t) __RENAME(__posix2time_z50);
-timezone_t tzalloc(const char *) __RENAME(__tzalloc50);
-void tzfree(const timezone_t) __RENAME(__tzfree50);
-const char *tzgetname(const timezone_t, int) __RENAME(__tzgetname50);
-#endif
-
-size_t strftime_z(const timezone_t, char * __restrict, size_t,
-    const char * __restrict, const struct tm * __restrict)
-    __attribute__((__format__(__strftime__, 4, 0)));
-
-#endif /* _NETBSD_SOURCE */
-
-#ifdef _MINIX
-int stime(time_t *_top);
-#endif /* _MINIX */
-
-__END_DECLS
-
-#endif /* !_TIME_H_ */
diff --git a/nbsd_include/ttyent.h b/nbsd_include/ttyent.h
deleted file mode 100644 (file)
index da30f13..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*     $NetBSD: ttyent.h,v 1.14 2006/04/17 23:29:21 salo Exp $ */
-
-/*
- * Copyright (c) 1989, 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. 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.
- *
- *     @(#)ttyent.h    8.1 (Berkeley) 6/2/93
- */
-
-#ifndef        _TTYENT_H_
-#define        _TTYENT_H_
-
-#include <sys/cdefs.h>
-
-#define        _PATH_TTYS      "/etc/ttys"
-
-#define        _TTYS_OFF       "off"
-#define        _TTYS_ON        "on"
-#define        _TTYS_SECURE    "secure"
-#define        _TTYS_WINDOW    "window"
-#define        _TTYS_CLASS     "class"
-#define        _TTYS_LOCAL     "local"
-#define        _TTYS_RTSCTS    "rtscts"
-#define        _TTYS_DTRCTS    "dtrcts"
-#define        _TTYS_SOFTCAR   "softcar"
-#define        _TTYS_MDMBUF    "mdmbuf"
-
-struct ttyent {
-       __aconst char *ty_name; /* terminal device name */
-       __aconst char *ty_getty;/* command to execute, usually getty */
-       __aconst char *ty_type; /* terminal type for termcap */
-#define        TTY_ON          0x01    /* enable logins (start ty_getty program) */
-#define        TTY_SECURE      0x02    /* allow uid of 0 to login */
-#define        TTY_LOCAL       0x04    /* set 'CLOCAL' on open (dev. specific) */
-#define        TTY_RTSCTS      0x08    /* set 'CRTSCTS' on open (dev. specific) */
-#define        TTY_SOFTCAR     0x10    /* ignore hardware carrier (dev. spec.) */
-#define        TTY_MDMBUF      0x20    /* set 'MDMBUF' on open (dev. specific) */
-#define TTY_DTRCTS      0x40    /* set 'CDTRCTS' on open (dev. specific) */
-       int     ty_status;      /* status flags */
-       __aconst char *ty_window;/* command to start up window manager */
-       __aconst char *ty_comment;/* comment field */
-       __aconst char *ty_class;/* category of tty usage */
-};
-
-__BEGIN_DECLS
-struct ttyent *getttyent(void);
-struct ttyent *getttynam(const char *);
-#if defined(_NETBSD_SOURCE)
-int setttyentpath(const char *);
-#endif /* defined(_NETBSD_SOURCE) */
-int setttyent(void);
-int endttyent(void);
-__END_DECLS
-
-#endif /* !_TTYENT_H_ */
diff --git a/nbsd_include/tzfile.h b/nbsd_include/tzfile.h
deleted file mode 100644 (file)
index 0029eae..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-/*     $NetBSD: tzfile.h,v 1.7 2003/08/07 09:44:11 agc Exp $   */
-
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Arthur David Olson of the National Cancer Institute.
- *
- * 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. 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.
- *
- *     @(#)tzfile.h    8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _TZFILE_H_
-#define        _TZFILE_H_
-
-/*
- * Information about time zone files.
- */
-                       /* Time zone object file directory */
-#define TZDIR          "/usr/share/zoneinfo"
-#define TZDEFAULT      "/etc/localtime"
-#define TZDEFRULES     "posixrules"
-
-/*
-** Each file begins with. . .
-*/
-
-#define TZ_MAGIC       "TZif"
-
-struct tzhead {
-       char    tzh_magic[4];           /* TZ_MAGIC */
-       char    tzh_reserved[16];       /* reserved for future use */
-       char    tzh_ttisgmtcnt[4];      /* coded number of trans. time flags */
-       char    tzh_ttisstdcnt[4];      /* coded number of trans. time flags */
-       char    tzh_leapcnt[4];         /* coded number of leap seconds */
-       char    tzh_timecnt[4];         /* coded number of transition times */
-       char    tzh_typecnt[4];         /* coded number of local time types */
-       char    tzh_charcnt[4];         /* coded number of abbr. chars */
-};
-
-/*
-** . . .followed by. . .
-**
-**     tzh_timecnt (char [4])s         coded transition times a la time(2)
-**     tzh_timecnt (unsigned char)s    types of local time starting at above
-**     tzh_typecnt repetitions of
-**             one (char [4])          coded UTC offset in seconds
-**             one (unsigned char)     used to set tm_isdst
-**             one (unsigned char)     that's an abbreviation list index
-**     tzh_charcnt (char)s             '\0'-terminated zone abbreviations
-**     tzh_leapcnt repetitions of
-**             one (char [4])          coded leap second transition times
-**             one (char [4])          total correction after above
-**     tzh_ttisstdcnt (char)s          indexed by type; if TRUE, transition
-**                                     time is standard time, if FALSE,
-**                                     transition time is wall clock time
-**                                     if absent, transition times are
-**                                     assumed to be wall clock time
-**     tzh_ttisgmtcnt (char)s          indexed by type; if TRUE, transition
-**                                     time is UTC, if FALSE,
-**                                     transition time is wall clock time
-**                                     if absent, transition times are
-**                                     assumed to be local time
-*/
-
-/*
-** In the current implementation, "tzset()" refuses to deal with files that
-** exceed any of the limits below.
-*/
-
-/*
-** The TZ_MAX_TIMES value below is enough to handle a bit more than a
-** year's worth of solar time (corrected daily to the nearest second) or
-** 138 years of Pacific Presidential Election time
-** (where there are three time zone transitions every fourth year).
-*/
-#define TZ_MAX_TIMES   370
-
-#define NOSOLAR                        /* 4BSD doesn't currently handle solar time */
-
-#ifndef NOSOLAR
-#define TZ_MAX_TYPES   256     /* Limited by what (unsigned char)'s can hold */
-#else
-#define TZ_MAX_TYPES   10      /* Maximum number of local time types */
-#endif
-
-#define TZ_MAX_CHARS   50      /* Maximum number of abbreviation characters */
-
-#define        TZ_MAX_LEAPS    50      /* Maximum number of leap second corrections */
-
-#define SECSPERMIN     60
-#define MINSPERHOUR    60
-#define HOURSPERDAY    24
-#define DAYSPERWEEK    7
-#define DAYSPERNYEAR   365
-#define DAYSPERLYEAR   366
-#define SECSPERHOUR    (SECSPERMIN * MINSPERHOUR)
-#define SECSPERDAY     ((long) SECSPERHOUR * HOURSPERDAY)
-#define MONSPERYEAR    12
-
-#define TM_SUNDAY      0
-#define TM_MONDAY      1
-#define TM_TUESDAY     2
-#define TM_WEDNESDAY   3
-#define TM_THURSDAY    4
-#define TM_FRIDAY      5
-#define TM_SATURDAY    6
-
-#define TM_JANUARY     0
-#define TM_FEBRUARY    1
-#define TM_MARCH       2
-#define TM_APRIL       3
-#define TM_MAY         4
-#define TM_JUNE                5
-#define TM_JULY                6
-#define TM_AUGUST      7
-#define TM_SEPTEMBER   8
-#define TM_OCTOBER     9
-#define TM_NOVEMBER    10
-#define TM_DECEMBER    11
-
-#define TM_YEAR_BASE   1900
-
-#define EPOCH_YEAR     1970
-#define EPOCH_WDAY     TM_THURSDAY
-
-/*
-** Accurate only for the past couple of centuries;
-** that will probably do.
-*/
-
-#define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0)
-
-#endif /* !_TZFILE_H_ */
diff --git a/nbsd_include/ucontext.h b/nbsd_include/ucontext.h
deleted file mode 100644 (file)
index 8dad20d..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*     $NetBSD: ucontext.h,v 1.6 2009/03/19 08:04:38 uebayasi Exp $    */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _UCONTEXT_H_
-#define _UCONTEXT_H_
-
-#include <sys/cdefs.h>
-#include <sys/ucontext.h>
-
-__BEGIN_DECLS
-int    getcontext(ucontext_t *);
-int    setcontext(const ucontext_t *);
-void   makecontext(ucontext_t *, void (*)(), int, ...);
-int    swapcontext(ucontext_t * __restrict, const ucontext_t * __restrict);
-__END_DECLS
-
-#endif /* !_UCONTEXT_H_ */
diff --git a/nbsd_include/unistd.h b/nbsd_include/unistd.h
deleted file mode 100644 (file)
index 505f9ac..0000000
+++ /dev/null
@@ -1,414 +0,0 @@
-/*     $NetBSD: unistd.h,v 1.125 2011/01/19 19:21:29 christos Exp $    */
-
-/*-
- * Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-/*
- * Copyright (c) 1991, 1993, 1994
- *     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. 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.
- *
- *     @(#)unistd.h    8.12 (Berkeley) 4/27/95
- */
-
-#ifndef _UNISTD_H_
-#define        _UNISTD_H_
-
-#include <machine/ansi.h>
-#include <machine/int_types.h>
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <sys/types.h>
-#include <sys/unistd.h>
-
-#if _FORTIFY_SOURCE > 0
-#include <ssp/unistd.h>
-#endif
-
-/*
- * IEEE Std 1003.1-90
- */
-#define        STDIN_FILENO    0       /* standard input file descriptor */
-#define        STDOUT_FILENO   1       /* standard output file descriptor */
-#define        STDERR_FILENO   2       /* standard error file descriptor */
-
-#include <sys/null.h>
-
-__BEGIN_DECLS
-__dead  void _exit(int);
-int     access(const char *, int);
-unsigned int alarm(unsigned int);
-int     chdir(const char *);
-#if !defined(__minix) && (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))
-int    chown(const char *, uid_t, gid_t) __RENAME(__posix_chown);
-#else
-int    chown(const char *, uid_t, gid_t);
-#endif /* defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) */
-int     close(int);
-size_t  confstr(int, char *, size_t);
-#ifndef __CUSERID_DECLARED
-#define __CUSERID_DECLARED
-/* also declared in stdio.h */
-char   *cuserid(char *);       /* obsolete */
-#endif /* __CUSERID_DECLARED */
-int     dup(int);
-int     dup2(int, int);
-int     execl(const char *, const char *, ...);
-int     execle(const char *, const char *, ...);
-int     execlp(const char *, const char *, ...);
-int     execv(const char *, char * const *);
-int     execve(const char *, char * const *, char * const *);
-int     execvp(const char *, char * const *);
-pid_t   fork(void);
-long    fpathconf(int, int);
-#if __SSP_FORTIFY_LEVEL == 0
-char   *getcwd(char *, size_t);
-#endif
-gid_t   getegid(void);
-uid_t   geteuid(void);
-gid_t   getgid(void);
-int     getgroups(int, gid_t []);
-__aconst char *getlogin(void);
-int     getlogin_r(char *, size_t);
-pid_t   getpgrp(void);
-pid_t   getpid(void);
-pid_t   getppid(void);
-uid_t   getuid(void);
-int     isatty(int);
-int     link(const char *, const char *);
-long    pathconf(const char *, int);
-int     pause(void);
-int     pipe(int *);
-#if __SSP_FORTIFY_LEVEL == 0
-ssize_t         read(int, void *, size_t);
-#endif
-int     rmdir(const char *);
-int     setgid(gid_t);
-#ifndef __minix
-int     setpgid(pid_t, pid_t);
-#endif /* !__minix */
-pid_t   setsid(void);
-int     setuid(uid_t);
-unsigned int    sleep(unsigned int);
-long    sysconf(int);
-pid_t   tcgetpgrp(int);
-int     tcsetpgrp(int, pid_t);
-__aconst char *ttyname(int);
-int     unlink(const char *);
-ssize_t         write(int, const void *, size_t);
-
-
-/*
- * IEEE Std 1003.2-92, adopted in X/Open Portability Guide Issue 4 and later
- */
-#if (_POSIX_C_SOURCE - 0) >= 2 || defined(_XOPEN_SOURCE) || \
-    defined(_NETBSD_SOURCE)
-int     getopt(int, char * const [], const char *);
-
-extern  char *optarg;                  /* getopt(3) external variables */
-extern  int opterr;
-extern  int optind;
-extern  int optopt;
-#endif
-
-/*
- * The Open Group Base Specifications, Issue 6; IEEE Std 1003.1-2001 (POSIX)
- */
-#if (_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600 || \
-    defined(_NETBSD_SOURCE)
-int     setegid(gid_t);
-int     seteuid(uid_t);
-#endif
-
-/*
- * The following three syscalls are also defined in <sys/types.h>
- * We protect them against double declarations.
- */
-#ifndef __OFF_T_SYSCALLS_DECLARED
-#define __OFF_T_SYSCALLS_DECLARED
-off_t   lseek(int, off_t, int);
-int     truncate(const char *, off_t);
-/*
- * IEEE Std 1003.1b-93,
- * also found in X/Open Portability Guide >= Issue 4 Verion 2
- */
-#if (_POSIX_C_SOURCE - 0) >= 199309L || \
-    (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
-    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-int     ftruncate(int, off_t);
-#endif
-#endif /* __OFF_T_SYSCALLS_DECLARED */
-
-
-/*
- * IEEE Std 1003.1b-93, adopted in X/Open CAE Specification Issue 5 Version 2
- */
-#if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_NETBSD_SOURCE)
-#ifndef __minix 
-int     fdatasync(int);
-#endif /* !__minix */
-int     fsync(int);
-#endif
-
-
-/*
- * IEEE Std 1003.1c-95, also adopted by X/Open CAE Spec Issue 5 Version 2
- */
-#if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \
-    defined(_REENTRANT) || defined(_NETBSD_SOURCE)
-int     ttyname_r(int, char *, size_t);
-int     pthread_atfork(void (*)(void), void (*)(void), void (*)(void));
-#endif
-
-/*
- * X/Open Portability Guide, all issues
- */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-int     chroot(const char *);
-int     nice(int);
-#endif
-
-
-/*
- * X/Open Portability Guide >= Issue 4
- */
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-__aconst char *crypt(const char *, const char *);
-int     encrypt(char *, int);
-char   *getpass(const char *);
-pid_t   getsid(pid_t);
-#endif
-
-
-/*
- * X/Open Portability Guide >= Issue 4 Version 2
- */
-#if (defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED)) || \
-    (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-#ifndef        intptr_t
-typedef        __intptr_t      intptr_t;
-#define        intptr_t        __intptr_t
-#endif
-
-#define F_ULOCK                0
-#define F_LOCK         1
-#define F_TLOCK                2
-#define F_TEST         3
-
-int     brk(void *);
-int     fchdir(int);
-#if !defined(__minix) && defined(_XOPEN_SOURCE)
-int     fchown(int, uid_t, gid_t) __RENAME(__posix_fchown);
-#else
-int     fchown(int, uid_t, gid_t);
-#endif
-int     getdtablesize(void);
-long    gethostid(void);
-int     gethostname(char *, size_t);
-__pure int
-        getpagesize(void);             /* legacy */
-#ifndef __minix
-pid_t   getpgid(pid_t);
-#endif /* !__minix */
-#ifndef __minix
-#if defined(_XOPEN_SOURCE)
-int     lchown(const char *, uid_t, gid_t) __RENAME(__posix_lchown);
-#else
-int     lchown(const char *, uid_t, gid_t);
-#endif
-#endif /* !__minix */
-int     lockf(int, int, off_t);
-#if __SSP_FORTIFY_LEVEL == 0
-ssize_t         readlink(const char * __restrict, char * __restrict, size_t);
-#endif
-void   *sbrk(intptr_t);
-#ifndef __minix
-/* XXX prototype wrong! */
-int     setpgrp(pid_t, pid_t);                 /* obsoleted by setpgid() */
-int     setregid(gid_t, gid_t);
-int     setreuid(uid_t, uid_t);
-#endif /* !__minix */
-void    swab(const void * __restrict, void * __restrict, ssize_t);
-int     symlink(const char *, const char *);
-void    sync(void);
-useconds_t ualarm(useconds_t, useconds_t);
-int     usleep(useconds_t);
-#ifndef __LIBC12_SOURCE__
-pid_t   vfork(void) __RENAME(__vfork14);
-#endif
-
-#ifndef __AUDIT__
-char   *getwd(char *);                         /* obsoleted by getcwd() */
-#endif
-#endif /* _XOPEN_SOURCE_EXTENDED || _XOPEN_SOURCE >= 500 || _NETBSD_SOURCE */
-
-
-/*
- * X/Open CAE Specification Issue 5 Version 2
- */
-#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
-ssize_t         pread(int, void *, size_t, off_t);
-ssize_t         pwrite(int, const void *, size_t, off_t);
-#endif
-
-
-/*
- * Implementation-defined extensions
- */
-#ifdef __minix
-int lseek64(int fd, u64_t _offset, int _whence, u64_t *_newpos);
-#if defined(_MINIX)
-#include <minix/type.h>
-
-int getprocnr(void);
-int getnprocnr(pid_t pid);
-int getpprocnr(void);
-int _pm_findproc(char *proc_name, int *proc_nr);
-int mapdriver(char *label, int major, int style, int flags);
-pid_t getnpid(endpoint_t proc_ep);
-uid_t getnuid(endpoint_t proc_ep);
-gid_t getngid(endpoint_t proc_ep);
-int getnucred(endpoint_t proc_ep, struct ucred *ucred);
-ssize_t pread64(int fd, void *buf, size_t count, u64_t where);
-ssize_t pwrite64(int fd, const void *buf, size_t count, u64_t where);
-#endif /* __MINIX */
-#endif /* __minix */
-
-#if defined(_NETBSD_SOURCE)
-#ifndef __minix
-int     acct(const char *);
-#endif /* !__minix */
-int     closefrom(int);
-int     des_cipher(const char *, char *, long, int);
-int     des_setkey(const char *);
-void    endusershell(void);
-int     exect(const char *, char * const *, char * const *);
-int     fchroot(int);
-int     fsync_range(int, int, off_t, off_t);
-int     getdomainname(char *, size_t);
-int     getgrouplist(const char *, gid_t, gid_t *, int *);
-int     getgroupmembership(const char *, gid_t, gid_t *, int, int *);
-mode_t  getmode(const void *, mode_t);
-int     getpeereid(int, uid_t *, gid_t *);
-int     getsubopt(char **, char * const *, char **);
-__aconst char *getusershell(void);
-int     initgroups(const char *, gid_t);
-int     iruserok(uint32_t, int, const char *, const char *);
-int      issetugid(void);
-int     nfssvc(int, void *);
-#ifndef __minix
-int     profil(char *, size_t, u_long, u_int);
-#endif /* !__minix */
-#ifndef __PSIGNAL_DECLARED
-#define __PSIGNAL_DECLARED
-/* also in signal.h */
-void   psignal(int, const char *);
-#endif /* __PSIGNAL_DECLARED */
-int     rcmd(char **, int, const char *, const char *, const char *, int *);
-#ifdef __minix
-int     reboot(int, ...);
-#else
-int     reboot(int, char *);
-#endif
-#ifndef __minix
-int     revoke(const char *);
-#endif
-int     rresvport(int *);
-int     ruserok(const char *, int, const char *, const char *);
-int     setdomainname(const char *, size_t);
-int     setgroups(int, const gid_t *);
-int     sethostid(long);
-int     sethostname(const char *, size_t);
-int     setlogin(const char *);
-void   *setmode(const char *);
-int     setrgid(gid_t);
-int     setruid(uid_t);
-void    setusershell(void);
-void    strmode(mode_t, char *);
-#ifndef __STRSIGNAL_DECLARED
-#define __STRSIGNAL_DECLARED
-/* backwards-compatibility; also in string.h */
-__aconst char *strsignal(int);
-#endif /* __STRSIGNAL_DECLARED */
-#ifndef __minix
-int     swapctl(int, void *, int);
-int     swapon(const char *);                  /* obsoleted by swapctl() */
-#endif /* !__minix */
-int     syscall(int, ...);
-quad_t  __syscall(quad_t, ...);
-int     undelete(const char *);
-
-#if 1 /*INET6*/
-int     rcmd_af(char **, int, const char *,
-           const char *, const char *, int *, int);
-int     rresvport_af(int *, int);
-int     iruserok_sa(const void *, int, int, const char *, const char *);
-#endif
-
-#ifndef __SYS_SIGLIST_DECLARED
-#define __SYS_SIGLIST_DECLARED
-/* also in signal.h */
-extern const char *const *sys_siglist __RENAME(__sys_siglist14);
-#endif /* __SYS_SIGLIST_DECLARED */
-extern  int optreset;          /* getopt(3) external variable */
-extern  char *suboptarg;       /* getsubopt(3) external variable */
-#endif
-
-__END_DECLS
-
-#ifdef __minix
-/* Minix expects RBT_* flags to be included with <unistd.h> */
-#include <sys/reboot.h>
-#endif
-
-#endif /* !_UNISTD_H_ */
diff --git a/nbsd_include/util.h b/nbsd_include/util.h
deleted file mode 100644 (file)
index 34252cc..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-/*     $NetBSD: util.h,v 1.55 2010/02/25 18:37:12 joerg Exp $  */
-
-/*-
- * 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. 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.
- */
-
-#ifndef _UTIL_H_
-#define        _UTIL_H_
-
-#include <sys/cdefs.h>
-#include <sys/ttycom.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <pwd.h>
-#include <termios.h>
-#include <utmp.h>
-#include <utmpx.h>
-#include <machine/ansi.h>
-
-#ifdef  _BSD_TIME_T_
-typedef _BSD_TIME_T_    time_t;
-#undef  _BSD_TIME_T_
-#endif
-
-#define        PIDLOCK_NONBLOCK        1
-#define        PIDLOCK_USEHOSTNAME     2
-
-#define        PW_POLICY_BYSTRING      0
-#define        PW_POLICY_BYPASSWD      1
-#define        PW_POLICY_BYGROUP       2
-
-__BEGIN_DECLS
-struct disklabel;
-struct iovec;
-struct passwd;
-struct termios;
-struct utmp;
-struct winsize;
-struct sockaddr;
-
-char          *flags_to_string(unsigned long, const char *);
-pid_t          forkpty(int *, char *, struct termios *, struct winsize *);
-const char     *getbootfile(void);
-off_t          getlabeloffset(void);
-int            getlabelsector(void);
-int            getmaxpartitions(void);
-int            getrawpartition(void);
-#ifndef __LIBC12_SOURCE__
-void           login(const struct utmp *) __RENAME(__login50);
-void           loginx(const struct utmpx *) __RENAME(__loginx50);
-#endif
-int            login_tty(int);
-int            logout(const char *);
-int            logoutx(const char *, int, int);
-void           logwtmp(const char *, const char *, const char *);
-void           logwtmpx(const char *, const char *, const char *, int, int);
-int            opendisk(const char *, int, char *, size_t, int);
-int            opendisk1(const char *, int, char *, size_t, int,
-                         int (*)(const char *, int, ...));
-int            openpty(int *, int *, char *, struct termios *,
-    struct winsize *);
-#ifndef __LIBC12_SOURCE__
-time_t         parsedate(const char *, const time_t *, const int *)
-    __RENAME(__parsedate50);
-#endif
-int            pidfile(const char *);
-int            pidlock(const char *, int, pid_t *, const char *);
-int            pw_abort(void);
-#ifndef __LIBC12_SOURCE__
-void           pw_copy(int, int, struct passwd *, struct passwd *)
-    __RENAME(__pw_copy50);
-int            pw_copyx(int, int, struct passwd *, struct passwd *,
-    char *, size_t) __RENAME(__pw_copyx50);
-#endif
-void           pw_edit(int, const char *);
-void           pw_error(const char *, int, int);
-void           pw_getconf(char *, size_t, const char *, const char *);
-#ifndef __LIBC12_SOURCE__
-void           pw_getpwconf(char *, size_t, const struct passwd *,
-    const char *) __RENAME(__pw_getpwconf50);
-#endif
-const char     *pw_getprefix(void);
-void           pw_init(void);
-int            pw_lock(int);
-int            pw_mkdb(const char *, int);
-void           pw_prompt(void);
-int            pw_setprefix(const char *);
-int            raise_default_signal(int);
-int            secure_path(const char *);
-int            snprintb_m(char *, size_t, const char *, uint64_t, size_t);
-int            snprintb(char *, size_t, const char *, uint64_t);
-int            sockaddr_snprintf(char *, size_t, const char *,
-    const struct sockaddr *);
-int            string_to_flags(char **, unsigned long *, unsigned long *);
-int            ttyaction(const char *, const char *, const char *);
-int            ttylock(const char *, int, pid_t *);
-char          *ttymsg(struct iovec *, int, const char *, int);
-int            ttyunlock(const char *);
-
-uint16_t       disklabel_dkcksum(struct disklabel *);
-int            disklabel_scan(struct disklabel *, char *, size_t);
-
-/* Error checked functions */
-void           (*esetfunc(void (*)(int, const char *, ...)))
-    (int, const char *, ...);
-size_t                 estrlcpy(char *, const char *, size_t);
-size_t                 estrlcat(char *, const char *, size_t);
-char           *estrdup(const char *);
-char           *estrndup(const char *, size_t);
-void           *ecalloc(size_t, size_t);
-void           *emalloc(size_t);
-void           *erealloc(void *, size_t);
-struct __sFILE *efopen(const char *, const char *);
-int            easprintf(char ** __restrict, const char * __restrict, ...)
-                       __printflike(2, 3);
-int            evasprintf(char ** __restrict, const char * __restrict,
-    _BSD_VA_LIST_)
-                       __printflike(2, 0);
-__END_DECLS
-
-#endif /* !_UTIL_H_ */
diff --git a/nbsd_include/utime.h b/nbsd_include/utime.h
deleted file mode 100644 (file)
index bf82611..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*     $NetBSD: utime.h,v 1.9 2009/01/11 03:04:12 christos Exp $       */
-
-/*-
- * Copyright (c) 1990, 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. 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.
- *
- *     @(#)utime.h     8.1 (Berkeley) 6/2/93
- */
-
-#ifndef        _UTIME_H_
-#define        _UTIME_H_
-
-#include <machine/ansi.h>
-
-#ifdef _BSD_TIME_T_
-typedef        _BSD_TIME_T_    time_t;
-#undef _BSD_TIME_T_
-#endif
-
-struct utimbuf {
-       time_t actime;          /* Access time */
-       time_t modtime;         /* Modification time */
-};
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-#ifndef __LIBC12_SOURCE__
-int utime(const char *, const struct utimbuf *) __RENAME(__utime50);
-#endif
-__END_DECLS
-
-#endif /* !_UTIME_H_ */
diff --git a/nbsd_include/utmp.h b/nbsd_include/utmp.h
deleted file mode 100644 (file)
index dd23b08..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*     $NetBSD: utmp.h,v 1.12 2009/01/11 03:04:12 christos Exp $       */
-
-/*
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- * (c) UNIX System Laboratories, Inc.
- * All or some portions of this file are derived from material licensed
- * to the University of California by American Telephone and Telegraph
- * Co. or Unix System Laboratories, Inc. and are reproduced herein with
- * the permission of UNIX System Laboratories, Inc.
- *
- * 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. 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.
- *
- *     @(#)utmp.h      8.2 (Berkeley) 1/21/94
- */
-
-#ifndef        _UTMP_H_
-#define        _UTMP_H_
-
-#ifdef __minix
-#define _PATH_UTMP     "/etc/utmp"
-#define _PATH_WTMP     "/usr/adm/wtmp"
-#define _PATH_BTMP     "/usr/adm/btmp"
-#define _PATH_LASTLOG  "/usr/adm/lastlog"
-#define UTMP           _PATH_UTMP
-#define WTMP           _PATH_WTMP
-#define BTMP           _PATH_BTMP
-#else
-#define        _PATH_UTMP      "/var/run/utmp"
-#define        _PATH_WTMP      "/var/log/wtmp"
-#define        _PATH_LASTLOG   "/var/log/lastlog"
-#endif
-
-#define        UT_NAMESIZE     8
-#ifdef __minix
-#define UT_LINESIZE    12
-#else
-#define        UT_LINESIZE     8
-#endif
-#define        UT_HOSTSIZE     16
-
-struct lastlog {
-       time_t  ll_time;
-       char    ll_line[UT_LINESIZE];
-       char    ll_host[UT_HOSTSIZE];
-};
-
-#ifdef __minix
-struct utmp {
-  char ut_name[UT_NAMESIZE];           /* user name */
-  char ut_id[4];               /* /etc/inittab ID */
-  char ut_line[UT_LINESIZE];           /* terminal name */
-  char ut_host[UT_HOSTSIZE];           /* host name, when remote */
-  short ut_pid;                        /* process id */
-  short int ut_type;           /* type of entry */
-  long ut_time;                        /* login/logout time */
-};
-
-/* Definitions for ut_type. */
-#define RUN_LVL            1   /* this is a RUN_LEVEL record */
-#define BOOT_TIME          2   /* this is a REBOOT record */
-#define INIT_PROCESS       5   /* this process was spawned by INIT */
-#define LOGIN_PROCESS      6   /* this is a 'getty' process waiting */
-#define USER_PROCESS       7   /* any other user process */
-#define DEAD_PROCESS       8   /* this process has died (wtmp only) */
-
-#else /* !__minix */
-
-struct utmp {
-       char    ut_line[UT_LINESIZE];
-       char    ut_name[UT_NAMESIZE];
-       char    ut_host[UT_HOSTSIZE];
-       time_t  ut_time;
-};
-#endif /* __minix */
-
-__BEGIN_DECLS
-int utmpname(const char *);
-void setutent(void);
-#ifndef __LIBC12_SOURCE__
-struct utmp *getutent(void) __RENAME(__getutent50);
-#endif
-void endutent(void);
-__END_DECLS
-
-#endif /* !_UTMP_H_ */
diff --git a/nbsd_include/wchar.h b/nbsd_include/wchar.h
deleted file mode 100644 (file)
index e7fc283..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-/*     $NetBSD: wchar.h,v 1.29 2010/03/27 22:14:09 tnozaki Exp $       */
-
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- */
-
-/*-
- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Julian Coleman.
- *
- * 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
- */
-
-#ifndef _WCHAR_H_
-#define _WCHAR_H_
-
-#include <sys/cdefs.h>
-#include <sys/featuretest.h>
-#include <machine/wchar_limits.h>
-#include <sys/ansi.h>
-#include <sys/null.h>
-
-#include <stdio.h> /* for FILE* */
-
-#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
-typedef        _BSD_WCHAR_T_   wchar_t;
-#undef _BSD_WCHAR_T_
-#endif
-
-#ifdef _BSD_MBSTATE_T_
-typedef        _BSD_MBSTATE_T_ mbstate_t;
-#undef _BSD_MBSTATE_T_
-#endif
-
-#ifdef _BSD_WINT_T_
-typedef        _BSD_WINT_T_    wint_t;
-#undef _BSD_WINT_T_
-#endif
-
-#ifdef _BSD_SIZE_T_
-typedef        _BSD_SIZE_T_    size_t;
-#undef _BSD_SIZE_T_
-#endif
-
-struct tm;
-
-__BEGIN_DECLS
-wint_t btowc(int);
-size_t mbrlen(const char * __restrict, size_t, mbstate_t * __restrict);
-size_t mbrtowc(wchar_t * __restrict, const char * __restrict, size_t,
-           mbstate_t * __restrict);
-int    mbsinit(const mbstate_t *);
-size_t mbsrtowcs(wchar_t * __restrict, const char ** __restrict, size_t,
-           mbstate_t * __restrict);
-size_t wcrtomb(char * __restrict, wchar_t, mbstate_t * __restrict);
-wchar_t        *wcscat(wchar_t * __restrict, const wchar_t * __restrict);
-wchar_t        *wcschr(const wchar_t *, wchar_t);
-int    wcscmp(const wchar_t *, const wchar_t *);
-int    wcscoll(const wchar_t *, const wchar_t *);
-wchar_t        *wcscpy(wchar_t * __restrict, const wchar_t * __restrict);
-size_t wcscspn(const wchar_t *, const wchar_t *);
-size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict,
-           const struct tm * __restrict);
-size_t wcslen(const wchar_t *);
-wchar_t        *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, size_t);
-int    wcsncmp(const wchar_t *, const wchar_t *, size_t);
-wchar_t        *wcsncpy(wchar_t * __restrict , const wchar_t * __restrict, size_t);
-wchar_t        *wcspbrk(const wchar_t *, const wchar_t *);
-wchar_t        *wcsrchr(const wchar_t *, wchar_t);
-size_t wcsrtombs(char * __restrict, const wchar_t ** __restrict, size_t,
-           mbstate_t * __restrict);
-size_t wcsspn(const wchar_t *, const wchar_t *);
-wchar_t        *wcsstr(const wchar_t *, const wchar_t *);
-wchar_t *wcstok(wchar_t * __restrict, const wchar_t * __restrict,
-                    wchar_t ** __restrict);
-size_t wcsxfrm(wchar_t *, const wchar_t *, size_t);
-wchar_t        *wcswcs(const wchar_t *, const wchar_t *);
-wchar_t        *wmemchr(const wchar_t *, wchar_t, size_t);
-int    wmemcmp(const wchar_t *, const wchar_t *, size_t);
-wchar_t        *wmemcpy(wchar_t * __restrict, const wchar_t * __restrict, size_t);
-wchar_t        *wmemmove(wchar_t *, const wchar_t *, size_t);
-wchar_t        *wmemset(wchar_t *, wchar_t, size_t);
-
-size_t wcslcat(wchar_t *, const wchar_t *, size_t);
-size_t wcslcpy(wchar_t *, const wchar_t *, size_t);
-int    wcswidth(const wchar_t *, size_t);
-int    wctob(wint_t);
-int    wcwidth(wchar_t);
-
-unsigned long int wcstoul(const wchar_t * __restrict,
-       wchar_t ** __restrict, int);
-long int wcstol(const wchar_t * __restrict,
-       wchar_t ** __restrict, int);
-double wcstod(const wchar_t * __restrict, wchar_t ** __restrict);
-
-#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
-    defined(_NETBSD_SOURCE)
-float wcstof(const wchar_t * __restrict, wchar_t ** __restrict);
-long double wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
-
-/* LONGLONG */
-long long int wcstoll(const wchar_t * __restrict,
-       wchar_t ** __restrict, int);
-/* LONGLONG */
-unsigned long long int wcstoull(const wchar_t * __restrict,
-       wchar_t ** __restrict, int);
-#endif
-
-wint_t ungetwc(wint_t, FILE *);
-wint_t fgetwc(FILE *);
-wchar_t *fgetws(wchar_t * __restrict, int, FILE * __restrict);
-wint_t getwc(FILE *);
-wint_t getwchar(void);
-wint_t fputwc(wchar_t, FILE *);
-int fputws(const wchar_t * __restrict, FILE * __restrict);
-wint_t putwc(wchar_t, FILE *);
-wint_t putwchar(wchar_t);
-
-int fwide(FILE *, int);
-
-wchar_t        *fgetwln(FILE * __restrict, size_t * __restrict);
-int fwprintf(FILE * __restrict, const wchar_t * __restrict, ...);
-int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
-int swprintf(wchar_t * __restrict, size_t n, const wchar_t * __restrict, ...);
-int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
-int vfwprintf(FILE * __restrict, const wchar_t * __restrict, _BSD_VA_LIST_);
-int vswprintf(wchar_t * __restrict, size_t, const wchar_t * __restrict,
-    _BSD_VA_LIST_);
-int vwprintf(const wchar_t * __restrict, _BSD_VA_LIST_);
-int wprintf(const wchar_t * __restrict, ...);
-int wscanf(const wchar_t * __restrict, ...);
-#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) > 199901L || \
-    defined(_NETBSD_SOURCE)
-int vfwscanf(FILE * __restrict, const wchar_t * __restrict, _BSD_VA_LIST_);
-int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict,
-    _BSD_VA_LIST_);
-int vwscanf(const wchar_t * __restrict, _BSD_VA_LIST_);
-#endif
-#if defined(_NETBSD_SOURCE)
-struct tinfo;
-int t_putws(struct tinfo *, const wchar_t *, int, void (*)(wchar_t, void *),
-    void *);
-wchar_t *wcsdup (const wchar_t *);
-int wcsncasecmp (const wchar_t *, const wchar_t *, size_t);
-int wcscasecmp(const wchar_t *, const wchar_t *);
-#endif
-__END_DECLS
-
-#ifndef WEOF
-#define        WEOF    ((wint_t)-1)
-#endif
-
-#define getwc(f) fgetwc(f)
-#define getwchar() getwc(stdin)
-#define putwc(wc, f) fputwc((wc), (f))
-#define putwchar(wc) putwc((wc), stdout)
-
-#endif /* !_WCHAR_H_ */
diff --git a/nbsd_include/wctype.h b/nbsd_include/wctype.h
deleted file mode 100644 (file)
index b8689b1..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*     $NetBSD: wctype.h,v 1.7 2010/03/27 22:14:09 tnozaki Exp $       */
-
-/*-
- * Copyright (c)1999 Citrus Project,
- * 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.
- *
- * 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.
- *
- *     citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp
- */
-
-#ifndef _WCTYPE_H_
-#define        _WCTYPE_H_
-
-#include <sys/cdefs.h>
-#include <sys/ansi.h>
-
-#ifdef _BSD_WINT_T_
-typedef        _BSD_WINT_T_    wint_t;
-#undef _BSD_WINT_T_
-#endif
-
-#ifdef _BSD_WCTRANS_T_
-typedef        _BSD_WCTRANS_T_ wctrans_t;
-#undef _BSD_WCTRANS_T_
-#endif
-
-#ifdef _BSD_WCTYPE_T_
-typedef        _BSD_WCTYPE_T_  wctype_t;
-#undef _BSD_WCTYPE_T_
-#endif
-
-#ifndef WEOF
-#define        WEOF    ((wint_t)-1)
-#endif
-
-__BEGIN_DECLS
-int    iswalnum(wint_t);
-int    iswalpha(wint_t);
-int    iswblank(wint_t);
-int    iswcntrl(wint_t);
-int    iswdigit(wint_t);
-int    iswgraph(wint_t);
-int    iswlower(wint_t);
-int    iswprint(wint_t);
-int    iswpunct(wint_t);
-int    iswspace(wint_t);
-int    iswupper(wint_t);
-int    iswxdigit(wint_t);
-int    iswctype(wint_t, wctype_t);
-wint_t towctrans(wint_t, wctrans_t);
-wint_t towlower(wint_t);
-wint_t towupper(wint_t);
-wctrans_t wctrans(const char *);
-wctype_t wctype(const char *);
-__END_DECLS
-
-#endif         /* _WCTYPE_H_ */
index 9fd04f1bbc737253d1ce2580a9ba3b7a712fe2b6..d9d9a48614b4d1c1f2c8f8ccdb70f4265727e2cd 100644 (file)
@@ -1,5 +1,3 @@
-.include <minix.newlibc.mk>
-
 CPPFLAGS+= -D_NETBSD_SOURCE
 
 BINDIR?=/sbin
index 5862b1bcad82a5d28da936923a92fefecfbab9f0..ef189d63e16cebe0ab63ac3307201ee0104556e1 100644 (file)
@@ -1,8 +1,4 @@
-.if ${COMPILER_TYPE} == "gnu"
 CPPFLAGS+= -D_MINIX -D_NETBSD_SOURCE
 LDADD+= -lminlib -lcompat_minix
 DPADD+= ${LIBMINLIB} ${LIBCOMPAT_MINIX}
-.else
-CPPFLAGS+= -D_MINIX -D_POSIX_SOURCE
-.endif
 BINDIR?=/usr/sbin
index 09271b63bc69b5fb06dd5e8b4436553720adff74..4598f1a16791ede561ca80f12442395f3e336920 100644 (file)
@@ -15,11 +15,7 @@ SRCS=        buf.c clock.c inet.c inet_config.c \
 DPADD+=        ${LIBCHARDRIVER} ${LIBSYS} ${LIBMINIXUTIL}
 LDADD+=        -lchardriver -lsys
 
-.if ${COMPILER_TYPE} == "gnu"
 LDADD+= -lc
-.else
-LDADD+= -lminixutil
-.endif
 
 MAN=
 
index 4feb4c52b68275e6ac856ed4d1b83a66a455a244..d8c2a4c958ba3dbab5fc9b9843cfb0f64580b7cf 100644 (file)
@@ -9,8 +9,6 @@ MAN=
 BINDIR?= /usr/sbin
 INSTALLFLAGS+= -S 64k
 
-.if ${OBJECT_FMT} == "ELF"
 LDFLAGS+= -Wl,--section-start=.init=0x0
-.endif
 
 .include <bsd.prog.mk>
index 18f5305f5ec2afe2d27f8582ced7e3e83224f064..98ec55b3f1aab8473008b28dcf2462851476de89 100644 (file)
@@ -7,9 +7,7 @@ SRCS=   open.c table.c inode.c main.c super.c link.c \
 DPADD+=        ${LIBSYS}
 LDADD+=        -lsys
 
-.if ${COMPILER_TYPE} == "gnu"
 LDADD+= -lc
-.endif
 
 MAN=
 
index ec0553f981a1650a3f2ac4aca7caba07778d3ca9..b7bdd8f102fadb19ec700333e5c26db235219b1a 100644 (file)
@@ -17,9 +17,7 @@ CPPFLAGS+= -DUSE_COVERAGE
 DPADD+=        ${LIBSYS} ${LIBTIMERS} ${LIBEXEC}
 LDADD+=        -lsys -ltimers -lexec -lmthread
 
-.if ${COMPILER_TYPE} == "gnu"
 LDADD+=        -lc
-.endif
 
 MAN=
 
index 9c2540f05e8f19a10214656073aaadc5e2c42263..a44b707f4cc16c95bd36e2a950eff98663391520 100644 (file)
@@ -11,9 +11,8 @@ FILES=        bsd.dep.mk bsd.files.mk \
        sys.mk
 
 # MINIX-specific files
-FILES+= minix.bootprog.mk minix.service.mk minix.ackdep.mk \
-       minix.ack.mk minix.gcc.mk minix.gcov.mk pkgsrchooks.mk \
-       minix.newlibc.mk
+FILES+= minix.bootprog.mk minix.service.mk \
+       minix.gcc.mk minix.gcov.mk pkgsrchooks.mk 
 
 FILESDIR=/usr/share/mk
 .endif
index 919360d24cece413fd9b09170c05e91b00b5effc..efd9cc0f702f146c730cc6596671151654317409 100644 (file)
@@ -153,14 +153,5 @@ LINKSMODE?= ${LIBMODE}
 .include <bsd.files.mk>
 .include <bsd.inc.mk>
 .include <bsd.links.mk>
-.if ${COMPILER_TYPE} == "ack"
-.include <minix.ackdep.mk>
-.elif ${COMPILER_TYPE} == "gnu"
 .include <bsd.dep.mk>
-.endif
-
-.if ${COMPILER_TYPE} == "ack"
-.include <minix.ack.mk>
-.elif ${COMPILER_TYPE} == "gnu"
 .include <minix.gcc.mk>
-.endif
index 8022426e6b1e8e04112818cad75da26ba8fb82ac..7c04a89b5aa7f345ffe689b50e111de3ab7edd50 100644 (file)
@@ -87,13 +87,13 @@ PRINTOBJDIR=        echo # prevent infinite recursion
 
 #
 # Determine if running in the MINIX source tree by checking for the
-# existence of boot/ and tools/ in the current or a parent directory,
+# existence of usr.bin and tools/ in the current or a parent directory,
 # and setting _MSRC_TOP_ to the result.
 #
 .if !defined(_MSRC_TOP_)               # {
 _MSRC_TOP_!= cd ${.CURDIR}; while :; do \
                here=`pwd`; \
-               [ -d boot  ] && [ -d tools ] && { echo $$here; break; }; \
+               [ -d usr.bin ] && [ -d tools ] && { echo $$here; break; }; \
                case $$here in /) echo ""; break;; esac; \
                cd ..; done
 
@@ -484,9 +484,6 @@ INFOOWN?=   root
 INFOMODE?=     ${NONBINMODE}
 
 LIBDIR?=       /usr/lib
-.if ${COMPILER_TYPE} == "ack"
-LIBDIR=                /usr/lib/i386
-.endif
 
 LINTLIBDIR?=   /usr/libdata/lint
 LIBGRP?=       ${BINGRP}
@@ -533,12 +530,7 @@ DEBUGMODE?=        ${NONBINMODE}
 #
 # All platforms are ELF.
 #
-#OBJECT_FMT=   ELF
-.if ${COMPILER_TYPE} == "gnu"
 OBJECT_FMT=    ELF
-.else
-OBJECT_FMT=    a.out
-.endif
 
 #
 # If this platform's toolchain is missing, we obviously cannot build it.
index e5cbffff7f0a9f64a02288a7fa2cdae3b3afb9bb..ba5e230040ddef52b0e611718b28bcb18ed519ca 100644 (file)
@@ -62,11 +62,6 @@ MKDEP_SUFFIXES?=     .o .ln
        bz2 l hgfs audiodriver exec ddekit devman usb elf bdev
 .ifndef LIB${_lib:tu}
 LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib}.a
-.if ${COMPILER_TYPE} == "ack"
-LIB${_lib:tu}= ${DESTDIR}/usr/lib/i386/lib${_lib}.a
-.elif ${COMPILER_TYPE} == "gnu"
-LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib}.a
-.endif
 .MADE:         ${LIB${_lib:tu}}        # Note: ${DESTDIR} will be expanded
 .endif
 .endfor
@@ -360,17 +355,8 @@ LINKSMODE?= ${BINMODE}
 .include <bsd.inc.mk>
 .include <bsd.links.mk>
 .include <bsd.sys.mk>
-.if ${COMPILER_TYPE} == "ack"
-.include <minix.ackdep.mk>
-.elif ${COMPILER_TYPE} == "gnu"
 .include <bsd.dep.mk>
-.endif
-
-.if ${COMPILER_TYPE} == "ack"
-.include <minix.ack.mk>
-.elif ${COMPILER_TYPE} == "gnu"
 .include <minix.gcc.mk>
-.endif
 
 
 cleanextra: .PHONY
@@ -380,14 +366,6 @@ cleanextra: .PHONY
 
 ${TARGETS}:    # ensure existence
 
-###### Minix rule to set up mem allocations for boot image services
-.if defined(INSTALLFLAGS) && ${COMPILER_TYPE} == "ack"
-all: .PHONY memalloc
-
-memalloc: realall
-       ${INSTALL} ${INSTALLFLAGS} ${PROG}
-.endif
-
 ${.CURDIR}/.gitignore: Makefile
        echo $(CLEANFILES) $(PROGS) | tr ' ' '\n' >${.TARGET}
 
diff --git a/share/mk/minix.ack.mk b/share/mk/minix.ack.mk
deleted file mode 100644 (file)
index fb39bf8..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-CPPFLAGS+= -wo
-
-.SUFFIXES:     .o .e .S
-
-# Treated like a C file
-.e.o:
-       ${_MKTARGET_COMPILE}
-       ${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.TARGET}
-# .if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
-#      ${OBJCOPY} -x ${.TARGET}
-# .endif
-
-ASMCONV=gas2ack
-AFLAGS+=-D__ASSEMBLY__ -w -wo
-CPP.s=${CC} -E ${AFLAGS} ${CPPFLAGS}
-ASMCONVFLAGS+=-mi386
-
-# Need to convert ACK assembly files to GNU assembly before building
-.S.o:
-       ${_MKTARGET_COMPILE}
-       ${CPP.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} -o ${.PREFIX}.gnu.s
-       ${ASMCONV} ${ASMCONVFLAGS} ${.PREFIX}.gnu.s ${.PREFIX}.ack.s
-       ${COMPILE.s} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${.PREFIX}.ack.s -o ${.TARGET}
-       rm -rf ${.PREFIX}.ack.s ${.PREFIX}.gnu.s
diff --git a/share/mk/minix.ackdep.mk b/share/mk/minix.ackdep.mk
deleted file mode 100644 (file)
index bd03804..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-#      $NetBSD: bsd.dep.mk,v 1.68 2008/10/25 22:27:36 apb Exp $
-
-##### Basic targets
-cleandir:      cleandepend
-realdepend:    beforedepend .depend afterdepend
-.ORDER:                beforedepend .depend afterdepend
-
-beforedepend .depend afterdepend: # ensure existence
-
-##### Default values
-MKDEP=                 ackmkdep
-MKDEP_SUFFIXES?=       .o
-
-##### Build rules
-# some of the rules involve .h sources, so remove them from mkdep line
-
-.if defined(SRCS)                                                      # {
-#_TRADITIONAL_CPP?=-traditional-cpp
-__acpp_flags=  ${_TRADITIONAL_CPP}
-
-__DPSRCS.all=  ${SRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/} \
-               ${DPSRCS:C/\.(c|m|s|S|C|cc|cpp|cxx)$/.d/}
-__DPSRCS.d=    ${__DPSRCS.all:O:u:M*.d}
-__DPSRCS.notd= ${__DPSRCS.all:O:u:N*.d}
-
-.NOPATH: .depend ${__DPSRCS.d}
-
-.if !empty(__DPSRCS.d)                                                 # {
-${__DPSRCS.d}: ${__DPSRCS.notd} ${DPSRCS}
-.endif                                                                 # }
-
-.depend: ${__DPSRCS.d}
-       ${_MKTARGET_CREATE}
-       rm -f .depend
-#      ${MKDEP} -d -f ${.TARGET} -s ${MKDEP_SUFFIXES:Q} ${__DPSRCS.d}
-       cat ${__DPSRCS.d} > ${.TARGET}
-
-.SUFFIXES: .d .s .S .c .C .cc .cpp .cxx .m
-
-.c.d:
-       ${_MKTARGET_CREATE}
-#      ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
-#          ${CFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
-#          ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
-#      mkdep -- ${MKDEPFLAGS} \
-#          ${CFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
-#          ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC} > ${.TARGET}
-       ${MKDEP} "$(CC)  ${CFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
-       ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} -E" ${.IMPSRC} > ${.TARGET}
-
-# .m.d:
-#      ${_MKTARGET_CREATE}
-#      ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
-#          ${OBJCFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
-#          ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
-
-.s.d .S.d:
-       ${_MKTARGET_CREATE}
-#       ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
-#           ${AFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
-#           ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${__acpp_flags} ${.IMPSRC}
-       ${MKDEP} "$(CC) ${AFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
-       ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} -E" ${.IMPSRC} > ${.TARGET}
-
-# .C.d .cc.d .cpp.d .cxx.d:
-#      ${_MKTARGET_CREATE}
-#      ${MKDEP} -f ${.TARGET} -- ${MKDEPFLAGS} \
-#          ${CXXFLAGS:C/-([IDU])[  ]*/-\1/Wg:M-[IDU]*} \
-#          ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} \
-#                      ${DESTDIR}/usr/include/g++} \
-#          ${CPPFLAGS} ${CPPFLAGS.${.IMPSRC:T}} ${.IMPSRC}
-
-.endif # defined(SRCS)                                                 # }
-
-##### Clean rules
-cleandepend: .PHONY
-.if defined(SRCS)
-       rm -f .depend ${__DPSRCS.d} ${.CURDIR}/tags ${CLEANDEPEND}
-.endif
-
-##### Custom rules
-# .if !target(tags)
-# tags: ${SRCS}
-# .if defined(SRCS)
-#      -cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
-#          ${TOOL_SED} "s;\${.CURDIR}/;;" > tags
-# .endif
-# .endif
index 4df1a8733d6eb021fb442f50ec9c5c4f564ad1fe..654b0e8ce6fdba2538370efee2a3f94638319a5f 100644 (file)
@@ -1,8 +1,6 @@
 # MINIX-specific boot program options
 .include <bsd.own.mk>
 
-.if ${OBJECT_FMT} == "ELF"
 LDFLAGS+= -Wl,--section-start=.init=0x0
-.endif
 
 .include <minix.service.mk>
index 6c046206036c331fcbeaa83a2aec9f1de4208745..2e62e4cc84691062efd45a0a3f9a7e1eea3be594 100644 (file)
@@ -4,7 +4,6 @@ CLEANFILES+= *.gcno *.gcda $(LCOV)
 .if ${MKCOVERAGE} == "yes"
 CFLAGS+=-fno-builtin -fprofile-arcs -ftest-coverage
 LDADD+= -lgcov
-COMPILER_TYPE=gnu
 CC=gcc
 .endif
 
diff --git a/share/mk/minix.newlibc.mk b/share/mk/minix.newlibc.mk
deleted file mode 100644 (file)
index 56b76e0..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# Force clang/gcc and using new libc
-# Requires NBSD_LIBC and clang/gcc (we default to using clang)
-NBSD_LIBC:= yes
-CC:=${CC:C/^cc/clang/}
-COMPILER_TYPE:= gnu
-AR=ar
index 1fc383cc779022ce0084be6aeedcfeff4369928a..19d028fd7ced1e984567f21f7292c9ecf11d5eaa 100644 (file)
@@ -1,14 +1,10 @@
 # MINIX-specific servers/drivers options
 .include <bsd.own.mk>
 
-.if ${COMPILER_TYPE} == "gnu"
-
 .if ${CC} == "gcc"
 LDADD+= -nodefaultlibs -lgcc -lsys -lgcc -lminc
 .elif ${CC} == "clang"
 LDADD+= -nodefaultlibs -L/usr/pkg/lib -L/usr/pkg/compiler-rt/lib -lCompilerRT-Generic -lsys -lCompilerRT-Generic -lminc
 .endif
 
-.endif
-
 .include <bsd.prog.mk>
index 8473f8344847bd6f46d12d157e5432c9dcc27001..8ae1cf18258a8be3b145a268b83fdd54780d37ed 100644 (file)
@@ -23,7 +23,7 @@ LINK.s?=      ${CC} ${AFLAGS} ${LDFLAGS}
 COMPILE.S?=    ${CC} ${AFLAGS} ${CPPFLAGS} -c
 LINK.S?=       ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
 
-CC?=           cc
+CC?=           clang
 .if ${MACHINE_ARCH} == "alpha" || \
     ${MACHINE_ARCH} == "arm" || \
     ${MACHINE_ARCH} == "x86_64" || \
@@ -232,22 +232,11 @@ YACC.y?=  ${YACC} ${YFLAGS}
 
 # MINIX
 
-.if !empty(CC:Mcc) || !empty(CC:Macd) || !empty(CC:M*acc)
-COMPILER_TYPE=ack
-AR?=   aal
-.elif !empty(CC:M*gcc) || !empty(CC:M*clang) || !empty(CC:M*pcc) || !empty(CC:M*ccc-analyzer)
 COMPILER_TYPE=gnu
-AR?=   ar
-.endif
-
-# Set NBSD_LIBC to either "yes" or "no".
-.if ${COMPILER_TYPE} == "ack"
-NBSD_LIBC=     no
-.else
+AR?=   ar
 NBSD_LIBC=     yes
-.endif
 
-.if ${COMPILER_TYPE} == "gnu" && defined(MKSMALL) && ${MKSMALL} == "yes"
+.if defined(MKSMALL) && ${MKSMALL} == "yes"
 DBG=   -Os
 CFLAGS+= -DNDEBUG
 .endif
index 0e8f2b946a3b648333171d4f1446e0985ed6866e..2fe70dab219c758d1755937c7fc7e264c9e69811 100644 (file)
@@ -1,10 +1,5 @@
 #      $NetBSD: Makefile.mbr,v 1.17 2009/11/20 17:28:19 dsl Exp $
 
-.if !defined(COMPILER_TYPE) || ${COMPILER_TYPE} != "gnu"
-CC:=clang
-COMPILER_TYPE:=gnu
-.endif
-
 NOMAN=         # defined
 
 LIBCRT0=       # nothing
index 1ccc2c7bc6b5c7f74472e40ff2406ec56630ba6c..2c31ff5b32a56bff0a99e0839dc7ec373ac902f3 100644 (file)
@@ -2,10 +2,8 @@
 
 GCC?=gcc
 CFLAGS= -O0 -D_MINIX -D_POSIX_SOURCE  -g  -Wall -Werror
-.if ${COMPILER_TYPE} == "gnu"
 CFLAGS+= -D_NETBSD_SOURCE -fno-builtin
 LIBS+= -lm -lcompat_minix
-.endif
 CFLAGS-GCC= $(CFLAGS) -Wall  -D_NETBSD_SOURCE 
 CFLAGS-GCCFPU= $(CFLAGS) -Wall -mhard-float 
 CFLAGS-GCCFPU= $(CFLAGS-GCC) -W -mhard-float
index fe3cb102feba546a15f9c3a3b7c02bf2c55bc1f0..7ffad558aac904c1c0ba9d2e2a225a225f700d4f 100644 (file)
@@ -1,9 +1,5 @@
 # Copied from drivers/Makefile.inc, and slightly edited.
-.if ${COMPILER_TYPE} == "gnu"
 CPPFLAGS+= -D_MINIX -D_NETBSD_SOURCE
 LDADD+= -lminlib -lcompat_minix -lc
 DPADD+= ${LIBMINLIB} ${LIBCOMPAT_MINIX}
-.else
-CPPFLAGS+= -D_MINIX -D_POSIX_SOURCE
-.endif
 BINDIR?=/usr/sbin
index 2709e72ed4b2745be4cb373699c120745066a4b5..4d2011c7fa1f540d2dc5b4864de4156bf3cc8733 100644 (file)
@@ -154,7 +154,7 @@ void garbage()
 {
   register int i, j, k;
   register char *p, *q, *r;
-  char *a;
+  char *a = NULL;
 
   p = &buf[300];
   q = &buf[400];
index f2f6ad193da45de25a6253ac65cfc1fd220557c7..461a4d67e68c027716a967a1c3edc5bf42ed3b77 100644 (file)
@@ -33,7 +33,6 @@ usage:
        @echo "Usage:" >&2
        @echo " make includes   # Install include files" >&2
        @echo " make depend     # Generate dependency files" >&2
-       @echo " make libraries  # Make system libraries" >&2
        @echo " make services   # Compile and install all services" >&2
        @echo " make image      # Make needed services and create boot image" >&2
        @echo " make install    # Make image, and install to hard disk" >&2
@@ -51,25 +50,10 @@ usage:
 
 all: services image
 
-# Pad the kernel text only if ACK compiler is used. padtext does not work for
-# gnu-like compilers as they generate common I&D and a linker script can do the
-# same in a nicer way
-.if ${COMPILER_TYPE} == "gnu"
-PAD_KERNEL_TEXT := cp ../kernel/kernel kernel
-.else
-PAD_KERNEL_TEXT := padtext ../kernel/kernel kernel
-.endif
-
-.if ${OBJECT_FMT} == "ELF"
 image: includes services
-       ${PAD_KERNEL_TEXT}
+       cp ../kernel/kernel kernel
        mkimage $(PROGRAMS)
        strip -s ${KERNEL} ${PROGRAMS}
-.else
-image:  includes services
-       ${PAD_KERNEL_TEXT}
-       installboot_minix -image $@ $(KERNEL) $(PROGRAMS)
-.endif
 
 # rebuild the program or system libraries
 includes:
@@ -86,25 +70,16 @@ services: includes kernel servers .WAIT drivers
 kernel: includes
        $(MAKE) -C ../kernel 
 
-.if ${COMPILER_TYPE} == "gnu"
 servers: includes
        $(MAKE) -C ../servers all install
-.else
-servers: includes
-       $(MAKE) -C ../servers all
-.endif
 
 drivers: includes servers
        $(MAKE) -C ../drivers all install
 
-libraries: includes
-       cd ../lib && sh ack_build.sh clean obj depend all install
-
 # make bootable and place system images
 bootable:
        exec su root mkboot bootable
 
-.if ${OBJECT_FMT} == "ELF"
 hdboot: image
        rm -rf /boot/minix/.temp/
        mkdir -p /boot/minix/.temp
@@ -113,15 +88,13 @@ hdboot: image
        do                                                      \
        let n=n+1 >/dev/null;                                   \
        [ "$$n" -ge 10 ] && prefix="mod" || prefix="mod0";      \
-       cp $$i /boot/minix/.temp/$${prefix}$${n}_`basename $$i`;\
+       newname="/boot/minix/.temp/$${prefix}$${n}_`basename $$i`"; \
+       cp $$i $$newname;                               \
+       [ -d /boot/image ] && ln -f $$newname /boot/`basename $$i` || true ;            \
        done
        cp kernel /boot/minix/.temp/
+       [ -d /boot/image ] && ln -f /boot/minix/.temp/kernel /boot/kernel || true
        exec sh mkboot $@ minix
-.else
-hdboot:        image
-       exec sh mkboot $@ image
-       @sync
-.endif
 
 fdboot:        image
        exec su root mkboot $@
index 92620db945d752a966e9191e4f582f9e2196a4e7..c4f6422e139cad2b0523b52689096214e786f242 100755 (executable)
@@ -12,15 +12,12 @@ make world
 
 cd tools 
 rm revision
-rm /boot/image/*
 make install
-cp /boot/image/* /boot/image_big  # Make big image accessible by this name
-cp ../boot/boot/boot /boot/boot
 
-CC=clang make cleandepend clean depend image
+make cleandepend clean depend image
 rm revision
 rm -rf /boot/minix/* # on old systems might not be present
-CC=clang make install
+make install
 cp ../sys/arch/i386/stand/boot/biosboot/boot_monitor /
 cp -rf /boot/minix/* /boot/minix_default
 
@@ -30,4 +27,3 @@ if [ $MAKEMAP -ne 0 ]; then
 fi
 make clean
 make cleandepend
-find . -name 'obj-*' -type d|xargs rm -rf
index 50c765e7622b94915ff19c75bdac0b0f936a7615..2c4f07b4e16992fc883ece1db07f6d70d0df0728 100755 (executable)
@@ -76,13 +76,6 @@ bootable | hdboot)
 esac
 
 case $action in
-bootable)
-       # Install the boot monitor on the root device and make it bootable.
-       install -cs -m 644 $mdec/boot $rootdir/boot/boot || exit
-       sync
-       installboot_minix -device $root $mdec/bootblock /boot/boot || exit
-       test $realroot != $root && umount $root
-       ;;
 hdboot)
        # Install a new image on the root device.
        if [ -e $rootdir/boot/$hdboot_t -a ! -d $rootdir/boot/$hdboot_t ]
@@ -136,14 +129,6 @@ hdboot)
                mv /boot/minix/.temp /boot/minix/"$target"
                rm -f /boot/minix_latest
                ln -s /boot/minix/"$target" /boot/minix_latest 
-
-               # XXX for compatibility with old boot
-               ln -f /boot/minix_latest/kernel /boot/kernel
-               for i in /boot/minix_latest/mod*
-               do
-                       lname=`basename $i | sed 's/.*_//'`
-                       ln -f "$i" "/boot/$lname"
-               done
        else
                # Install the new image.
                echo "install $hdboot_t $root:/boot/$hdboot_t/$target"
@@ -159,52 +144,6 @@ hdboot)
        test $realroot != $root && umount $root
        echo "Done."
        ;;
-fdboot)
-       # fdboot: Make a boot floppy.
-
-       if [ -z "$dev" ]
-       then
-               echo -n \
-"Finish the name of the floppy device to write (by default 'fd0'): /dev/";
-               read dev
-               case "$dev" in
-               '')     dev=/dev/fd0
-                       ;;
-               /dev/*)
-                       ;;
-               *)      dev=/dev/$dev
-               esac
-       fi
-
-       # Make a file system.
-       umount $dev 2>/dev/null
-       if mkfs -B 1024 -i 512 $dev
-       then    :
-       else
-               echo "mkfs of $dev failed."
-               exit 1;
-       fi
-
-       # Install /dev, /boot/boot and /boot/image.
-       mount $dev /mnt || exit
-       mkdir -p /mnt/boot/image || exit
-       cpdir /dev /mnt/dev || exit
-       cp -p $mdec/boot /mnt/boot/boot || exit
-       cp -p image /mnt/boot/image/ || exit
-       umount $dev || exit
-
-       # Make bootable and copy the boot parameters.
-       installboot_minix -d $dev $mdec/bootblock /boot/boot || exit
-       pfile=fdbootparams
-       if [ -f $pfile ]
-       then    echo "Using floppy boot parameters from file $pfile."
-               edparams $dev "`cat $pfile`" || exit
-       else    echo "Copying floppy boot parameters from $root."
-               dd if=$root of=$dev skip=1 seek=1 count=1 conv=silent || exit
-       fi
-       edparams $dev 'main(){delay 2000;boot}; save' || exit
-       echo "Test kernel installed on $dev"
-       ;;
 esac
 sync
 exit 0
index f64ba4e51388a7dabcfa92b638b3e6b8e348f781..0197ef3b9353d49f618fa85aeb7d5bd153e2e94f 100644 (file)
@@ -1,5 +1,6 @@
+bin/date               src/bin/date
 common/lib/libprop             src/common/lib/libprop
-nbsd_include/ufs       src/sys/ufs
+include/ufs            src/sys/ufs
 sbin/newfs_ext2fs      src/sbin/newfs_ext2fs
 sbin/fsck_ext2fs       src/sbin/fsck_ext2fs
 lib/libprop            src/lib/libprop
@@ -7,15 +8,15 @@ common/include/arch/x86               src/sys/arch/x86/include
 common/include/arch/i386       src/sys/arch/i386/include
 common/include         src/common/include
 common/lib/libc                src/common/lib/libc
-lib/nbsd_libc          src/lib/libc
-lib/nbsd_libm          src/lib/libm
+lib/libc               src/lib/libc
+lib/libm               src/lib/libm
 lib/libcrypt           src/lib/libcrypt
 lib/libterminfo                src/lib/libterminfo
 lib/libcurses          src/lib/libcurses
 lib/libutil            src/lib/libutil
 common/lib/libutil     src/common/lib/libutil
 lib/libbz2             src/lib/libbz2
-nbsd_include           src/include
+include                        src/include
 bin/mkdir              src/bin/mkdir
 bin/rm                 src/bin/rm
 bin/rmdir              src/bin/rmdir
index a87bdfb6bb4758bf0ba29378844790b9f2c536e7..519494c9337b758fb0557d7032250c0eb8fb4ccc 100755 (executable)
@@ -185,20 +185,15 @@ mkdir -p $RELEASEPACKAGE
 
 echo " * Transfering bootstrap dirs to $RELEASEDIR"
 cp -p /bin/* /usr/bin/* /usr/sbin/* /sbin/* $RELEASEDIR/$XBIN
-cp -rp /usr/lib $RELEASEDIR/usr
 cp -rp /bin/sh /bin/echo /bin/install /bin/rm \
     /bin/date /bin/ls $RELEASEDIR/bin
-cp -rp /usr/bin/make /usr/bin/yacc /usr/bin/lex /usr/bin/asmconv \
+cp -rp /usr/bin/make /usr/bin/yacc /usr/bin/lex \
        /usr/bin/grep /usr/bin/egrep /usr/bin/awk /usr/bin/sed $RELEASEDIR/usr/bin
 
-CONFIGHEADER=$RELEASEDIR/usr/src/common/include/minix/sys_config.h
+CONFIGHEADER=$RELEASEDIR/usr/src/include/minix/sys_config.h
 
 copy_local_packages
 
-# Make sure compilers and libraries are root-owned
-chown -R root $RELEASEDIR/usr/lib
-chmod -R u+w $RELEASEDIR/usr/lib
-
 if [ "$COPY" -ne 1 ]
 then
        echo "Retrieving latest minix repo from $REPO."
@@ -235,16 +230,6 @@ else
        IMG=${IMG_BASE}_copy.iso
 fi
 
-echo " * Fixups for owners and modes of dirs and files"
-chown -R root $RELEASEDIR/usr/$SRC
-chmod -R u+w $RELEASEDIR/usr/$SRC 
-find $RELEASEDIR/usr/$SRC -type d | xargs chmod 755
-find $RELEASEDIR/usr/$SRC -type f | xargs chmod 644
-find $RELEASEDIR/usr/$SRC -name configure | xargs chmod 755
-find $RELEASEDIR/usr/$SRC/commands -name build | xargs chmod 755
-# Bug tracking system not for on cd
-rm -rf $RELEASEDIR/usr/$SRC/doc/bugs
-
 # Make sure the CD knows it's a CD, unless it's not
 if [ "$USB" -eq 0 ]
 then   date >$RELEASEDIR/CD
@@ -279,6 +264,9 @@ rm -rf $RELEASEDIR/$XBIN
 chown -R root $RELEASEDIR/usr/src*
 cp issue.install $RELEASEDIR/etc/issue
 
+echo " * Resetting timestamps"
+find $RELEASEDIR | xargs touch
+
 echo $version_pretty, SVN revision $REVISION, generated `date` >$RELEASEDIR/etc/version
 rm -rf $RELEASEDIR/tmp/*
 
index f4a7b823db7151467867a48840c204bc3b17ecb0..8a0cc2a41ba44b6a52d51bff2e63566e82583cca 100755 (executable)
@@ -4,10 +4,10 @@
 #                                              Author: Kees J. Bot
 
 echo "
-#include \"../common/include/minix/config.h\"
+#include \"../include/minix/config.h\"
 $*
 " >/tmp/tell.$$
 exec </tmp/tell.$$
 rm /tmp/tell.$$
 
-exec cc -P -E -
+exec clang -P -E -
index cfde616e69238caa08b2329180e819fb82de4f24..25b3aeeb90a8338ebbf2e76606b32e9e12714be6 100644 (file)
@@ -1,4 +1,2 @@
-.include <minix.newlibc.mk>
-
 BINDIR?=/usr/bin
 
index ccd0096ca994a9768398a2302865c495638ac0db..80f49701c210de71c60177ccbe7bb8b35b5387ac 100644 (file)
@@ -8,19 +8,11 @@ PROG= chpass
 SRCS=  chpass.c edit.c field.c table.c util.c
 BINOWN=        root
 BINMODE=4555
-.ifdef __MINIX
-.PATH:  ${NETBSDSRCDIR}/lib/nbsd_libc/gen
-.else
 .PATH: ${NETBSDSRCDIR}/lib/libc/gen
-.endif
 LINKS= ${BINDIR}/chpass ${BINDIR}/chfn ${BINDIR}/chpass ${BINDIR}/chsh
 MLINKS=        chpass.1 chfn.1 chpass.1 chsh.1
 
-.ifdef __MINIX
-CPPFLAGS+=-I${NETBSDSRCDIR}/lib/nbsd_libc/include
-.else
 CPPFLAGS+=-I${NETBSDSRCDIR}/lib/libc/include
-.endif
 
 .if defined(__MINIX)
 USE_YP=        no
index 873a29712257d7e33c8adde96e9b51e5107dc114..27d80a74a8739e24fb95c01d746cbf4a13a7e84d 100644 (file)
@@ -1,3 +1 @@
-.include <minix.newlibc.mk>
-
 BINDIR?= /usr/sbin
index 2dfe37aefc2e66efb714994443bd96292b593138..64b1e731aa772510d7b37b587053948653a2ca18 100644 (file)
@@ -5,11 +5,7 @@
 
 PROG=  pwd_mkdb
 MAN=   pwd_mkdb.8
-.if defined(__MINIX)
-CPPFLAGS+=     -I${NETBSDSRCDIR}/lib/nbsd_libc/include
-.else
 CPPFLAGS+=     -I${NETBSDSRCDIR}/lib/libc/include
-.endif
 
 .ifndef HOSTPROG
 LDADD+=        -lutil
index 46236757ae8d138886d4399b450dd54021716569..16b0cfde1ea43694c7aec88b5990524cb0caa9e2 100644 (file)
@@ -9,6 +9,6 @@ SRCS=   zic.c scheck.c ialloc.c
 MAN=   zic.8
 CPPFLAGS+=-Dunix
 
-.PATH: ${NETBSDSRCDIR}/lib/nbsd_libc/time
+.PATH: ${NETBSDSRCDIR}/lib/libc/time
 
 .include <bsd.prog.mk>