aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorsvn2git <svn2git@FreeBSD.org>1994-05-01 00:00:00 -0800
committersvn2git <svn2git@FreeBSD.org>1994-05-01 00:00:00 -0800
commita16f65c7d117419bd266c28a1901ef129a337569 (patch)
tree2626602f66dc3551e7a7c7bc9ad763c3bc7ab40a /lib
parent8503f4f13f77abf7adc8f7e329c6f9c1d52b6a20 (diff)
downloadsrc-a16f65c7d117419bd266c28a1901ef129a337569.tar.gz
src-a16f65c7d117419bd266c28a1901ef129a337569.zip
Release FreeBSD 1.1release/1.1.0_cvs
This commit was manufactured to restore the state of the 1.1-RELEASE image. Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile10
-rw-r--r--lib/Makefile.inc3
-rw-r--r--lib/csu.i386/Makefile16
-rw-r--r--lib/csu.i386/crt0.c365
-rw-r--r--lib/csu.i386/crt1.c47
-rw-r--r--lib/csu.i386/gmon.c3
-rw-r--r--lib/csu.i386/gmon.h3
-rw-r--r--lib/libF77/Makefile30
-rw-r--r--lib/libF77/Notice23
-rw-r--r--lib/libF77/README86
-rw-r--r--lib/libF77/Version.c27
-rw-r--r--lib/libF77/abort_.c18
-rw-r--r--lib/libF77/c_abs.c14
-rw-r--r--lib/libF77/c_cos.c16
-rw-r--r--lib/libF77/c_div.c36
-rw-r--r--lib/libF77/c_exp.c19
-rw-r--r--lib/libF77/c_log.c16
-rw-r--r--lib/libF77/c_sin.c16
-rw-r--r--lib/libF77/c_sqrt.c34
-rw-r--r--lib/libF77/cabs.c14
-rw-r--r--lib/libF77/d_abs.c12
-rw-r--r--lib/libF77/d_acos.c13
-rw-r--r--lib/libF77/d_asin.c13
-rw-r--r--lib/libF77/d_atan.c13
-rw-r--r--lib/libF77/d_atn2.c13
-rw-r--r--lib/libF77/d_cnjg.c12
-rw-r--r--lib/libF77/d_cos.c13
-rw-r--r--lib/libF77/d_cosh.c13
-rw-r--r--lib/libF77/d_dim.c10
-rw-r--r--lib/libF77/d_exp.c13
-rw-r--r--lib/libF77/d_imag.c10
-rw-r--r--lib/libF77/d_int.c13
-rw-r--r--lib/libF77/d_lg10.c15
-rw-r--r--lib/libF77/d_log.c13
-rw-r--r--lib/libF77/d_mod.c40
-rw-r--r--lib/libF77/d_nint.c14
-rw-r--r--lib/libF77/d_prod.c10
-rw-r--r--lib/libF77/d_sign.c12
-rw-r--r--lib/libF77/d_sin.c13
-rw-r--r--lib/libF77/d_sinh.c13
-rw-r--r--lib/libF77/d_sqrt.c13
-rw-r--r--lib/libF77/d_tan.c13
-rw-r--r--lib/libF77/d_tanh.c13
-rw-r--r--lib/libF77/derf_.c12
-rw-r--r--lib/libF77/derfc_.c14
-rw-r--r--lib/libF77/disclaimer15
-rw-r--r--lib/libF77/ef1asc_.c21
-rw-r--r--lib/libF77/ef1cmc_.c14
-rw-r--r--lib/libF77/erf_.c12
-rw-r--r--lib/libF77/erfc_.c12
-rw-r--r--lib/libF77/f2ch.add162
-rw-r--r--lib/libF77/getarg_.c28
-rw-r--r--lib/libF77/getenv_.c51
-rw-r--r--lib/libF77/h_abs.c12
-rw-r--r--lib/libF77/h_dim.c10
-rw-r--r--lib/libF77/h_dnnt.c14
-rw-r--r--lib/libF77/h_indx.c26
-rw-r--r--lib/libF77/h_len.c10
-rw-r--r--lib/libF77/h_mod.c10
-rw-r--r--lib/libF77/h_nint.c14
-rw-r--r--lib/libF77/h_sign.c12
-rw-r--r--lib/libF77/hl_ge.c12
-rw-r--r--lib/libF77/hl_gt.c12
-rw-r--r--lib/libF77/hl_le.c12
-rw-r--r--lib/libF77/hl_lt.c12
-rw-r--r--lib/libF77/i_abs.c12
-rw-r--r--lib/libF77/i_dim.c10
-rw-r--r--lib/libF77/i_dnnt.c14
-rw-r--r--lib/libF77/i_indx.c26
-rw-r--r--lib/libF77/i_len.c10
-rw-r--r--lib/libF77/i_mod.c10
-rw-r--r--lib/libF77/i_nint.c14
-rw-r--r--lib/libF77/i_sign.c12
-rw-r--r--lib/libF77/iargc_.c11
-rw-r--r--lib/libF77/l_ge.c12
-rw-r--r--lib/libF77/l_gt.c12
-rw-r--r--lib/libF77/l_le.c12
-rw-r--r--lib/libF77/l_lt.c12
-rw-r--r--lib/libF77/main.c124
-rw-r--r--lib/libF77/permission41
-rw-r--r--lib/libF77/pow_ci.c20
-rw-r--r--lib/libF77/pow_dd.c13
-rw-r--r--lib/libF77/pow_di.c34
-rw-r--r--lib/libF77/pow_hh.c31
-rw-r--r--lib/libF77/pow_ii.c31
-rw-r--r--lib/libF77/pow_qq.c31
-rw-r--r--lib/libF77/pow_ri.c34
-rw-r--r--lib/libF77/pow_zi.c50
-rw-r--r--lib/libF77/pow_zz.c23
-rw-r--r--lib/libF77/r_abs.c12
-rw-r--r--lib/libF77/r_acos.c13
-rw-r--r--lib/libF77/r_asin.c13
-rw-r--r--lib/libF77/r_atan.c13
-rw-r--r--lib/libF77/r_atn2.c13
-rw-r--r--lib/libF77/r_cnjg.c11
-rw-r--r--lib/libF77/r_cos.c13
-rw-r--r--lib/libF77/r_cosh.c13
-rw-r--r--lib/libF77/r_dim.c10
-rw-r--r--lib/libF77/r_exp.c13
-rw-r--r--lib/libF77/r_imag.c10
-rw-r--r--lib/libF77/r_int.c13
-rw-r--r--lib/libF77/r_lg10.c15
-rw-r--r--lib/libF77/r_log.c13
-rw-r--r--lib/libF77/r_mod.c40
-rw-r--r--lib/libF77/r_nint.c14
-rw-r--r--lib/libF77/r_sign.c12
-rw-r--r--lib/libF77/r_sin.c13
-rw-r--r--lib/libF77/r_sinh.c13
-rw-r--r--lib/libF77/r_sqrt.c13
-rw-r--r--lib/libF77/r_tan.c13
-rw-r--r--lib/libF77/r_tanh.c13
-rw-r--r--lib/libF77/s_cat.c25
-rw-r--r--lib/libF77/s_cmp.c42
-rw-r--r--lib/libF77/s_copy.c27
-rw-r--r--lib/libF77/s_paus.c64
-rw-r--r--lib/libF77/s_rnge.c26
-rw-r--r--lib/libF77/s_stop.c33
-rw-r--r--lib/libF77/sig_die.c37
-rw-r--r--lib/libF77/signal_.c19
-rw-r--r--lib/libF77/system_.c22
-rw-r--r--lib/libF77/z_abs.c.obsolete12
-rw-r--r--lib/libF77/z_cos.c14
-rw-r--r--lib/libF77/z_div.c36
-rw-r--r--lib/libF77/z_exp.c17
-rw-r--r--lib/libF77/z_log.c16
-rw-r--r--lib/libF77/z_sin.c14
-rw-r--r--lib/libF77/z_sqrt.c29
-rw-r--r--lib/libI77/Makefile14
-rw-r--r--lib/libI77/Notice23
-rw-r--r--lib/libI77/README155
-rw-r--r--lib/libI77/Version.c176
-rw-r--r--lib/libI77/backspace.c96
-rw-r--r--lib/libI77/close.c95
-rw-r--r--lib/libI77/dfe.c157
-rw-r--r--lib/libI77/disclaimer15
-rw-r--r--lib/libI77/dolio.c20
-rw-r--r--lib/libI77/due.c64
-rw-r--r--lib/libI77/endfile.c195
-rw-r--r--lib/libI77/err.c275
-rw-r--r--lib/libI77/f2ch.add162
-rw-r--r--lib/libI77/fio.h102
-rw-r--r--lib/libI77/fmt.c488
-rw-r--r--lib/libI77/fmt.h82
-rw-r--r--lib/libI77/fmtlib.c28
-rw-r--r--lib/libI77/fp.h26
-rw-r--r--lib/libI77/iio.c138
-rw-r--r--lib/libI77/ilnw.c77
-rw-r--r--lib/libI77/inquire.c106
-rw-r--r--lib/libI77/lio.h73
-rw-r--r--lib/libI77/local.h6
-rw-r--r--lib/libI77/lread.c611
-rw-r--r--lib/libI77/lwrite.c250
-rw-r--r--lib/libI77/open.c231
-rw-r--r--lib/libI77/permission41
-rw-r--r--lib/libI77/rawio.h41
-rw-r--r--lib/libI77/rdfmt.c476
-rw-r--r--lib/libI77/rewind.c24
-rw-r--r--lib/libI77/rsfe.c73
-rw-r--r--lib/libI77/rsli.c98
-rw-r--r--lib/libI77/rsne.c565
-rw-r--r--lib/libI77/sfe.c32
-rw-r--r--lib/libI77/sue.c79
-rw-r--r--lib/libI77/typesize.c6
-rw-r--r--lib/libI77/uio.c54
-rw-r--r--lib/libI77/util.c72
-rw-r--r--lib/libI77/wref.c245
-rw-r--r--lib/libI77/wrtfmt.c372
-rw-r--r--lib/libI77/wsfe.c80
-rw-r--r--lib/libI77/wsle.c36
-rw-r--r--lib/libI77/wsne.c28
-rw-r--r--lib/libI77/xwsne.c68
-rw-r--r--lib/libc/Makefile8
-rw-r--r--lib/libc/compat-43/creat.23
-rw-r--r--lib/libc/compat-43/sigvec.22
-rw-r--r--lib/libc/db/PORT/Makefile55
-rw-r--r--lib/libc/db/PORT/README60
-rw-r--r--lib/libc/db/PORT/clib/memmove.c139
-rw-r--r--lib/libc/db/PORT/clib/realloc.c11
-rw-r--r--lib/libc/db/PORT/clib/snprintf.c54
-rw-r--r--lib/libc/db/PORT/include/cdefs.h94
-rw-r--r--lib/libc/db/PORT/include/compat.h217
-rw-r--r--lib/libc/db/PORT/include/db.h194
-rw-r--r--lib/libc/db/PORT/include/mpool.h135
l---------lib/libc/db/PORT/sys1
l---------lib/libc/db/README1
-rw-r--r--lib/libc/db/VERSION46
-rw-r--r--lib/libc/db/btree/bt_close.c19
-rw-r--r--lib/libc/db/btree/bt_delete.c10
-rw-r--r--lib/libc/db/btree/bt_get.c22
-rw-r--r--lib/libc/db/btree/bt_open.c38
-rw-r--r--lib/libc/db/btree/bt_put.c29
-rw-r--r--lib/libc/db/btree/bt_search.c152
-rw-r--r--lib/libc/db/btree/bt_seq.c21
-rw-r--r--lib/libc/db/btree/bt_utils.c23
-rw-r--r--lib/libc/db/btree/btree.h33
-rw-r--r--lib/libc/db/btree/extern.h3
-rw-r--r--lib/libc/db/db/db.c29
-rw-r--r--lib/libc/db/doc/btree.3.ps364
-rw-r--r--lib/libc/db/doc/dbopen.3.ps496
-rw-r--r--lib/libc/db/doc/hash.3.ps289
-rw-r--r--lib/libc/db/doc/hash.ps12209
-rw-r--r--lib/libc/db/doc/mpool.3.ps318
-rw-r--r--lib/libc/db/doc/recno.3.ps317
-rw-r--r--lib/libc/db/hash/hash.c21
-rw-r--r--lib/libc/db/hash/hash_page.c19
-rw-r--r--lib/libc/db/hash/hsearch.c4
-rw-r--r--lib/libc/db/hash/ndbm.c4
-rw-r--r--lib/libc/db/man/btree.350
-rw-r--r--lib/libc/db/man/dbopen.335
-rw-r--r--lib/libc/db/man/hash.346
-rw-r--r--lib/libc/db/man/recno.380
-rw-r--r--lib/libc/db/recno/rec_close.c18
-rw-r--r--lib/libc/db/recno/rec_delete.c9
-rw-r--r--lib/libc/db/recno/rec_get.c17
-rw-r--r--lib/libc/db/recno/rec_open.c22
-rw-r--r--lib/libc/db/recno/rec_put.c8
-rw-r--r--lib/libc/db/recno/rec_search.c16
-rw-r--r--lib/libc/db/recno/rec_seq.c15
-rw-r--r--lib/libc/db/recno/rec_utils.c16
-rw-r--r--lib/libc/db/test/Makefile16
-rw-r--r--lib/libc/db/test/dbtest.c56
-rw-r--r--lib/libc/db/test/run.test315
-rw-r--r--lib/libc/db/test/strerror.c67
-rw-r--r--lib/libc/gen/Makefile.inc43
-rw-r--r--lib/libc/gen/alarm.34
-rw-r--r--lib/libc/gen/crypt.c2
-rw-r--r--lib/libc/gen/ctype_.c9
-rw-r--r--lib/libc/gen/directory.32
-rw-r--r--lib/libc/gen/err.311
-rw-r--r--lib/libc/gen/fnmatch.325
-rw-r--r--lib/libc/gen/fnmatch.c85
-rw-r--r--lib/libc/gen/getcap.35
-rw-r--r--lib/libc/gen/getgrent.32
-rw-r--r--lib/libc/gen/getgrent.c87
-rw-r--r--lib/libc/gen/getpwent.c288
-rw-r--r--lib/libc/gen/isctype.c15
-rw-r--r--lib/libc/gen/isupper.32
-rw-r--r--lib/libc/gen/ldexp.32
-rw-r--r--lib/libc/gen/msgctl.c15
-rw-r--r--lib/libc/gen/msgget.c14
-rw-r--r--lib/libc/gen/msgrcv.c17
-rw-r--r--lib/libc/gen/msgsnd.c16
-rw-r--r--lib/libc/gen/nlist.32
-rw-r--r--lib/libc/gen/regexp.3315
-rw-r--r--lib/libc/gen/regexp/COPYRIGHT22
-rw-r--r--lib/libc/gen/regexp/README84
-rw-r--r--lib/libc/gen/regexp/regerror.c18
-rw-r--r--lib/libc/gen/regexp/regexp.3315
-rw-r--r--lib/libc/gen/regexp/regexp.c1320
-rw-r--r--lib/libc/gen/regexp/regexp.h21
-rw-r--r--lib/libc/gen/regexp/regmagic.h5
-rw-r--r--lib/libc/gen/regexp/regsub.c81
-rw-r--r--lib/libc/gen/semconfig.c13
-rw-r--r--lib/libc/gen/semctl.c15
-rw-r--r--lib/libc/gen/semget.c15
-rw-r--r--lib/libc/gen/semop.c15
-rw-r--r--lib/libc/gen/setmode.c8
-rw-r--r--lib/libc/gen/signal.34
-rw-r--r--lib/libc/gen/tcgetpgrp.379
-rw-r--r--lib/libc/gen/tcsetattr.3330
-rw-r--r--lib/libc/gen/tcsetpgrp.3100
-rw-r--r--lib/libc/gen/timezone.32
-rw-r--r--lib/libc/gen/timezone.c1
-rw-r--r--lib/libc/gen/ualarm.32
-rw-r--r--lib/libc/i386/DEFS.h57
-rw-r--r--lib/libc/i386/SYS.h28
-rw-r--r--lib/libc/i386/gen/_setjmp.S (renamed from lib/libc/i386/gen/_setjmp.s)0
-rw-r--r--lib/libc/i386/gen/alloca.S (renamed from lib/libc/i386/gen/alloca.s)0
-rw-r--r--lib/libc/i386/gen/divsi3.S (renamed from lib/libc/i386/gen/divsi3.s)1
-rw-r--r--lib/libc/i386/gen/fabs.S (renamed from lib/libc/i386/gen/fabs.s)0
-rw-r--r--lib/libc/i386/gen/fixdfsi.S (renamed from lib/libc/i386/gen/fixdfsi.s)1
-rw-r--r--lib/libc/i386/gen/fixunsdfsi.S82
-rw-r--r--lib/libc/i386/gen/fixunsdfsi.s50
-rw-r--r--lib/libc/i386/gen/modf.S (renamed from lib/libc/i386/gen/modf.s)1
-rw-r--r--lib/libc/i386/gen/setjmp.S (renamed from lib/libc/i386/gen/setjmp.s)5
-rw-r--r--lib/libc/i386/gen/sigsetjmp.S (renamed from lib/libc/i386/gen/sigsetjmp.s)9
-rw-r--r--lib/libc/i386/gen/udivsi3.S (renamed from lib/libc/i386/gen/udivsi3.s)1
-rw-r--r--lib/libc/i386/net/htonl.S (renamed from lib/libc/i386/net/htonl.s)0
-rw-r--r--lib/libc/i386/net/htons.S (renamed from lib/libc/i386/net/htons.s)0
-rw-r--r--lib/libc/i386/net/ntohl.S (renamed from lib/libc/i386/net/ntohl.s)0
-rw-r--r--lib/libc/i386/net/ntohs.S (renamed from lib/libc/i386/net/ntohs.s)0
-rw-r--r--lib/libc/i386/stdlib/abs.S (renamed from lib/libc/i386/stdlib/abs.s)0
-rw-r--r--lib/libc/i386/stdlib/div.S (renamed from lib/libc/i386/stdlib/div.s)4
-rw-r--r--lib/libc/i386/stdlib/labs.S (renamed from lib/libc/i386/stdlib/labs.s)0
-rw-r--r--lib/libc/i386/stdlib/ldiv.S (renamed from lib/libc/i386/stdlib/ldiv.s)4
-rw-r--r--lib/libc/i386/string/bcmp.S (renamed from lib/libc/i386/string/bcmp.s)4
-rw-r--r--lib/libc/i386/string/bcopy.S (renamed from lib/libc/i386/string/bcopy.s)4
-rw-r--r--lib/libc/i386/string/bzero.S (renamed from lib/libc/i386/string/bzero.s)4
-rw-r--r--lib/libc/i386/string/ffs.S (renamed from lib/libc/i386/string/ffs.s)4
-rw-r--r--lib/libc/i386/string/index.S (renamed from lib/libc/i386/string/index.s)4
-rw-r--r--lib/libc/i386/string/memchr.S (renamed from lib/libc/i386/string/memchr.s)4
-rw-r--r--lib/libc/i386/string/memcmp.S (renamed from lib/libc/i386/string/memcmp.s)8
-rw-r--r--lib/libc/i386/string/memmove.S (renamed from lib/libc/i386/string/memmove.s)4
-rw-r--r--lib/libc/i386/string/memset.S (renamed from lib/libc/i386/string/memset.s)4
-rw-r--r--lib/libc/i386/string/rindex.S (renamed from lib/libc/i386/string/rindex.s)4
-rw-r--r--lib/libc/i386/string/strcat.S (renamed from lib/libc/i386/string/strcat.s)4
-rw-r--r--lib/libc/i386/string/strchr.S (renamed from lib/libc/i386/string/strchr.s)4
-rw-r--r--lib/libc/i386/string/strcmp.S (renamed from lib/libc/i386/string/strcmp.s)8
-rw-r--r--lib/libc/i386/string/strcpy.S (renamed from lib/libc/i386/string/strcpy.s)4
-rw-r--r--lib/libc/i386/string/strlen.S (renamed from lib/libc/i386/string/strlen.s)4
-rw-r--r--lib/libc/i386/string/strncmp.S (renamed from lib/libc/i386/string/strncmp.s)8
-rw-r--r--lib/libc/i386/string/strrchr.S (renamed from lib/libc/i386/string/strrchr.s)4
-rw-r--r--lib/libc/i386/sys/Makefile.inc10
-rw-r--r--lib/libc/i386/sys/Ovfork.S (renamed from lib/libc/i386/sys/Ovfork.s)10
-rw-r--r--lib/libc/i386/sys/brk.S (renamed from lib/libc/i386/sys/brk.s)26
-rw-r--r--lib/libc/i386/sys/cerror.S (renamed from lib/libc/i386/sys/cerror.s)9
-rw-r--r--lib/libc/i386/sys/exect.S (renamed from lib/libc/i386/sys/exect.s)2
-rw-r--r--lib/libc/i386/sys/fork.S (renamed from lib/libc/i386/sys/fork.s)2
-rw-r--r--lib/libc/i386/sys/i386_get_ldt.298
-rw-r--r--lib/libc/i386/sys/i386_get_ldt.c50
-rw-r--r--lib/libc/i386/sys/i386_set_ldt.c50
-rw-r--r--lib/libc/i386/sys/mount.S (renamed from lib/libc/i386/sys/mount.s)2
-rw-r--r--lib/libc/i386/sys/pipe.S (renamed from lib/libc/i386/sys/pipe.s)2
-rw-r--r--lib/libc/i386/sys/ptrace.S (renamed from lib/libc/i386/sys/ptrace.s)11
-rw-r--r--lib/libc/i386/sys/reboot.S (renamed from lib/libc/i386/sys/reboot.s)2
-rw-r--r--lib/libc/i386/sys/sbrk.S (renamed from lib/libc/i386/sys/sbrk.s)24
-rw-r--r--lib/libc/i386/sys/setlogin.S (renamed from lib/libc/i386/sys/setlogin.s)11
-rw-r--r--lib/libc/i386/sys/sigpending.S (renamed from lib/libc/i386/sys/sigpending.s)2
-rw-r--r--lib/libc/i386/sys/sigprocmask.S (renamed from lib/libc/i386/sys/sigprocmask.s)2
-rw-r--r--lib/libc/i386/sys/sigreturn.S (renamed from lib/libc/i386/sys/sigreturn.s)2
-rw-r--r--lib/libc/i386/sys/sigsuspend.S (renamed from lib/libc/i386/sys/sigsuspend.s)0
-rw-r--r--lib/libc/i386/sys/syscall.S (renamed from lib/libc/i386/sys/syscall.s)2
-rw-r--r--lib/libc/net/Makefile.inc2
-rw-r--r--lib/libc/net/gethostbyname.32
-rw-r--r--lib/libc/quad/Makefile.inc10
-rw-r--r--lib/libc/quad/TESTS/Makefile11
-rw-r--r--lib/libc/quad/TESTS/divrem.c (renamed from lib/libtelnet/getent.c)70
-rw-r--r--lib/libc/quad/TESTS/mul.c (renamed from lib/libcurses/mvprintw.c)93
-rw-r--r--lib/libc/quad/adddi3.c60
-rw-r--r--lib/libc/quad/anddi3.c58
-rw-r--r--lib/libc/quad/ashldi3.c66
-rw-r--r--lib/libc/quad/ashrdi3.c75
-rw-r--r--lib/libc/quad/cmpdi2.c59
-rw-r--r--lib/libc/quad/divdi3.c65
-rw-r--r--lib/libc/quad/fixdfdi.c62
-rw-r--r--lib/libc/quad/fixsfdi.c63
-rw-r--r--lib/libc/quad/fixunsdfdi.c96
-rw-r--r--lib/libc/quad/fixunssfdi.c100
-rw-r--r--lib/libc/quad/floatdidf.c74
-rw-r--r--lib/libc/quad/floatdisf.c76
-rw-r--r--lib/libc/quad/floatunsdidf.c59
-rw-r--r--lib/libc/quad/iordi3.c58
-rw-r--r--lib/libc/quad/lshldi3.c66
-rw-r--r--lib/libc/quad/lshrdi3.c65
-rw-r--r--lib/libc/quad/moddi3.c67
-rw-r--r--lib/libc/quad/muldi3.c246
-rw-r--r--lib/libc/quad/negdi2.c57
-rw-r--r--lib/libc/quad/notdi2.c58
-rw-r--r--lib/libc/quad/qdivrem.c279
-rw-r--r--lib/libc/quad/quad.h112
-rw-r--r--lib/libc/quad/subdi3.c59
-rw-r--r--lib/libc/quad/ucmpdi2.c58
-rw-r--r--lib/libc/quad/udivdi3.c53
-rw-r--r--lib/libc/quad/umoddi3.c55
-rw-r--r--lib/libc/quad/xordi3.c58
-rw-r--r--lib/libc/regex/Makefile.inc13
-rw-r--r--lib/libc/regex/WHATSNEW72
-rw-r--r--lib/libc/regex/cclass.h70
-rw-r--r--lib/libc/regex/cname.h141
-rw-r--r--lib/libc/regex/engine.c1075
-rw-r--r--lib/libc/regex/regcomp.c1653
-rw-r--r--lib/libc/regex/regerror.c171
-rw-r--r--lib/libc/regex/regex.3502
-rw-r--r--lib/libc/regex/regex.7231
-rw-r--r--lib/libc/regex/regex.h108
-rw-r--r--lib/libc/regex/regex2.h173
-rw-r--r--lib/libc/regex/regexec.c182
-rw-r--r--lib/libc/regex/regfree.c (renamed from lib/libc/db/PORT/include/ndbm.h)71
-rw-r--r--lib/libc/regex/tests448
-rw-r--r--lib/libc/regex/utils.h50
-rw-r--r--lib/libc/rpc/DISCLAIMER (renamed from lib/librpc/DISCLAIMER)0
-rw-r--r--lib/libc/rpc/Makefile.inc (renamed from lib/librpc/rpc/Makefile)29
-rw-r--r--lib/libc/rpc/README (renamed from lib/librpc/README)0
-rw-r--r--lib/libc/rpc/auth.h (renamed from lib/librpc/rpc/auth.h)2
-rw-r--r--lib/libc/rpc/auth_none.c (renamed from lib/librpc/rpc/auth_none.c)2
-rw-r--r--lib/libc/rpc/auth_unix.c (renamed from lib/librpc/rpc/auth_unix.c)2
-rw-r--r--lib/libc/rpc/auth_unix.h (renamed from lib/librpc/rpc/auth_unix.h)2
-rw-r--r--lib/libc/rpc/authunix_prot.c (renamed from lib/librpc/rpc/authunix_prot.c)2
-rw-r--r--lib/libc/rpc/bindresvport.3 (renamed from lib/librpc/man/man3/bindresvport.3n)0
-rw-r--r--lib/libc/rpc/bindresvport.c (renamed from lib/librpc/rpc/bindresvport.c)2
-rw-r--r--lib/libc/rpc/clnt.h (renamed from lib/librpc/rpc/clnt.h)2
-rw-r--r--lib/libc/rpc/clnt_generic.c (renamed from lib/librpc/rpc/clnt_generic.c)2
-rw-r--r--lib/libc/rpc/clnt_perror.c (renamed from lib/librpc/rpc/clnt_perror.c)2
-rw-r--r--lib/libc/rpc/clnt_raw.c (renamed from lib/librpc/rpc/clnt_raw.c)2
-rw-r--r--lib/libc/rpc/clnt_simple.c (renamed from lib/librpc/rpc/clnt_simple.c)2
-rw-r--r--lib/libc/rpc/clnt_tcp.c (renamed from lib/librpc/rpc/clnt_tcp.c)2
-rw-r--r--lib/libc/rpc/clnt_udp.c (renamed from lib/librpc/rpc/clnt_udp.c)2
-rw-r--r--lib/libc/rpc/get_myaddress.c (renamed from lib/librpc/rpc/get_myaddress.c)2
-rw-r--r--lib/libc/rpc/getrpcent.3 (renamed from lib/librpc/man/man3/getrpcent.3n)0
-rw-r--r--lib/libc/rpc/getrpcent.c (renamed from lib/librpc/rpc/getrpcent.c)2
-rw-r--r--lib/libc/rpc/getrpcport.3 (renamed from lib/librpc/man/man3/getrpcport.3r)0
-rw-r--r--lib/libc/rpc/getrpcport.c (renamed from lib/librpc/rpc/getrpcport.c)2
-rw-r--r--lib/libc/rpc/pmap_clnt.c (renamed from lib/librpc/rpc/pmap_clnt.c)2
-rw-r--r--lib/libc/rpc/pmap_clnt.h (renamed from lib/librpc/rpc/pmap_clnt.h)2
-rw-r--r--lib/libc/rpc/pmap_getmaps.c (renamed from lib/librpc/rpc/pmap_getmaps.c)2
-rw-r--r--lib/libc/rpc/pmap_getport.c (renamed from lib/librpc/rpc/pmap_getport.c)2
-rw-r--r--lib/libc/rpc/pmap_prot.c (renamed from lib/librpc/rpc/pmap_prot.c)2
-rw-r--r--lib/libc/rpc/pmap_prot.h (renamed from lib/librpc/rpc/pmap_prot.h)2
-rw-r--r--lib/libc/rpc/pmap_prot2.c (renamed from lib/librpc/rpc/pmap_prot2.c)2
-rw-r--r--lib/libc/rpc/pmap_rmt.c (renamed from lib/librpc/rpc/pmap_rmt.c)2
-rw-r--r--lib/libc/rpc/pmap_rmt.h (renamed from lib/librpc/rpc/pmap_rmt.h)2
-rw-r--r--lib/libc/rpc/rpc.3 (renamed from lib/librpc/man/man3/rpc.3n)0
-rw-r--r--lib/libc/rpc/rpc.5 (renamed from lib/librpc/man/man5/rpc.5)0
-rw-r--r--lib/libc/rpc/rpc.h (renamed from lib/librpc/rpc/rpc.h)2
-rw-r--r--lib/libc/rpc/rpc_callmsg.c (renamed from lib/librpc/rpc/rpc_callmsg.c)2
-rw-r--r--lib/libc/rpc/rpc_commondata.c (renamed from lib/librpc/rpc/rpc_commondata.c)2
-rw-r--r--lib/libc/rpc/rpc_dtablesize.c (renamed from lib/librpc/rpc/rpc_dtablesize.c)2
-rw-r--r--lib/libc/rpc/rpc_msg.h (renamed from lib/librpc/rpc/rpc_msg.h)2
-rw-r--r--lib/libc/rpc/rpc_prot.c (renamed from lib/librpc/rpc/rpc_prot.c)2
-rw-r--r--lib/libc/rpc/rstat.1 (renamed from lib/librpc/man/man1/rstat.1)0
-rw-r--r--lib/libc/rpc/rstat_svc.8 (renamed from lib/librpc/man/man8/rstat_svc.8c)0
-rw-r--r--lib/libc/rpc/svc.c (renamed from lib/librpc/rpc/svc.c)2
-rw-r--r--lib/libc/rpc/svc.h (renamed from lib/librpc/rpc/svc.h)2
-rw-r--r--lib/libc/rpc/svc_auth.c (renamed from lib/librpc/rpc/svc_auth.c)2
-rw-r--r--lib/libc/rpc/svc_auth.h (renamed from lib/librpc/rpc/svc_auth.h)2
-rw-r--r--lib/libc/rpc/svc_auth_unix.c (renamed from lib/librpc/rpc/svc_auth_unix.c)2
-rw-r--r--lib/libc/rpc/svc_raw.c (renamed from lib/librpc/rpc/svc_raw.c)2
-rw-r--r--lib/libc/rpc/svc_run.c (renamed from lib/librpc/rpc/svc_run.c)2
-rw-r--r--lib/libc/rpc/svc_simple.c (renamed from lib/librpc/rpc/svc_simple.c)2
-rw-r--r--lib/libc/rpc/svc_tcp.c (renamed from lib/librpc/rpc/svc_tcp.c)2
-rw-r--r--lib/libc/rpc/svc_udp.c (renamed from lib/librpc/rpc/svc_udp.c)2
-rw-r--r--lib/libc/rpc/types.h (renamed from lib/librpc/rpc/types.h)2
-rw-r--r--lib/libc/rpc/xdr.3 (renamed from lib/librpc/man/man3/xdr.3n)0
-rw-r--r--lib/libc/rpc/xdr.c (renamed from lib/librpc/rpc/xdr.c)2
-rw-r--r--lib/libc/rpc/xdr.h (renamed from lib/librpc/rpc/xdr.h)2
-rw-r--r--lib/libc/rpc/xdr_array.c (renamed from lib/librpc/rpc/xdr_array.c)2
-rw-r--r--lib/libc/rpc/xdr_float.c (renamed from lib/librpc/rpc/xdr_float.c)2
-rw-r--r--lib/libc/rpc/xdr_mem.c (renamed from lib/librpc/rpc/xdr_mem.c)2
-rw-r--r--lib/libc/rpc/xdr_rec.c (renamed from lib/librpc/rpc/xdr_rec.c)2
-rw-r--r--lib/libc/rpc/xdr_reference.c (renamed from lib/librpc/rpc/xdr_reference.c)2
-rw-r--r--lib/libc/rpc/xdr_stdio.c (renamed from lib/librpc/rpc/xdr_stdio.c)2
-rw-r--r--lib/libc/stdio/ferror.32
-rw-r--r--lib/libc/stdio/fgets.32
-rw-r--r--lib/libc/stdio/setvbuf.c5
-rw-r--r--lib/libc/stdio/stdio.32
-rw-r--r--lib/libc/stdio/strerror.34
-rw-r--r--lib/libc/stdio/tempnam.c22
-rw-r--r--lib/libc/stdio/vfprintf.c58
-rw-r--r--lib/libc/stdlib/Makefile.inc6
-rw-r--r--lib/libc/stdlib/bsearch.32
-rw-r--r--lib/libc/stdlib/exit.c2
-rw-r--r--lib/libc/stdlib/getopt.3164
-rw-r--r--lib/libc/stdlib/getopt.c44
-rw-r--r--lib/libc/stdlib/rand48.33
-rw-r--r--lib/libc/stdlib/random.32
-rw-r--r--lib/libc/stdlib/realloc.32
-rw-r--r--lib/libc/stdlib/setenv.c3
-rw-r--r--lib/libc/stdlib/strtol.c2
-rw-r--r--lib/libc/stdlib/strtoq.c136
-rw-r--r--lib/libc/stdlib/strtoul.c2
-rw-r--r--lib/libc/stdlib/strtouq.c114
-rw-r--r--lib/libc/string/Makefile.inc16
-rw-r--r--lib/libc/string/bzero.32
-rw-r--r--lib/libc/string/ffs.32
-rw-r--r--lib/libc/string/strchr.32
-rw-r--r--lib/libc/string/strsep.32
-rw-r--r--lib/libc/sys/Makefile.inc68
-rw-r--r--lib/libc/sys/accept.22
-rw-r--r--lib/libc/sys/acct.23
-rw-r--r--lib/libc/sys/brk.212
-rw-r--r--lib/libc/sys/chown.22
-rw-r--r--lib/libc/sys/close.24
-rw-r--r--lib/libc/sys/execve.225
-rw-r--r--lib/libc/sys/fork.23
-rw-r--r--lib/libc/sys/getsockopt.22
-rw-r--r--lib/libc/sys/intro.24
-rw-r--r--lib/libc/sys/ioctl.23
-rw-r--r--lib/libc/sys/kill.22
-rw-r--r--lib/libc/sys/ktrace.266
-rw-r--r--lib/libc/sys/lseek.24
-rw-r--r--lib/libc/sys/mknod.23
-rw-r--r--lib/libc/sys/mount.23
-rw-r--r--lib/libc/sys/open.23
-rw-r--r--lib/libc/sys/pipe.23
-rw-r--r--lib/libc/sys/read.22
-rw-r--r--lib/libc/sys/setpgid.22
-rw-r--r--lib/libc/sys/setregid.250
-rw-r--r--lib/libc/sys/setreuid.245
-rw-r--r--lib/libc/sys/setsid.267
-rw-r--r--lib/libc/sys/sigaction.22
-rw-r--r--lib/libc/sys/sigsuspend.22
-rw-r--r--lib/libc/sys/socket.24
-rw-r--r--lib/libc/sys/stat.24
-rw-r--r--lib/libc/sys/statfs.25
-rw-r--r--lib/libc/sys/sync.23
-rw-r--r--lib/libc/sys/uname.230
-rw-r--r--lib/libc/sys/unlink.23
-rw-r--r--lib/libc/sys/wait.27
-rw-r--r--lib/libc/sys/write.22
-rw-r--r--lib/libc/yp/Makefile.inc8
-rw-r--r--lib/libc/yp/xdryp.c394
-rw-r--r--lib/libc/yp/yplib.c794
-rw-r--r--lib/libcurses/Makefile19
-rw-r--r--lib/libcurses/addbytes.c222
-rw-r--r--lib/libcurses/addch.c34
-rw-r--r--lib/libcurses/addnstr.c (renamed from lib/libcurses/endwin.c)44
-rw-r--r--lib/libcurses/box.c63
-rw-r--r--lib/libcurses/clear.c27
-rw-r--r--lib/libcurses/clrtobot.c55
-rw-r--r--lib/libcurses/clrtoeol.c70
-rw-r--r--lib/libcurses/cr_put.c281
-rw-r--r--lib/libcurses/cr_tty.c239
-rw-r--r--lib/libcurses/ctrace.c (renamed from lib/libcurses/curses.ext)60
-rw-r--r--lib/libcurses/cur_hash.c (renamed from lib/libcurses/addstr.c)43
-rw-r--r--lib/libcurses/curses.38
-rw-r--r--lib/libcurses/curses.c84
-rw-r--r--lib/libcurses/curses.h473
-rw-r--r--lib/libcurses/delch.c41
-rw-r--r--lib/libcurses/deleteln.c69
-rw-r--r--lib/libcurses/delwin.c56
-rw-r--r--lib/libcurses/erase.c53
-rw-r--r--lib/libcurses/fullname.c37
-rw-r--r--lib/libcurses/getch.c59
-rw-r--r--lib/libcurses/getstr.c28
-rw-r--r--lib/libcurses/id_subwins.c42
-rw-r--r--lib/libcurses/idlok.c26
-rw-r--r--lib/libcurses/initscr.c99
-rw-r--r--lib/libcurses/insch.c56
-rw-r--r--lib/libcurses/insertln.c67
-rw-r--r--lib/libcurses/longname.c28
-rw-r--r--lib/libcurses/move.c40
-rw-r--r--lib/libcurses/mvscanw.c97
-rw-r--r--lib/libcurses/mvwin.c67
-rw-r--r--lib/libcurses/newwin.c339
-rw-r--r--lib/libcurses/overlay.c67
-rw-r--r--lib/libcurses/overwrite.c59
-rw-r--r--lib/libcurses/printw.c146
-rw-r--r--lib/libcurses/putchar.c21
-rw-r--r--lib/libcurses/refresh.c898
-rw-r--r--lib/libcurses/scanw.c112
-rw-r--r--lib/libcurses/scroll.c38
-rw-r--r--lib/libcurses/setterm.c230
-rw-r--r--lib/libcurses/standout.c39
-rw-r--r--lib/libcurses/toucholap.c66
-rw-r--r--lib/libcurses/touchwin.c112
-rw-r--r--lib/libcurses/tscroll.c140
-rw-r--r--lib/libcurses/tstp.c117
-rw-r--r--lib/libcurses/tty.c277
-rw-r--r--lib/libcurses/unctrl.c90
-rw-r--r--lib/libf2c/Makefile37
-rw-r--r--lib/libm/common_source/exp.32
-rw-r--r--lib/libm/common_source/j0.34
-rw-r--r--lib/libm/common_source/pow.c4
-rw-r--r--lib/libpthread/COPYRIGHT31
-rw-r--r--lib/libpthread/Makefile22
-rw-r--r--lib/libpthread/README88
-rw-r--r--lib/libpthread/arch/i386/Makefile.inc5
-rw-r--r--lib/libpthread/arch/i386/machdep.c102
-rw-r--r--lib/libpthread/arch/i386/machdep.h58
-rw-r--r--lib/libpthread/arch/i386/syscall.S168
-rw-r--r--lib/libpthread/include/Makefile.inc30
-rw-r--r--lib/libpthread/include/cond.h89
-rw-r--r--lib/libpthread/include/engine.h86
-rw-r--r--lib/libpthread/include/fd.h104
-rw-r--r--lib/libpthread/include/fd_pipe.h52
-rw-r--r--lib/libpthread/include/kernel.h48
-rw-r--r--lib/libpthread/include/mutex.h91
-rw-r--r--lib/libpthread/include/posix.h19
-rw-r--r--lib/libpthread/include/pthread.h146
-rw-r--r--lib/libpthread/include/pthread_attr.h71
-rw-r--r--lib/libpthread/include/pthread_once.h51
-rw-r--r--lib/libpthread/include/queue.h65
-rw-r--r--lib/libpthread/include/stdio.h353
-rw-r--r--lib/libpthread/include/util.h87
-rw-r--r--lib/libpthread/pthreads/Makefile.inc13
-rw-r--r--lib/libpthread/pthreads/cond.c204
-rw-r--r--lib/libpthread/pthreads/fd.c558
-rw-r--r--lib/libpthread/pthreads/fd_kern.c643
-rw-r--r--lib/libpthread/pthreads/fd_pipe.c264
-rw-r--r--lib/libpthread/pthreads/file.c113
-rw-r--r--lib/libpthread/pthreads/globals.c63
-rw-r--r--lib/libpthread/pthreads/malloc.c357
-rw-r--r--lib/libpthread/pthreads/mutex.c223
-rw-r--r--lib/libpthread/pthreads/pthread.c200
-rw-r--r--lib/libpthread/pthreads/pthread_attr.c96
-rw-r--r--lib/libpthread/pthreads/pthread_detach.c86
-rw-r--r--lib/libpthread/pthreads/pthread_join.c109
-rw-r--r--lib/libpthread/pthreads/pthread_once.c57
-rw-r--r--lib/libpthread/pthreads/queue.c119
-rw-r--r--lib/libpthread/pthreads/signal.c426
-rw-r--r--lib/libpthread/pthreads/sleep.c227
-rw-r--r--lib/libpthread/stdio/Makefile.inc18
-rw-r--r--lib/libpthread/stdio/README37
-rw-r--r--lib/libpthread/stdio/clrerr.c50
-rw-r--r--lib/libpthread/stdio/fclose.c71
-rw-r--r--lib/libpthread/stdio/fdopen.c92
-rw-r--r--lib/libpthread/stdio/feof.c54
-rw-r--r--lib/libpthread/stdio/ferror.c54
-rw-r--r--lib/libpthread/stdio/fflush.c97
-rw-r--r--lib/libpthread/stdio/fgetc.c51
-rw-r--r--lib/libpthread/stdio/fgetline.c169
-rw-r--r--lib/libpthread/stdio/fgetpos.c50
-rw-r--r--lib/libpthread/stdio/fgets.c108
-rw-r--r--lib/libpthread/stdio/fileno.c54
-rw-r--r--lib/libpthread/stdio/findfp.c151
-rw-r--r--lib/libpthread/stdio/flags.c90
-rw-r--r--lib/libpthread/stdio/floatio.h47
-rw-r--r--lib/libpthread/stdio/fopen.c89
-rw-r--r--lib/libpthread/stdio/fprintf.c70
-rw-r--r--lib/libpthread/stdio/fpurge.c72
-rw-r--r--lib/libpthread/stdio/fputc.c54
-rw-r--r--lib/libpthread/stdio/fputs.c66
-rw-r--r--lib/libpthread/stdio/fread.c83
-rw-r--r--lib/libpthread/stdio/freopen.c146
-rw-r--r--lib/libpthread/stdio/fscanf.c72
-rw-r--r--lib/libpthread/stdio/fseek.c246
-rw-r--r--lib/libpthread/stdio/fsetpos.c53
-rw-r--r--lib/libpthread/stdio/ftell.c89
-rw-r--r--lib/libpthread/stdio/funopen.c100
-rw-r--r--lib/libpthread/stdio/fvwrite.c188
-rw-r--r--lib/libpthread/stdio/fvwrite.h54
-rw-r--r--lib/libpthread/stdio/fwalk.c131
-rw-r--r--lib/libpthread/stdio/fwrite.c77
-rw-r--r--lib/libpthread/stdio/getc.c57
-rw-r--r--lib/libpthread/stdio/getc_unlocked.c54
-rw-r--r--lib/libpthread/stdio/getchar.c57
-rw-r--r--lib/libpthread/stdio/getchar_unlocked.c53
-rw-r--r--lib/libpthread/stdio/gets.c69
-rw-r--r--lib/libpthread/stdio/getw.c50
-rw-r--r--lib/libpthread/stdio/glue.h48
-rw-r--r--lib/libpthread/stdio/local.h88
-rw-r--r--lib/libpthread/stdio/makebuf.c119
-rw-r--r--lib/libpthread/stdio/mktemp.c (renamed from lib/libc/db/PORT/clib/mktemp.c)8
-rw-r--r--lib/libpthread/stdio/perror.c67
-rw-r--r--lib/libpthread/stdio/perror.c.old77
-rw-r--r--lib/libpthread/stdio/printf.c54
-rw-r--r--lib/libpthread/stdio/putc.c59
-rw-r--r--lib/libpthread/stdio/putc_unlocked.c55
-rw-r--r--lib/libpthread/stdio/putchar.c59
-rw-r--r--lib/libpthread/stdio/putchar_unlocked.c55
-rw-r--r--lib/libpthread/stdio/puts.c70
-rw-r--r--lib/libpthread/stdio/putw.c63
-rw-r--r--lib/libpthread/stdio/refill.c183
-rw-r--r--lib/libpthread/stdio/remove.c48
-rw-r--r--lib/libpthread/stdio/rewind.c54
-rw-r--r--lib/libpthread/stdio/rget.c57
-rw-r--r--lib/libpthread/stdio/scanf.c71
-rw-r--r--lib/libpthread/stdio/setbuf.c51
-rw-r--r--lib/libpthread/stdio/setbuffer.c63
-rw-r--r--lib/libpthread/stdio/setvbuf.c153
-rw-r--r--lib/libpthread/stdio/snprintf.c77
-rw-r--r--lib/libpthread/stdio/sprintf.c76
-rw-r--r--lib/libpthread/stdio/sscanf.c78
-rw-r--r--lib/libpthread/stdio/stdio.c92
-rw-r--r--lib/libpthread/stdio/strerror.c67
-rw-r--r--lib/libpthread/stdio/tempnam.c87
-rw-r--r--lib/libpthread/stdio/tmpfile.c80
-rw-r--r--lib/libpthread/stdio/tmpnam.c55
-rw-r--r--lib/libpthread/stdio/ungetc.c154
-rw-r--r--lib/libpthread/stdio/vfprintf.c774
-rw-r--r--lib/libpthread/stdio/vfscanf.c749
-rw-r--r--lib/libpthread/stdio/vprintf.c49
-rw-r--r--lib/libpthread/stdio/vscanf.c53
-rw-r--r--lib/libpthread/stdio/vsnprintf.c61
-rw-r--r--lib/libpthread/stdio/vsprintf.c59
-rw-r--r--lib/libpthread/stdio/vsscanf.c60
-rw-r--r--lib/libpthread/stdio/wbuf.c88
-rw-r--r--lib/libpthread/stdio/wsetup.c92
-rw-r--r--lib/librpc/Makefile3
-rw-r--r--lib/librpc/man/Makefile3
-rw-r--r--lib/librpc/man/man1/Makefile3
-rw-r--r--lib/librpc/man/man1/rpcgen.1175
-rw-r--r--lib/librpc/man/man3/Makefile3
-rw-r--r--lib/librpc/man/man5/Makefile3
-rw-r--r--lib/librpc/man/man8/Makefile3
-rw-r--r--lib/librpc/man/man8/portmap.8c53
-rw-r--r--lib/librpc/man/man8/rpcinfo.8c183
-rw-r--r--lib/librpcsvc/Makefile2
-rw-r--r--lib/libtelnet/Makefile2
-rw-r--r--lib/libterm/Makefile19
-rw-r--r--lib/libterm/termcap.32
-rw-r--r--lib/libterm/termcap.c4
-rw-r--r--lib/libutil/Makefile14
-rw-r--r--lib/libutil/config.c202
-rw-r--r--lib/libutil/config_open.3103
-rw-r--r--lib/libutil/daemon.361
-rw-r--r--lib/libutil/daemon.c4
-rw-r--r--lib/libutil/getloadavg.33
-rw-r--r--lib/libutil/getloadavg.c2
-rw-r--r--lib/libutil/kvm.c741
-rw-r--r--lib/libutil/login.c2
-rw-r--r--lib/libutil/login_tty.c2
-rw-r--r--lib/libutil/logout.c2
-rw-r--r--lib/libutil/logwtmp.c2
-rw-r--r--lib/libutil/osname.347
-rw-r--r--lib/libutil/osname.c43
-rw-r--r--lib/libutil/pty.c2
-rw-r--r--lib/libutil/pwcache.33
-rw-r--r--lib/libutil/pwcache.c4
689 files changed, 37661 insertions, 21317 deletions
diff --git a/lib/Makefile b/lib/Makefile
index 8995044c55d5..29043c1fd223 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -1,7 +1,7 @@
# @(#)Makefile 5.25.1.1 (Berkeley) 5/7/91
-SUBDIR= csu.${MACHINE} libc libcurses libm \
- libresolv librpc librpcsvc libtelnet libterm libutil liby
+SUBDIR= csu.${MACHINE} libc libcurses libm libpthread \
+ libresolv librpcsvc libtelnet libterm libutil liby
.if exists(libcrypt)
.if !defined(NOCRYPT)
@@ -9,4 +9,10 @@ SUBDIR+= libcrypt
.endif
.endif
+.if !defined(SPLIT_F2C)
+SUBDIR+= libf2c
+.else
+SUBDIR+= libI77 libF77
+.endif
+
.include <bsd.subdir.mk>
diff --git a/lib/Makefile.inc b/lib/Makefile.inc
new file mode 100644
index 000000000000..8e9d1e78a221
--- /dev/null
+++ b/lib/Makefile.inc
@@ -0,0 +1,3 @@
+# Default version for system libs (override in <lib>/Makefile if necessary)
+SHLIB_MAJOR?= 1
+SHLIB_MINOR?= 0
diff --git a/lib/csu.i386/Makefile b/lib/csu.i386/Makefile
index aeb328edc755..503ad9753294 100644
--- a/lib/csu.i386/Makefile
+++ b/lib/csu.i386/Makefile
@@ -1,16 +1,22 @@
-# @(#)Makefile 5.6 (Berkeley) 5/22/91
+# from: @(#)Makefile 5.6 (Berkeley) 5/22/91
+# $Id: Makefile,v 1.8 1993/12/24 02:11:37 jkh Exp $
-CFLAGS= -O -DLIBC_SCCS
-OBJS= crt0.o gcrt0.o
+CFLAGS+= -DLIBC_SCCS -DDYNAMIC
+OBJS= crt0.o gcrt0.o crt1.so
CLEANFILES+= gmon.o moncrt0.o core a.out
all: ${OBJS}
crt0.o: crt0.c
- ${CC} ${CFLAGS} -c -DCRT0 ${.ALLSRC}
+ ${CC} ${CFLAGS} -c -DCRT0 ${.ALLSRC} -o ${.TARGET}
${LD} -x -r ${.TARGET}
mv a.out ${.TARGET}
+crt1.so: crt1.c
+ ${CC} ${CFLAGS} -fpic -c ${.ALLSRC} -o ${.TARGET}
+ ${LD} -X -r ${.TARGET}
+ @mv a.out ${.TARGET}
+
moncrt0.o: crt0.c
${CC} ${CFLAGS} -c -DMCRT0 ${.ALLSRC} -o ${.TARGET}
${LD} -x -r ${.TARGET}
@@ -20,7 +26,7 @@ gcrt0.o: moncrt0.o gmon.o
${LD} -x -r -o ${.TARGET} moncrt0.o gmon.o
gmon.o: gmon.c gmon.h
- ${CC} -c ${DEFS} ${.IMPSRC}
+ ${CC} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET}
${LD} -x -r ${.TARGET}
mv a.out ${.TARGET}
diff --git a/lib/csu.i386/crt0.c b/lib/csu.i386/crt0.c
index 7c3cef10e6d6..93bb1e1ff7fb 100644
--- a/lib/csu.i386/crt0.c
+++ b/lib/csu.i386/crt0.c
@@ -1,5 +1,5 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
+/*
+ * Copyright (c) 1993 Paul Kranenburg
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -12,61 +12,105 @@
* 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 product includes software developed by Paul Kranenburg.
+ * 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.
*
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (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: crt0.c,v 1.9 1994/02/16 19:26:39 nate Exp $
*/
+
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)crt0.c 5.7 (Berkeley) 7/3/91";
+static char sccsid[] = "%W% (Erasmus) %G%";
#endif /* LIBC_SCCS and not lint */
+extern void exit();
+int _callmain();
-/*
- * C start up routine.
- * Robert Henry, UCB, 20 Oct 81
- *
- * We make the following (true) assumption:
- * 1) The only register variable that we can trust is the frame pointer,
- * ebp, which points to the base of the kernel calling frame.
- */
+#include <sys/param.h>
+
+#ifdef DYNAMIC
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <a.out.h>
+#ifndef N_GETMAGIC
+#define N_GETMAGIC(x) ((x).a_magic)
+#endif
+#ifndef N_BSSADDR
+#define N_BSSADDR(x) (N_DATADDR(x)+(x).a_data)
+#endif
+#include <sys/mman.h>
+#ifdef sun
+#define MAP_COPY MAP_PRIVATE
+#define MAP_FILE 0
+#define MAP_ANON 0
+#endif
+#include <link.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <string.h>
-
-char **environ = (char **)0;
-static char empty[1];
-char *__progname = empty;
-int errno = 0;
-
-asm(".text");
-asm(".long 0xc000c000");
-#if 1 /* more needed for alignment on i486/gcc-2.3.3 */
-asm(".long 0xc000c000");
-asm(".long 0xc000c000");
-asm(".long 0xc000c000");
+extern struct _dynamic _DYNAMIC;
+static struct ld_entry *ld_entry;
+static void __do_dynamic_link ();
+static char *_getenv();
+static int _strncmp();
+
+#ifdef sun
+#define LDSO "/usr/lib/ld.so"
+#endif
+#ifdef BSD
+#define LDSO "/usr/libexec/ld.so"
#endif
+#endif /* DYNAMIC */
+
+static char *_strrchr();
+
+char **environ;
+
+#ifdef BSD
extern unsigned char etext;
extern unsigned char eprol asm ("eprol");
extern start() asm("start");
extern mcount() asm ("mcount");
+int errno;
+static char empty[1];
+char *__progname = empty;
+#endif
+
+/*
+ * We need these system calls, but can't use library stubs
+ */
+#define _exit(v) __syscall(SYS_exit, (v))
+#define open(name, f, m) __syscall(SYS_open, (name), (f), (m))
+#define close(fd) __syscall(SYS_close, (fd))
+#define read(fd, s, n) __syscall(SYS_read, (fd), (s), (n))
+#define write(fd, s, n) __syscall(SYS_write, (fd), (s), (n))
+#define dup(fd) __syscall(SYS_dup, (fd))
+#define dup2(fd, fdnew) __syscall(SYS_dup2, (fd), (fdnew))
+#ifdef sun
+#define mmap(addr, len, prot, flags, fd, off) \
+ __syscall(SYS_mmap, (addr), (len), (prot), _MAP_NEW|(flags), (fd), (off))
+#else
+#define mmap(addr, len, prot, flags, fd, off) \
+ __syscall(SYS_mmap, (addr), (len), (prot), (flags), (fd), (off))
+#endif
+
+#define _FATAL(str) \
+ write(2, str, sizeof(str)), \
+ _exit(1);
+
+
start()
{
struct kframe {
@@ -82,44 +126,251 @@ start()
register char **targv;
register char **argv;
extern void _mcleanup();
+#ifdef DYNAMIC
+ volatile caddr_t x;
+#endif
#ifdef lint
kfp = 0;
initcode = initcode = 0;
-#else not lint
+#else /* not lint */
/* just above the saved frame pointer */
asm ("lea 4(%%ebp), %0" : "=r" (kfp) );
-#endif not lint
+#endif /* not lint */
for (argv = targv = &kfp->kargv[0]; *targv++; /* void */)
/* void */ ;
if (targv >= (char **)(*argv))
--targv;
environ = targv;
+
+ if (argv[0])
+ if ((__progname = _strrchr(argv[0], '/')) == NULL)
+ __progname = argv[0];
+ else
+ ++__progname;
+
+#ifdef DYNAMIC
+ /* ld(1) convention: if DYNAMIC = 0 then statically linked */
+#ifdef stupid_gcc
+ if (&_DYNAMIC)
+ __do_dynamic_link();
+#else
+ x = (caddr_t)&_DYNAMIC;
+ if (x)
+ __do_dynamic_link();
+#endif
+#endif /* DYNAMIC */
+
asm("eprol:");
#ifdef MCRT0
atexit(_mcleanup);
monstartup(&eprol, &etext);
#endif MCRT0
- errno = 0;
- if (argv[0])
- if ((__progname = strrchr(argv[0], '/')) == NULL)
- __progname = argv[0];
- else
- ++__progname;
+
+asm ("__callmain:"); /* Defined for the benefit of debuggers */
exit(main(kfp->kargc, argv, environ));
}
-#ifdef CRT0
+#ifdef DYNAMIC
+static void
+__do_dynamic_link ()
+{
+ struct crt_ldso crt;
+ struct exec hdr;
+ char *ldso;
+ int dupzfd;
+ int (*entry)();
+
+#ifdef DEBUG
+ /* Provision for alternate ld.so - security risk! */
+ if (!(ldso = _getenv("LDSO")))
+#endif
+ ldso = LDSO;
+
+ crt.crt_ldfd = open(ldso, 0, 0);
+ if (crt.crt_ldfd == -1) {
+ _FATAL("No ld.so\n");
+ }
+
+ /* Read LDSO exec header */
+ if (read(crt.crt_ldfd, &hdr, sizeof hdr) < sizeof hdr) {
+ _FATAL("Failure reading ld.so\n");
+ }
+ if ((N_GETMAGIC_NET(hdr) != ZMAGIC) && (N_GETMAGIC(hdr) != QMAGIC)) {
+ _FATAL("Bad magic: ld.so\n");
+ }
+
+ /* We use MAP_ANON */
+ crt.crt_dzfd = -1;
+
+ /* Map in ld.so */
+ crt.crt_ba = mmap(0, hdr.a_text,
+ PROT_READ|PROT_EXEC,
+ MAP_FILE|MAP_COPY,
+ crt.crt_ldfd, N_TXTOFF(hdr));
+ if (crt.crt_ba == -1) {
+ _FATAL("Cannot map ld.so\n");
+ }
+
+#ifdef BSD
+/* !!!
+ * This is gross, ld.so is a ZMAGIC a.out, but has `sizeof(hdr)' for
+ * an entry point and not at PAGSIZ as the N_*ADDR macros assume.
+ */
+#undef N_DATADDR
+#undef N_BSSADDR
+#define N_DATADDR(x) ((x).a_text)
+#define N_BSSADDR(x) ((x).a_text + (x).a_data)
+#endif
+
+ /* Map in data segment of ld.so writable */
+ if (mmap(crt.crt_ba+N_DATADDR(hdr), hdr.a_data,
+ PROT_READ|PROT_WRITE,
+ MAP_FIXED|MAP_FILE|MAP_COPY,
+ crt.crt_ldfd, N_DATOFF(hdr)) == -1) {
+ _FATAL("Cannot map ld.so\n");
+ }
+
+ /* Map bss segment of ld.so zero */
+ if (hdr.a_bss && mmap(crt.crt_ba+N_BSSADDR(hdr), hdr.a_bss,
+ PROT_READ|PROT_WRITE,
+ MAP_FIXED|MAP_ANON|MAP_COPY,
+ crt.crt_dzfd, 0) == -1) {
+ _FATAL("Cannot map ld.so\n");
+ }
+
+ crt.crt_dp = &_DYNAMIC;
+ crt.crt_ep = environ;
+ crt.crt_bp = (caddr_t)_callmain;
+ crt.crt_prog = __progname;
+
+ entry = (int (*)())(crt.crt_ba + sizeof hdr);
+ if ((*entry)(CRT_VERSION_BSD_3, &crt) == -1) {
+ _FATAL("ld.so failed\n");
+ }
+
+ ld_entry = _DYNAMIC.d_entry;
+ return;
+}
+
/*
- * null mcount and moncontrol,
- * just in case some routine is compiled for profiling
+ * DL stubs
*/
-moncontrol(val)
- int val;
+
+void *
+dlopen(name, mode)
+char *name;
+int mode;
+{
+ if (ld_entry == NULL)
+ return NULL;
+
+ return (ld_entry->dlopen)(name, mode);
+}
+
+int
+dlclose(fd)
+void *fd;
+{
+ if (ld_entry == NULL)
+ return -1;
+
+ return (ld_entry->dlclose)(fd);
+}
+
+void *
+dlsym(fd, name)
+void *fd;
+char *name;
+{
+ if (ld_entry == NULL)
+ return NULL;
+
+ return (ld_entry->dlsym)(fd, name);
+}
+
+int
+dlctl(fd, cmd, arg)
+void *fd, *arg;
+int cmd;
{
+ if (ld_entry == NULL)
+ return -1;
+ return (ld_entry->dlctl)(fd, cmd, arg);
}
-mcount() { }
-#endif CRT0
+/*
+ * Support routines
+ */
+
+static int
+_strncmp(s1, s2, n)
+ register char *s1, *s2;
+ register n;
+{
+
+ if (n == 0)
+ return (0);
+ do {
+ if (*s1 != *s2++)
+ return (*(unsigned char *)s1 - *(unsigned char *)--s2);
+ if (*s1++ == 0)
+ break;
+ } while (--n != 0);
+ return (0);
+}
+
+static char *
+_getenv(name)
+ register char *name;
+{
+ extern char **environ;
+ register int len;
+ register char **P, *C;
+
+ for (C = name, len = 0; *C && *C != '='; ++C, ++len);
+ for (P = environ; *P; ++P)
+ if (!_strncmp(*P, name, len))
+ if (*(C = *P + len) == '=') {
+ return(++C);
+ }
+ return (char *)0;
+}
+
+ asm(" ___syscall:");
+ asm(" popl %ecx");
+ asm(" popl %eax");
+ asm(" pushl %ecx");
+ asm(" .byte 0x9a");
+ asm(" .long 0");
+ asm(" .word 7");
+ asm(" pushl %ecx");
+ asm(" jc 1f");
+ asm(" ret");
+ asm(" 1:");
+ asm(" movl $-1,%eax");
+ asm(" ret");
+
+#endif /* DYNAMIC */
+
+static char *
+_strrchr(p, ch)
+register char *p, ch;
+{
+ register char *save;
+
+ for (save = NULL;; ++p) {
+ if (*p == ch)
+ save = (char *)p;
+ if (!*p)
+ return(save);
+ }
+/* NOTREACHED */
+}
+
+#ifdef MCRT0
+asm (" .text");
+asm ("_eprol:");
+#endif
diff --git a/lib/csu.i386/crt1.c b/lib/csu.i386/crt1.c
new file mode 100644
index 000000000000..bee2d1b6fb67
--- /dev/null
+++ b/lib/csu.i386/crt1.c
@@ -0,0 +1,47 @@
+typedef void (*func_ptr) (void);
+
+func_ptr __CTOR_LIST__[2];
+func_ptr __DTOR_LIST__[2];
+
+/* Run all the global destructors on exit from the program. */
+
+static void
+__do_global_dtors ()
+{
+ unsigned nptrs = (unsigned long) __DTOR_LIST__[0];
+ unsigned i;
+
+ /* Some systems place the number of pointers
+ in the first word of the table.
+ On other systems, that word is -1.
+ In all cases, the table is null-terminated. */
+
+ /* If the length is not recorded, count up to the null. */
+ if (nptrs == -1)
+ for (nptrs = 0; __DTOR_LIST__[nptrs + 1] != 0; nptrs++);
+
+ /* GNU LD format. */
+ for (i = nptrs; i >= 1; i--)
+ __DTOR_LIST__[i] ();
+
+}
+
+static void
+__do_global_ctors ()
+{
+ func_ptr *p;
+
+ for (p = __CTOR_LIST__ + 1; *p; )
+ (*p++)();
+ atexit (__do_global_dtors);
+}
+
+__init()
+{
+ static int initialized = 0;
+ if (! initialized) {
+ initialized = 1;
+ __do_global_ctors ();
+ }
+
+}
diff --git a/lib/csu.i386/gmon.c b/lib/csu.i386/gmon.c
index 55486881e133..852edba3ff27 100644
--- a/lib/csu.i386/gmon.c
+++ b/lib/csu.i386/gmon.c
@@ -32,7 +32,8 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gmon.c 5.3 (Berkeley) 5/22/91";
+/*static char sccsid[] = "from: @(#)gmon.c 5.3 (Berkeley) 5/22/91";*/
+static char rcsid[] = "$Id: gmon.c,v 1.2 1993/11/04 01:09:15 paul Exp $";
#endif /* LIBC_SCCS and not lint */
diff --git a/lib/csu.i386/gmon.h b/lib/csu.i386/gmon.h
index c89a721972bd..0dd05738220a 100644
--- a/lib/csu.i386/gmon.h
+++ b/lib/csu.i386/gmon.h
@@ -30,7 +30,8 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)gmon.h 5.2 (Berkeley) 5/6/91
+ * from: @(#)gmon.h 5.2 (Berkeley) 5/6/91
+ * $Id: gmon.h,v 1.2 1993/11/04 01:09:18 paul Exp $
*/
struct phdr {
diff --git a/lib/libF77/Makefile b/lib/libF77/Makefile
new file mode 100644
index 000000000000..9a790d656664
--- /dev/null
+++ b/lib/libF77/Makefile
@@ -0,0 +1,30 @@
+LIB=F77
+CFLAGS+= -DSkip_f2c_Undefs -DIEEE_drem
+
+MISC = Version.c main.c s_rnge.c abort_.c getarg_.c iargc_.c getenv_.c\
+ signal_.c s_stop.c s_paus.c system_.c cabs.c\
+ derf_.c derfc_.c erf_.c erfc_.c sig_die.c
+POW = pow_ci.c pow_dd.c pow_di.c pow_hh.c pow_ii.c pow_ri.c pow_zi.c pow_zz.c
+CX = c_abs.c c_cos.c c_div.c c_exp.c c_log.c c_sin.c c_sqrt.c
+DCX = z_cos.c z_div.c z_exp.c z_log.c z_sin.c z_sqrt.c
+REAL = r_abs.c r_acos.c r_asin.c r_atan.c r_atn2.c r_cnjg.c r_cos.c\
+ r_cosh.c r_dim.c r_exp.c r_imag.c r_int.c\
+ r_lg10.c r_log.c r_mod.c r_nint.c r_sign.c\
+ r_sin.c r_sinh.c r_sqrt.c r_tan.c r_tanh.c
+DBL = d_abs.c d_acos.c d_asin.c d_atan.c d_atn2.c\
+ d_cnjg.c d_cos.c d_cosh.c d_dim.c d_exp.c\
+ d_imag.c d_int.c d_lg10.c d_log.c d_mod.c\
+ d_nint.c d_prod.c d_sign.c d_sin.c d_sinh.c\
+ d_sqrt.c d_tan.c d_tanh.c
+INT = i_abs.c i_dim.c i_dnnt.c i_indx.c i_len.c i_mod.c i_nint.c i_sign.c
+HALF = h_abs.c h_dim.c h_dnnt.c h_indx.c h_len.c h_mod.c h_nint.c h_sign.c
+CMP = l_ge.c l_gt.c l_le.c l_lt.c hl_ge.c hl_gt.c hl_le.c hl_lt.c
+EFL = ef1asc_.c ef1cmc_.c
+CHAR = s_cat.c s_cmp.c s_copy.c
+
+F77SRCS= $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) \
+ $(HALF) $(CMP) $(EFL) $(CHAR)
+
+SRCS= ${F77SRCS} ${I77SRCS}
+
+.include <bsd.lib.mk>
diff --git a/lib/libF77/Notice b/lib/libF77/Notice
new file mode 100644
index 000000000000..64af9f12dc4e
--- /dev/null
+++ b/lib/libF77/Notice
@@ -0,0 +1,23 @@
+/****************************************************************
+Copyright 1990, 1991, 1992, 1993 by AT&T Bell Laboratories and Bellcore.
+
+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 appear in all
+copies and that both that the copyright notice and this
+permission notice and warranty disclaimer appear in supporting
+documentation, and that the names of AT&T Bell Laboratories or
+Bellcore or any of their entities not be used in advertising or
+publicity pertaining to distribution of the software without
+specific, written prior permission.
+
+AT&T and Bellcore disclaim all warranties with regard to this
+software, including all implied warranties of merchantability
+and fitness. In no event shall AT&T or Bellcore be liable for
+any special, 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.
+****************************************************************/
+
diff --git a/lib/libF77/README b/lib/libF77/README
new file mode 100644
index 000000000000..4bf21f998d5b
--- /dev/null
+++ b/lib/libF77/README
@@ -0,0 +1,86 @@
+If your compiler does not recognize ANSI C headers,
+compile with KR_headers defined: either add -DKR_headers
+to the definition of CFLAGS in the makefile, or insert
+
+#define KR_headers
+
+at the top of f2c.h , cabs.c , main.c , and sig_die.c .
+
+
+If you have a really ancient K&R C compiler that does not understand
+void, add -Dvoid=int to the definition of CFLAGS in the makefile.
+
+If you use a C++ compiler, first create a local f2c.h by appending
+f2ch.add to the usual f2c.h, e.g., by issuing the command
+ make f2c.h
+which assumes f2c.h is installed in /usr/include .
+
+If your system lacks onexit() and you are not using an ANSI C
+compiler, then you should compile main.c with NO_ONEXIT defined.
+See the comments about onexit in the makefile.
+
+If your system has a double drem() function such that drem(a,b)
+is the IEEE remainder function (with double a, b), then you may
+wish to compile r_mod.c and d_mod.c with IEEE_drem defined.
+On some systems, you may also need to compile with -Ddrem=remainder .
+
+To check for transmission errors, issue the command
+ make check
+This assumes you have the xsum program whose source, xsum.c,
+is distributed as part of "all from f2c/src". If you do not
+have xsum, you can obtain xsum.c by sending the following E-mail
+message to netlib@research.att.com
+ send xsum.c from f2c/src
+
+The makefile assumes you have installed f2c.h in a standard
+place (and does not cause recompilation when f2c.h is changed);
+f2c.h comes with "all from f2c" (the source for f2c) and is
+available separately ("f2c.h from f2c").
+
+Most of the routines in libF77 are support routines for Fortran
+intrinsic functions or for operations that f2c chooses not
+to do "in line". There are a few exceptions, summarized below --
+functions and subroutines that appear to your program as ordinary
+external Fortran routines.
+
+1. CALL ABORT prints a message and causes a core dump.
+
+2. ERF(r) and DERF(d) and the REAL and DOUBLE PRECISION
+ error functions (with x REAL and d DOUBLE PRECISION);
+ DERF must be declared DOUBLE PRECISION in your program.
+ Both ERF and DERF assume your C library provides the
+ underlying erf() function (which not all systems do).
+
+3. ERFC(r) and DERFC(d) are the complementary error functions:
+ ERFC(r) = 1 - ERF(r) and DERFC(d) = 1.d0 - DERFC(d)
+ (except that their results may be more accurate than
+ explicitly evaluating the above formulae would give).
+ Again, ERFC and r are REAL, and DERFC and d are DOUBLE
+ PRECISION (and must be declared as such in your program),
+ and ERFC and DERFC rely on your system's erfc().
+
+4. CALL GETARG(n,s), where n is an INTEGER and s is a CHARACTER
+ variable, sets s to the n-th command-line argument (or to
+ all blanks if there are fewer than n command-line arguments);
+ CALL GETARG(0,s) sets s to the name of the program (on systems
+ that support this feature). See IARGC below.
+
+5. CALL GETENV(name, value), where name and value are of type
+ CHARACTER, sets value to the environment value, $name, of
+ name (or to blanks if $name has not been set).
+
+6. NARGS = IARGC() sets NARGS to the number of command-line
+ arguments (an INTEGER value).
+
+7. CALL SIGNAL(n,func), where n is an INTEGER and func is an
+ EXTERNAL procedure, arranges for func to be invoked when
+ signal n occurs (on systems where this makes sense).
+
+8. CALL SYSTEM(cmd), where cmd is of type CHARACTER, passes
+ cmd to the system's command processor (on systems where
+ this can be done).
+
+The makefile does not attempt to compile pow_qq.c, which is meant
+for use with INTEGER*8. To use it, you must modify f2c.h to
+declare longint appropriately; then add pow_qq.o to the POW =
+line in the makefile.
diff --git a/lib/libF77/Version.c b/lib/libF77/Version.c
new file mode 100644
index 000000000000..e6b99cfe1e9d
--- /dev/null
+++ b/lib/libF77/Version.c
@@ -0,0 +1,27 @@
+static char junk[] = "\n@(#)LIBF77 VERSION 2.01 12 March 1993\n";
+
+/*
+2.00 11 June 1980. File version.c added to library.
+2.01 31 May 1988. s_paus() flushes stderr; names of hl_* fixed
+ [ d]erf[c ] added
+ 8 Aug. 1989: #ifdefs for f2c -i2 added to s_cat.c
+ 29 Nov. 1989: s_cmp returns long (for f2c)
+ 30 Nov. 1989: arg types from f2c.h
+ 12 Dec. 1989: s_rnge allows long names
+ 19 Dec. 1989: getenv_ allows unsorted environment
+ 28 Mar. 1990: add exit(0) to end of main()
+ 2 Oct. 1990: test signal(...) == SIG_IGN rather than & 01 in main
+ 17 Oct. 1990: abort() calls changed to sig_die(...,1)
+ 22 Oct. 1990: separate sig_die from main
+ 25 Apr. 1991: minor, theoretically invisible tweaks to s_cat, sig_die
+ 31 May 1991: make system_ return status
+ 18 Dec. 1991: change long to ftnlen (for -i2) many places
+ 28 Feb. 1992: repair z_sqrt.c (scribbled on input, gave wrong answer)
+ 18 July 1992: for n < 0, repair handling of 0**n in pow_[dr]i.c
+ and m**n in pow_hh.c and pow_ii.c;
+ catch SIGTRAP in main() for error msg before abort
+ 23 July 1992: switch to ANSI prototypes unless KR_headers is #defined
+ 23 Oct. 1992: fix botch in signal_.c (erroneous deref of 2nd arg);
+ change Cabs to f__cabs.
+ 12 March 1993: various tweaks for C++.
+*/
diff --git a/lib/libF77/abort_.c b/lib/libF77/abort_.c
new file mode 100644
index 000000000000..9d4a0568ec74
--- /dev/null
+++ b/lib/libF77/abort_.c
@@ -0,0 +1,18 @@
+#include "stdio.h"
+#include "f2c.h"
+
+#ifdef KR_headers
+extern VOID sig_die();
+
+int abort_()
+#else
+extern void sig_die(char*,int);
+
+int abort_(void)
+#endif
+{
+sig_die("Fortran abort routine called", 1);
+#ifdef __cplusplus
+return 0;
+#endif
+}
diff --git a/lib/libF77/c_abs.c b/lib/libF77/c_abs.c
new file mode 100644
index 000000000000..041fbd3d8bb0
--- /dev/null
+++ b/lib/libF77/c_abs.c
@@ -0,0 +1,14 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern double f__cabs();
+
+double c_abs(z) complex *z;
+#else
+extern double f__cabs(double, double);
+
+double c_abs(complex *z)
+#endif
+{
+return( f__cabs( z->r, z->i ) );
+}
diff --git a/lib/libF77/c_cos.c b/lib/libF77/c_cos.c
new file mode 100644
index 000000000000..d5fadd43b18e
--- /dev/null
+++ b/lib/libF77/c_cos.c
@@ -0,0 +1,16 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern double sin(), cos(), sinh(), cosh();
+
+VOID c_cos(r, z) complex *r, *z;
+#else
+#undef abs
+#include "math.h"
+
+void c_cos(complex *r, complex *z)
+#endif
+{
+r->r = cos(z->r) * cosh(z->i);
+r->i = - sin(z->r) * sinh(z->i);
+}
diff --git a/lib/libF77/c_div.c b/lib/libF77/c_div.c
new file mode 100644
index 000000000000..0bb56b485e1e
--- /dev/null
+++ b/lib/libF77/c_div.c
@@ -0,0 +1,36 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern VOID sig_die();
+VOID c_div(c, a, b)
+complex *a, *b, *c;
+#else
+extern void sig_die(char*,int);
+void c_div(complex *c, complex *a, complex *b)
+#endif
+{
+double ratio, den;
+double abr, abi;
+
+if( (abr = b->r) < 0.)
+ abr = - abr;
+if( (abi = b->i) < 0.)
+ abi = - abi;
+if( abr <= abi )
+ {
+ if(abi == 0)
+ sig_die("complex division by zero", 1);
+ ratio = (double)b->r / b->i ;
+ den = b->i * (1 + ratio*ratio);
+ c->r = (a->r*ratio + a->i) / den;
+ c->i = (a->i*ratio - a->r) / den;
+ }
+
+else
+ {
+ ratio = (double)b->i / b->r ;
+ den = b->r * (1 + ratio*ratio);
+ c->r = (a->r + a->i*ratio) / den;
+ c->i = (a->i - a->r*ratio) / den;
+ }
+}
diff --git a/lib/libF77/c_exp.c b/lib/libF77/c_exp.c
new file mode 100644
index 000000000000..8252c7f7012b
--- /dev/null
+++ b/lib/libF77/c_exp.c
@@ -0,0 +1,19 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern double exp(), cos(), sin();
+
+ VOID c_exp(r, z) complex *r, *z;
+#else
+#undef abs
+#include "math.h"
+
+void c_exp(complex *r, complex *z)
+#endif
+{
+double expx;
+
+expx = exp(z->r);
+r->r = expx * cos(z->i);
+r->i = expx * sin(z->i);
+}
diff --git a/lib/libF77/c_log.c b/lib/libF77/c_log.c
new file mode 100644
index 000000000000..a77521aee548
--- /dev/null
+++ b/lib/libF77/c_log.c
@@ -0,0 +1,16 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern double log(), f__cabs(), atan2();
+VOID c_log(r, z) complex *r, *z;
+#else
+#undef abs
+#include "math.h"
+extern double f__cabs(double, double);
+
+void c_log(complex *r, complex *z)
+#endif
+{
+r->i = atan2(z->i, z->r);
+r->r = log( f__cabs(z->r, z->i) );
+}
diff --git a/lib/libF77/c_sin.c b/lib/libF77/c_sin.c
new file mode 100644
index 000000000000..ffdef1d171fc
--- /dev/null
+++ b/lib/libF77/c_sin.c
@@ -0,0 +1,16 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern double sin(), cos(), sinh(), cosh();
+
+VOID c_sin(r, z) complex *r, *z;
+#else
+#undef abs
+#include "math.h"
+
+void c_sin(complex *r, complex *z)
+#endif
+{
+r->r = sin(z->r) * cosh(z->i);
+r->i = cos(z->r) * sinh(z->i);
+}
diff --git a/lib/libF77/c_sqrt.c b/lib/libF77/c_sqrt.c
new file mode 100644
index 000000000000..3b7342f4a49f
--- /dev/null
+++ b/lib/libF77/c_sqrt.c
@@ -0,0 +1,34 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern double sqrt(), f__cabs();
+
+VOID c_sqrt(r, z) complex *r, *z;
+#else
+#undef abs
+#include "math.h"
+extern double f__cabs(double, double);
+
+void c_sqrt(complex *r, complex *z)
+#endif
+{
+double mag, t;
+
+if( (mag = f__cabs(z->r, z->i)) == 0.)
+ r->r = r->i = 0.;
+else if(z->r > 0)
+ {
+ r->r = t = sqrt(0.5 * (mag + z->r) );
+ t = z->i / t;
+ r->i = 0.5 * t;
+ }
+else
+ {
+ t = sqrt(0.5 * (mag - z->r) );
+ if(z->i < 0)
+ t = -t;
+ r->i = t;
+ t = z->i / t;
+ r->r = 0.5 * t;
+ }
+}
diff --git a/lib/libF77/cabs.c b/lib/libF77/cabs.c
new file mode 100644
index 000000000000..8c14afd15ca2
--- /dev/null
+++ b/lib/libF77/cabs.c
@@ -0,0 +1,14 @@
+#ifdef KR_headers
+extern double sqrt();
+double f__cabs(real, imag) double real, imag;
+#else
+#undef abs
+#include "math.h"
+double f__cabs(double real, double imag)
+#endif
+{
+struct {double x, y;} z;
+z.x = real;
+z.y = imag;
+return cabs(z);
+}
diff --git a/lib/libF77/d_abs.c b/lib/libF77/d_abs.c
new file mode 100644
index 000000000000..cb157e067b73
--- /dev/null
+++ b/lib/libF77/d_abs.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double d_abs(x) doublereal *x;
+#else
+double d_abs(doublereal *x)
+#endif
+{
+if(*x >= 0)
+ return(*x);
+return(- *x);
+}
diff --git a/lib/libF77/d_acos.c b/lib/libF77/d_acos.c
new file mode 100644
index 000000000000..ecb56e87f540
--- /dev/null
+++ b/lib/libF77/d_acos.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double acos();
+double d_acos(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_acos(doublereal *x)
+#endif
+{
+return( acos(*x) );
+}
diff --git a/lib/libF77/d_asin.c b/lib/libF77/d_asin.c
new file mode 100644
index 000000000000..045e73301c81
--- /dev/null
+++ b/lib/libF77/d_asin.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double asin();
+double d_asin(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_asin(doublereal *x)
+#endif
+{
+return( asin(*x) );
+}
diff --git a/lib/libF77/d_atan.c b/lib/libF77/d_atan.c
new file mode 100644
index 000000000000..03530a1857c3
--- /dev/null
+++ b/lib/libF77/d_atan.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double atan();
+double d_atan(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_atan(doublereal *x)
+#endif
+{
+return( atan(*x) );
+}
diff --git a/lib/libF77/d_atn2.c b/lib/libF77/d_atn2.c
new file mode 100644
index 000000000000..7c25ac046081
--- /dev/null
+++ b/lib/libF77/d_atn2.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double atan2();
+double d_atn2(x,y) doublereal *x, *y;
+#else
+#undef abs
+#include "math.h"
+double d_atn2(doublereal *x, doublereal *y)
+#endif
+{
+return( atan2(*x,*y) );
+}
diff --git a/lib/libF77/d_cnjg.c b/lib/libF77/d_cnjg.c
new file mode 100644
index 000000000000..c778c38758cb
--- /dev/null
+++ b/lib/libF77/d_cnjg.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+ VOID
+#ifdef KR_headers
+d_cnjg(r, z) doublecomplex *r, *z;
+#else
+d_cnjg(doublecomplex *r, doublecomplex *z)
+#endif
+{
+r->r = z->r;
+r->i = - z->i;
+}
diff --git a/lib/libF77/d_cos.c b/lib/libF77/d_cos.c
new file mode 100644
index 000000000000..45c4838baee7
--- /dev/null
+++ b/lib/libF77/d_cos.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double cos();
+double d_cos(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_cos(doublereal *x)
+#endif
+{
+return( cos(*x) );
+}
diff --git a/lib/libF77/d_cosh.c b/lib/libF77/d_cosh.c
new file mode 100644
index 000000000000..1181833cc1fa
--- /dev/null
+++ b/lib/libF77/d_cosh.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double cosh();
+double d_cosh(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_cosh(doublereal *x)
+#endif
+{
+return( cosh(*x) );
+}
diff --git a/lib/libF77/d_dim.c b/lib/libF77/d_dim.c
new file mode 100644
index 000000000000..1d0ecb7bbb64
--- /dev/null
+++ b/lib/libF77/d_dim.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double d_dim(a,b) doublereal *a, *b;
+#else
+double d_dim(doublereal *a, doublereal *b)
+#endif
+{
+return( *a > *b ? *a - *b : 0);
+}
diff --git a/lib/libF77/d_exp.c b/lib/libF77/d_exp.c
new file mode 100644
index 000000000000..3f2b6ffcc45e
--- /dev/null
+++ b/lib/libF77/d_exp.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double exp();
+double d_exp(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_exp(doublereal *x)
+#endif
+{
+return( exp(*x) );
+}
diff --git a/lib/libF77/d_imag.c b/lib/libF77/d_imag.c
new file mode 100644
index 000000000000..793a3f9c4059
--- /dev/null
+++ b/lib/libF77/d_imag.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double d_imag(z) doublecomplex *z;
+#else
+double d_imag(doublecomplex *z)
+#endif
+{
+return(z->i);
+}
diff --git a/lib/libF77/d_int.c b/lib/libF77/d_int.c
new file mode 100644
index 000000000000..6c0e64215d8d
--- /dev/null
+++ b/lib/libF77/d_int.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double floor();
+double d_int(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_int(doublereal *x)
+#endif
+{
+return( (*x>0) ? floor(*x) : -floor(- *x) );
+}
diff --git a/lib/libF77/d_lg10.c b/lib/libF77/d_lg10.c
new file mode 100644
index 000000000000..f03ff0043f86
--- /dev/null
+++ b/lib/libF77/d_lg10.c
@@ -0,0 +1,15 @@
+#include "f2c.h"
+
+#define log10e 0.43429448190325182765
+
+#ifdef KR_headers
+double log();
+double d_lg10(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_lg10(doublereal *x)
+#endif
+{
+return( log10e * log(*x) );
+}
diff --git a/lib/libF77/d_log.c b/lib/libF77/d_log.c
new file mode 100644
index 000000000000..d7a1941d56a5
--- /dev/null
+++ b/lib/libF77/d_log.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double log();
+double d_log(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_log(doublereal *x)
+#endif
+{
+return( log(*x) );
+}
diff --git a/lib/libF77/d_mod.c b/lib/libF77/d_mod.c
new file mode 100644
index 000000000000..0d3ffbff9eb5
--- /dev/null
+++ b/lib/libF77/d_mod.c
@@ -0,0 +1,40 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+#ifdef IEEE_drem
+double drem();
+#else
+double floor();
+#endif
+double d_mod(x,y) doublereal *x, *y;
+#else
+#ifdef IEEE_drem
+double drem(double, double);
+#else
+#undef abs
+#include "math.h"
+#endif
+double d_mod(doublereal *x, doublereal *y)
+#endif
+{
+#ifdef IEEE_drem
+ double xa, ya, z;
+ if ((ya = *y) < 0.)
+ ya = -ya;
+ z = drem(xa = *x, ya);
+ if (xa > 0) {
+ if (z < 0)
+ z += ya;
+ }
+ else if (z > 0)
+ z -= ya;
+ return z;
+#else
+ double quotient;
+ if( (quotient = *x / *y) >= 0)
+ quotient = floor(quotient);
+ else
+ quotient = -floor(-quotient);
+ return(*x - (*y) * quotient );
+#endif
+}
diff --git a/lib/libF77/d_nint.c b/lib/libF77/d_nint.c
new file mode 100644
index 000000000000..2ead3df200ae
--- /dev/null
+++ b/lib/libF77/d_nint.c
@@ -0,0 +1,14 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double floor();
+double d_nint(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_nint(doublereal *x)
+#endif
+{
+return( (*x)>=0 ?
+ floor(*x + .5) : -floor(.5 - *x) );
+}
diff --git a/lib/libF77/d_prod.c b/lib/libF77/d_prod.c
new file mode 100644
index 000000000000..3d4cef7835c2
--- /dev/null
+++ b/lib/libF77/d_prod.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double d_prod(x,y) real *x, *y;
+#else
+double d_prod(real *x, real *y)
+#endif
+{
+return( (*x) * (*y) );
+}
diff --git a/lib/libF77/d_sign.c b/lib/libF77/d_sign.c
new file mode 100644
index 000000000000..514ff0bbff82
--- /dev/null
+++ b/lib/libF77/d_sign.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double d_sign(a,b) doublereal *a, *b;
+#else
+double d_sign(doublereal *a, doublereal *b)
+#endif
+{
+double x;
+x = (*a >= 0 ? *a : - *a);
+return( *b >= 0 ? x : -x);
+}
diff --git a/lib/libF77/d_sin.c b/lib/libF77/d_sin.c
new file mode 100644
index 000000000000..0013af03496f
--- /dev/null
+++ b/lib/libF77/d_sin.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double sin();
+double d_sin(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_sin(doublereal *x)
+#endif
+{
+return( sin(*x) );
+}
diff --git a/lib/libF77/d_sinh.c b/lib/libF77/d_sinh.c
new file mode 100644
index 000000000000..1ccd02ead97e
--- /dev/null
+++ b/lib/libF77/d_sinh.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double sinh();
+double d_sinh(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_sinh(doublereal *x)
+#endif
+{
+return( sinh(*x) );
+}
diff --git a/lib/libF77/d_sqrt.c b/lib/libF77/d_sqrt.c
new file mode 100644
index 000000000000..bee10a3a551f
--- /dev/null
+++ b/lib/libF77/d_sqrt.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double sqrt();
+double d_sqrt(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_sqrt(doublereal *x)
+#endif
+{
+return( sqrt(*x) );
+}
diff --git a/lib/libF77/d_tan.c b/lib/libF77/d_tan.c
new file mode 100644
index 000000000000..23fa423188e3
--- /dev/null
+++ b/lib/libF77/d_tan.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double tan();
+double d_tan(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_tan(doublereal *x)
+#endif
+{
+return( tan(*x) );
+}
diff --git a/lib/libF77/d_tanh.c b/lib/libF77/d_tanh.c
new file mode 100644
index 000000000000..0363a49b1be3
--- /dev/null
+++ b/lib/libF77/d_tanh.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double tanh();
+double d_tanh(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+double d_tanh(doublereal *x)
+#endif
+{
+return( tanh(*x) );
+}
diff --git a/lib/libF77/derf_.c b/lib/libF77/derf_.c
new file mode 100644
index 000000000000..6afaccdaa3ed
--- /dev/null
+++ b/lib/libF77/derf_.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double erf();
+double derf_(x) doublereal *x;
+#else
+extern double erf(double);
+double derf_(doublereal *x)
+#endif
+{
+return( erf(*x) );
+}
diff --git a/lib/libF77/derfc_.c b/lib/libF77/derfc_.c
new file mode 100644
index 000000000000..e199f916058e
--- /dev/null
+++ b/lib/libF77/derfc_.c
@@ -0,0 +1,14 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern double erfc();
+
+double derfc_(x) doublereal *x;
+#else
+extern double erfc(double);
+
+double derfc_(doublereal *x)
+#endif
+{
+return( erfc(*x) );
+}
diff --git a/lib/libF77/disclaimer b/lib/libF77/disclaimer
new file mode 100644
index 000000000000..59db1ecf42fd
--- /dev/null
+++ b/lib/libF77/disclaimer
@@ -0,0 +1,15 @@
+f2c is a Fortran to C converter under development by
+ David Gay (AT&T Bell Labs)
+ Stu Feldman (Bellcore)
+ Mark Maimone (Carnegie-Mellon University)
+ Norm Schryer (AT&T Bell Labs)
+Please send bug reports to dmg@research.att.com or uunet!research!dmg.
+
+AT&T and Bellcore disclaim all warranties with regard to this
+software, including all implied warranties of merchantability
+and fitness. In no event shall AT&T or Bellcore be liable for
+any special, 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.
diff --git a/lib/libF77/ef1asc_.c b/lib/libF77/ef1asc_.c
new file mode 100644
index 000000000000..b2b8d72a7811
--- /dev/null
+++ b/lib/libF77/ef1asc_.c
@@ -0,0 +1,21 @@
+/* EFL support routine to copy string b to string a */
+
+#include "f2c.h"
+
+
+#define M ( (long) (sizeof(long) - 1) )
+#define EVEN(x) ( ( (x)+ M) & (~M) )
+
+#ifdef KR_headers
+extern VOID s_copy();
+ef1asc_(a, la, b, lb) ftnint *a, *b; ftnlen *la, *lb;
+#else
+extern void s_copy(char*,char*,ftnlen,ftnlen);
+int ef1asc_(ftnint *a, ftnlen *la, ftnint *b, ftnlen *lb)
+#endif
+{
+s_copy( (char *)a, (char *)b, EVEN(*la), *lb );
+#ifdef __cplusplus
+return 0;
+#endif
+}
diff --git a/lib/libF77/ef1cmc_.c b/lib/libF77/ef1cmc_.c
new file mode 100644
index 000000000000..8239a6ba2e1f
--- /dev/null
+++ b/lib/libF77/ef1cmc_.c
@@ -0,0 +1,14 @@
+/* EFL support routine to compare two character strings */
+
+#include "f2c.h"
+
+#ifdef KR_headers
+extern integer s_cmp();
+integer ef1cmc_(a, la, b, lb) ftnint *a, *b; ftnlen *la, *lb;
+#else
+extern integer s_cmp(char*,char*,ftnlen,ftnlen);
+integer ef1cmc_(ftnint *a, ftnlen *la, ftnint *b, ftnlen *lb)
+#endif
+{
+return( s_cmp( (char *)a, (char *)b, *la, *lb) );
+}
diff --git a/lib/libF77/erf_.c b/lib/libF77/erf_.c
new file mode 100644
index 000000000000..f7565ae6ae39
--- /dev/null
+++ b/lib/libF77/erf_.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double erf();
+double erf_(x) real *x;
+#else
+extern double erf(double);
+double erf_(real *x)
+#endif
+{
+return( erf(*x) );
+}
diff --git a/lib/libF77/erfc_.c b/lib/libF77/erfc_.c
new file mode 100644
index 000000000000..56adb2f910b7
--- /dev/null
+++ b/lib/libF77/erfc_.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double erfc();
+double erfc_(x) real *x;
+#else
+extern double erfc(double);
+double erfc_(real *x)
+#endif
+{
+return( erfc(*x) );
+}
diff --git a/lib/libF77/f2ch.add b/lib/libF77/f2ch.add
new file mode 100644
index 000000000000..4ab0d8078c65
--- /dev/null
+++ b/lib/libF77/f2ch.add
@@ -0,0 +1,162 @@
+/* If you are using a C++ compiler, append the following to f2c.h
+ for compiling libF77 and libI77. */
+
+#ifdef __cplusplus
+extern "C" {
+extern int abort_(void);
+extern double c_abs(complex *);
+extern void c_cos(complex *, complex *);
+extern void c_div(complex *, complex *, complex *);
+extern void c_exp(complex *, complex *);
+extern void c_log(complex *, complex *);
+extern void c_sin(complex *, complex *);
+extern void c_sqrt(complex *, complex *);
+extern double d_abs(double *);
+extern double d_acos(double *);
+extern double d_asin(double *);
+extern double d_atan(double *);
+extern double d_atn2(double *, double *);
+extern void d_cnjg(doublecomplex *, doublecomplex *);
+extern double d_cos(double *);
+extern double d_cosh(double *);
+extern double d_dim(double *, double *);
+extern double d_exp(double *);
+extern double d_imag(doublecomplex *);
+extern double d_int(double *);
+extern double d_lg10(double *);
+extern double d_log(double *);
+extern double d_mod(double *, double *);
+extern double d_nint(double *);
+extern double d_prod(float *, float *);
+extern double d_sign(double *, double *);
+extern double d_sin(double *);
+extern double d_sinh(double *);
+extern double d_sqrt(double *);
+extern double d_tan(double *);
+extern double d_tanh(double *);
+extern double derf_(double *);
+extern double derfc_(double *);
+extern integer do_fio(ftnint *, char *, ftnlen);
+extern integer do_lio(ftnint *, ftnint *, char *, ftnlen);
+extern integer do_uio(ftnint *, char *, ftnlen);
+extern integer e_rdfe(void);
+extern integer e_rdue(void);
+extern integer e_rsfe(void);
+extern integer e_rsfi(void);
+extern integer e_rsle(void);
+extern integer e_rsli(void);
+extern integer e_rsue(void);
+extern integer e_wdfe(void);
+extern integer e_wdue(void);
+extern integer e_wsfe(void);
+extern integer e_wsfi(void);
+extern integer e_wsle(void);
+extern integer e_wsli(void);
+extern integer e_wsue(void);
+extern int ef1asc_(ftnint *, ftnlen *, ftnint *, ftnlen *);
+extern integer ef1cmc_(ftnint *, ftnlen *, ftnint *, ftnlen *);
+extern double erf(double);
+extern double erf_(float *);
+extern double erfc(double);
+extern double erfc_(float *);
+extern integer f_back(alist *);
+extern integer f_clos(cllist *);
+extern integer f_end(alist *);
+extern void f_exit(void);
+extern integer f_inqu(inlist *);
+extern integer f_open(olist *);
+extern integer f_rew(alist *);
+extern int flush_(void);
+extern void getarg_(integer *, char *, ftnlen);
+extern void getenv_(char *, char *, ftnlen, ftnlen);
+extern short h_abs(short *);
+extern short h_dim(short *, short *);
+extern short h_dnnt(double *);
+extern short h_indx(char *, char *, ftnlen, ftnlen);
+extern short h_len(char *, ftnlen);
+extern short h_mod(short *, short *);
+extern short h_nint(float *);
+extern short h_sign(short *, short *);
+extern short hl_ge(char *, char *, ftnlen, ftnlen);
+extern short hl_gt(char *, char *, ftnlen, ftnlen);
+extern short hl_le(char *, char *, ftnlen, ftnlen);
+extern short hl_lt(char *, char *, ftnlen, ftnlen);
+extern integer i_abs(integer *);
+extern integer i_dim(integer *, integer *);
+extern integer i_dnnt(double *);
+extern integer i_indx(char *, char *, ftnlen, ftnlen);
+extern integer i_len(char *, ftnlen);
+extern integer i_mod(integer *, integer *);
+extern integer i_nint(float *);
+extern integer i_sign(integer *, integer *);
+extern integer iargc_(void);
+extern ftnlen l_ge(char *, char *, ftnlen, ftnlen);
+extern ftnlen l_gt(char *, char *, ftnlen, ftnlen);
+extern ftnlen l_le(char *, char *, ftnlen, ftnlen);
+extern ftnlen l_lt(char *, char *, ftnlen, ftnlen);
+extern void pow_ci(complex *, complex *, integer *);
+extern double pow_dd(double *, double *);
+extern double pow_di(double *, integer *);
+extern short pow_hh(short *, shortint *);
+extern integer pow_ii(integer *, integer *);
+extern double pow_ri(float *, integer *);
+extern void pow_zi(doublecomplex *, doublecomplex *, integer *);
+extern void pow_zz(doublecomplex *, doublecomplex *, doublecomplex *);
+extern double r_abs(float *);
+extern double r_acos(float *);
+extern double r_asin(float *);
+extern double r_atan(float *);
+extern double r_atn2(float *, float *);
+extern void r_cnjg(complex *, complex *);
+extern double r_cos(float *);
+extern double r_cosh(float *);
+extern double r_dim(float *, float *);
+extern double r_exp(float *);
+extern double r_imag(complex *);
+extern double r_int(float *);
+extern double r_lg10(float *);
+extern double r_log(float *);
+extern double r_mod(float *, float *);
+extern double r_nint(float *);
+extern double r_sign(float *, float *);
+extern double r_sin(float *);
+extern double r_sinh(float *);
+extern double r_sqrt(float *);
+extern double r_tan(float *);
+extern double r_tanh(float *);
+extern void s_cat(char *, char **, integer *, integer *, ftnlen);
+extern integer s_cmp(char *, char *, ftnlen, ftnlen);
+extern void s_copy(char *, char *, ftnlen, ftnlen);
+extern int s_paus(char *, ftnlen);
+extern integer s_rdfe(cilist *);
+extern integer s_rdue(cilist *);
+extern integer s_rnge(char *, integer, char *, integer);
+extern integer s_rsfe(cilist *);
+extern integer s_rsfi(icilist *);
+extern integer s_rsle(cilist *);
+extern integer s_rsli(icilist *);
+extern integer s_rsne(cilist *);
+extern integer s_rsni(icilist *);
+extern integer s_rsue(cilist *);
+extern int s_stop(char *, ftnlen);
+extern integer s_wdfe(cilist *);
+extern integer s_wdue(cilist *);
+extern integer s_wsfe(cilist *);
+extern integer s_wsfi(icilist *);
+extern integer s_wsle(cilist *);
+extern integer s_wsli(icilist *);
+extern integer s_wsne(cilist *);
+extern integer s_wsni(icilist *);
+extern integer s_wsue(cilist *);
+extern void sig_die(char *, int);
+extern integer signal_(integer *, void (*)(int));
+extern int system_(char *, ftnlen);
+extern double z_abs(doublecomplex *);
+extern void z_cos(doublecomplex *, doublecomplex *);
+extern void z_div(doublecomplex *, doublecomplex *, doublecomplex *);
+extern void z_exp(doublecomplex *, doublecomplex *);
+extern void z_log(doublecomplex *, doublecomplex *);
+extern void z_sin(doublecomplex *, doublecomplex *);
+extern void z_sqrt(doublecomplex *, doublecomplex *);
+ }
+#endif
diff --git a/lib/libF77/getarg_.c b/lib/libF77/getarg_.c
new file mode 100644
index 000000000000..fef0da7b1d5f
--- /dev/null
+++ b/lib/libF77/getarg_.c
@@ -0,0 +1,28 @@
+#include "f2c.h"
+
+/*
+ * subroutine getarg(k, c)
+ * returns the kth unix command argument in fortran character
+ * variable argument c
+*/
+
+#ifdef KR_headers
+VOID getarg_(n, s, ls) ftnint *n; register char *s; ftnlen ls;
+#else
+void getarg_(ftnint *n, register char *s, ftnlen ls)
+#endif
+{
+extern int xargc;
+extern char **xargv;
+register char *t;
+register int i;
+
+if(*n>=0 && *n<xargc)
+ t = xargv[*n];
+else
+ t = "";
+for(i = 0; i<ls && *t!='\0' ; ++i)
+ *s++ = *t++;
+for( ; i<ls ; ++i)
+ *s++ = ' ';
+}
diff --git a/lib/libF77/getenv_.c b/lib/libF77/getenv_.c
new file mode 100644
index 000000000000..2a035ea9a6bb
--- /dev/null
+++ b/lib/libF77/getenv_.c
@@ -0,0 +1,51 @@
+#include "f2c.h"
+
+/*
+ * getenv - f77 subroutine to return environment variables
+ *
+ * called by:
+ * call getenv (ENV_NAME, char_var)
+ * where:
+ * ENV_NAME is the name of an environment variable
+ * char_var is a character variable which will receive
+ * the current value of ENV_NAME, or all blanks
+ * if ENV_NAME is not defined
+ */
+
+#ifdef KR_headers
+VOID getenv_(fname, value, flen, vlen) char *value, *fname; ftnlen vlen, flen;
+#else
+void getenv_(char *fname, char *value, ftnlen flen, ftnlen vlen)
+#endif
+{
+extern char **environ;
+register char *ep, *fp, *flast;
+register char **env = environ;
+
+flast = fname + flen;
+for(fp = fname ; fp < flast ; ++fp)
+ if(*fp == ' ')
+ {
+ flast = fp;
+ break;
+ }
+
+while (ep = *env++)
+ {
+ for(fp = fname; fp<flast ; )
+ if(*fp++ != *ep++)
+ goto endloop;
+
+ if(*ep++ == '=') { /* copy right hand side */
+ while( *ep && --vlen>=0 )
+ *value++ = *ep++;
+
+ goto blank;
+ }
+endloop: ;
+ }
+
+blank:
+ while( --vlen >= 0 )
+ *value++ = ' ';
+}
diff --git a/lib/libF77/h_abs.c b/lib/libF77/h_abs.c
new file mode 100644
index 000000000000..73b82151ac1d
--- /dev/null
+++ b/lib/libF77/h_abs.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+shortint h_abs(x) shortint *x;
+#else
+shortint h_abs(shortint *x)
+#endif
+{
+if(*x >= 0)
+ return(*x);
+return(- *x);
+}
diff --git a/lib/libF77/h_dim.c b/lib/libF77/h_dim.c
new file mode 100644
index 000000000000..ceff660e26cd
--- /dev/null
+++ b/lib/libF77/h_dim.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+shortint h_dim(a,b) shortint *a, *b;
+#else
+shortint h_dim(shortint *a, shortint *b)
+#endif
+{
+return( *a > *b ? *a - *b : 0);
+}
diff --git a/lib/libF77/h_dnnt.c b/lib/libF77/h_dnnt.c
new file mode 100644
index 000000000000..9fbeb5ce6244
--- /dev/null
+++ b/lib/libF77/h_dnnt.c
@@ -0,0 +1,14 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double floor();
+shortint h_dnnt(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+shortint h_dnnt(doublereal *x)
+#endif
+{
+return( (*x)>=0 ?
+ floor(*x + .5) : -floor(.5 - *x) );
+}
diff --git a/lib/libF77/h_indx.c b/lib/libF77/h_indx.c
new file mode 100644
index 000000000000..a211cc7fa0fb
--- /dev/null
+++ b/lib/libF77/h_indx.c
@@ -0,0 +1,26 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+shortint h_indx(a, b, la, lb) char *a, *b; ftnlen la, lb;
+#else
+shortint h_indx(char *a, char *b, ftnlen la, ftnlen lb)
+#endif
+{
+ftnlen i, n;
+char *s, *t, *bend;
+
+n = la - lb + 1;
+bend = b + lb;
+
+for(i = 0 ; i < n ; ++i)
+ {
+ s = a + i;
+ t = b;
+ while(t < bend)
+ if(*s++ != *t++)
+ goto no;
+ return((shortint)i+1);
+ no: ;
+ }
+return(0);
+}
diff --git a/lib/libF77/h_len.c b/lib/libF77/h_len.c
new file mode 100644
index 000000000000..00a2151bfa11
--- /dev/null
+++ b/lib/libF77/h_len.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+shortint h_len(s, n) char *s; ftnlen n;
+#else
+shortint h_len(char *s, ftnlen n)
+#endif
+{
+return(n);
+}
diff --git a/lib/libF77/h_mod.c b/lib/libF77/h_mod.c
new file mode 100644
index 000000000000..43431c1c503c
--- /dev/null
+++ b/lib/libF77/h_mod.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+shortint h_mod(a,b) short *a, *b;
+#else
+shortint h_mod(short *a, short *b)
+#endif
+{
+return( *a % *b);
+}
diff --git a/lib/libF77/h_nint.c b/lib/libF77/h_nint.c
new file mode 100644
index 000000000000..bf63df128d89
--- /dev/null
+++ b/lib/libF77/h_nint.c
@@ -0,0 +1,14 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double floor();
+shortint h_nint(x) real *x;
+#else
+#undef abs
+#include "math.h"
+shortint h_nint(real *x)
+#endif
+{
+return( (*x)>=0 ?
+ floor(*x + .5) : -floor(.5 - *x) );
+}
diff --git a/lib/libF77/h_sign.c b/lib/libF77/h_sign.c
new file mode 100644
index 000000000000..7b06c157a74e
--- /dev/null
+++ b/lib/libF77/h_sign.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+shortint h_sign(a,b) shortint *a, *b;
+#else
+shortint h_sign(shortint *a, shortint *b)
+#endif
+{
+shortint x;
+x = (*a >= 0 ? *a : - *a);
+return( *b >= 0 ? x : -x);
+}
diff --git a/lib/libF77/hl_ge.c b/lib/libF77/hl_ge.c
new file mode 100644
index 000000000000..4c29527065a2
--- /dev/null
+++ b/lib/libF77/hl_ge.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern integer s_cmp();
+shortlogical hl_ge(a,b,la,lb) char *a, *b; ftnlen la, lb;
+#else
+extern integer s_cmp(char *, char *, ftnlen, ftnlen);
+shortlogical hl_ge(char *a, char *b, ftnlen la, ftnlen lb)
+#endif
+{
+return(s_cmp(a,b,la,lb) >= 0);
+}
diff --git a/lib/libF77/hl_gt.c b/lib/libF77/hl_gt.c
new file mode 100644
index 000000000000..c4f345a0859e
--- /dev/null
+++ b/lib/libF77/hl_gt.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern integer s_cmp();
+shortlogical hl_gt(a,b,la,lb) char *a, *b; ftnlen la, lb;
+#else
+extern integer s_cmp(char *, char *, ftnlen, ftnlen);
+shortlogical hl_gt(char *a, char *b, ftnlen la, ftnlen lb)
+#endif
+{
+return(s_cmp(a,b,la,lb) > 0);
+}
diff --git a/lib/libF77/hl_le.c b/lib/libF77/hl_le.c
new file mode 100644
index 000000000000..a9cce596c715
--- /dev/null
+++ b/lib/libF77/hl_le.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern integer s_cmp();
+shortlogical hl_le(a,b,la,lb) char *a, *b; ftnlen la, lb;
+#else
+extern integer s_cmp(char *, char *, ftnlen, ftnlen);
+shortlogical hl_le(char *a, char *b, ftnlen la, ftnlen lb)
+#endif
+{
+return(s_cmp(a,b,la,lb) <= 0);
+}
diff --git a/lib/libF77/hl_lt.c b/lib/libF77/hl_lt.c
new file mode 100644
index 000000000000..162d919c3b48
--- /dev/null
+++ b/lib/libF77/hl_lt.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern integer s_cmp();
+shortlogical hl_lt(a,b,la,lb) char *a, *b; ftnlen la, lb;
+#else
+extern integer s_cmp(char *, char *, ftnlen, ftnlen);
+shortlogical hl_lt(char *a, char *b, ftnlen la, ftnlen lb)
+#endif
+{
+return(s_cmp(a,b,la,lb) < 0);
+}
diff --git a/lib/libF77/i_abs.c b/lib/libF77/i_abs.c
new file mode 100644
index 000000000000..be21295aaa12
--- /dev/null
+++ b/lib/libF77/i_abs.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+integer i_abs(x) integer *x;
+#else
+integer i_abs(integer *x)
+#endif
+{
+if(*x >= 0)
+ return(*x);
+return(- *x);
+}
diff --git a/lib/libF77/i_dim.c b/lib/libF77/i_dim.c
new file mode 100644
index 000000000000..6e1b1707b555
--- /dev/null
+++ b/lib/libF77/i_dim.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+integer i_dim(a,b) integer *a, *b;
+#else
+integer i_dim(integer *a, integer *b)
+#endif
+{
+return( *a > *b ? *a - *b : 0);
+}
diff --git a/lib/libF77/i_dnnt.c b/lib/libF77/i_dnnt.c
new file mode 100644
index 000000000000..9d46c4b6ad9d
--- /dev/null
+++ b/lib/libF77/i_dnnt.c
@@ -0,0 +1,14 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double floor();
+integer i_dnnt(x) doublereal *x;
+#else
+#undef abs
+#include "math.h"
+integer i_dnnt(doublereal *x)
+#endif
+{
+return( (*x)>=0 ?
+ floor(*x + .5) : -floor(.5 - *x) );
+}
diff --git a/lib/libF77/i_indx.c b/lib/libF77/i_indx.c
new file mode 100644
index 000000000000..96e7bc51ba85
--- /dev/null
+++ b/lib/libF77/i_indx.c
@@ -0,0 +1,26 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+integer i_indx(a, b, la, lb) char *a, *b; ftnlen la, lb;
+#else
+integer i_indx(char *a, char *b, ftnlen la, ftnlen lb)
+#endif
+{
+ftnlen i, n;
+char *s, *t, *bend;
+
+n = la - lb + 1;
+bend = b + lb;
+
+for(i = 0 ; i < n ; ++i)
+ {
+ s = a + i;
+ t = b;
+ while(t < bend)
+ if(*s++ != *t++)
+ goto no;
+ return(i+1);
+ no: ;
+ }
+return(0);
+}
diff --git a/lib/libF77/i_len.c b/lib/libF77/i_len.c
new file mode 100644
index 000000000000..4020fee46183
--- /dev/null
+++ b/lib/libF77/i_len.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+integer i_len(s, n) char *s; ftnlen n;
+#else
+integer i_len(char *s, ftnlen n)
+#endif
+{
+return(n);
+}
diff --git a/lib/libF77/i_mod.c b/lib/libF77/i_mod.c
new file mode 100644
index 000000000000..6937c4213570
--- /dev/null
+++ b/lib/libF77/i_mod.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+integer i_mod(a,b) integer *a, *b;
+#else
+integer i_mod(integer *a, integer *b)
+#endif
+{
+return( *a % *b);
+}
diff --git a/lib/libF77/i_nint.c b/lib/libF77/i_nint.c
new file mode 100644
index 000000000000..ccde78548880
--- /dev/null
+++ b/lib/libF77/i_nint.c
@@ -0,0 +1,14 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double floor();
+integer i_nint(x) real *x;
+#else
+#undef abs
+#include "math.h"
+integer i_nint(real *x)
+#endif
+{
+return( (*x)>=0 ?
+ floor(*x + .5) : -floor(.5 - *x) );
+}
diff --git a/lib/libF77/i_sign.c b/lib/libF77/i_sign.c
new file mode 100644
index 000000000000..94009b86e6fa
--- /dev/null
+++ b/lib/libF77/i_sign.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+integer i_sign(a,b) integer *a, *b;
+#else
+integer i_sign(integer *a, integer *b)
+#endif
+{
+integer x;
+x = (*a >= 0 ? *a : - *a);
+return( *b >= 0 ? x : -x);
+}
diff --git a/lib/libF77/iargc_.c b/lib/libF77/iargc_.c
new file mode 100644
index 000000000000..29614ec6595d
--- /dev/null
+++ b/lib/libF77/iargc_.c
@@ -0,0 +1,11 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+ftnint iargc_()
+#else
+ftnint iargc_(void)
+#endif
+{
+extern int xargc;
+return ( xargc - 1 );
+}
diff --git a/lib/libF77/l_ge.c b/lib/libF77/l_ge.c
new file mode 100644
index 000000000000..86b4a1f5a7f5
--- /dev/null
+++ b/lib/libF77/l_ge.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern integer s_cmp();
+logical l_ge(a,b,la,lb) char *a, *b; ftnlen la, lb;
+#else
+extern integer s_cmp(char *, char *, ftnlen, ftnlen);
+logical l_ge(char *a, char *b, ftnlen la, ftnlen lb)
+#endif
+{
+return(s_cmp(a,b,la,lb) >= 0);
+}
diff --git a/lib/libF77/l_gt.c b/lib/libF77/l_gt.c
new file mode 100644
index 000000000000..c4b52f5bf7dd
--- /dev/null
+++ b/lib/libF77/l_gt.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern integer s_cmp();
+logical l_gt(a,b,la,lb) char *a, *b; ftnlen la, lb;
+#else
+extern integer s_cmp(char *, char *, ftnlen, ftnlen);
+logical l_gt(char *a, char *b, ftnlen la, ftnlen lb)
+#endif
+{
+return(s_cmp(a,b,la,lb) > 0);
+}
diff --git a/lib/libF77/l_le.c b/lib/libF77/l_le.c
new file mode 100644
index 000000000000..f2740a238143
--- /dev/null
+++ b/lib/libF77/l_le.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern integer s_cmp();
+logical l_le(a,b,la,lb) char *a, *b; ftnlen la, lb;
+#else
+extern integer s_cmp(char *, char *, ftnlen, ftnlen);
+logical l_le(char *a, char *b, ftnlen la, ftnlen lb)
+#endif
+{
+return(s_cmp(a,b,la,lb) <= 0);
+}
diff --git a/lib/libF77/l_lt.c b/lib/libF77/l_lt.c
new file mode 100644
index 000000000000..c48dc946f9a7
--- /dev/null
+++ b/lib/libF77/l_lt.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern integer s_cmp();
+logical l_lt(a,b,la,lb) char *a, *b; ftnlen la, lb;
+#else
+extern integer s_cmp(char *, char *, ftnlen, ftnlen);
+logical l_lt(char *a, char *b, ftnlen la, ftnlen lb)
+#endif
+{
+return(s_cmp(a,b,la,lb) < 0);
+}
diff --git a/lib/libF77/main.c b/lib/libF77/main.c
new file mode 100644
index 000000000000..d7f71bd36fdd
--- /dev/null
+++ b/lib/libF77/main.c
@@ -0,0 +1,124 @@
+/* STARTUP PROCEDURE FOR UNIX FORTRAN PROGRAMS */
+
+#include "stdio.h"
+#include "signal.h"
+
+#ifndef SIGIOT
+#define SIGIOT SIGABRT
+#endif
+
+#ifndef KR_headers
+#include "stdlib.h"
+#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef NO__STDC
+#define ONEXIT onexit
+extern void f_exit();
+#else
+#ifndef KR_headers
+extern void f_exit(void);
+#ifndef NO_ONEXIT
+#define ONEXIT atexit
+extern int atexit(void (*)(void));
+#endif
+#else
+#ifndef NO_ONEXIT
+#define ONEXIT onexit
+extern void f_exit();
+#endif
+#endif
+#endif
+
+#ifdef KR_headers
+extern void f_init(), sig_die();
+extern int MAIN__();
+#define Int /* int */
+#else
+extern void f_init(void), sig_die(char*, int);
+extern int MAIN__(void);
+#define Int int
+#endif
+
+static void sigfdie(Int n)
+{
+sig_die("Floating Exception", 1);
+}
+
+
+static void sigidie(Int n)
+{
+sig_die("IOT Trap", 1);
+}
+
+#ifdef SIGQUIT
+static void sigqdie(Int n)
+{
+sig_die("Quit signal", 1);
+}
+#endif
+
+
+static void sigindie(Int n)
+{
+sig_die("Interrupt", 0);
+}
+
+static void sigtdie(Int n)
+{
+sig_die("Killed", 0);
+}
+
+#ifdef SIGTRAP
+static void sigtrdie(Int n)
+{
+sig_die("Trace trap", 1);
+}
+#endif
+
+
+int xargc;
+char **xargv;
+
+#ifdef KR_headers
+main(argc, argv) int argc; char **argv;
+#else
+main(int argc, char **argv)
+#endif
+{
+xargc = argc;
+xargv = argv;
+signal(SIGFPE, sigfdie); /* ignore underflow, enable overflow */
+signal(SIGIOT, sigidie);
+#ifdef SIGTRAP
+signal(SIGTRAP, sigtrdie);
+#endif
+#ifdef SIGQUIT
+if(signal(SIGQUIT,sigqdie) == SIG_IGN)
+ signal(SIGQUIT, SIG_IGN);
+#endif
+if(signal(SIGINT, sigindie) == SIG_IGN)
+ signal(SIGINT, SIG_IGN);
+signal(SIGTERM,sigtdie);
+
+#ifdef pdp11
+ ldfps(01200); /* detect overflow as an exception */
+#endif
+
+f_init();
+#ifndef NO_ONEXIT
+ONEXIT(f_exit);
+#endif
+MAIN__();
+#ifdef NO_ONEXIT
+f_exit();
+#endif
+exit(0); /* exit(0) rather than return(0) to bypass Cray bug */
+return 0; /* For compilers that complain of missing return values; */
+ /* others will complain that this is unreachable code. */
+}
+#ifdef __cplusplus
+ }
+#endif
diff --git a/lib/libF77/permission b/lib/libF77/permission
new file mode 100644
index 000000000000..20d431ed6dc9
--- /dev/null
+++ b/lib/libF77/permission
@@ -0,0 +1,41 @@
+From ches Tue Mar 6 09:06:22 EST 1990
+It think it probably is. I am told the line is 89% utilized. But the throughpu
+t
+is shared, so I wouldn't worry about it.
+>From ehg Tue Mar 6 08:16 EST 1990
+Received: by coma; Tue Mar 6 08:17:21 1990
+From: pyxis!ehg
+Date: Tue, 6 Mar 90 08:16 EST
+To: coma!ches
+
+Thanks. Is it reasonable for people to ask for the 600KB f2c source over
+uunet's dedicated line? I'm just trying to find out if there's a problem
+before there's a disaster.
+>From ches Tue Mar 6 07:16:18 EST 1990
+Inet has no dialers. All its calls go through the internet. The mcsun addresse
+s
+were uunet.uu.net!mcsun!..., which will travel to uunet via Internet and
+then across the ocean on uunet's dedicated line.
+/****************************************************************
+Copyright 1990 by AT&T Bell Laboratories and Bellcore.
+
+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 appear in all
+copies and that both that the copyright notice and this
+permission notice and warranty disclaimer appear in supporting
+documentation, and that the names of AT&T Bell Laboratories or
+Bellcore or any of their entities not be used in advertising or
+publicity pertaining to distribution of the software without
+specific, written prior permission.
+
+AT&T and Bellcore disclaim all warranties with regard to this
+software, including all implied warranties of merchantability
+and fitness. In no event shall AT&T or Bellcore be liable for
+any special, 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.
+****************************************************************/
+
diff --git a/lib/libF77/pow_ci.c b/lib/libF77/pow_ci.c
new file mode 100644
index 000000000000..37e2ce0f2eb9
--- /dev/null
+++ b/lib/libF77/pow_ci.c
@@ -0,0 +1,20 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+VOID pow_ci(p, a, b) /* p = a**b */
+ complex *p, *a; integer *b;
+#else
+extern void pow_zi(doublecomplex*, doublecomplex*, integer*);
+void pow_ci(complex *p, complex *a, integer *b) /* p = a**b */
+#endif
+{
+doublecomplex p1, a1;
+
+a1.r = a->r;
+a1.i = a->i;
+
+pow_zi(&p1, &a1, b);
+
+p->r = p1.r;
+p->i = p1.i;
+}
diff --git a/lib/libF77/pow_dd.c b/lib/libF77/pow_dd.c
new file mode 100644
index 000000000000..d2bb0e39bfdc
--- /dev/null
+++ b/lib/libF77/pow_dd.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double pow();
+double pow_dd(ap, bp) doublereal *ap, *bp;
+#else
+#undef abs
+#include "math.h"
+double pow_dd(doublereal *ap, doublereal *bp)
+#endif
+{
+return(pow(*ap, *bp) );
+}
diff --git a/lib/libF77/pow_di.c b/lib/libF77/pow_di.c
new file mode 100644
index 000000000000..7af69a71259b
--- /dev/null
+++ b/lib/libF77/pow_di.c
@@ -0,0 +1,34 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double pow_di(ap, bp) doublereal *ap; integer *bp;
+#else
+double pow_di(doublereal *ap, integer *bp)
+#endif
+{
+double pow, x;
+integer n;
+
+pow = 1;
+x = *ap;
+n = *bp;
+
+if(n != 0)
+ {
+ if(n < 0)
+ {
+ n = -n;
+ x = 1/x;
+ }
+ for( ; ; )
+ {
+ if(n & 01)
+ pow *= x;
+ if(n >>= 1)
+ x *= x;
+ else
+ break;
+ }
+ }
+return(pow);
+}
diff --git a/lib/libF77/pow_hh.c b/lib/libF77/pow_hh.c
new file mode 100644
index 000000000000..e1a503c5ca82
--- /dev/null
+++ b/lib/libF77/pow_hh.c
@@ -0,0 +1,31 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+shortint pow_hh(ap, bp) shortint *ap, *bp;
+#else
+shortint pow_hh(shortint *ap, shortint *bp)
+#endif
+{
+ shortint pow, x, n;
+
+ x = *ap;
+ n = *bp;
+
+ if (n <= 0) {
+ if (n == 0 || x == 1)
+ return 1;
+ if (x != -1)
+ return x == 0 ? 1/x : 0;
+ n = -n;
+ }
+ for(pow = 1; ; )
+ {
+ if(n & 01)
+ pow *= x;
+ if(n >>= 1)
+ x *= x;
+ else
+ break;
+ }
+ return(pow);
+ }
diff --git a/lib/libF77/pow_ii.c b/lib/libF77/pow_ii.c
new file mode 100644
index 000000000000..e7948776e6c7
--- /dev/null
+++ b/lib/libF77/pow_ii.c
@@ -0,0 +1,31 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+integer pow_ii(ap, bp) integer *ap, *bp;
+#else
+integer pow_ii(integer *ap, integer *bp)
+#endif
+{
+ integer pow, x, n;
+
+ x = *ap;
+ n = *bp;
+
+ if (n <= 0) {
+ if (n == 0 || x == 1)
+ return 1;
+ if (x != -1)
+ return x == 0 ? 1/x : 0;
+ n = -n;
+ }
+ for(pow = 1; ; )
+ {
+ if(n & 01)
+ pow *= x;
+ if(n >>= 1)
+ x *= x;
+ else
+ break;
+ }
+ return(pow);
+ }
diff --git a/lib/libF77/pow_qq.c b/lib/libF77/pow_qq.c
new file mode 100644
index 000000000000..d80c40a9a697
--- /dev/null
+++ b/lib/libF77/pow_qq.c
@@ -0,0 +1,31 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+longint pow_qq(ap, bp) longint *ap, *bp;
+#else
+longint pow_qq(longint *ap, longint *bp)
+#endif
+{
+ longint pow, x, n;
+
+ x = *ap;
+ n = *bp;
+
+ if (n <= 0) {
+ if (n == 0 || x == 1)
+ return 1;
+ if (x != -1)
+ return x == 0 ? 1/x : 0;
+ n = -n;
+ }
+ for(pow = 1; ; )
+ {
+ if(n & 01)
+ pow *= x;
+ if(n >>= 1)
+ x *= x;
+ else
+ break;
+ }
+ return(pow);
+ }
diff --git a/lib/libF77/pow_ri.c b/lib/libF77/pow_ri.c
new file mode 100644
index 000000000000..3a3c4cf1ca4e
--- /dev/null
+++ b/lib/libF77/pow_ri.c
@@ -0,0 +1,34 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double pow_ri(ap, bp) real *ap; integer *bp;
+#else
+double pow_ri(real *ap, integer *bp)
+#endif
+{
+double pow, x;
+integer n;
+
+pow = 1;
+x = *ap;
+n = *bp;
+
+if(n != 0)
+ {
+ if(n < 0)
+ {
+ n = -n;
+ x = 1/x;
+ }
+ for( ; ; )
+ {
+ if(n & 01)
+ pow *= x;
+ if(n >>= 1)
+ x *= x;
+ else
+ break;
+ }
+ }
+return(pow);
+}
diff --git a/lib/libF77/pow_zi.c b/lib/libF77/pow_zi.c
new file mode 100644
index 000000000000..8dd60069bfe0
--- /dev/null
+++ b/lib/libF77/pow_zi.c
@@ -0,0 +1,50 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+VOID pow_zi(p, a, b) /* p = a**b */
+ doublecomplex *p, *a; integer *b;
+#else
+extern void z_div(doublecomplex*, doublecomplex*, doublecomplex*);
+void pow_zi(doublecomplex *p, doublecomplex *a, integer *b) /* p = a**b */
+#endif
+{
+integer n;
+double t;
+doublecomplex x;
+static doublecomplex one = {1.0, 0.0};
+
+n = *b;
+p->r = 1;
+p->i = 0;
+
+if(n == 0)
+ return;
+if(n < 0)
+ {
+ n = -n;
+ z_div(&x, &one, a);
+ }
+else
+ {
+ x.r = a->r;
+ x.i = a->i;
+ }
+
+for( ; ; )
+ {
+ if(n & 01)
+ {
+ t = p->r * x.r - p->i * x.i;
+ p->i = p->r * x.i + p->i * x.r;
+ p->r = t;
+ }
+ if(n >>= 1)
+ {
+ t = x.r * x.r - x.i * x.i;
+ x.i = 2 * x.r * x.i;
+ x.r = t;
+ }
+ else
+ break;
+ }
+}
diff --git a/lib/libF77/pow_zz.c b/lib/libF77/pow_zz.c
new file mode 100644
index 000000000000..55785dffbe6b
--- /dev/null
+++ b/lib/libF77/pow_zz.c
@@ -0,0 +1,23 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double log(), exp(), cos(), sin(), atan2(), f__cabs();
+VOID pow_zz(r,a,b) doublecomplex *r, *a, *b;
+#else
+#undef abs
+#include "math.h"
+extern double f__cabs(double,double);
+void pow_zz(doublecomplex *r, doublecomplex *a, doublecomplex *b)
+#endif
+{
+double logr, logi, x, y;
+
+logr = log( f__cabs(a->r, a->i) );
+logi = atan2(a->i, a->r);
+
+x = exp( logr * b->r - logi * b->i );
+y = logr * b->i + logi * b->r;
+
+r->r = x * cos(y);
+r->i = x * sin(y);
+}
diff --git a/lib/libF77/r_abs.c b/lib/libF77/r_abs.c
new file mode 100644
index 000000000000..7b222961d16d
--- /dev/null
+++ b/lib/libF77/r_abs.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double r_abs(x) real *x;
+#else
+double r_abs(real *x)
+#endif
+{
+if(*x >= 0)
+ return(*x);
+return(- *x);
+}
diff --git a/lib/libF77/r_acos.c b/lib/libF77/r_acos.c
new file mode 100644
index 000000000000..328812ab6aa2
--- /dev/null
+++ b/lib/libF77/r_acos.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double acos();
+double r_acos(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_acos(real *x)
+#endif
+{
+return( acos(*x) );
+}
diff --git a/lib/libF77/r_asin.c b/lib/libF77/r_asin.c
new file mode 100644
index 000000000000..a30c6706b06d
--- /dev/null
+++ b/lib/libF77/r_asin.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double asin();
+double r_asin(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_asin(real *x)
+#endif
+{
+return( asin(*x) );
+}
diff --git a/lib/libF77/r_atan.c b/lib/libF77/r_atan.c
new file mode 100644
index 000000000000..1e3817bdf661
--- /dev/null
+++ b/lib/libF77/r_atan.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double atan();
+double r_atan(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_atan(real *x)
+#endif
+{
+return( atan(*x) );
+}
diff --git a/lib/libF77/r_atn2.c b/lib/libF77/r_atn2.c
new file mode 100644
index 000000000000..3832a27f3e3c
--- /dev/null
+++ b/lib/libF77/r_atn2.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double atan2();
+double r_atn2(x,y) real *x, *y;
+#else
+#undef abs
+#include "math.h"
+double r_atn2(real *x, real *y)
+#endif
+{
+return( atan2(*x,*y) );
+}
diff --git a/lib/libF77/r_cnjg.c b/lib/libF77/r_cnjg.c
new file mode 100644
index 000000000000..e127ca969c4f
--- /dev/null
+++ b/lib/libF77/r_cnjg.c
@@ -0,0 +1,11 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+VOID r_cnjg(r, z) complex *r, *z;
+#else
+VOID r_cnjg(complex *r, complex *z)
+#endif
+{
+r->r = z->r;
+r->i = - z->i;
+}
diff --git a/lib/libF77/r_cos.c b/lib/libF77/r_cos.c
new file mode 100644
index 000000000000..cf5c8eb4af29
--- /dev/null
+++ b/lib/libF77/r_cos.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double cos();
+double r_cos(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_cos(real *x)
+#endif
+{
+return( cos(*x) );
+}
diff --git a/lib/libF77/r_cosh.c b/lib/libF77/r_cosh.c
new file mode 100644
index 000000000000..5756c172427b
--- /dev/null
+++ b/lib/libF77/r_cosh.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double cosh();
+double r_cosh(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_cosh(real *x)
+#endif
+{
+return( cosh(*x) );
+}
diff --git a/lib/libF77/r_dim.c b/lib/libF77/r_dim.c
new file mode 100644
index 000000000000..baca95cd9e47
--- /dev/null
+++ b/lib/libF77/r_dim.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double r_dim(a,b) real *a, *b;
+#else
+double r_dim(real *a, real *b)
+#endif
+{
+return( *a > *b ? *a - *b : 0);
+}
diff --git a/lib/libF77/r_exp.c b/lib/libF77/r_exp.c
new file mode 100644
index 000000000000..a95f4bc7f2b2
--- /dev/null
+++ b/lib/libF77/r_exp.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double exp();
+double r_exp(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_exp(real *x)
+#endif
+{
+return( exp(*x) );
+}
diff --git a/lib/libF77/r_imag.c b/lib/libF77/r_imag.c
new file mode 100644
index 000000000000..d51252bbb791
--- /dev/null
+++ b/lib/libF77/r_imag.c
@@ -0,0 +1,10 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double r_imag(z) complex *z;
+#else
+double r_imag(complex *z)
+#endif
+{
+return(z->i);
+}
diff --git a/lib/libF77/r_int.c b/lib/libF77/r_int.c
new file mode 100644
index 000000000000..11264bf19247
--- /dev/null
+++ b/lib/libF77/r_int.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double floor();
+double r_int(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_int(real *x)
+#endif
+{
+return( (*x>0) ? floor(*x) : -floor(- *x) );
+}
diff --git a/lib/libF77/r_lg10.c b/lib/libF77/r_lg10.c
new file mode 100644
index 000000000000..4ea02f451003
--- /dev/null
+++ b/lib/libF77/r_lg10.c
@@ -0,0 +1,15 @@
+#include "f2c.h"
+
+#define log10e 0.43429448190325182765
+
+#ifdef KR_headers
+double log();
+double r_lg10(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_lg10(real *x)
+#endif
+{
+return( log10e * log(*x) );
+}
diff --git a/lib/libF77/r_log.c b/lib/libF77/r_log.c
new file mode 100644
index 000000000000..aec6726ef5b6
--- /dev/null
+++ b/lib/libF77/r_log.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double log();
+double r_log(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_log(real *x)
+#endif
+{
+return( log(*x) );
+}
diff --git a/lib/libF77/r_mod.c b/lib/libF77/r_mod.c
new file mode 100644
index 000000000000..7adb44cdbec0
--- /dev/null
+++ b/lib/libF77/r_mod.c
@@ -0,0 +1,40 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+#ifdef IEEE_drem
+double drem();
+#else
+double floor();
+#endif
+double r_mod(x,y) real *x, *y;
+#else
+#ifdef IEEE_drem
+double drem(double, double);
+#else
+#undef abs
+#include "math.h"
+#endif
+double r_mod(real *x, real *y)
+#endif
+{
+#ifdef IEEE_drem
+ double xa, ya, z;
+ if ((ya = *y) < 0.)
+ ya = -ya;
+ z = drem(xa = *x, ya);
+ if (xa > 0) {
+ if (z < 0)
+ z += ya;
+ }
+ else if (z > 0)
+ z -= ya;
+ return z;
+#else
+ double quotient;
+ if( (quotient = (double)*x / *y) >= 0)
+ quotient = floor(quotient);
+ else
+ quotient = -floor(-quotient);
+ return(*x - (*y) * quotient );
+#endif
+}
diff --git a/lib/libF77/r_nint.c b/lib/libF77/r_nint.c
new file mode 100644
index 000000000000..c45bac6458f0
--- /dev/null
+++ b/lib/libF77/r_nint.c
@@ -0,0 +1,14 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double floor();
+double r_nint(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_nint(real *x)
+#endif
+{
+return( (*x)>=0 ?
+ floor(*x + .5) : -floor(.5 - *x) );
+}
diff --git a/lib/libF77/r_sign.c b/lib/libF77/r_sign.c
new file mode 100644
index 000000000000..df6d02af00a7
--- /dev/null
+++ b/lib/libF77/r_sign.c
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double r_sign(a,b) real *a, *b;
+#else
+double r_sign(real *a, real *b)
+#endif
+{
+double x;
+x = (*a >= 0 ? *a : - *a);
+return( *b >= 0 ? x : -x);
+}
diff --git a/lib/libF77/r_sin.c b/lib/libF77/r_sin.c
new file mode 100644
index 000000000000..d2a3dac8581e
--- /dev/null
+++ b/lib/libF77/r_sin.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double sin();
+double r_sin(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_sin(real *x)
+#endif
+{
+return( sin(*x) );
+}
diff --git a/lib/libF77/r_sinh.c b/lib/libF77/r_sinh.c
new file mode 100644
index 000000000000..00cba0cb07f9
--- /dev/null
+++ b/lib/libF77/r_sinh.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double sinh();
+double r_sinh(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_sinh(real *x)
+#endif
+{
+return( sinh(*x) );
+}
diff --git a/lib/libF77/r_sqrt.c b/lib/libF77/r_sqrt.c
new file mode 100644
index 000000000000..26b45458aac9
--- /dev/null
+++ b/lib/libF77/r_sqrt.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double sqrt();
+double r_sqrt(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_sqrt(real *x)
+#endif
+{
+return( sqrt(*x) );
+}
diff --git a/lib/libF77/r_tan.c b/lib/libF77/r_tan.c
new file mode 100644
index 000000000000..736b37893c44
--- /dev/null
+++ b/lib/libF77/r_tan.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double tan();
+double r_tan(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_tan(real *x)
+#endif
+{
+return( tan(*x) );
+}
diff --git a/lib/libF77/r_tanh.c b/lib/libF77/r_tanh.c
new file mode 100644
index 000000000000..044255a08cc0
--- /dev/null
+++ b/lib/libF77/r_tanh.c
@@ -0,0 +1,13 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double tanh();
+double r_tanh(x) real *x;
+#else
+#undef abs
+#include "math.h"
+double r_tanh(real *x)
+#endif
+{
+return( tanh(*x) );
+}
diff --git a/lib/libF77/s_cat.c b/lib/libF77/s_cat.c
new file mode 100644
index 000000000000..e9e29cf5d46a
--- /dev/null
+++ b/lib/libF77/s_cat.c
@@ -0,0 +1,25 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+VOID s_cat(lp, rpp, rnp, np, ll) char *lp, *rpp[]; ftnlen rnp[], *np, ll;
+#else
+VOID s_cat(char *lp, char *rpp[], ftnlen rnp[], ftnlen *np, ftnlen ll)
+#endif
+{
+ftnlen i, n, nc;
+char *f__rp;
+
+n = (int)*np;
+for(i = 0 ; i < n ; ++i)
+ {
+ nc = ll;
+ if(rnp[i] < nc)
+ nc = rnp[i];
+ ll -= nc;
+ f__rp = rpp[i];
+ while(--nc >= 0)
+ *lp++ = *f__rp++;
+ }
+while(--ll >= 0)
+ *lp++ = ' ';
+}
diff --git a/lib/libF77/s_cmp.c b/lib/libF77/s_cmp.c
new file mode 100644
index 000000000000..9e4c12619a2f
--- /dev/null
+++ b/lib/libF77/s_cmp.c
@@ -0,0 +1,42 @@
+#include "f2c.h"
+
+/* compare two strings */
+
+#ifdef KR_headers
+integer s_cmp(a, b, la, lb) register char *a, *b; ftnlen la, lb;
+#else
+integer s_cmp(register char *a, register char *b, ftnlen la, ftnlen lb)
+#endif
+{
+register char *aend, *bend;
+aend = a + la;
+bend = b + lb;
+
+if(la <= lb)
+ {
+ while(a < aend)
+ if(*a != *b)
+ return( *a - *b );
+ else
+ { ++a; ++b; }
+
+ while(b < bend)
+ if(*b != ' ')
+ return( ' ' - *b );
+ else ++b;
+ }
+
+else
+ {
+ while(b < bend)
+ if(*a == *b)
+ { ++a; ++b; }
+ else
+ return( *a - *b );
+ while(a < aend)
+ if(*a != ' ')
+ return(*a - ' ');
+ else ++a;
+ }
+return(0);
+}
diff --git a/lib/libF77/s_copy.c b/lib/libF77/s_copy.c
new file mode 100644
index 000000000000..989f5dded9b0
--- /dev/null
+++ b/lib/libF77/s_copy.c
@@ -0,0 +1,27 @@
+#include "f2c.h"
+
+/* assign strings: a = b */
+
+#ifdef KR_headers
+VOID s_copy(a, b, la, lb) register char *a, *b; ftnlen la, lb;
+#else
+void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb)
+#endif
+{
+register char *aend, *bend;
+
+aend = a + la;
+
+if(la <= lb)
+ while(a < aend)
+ *a++ = *b++;
+
+else
+ {
+ bend = b + lb;
+ while(b < bend)
+ *a++ = *b++;
+ while(a < aend)
+ *a++ = ' ';
+ }
+}
diff --git a/lib/libF77/s_paus.c b/lib/libF77/s_paus.c
new file mode 100644
index 000000000000..35107d880734
--- /dev/null
+++ b/lib/libF77/s_paus.c
@@ -0,0 +1,64 @@
+#include "stdio.h"
+#include "f2c.h"
+#define PAUSESIG 15
+
+#ifdef KR_headers
+#define Void /* void */
+#define Int /* int */
+#else
+#define Void void
+#define Int int
+#undef abs
+#include "stdlib.h"
+#include "signal.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int getpid(void), isatty(int), pause(void);
+#endif
+
+extern VOID f_exit(Void);
+
+static VOID waitpause(Int n)
+{
+return;
+}
+
+#ifdef KR_headers
+int s_paus(s, n) char *s; ftnlen n;
+#else
+int s_paus(char *s, ftnlen n)
+#endif
+{
+int i;
+
+fprintf(stderr, "PAUSE ");
+if(n > 0)
+ for(i = 0; i<n ; ++i)
+ putc(*s++, stderr);
+fprintf(stderr, " statement executed\n");
+if( isatty(fileno(stdin)) )
+ {
+ fprintf(stderr, "To resume execution, type go. Any other input will terminate job.\n");
+ fflush(stderr);
+ if( getchar()!='g' || getchar()!='o' || getchar()!='\n' )
+ {
+ fprintf(stderr, "STOP\n");
+ f_exit();
+ exit(0);
+ }
+ }
+else
+ {
+ fprintf(stderr, "To resume execution, execute a kill -%d %d command\n",
+ PAUSESIG, getpid() );
+ signal(PAUSESIG, waitpause);
+ fflush(stderr);
+ pause();
+ }
+fprintf(stderr, "Execution resumes after PAUSE.\n");
+#ifdef __cplusplus
+return 0; /* NOT REACHED */
+}
+#endif
+}
diff --git a/lib/libF77/s_rnge.c b/lib/libF77/s_rnge.c
new file mode 100644
index 000000000000..b200fce1bf34
--- /dev/null
+++ b/lib/libF77/s_rnge.c
@@ -0,0 +1,26 @@
+#include "stdio.h"
+#include "f2c.h"
+
+/* called when a subscript is out of range */
+
+#ifdef KR_headers
+extern VOID sig_die();
+integer s_rnge(varn, offset, procn, line) char *varn, *procn; ftnint offset, line;
+#else
+extern VOID sig_die(char*,int);
+integer s_rnge(char *varn, ftnint offset, char *procn, ftnint line)
+#endif
+{
+register int i;
+
+fprintf(stderr, "Subscript out of range on file line %ld, procedure ", line);
+while((i = *procn) && i != '_' && i != ' ')
+ putc(*procn++, stderr);
+fprintf(stderr, ".\nAttempt to access the %ld-th element of variable ", offset+1);
+while((i = *varn) && i != ' ')
+ putc(*varn++, stderr);
+sig_die(".", 1);
+#ifdef __cplusplus
+return 0;
+#endif
+}
diff --git a/lib/libF77/s_stop.c b/lib/libF77/s_stop.c
new file mode 100644
index 000000000000..7a3b4aa75431
--- /dev/null
+++ b/lib/libF77/s_stop.c
@@ -0,0 +1,33 @@
+#include "stdio.h"
+#include "f2c.h"
+
+#ifdef KR_headers
+extern void f_exit();
+VOID s_stop(s, n) char *s; ftnlen n;
+#else
+#undef abs
+#include "stdlib.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+void f_exit(void);
+
+int s_stop(char *s, ftnlen n)
+#endif
+{
+int i;
+
+if(n > 0)
+ {
+ fprintf(stderr, "STOP ");
+ for(i = 0; i<n ; ++i)
+ putc(*s++, stderr);
+ fprintf(stderr, " statement executed\n");
+ }
+f_exit();
+exit(0);
+#ifdef __cplusplus
+return 0; /* NOT REACHED */
+}
+#endif
+}
diff --git a/lib/libF77/sig_die.c b/lib/libF77/sig_die.c
new file mode 100644
index 000000000000..91638b0ad473
--- /dev/null
+++ b/lib/libF77/sig_die.c
@@ -0,0 +1,37 @@
+#include "stdio.h"
+#include "signal.h"
+
+#ifndef SIGIOT
+#define SIGIOT SIGABRT
+#endif
+
+#ifdef KR_headers
+void sig_die(s, kill) register char *s; int kill;
+#else
+#include "stdlib.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+ extern void f_exit(void);
+
+void sig_die(register char *s, int kill)
+#endif
+{
+ /* print error message, then clear buffers */
+ fprintf(stderr, "%s\n", s);
+ fflush(stderr);
+ f_exit();
+ fflush(stderr);
+
+ if(kill)
+ {
+ /* now get a core */
+ signal(SIGIOT, SIG_DFL);
+ abort();
+ }
+ else
+ exit(1);
+ }
+#ifdef __cplusplus
+}
+#endif
diff --git a/lib/libF77/signal_.c b/lib/libF77/signal_.c
new file mode 100644
index 000000000000..90ec7ea39af2
--- /dev/null
+++ b/lib/libF77/signal_.c
@@ -0,0 +1,19 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+typedef int (*sig_type)();
+extern sig_type signal();
+
+ftnint signal_(sigp, proc) integer *sigp; sig_type proc;
+#else
+#include "signal.h"
+typedef void (*sig_type)(int);
+
+ftnint signal_(integer *sigp, sig_type proc)
+#endif
+{
+ int sig;
+ sig = (int)*sigp;
+
+ return (ftnint)signal(sig, proc);
+ }
diff --git a/lib/libF77/system_.c b/lib/libF77/system_.c
new file mode 100644
index 000000000000..181850b51b13
--- /dev/null
+++ b/lib/libF77/system_.c
@@ -0,0 +1,22 @@
+/* f77 interface to system routine */
+
+#include "f2c.h"
+
+#ifdef KR_headers
+system_(s, n) register char *s; ftnlen n;
+#else
+#undef abs
+#include "stdlib.h"
+system_(register char *s, ftnlen n)
+#endif
+{
+char buff[1000];
+register char *bp, *blast;
+
+blast = buff + (n < 1000 ? n : 1000);
+
+for(bp = buff ; bp<blast && *s!='\0' ; )
+ *bp++ = *s++;
+*bp = '\0';
+return system(buff);
+}
diff --git a/lib/libF77/z_abs.c.obsolete b/lib/libF77/z_abs.c.obsolete
new file mode 100644
index 000000000000..7e67ad2957fb
--- /dev/null
+++ b/lib/libF77/z_abs.c.obsolete
@@ -0,0 +1,12 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double f__cabs();
+double z_abs(z) doublecomplex *z;
+#else
+double f__cabs(double, double);
+double z_abs(doublecomplex *z)
+#endif
+{
+return( f__cabs( z->r, z->i ) );
+}
diff --git a/lib/libF77/z_cos.c b/lib/libF77/z_cos.c
new file mode 100644
index 000000000000..bc9e23e18a72
--- /dev/null
+++ b/lib/libF77/z_cos.c
@@ -0,0 +1,14 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double sin(), cos(), sinh(), cosh();
+VOID z_cos(r, z) doublecomplex *r, *z;
+#else
+#undef abs
+#include "math.h"
+void z_cos(doublecomplex *r, doublecomplex *z)
+#endif
+{
+r->r = cos(z->r) * cosh(z->i);
+r->i = - sin(z->r) * sinh(z->i);
+}
diff --git a/lib/libF77/z_div.c b/lib/libF77/z_div.c
new file mode 100644
index 000000000000..fd53733e8827
--- /dev/null
+++ b/lib/libF77/z_div.c
@@ -0,0 +1,36 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+extern void sig_die();
+VOID z_div(c, a, b) doublecomplex *a, *b, *c;
+#else
+extern void sig_die(char*, int);
+void z_div(doublecomplex *c, doublecomplex *a, doublecomplex *b)
+#endif
+{
+double ratio, den;
+double abr, abi;
+
+if( (abr = b->r) < 0.)
+ abr = - abr;
+if( (abi = b->i) < 0.)
+ abi = - abi;
+if( abr <= abi )
+ {
+ if(abi == 0)
+ sig_die("complex division by zero", 1);
+ ratio = b->r / b->i ;
+ den = b->i * (1 + ratio*ratio);
+ c->r = (a->r*ratio + a->i) / den;
+ c->i = (a->i*ratio - a->r) / den;
+ }
+
+else
+ {
+ ratio = b->i / b->r ;
+ den = b->r * (1 + ratio*ratio);
+ c->r = (a->r + a->i*ratio) / den;
+ c->i = (a->i - a->r*ratio) / den;
+ }
+
+}
diff --git a/lib/libF77/z_exp.c b/lib/libF77/z_exp.c
new file mode 100644
index 000000000000..56138f3d34b4
--- /dev/null
+++ b/lib/libF77/z_exp.c
@@ -0,0 +1,17 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double exp(), cos(), sin();
+VOID z_exp(r, z) doublecomplex *r, *z;
+#else
+#undef abs
+#include "math.h"
+void z_exp(doublecomplex *r, doublecomplex *z)
+#endif
+{
+double expx;
+
+expx = exp(z->r);
+r->r = expx * cos(z->i);
+r->i = expx * sin(z->i);
+}
diff --git a/lib/libF77/z_log.c b/lib/libF77/z_log.c
new file mode 100644
index 000000000000..fa1ac803eb3a
--- /dev/null
+++ b/lib/libF77/z_log.c
@@ -0,0 +1,16 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double log(), f__cabs(), atan2();
+VOID z_log(r, z) doublecomplex *r, *z;
+#else
+#undef abs
+#include "math.h"
+extern double f__cabs(double, double);
+void z_log(doublecomplex *r, doublecomplex *z)
+#endif
+{
+
+r->i = atan2(z->i, z->r);
+r->r = log( f__cabs( z->r, z->i ) );
+}
diff --git a/lib/libF77/z_sin.c b/lib/libF77/z_sin.c
new file mode 100644
index 000000000000..bd908046f394
--- /dev/null
+++ b/lib/libF77/z_sin.c
@@ -0,0 +1,14 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double sin(), cos(), sinh(), cosh();
+VOID z_sin(r, z) doublecomplex *r, *z;
+#else
+#undef abs
+#include "math.h"
+void z_sin(doublecomplex *r, doublecomplex *z)
+#endif
+{
+r->r = sin(z->r) * cosh(z->i);
+r->i = cos(z->r) * sinh(z->i);
+}
diff --git a/lib/libF77/z_sqrt.c b/lib/libF77/z_sqrt.c
new file mode 100644
index 000000000000..eed38d0cef85
--- /dev/null
+++ b/lib/libF77/z_sqrt.c
@@ -0,0 +1,29 @@
+#include "f2c.h"
+
+#ifdef KR_headers
+double sqrt(), f__cabs();
+VOID z_sqrt(r, z) doublecomplex *r, *z;
+#else
+#undef abs
+#include "math.h"
+extern double f__cabs(double, double);
+void z_sqrt(doublecomplex *r, doublecomplex *z)
+#endif
+{
+double mag;
+
+if( (mag = f__cabs(z->r, z->i)) == 0.)
+ r->r = r->i = 0.;
+else if(z->r > 0)
+ {
+ r->r = sqrt(0.5 * (mag + z->r) );
+ r->i = z->i / r->r / 2;
+ }
+else
+ {
+ r->i = sqrt(0.5 * (mag - z->r) );
+ if(z->i < 0)
+ r->i = - r->i;
+ r->r = z->i / r->i / 2;
+ }
+}
diff --git a/lib/libI77/Makefile b/lib/libI77/Makefile
new file mode 100644
index 000000000000..6c76a9dc9f56
--- /dev/null
+++ b/lib/libI77/Makefile
@@ -0,0 +1,14 @@
+SHLIB_MAJOR= 1
+SHLIB_MINOR= 0
+
+LIB=I77
+CFLAGS+= -DSkip_f2c_Undefs -DNON_ANSI_RW_MODES
+
+I77SRCS = Version.c backspace.c close.c dfe.c dolio.c due.c endfile.c err.c \
+ fmt.c fmtlib.c iio.c ilnw.c inquire.c lread.c lwrite.c open.c \
+ rdfmt.c rewind.c rsfe.c rsli.c rsne.c sfe.c sue.c typesize.c uio.c \
+ util.c wref.c wrtfmt.c wsfe.c wsle.c wsne.c xwsne.c
+
+SRCS= ${I77SRCS}
+
+.include <bsd.lib.mk>
diff --git a/lib/libI77/Notice b/lib/libI77/Notice
new file mode 100644
index 000000000000..64af9f12dc4e
--- /dev/null
+++ b/lib/libI77/Notice
@@ -0,0 +1,23 @@
+/****************************************************************
+Copyright 1990, 1991, 1992, 1993 by AT&T Bell Laboratories and Bellcore.
+
+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 appear in all
+copies and that both that the copyright notice and this
+permission notice and warranty disclaimer appear in supporting
+documentation, and that the names of AT&T Bell Laboratories or
+Bellcore or any of their entities not be used in advertising or
+publicity pertaining to distribution of the software without
+specific, written prior permission.
+
+AT&T and Bellcore disclaim all warranties with regard to this
+software, including all implied warranties of merchantability
+and fitness. In no event shall AT&T or Bellcore be liable for
+any special, 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.
+****************************************************************/
+
diff --git a/lib/libI77/README b/lib/libI77/README
new file mode 100644
index 000000000000..86132a794552
--- /dev/null
+++ b/lib/libI77/README
@@ -0,0 +1,155 @@
+If your compiler does not recognize ANSI C headers,
+compile with KR_headers defined: either add -DKR_headers
+to the definition of CFLAGS in the makefile, or insert
+
+#define KR_headers
+
+at the top of f2c.h and fmtlib.c .
+
+
+If you have a really ancient K&R C compiler that does not understand
+void, add -Dvoid=int to the definition of CFLAGS in the makefile.
+
+If you use a C++ compiler, first create a local f2c.h by appending
+f2ch.add to the usual f2c.h, e.g., by issuing the command
+ make f2c.h
+which assumes f2c.h is installed in /usr/include .
+
+If your system lacks /usr/include/local.h ,
+then you should create an appropriate local.h in
+this directory. An appropriate local.h may simply
+be empty, or it may #define VAX or #define CRAY
+(or whatever else you must do to make fp.h work right).
+Alternatively, edit fp.h to suite your machine.
+
+If your system lacks /usr/include/fcntl.h , then you
+should simply create an empty fcntl.h in this directory.
+If your compiler then complains about creat and open not
+having a prototype, compile with OPEN_DECL defined.
+On many systems, open and creat are declared in fcntl.h .
+
+If your system has /usr/include/fcntl.h, you may need to add
+-D_POSIX_SOURCE to the makefile's definition of CFLAGS.
+
+If your system's sprintf does not work the way ANSI C
+specifies -- specifically, if it does not return the
+number of characters transmitted -- then insert the line
+
+#define USE_STRLEN
+
+at the end of fmt.h . This is necessary with
+at least some versions of Sun software.
+
+If your system's fopen does not like the ANSI binary
+reading and writing modes "rb" and "wb", then you should
+compile open.c with NON_ANSI_RW_MODES #defined.
+
+If you get error messages about references to cf->_ptr
+and cf->_base when compiling wrtfmt.c and wsfe.c or to
+stderr->_flag when compiling err.c, then insert the line
+
+#define NON_UNIX_STDIO
+
+at the beginning of fio.h, and recompile everything (or
+at least those modules that contain NON_UNIX_STDIO).
+
+Unformatted sequential records consist of a length of record
+contents, the record contents themselves, and the length of
+record contents again (for backspace). Prior to 17 Oct. 1991,
+the length was of type int; now it is of type long, but you
+can change it back to int by inserting
+
+#define UIOLEN_int
+
+at the beginning of fio.h. This affects only sue.c and uio.c .
+
+You may need to supply the following non-ANSI routines:
+
+ fstat(int fileds, struct stat *buf) is similar
+to stat(char *name, struct stat *buf), except that
+the first argument, fileds, is the file descriptor
+returned by open rather than the name of the file.
+fstat is used in the system-dependent routine
+canseek (in the libI77 source file err.c), which
+is supposed to return 1 if it's possible to issue
+seeks on the file in question, 0 if it's not; you may
+need to suitably modify err.c . On non-UNIX systems,
+you can avoid references to fstat and stat by compiling
+with NON_UNIX_STDIO defined; in that case, you may need
+to supply access(char *Name,0), which is supposed to
+return 0 if file Name exists, nonzero otherwise.
+
+ char * mktemp(char *buf) is supposed to replace the
+6 trailing X's in buf with a unique number and then
+return buf. The idea is to get a unique name for
+a temporary file.
+
+On non-UNIX systems, you may need to change a few other,
+e.g.: the form of name computed by mktemp() in endfile.c and
+open.c; the use of the open(), close(), and creat() system
+calls in endfile.c, err.c, open.c; and the modes in calls on
+fopen() and fdopen() (and perhaps the use of fdopen() itself
+-- it's supposed to return a FILE* corresponding to a given
+an integer file descriptor) in err.c and open.c (component ufmt
+of struct unit is 1 for formatted I/O -- text mode on some systems
+-- and 0 for unformatted I/O -- binary mode on some systems).
+Compiling with -DNON_UNIX_STDIO omits all references to creat()
+and almost all references to open() and close(), the exception
+being in the function f__isdev() (in open.c).
+
+For Turbo C++, in particular, you need to adjust the mktemp
+invocations and should compile all of libI77 with -DMSDOS .
+You also need to #undef ungetc in lread.c and rsne.c .
+
+If you want to be able to load against libI77 but not libF77,
+then you will need to add sig_die.o (from libF77) to libI77.
+
+If you wish to use translated Fortran that has funny notions
+of record length for direct unformatted I/O (i.e., that assumes
+RECL= values in OPEN statements are not bytes but rather counts
+of some other units -- e.g., 4-character words for VMS), then you
+should insert an appropriate #define for url_Adjust at the
+beginning of open.c . For VMS Fortran, for example,
+#define url_Adjust(x) x *= 4
+would suffice.
+
+To check for transmission errors, issue the command
+ make check
+This assumes you have the xsum program whose source, xsum.c,
+is distributed as part of "all from f2c/src". If you do not
+have xsum, you can obtain xsum.c by sending the following E-mail
+message to netlib@research.att.com
+ send xsum.c from f2c/src
+
+The makefile assumes you have installed f2c.h in a standard
+place (and does not cause recompilation when f2c.h is changed);
+f2c.h comes with "all from f2c" (the source for f2c) and is
+available separately ("f2c.h from f2c").
+
+By default, Fortran I/O units 5, 6, and 0 are pre-connected to
+stdin, stdout, and stderr, respectively. You can change this
+behavior by changing f_init() in err.c to suit your needs.
+Note that f2c assumes READ(*... means READ(5... and WRITE(*...
+means WRITE(6... . Moreover, an OPEN(n,... statement that does
+not specify a file name (and does not specify STATUS='SCRATCH')
+assumes FILE='fort.n' . You can change this by editing open.c
+and endfile.c suitably.
+
+Lines protected from compilation by #ifdef Allow_TYQUAD
+are for a possible extension to 64-bit integers in which
+integer = int = 32 bits and longint = long = 64 bits.
+
+Extensions (Feb. 1993) to NAMELIST processing:
+ 1. Reading a ? instead of &name (the start of a namelist) causes
+the namelist being sought to be written to stdout (unit 6);
+to omit this feature, compile rsne.c with -DNo_Namelist_Questions.
+ 2. Reading the wrong namelist name now leads to an error message
+and an attempt to skip input until the right namelist name is found;
+to omit this feature, compile rsne.c with -DNo_Bad_Namelist_Skip.
+ 3. Namelist writes now insert newlines before each variable; to omit
+this feature, compile xwsne.c with -DNo_Extra_Namelist_Newlines.
+
+Nonstandard extension (Feb. 1993) to open: for sequential files,
+ACCESS='APPEND' (or access='anything else starting with "A" or "a"')
+causes the file to be positioned at end-of-file, so a write will
+append to the file.
diff --git a/lib/libI77/Version.c b/lib/libI77/Version.c
new file mode 100644
index 000000000000..04edb5a1c2ec
--- /dev/null
+++ b/lib/libI77/Version.c
@@ -0,0 +1,176 @@
+static char junk[] = "\n@(#) LIBI77 VERSION pjw,dmg-mods 8 Dec. 1993\n";
+
+/*
+2.01 $ format added
+2.02 Coding bug in open.c repaired
+2.03 fixed bugs in lread.c (read * with negative f-format) and lio.c
+ and lio.h (e-format conforming to spec)
+2.04 changed open.c and err.c (fopen and freopen respectively) to
+ update to new c-library (append mode)
+2.05 added namelist capability
+2.06 allow internal list and namelist I/O
+*/
+
+/*
+close.c:
+ allow upper-case STATUS= values
+endfile.c
+ create fort.nnn if unit nnn not open;
+ else if (file length == 0) use creat() rather than copy;
+ use local copy() rather than forking /bin/cp;
+ rewind, fseek to clear buffer (for no reading past EOF)
+err.c
+ use neither setbuf nor setvbuf; make stderr buffered
+fio.h
+ #define _bufend
+inquire.c
+ upper case responses;
+ omit byfile test from SEQUENTIAL=
+ answer "YES" to DIRECT= for unopened file (open to debate)
+lio.c
+ flush stderr, stdout at end of each stmt
+ space before character strings in list output only at line start
+lio.h
+ adjust LEW, LED consistent with old libI77
+lread.c
+ use atof()
+ allow "nnn*," when reading complex constants
+open.c
+ try opening for writing when open for read fails, with
+ special uwrt value (2) delaying creat() to first write;
+ set curunit so error messages don't drop core;
+ no file name ==> fort.nnn except for STATUS='SCRATCH'
+rdfmt.c
+ use atof(); trust EOF == end-of-file (so don't read past
+ end-of-file after endfile stmt)
+sfe.c
+ flush stderr, stdout at end of each stmt
+wrtfmt.c:
+ use upper case
+ put wrt_E and wrt_F into wref.c, use sprintf()
+ rather than ecvt() and fcvt() [more accurate on VAX]
+*/
+
+/* 16 Oct. 1988: uwrt = 3 after write, rewind, so close won't zap the file. */
+
+/* 10 July 1989: change _bufend to buf_end in fio.h, wsfe.c, wrtfmt.c */
+
+/* 28 Nov. 1989: corrections for IEEE and Cray arithmetic */
+/* 29 Nov. 1989: change various int return types to long for f2c */
+/* 30 Nov. 1989: various types from f2c.h */
+/* 6 Dec. 1989: types corrected various places */
+/* 19 Dec. 1989: make iostat= work right for internal I/O */
+/* 8 Jan. 1990: add rsne, wsne -- routines for handling NAMELIST */
+/* 28 Jan. 1990: have NAMELIST read treat $ as &, general white
+ space as blank */
+/* 27 Mar. 1990: change an = to == in rd_L(rdfmt.c) so formatted reads
+ of logical values reject letters other than fFtT;
+ have nowwriting reset cf */
+/* 14 Aug. 1990: adjust lread.c to treat tabs as spaces in list input */
+/* 17 Aug. 1990: adjust open.c to recognize blank='Z...' as well as
+ blank='z...' when reopening an open file */
+/* 30 Aug. 1990: prevent embedded blanks in list output of complex values;
+ omit exponent field in list output of values of
+ magnitude between 10 and 1e8; prevent writing stdin
+ and reading stdout or stderr; don't close stdin, stdout,
+ or stderr when reopening units 5, 6, 0. */
+/* 18 Sep. 1990: add component udev to unit and consider old == new file
+ iff uinode and udev values agree; use stat rather than
+ access to check existence of file (when STATUS='OLD')*/
+/* 2 Oct. 1990: adjust rewind.c so two successive rewinds after a write
+ don't clobber the file. */
+/* 9 Oct. 1990: add #include "fcntl.h" to endfile.c, err.c, open.c;
+ adjust g_char in util.c for segmented memories. */
+/* 17 Oct. 1990: replace abort() and _cleanup() with calls on
+ sig_die(...,1) (defined in main.c). */
+/* 5 Nov. 1990: changes to open.c: complain if new= is specified and the
+ file already exists; allow file= to be omitted in open stmts
+ and allow status='replace' (Fortran 90 extensions). */
+/* 11 Dec. 1990: adjustments for POSIX. */
+/* 15 Jan. 1991: tweak i_ungetc in rsli.c to allow reading from
+ strings in read-only memory. */
+/* 25 Apr. 1991: adjust namelist stuff to work with f2c -i2 */
+/* 26 Apr. 1991: fix some bugs with NAMELIST read of multi-dim. arrays */
+/* 16 May 1991: increase LEFBL in lio.h to bypass NeXT bug */
+/* 17 Oct. 1991: change type of length field in sequential unformatted
+ records from int to long (for systems where sizeof(int)
+ can vary, depending on the compiler or compiler options). */
+/* 14 Nov. 1991: change uint to Uint in fmt.h, rdfmt.c, wrtfmt.c.
+/* 25 Nov. 1991: change uint to Uint in lwrite.c; change sizeof(int) to
+ sizeof(uioint) in fseeks in sue.c (missed on 17 Oct.). */
+/* 1 Dec. 1991: uio.c: add test for read failure (seq. unformatted reads);
+ adjust an error return from EOF to off end of record */
+/* 12 Dec. 1991: rsli.c: fix bug with internal list input that caused
+ the last character of each record to be ignored.
+ iio.c: adjust error message in internal formatted
+ input from "end-of-file" to "off end of record" if
+ the format specifies more characters than the
+ record contains. */
+/* 17 Jan. 1992: lread.c, rsne.c: in list and namelist input,
+ treat "r* ," and "r*," alike (where r is a
+ positive integer constant), and fix a bug in
+ handling null values following items with repeat
+ counts (e.g., 2*1,,3); for namelist reading
+ of a numeric array, allow a new name-value subsequence
+ to terminate the current one (as though the current
+ one ended with the right number of null values).
+ lio.h, lwrite.c: omit insignificant zeros in
+ list and namelist output. To get the old
+ behavior, compile with -DOld_list_output . */
+/* 18 Jan. 1992: make list output consistent with F format by
+ printing .1 rather than 0.1 (introduced yesterday). */
+/* 3 Feb. 1992: rsne.c: fix namelist read bug that caused the
+ character following a comma to be ignored. */
+/* 19 May 1992: adjust iio.c, ilnw.c, rdfmt.c and rsli.c to make err=
+ work with internal list and formatted I/O. */
+/* 18 July 1992: adjust rsne.c to allow namelist input to stop at
+ an & (e.g. &end). */
+/* 23 July 1992: switch to ANSI prototypes unless KR_headers is #defined ;
+ recognize Z format (assuming 8-bit bytes). */
+/* 14 Aug. 1992: tweak wrt_E in wref.c to avoid -NaN */
+/* 23 Oct. 1992: Supply missing l_eof = 0 assignment to s_rsne() in rsne.c
+ (so end-of-file on other files won't confuse namelist
+ reads of external files). Prepend f__ to external
+ names that are only of internal interest to lib[FI]77. */
+/* 1 Feb. 1993: backspace.c: fix bug that bit when last char of 2nd
+ buffer == '\n'.
+ endfile.c: guard against tiny L_tmpnam; close and reopen
+ files in t_runc().
+ lio.h: lengthen LINTW (buffer size in lwrite.c).
+ err.c, open.c: more prepending of f__ (to [rw]_mode). */
+/* 5 Feb. 1993: tweaks to NAMELIST: rsne.c: ? prints the namelist being
+ sought; namelists of the wrong name are skipped (after
+ an error message; xwsne.c: namelist writes have a
+ newline before each new variable.
+ open.c: ACCESS='APPEND' positions sequential files
+ at EOF (nonstandard extension -- that doesn't require
+ changing data structures). */
+/* 9 Feb. 1993: Change some #ifdef MSDOS lines to #ifdef NON_UNIZ_STDIO.
+ err.c: under NON_UNIX_STDIO, avoid close(creat(name,0666))
+ when the unit has another file descriptor for name. */
+/* 4 March 1993: err.c, open.c: take declaration of fdopen from rawio.h;
+ open.c: always give f__w_mode[] 4 elements for use
+ in t_runc (in endfile.c -- for change of 1 Feb. 1993). */
+/* 6 March 1993: uio.c: adjust off-end-of-record test for sequential
+ unformatted reads to respond to err= rather than end=. */
+/* 12 March 1993: various tweaks for C++ */
+/* 6 April 1993: adjust error returns for formatted inputs to flush
+ the current input line when err=label is specified.
+ To restore the old behavior (input left mid-line),
+ either adjust the #definition of errfl in fio.h or
+ omit the invocation of f__doend in err__fl (in err.c). */
+/* 23 June 1993: iio.c: fix bug in format reversions for internal writes. */
+/* 5 Aug. 1993: lread.c: fix bug in handling repetition counts for
+ logical data (during list or namelist input).
+ Change struct f__syl to struct syl (for buggy compilers). */
+/* 7 Aug. 1993: lread.c: fix bug in namelist reading of incomplete
+ logical arrays. */
+/* 9 Aug. 1993: lread.c: fix bug in namelist reading of an incomplete
+ array of numeric data followed by another namelist
+ item whose name starts with 'd', 'D', 'e', or 'E'. */
+/* 8 Sept. 1993: open.c: protect #include "sys/..." with
+ #ifndef NON_UNIX_STDIO; Version date not changed. */
+/* 10 Nov. 1993: backspace.c: add nonsense for #ifdef MSDOS */
+/* 8 Dec. 1993: iio.c: adjust internal formatted reads to treat
+ short records as though padded with blanks
+ (rather than causing an "off end of record" error). */
diff --git a/lib/libI77/backspace.c b/lib/libI77/backspace.c
new file mode 100644
index 000000000000..421342485fec
--- /dev/null
+++ b/lib/libI77/backspace.c
@@ -0,0 +1,96 @@
+#include "f2c.h"
+#include "fio.h"
+#ifdef KR_headers
+integer f_back(a) alist *a;
+#else
+integer f_back(alist *a)
+#endif
+{ unit *b;
+ int i, n, ndec;
+#ifdef MSDOS
+ int j, k;
+ long w, z;
+#endif
+ long x, y;
+ char buf[32];
+ if(a->aunit >= MXUNIT || a->aunit < 0)
+ err(a->aerr,101,"backspace")
+ b= &f__units[a->aunit];
+ if(b->useek==0) err(a->aerr,106,"backspace")
+ if(b->ufd==NULL) {
+ fk_open(1, 1, a->aunit);
+ return(0);
+ }
+ if(b->uend==1)
+ { b->uend=0;
+ return(0);
+ }
+ if(b->uwrt) {
+ (void) t_runc(a);
+ if (f__nowreading(b))
+ err(a->aerr,errno,"backspace")
+ }
+ if(b->url>0)
+ {
+ x=ftell(b->ufd);
+ y = x % b->url;
+ if(y == 0) x--;
+ x /= b->url;
+ x *= b->url;
+ (void) fseek(b->ufd,x,SEEK_SET);
+ return(0);
+ }
+
+ if(b->ufmt==0)
+ { (void) fseek(b->ufd,-(long)sizeof(int),SEEK_CUR);
+ (void) fread((char *)&n,sizeof(int),1,b->ufd);
+ (void) fseek(b->ufd,-(long)n-2*sizeof(int),SEEK_CUR);
+ return(0);
+ }
+#ifdef MSDOS
+ w = -1;
+#endif
+ for(ndec = 2;; ndec = 1)
+ {
+ y = x=ftell(b->ufd);
+ if(x<sizeof(buf)) x=0;
+ else x -= sizeof(buf);
+ (void) fseek(b->ufd,x,SEEK_SET);
+ n=fread(buf,1,(int)(y-x), b->ufd);
+ for(i=n-ndec;i>=0;i--)
+ {
+ if(buf[i]!='\n') continue;
+#ifdef MSDOS
+ for(j = k = 0; j <= i; j++)
+ if (buf[j] == '\n')
+ k++;
+ fseek(b->ufd,x,SEEK_SET);
+ do {
+ if (getc(b->ufd) == '\n') {
+ --k;
+ if ((z = ftell(b->ufd)) >= y) {
+ if (w == -1)
+ goto break2;
+ break;
+ }
+ w = z;
+ }
+ } while(k > 0);
+ fseek(b->ufd, w, SEEK_SET);
+#else
+ fseek(b->ufd,(long)(i+1-n),SEEK_CUR);
+#endif
+ return(0);
+ }
+#ifdef MSDOS
+ break2:
+#endif
+ if(x==0)
+ {
+ (void) fseek(b->ufd, 0L, SEEK_SET);
+ return(0);
+ }
+ else if(n<=0) err(a->aerr,(EOF),"backspace")
+ (void) fseek(b->ufd, x, SEEK_SET);
+ }
+}
diff --git a/lib/libI77/close.c b/lib/libI77/close.c
new file mode 100644
index 000000000000..29a7af54c1f8
--- /dev/null
+++ b/lib/libI77/close.c
@@ -0,0 +1,95 @@
+#include "f2c.h"
+#include "fio.h"
+#ifdef KR_headers
+integer f_clos(a) cllist *a;
+#else
+#undef abs
+#undef min
+#undef max
+#include "stdlib.h"
+#ifdef NON_UNIX_STDIO
+#ifndef unlink
+#define unlink remove
+#endif
+#else
+#ifdef MSDOS
+#include "io.h"
+#else
+#ifdef __cplusplus
+extern "C" int unlink(const char*);
+#else
+extern int unlink(const char*);
+#endif
+#endif
+#endif
+
+integer f_clos(cllist *a)
+#endif
+{ unit *b;
+
+ if(a->cunit >= MXUNIT) return(0);
+ b= &f__units[a->cunit];
+ if(b->ufd==NULL)
+ goto done;
+ if (!a->csta)
+ if (b->uscrtch == 1)
+ goto Delete;
+ else
+ goto Keep;
+ switch(*a->csta) {
+ default:
+ Keep:
+ case 'k':
+ case 'K':
+ if(b->uwrt == 1)
+ t_runc((alist *)a);
+ if(b->ufnm) {
+ fclose(b->ufd);
+ free(b->ufnm);
+ }
+ break;
+ case 'd':
+ case 'D':
+ Delete:
+ if(b->ufnm) {
+ fclose(b->ufd);
+ unlink(b->ufnm); /*SYSDEP*/
+ free(b->ufnm);
+ }
+ }
+ b->ufd=NULL;
+ done:
+ b->uend=0;
+ b->ufnm=NULL;
+ return(0);
+ }
+ void
+#ifdef KR_headers
+f_exit()
+#else
+f_exit(void)
+#endif
+{ int i;
+ static cllist xx;
+ if (!xx.cerr) {
+ xx.cerr=1;
+ xx.csta=NULL;
+ for(i=0;i<MXUNIT;i++)
+ {
+ xx.cunit=i;
+ (void) f_clos(&xx);
+ }
+ }
+}
+ int
+#ifdef KR_headers
+flush_()
+#else
+flush_(void)
+#endif
+{ int i;
+ for(i=0;i<MXUNIT;i++)
+ if(f__units[i].ufd != NULL && f__units[i].uwrt)
+ fflush(f__units[i].ufd);
+return 0;
+}
diff --git a/lib/libI77/dfe.c b/lib/libI77/dfe.c
new file mode 100644
index 000000000000..669c3bd8b1db
--- /dev/null
+++ b/lib/libI77/dfe.c
@@ -0,0 +1,157 @@
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+
+y_rsk(Void)
+{
+ if(f__curunit->uend || f__curunit->url <= f__recpos
+ || f__curunit->url == 1) return 0;
+ do {
+ getc(f__cf);
+ } while(++f__recpos < f__curunit->url);
+ return 0;
+}
+y_getc(Void)
+{
+ int ch;
+ if(f__curunit->uend) return(-1);
+ if((ch=getc(f__cf))!=EOF)
+ {
+ f__recpos++;
+ if(f__curunit->url>=f__recpos ||
+ f__curunit->url==1)
+ return(ch);
+ else return(' ');
+ }
+ if(feof(f__cf))
+ {
+ f__curunit->uend=1;
+ errno=0;
+ return(-1);
+ }
+ err(f__elist->cierr,errno,"readingd");
+#ifdef __cplusplus
+ return 0;
+#endif
+}
+#ifdef KR_headers
+y_putc(c)
+#else
+y_putc(int c)
+#endif
+{
+ f__recpos++;
+ if(f__recpos <= f__curunit->url || f__curunit->url==1)
+ putc(c,f__cf);
+ else
+ err(f__elist->cierr,110,"dout");
+ return(0);
+}
+y_rev(Void)
+{ /*what about work done?*/
+ if(f__curunit->url==1 || f__recpos==f__curunit->url)
+ return(0);
+ while(f__recpos<f__curunit->url)
+ (*f__putn)(' ');
+ f__recpos=0;
+ return(0);
+}
+y_err(Void)
+{
+ err(f__elist->cierr, 110, "dfe");
+#ifdef __cplusplus
+ return 0;
+#endif
+}
+
+y_newrec(Void)
+{
+ if(f__curunit->url == 1 || f__recpos == f__curunit->url) {
+ f__hiwater = f__recpos = f__cursor = 0;
+ return(1);
+ }
+ if(f__hiwater > f__recpos)
+ f__recpos = f__hiwater;
+ y_rev();
+ f__hiwater = f__cursor = 0;
+ return(1);
+}
+
+#ifdef KR_headers
+c_dfe(a) cilist *a;
+#else
+c_dfe(cilist *a)
+#endif
+{
+ f__sequential=0;
+ f__formatted=f__external=1;
+ f__elist=a;
+ f__cursor=f__scale=f__recpos=0;
+ if(a->ciunit>MXUNIT || a->ciunit<0)
+ err(a->cierr,101,"startchk");
+ f__curunit = &f__units[a->ciunit];
+ if(f__curunit->ufd==NULL && fk_open(DIR,FMT,a->ciunit))
+ err(a->cierr,104,"dfe");
+ f__cf=f__curunit->ufd;
+ if(!f__curunit->ufmt) err(a->cierr,102,"dfe")
+ if(!f__curunit->useek) err(a->cierr,104,"dfe")
+ f__fmtbuf=a->cifmt;
+ (void) fseek(f__cf,(long)f__curunit->url * (a->cirec-1),SEEK_SET);
+ f__curunit->uend = 0;
+ return(0);
+}
+#ifdef KR_headers
+integer s_rdfe(a) cilist *a;
+#else
+integer s_rdfe(cilist *a)
+#endif
+{
+ int n;
+ if(!f__init) f_init();
+ if(n=c_dfe(a))return(n);
+ f__reading=1;
+ if(f__curunit->uwrt && f__nowreading(f__curunit))
+ err(a->cierr,errno,"read start");
+ f__getn = y_getc;
+ f__doed = rd_ed;
+ f__doned = rd_ned;
+ f__dorevert = f__donewrec = y_err;
+ f__doend = y_rsk;
+ if(pars_f(f__fmtbuf)<0)
+ err(a->cierr,100,"read start");
+ fmt_bg();
+ return(0);
+}
+#ifdef KR_headers
+integer s_wdfe(a) cilist *a;
+#else
+integer s_wdfe(cilist *a)
+#endif
+{
+ int n;
+ if(!f__init) f_init();
+ if(n=c_dfe(a)) return(n);
+ f__reading=0;
+ if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
+ err(a->cierr,errno,"startwrt");
+ f__putn = y_putc;
+ f__doed = w_ed;
+ f__doned= w_ned;
+ f__dorevert = y_err;
+ f__donewrec = y_newrec;
+ f__doend = y_rev;
+ if(pars_f(f__fmtbuf)<0)
+ err(a->cierr,100,"startwrt");
+ fmt_bg();
+ return(0);
+}
+integer e_rdfe(Void)
+{
+ (void) en_fio();
+ return(0);
+}
+integer e_wdfe(Void)
+{
+ (void) en_fio();
+ return(0);
+}
diff --git a/lib/libI77/disclaimer b/lib/libI77/disclaimer
new file mode 100644
index 000000000000..59db1ecf42fd
--- /dev/null
+++ b/lib/libI77/disclaimer
@@ -0,0 +1,15 @@
+f2c is a Fortran to C converter under development by
+ David Gay (AT&T Bell Labs)
+ Stu Feldman (Bellcore)
+ Mark Maimone (Carnegie-Mellon University)
+ Norm Schryer (AT&T Bell Labs)
+Please send bug reports to dmg@research.att.com or uunet!research!dmg.
+
+AT&T and Bellcore disclaim all warranties with regard to this
+software, including all implied warranties of merchantability
+and fitness. In no event shall AT&T or Bellcore be liable for
+any special, 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.
diff --git a/lib/libI77/dolio.c b/lib/libI77/dolio.c
new file mode 100644
index 000000000000..4b5a2ca6588c
--- /dev/null
+++ b/lib/libI77/dolio.c
@@ -0,0 +1,20 @@
+#include "f2c.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef KR_headers
+extern int (*f__lioproc)();
+
+integer do_lio(type,number,ptr,len) ftnint *number,*type; char *ptr; ftnlen len;
+#else
+extern int (*f__lioproc)(ftnint*, char*, ftnlen, ftnint);
+
+integer do_lio(ftnint *type, ftnint *number, char *ptr, ftnlen len)
+#endif
+{
+ return((*f__lioproc)(number,ptr,len,*type));
+}
+#ifdef __cplusplus
+ }
+#endif
diff --git a/lib/libI77/due.c b/lib/libI77/due.c
new file mode 100644
index 000000000000..33ee02c3cd29
--- /dev/null
+++ b/lib/libI77/due.c
@@ -0,0 +1,64 @@
+#include "f2c.h"
+#include "fio.h"
+
+#ifdef KR_headers
+c_due(a) cilist *a;
+#else
+c_due(cilist *a)
+#endif
+{
+ if(!f__init) f_init();
+ if(a->ciunit>=MXUNIT || a->ciunit<0)
+ err(a->cierr,101,"startio");
+ f__sequential=f__formatted=f__recpos=0;
+ f__external=1;
+ f__curunit = &f__units[a->ciunit];
+ f__elist=a;
+ if(f__curunit->ufd==NULL && fk_open(DIR,UNF,a->ciunit) ) err(a->cierr,104,"due");
+ f__cf=f__curunit->ufd;
+ if(f__curunit->ufmt) err(a->cierr,102,"cdue")
+ if(!f__curunit->useek) err(a->cierr,104,"cdue")
+ if(f__curunit->ufd==NULL) err(a->cierr,114,"cdue")
+ (void) fseek(f__cf,(long)(a->cirec-1)*f__curunit->url,SEEK_SET);
+ f__curunit->uend = 0;
+ return(0);
+}
+#ifdef KR_headers
+integer s_rdue(a) cilist *a;
+#else
+integer s_rdue(cilist *a)
+#endif
+{
+ int n;
+ if(n=c_due(a)) return(n);
+ f__reading=1;
+ if(f__curunit->uwrt && f__nowreading(f__curunit))
+ err(a->cierr,errno,"read start");
+ return(0);
+}
+#ifdef KR_headers
+integer s_wdue(a) cilist *a;
+#else
+integer s_wdue(cilist *a)
+#endif
+{
+ int n;
+ if(n=c_due(a)) return(n);
+ f__reading=0;
+ if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
+ err(a->cierr,errno,"write start");
+ return(0);
+}
+integer e_rdue(Void)
+{
+ if(f__curunit->url==1 || f__recpos==f__curunit->url)
+ return(0);
+ (void) fseek(f__cf,(long)(f__curunit->url-f__recpos),SEEK_CUR);
+ if(ftell(f__cf)%f__curunit->url)
+ err(f__elist->cierr,200,"syserr");
+ return(0);
+}
+integer e_wdue(Void)
+{
+ return(e_rdue());
+}
diff --git a/lib/libI77/endfile.c b/lib/libI77/endfile.c
new file mode 100644
index 000000000000..68e1f2f3fa0b
--- /dev/null
+++ b/lib/libI77/endfile.c
@@ -0,0 +1,195 @@
+#include "f2c.h"
+#include "fio.h"
+#ifndef NON_UNIX_STDIO
+#include "sys/types.h"
+#endif
+#include "rawio.h"
+
+#ifdef KR_headers
+extern char *strcpy();
+#else
+#undef abs
+#undef min
+#undef max
+#include "stdlib.h"
+#include "string.h"
+#endif
+
+#ifdef NON_UNIX_STDIO
+#ifndef unlink
+#define unlink remove
+#endif
+#else
+#ifdef MSDOS
+#include "io.h"
+#endif
+#endif
+
+#ifdef NON_UNIX_STDIO
+extern char *f__r_mode[], *f__w_mode[];
+#endif
+
+#ifdef KR_headers
+integer f_end(a) alist *a;
+#else
+integer f_end(alist *a)
+#endif
+{
+ unit *b;
+ if(a->aunit>=MXUNIT || a->aunit<0) err(a->aerr,101,"endfile");
+ b = &f__units[a->aunit];
+ if(b->ufd==NULL) {
+ char nbuf[10];
+ (void) sprintf(nbuf,"fort.%ld",a->aunit);
+#ifdef NON_UNIX_STDIO
+ { FILE *tf;
+ if (tf = fopen(nbuf, f__w_mode[0]))
+ fclose(tf);
+ }
+#else
+ close(creat(nbuf, 0666));
+#endif
+ return(0);
+ }
+ b->uend=1;
+ return(b->useek ? t_runc(a) : 0);
+}
+
+ static int
+#ifdef NON_UNIX_STDIO
+#ifdef KR_headers
+copy(from, len, to) char *from, *to; register long len;
+#else
+copy(FILE *from, register long len, FILE *to)
+#endif
+{
+ int k, len1;
+ char buf[BUFSIZ];
+
+ while(fread(buf, len1 = len > BUFSIZ ? BUFSIZ : (int)len, 1, from)) {
+ if (!fwrite(buf, len1, 1, to))
+ return 1;
+ if ((len -= len1) <= 0)
+ break;
+ }
+ return 0;
+ }
+#else
+#ifdef KR_headers
+copy(from, len, to) char *from, *to; register long len;
+#else
+copy(char *from, register long len, char *to)
+#endif
+{
+ register int n;
+ int k, rc = 0, tmp;
+ char buf[BUFSIZ];
+
+ if ((k = open(from, O_RDONLY)) < 0)
+ return 1;
+ if ((tmp = creat(to,0666)) < 0)
+ return 1;
+ while((n = read(k, buf, len > BUFSIZ ? BUFSIZ : (int)len)) > 0) {
+ if (write(tmp, buf, n) != n)
+ { rc = 1; break; }
+ if ((len -= n) <= 0)
+ break;
+ }
+ close(k);
+ close(tmp);
+ return n < 0 ? 1 : rc;
+ }
+#endif
+
+#ifndef L_tmpnam
+#define L_tmpnam 16
+#endif
+
+ int
+#ifdef KR_headers
+t_runc(a) alist *a;
+#else
+t_runc(alist *a)
+#endif
+{
+ char nm[L_tmpnam+12]; /* extra space in case L_tmpnam is tiny */
+ long loc, len;
+ unit *b;
+#ifdef NON_UNIX_STDIO
+ FILE *bf, *tf;
+#else
+ FILE *bf;
+#endif
+ int rc = 0;
+
+ b = &f__units[a->aunit];
+ if(b->url)
+ return(0); /*don't truncate direct files*/
+ loc=ftell(bf = b->ufd);
+ fseek(bf,0L,SEEK_END);
+ len=ftell(bf);
+ if (loc >= len || b->useek == 0 || b->ufnm == NULL)
+ return(0);
+#ifdef NON_UNIX_STDIO
+ fclose(b->ufd);
+#else
+ rewind(b->ufd); /* empty buffer */
+#endif
+ if (!loc) {
+#ifdef NON_UNIX_STDIO
+ if (!(bf = fopen(b->ufnm, f__w_mode[b->ufmt])))
+#else
+ if (close(creat(b->ufnm,0666)))
+#endif
+ rc = 1;
+ if (b->uwrt)
+ b->uwrt = 1;
+ goto done;
+ }
+#ifdef _POSIX_SOURCE
+ tmpnam(nm);
+#else
+ strcpy(nm,"tmp.FXXXXXX");
+ mktemp(nm);
+#endif
+#ifdef NON_UNIX_STDIO
+ if (!(bf = fopen(b->ufnm, f__r_mode[0]))) {
+ bad:
+ rc = 1;
+ goto done;
+ }
+ if (!(tf = fopen(nm, f__w_mode[0])))
+ goto bad;
+ if (copy(bf, loc, tf)) {
+ bad1:
+ rc = 1;
+ goto done1;
+ }
+ if (!(bf = freopen(b->ufnm, f__w_mode[0], bf)))
+ goto bad1;
+ if (!(tf = freopen(nm, f__r_mode[0], tf)))
+ goto bad1;
+ if (copy(tf, loc, bf))
+ goto bad1;
+ if (f__w_mode[0] != f__w_mode[b->ufmt]) {
+ if (!(bf = freopen(b->ufnm, f__w_mode[b->ufmt+2], bf)))
+ goto bad1;
+ fseek(bf, loc, SEEK_SET);
+ }
+done1:
+ fclose(tf);
+ unlink(nm);
+done:
+ f__cf = b->ufd = bf;
+#else
+ if (copy(b->ufnm, loc, nm)
+ || copy(nm, loc, b->ufnm))
+ rc = 1;
+ unlink(nm);
+ fseek(b->ufd, loc, SEEK_SET);
+done:
+#endif
+ if (rc)
+ err(a->aerr,111,"endfile");
+ return 0;
+ }
diff --git a/lib/libI77/err.c b/lib/libI77/err.c
new file mode 100644
index 000000000000..85966261d8a4
--- /dev/null
+++ b/lib/libI77/err.c
@@ -0,0 +1,275 @@
+#ifndef NON_UNIX_STDIO
+#include "sys/types.h"
+#include "sys/stat.h"
+#endif
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h" /* for struct syl */
+#include "rawio.h" /* for fcntl.h, fdopen */
+#include "local.h"
+#ifdef NON_UNIX_STDIO
+#ifdef KR_headers
+extern char *malloc();
+#else
+#undef abs
+#undef min
+#undef max
+#include "stdlib.h"
+#endif
+#endif
+
+/*global definitions*/
+unit f__units[MXUNIT]; /*unit table*/
+flag f__init; /*0 on entry, 1 after initializations*/
+cilist *f__elist; /*active external io list*/
+flag f__reading; /*1 if reading, 0 if writing*/
+flag f__cplus,f__cblank;
+char *f__fmtbuf;
+flag f__external; /*1 if external io, 0 if internal */
+#ifdef KR_headers
+int (*f__doed)(),(*f__doned)();
+int (*f__doend)(),(*f__donewrec)(),(*f__dorevert)();
+int (*f__getn)(),(*f__putn)(); /*for formatted io*/
+#else
+int (*f__getn)(void),(*f__putn)(int); /*for formatted io*/
+int (*f__doed)(struct syl*, char*, ftnlen),(*f__doned)(struct syl*);
+int (*f__dorevert)(void),(*f__donewrec)(void),(*f__doend)(void);
+#endif
+flag f__sequential; /*1 if sequential io, 0 if direct*/
+flag f__formatted; /*1 if formatted io, 0 if unformatted*/
+FILE *f__cf; /*current file*/
+unit *f__curunit; /*current unit*/
+int f__recpos; /*place in current record*/
+int f__cursor,f__scale;
+
+/*error messages*/
+char *F_err[] =
+{
+ "error in format", /* 100 */
+ "illegal unit number", /* 101 */
+ "formatted io not allowed", /* 102 */
+ "unformatted io not allowed", /* 103 */
+ "direct io not allowed", /* 104 */
+ "sequential io not allowed", /* 105 */
+ "can't backspace file", /* 106 */
+ "null file name", /* 107 */
+ "can't stat file", /* 108 */
+ "unit not connected", /* 109 */
+ "off end of record", /* 110 */
+ "truncation failed in endfile", /* 111 */
+ "incomprehensible list input", /* 112 */
+ "out of free space", /* 113 */
+ "unit not connected", /* 114 */
+ "read unexpected character", /* 115 */
+ "bad logical input field", /* 116 */
+ "bad variable type", /* 117 */
+ "bad namelist name", /* 118 */
+ "variable not in namelist", /* 119 */
+ "no end record", /* 120 */
+ "variable count incorrect", /* 121 */
+ "subscript for scalar variable", /* 122 */
+ "invalid array section", /* 123 */
+ "substring out of bounds", /* 124 */
+ "subscript out of bounds", /* 125 */
+ "can't read file", /* 126 */
+ "can't write file", /* 127 */
+ "'new' file exists", /* 128 */
+ "can't append to file" /* 129 */
+};
+#define MAXERR (sizeof(F_err)/sizeof(char *)+100)
+
+#ifdef KR_headers
+f__canseek(f) FILE *f; /*SYSDEP*/
+#else
+f__canseek(FILE *f) /*SYSDEP*/
+#endif
+{
+#ifdef NON_UNIX_STDIO
+ return !isatty(fileno(f));
+#else
+ struct stat x;
+
+ if (fstat(fileno(f),&x) < 0)
+ return(0);
+#ifdef S_IFMT
+ switch(x.st_mode & S_IFMT) {
+ case S_IFDIR:
+ case S_IFREG:
+ if(x.st_nlink > 0) /* !pipe */
+ return(1);
+ else
+ return(0);
+ case S_IFCHR:
+ if(isatty(fileno(f)))
+ return(0);
+ return(1);
+#ifdef S_IFBLK
+ case S_IFBLK:
+ return(1);
+#endif
+ }
+#else
+#ifdef S_ISDIR
+ /* POSIX version */
+ if (S_ISREG(x.st_mode) || S_ISDIR(x.st_mode)) {
+ if(x.st_nlink > 0) /* !pipe */
+ return(1);
+ else
+ return(0);
+ }
+ if (S_ISCHR(x.st_mode)) {
+ if(isatty(fileno(f)))
+ return(0);
+ return(1);
+ }
+ if (S_ISBLK(x.st_mode))
+ return(1);
+#else
+ Help! How does fstat work on this system?
+#endif
+#endif
+ return(0); /* who knows what it is? */
+#endif
+}
+
+ void
+#ifdef KR_headers
+f__fatal(n,s) char *s;
+#else
+f__fatal(int n, char *s)
+#endif
+{
+ if(n<100 && n>=0) perror(s); /*SYSDEP*/
+ else if(n >= (int)MAXERR || n < -1)
+ { fprintf(stderr,"%s: illegal error number %d\n",s,n);
+ }
+ else if(n == -1) fprintf(stderr,"%s: end of file\n",s);
+ else
+ fprintf(stderr,"%s: %s\n",s,F_err[n-100]);
+ if (f__curunit) {
+ fprintf(stderr,"apparent state: unit %d ",f__curunit-f__units);
+ fprintf(stderr, f__curunit->ufnm ? "named %s\n" : "(unnamed)\n",
+ f__curunit->ufnm);
+ }
+ else
+ fprintf(stderr,"apparent state: internal I/O\n");
+ if (f__fmtbuf)
+ fprintf(stderr,"last format: %s\n",f__fmtbuf);
+ fprintf(stderr,"lately %s %s %s %s",f__reading?"reading":"writing",
+ f__sequential?"sequential":"direct",f__formatted?"formatted":"unformatted",
+ f__external?"external":"internal");
+ sig_die(" IO", 1);
+}
+/*initialization routine*/
+ VOID
+f_init(Void)
+{ unit *p;
+
+ f__init=1;
+ p= &f__units[0];
+ p->ufd=stderr;
+ p->useek=f__canseek(stderr);
+#ifdef NON_UNIX_STDIO
+ setbuf(stderr, (char *)malloc(BUFSIZ));
+#else
+ stderr->_flag &= ~_IONBF;
+#endif
+ p->ufmt=1;
+ p->uwrt=1;
+ p = &f__units[5];
+ p->ufd=stdin;
+ p->useek=f__canseek(stdin);
+ p->ufmt=1;
+ p->uwrt=0;
+ p= &f__units[6];
+ p->ufd=stdout;
+ p->useek=f__canseek(stdout);
+ /* IOLBUF and setvbuf only in system 5+ */
+#ifdef COMMENTED_OUT
+ if(isatty(fileno(stdout))) {
+ extern char _sobuf[];
+ setbuf(stdout, _sobuf);
+ /* setvbuf(stdout, _IOLBF, 0, 0); /* the buf arg in setvbuf? */
+ p->useek = 1; /* only within a record no bigger than BUFSIZ */
+ }
+#endif
+ p->ufmt=1;
+ p->uwrt=1;
+}
+#ifdef KR_headers
+f__nowreading(x) unit *x;
+#else
+f__nowreading(unit *x)
+#endif
+{
+ long loc;
+ extern char *f__r_mode[];
+ if (!x->ufnm)
+ goto cantread;
+ loc=ftell(x->ufd);
+ if(freopen(x->ufnm,f__r_mode[x->ufmt],x->ufd) == NULL) {
+ cantread:
+ errno = 126;
+ return(1);
+ }
+ x->uwrt=0;
+ (void) fseek(x->ufd,loc,SEEK_SET);
+ return(0);
+}
+#ifdef KR_headers
+f__nowwriting(x) unit *x;
+#else
+f__nowwriting(unit *x)
+#endif
+{
+ long loc;
+ int k;
+ extern char *f__w_mode[];
+
+ if (!x->ufnm)
+ goto cantwrite;
+ if (x->uwrt == 3) { /* just did write, rewind */
+#ifdef NON_UNIX_STDIO
+ if (!(f__cf = x->ufd =
+ freopen(x->ufnm,f__w_mode[x->ufmt],x->ufd)))
+#else
+ if (close(creat(x->ufnm,0666)))
+#endif
+ goto cantwrite;
+ }
+ else {
+ loc=ftell(x->ufd);
+#ifdef NON_UNIX_STDIO
+ if (!(f__cf = x->ufd =
+ freopen(x->ufnm, f__w_mode[x->ufmt+2], x->ufd)))
+#else
+ if (fclose(x->ufd) < 0
+ || (k = x->uwrt == 2 ? creat(x->ufnm,0666)
+ : open(x->ufnm,O_WRONLY)) < 0
+ || (f__cf = x->ufd = fdopen(k,f__w_mode[x->ufmt])) == NULL)
+#endif
+ {
+ x->ufd = NULL;
+ cantwrite:
+ errno = 127;
+ return(1);
+ }
+ (void) fseek(x->ufd,loc,SEEK_SET);
+ }
+ x->uwrt = 1;
+ return(0);
+}
+
+ int
+#ifdef KR_headers
+err__fl(f, m, s) int f, m; char *s;
+#else
+err__fl(int f, int m, char *s)
+#endif
+{
+ if (!f)
+ f__fatal(m, s);
+ if (f__doend)
+ (*f__doend)();
+ return errno = m;
+ }
diff --git a/lib/libI77/f2ch.add b/lib/libI77/f2ch.add
new file mode 100644
index 000000000000..4ab0d8078c65
--- /dev/null
+++ b/lib/libI77/f2ch.add
@@ -0,0 +1,162 @@
+/* If you are using a C++ compiler, append the following to f2c.h
+ for compiling libF77 and libI77. */
+
+#ifdef __cplusplus
+extern "C" {
+extern int abort_(void);
+extern double c_abs(complex *);
+extern void c_cos(complex *, complex *);
+extern void c_div(complex *, complex *, complex *);
+extern void c_exp(complex *, complex *);
+extern void c_log(complex *, complex *);
+extern void c_sin(complex *, complex *);
+extern void c_sqrt(complex *, complex *);
+extern double d_abs(double *);
+extern double d_acos(double *);
+extern double d_asin(double *);
+extern double d_atan(double *);
+extern double d_atn2(double *, double *);
+extern void d_cnjg(doublecomplex *, doublecomplex *);
+extern double d_cos(double *);
+extern double d_cosh(double *);
+extern double d_dim(double *, double *);
+extern double d_exp(double *);
+extern double d_imag(doublecomplex *);
+extern double d_int(double *);
+extern double d_lg10(double *);
+extern double d_log(double *);
+extern double d_mod(double *, double *);
+extern double d_nint(double *);
+extern double d_prod(float *, float *);
+extern double d_sign(double *, double *);
+extern double d_sin(double *);
+extern double d_sinh(double *);
+extern double d_sqrt(double *);
+extern double d_tan(double *);
+extern double d_tanh(double *);
+extern double derf_(double *);
+extern double derfc_(double *);
+extern integer do_fio(ftnint *, char *, ftnlen);
+extern integer do_lio(ftnint *, ftnint *, char *, ftnlen);
+extern integer do_uio(ftnint *, char *, ftnlen);
+extern integer e_rdfe(void);
+extern integer e_rdue(void);
+extern integer e_rsfe(void);
+extern integer e_rsfi(void);
+extern integer e_rsle(void);
+extern integer e_rsli(void);
+extern integer e_rsue(void);
+extern integer e_wdfe(void);
+extern integer e_wdue(void);
+extern integer e_wsfe(void);
+extern integer e_wsfi(void);
+extern integer e_wsle(void);
+extern integer e_wsli(void);
+extern integer e_wsue(void);
+extern int ef1asc_(ftnint *, ftnlen *, ftnint *, ftnlen *);
+extern integer ef1cmc_(ftnint *, ftnlen *, ftnint *, ftnlen *);
+extern double erf(double);
+extern double erf_(float *);
+extern double erfc(double);
+extern double erfc_(float *);
+extern integer f_back(alist *);
+extern integer f_clos(cllist *);
+extern integer f_end(alist *);
+extern void f_exit(void);
+extern integer f_inqu(inlist *);
+extern integer f_open(olist *);
+extern integer f_rew(alist *);
+extern int flush_(void);
+extern void getarg_(integer *, char *, ftnlen);
+extern void getenv_(char *, char *, ftnlen, ftnlen);
+extern short h_abs(short *);
+extern short h_dim(short *, short *);
+extern short h_dnnt(double *);
+extern short h_indx(char *, char *, ftnlen, ftnlen);
+extern short h_len(char *, ftnlen);
+extern short h_mod(short *, short *);
+extern short h_nint(float *);
+extern short h_sign(short *, short *);
+extern short hl_ge(char *, char *, ftnlen, ftnlen);
+extern short hl_gt(char *, char *, ftnlen, ftnlen);
+extern short hl_le(char *, char *, ftnlen, ftnlen);
+extern short hl_lt(char *, char *, ftnlen, ftnlen);
+extern integer i_abs(integer *);
+extern integer i_dim(integer *, integer *);
+extern integer i_dnnt(double *);
+extern integer i_indx(char *, char *, ftnlen, ftnlen);
+extern integer i_len(char *, ftnlen);
+extern integer i_mod(integer *, integer *);
+extern integer i_nint(float *);
+extern integer i_sign(integer *, integer *);
+extern integer iargc_(void);
+extern ftnlen l_ge(char *, char *, ftnlen, ftnlen);
+extern ftnlen l_gt(char *, char *, ftnlen, ftnlen);
+extern ftnlen l_le(char *, char *, ftnlen, ftnlen);
+extern ftnlen l_lt(char *, char *, ftnlen, ftnlen);
+extern void pow_ci(complex *, complex *, integer *);
+extern double pow_dd(double *, double *);
+extern double pow_di(double *, integer *);
+extern short pow_hh(short *, shortint *);
+extern integer pow_ii(integer *, integer *);
+extern double pow_ri(float *, integer *);
+extern void pow_zi(doublecomplex *, doublecomplex *, integer *);
+extern void pow_zz(doublecomplex *, doublecomplex *, doublecomplex *);
+extern double r_abs(float *);
+extern double r_acos(float *);
+extern double r_asin(float *);
+extern double r_atan(float *);
+extern double r_atn2(float *, float *);
+extern void r_cnjg(complex *, complex *);
+extern double r_cos(float *);
+extern double r_cosh(float *);
+extern double r_dim(float *, float *);
+extern double r_exp(float *);
+extern double r_imag(complex *);
+extern double r_int(float *);
+extern double r_lg10(float *);
+extern double r_log(float *);
+extern double r_mod(float *, float *);
+extern double r_nint(float *);
+extern double r_sign(float *, float *);
+extern double r_sin(float *);
+extern double r_sinh(float *);
+extern double r_sqrt(float *);
+extern double r_tan(float *);
+extern double r_tanh(float *);
+extern void s_cat(char *, char **, integer *, integer *, ftnlen);
+extern integer s_cmp(char *, char *, ftnlen, ftnlen);
+extern void s_copy(char *, char *, ftnlen, ftnlen);
+extern int s_paus(char *, ftnlen);
+extern integer s_rdfe(cilist *);
+extern integer s_rdue(cilist *);
+extern integer s_rnge(char *, integer, char *, integer);
+extern integer s_rsfe(cilist *);
+extern integer s_rsfi(icilist *);
+extern integer s_rsle(cilist *);
+extern integer s_rsli(icilist *);
+extern integer s_rsne(cilist *);
+extern integer s_rsni(icilist *);
+extern integer s_rsue(cilist *);
+extern int s_stop(char *, ftnlen);
+extern integer s_wdfe(cilist *);
+extern integer s_wdue(cilist *);
+extern integer s_wsfe(cilist *);
+extern integer s_wsfi(icilist *);
+extern integer s_wsle(cilist *);
+extern integer s_wsli(icilist *);
+extern integer s_wsne(cilist *);
+extern integer s_wsni(icilist *);
+extern integer s_wsue(cilist *);
+extern void sig_die(char *, int);
+extern integer signal_(integer *, void (*)(int));
+extern int system_(char *, ftnlen);
+extern double z_abs(doublecomplex *);
+extern void z_cos(doublecomplex *, doublecomplex *);
+extern void z_div(doublecomplex *, doublecomplex *, doublecomplex *);
+extern void z_exp(doublecomplex *, doublecomplex *);
+extern void z_log(doublecomplex *, doublecomplex *);
+extern void z_sin(doublecomplex *, doublecomplex *);
+extern void z_sqrt(doublecomplex *, doublecomplex *);
+ }
+#endif
diff --git a/lib/libI77/fio.h b/lib/libI77/fio.h
new file mode 100644
index 000000000000..370942108a11
--- /dev/null
+++ b/lib/libI77/fio.h
@@ -0,0 +1,102 @@
+#include "stdio.h"
+#include "errno.h"
+#ifndef NULL
+/* ANSI C */
+#include "stddef.h"
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#define SEEK_CUR 1
+#define SEEK_END 2
+#endif
+
+#ifdef MSDOS
+#ifndef NON_UNIX_STDIO
+#define NON_UNIX_STDIO
+#endif
+#endif
+
+#ifdef UIOLEN_int
+typedef int uiolen;
+#else
+typedef long uiolen;
+#endif
+
+/*units*/
+typedef struct
+{ FILE *ufd; /*0=unconnected*/
+ char *ufnm;
+#ifndef MSDOS
+ long uinode;
+ int udev;
+#endif
+ int url; /*0=sequential*/
+ flag useek; /*true=can backspace, use dir, ...*/
+ flag ufmt;
+ flag uprnt;
+ flag ublnk;
+ flag uend;
+ flag uwrt; /*last io was write*/
+ flag uscrtch;
+} unit;
+
+extern flag f__init;
+extern cilist *f__elist; /*active external io list*/
+extern flag f__reading,f__external,f__sequential,f__formatted;
+#undef Void
+#ifdef KR_headers
+#define Void /*void*/
+extern int (*f__getn)(),(*f__putn)(); /*for formatted io*/
+extern long f__inode();
+extern VOID sig_die();
+extern int (*f__donewrec)(), t_putc(), x_wSL();
+extern int c_sfe(), err_fl(), xrd_SL();
+#else
+#define Void void
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int (*f__getn)(void),(*f__putn)(int); /*for formatted io*/
+extern long f__inode(char*,int*);
+extern void sig_die(char*,int);
+extern void f__fatal(int,char*);
+extern int t_runc(alist*);
+extern int f__nowreading(unit*), f__nowwriting(unit*);
+extern int fk_open(int,int,ftnint);
+extern int en_fio(void);
+extern void f_init(void);
+extern int (*f__donewrec)(void), t_putc(int), x_wSL(void);
+extern void b_char(char*,char*,ftnlen), g_char(char*,ftnlen,char*);
+extern int c_sfe(cilist*), z_rnew(void);
+extern int isatty(int);
+extern int err__fl(int,int,char*);
+extern int xrd_SL(void);
+#ifdef __cplusplus
+ }
+#endif
+#endif
+extern int (*f__doend)(Void);
+extern FILE *f__cf; /*current file*/
+extern unit *f__curunit; /*current unit*/
+extern unit f__units[];
+#define err(f,m,s) {if(f) errno= m; else f__fatal(m,s); return(m);}
+#define errfl(f,m,s) return err__fl(f,m,s)
+
+/*Table sizes*/
+#define MXUNIT 100
+
+extern int f__recpos; /*position in current record*/
+extern int f__cursor; /* offset to move to */
+extern int f__hiwater; /* so TL doesn't confuse us */
+
+#define WRITE 1
+#define READ 2
+#define SEQ 3
+#define DIR 4
+#define FMT 5
+#define UNF 6
+#define EXT 7
+#define INT 8
+
+#define buf_end(x) (x->_flag & _IONBF ? x->_ptr : x->_base + BUFSIZ)
diff --git a/lib/libI77/fmt.c b/lib/libI77/fmt.c
new file mode 100644
index 000000000000..12792fcf1ddb
--- /dev/null
+++ b/lib/libI77/fmt.c
@@ -0,0 +1,488 @@
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+#define skip(s) while(*s==' ') s++
+#ifdef interdata
+#define SYLMX 300
+#endif
+#ifdef pdp11
+#define SYLMX 300
+#endif
+#ifdef vax
+#define SYLMX 300
+#endif
+#ifndef SYLMX
+#define SYLMX 300
+#endif
+#define GLITCH '\2'
+ /* special quote character for stu */
+extern int f__cursor,f__scale;
+extern flag f__cblank,f__cplus; /*blanks in I and compulsory plus*/
+struct syl f__syl[SYLMX];
+int f__parenlvl,f__pc,f__revloc;
+
+#ifdef KR_headers
+char *ap_end(s) char *s;
+#else
+char *ap_end(char *s)
+#endif
+{ char quote;
+ quote= *s++;
+ for(;*s;s++)
+ { if(*s!=quote) continue;
+ if(*++s!=quote) return(s);
+ }
+ if(f__elist->cierr) {
+ errno = 100;
+ return(NULL);
+ }
+ f__fatal(100, "bad string");
+ /*NOTREACHED*/ return 0;
+}
+#ifdef KR_headers
+op_gen(a,b,c,d)
+#else
+op_gen(int a, int b, int c, int d)
+#endif
+{ struct syl *p= &f__syl[f__pc];
+ if(f__pc>=SYLMX)
+ { fprintf(stderr,"format too complicated:\n");
+ sig_die(f__fmtbuf, 1);
+ }
+ p->op=a;
+ p->p1=b;
+ p->p2=c;
+ p->p3=d;
+ return(f__pc++);
+}
+#ifdef KR_headers
+char *f_list();
+char *gt_num(s,n) char *s; int *n;
+#else
+char *f_list(char*);
+char *gt_num(char *s, int *n)
+#endif
+{ int m=0,f__cnt=0;
+ char c;
+ for(c= *s;;c = *s)
+ { if(c==' ')
+ { s++;
+ continue;
+ }
+ if(c>'9' || c<'0') break;
+ m=10*m+c-'0';
+ f__cnt++;
+ s++;
+ }
+ if(f__cnt==0) *n=1;
+ else *n=m;
+ return(s);
+}
+#ifdef KR_headers
+char *f_s(s,curloc) char *s;
+#else
+char *f_s(char *s, int curloc)
+#endif
+{
+ skip(s);
+ if(*s++!='(')
+ {
+ return(NULL);
+ }
+ if(f__parenlvl++ ==1) f__revloc=curloc;
+ if(op_gen(RET1,curloc,0,0)<0 ||
+ (s=f_list(s))==NULL)
+ {
+ return(NULL);
+ }
+ skip(s);
+ return(s);
+}
+#ifdef KR_headers
+ne_d(s,p) char *s,**p;
+#else
+ne_d(char *s, char **p)
+#endif
+{ int n,x,sign=0;
+ struct syl *sp;
+ switch(*s)
+ {
+ default:
+ return(0);
+ case ':': (void) op_gen(COLON,0,0,0); break;
+ case '$':
+ (void) op_gen(NONL, 0, 0, 0); break;
+ case 'B':
+ case 'b':
+ if(*++s=='z' || *s == 'Z') (void) op_gen(BZ,0,0,0);
+ else (void) op_gen(BN,0,0,0);
+ break;
+ case 'S':
+ case 's':
+ if(*(s+1)=='s' || *(s+1) == 'S')
+ { x=SS;
+ s++;
+ }
+ else if(*(s+1)=='p' || *(s+1) == 'P')
+ { x=SP;
+ s++;
+ }
+ else x=S;
+ (void) op_gen(x,0,0,0);
+ break;
+ case '/': (void) op_gen(SLASH,0,0,0); break;
+ case '-': sign=1;
+ case '+': s++; /*OUTRAGEOUS CODING TRICK*/
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ s=gt_num(s,&n);
+ switch(*s)
+ {
+ default:
+ return(0);
+ case 'P':
+ case 'p': if(sign) n= -n; (void) op_gen(P,n,0,0); break;
+ case 'X':
+ case 'x': (void) op_gen(X,n,0,0); break;
+ case 'H':
+ case 'h':
+ sp = &f__syl[op_gen(H,n,0,0)];
+ *(char **)&sp->p2 = s + 1;
+ s+=n;
+ break;
+ }
+ break;
+ case GLITCH:
+ case '"':
+ case '\'':
+ sp = &f__syl[op_gen(APOS,0,0,0)];
+ *(char **)&sp->p2 = s;
+ if((*p = ap_end(s)) == NULL)
+ return(0);
+ return(1);
+ case 'T':
+ case 't':
+ if(*(s+1)=='l' || *(s+1) == 'L')
+ { x=TL;
+ s++;
+ }
+ else if(*(s+1)=='r'|| *(s+1) == 'R')
+ { x=TR;
+ s++;
+ }
+ else x=T;
+ s=gt_num(s+1,&n);
+ s--;
+ (void) op_gen(x,n,0,0);
+ break;
+ case 'X':
+ case 'x': (void) op_gen(X,1,0,0); break;
+ case 'P':
+ case 'p': (void) op_gen(P,1,0,0); break;
+ }
+ s++;
+ *p=s;
+ return(1);
+}
+#ifdef KR_headers
+e_d(s,p) char *s,**p;
+#else
+e_d(char *s, char **p)
+#endif
+{ int i,im,n,w,d,e,found=0,x=0;
+ char *sv=s;
+ s=gt_num(s,&n);
+ (void) op_gen(STACK,n,0,0);
+ switch(*s++)
+ {
+ default: break;
+ case 'E':
+ case 'e': x=1;
+ case 'G':
+ case 'g':
+ found=1;
+ s=gt_num(s,&w);
+ if(w==0) break;
+ if(*s=='.')
+ { s++;
+ s=gt_num(s,&d);
+ }
+ else d=0;
+ if(*s!='E' && *s != 'e')
+ (void) op_gen(x==1?E:G,w,d,0); /* default is Ew.dE2 */
+ else
+ { s++;
+ s=gt_num(s,&e);
+ (void) op_gen(x==1?EE:GE,w,d,e);
+ }
+ break;
+ case 'O':
+ case 'o':
+ i = O;
+ im = OM;
+ goto finish_I;
+ case 'Z':
+ case 'z':
+ i = Z;
+ im = ZM;
+ goto finish_I;
+ case 'L':
+ case 'l':
+ found=1;
+ s=gt_num(s,&w);
+ if(w==0) break;
+ (void) op_gen(L,w,0,0);
+ break;
+ case 'A':
+ case 'a':
+ found=1;
+ skip(s);
+ if(*s>='0' && *s<='9')
+ { s=gt_num(s,&w);
+ if(w==0) break;
+ (void) op_gen(AW,w,0,0);
+ break;
+ }
+ (void) op_gen(A,0,0,0);
+ break;
+ case 'F':
+ case 'f':
+ found=1;
+ s=gt_num(s,&w);
+ if(w==0) break;
+ if(*s=='.')
+ { s++;
+ s=gt_num(s,&d);
+ }
+ else d=0;
+ (void) op_gen(F,w,d,0);
+ break;
+ case 'D':
+ case 'd':
+ found=1;
+ s=gt_num(s,&w);
+ if(w==0) break;
+ if(*s=='.')
+ { s++;
+ s=gt_num(s,&d);
+ }
+ else d=0;
+ (void) op_gen(D,w,d,0);
+ break;
+ case 'I':
+ case 'i':
+ i = I;
+ im = IM;
+ finish_I:
+ found=1;
+ s=gt_num(s,&w);
+ if(w==0) break;
+ if(*s!='.')
+ { (void) op_gen(i,w,0,0);
+ break;
+ }
+ s++;
+ s=gt_num(s,&d);
+ (void) op_gen(im,w,d,0);
+ break;
+ }
+ if(found==0)
+ { f__pc--; /*unSTACK*/
+ *p=sv;
+ return(0);
+ }
+ *p=s;
+ return(1);
+}
+#ifdef KR_headers
+char *i_tem(s) char *s;
+#else
+char *i_tem(char *s)
+#endif
+{ char *t;
+ int n,curloc;
+ if(*s==')') return(s);
+ if(ne_d(s,&t)) return(t);
+ if(e_d(s,&t)) return(t);
+ s=gt_num(s,&n);
+ if((curloc=op_gen(STACK,n,0,0))<0) return(NULL);
+ return(f_s(s,curloc));
+}
+#ifdef KR_headers
+char *f_list(s) char *s;
+#else
+char *f_list(char *s)
+#endif
+{
+ for(;*s!=0;)
+ { skip(s);
+ if((s=i_tem(s))==NULL) return(NULL);
+ skip(s);
+ if(*s==',') s++;
+ else if(*s==')')
+ { if(--f__parenlvl==0)
+ {
+ (void) op_gen(REVERT,f__revloc,0,0);
+ return(++s);
+ }
+ (void) op_gen(GOTO,0,0,0);
+ return(++s);
+ }
+ }
+ return(NULL);
+}
+
+#ifdef KR_headers
+pars_f(s) char *s;
+#else
+pars_f(char *s)
+#endif
+{
+ f__parenlvl=f__revloc=f__pc=0;
+ if(f_s(s,0) == NULL)
+ {
+ return(-1);
+ }
+ return(0);
+}
+#define STKSZ 10
+int f__cnt[STKSZ],f__ret[STKSZ],f__cp,f__rp;
+flag f__workdone, f__nonl;
+
+#ifdef KR_headers
+type_f(n)
+#else
+type_f(int n)
+#endif
+{
+ switch(n)
+ {
+ default:
+ return(n);
+ case RET1:
+ return(RET1);
+ case REVERT: return(REVERT);
+ case GOTO: return(GOTO);
+ case STACK: return(STACK);
+ case X:
+ case SLASH:
+ case APOS: case H:
+ case T: case TL: case TR:
+ return(NED);
+ case F:
+ case I:
+ case IM:
+ case A: case AW:
+ case O: case OM:
+ case L:
+ case E: case EE: case D:
+ case G: case GE:
+ case Z: case ZM:
+ return(ED);
+ }
+}
+#ifdef KR_headers
+integer do_fio(number,ptr,len) ftnint *number; ftnlen len; char *ptr;
+#else
+integer do_fio(ftnint *number, char *ptr, ftnlen len)
+#endif
+{ struct syl *p;
+ int n,i;
+ for(i=0;i<*number;i++,ptr+=len)
+ {
+loop: switch(type_f((p= &f__syl[f__pc])->op))
+ {
+ default:
+ fprintf(stderr,"unknown code in do_fio: %d\n%s\n",
+ p->op,f__fmtbuf);
+ err(f__elist->cierr,100,"do_fio");
+ case NED:
+ if((*f__doned)(p))
+ { f__pc++;
+ goto loop;
+ }
+ f__pc++;
+ continue;
+ case ED:
+ if(f__cnt[f__cp]<=0)
+ { f__cp--;
+ f__pc++;
+ goto loop;
+ }
+ if(ptr==NULL)
+ return((*f__doend)());
+ f__cnt[f__cp]--;
+ f__workdone=1;
+ if((n=(*f__doed)(p,ptr,len))>0)
+ errfl(f__elist->cierr,errno,"fmt");
+ if(n<0)
+ err(f__elist->ciend,(EOF),"fmt");
+ continue;
+ case STACK:
+ f__cnt[++f__cp]=p->p1;
+ f__pc++;
+ goto loop;
+ case RET1:
+ f__ret[++f__rp]=p->p1;
+ f__pc++;
+ goto loop;
+ case GOTO:
+ if(--f__cnt[f__cp]<=0)
+ { f__cp--;
+ f__rp--;
+ f__pc++;
+ goto loop;
+ }
+ f__pc=1+f__ret[f__rp--];
+ goto loop;
+ case REVERT:
+ f__rp=f__cp=0;
+ f__pc = p->p1;
+ if(ptr==NULL)
+ return((*f__doend)());
+ if(!f__workdone) return(0);
+ if((n=(*f__dorevert)()) != 0) return(n);
+ goto loop;
+ case COLON:
+ if(ptr==NULL)
+ return((*f__doend)());
+ f__pc++;
+ goto loop;
+ case NONL:
+ f__nonl = 1;
+ f__pc++;
+ goto loop;
+ case S:
+ case SS:
+ f__cplus=0;
+ f__pc++;
+ goto loop;
+ case SP:
+ f__cplus = 1;
+ f__pc++;
+ goto loop;
+ case P: f__scale=p->p1;
+ f__pc++;
+ goto loop;
+ case BN:
+ f__cblank=0;
+ f__pc++;
+ goto loop;
+ case BZ:
+ f__cblank=1;
+ f__pc++;
+ goto loop;
+ }
+ }
+ return(0);
+}
+en_fio(Void)
+{ ftnint one=1;
+ return(do_fio(&one,(char *)NULL,(ftnint)0));
+}
+ VOID
+fmt_bg(Void)
+{
+ f__workdone=f__cp=f__rp=f__pc=f__cursor=0;
+ f__cnt[0]=f__ret[0]=0;
+}
diff --git a/lib/libI77/fmt.h b/lib/libI77/fmt.h
new file mode 100644
index 000000000000..d4810a15e82a
--- /dev/null
+++ b/lib/libI77/fmt.h
@@ -0,0 +1,82 @@
+struct syl
+{ int op,p1,p2,p3;
+};
+#define RET1 1
+#define REVERT 2
+#define GOTO 3
+#define X 4
+#define SLASH 5
+#define STACK 6
+#define I 7
+#define ED 8
+#define NED 9
+#define IM 10
+#define APOS 11
+#define H 12
+#define TL 13
+#define TR 14
+#define T 15
+#define COLON 16
+#define S 17
+#define SP 18
+#define SS 19
+#define P 20
+#define BN 21
+#define BZ 22
+#define F 23
+#define E 24
+#define EE 25
+#define D 26
+#define G 27
+#define GE 28
+#define L 29
+#define A 30
+#define AW 31
+#define O 32
+#define NONL 33
+#define OM 34
+#define Z 35
+#define ZM 36
+extern struct syl f__syl[];
+extern int f__pc,f__parenlvl,f__revloc;
+typedef union
+{ real pf;
+ doublereal pd;
+} ufloat;
+typedef union
+{ short is;
+ char ic;
+ integer il;
+#ifdef Allow_TYQUAD
+ longint ili;
+#endif
+} Uint;
+#ifdef KR_headers
+extern int (*f__doed)(),(*f__doned)();
+extern int (*f__dorevert)();
+extern int rd_ed(),rd_ned();
+extern int w_ed(),w_ned();
+#else
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int (*f__doed)(struct syl*, char*, ftnlen),(*f__doned)(struct syl*);
+extern int (*f__dorevert)(void);
+extern void fmt_bg(void);
+extern int pars_f(char*);
+extern int rd_ed(struct syl*, char*, ftnlen),rd_ned(struct syl*);
+extern int w_ed(struct syl*, char*, ftnlen),w_ned(struct syl*);
+extern int wrt_E(ufloat*, int, int, int, ftnlen);
+extern int wrt_F(ufloat*, int, int, ftnlen);
+extern int wrt_L(Uint*, int, ftnlen);
+#ifdef __cplusplus
+ }
+#endif
+#endif
+extern flag f__cblank,f__cplus,f__workdone, f__nonl;
+extern char *f__fmtbuf;
+extern int f__scale;
+#define GET(x) if((x=(*f__getn)())<0) return(x)
+#define VAL(x) (x!='\n'?x:' ')
+#define PUT(x) (*f__putn)(x)
+extern int f__cursor;
diff --git a/lib/libI77/fmtlib.c b/lib/libI77/fmtlib.c
new file mode 100644
index 000000000000..37a4cc5f1d5a
--- /dev/null
+++ b/lib/libI77/fmtlib.c
@@ -0,0 +1,28 @@
+/* @(#)fmtlib.c 1.2 */
+#define MAXINTLENGTH 23
+#ifdef KR_headers
+char *f__icvt(value,ndigit,sign, base) long value; int *ndigit,*sign;
+ register int base;
+#else
+char *f__icvt(long value, int *ndigit, int *sign, int base)
+#endif
+{ static char buf[MAXINTLENGTH+1];
+ register int i;
+ if(value>0) *sign=0;
+ else if(value<0)
+ { value = -value;
+ *sign= 1;
+ }
+ else
+ { *sign=0;
+ *ndigit=1;
+ buf[MAXINTLENGTH]='0';
+ return(&buf[MAXINTLENGTH]);
+ }
+ for(i=MAXINTLENGTH-1;value>0;i--)
+ { *(buf+i)=(int)(value%base)+'0';
+ value /= base;
+ }
+ *ndigit=MAXINTLENGTH-1-i;
+ return(&buf[i+1]);
+}
diff --git a/lib/libI77/fp.h b/lib/libI77/fp.h
new file mode 100644
index 000000000000..033cb03f272f
--- /dev/null
+++ b/lib/libI77/fp.h
@@ -0,0 +1,26 @@
+#define FMAX 40
+#define EXPMAXDIGS 8
+#define EXPMAX 99999999
+/* FMAX = max number of nonzero digits passed to atof() */
+/* EXPMAX = 10^EXPMAXDIGS - 1 = largest allowed exponent absolute value */
+
+#include "local.h"
+
+/* MAXFRACDIGS and MAXINTDIGS are for wrt_F -- bounds (not necessarily
+ tight) on the maximum number of digits to the right and left of
+ * the decimal point.
+ */
+
+#ifdef VAX
+#define MAXFRACDIGS 56
+#define MAXINTDIGS 38
+#else
+#ifdef CRAY
+#define MAXFRACDIGS 9880
+#define MAXINTDIGS 9864
+#else
+/* values that suffice for IEEE double */
+#define MAXFRACDIGS 344
+#define MAXINTDIGS 308
+#endif
+#endif
diff --git a/lib/libI77/iio.c b/lib/libI77/iio.c
new file mode 100644
index 000000000000..b747826f4b88
--- /dev/null
+++ b/lib/libI77/iio.c
@@ -0,0 +1,138 @@
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+extern char *f__icptr;
+char *f__icend;
+extern icilist *f__svic;
+int f__icnum;
+extern int f__hiwater;
+z_getc(Void)
+{
+ if(f__recpos++ < f__svic->icirlen) {
+ if(f__icptr >= f__icend) err(f__svic->iciend,(EOF),"endfile");
+ return(*f__icptr++);
+ }
+ return '\n';
+}
+#ifdef KR_headers
+z_putc(c)
+#else
+z_putc(int c)
+#endif
+{
+ if(f__icptr >= f__icend) err(f__svic->icierr,110,"inwrite");
+ if(f__recpos++ < f__svic->icirlen)
+ *f__icptr++ = c;
+ else err(f__svic->icierr,110,"recend");
+ return 0;
+}
+z_rnew(Void)
+{
+ f__icptr = f__svic->iciunit + (++f__icnum)*f__svic->icirlen;
+ f__recpos = 0;
+ f__cursor = 0;
+ f__hiwater = 0;
+ return 1;
+}
+
+ static int
+z_endp(Void)
+{
+ (*f__donewrec)();
+ return 0;
+ }
+
+#ifdef KR_headers
+c_si(a) icilist *a;
+#else
+c_si(icilist *a)
+#endif
+{
+ f__elist = (cilist *)a;
+ f__fmtbuf=a->icifmt;
+ if(pars_f(f__fmtbuf)<0)
+ err(a->icierr,100,"startint");
+ fmt_bg();
+ f__sequential=f__formatted=1;
+ f__external=0;
+ f__cblank=f__cplus=f__scale=0;
+ f__svic=a;
+ f__icnum=f__recpos=0;
+ f__cursor = 0;
+ f__hiwater = 0;
+ f__icptr = a->iciunit;
+ f__icend = f__icptr + a->icirlen*a->icirnum;
+ f__curunit = 0;
+ f__cf = 0;
+ return(0);
+}
+
+ int
+iw_rev(Void)
+{
+ if(f__workdone)
+ z_endp();
+ f__hiwater = f__recpos = f__cursor = 0;
+ return(f__workdone=0);
+ }
+
+#ifdef KR_headers
+integer s_rsfi(a) icilist *a;
+#else
+integer s_rsfi(icilist *a)
+#endif
+{ int n;
+ if(n=c_si(a)) return(n);
+ f__reading=1;
+ f__doed=rd_ed;
+ f__doned=rd_ned;
+ f__getn=z_getc;
+ f__dorevert = z_endp;
+ f__donewrec = z_rnew;
+ f__doend = z_endp;
+ return(0);
+}
+
+z_wnew(Void)
+{
+ while(f__recpos++ < f__svic->icirlen)
+ *f__icptr++ = ' ';
+ f__recpos = 0;
+ f__cursor = 0;
+ f__hiwater = 0;
+ f__icnum++;
+ return 1;
+}
+#ifdef KR_headers
+integer s_wsfi(a) icilist *a;
+#else
+integer s_wsfi(icilist *a)
+#endif
+{ int n;
+ if(n=c_si(a)) return(n);
+ f__reading=0;
+ f__doed=w_ed;
+ f__doned=w_ned;
+ f__putn=z_putc;
+ f__dorevert = iw_rev;
+ f__donewrec = z_wnew;
+ f__doend = z_endp;
+ return(0);
+}
+integer e_rsfi(Void)
+{ int n;
+ n = en_fio();
+ f__fmtbuf = NULL;
+ return(n);
+}
+integer e_wsfi(Void)
+{
+ int n;
+ n = en_fio();
+ f__fmtbuf = NULL;
+ if(f__icnum >= f__svic->icirnum)
+ return(n);
+ while(f__recpos++ < f__svic->icirlen)
+ *f__icptr++ = ' ';
+ return(n);
+}
diff --git a/lib/libI77/ilnw.c b/lib/libI77/ilnw.c
new file mode 100644
index 000000000000..b4156861eeb8
--- /dev/null
+++ b/lib/libI77/ilnw.c
@@ -0,0 +1,77 @@
+#include "f2c.h"
+#include "fio.h"
+#include "lio.h"
+extern char *f__icptr;
+extern char *f__icend;
+extern icilist *f__svic;
+extern int f__icnum;
+#ifdef KR_headers
+extern int z_putc();
+#else
+extern int z_putc(int);
+#endif
+
+ static int
+z_wSL(Void)
+{
+ while(f__recpos < f__svic->icirlen)
+ z_putc(' ');
+ return z_rnew();
+ }
+
+ VOID
+#ifdef KR_headers
+c_liw(a) icilist *a;
+#else
+c_liw(icilist *a)
+#endif
+{
+ f__reading = 0;
+ f__external = 0;
+ f__formatted = 1;
+ f__putn = z_putc;
+ L_len = a->icirlen;
+ f__donewrec = z_wSL;
+ f__svic = a;
+ f__icnum = f__recpos = 0;
+ f__cursor = 0;
+ f__cf = 0;
+ f__curunit = 0;
+ f__icptr = a->iciunit;
+ f__icend = f__icptr + a->icirlen*a->icirnum;
+ f__elist = (cilist *)a;
+ }
+
+ integer
+#ifdef KR_headers
+s_wsni(a) icilist *a;
+#else
+s_wsni(icilist *a)
+#endif
+{
+ cilist ca;
+
+ c_liw(a);
+ ca.cifmt = a->icifmt;
+ x_wsne(&ca);
+ z_wSL();
+ return 0;
+ }
+
+ integer
+#ifdef KR_headers
+s_wsli(a) icilist *a;
+#else
+s_wsli(icilist *a)
+#endif
+{
+ f__lioproc = l_write;
+ c_liw(a);
+ return(0);
+ }
+
+integer e_wsli(Void)
+{
+ z_wSL();
+ return(0);
+ }
diff --git a/lib/libI77/inquire.c b/lib/libI77/inquire.c
new file mode 100644
index 000000000000..ec98b22f8401
--- /dev/null
+++ b/lib/libI77/inquire.c
@@ -0,0 +1,106 @@
+#include "f2c.h"
+#include "fio.h"
+#ifdef KR_headers
+integer f_inqu(a) inlist *a;
+#else
+#ifdef MSDOS
+#undef abs
+#undef min
+#undef max
+#include "string.h"
+#include "io.h"
+#endif
+integer f_inqu(inlist *a)
+#endif
+{ flag byfile;
+ int i, n;
+ unit *p;
+ char buf[256];
+ long x;
+ if(a->infile!=NULL)
+ { byfile=1;
+ g_char(a->infile,a->infilen,buf);
+#ifdef NON_UNIX_STDIO
+ x = access(buf,0) ? -1 : 0;
+ for(i=0,p=NULL;i<MXUNIT;i++)
+ if(f__units[i].ufd != NULL
+ && f__units[i].ufnm != NULL
+ && !strcmp(f__units[i].ufnm,buf)) {
+ p = &f__units[i];
+ break;
+ }
+#else
+ x=f__inode(buf, &n);
+ for(i=0,p=NULL;i<MXUNIT;i++)
+ if(f__units[i].uinode==x
+ && f__units[i].ufd!=NULL
+ && f__units[i].udev == n) {
+ p = &f__units[i];
+ break;
+ }
+#endif
+ }
+ else
+ {
+ byfile=0;
+ if(a->inunit<MXUNIT && a->inunit>=0)
+ {
+ p= &f__units[a->inunit];
+ }
+ else
+ {
+ p=NULL;
+ }
+ }
+ if(a->inex!=NULL)
+ if(byfile && x != -1 || !byfile && p!=NULL)
+ *a->inex=1;
+ else *a->inex=0;
+ if(a->inopen!=NULL)
+ if(byfile) *a->inopen=(p!=NULL);
+ else *a->inopen=(p!=NULL && p->ufd!=NULL);
+ if(a->innum!=NULL) *a->innum= p-f__units;
+ if(a->innamed!=NULL)
+ if(byfile || p!=NULL && p->ufnm!=NULL)
+ *a->innamed=1;
+ else *a->innamed=0;
+ if(a->inname!=NULL)
+ if(byfile)
+ b_char(buf,a->inname,a->innamlen);
+ else if(p!=NULL && p->ufnm!=NULL)
+ b_char(p->ufnm,a->inname,a->innamlen);
+ if(a->inacc!=NULL && p!=NULL && p->ufd!=NULL)
+ if(p->url)
+ b_char("DIRECT",a->inacc,a->inacclen);
+ else b_char("SEQUENTIAL",a->inacc,a->inacclen);
+ if(a->inseq!=NULL)
+ if(p!=NULL && p->url)
+ b_char("NO",a->inseq,a->inseqlen);
+ else b_char("YES",a->inseq,a->inseqlen);
+ if(a->indir!=NULL)
+ if(p==NULL || p->url)
+ b_char("YES",a->indir,a->indirlen);
+ else b_char("NO",a->indir,a->indirlen);
+ if(a->infmt!=NULL)
+ if(p!=NULL && p->ufmt==0)
+ b_char("UNFORMATTED",a->infmt,a->infmtlen);
+ else b_char("FORMATTED",a->infmt,a->infmtlen);
+ if(a->inform!=NULL)
+ if(p!=NULL && p->ufmt==0)
+ b_char("NO",a->inform,a->informlen);
+ else b_char("YES",a->inform,a->informlen);
+ if(a->inunf)
+ if(p!=NULL && p->ufmt==0)
+ b_char("YES",a->inunf,a->inunflen);
+ else if (p!=NULL) b_char("NO",a->inunf,a->inunflen);
+ else b_char("UNKNOWN",a->inunf,a->inunflen);
+ if(a->inrecl!=NULL && p!=NULL)
+ *a->inrecl=p->url;
+ if(a->innrec!=NULL && p!=NULL && p->url>0)
+ *a->innrec=ftell(p->ufd)/p->url+1;
+ if(a->inblank && p!=NULL && p->ufmt)
+ if(p->ublnk)
+ b_char("ZERO",a->inblank,a->inblanklen);
+ else b_char("NULL",a->inblank,a->inblanklen);
+ return(0);
+}
diff --git a/lib/libI77/lio.h b/lib/libI77/lio.h
new file mode 100644
index 000000000000..5af9fc45e66f
--- /dev/null
+++ b/lib/libI77/lio.h
@@ -0,0 +1,73 @@
+/* copy of ftypes from the compiler */
+/* variable types
+ * numeric assumptions:
+ * int < reals < complexes
+ * TYDREAL-TYREAL = TYDCOMPLEX-TYCOMPLEX
+ */
+
+/* 0-10 retain their old (pre LOGICAL*1, etc.) */
+/* values to allow mixing old and new objects. */
+
+#define TYUNKNOWN 0
+#define TYADDR 1
+#define TYSHORT 2
+#define TYLONG 3
+#define TYREAL 4
+#define TYDREAL 5
+#define TYCOMPLEX 6
+#define TYDCOMPLEX 7
+#define TYLOGICAL 8
+#define TYCHAR 9
+#define TYSUBR 10
+#define TYINT1 11
+#define TYLOGICAL1 12
+#define TYLOGICAL2 13
+#ifdef Allow_TYQUAD
+#define TYQUAD 14
+#endif
+
+#define LINTW 24
+#define LINE 80
+#define LLOGW 2
+#ifdef Old_list_output
+#define LLOW 1.0
+#define LHIGH 1.e9
+#define LEFMT " %# .8E"
+#define LFFMT " %# .9g"
+#else
+#define LGFMT "%.9G"
+#endif
+/* LEFBL 20 should suffice; 24 overcomes a NeXT bug. */
+#define LEFBL 24
+
+typedef union
+{
+ char flchar;
+ short flshort;
+ ftnint flint;
+#ifdef Allow_TYQUAD
+ longint fllongint;
+#endif
+ real flreal;
+ doublereal fldouble;
+} flex;
+extern int f__scale;
+#ifdef KR_headers
+extern int (*f__lioproc)(), (*l_getc)(), (*l_ungetc)();
+extern int l_read(), l_write();
+#else
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern int (*f__lioproc)(ftnint*, char*, ftnlen, ftnint);
+extern int l_write(ftnint*, char*, ftnlen, ftnint);
+extern void x_wsne(cilist*);
+extern int c_le(cilist*), (*l_getc)(void), (*l_ungetc)(int,FILE*);
+extern int l_read(ftnint*,char*,ftnlen,ftnint);
+extern integer e_rsle(void), e_wsle(void), s_wsne(cilist*);
+extern int z_rnew(void);
+#ifdef __cplusplus
+ }
+#endif
+#endif
+extern ftnint L_len;
diff --git a/lib/libI77/local.h b/lib/libI77/local.h
new file mode 100644
index 000000000000..a26b7c1a4964
--- /dev/null
+++ b/lib/libI77/local.h
@@ -0,0 +1,6 @@
+/* Use
+ -DNON_ANSI_RW_MODES in libI77/makefile and
+ -DIEEE_drem in libF77/makefile. Rich */
+#define _base _bf._base
+#define _flag _flags
+#define _ptr _p
diff --git a/lib/libI77/lread.c b/lib/libI77/lread.c
new file mode 100644
index 000000000000..dacb9a8f9e5a
--- /dev/null
+++ b/lib/libI77/lread.c
@@ -0,0 +1,611 @@
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+#include "lio.h"
+#include "ctype.h"
+#include "fp.h"
+
+extern char *f__fmtbuf;
+#ifdef KR_headers
+extern double atof();
+extern char *malloc(), *realloc();
+int (*f__lioproc)(), (*l_getc)(), (*l_ungetc)();
+#else
+#undef abs
+#undef min
+#undef max
+#include "stdlib.h"
+int (*f__lioproc)(ftnint*, char*, ftnlen, ftnint), (*l_getc)(void),
+ (*l_ungetc)(int,FILE*);
+#endif
+int l_eof;
+
+#define isblnk(x) (f__ltab[x+1]&B)
+#define issep(x) (f__ltab[x+1]&SX)
+#define isapos(x) (f__ltab[x+1]&AX)
+#define isexp(x) (f__ltab[x+1]&EX)
+#define issign(x) (f__ltab[x+1]&SG)
+#define iswhit(x) (f__ltab[x+1]&WH)
+#define SX 1
+#define B 2
+#define AX 4
+#define EX 8
+#define SG 16
+#define WH 32
+char f__ltab[128+1] = { /* offset one for EOF */
+ 0,
+ 0,0,AX,0,0,0,0,0,0,WH|B,SX|WH,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ SX|B|WH,0,AX,0,0,0,0,AX,0,0,0,SG,SX,SG,0,SX,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,EX,EX,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ AX,0,0,0,EX,EX,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
+};
+
+#ifdef ungetc
+ static int
+#ifdef KR_headers
+un_getc(x,f__cf) int x; FILE *f__cf;
+#else
+un_getc(int x, FILE *f__cf)
+#endif
+{ return ungetc(x,f__cf); }
+#else
+#define un_getc ungetc
+#ifdef KR_headers
+ extern int ungetc();
+#endif
+#endif
+
+t_getc(Void)
+{ int ch;
+ if(f__curunit->uend) return(EOF);
+ if((ch=getc(f__cf))!=EOF) return(ch);
+ if(feof(f__cf))
+ f__curunit->uend = l_eof = 1;
+ return(EOF);
+}
+integer e_rsle(Void)
+{
+ int ch;
+ if(f__curunit->uend) return(0);
+ while((ch=t_getc())!='\n' && ch!=EOF);
+ return(0);
+}
+
+flag f__lquit;
+int f__lcount,f__ltype,nml_read;
+char *f__lchar;
+double f__lx,f__ly;
+#define ERR(x) if(n=(x)) return(n)
+#define GETC(x) (x=(*l_getc)())
+#define Ungetc(x,y) (*l_ungetc)(x,y)
+
+#ifdef KR_headers
+l_R(poststar) int poststar;
+#else
+l_R(int poststar)
+#endif
+{
+ char s[FMAX+EXPMAXDIGS+4];
+ register int ch;
+ register char *sp, *spe, *sp1;
+ long e, exp;
+ int havenum, havestar, se;
+
+ if (!poststar) {
+ if (f__lcount > 0)
+ return(0);
+ f__lcount = 1;
+ }
+ f__ltype = 0;
+ exp = 0;
+ havestar = 0;
+retry:
+ sp1 = sp = s;
+ spe = sp + FMAX;
+ havenum = 0;
+
+ switch(GETC(ch)) {
+ case '-': *sp++ = ch; sp1++; spe++;
+ case '+':
+ GETC(ch);
+ }
+ while(ch == '0') {
+ ++havenum;
+ GETC(ch);
+ }
+ while(isdigit(ch)) {
+ if (sp < spe) *sp++ = ch;
+ else ++exp;
+ GETC(ch);
+ }
+ if (ch == '*' && !poststar) {
+ if (sp == sp1 || exp || *s == '-') {
+ errfl(f__elist->cierr,112,"bad repetition count");
+ }
+ poststar = havestar = 1;
+ *sp = 0;
+ f__lcount = atoi(s);
+ goto retry;
+ }
+ if (ch == '.') {
+ GETC(ch);
+ if (sp == sp1)
+ while(ch == '0') {
+ ++havenum;
+ --exp;
+ GETC(ch);
+ }
+ while(isdigit(ch)) {
+ if (sp < spe)
+ { *sp++ = ch; --exp; }
+ GETC(ch);
+ }
+ }
+ havenum += sp - sp1;
+ se = 0;
+ if (issign(ch))
+ goto signonly;
+ if (havenum && isexp(ch)) {
+ GETC(ch);
+ if (issign(ch)) {
+signonly:
+ if (ch == '-') se = 1;
+ GETC(ch);
+ }
+ if (!isdigit(ch)) {
+bad:
+ errfl(f__elist->cierr,112,"exponent field");
+ }
+
+ e = ch - '0';
+ while(isdigit(GETC(ch))) {
+ e = 10*e + ch - '0';
+ if (e > EXPMAX)
+ goto bad;
+ }
+ if (se)
+ exp -= e;
+ else
+ exp += e;
+ }
+ (void) Ungetc(ch, f__cf);
+ if (sp > sp1) {
+ ++havenum;
+ while(*--sp == '0')
+ ++exp;
+ if (exp)
+ sprintf(sp+1, "e%ld", exp);
+ else
+ sp[1] = 0;
+ f__lx = atof(s);
+ }
+ else
+ f__lx = 0.;
+ if (havenum)
+ f__ltype = TYLONG;
+ else
+ switch(ch) {
+ case ',':
+ case '/':
+ break;
+ default:
+ if (havestar && ( ch == ' '
+ ||ch == '\t'
+ ||ch == '\n'))
+ break;
+ if (nml_read > 1) {
+ f__lquit = 2;
+ return 0;
+ }
+ errfl(f__elist->cierr,112,"invalid number");
+ }
+ return 0;
+ }
+
+ static int
+#ifdef KR_headers
+rd_count(ch) register int ch;
+#else
+rd_count(register int ch)
+#endif
+{
+ if (ch < '0' || ch > '9')
+ return 1;
+ f__lcount = ch - '0';
+ while(GETC(ch) >= '0' && ch <= '9')
+ f__lcount = 10*f__lcount + ch - '0';
+ Ungetc(ch,f__cf);
+ return f__lcount <= 0;
+ }
+
+l_C(Void)
+{ int ch, nml_save;
+ double lz;
+ if(f__lcount>0) return(0);
+ f__ltype=0;
+ GETC(ch);
+ if(ch!='(')
+ {
+ if (nml_read > 1 && (ch < '0' || ch > '9')) {
+ Ungetc(ch,f__cf);
+ f__lquit = 2;
+ return 0;
+ }
+ if (rd_count(ch))
+ if(!f__cf || !feof(f__cf))
+ errfl(f__elist->cierr,112,"complex format");
+ else
+ err(f__elist->cierr,(EOF),"lread");
+ if(GETC(ch)!='*')
+ {
+ if(!f__cf || !feof(f__cf))
+ errfl(f__elist->cierr,112,"no star");
+ else
+ err(f__elist->cierr,(EOF),"lread");
+ }
+ if(GETC(ch)!='(')
+ { Ungetc(ch,f__cf);
+ return(0);
+ }
+ }
+ else
+ f__lcount = 1;
+ while(iswhit(GETC(ch)));
+ Ungetc(ch,f__cf);
+ nml_save = nml_read;
+ nml_read = 0;
+ if (ch = l_R(1))
+ return ch;
+ if (!f__ltype)
+ errfl(f__elist->cierr,112,"no real part");
+ lz = f__lx;
+ while(iswhit(GETC(ch)));
+ if(ch!=',')
+ { (void) Ungetc(ch,f__cf);
+ errfl(f__elist->cierr,112,"no comma");
+ }
+ while(iswhit(GETC(ch)));
+ (void) Ungetc(ch,f__cf);
+ if (ch = l_R(1))
+ return ch;
+ if (!f__ltype)
+ errfl(f__elist->cierr,112,"no imaginary part");
+ while(iswhit(GETC(ch)));
+ if(ch!=')') errfl(f__elist->cierr,112,"no )");
+ f__ly = f__lx;
+ f__lx = lz;
+ nml_read = nml_save;
+ return(0);
+}
+l_L(Void)
+{
+ int ch;
+ if(f__lcount>0) return(0);
+ f__lcount = 1;
+ f__ltype=0;
+ GETC(ch);
+ if(isdigit(ch))
+ {
+ rd_count(ch);
+ if(GETC(ch)!='*')
+ if(!f__cf || !feof(f__cf))
+ errfl(f__elist->cierr,112,"no star");
+ else
+ err(f__elist->cierr,(EOF),"lread");
+ GETC(ch);
+ }
+ if(ch == '.') GETC(ch);
+ switch(ch)
+ {
+ case 't':
+ case 'T':
+ f__lx=1;
+ break;
+ case 'f':
+ case 'F':
+ f__lx=0;
+ break;
+ default:
+ if(isblnk(ch) || issep(ch) || ch==EOF)
+ { (void) Ungetc(ch,f__cf);
+ return(0);
+ }
+ if (nml_read > 1) {
+ Ungetc(ch,f__cf);
+ f__lquit = 2;
+ return 0;
+ }
+ errfl(f__elist->cierr,112,"logical");
+ }
+ f__ltype=TYLONG;
+ while(!issep(GETC(ch)) && ch!=EOF);
+ (void) Ungetc(ch, f__cf);
+ return(0);
+}
+#define BUFSIZE 128
+l_CHAR(Void)
+{ int ch,size,i;
+ char quote,*p;
+ if(f__lcount>0) return(0);
+ f__ltype=0;
+ if(f__lchar!=NULL) free(f__lchar);
+ size=BUFSIZE;
+ p=f__lchar = (char *)malloc((unsigned int)size);
+ if(f__lchar == NULL)
+ errfl(f__elist->cierr,113,"no space");
+
+ GETC(ch);
+ if(isdigit(ch)) {
+ /* allow Fortran 8x-style unquoted string... */
+ /* either find a repetition count or the string */
+ f__lcount = ch - '0';
+ *p++ = ch;
+ for(i = 1;;) {
+ switch(GETC(ch)) {
+ case '*':
+ if (f__lcount == 0) {
+ f__lcount = 1;
+ goto noquote;
+ }
+ p = f__lchar;
+ goto have_lcount;
+ case ',':
+ case ' ':
+ case '\t':
+ case '\n':
+ case '/':
+ Ungetc(ch,f__cf);
+ /* no break */
+ case EOF:
+ f__lcount = 1;
+ f__ltype = TYCHAR;
+ return *p = 0;
+ }
+ if (!isdigit(ch)) {
+ f__lcount = 1;
+ goto noquote;
+ }
+ *p++ = ch;
+ f__lcount = 10*f__lcount + ch - '0';
+ if (++i == size) {
+ f__lchar = (char *)realloc(f__lchar,
+ (unsigned int)(size += BUFSIZE));
+ p = f__lchar + i;
+ }
+ }
+ }
+ else (void) Ungetc(ch,f__cf);
+ have_lcount:
+ if(GETC(ch)=='\'' || ch=='"') quote=ch;
+ else if(isblnk(ch) || (issep(ch) && ch != '\n') || ch==EOF)
+ { (void) Ungetc(ch,f__cf);
+ return(0);
+ }
+ else {
+ /* Fortran 8x-style unquoted string */
+ *p++ = ch;
+ for(i = 1;;) {
+ switch(GETC(ch)) {
+ case ',':
+ case ' ':
+ case '\t':
+ case '\n':
+ case '/':
+ Ungetc(ch,f__cf);
+ /* no break */
+ case EOF:
+ f__ltype = TYCHAR;
+ return *p = 0;
+ }
+ noquote:
+ *p++ = ch;
+ if (++i == size) {
+ f__lchar = (char *)realloc(f__lchar,
+ (unsigned int)(size += BUFSIZE));
+ p = f__lchar + i;
+ }
+ }
+ }
+ f__ltype=TYCHAR;
+ for(i=0;;)
+ { while(GETC(ch)!=quote && ch!='\n'
+ && ch!=EOF && ++i<size) *p++ = ch;
+ if(i==size)
+ {
+ newone:
+ f__lchar= (char *)realloc(f__lchar,
+ (unsigned int)(size += BUFSIZE));
+ p=f__lchar+i-1;
+ *p++ = ch;
+ }
+ else if(ch==EOF) return(EOF);
+ else if(ch=='\n')
+ { if(*(p-1) != '\\') continue;
+ i--;
+ p--;
+ if(++i<size) *p++ = ch;
+ else goto newone;
+ }
+ else if(GETC(ch)==quote)
+ { if(++i<size) *p++ = ch;
+ else goto newone;
+ }
+ else
+ { (void) Ungetc(ch,f__cf);
+ *p = 0;
+ return(0);
+ }
+ }
+}
+#ifdef KR_headers
+c_le(a) cilist *a;
+#else
+c_le(cilist *a)
+#endif
+{
+ f__fmtbuf="list io";
+ if(a->ciunit>=MXUNIT || a->ciunit<0)
+ err(a->cierr,101,"stler");
+ f__scale=f__recpos=0;
+ f__elist=a;
+ f__curunit = &f__units[a->ciunit];
+ if(f__curunit->ufd==NULL && fk_open(SEQ,FMT,a->ciunit))
+ err(a->cierr,102,"lio");
+ f__cf=f__curunit->ufd;
+ if(!f__curunit->ufmt) err(a->cierr,103,"lio")
+ return(0);
+}
+#ifdef KR_headers
+l_read(number,ptr,len,type) ftnint *number,type; char *ptr; ftnlen len;
+#else
+l_read(ftnint *number, char *ptr, ftnlen len, ftnint type)
+#endif
+{
+#define Ptr ((flex *)ptr)
+ int i,n,ch;
+ doublereal *yy;
+ real *xx;
+ for(i=0;i<*number;i++)
+ {
+ if(f__lquit) return(0);
+ if(l_eof)
+ err(f__elist->ciend, EOF, "list in")
+ if(f__lcount == 0) {
+ f__ltype = 0;
+ for(;;) {
+ GETC(ch);
+ switch(ch) {
+ case EOF:
+ goto loopend;
+ case ' ':
+ case '\t':
+ case '\n':
+ continue;
+ case '/':
+ f__lquit = 1;
+ goto loopend;
+ case ',':
+ f__lcount = 1;
+ goto loopend;
+ default:
+ (void) Ungetc(ch, f__cf);
+ goto rddata;
+ }
+ }
+ }
+ rddata:
+ switch((int)type)
+ {
+ case TYINT1:
+ case TYSHORT:
+ case TYLONG:
+#ifdef TYQUAD
+ case TYQUAD:
+#endif
+ case TYREAL:
+ case TYDREAL:
+ ERR(l_R(0));
+ break;
+ case TYCOMPLEX:
+ case TYDCOMPLEX:
+ ERR(l_C());
+ break;
+ case TYLOGICAL1:
+ case TYLOGICAL2:
+ case TYLOGICAL:
+ ERR(l_L());
+ break;
+ case TYCHAR:
+ ERR(l_CHAR());
+ break;
+ }
+ while (GETC(ch) == ' ' || ch == '\t');
+ if (ch != ',' || f__lcount > 1)
+ Ungetc(ch,f__cf);
+ loopend:
+ if(f__lquit) return(0);
+ if(f__cf) {
+ if (feof(f__cf))
+ err(f__elist->ciend,(EOF),"list in")
+ else if(ferror(f__cf)) {
+ clearerr(f__cf);
+ errfl(f__elist->cierr,errno,"list in");
+ }
+ }
+ if(f__ltype==0) goto bump;
+ switch((int)type)
+ {
+ case TYINT1:
+ case TYLOGICAL1:
+ Ptr->flchar = (char)f__lx;
+ break;
+ case TYLOGICAL2:
+ case TYSHORT:
+ Ptr->flshort = (short)f__lx;
+ break;
+ case TYLOGICAL:
+ case TYLONG:
+ Ptr->flint=f__lx;
+ break;
+#ifdef TYQUAD
+ case TYQUAD:
+ Ptr->fllongint = f__lx;
+ break;
+#endif
+ case TYREAL:
+ Ptr->flreal=f__lx;
+ break;
+ case TYDREAL:
+ Ptr->fldouble=f__lx;
+ break;
+ case TYCOMPLEX:
+ xx=(real *)ptr;
+ *xx++ = f__lx;
+ *xx = f__ly;
+ break;
+ case TYDCOMPLEX:
+ yy=(doublereal *)ptr;
+ *yy++ = f__lx;
+ *yy = f__ly;
+ break;
+ case TYCHAR:
+ b_char(f__lchar,ptr,len);
+ break;
+ }
+ bump:
+ if(f__lcount>0) f__lcount--;
+ ptr += len;
+ if (nml_read)
+ nml_read++;
+ }
+ return(0);
+#undef Ptr
+}
+#ifdef KR_headers
+integer s_rsle(a) cilist *a;
+#else
+integer s_rsle(cilist *a)
+#endif
+{
+ int n;
+
+ if(!f__init) f_init();
+ if(n=c_le(a)) return(n);
+ f__reading=1;
+ f__external=1;
+ f__formatted=1;
+ f__lioproc = l_read;
+ f__lquit = 0;
+ f__lcount = 0;
+ l_eof = 0;
+ if(f__curunit->uwrt && f__nowreading(f__curunit))
+ err(a->cierr,errno,"read start");
+ l_getc = t_getc;
+ l_ungetc = un_getc;
+ f__doend = xrd_SL;
+ return(0);
+}
diff --git a/lib/libI77/lwrite.c b/lib/libI77/lwrite.c
new file mode 100644
index 000000000000..6c630d3a0955
--- /dev/null
+++ b/lib/libI77/lwrite.c
@@ -0,0 +1,250 @@
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+#include "lio.h"
+ftnint L_len;
+
+#ifdef KR_headers
+t_putc(c)
+#else
+t_putc(int c)
+#endif
+{
+ f__recpos++;
+ putc(c,f__cf);
+ return(0);
+}
+ static VOID
+#ifdef KR_headers
+lwrt_I(n) long n;
+#else
+lwrt_I(long n)
+#endif
+{
+ char buf[LINTW],*p;
+#ifdef USE_STRLEN
+ (void) sprintf(buf," %ld",n);
+ if(f__recpos+strlen(buf)>=L_len)
+#else
+ if(f__recpos + sprintf(buf," %ld",n) >= L_len)
+#endif
+ (*f__donewrec)();
+ for(p=buf;*p;PUT(*p++));
+}
+ static VOID
+#ifdef KR_headers
+lwrt_L(n, len) ftnint n; ftnlen len;
+#else
+lwrt_L(ftnint n, ftnlen len)
+#endif
+{
+ if(f__recpos+LLOGW>=L_len)
+ (*f__donewrec)();
+ wrt_L((Uint *)&n,LLOGW, len);
+}
+ static VOID
+#ifdef KR_headers
+lwrt_A(p,len) char *p; ftnlen len;
+#else
+lwrt_A(char *p, ftnlen len)
+#endif
+{
+ int i;
+ if(f__recpos+len>=L_len)
+ (*f__donewrec)();
+ if (!f__recpos)
+ { PUT(' '); ++f__recpos; }
+ for(i=0;i<len;i++) PUT(*p++);
+}
+
+ static int
+#ifdef KR_headers
+l_g(buf, n) char *buf; double n;
+#else
+l_g(char *buf, double n)
+#endif
+{
+#ifdef Old_list_output
+ doublereal absn;
+ char *fmt;
+
+ absn = n;
+ if (absn < 0)
+ absn = -absn;
+ fmt = LLOW <= absn && absn < LHIGH ? LFFMT : LEFMT;
+#ifdef USE_STRLEN
+ sprintf(buf, fmt, n);
+ return strlen(buf);
+#else
+ return sprintf(buf, fmt, n);
+#endif
+
+#else
+ register char *b, c, c1;
+
+ b = buf;
+ *b++ = ' ';
+ if (n < 0) {
+ *b++ = '-';
+ n = -n;
+ }
+ else
+ *b++ = ' ';
+ if (n == 0) {
+ *b++ = '0';
+ *b++ = '.';
+ *b = 0;
+ goto f__ret;
+ }
+ sprintf(b, LGFMT, n);
+ if (*b == '0') {
+ while(b[0] = b[1])
+ b++;
+ }
+ /* Fortran 77 insists on having a decimal point... */
+ else for(;; b++)
+ switch(*b) {
+ case 0:
+ *b++ = '.';
+ *b = 0;
+ goto f__ret;
+ case '.':
+ while(*++b);
+ goto f__ret;
+ case 'E':
+ for(c1 = '.', c = 'E'; *b = c1;
+ c1 = c, c = *++b);
+ goto f__ret;
+ }
+ f__ret:
+ return b - buf;
+#endif
+ }
+
+ static VOID
+#ifdef KR_headers
+l_put(s) register char *s;
+#else
+l_put(register char *s)
+#endif
+{
+#ifdef KR_headers
+ register int c, (*pn)() = f__putn;
+#else
+ register int c, (*pn)(int) = f__putn;
+#endif
+ while(c = *s++)
+ (*pn)(c);
+ }
+
+ static VOID
+#ifdef KR_headers
+lwrt_F(n) double n;
+#else
+lwrt_F(double n)
+#endif
+{
+ char buf[LEFBL];
+
+ if(f__recpos + l_g(buf,n) >= L_len)
+ (*f__donewrec)();
+ l_put(buf);
+}
+ static VOID
+#ifdef KR_headers
+lwrt_C(a,b) double a,b;
+#else
+lwrt_C(double a, double b)
+#endif
+{
+ char *ba, *bb, bufa[LEFBL], bufb[LEFBL];
+ int al, bl;
+
+ al = l_g(bufa, a);
+ for(ba = bufa; *ba == ' '; ba++)
+ --al;
+ bl = l_g(bufb, b) + 1; /* intentionally high by 1 */
+ for(bb = bufb; *bb == ' '; bb++)
+ --bl;
+ if(f__recpos + al + bl + 3 >= L_len && f__recpos)
+ (*f__donewrec)();
+ PUT(' ');
+ PUT('(');
+ l_put(ba);
+ PUT(',');
+ if (f__recpos + bl >= L_len) {
+ (*f__donewrec)();
+ PUT(' ');
+ }
+ l_put(bb);
+ PUT(')');
+}
+#ifdef KR_headers
+l_write(number,ptr,len,type) ftnint *number,type; char *ptr; ftnlen len;
+#else
+l_write(ftnint *number, char *ptr, ftnlen len, ftnint type)
+#endif
+{
+#define Ptr ((flex *)ptr)
+ int i;
+ long x;
+ double y,z;
+ real *xx;
+ doublereal *yy;
+ for(i=0;i< *number; i++)
+ {
+ switch((int)type)
+ {
+ default: f__fatal(204,"unknown type in lio");
+ case TYINT1:
+ x = Ptr->flchar;
+ goto xint;
+ case TYSHORT:
+ x=Ptr->flshort;
+ goto xint;
+#ifdef TYQUAD
+ case TYQUAD:
+ x = Ptr->fllongint;
+ goto xint;
+#endif
+ case TYLONG:
+ x=Ptr->flint;
+ xint: lwrt_I(x);
+ break;
+ case TYREAL:
+ y=Ptr->flreal;
+ goto xfloat;
+ case TYDREAL:
+ y=Ptr->fldouble;
+ xfloat: lwrt_F(y);
+ break;
+ case TYCOMPLEX:
+ xx= &Ptr->flreal;
+ y = *xx++;
+ z = *xx;
+ goto xcomplex;
+ case TYDCOMPLEX:
+ yy = &Ptr->fldouble;
+ y= *yy++;
+ z = *yy;
+ xcomplex:
+ lwrt_C(y,z);
+ break;
+ case TYLOGICAL1:
+ x = Ptr->flchar;
+ goto xlog;
+ case TYLOGICAL2:
+ x = Ptr->flshort;
+ goto xlog;
+ case TYLOGICAL:
+ x = Ptr->flint;
+ xlog: lwrt_L(Ptr->flint, len);
+ break;
+ case TYCHAR:
+ lwrt_A(ptr,len);
+ break;
+ }
+ ptr += len;
+ }
+ return(0);
+}
diff --git a/lib/libI77/open.c b/lib/libI77/open.c
new file mode 100644
index 000000000000..514d76f83b1b
--- /dev/null
+++ b/lib/libI77/open.c
@@ -0,0 +1,231 @@
+#ifndef NON_UNIX_STDIO
+#include "sys/types.h"
+#include "sys/stat.h"
+#endif
+#include "f2c.h"
+#include "fio.h"
+#include "string.h"
+#include "rawio.h"
+
+#ifdef KR_headers
+extern char *malloc(), *mktemp();
+extern integer f_clos();
+#else
+#undef abs
+#undef min
+#undef max
+#include "stdlib.h"
+extern int f__canseek(FILE*);
+extern integer f_clos(cllist*);
+#endif
+
+#ifdef NON_ANSI_RW_MODES
+char *f__r_mode[2] = {"r", "r"};
+char *f__w_mode[4] = {"w", "w", "r+w", "r+w"};
+#else
+char *f__r_mode[2] = {"rb", "r"};
+char *f__w_mode[4] = {"wb", "w", "r+b", "r+"};
+#endif
+
+#ifdef KR_headers
+f__isdev(s) char *s;
+#else
+f__isdev(char *s)
+#endif
+{
+#ifdef NON_UNIX_STDIO
+ int i, j;
+
+ i = open(s,O_RDONLY);
+ if (i == -1)
+ return 0;
+ j = isatty(i);
+ close(i);
+ return j;
+#else
+ struct stat x;
+
+ if(stat(s, &x) == -1) return(0);
+#ifdef S_IFMT
+ switch(x.st_mode&S_IFMT) {
+ case S_IFREG:
+ case S_IFDIR:
+ return(0);
+ }
+#else
+#ifdef S_ISREG
+ /* POSIX version */
+ if(S_ISREG(x.st_mode) || S_ISDIR(x.st_mode))
+ return(0);
+ else
+#else
+ Help! How does stat work on this system?
+#endif
+#endif
+ return(1);
+#endif
+}
+#ifdef KR_headers
+integer f_open(a) olist *a;
+#else
+integer f_open(olist *a)
+#endif
+{ unit *b;
+ integer rv;
+ char buf[256], *s;
+ cllist x;
+#ifdef NON_UNIX_STDIO
+ FILE *tf;
+#else
+ int n;
+ struct stat stb;
+#endif
+ if(a->ounit>=MXUNIT || a->ounit<0)
+ err(a->oerr,101,"open")
+ f__curunit = b = &f__units[a->ounit];
+ if(b->ufd) {
+ if(a->ofnm==0)
+ {
+ same: if (a->oblnk)
+ b->ublnk = *a->oblnk == 'z' || *a->oblnk == 'Z';
+ return(0);
+ }
+#ifdef NON_UNIX_STDIO
+ if (b->ufnm
+ && strlen(b->ufnm) == a->ofnmlen
+ && !strncmp(b->ufnm, b->ufnm, (unsigned)a->ofnmlen))
+ goto same;
+#else
+ g_char(a->ofnm,a->ofnmlen,buf);
+ if (f__inode(buf,&n) == b->uinode && n == b->udev)
+ goto same;
+#endif
+ x.cunit=a->ounit;
+ x.csta=0;
+ x.cerr=a->oerr;
+ if ((rv = f_clos(&x)) != 0)
+ return rv;
+ }
+ b->url = (int)a->orl;
+ b->ublnk = a->oblnk && (*a->oblnk == 'z' || *a->oblnk == 'Z');
+ if(a->ofm==0)
+ { if(b->url>0) b->ufmt=0;
+ else b->ufmt=1;
+ }
+ else if(*a->ofm=='f' || *a->ofm == 'F') b->ufmt=1;
+ else b->ufmt=0;
+#ifdef url_Adjust
+ if (b->url && !b->ufmt)
+ url_Adjust(b->url);
+#endif
+ if (a->ofnm) {
+ g_char(a->ofnm,a->ofnmlen,buf);
+ if (!buf[0])
+ err(a->oerr,107,"open")
+ }
+ else
+ sprintf(buf, "fort.%ld", a->ounit);
+ b->uscrtch = 0;
+ switch(a->osta ? *a->osta : 'u')
+ {
+ case 'o':
+ case 'O':
+#ifdef NON_UNIX_STDIO
+ if(access(buf,0))
+#else
+ if(stat(buf,&stb))
+#endif
+ err(a->oerr,errno,"open")
+ break;
+ case 's':
+ case 'S':
+ b->uscrtch=1;
+#ifdef _POSIX_SOURCE
+ tmpnam(buf);
+#else
+ (void) strcpy(buf,"tmp.FXXXXXX");
+ (void) mktemp(buf);
+#endif
+ goto replace;
+ case 'n':
+ case 'N':
+#ifdef NON_UNIX_STDIO
+ if(!access(buf,0))
+#else
+ if(!stat(buf,&stb))
+#endif
+ err(a->oerr,128,"open")
+ /* no break */
+ case 'r': /* Fortran 90 replace option */
+ case 'R':
+ replace:
+#ifdef NON_UNIX_STDIO
+ if (tf = fopen(buf,f__w_mode[0]))
+ fclose(tf);
+#else
+ (void) close(creat(buf, 0666));
+#endif
+ }
+
+ b->ufnm=(char *) malloc((unsigned int)(strlen(buf)+1));
+ if(b->ufnm==NULL) err(a->oerr,113,"no space");
+ (void) strcpy(b->ufnm,buf);
+ b->uend=0;
+ b->uwrt = 0;
+ if(f__isdev(buf))
+ { b->ufd = fopen(buf,f__r_mode[b->ufmt]);
+ if(b->ufd==NULL) err(a->oerr,errno,buf)
+ }
+ else {
+ if(!(b->ufd = fopen(buf, f__r_mode[b->ufmt]))) {
+#ifdef NON_UNIX_STDIO
+ if (b->ufd = fopen(buf, f__w_mode[b->ufmt+2]))
+ b->uwrt = 2;
+ else if (b->ufd = fopen(buf, f__w_mode[b->ufmt]))
+ b->uwrt = 1;
+ else
+#else
+ if ((n = open(buf,O_WRONLY)) >= 0)
+ b->uwrt = 2;
+ else {
+ n = creat(buf, 0666);
+ b->uwrt = 1;
+ }
+ if (n < 0
+ || (b->ufd = fdopen(n, f__w_mode[b->ufmt])) == NULL)
+#endif
+ err(a->oerr, errno, "open");
+ }
+ }
+ b->useek=f__canseek(b->ufd);
+#ifndef NON_UNIX_STDIO
+ if((b->uinode=f__inode(buf,&b->udev))==-1)
+ err(a->oerr,108,"open")
+#endif
+ if(b->useek)
+ if (a->orl)
+ rewind(b->ufd);
+ else if ((s = a->oacc) && (*s == 'a' || *s == 'A')
+ && fseek(b->ufd, 0L, SEEK_END))
+ err(a->oerr,129,"open");
+ return(0);
+}
+#ifdef KR_headers
+fk_open(seq,fmt,n) ftnint n;
+#else
+fk_open(int seq, int fmt, ftnint n)
+#endif
+{ char nbuf[10];
+ olist a;
+ (void) sprintf(nbuf,"fort.%ld",n);
+ a.oerr=1;
+ a.ounit=n;
+ a.ofnm=nbuf;
+ a.ofnmlen=strlen(nbuf);
+ a.osta=NULL;
+ a.oacc= seq==SEQ?"s":"d";
+ a.ofm = fmt==FMT?"f":"u";
+ a.orl = seq==DIR?1:0;
+ a.oblnk=NULL;
+ return(f_open(&a));
+}
diff --git a/lib/libI77/permission b/lib/libI77/permission
new file mode 100644
index 000000000000..20d431ed6dc9
--- /dev/null
+++ b/lib/libI77/permission
@@ -0,0 +1,41 @@
+From ches Tue Mar 6 09:06:22 EST 1990
+It think it probably is. I am told the line is 89% utilized. But the throughpu
+t
+is shared, so I wouldn't worry about it.
+>From ehg Tue Mar 6 08:16 EST 1990
+Received: by coma; Tue Mar 6 08:17:21 1990
+From: pyxis!ehg
+Date: Tue, 6 Mar 90 08:16 EST
+To: coma!ches
+
+Thanks. Is it reasonable for people to ask for the 600KB f2c source over
+uunet's dedicated line? I'm just trying to find out if there's a problem
+before there's a disaster.
+>From ches Tue Mar 6 07:16:18 EST 1990
+Inet has no dialers. All its calls go through the internet. The mcsun addresse
+s
+were uunet.uu.net!mcsun!..., which will travel to uunet via Internet and
+then across the ocean on uunet's dedicated line.
+/****************************************************************
+Copyright 1990 by AT&T Bell Laboratories and Bellcore.
+
+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 appear in all
+copies and that both that the copyright notice and this
+permission notice and warranty disclaimer appear in supporting
+documentation, and that the names of AT&T Bell Laboratories or
+Bellcore or any of their entities not be used in advertising or
+publicity pertaining to distribution of the software without
+specific, written prior permission.
+
+AT&T and Bellcore disclaim all warranties with regard to this
+software, including all implied warranties of merchantability
+and fitness. In no event shall AT&T or Bellcore be liable for
+any special, 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.
+****************************************************************/
+
diff --git a/lib/libI77/rawio.h b/lib/libI77/rawio.h
new file mode 100644
index 000000000000..59181d759f8d
--- /dev/null
+++ b/lib/libI77/rawio.h
@@ -0,0 +1,41 @@
+#ifdef KR_headers
+extern FILE *fdopen();
+#else
+#ifdef MSDOS
+#include "io.h"
+#define close _close
+#define creat _creat
+#define open _open
+#define read _read
+#define write _write
+#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifndef MSDOS
+#ifdef OPEN_DECL
+extern int creat(const char*,int), open(const char*,int);
+#endif
+extern int close(int);
+extern int read(int,void*,size_t), write(int,void*,size_t);
+extern int unlink(const char*);
+#ifndef _POSIX_SOURCE
+#ifndef NON_UNIX_STDIO
+extern FILE *fdopen(int, const char*);
+#endif
+#endif
+#endif
+
+extern char *mktemp(char*);
+
+#ifdef __cplusplus
+ }
+#endif
+#endif
+
+#include "fcntl.h"
+
+#ifndef O_WRONLY
+#define O_RDONLY 0
+#define O_WRONLY 1
+#endif
diff --git a/lib/libI77/rdfmt.c b/lib/libI77/rdfmt.c
new file mode 100644
index 000000000000..9fd854515b65
--- /dev/null
+++ b/lib/libI77/rdfmt.c
@@ -0,0 +1,476 @@
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+#include "fp.h"
+
+extern int f__cursor;
+#ifdef KR_headers
+extern double atof();
+#else
+#undef abs
+#undef min
+#undef max
+#include "stdlib.h"
+#endif
+
+ static int
+#ifdef KR_headers
+rd_Z(n,w,len) Uint *n; ftnlen len;
+#else
+rd_Z(Uint *n, int w, ftnlen len)
+#endif
+{
+ long x[9];
+ char *s, *s0, *s1, *se, *t;
+ int ch, i, w1, w2;
+ static char hex[256];
+ static int one = 1;
+ int bad = 0;
+
+ if (!hex['0']) {
+ s = "0123456789";
+ while(ch = *s++)
+ hex[ch] = ch - '0' + 1;
+ s = "ABCDEF";
+ while(ch = *s++)
+ hex[ch] = hex[ch + 'a' - 'A'] = ch - 'A' + 11;
+ }
+ s = s0 = (char *)x;
+ s1 = (char *)&x[4];
+ se = (char *)&x[8];
+ if (len > 4*sizeof(long))
+ return errno = 117;
+ while (w) {
+ GET(ch);
+ if (ch==',' || ch=='\n')
+ break;
+ w--;
+ if (ch > ' ') {
+ if (!hex[ch & 0xff])
+ bad++;
+ *s++ = ch;
+ if (s == se) {
+ /* discard excess characters */
+ for(t = s0, s = s1; t < s1;)
+ *t++ = *s++;
+ s = s1;
+ }
+ }
+ }
+ if (bad)
+ return errno = 115;
+ w = (int)len;
+ w1 = s - s0;
+ w2 = w1+1 >> 1;
+ t = (char *)n;
+ if (*(char *)&one) {
+ /* little endian */
+ t += w - 1;
+ i = -1;
+ }
+ else
+ i = 1;
+ for(; w > w2; t += i, --w)
+ *t = 0;
+ if (!w)
+ return 0;
+ if (w < w2)
+ s0 = s - (w << 1);
+ else if (w1 & 1) {
+ *t = hex[*s0++ & 0xff] - 1;
+ if (!--w)
+ return 0;
+ t += i;
+ }
+ do {
+ *t = hex[*s0 & 0xff]-1 << 4 | hex[s0[1] & 0xff]-1;
+ t += i;
+ s0 += 2;
+ }
+ while(--w);
+ return 0;
+ }
+
+ static int
+#ifdef KR_headers
+rd_I(n,w,len, base) Uint *n; int w; ftnlen len; register int base;
+#else
+rd_I(Uint *n, int w, ftnlen len, register int base)
+#endif
+{ long x;
+ int sign,ch;
+ char s[84], *ps;
+ ps=s; x=0;
+ while (w)
+ {
+ GET(ch);
+ if (ch==',' || ch=='\n') break;
+ *ps=ch; ps++; w--;
+ }
+ *ps='\0';
+ ps=s;
+ while (*ps==' ') ps++;
+ if (*ps=='-') { sign=1; ps++; }
+ else { sign=0; if (*ps=='+') ps++; }
+loop: while (*ps>='0' && *ps<='9') { x=x*base+(*ps-'0'); ps++; }
+ if (*ps==' ') {if (f__cblank) x *= base; ps++; goto loop;}
+ if(sign) x = -x;
+ if(len==sizeof(integer)) n->il=x;
+ else if(len == sizeof(char)) n->ic = (char)x;
+#ifdef Allow_TYQUAD
+ else if (len == sizeof(longint)) n->ili = x;
+#endif
+ else n->is = (short)x;
+ if (*ps) return(errno=115); else return(0);
+}
+ static int
+#ifdef KR_headers
+rd_L(n,w,len) ftnint *n; ftnlen len;
+#else
+rd_L(ftnint *n, int w, ftnlen len)
+#endif
+{ int ch, lv;
+ char s[84], *ps;
+ ps=s;
+ while (w) {
+ GET(ch);
+ if (ch==','||ch=='\n') break;
+ *ps=ch;
+ ps++; w--;
+ }
+ *ps='\0';
+ ps=s; while (*ps==' ') ps++;
+ if (*ps=='.') ps++;
+ if (*ps=='t' || *ps == 'T')
+ lv = 1;
+ else if (*ps == 'f' || *ps == 'F')
+ lv = 0;
+ else return(errno=116);
+ switch(len) {
+ case sizeof(char): *(char *)n = (char)lv; break;
+ case sizeof(short): *(short *)n = (short)lv; break;
+ default: *n = lv;
+ }
+ return 0;
+}
+
+#include "ctype.h"
+
+ static int
+#ifdef KR_headers
+rd_F(p, w, d, len) ufloat *p; ftnlen len;
+#else
+rd_F(ufloat *p, int w, int d, ftnlen len)
+#endif
+{
+ char s[FMAX+EXPMAXDIGS+4];
+ register int ch;
+ register char *sp, *spe, *sp1;
+ double x;
+ int scale1, se;
+ long e, exp;
+
+ sp1 = sp = s;
+ spe = sp + FMAX;
+ exp = -d;
+ x = 0.;
+
+ do {
+ GET(ch);
+ w--;
+ } while (ch == ' ' && w);
+ switch(ch) {
+ case '-': *sp++ = ch; sp1++; spe++;
+ case '+':
+ if (!w) goto zero;
+ --w;
+ GET(ch);
+ }
+ while(ch == ' ') {
+blankdrop:
+ if (!w--) goto zero; GET(ch); }
+ while(ch == '0')
+ { if (!w--) goto zero; GET(ch); }
+ if (ch == ' ' && f__cblank)
+ goto blankdrop;
+ scale1 = f__scale;
+ while(isdigit(ch)) {
+digloop1:
+ if (sp < spe) *sp++ = ch;
+ else ++exp;
+digloop1e:
+ if (!w--) goto done;
+ GET(ch);
+ }
+ if (ch == ' ') {
+ if (f__cblank)
+ { ch = '0'; goto digloop1; }
+ goto digloop1e;
+ }
+ if (ch == '.') {
+ exp += d;
+ if (!w--) goto done;
+ GET(ch);
+ if (sp == sp1) { /* no digits yet */
+ while(ch == '0') {
+skip01:
+ --exp;
+skip0:
+ if (!w--) goto done;
+ GET(ch);
+ }
+ if (ch == ' ') {
+ if (f__cblank) goto skip01;
+ goto skip0;
+ }
+ }
+ while(isdigit(ch)) {
+digloop2:
+ if (sp < spe)
+ { *sp++ = ch; --exp; }
+digloop2e:
+ if (!w--) goto done;
+ GET(ch);
+ }
+ if (ch == ' ') {
+ if (f__cblank)
+ { ch = '0'; goto digloop2; }
+ goto digloop2e;
+ }
+ }
+ switch(ch) {
+ default:
+ break;
+ case '-': se = 1; goto signonly;
+ case '+': se = 0; goto signonly;
+ case 'e':
+ case 'E':
+ case 'd':
+ case 'D':
+ if (!w--)
+ goto bad;
+ GET(ch);
+ while(ch == ' ') {
+ if (!w--)
+ goto bad;
+ GET(ch);
+ }
+ se = 0;
+ switch(ch) {
+ case '-': se = 1;
+ case '+':
+signonly:
+ if (!w--)
+ goto bad;
+ GET(ch);
+ }
+ while(ch == ' ') {
+ if (!w--)
+ goto bad;
+ GET(ch);
+ }
+ if (!isdigit(ch))
+ goto bad;
+
+ e = ch - '0';
+ for(;;) {
+ if (!w--)
+ { ch = '\n'; break; }
+ GET(ch);
+ if (!isdigit(ch)) {
+ if (ch == ' ') {
+ if (f__cblank)
+ ch = '0';
+ else continue;
+ }
+ else
+ break;
+ }
+ e = 10*e + ch - '0';
+ if (e > EXPMAX && sp > sp1)
+ goto bad;
+ }
+ if (se)
+ exp -= e;
+ else
+ exp += e;
+ scale1 = 0;
+ }
+ switch(ch) {
+ case '\n':
+ case ',':
+ break;
+ default:
+bad:
+ return (errno = 115);
+ }
+done:
+ if (sp > sp1) {
+ while(*--sp == '0')
+ ++exp;
+ if (exp -= scale1)
+ sprintf(sp+1, "e%ld", exp);
+ else
+ sp[1] = 0;
+ x = atof(s);
+ }
+zero:
+ if (len == sizeof(real))
+ p->pf = x;
+ else
+ p->pd = x;
+ return(0);
+ }
+
+
+ static int
+#ifdef KR_headers
+rd_A(p,len) char *p; ftnlen len;
+#else
+rd_A(char *p, ftnlen len)
+#endif
+{ int i,ch;
+ for(i=0;i<len;i++)
+ { GET(ch);
+ *p++=VAL(ch);
+ }
+ return(0);
+}
+ static int
+#ifdef KR_headers
+rd_AW(p,w,len) char *p; ftnlen len;
+#else
+rd_AW(char *p, int w, ftnlen len)
+#endif
+{ int i,ch;
+ if(w>=len)
+ { for(i=0;i<w-len;i++)
+ GET(ch);
+ for(i=0;i<len;i++)
+ { GET(ch);
+ *p++=VAL(ch);
+ }
+ return(0);
+ }
+ for(i=0;i<w;i++)
+ { GET(ch);
+ *p++=VAL(ch);
+ }
+ for(i=0;i<len-w;i++) *p++=' ';
+ return(0);
+}
+ static int
+#ifdef KR_headers
+rd_H(n,s) char *s;
+#else
+rd_H(int n, char *s)
+#endif
+{ int i,ch;
+ for(i=0;i<n;i++)
+ if((ch=(*f__getn)())<0) return(ch);
+ else *s++ = ch=='\n'?' ':ch;
+ return(1);
+}
+ static int
+#ifdef KR_headers
+rd_POS(s) char *s;
+#else
+rd_POS(char *s)
+#endif
+{ char quote;
+ int ch;
+ quote= *s++;
+ for(;*s;s++)
+ if(*s==quote && *(s+1)!=quote) break;
+ else if((ch=(*f__getn)())<0) return(ch);
+ else *s = ch=='\n'?' ':ch;
+ return(1);
+}
+#ifdef KR_headers
+rd_ed(p,ptr,len) struct syl *p; char *ptr; ftnlen len;
+#else
+rd_ed(struct syl *p, char *ptr, ftnlen len)
+#endif
+{ int ch;
+ for(;f__cursor>0;f__cursor--) if((ch=(*f__getn)())<0) return(ch);
+ if(f__cursor<0)
+ { if(f__recpos+f__cursor < 0) /*err(elist->cierr,110,"fmt")*/
+ f__cursor = -f__recpos; /* is this in the standard? */
+ if(f__external == 0) {
+ extern char *f__icptr;
+ f__icptr += f__cursor;
+ }
+ else if(f__curunit && f__curunit->useek)
+ (void) fseek(f__cf,(long) f__cursor,SEEK_CUR);
+ else
+ err(f__elist->cierr,106,"fmt");
+ f__recpos += f__cursor;
+ f__cursor=0;
+ }
+ switch(p->op)
+ {
+ default: fprintf(stderr,"rd_ed, unexpected code: %d\n", p->op);
+ sig_die(f__fmtbuf, 1);
+ case IM:
+ case I: ch = rd_I((Uint *)ptr,p->p1,len, 10);
+ break;
+
+ /* O and OM don't work right for character, double, complex, */
+ /* or doublecomplex, and they differ from Fortran 90 in */
+ /* showing a minus sign for negative values. */
+
+ case OM:
+ case O: ch = rd_I((Uint *)ptr, p->p1, len, 8);
+ break;
+ case L: ch = rd_L((ftnint *)ptr,p->p1,len);
+ break;
+ case A: ch = rd_A(ptr,len);
+ break;
+ case AW:
+ ch = rd_AW(ptr,p->p1,len);
+ break;
+ case E: case EE:
+ case D:
+ case G:
+ case GE:
+ case F: ch = rd_F((ufloat *)ptr,p->p1,p->p2,len);
+ break;
+
+ /* Z and ZM assume 8-bit bytes. */
+
+ case ZM:
+ case Z:
+ ch = rd_Z((Uint *)ptr, p->p1, len);
+ break;
+ }
+ if(ch == 0) return(ch);
+ else if(ch == EOF) return(EOF);
+ if (f__cf)
+ clearerr(f__cf);
+ return(errno);
+}
+#ifdef KR_headers
+rd_ned(p) struct syl *p;
+#else
+rd_ned(struct syl *p)
+#endif
+{
+ switch(p->op)
+ {
+ default: fprintf(stderr,"rd_ned, unexpected code: %d\n", p->op);
+ sig_die(f__fmtbuf, 1);
+ case APOS:
+ return(rd_POS(*(char **)&p->p2));
+ case H: return(rd_H(p->p1,*(char **)&p->p2));
+ case SLASH: return((*f__donewrec)());
+ case TR:
+ case X: f__cursor += p->p1;
+ return(1);
+ case T: f__cursor=p->p1-f__recpos - 1;
+ return(1);
+ case TL: f__cursor -= p->p1;
+ if(f__cursor < -f__recpos) /* TL1000, 1X */
+ f__cursor = -f__recpos;
+ return(1);
+ }
+}
diff --git a/lib/libI77/rewind.c b/lib/libI77/rewind.c
new file mode 100644
index 000000000000..e58daad7b8a2
--- /dev/null
+++ b/lib/libI77/rewind.c
@@ -0,0 +1,24 @@
+#include "f2c.h"
+#include "fio.h"
+#ifdef KR_headers
+integer f_rew(a) alist *a;
+#else
+integer f_rew(alist *a)
+#endif
+{
+ unit *b;
+ if(a->aunit>=MXUNIT || a->aunit<0)
+ err(a->aerr,101,"rewind");
+ b = &f__units[a->aunit];
+ if(b->ufd == NULL || b->uwrt == 3)
+ return(0);
+ if(!b->useek)
+ err(a->aerr,106,"rewind")
+ if(b->uwrt) {
+ (void) t_runc(a);
+ b->uwrt = 3;
+ }
+ rewind(b->ufd);
+ b->uend=0;
+ return(0);
+}
diff --git a/lib/libI77/rsfe.c b/lib/libI77/rsfe.c
new file mode 100644
index 000000000000..5d29bee6847e
--- /dev/null
+++ b/lib/libI77/rsfe.c
@@ -0,0 +1,73 @@
+/* read sequential formatted external */
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+
+xrd_SL(Void)
+{ int ch;
+ if(!f__curunit->uend)
+ while((ch=getc(f__cf))!='\n' && ch!=EOF);
+ f__cursor=f__recpos=0;
+ return(1);
+}
+x_getc(Void)
+{ int ch;
+ if(f__curunit->uend) return(EOF);
+ ch = getc(f__cf);
+ if(ch!=EOF && ch!='\n')
+ { f__recpos++;
+ return(ch);
+ }
+ if(ch=='\n')
+ { (void) ungetc(ch,f__cf);
+ return(ch);
+ }
+ if(f__curunit->uend || feof(f__cf))
+ { errno=0;
+ f__curunit->uend=1;
+ return(-1);
+ }
+ return(-1);
+}
+x_endp(Void)
+{
+ (void) xrd_SL();
+ return(0);
+}
+x_rev(Void)
+{
+ (void) xrd_SL();
+ return(0);
+}
+#ifdef KR_headers
+integer s_rsfe(a) cilist *a; /* start */
+#else
+integer s_rsfe(cilist *a) /* start */
+#endif
+{ int n;
+ if(!f__init) f_init();
+ if(n=c_sfe(a)) return(n);
+ f__reading=1;
+ f__sequential=1;
+ f__formatted=1;
+ f__external=1;
+ f__elist=a;
+ f__cursor=f__recpos=0;
+ f__scale=0;
+ f__fmtbuf=a->cifmt;
+ f__curunit= &f__units[a->ciunit];
+ f__cf=f__curunit->ufd;
+ if(pars_f(f__fmtbuf)<0) err(a->cierr,100,"startio");
+ f__getn= x_getc;
+ f__doed= rd_ed;
+ f__doned= rd_ned;
+ fmt_bg();
+ f__doend=x_endp;
+ f__donewrec=xrd_SL;
+ f__dorevert=x_rev;
+ f__cblank=f__curunit->ublnk;
+ f__cplus=0;
+ if(f__curunit->uwrt && f__nowreading(f__curunit))
+ err(a->cierr,errno,"read start");
+ return(0);
+}
diff --git a/lib/libI77/rsli.c b/lib/libI77/rsli.c
new file mode 100644
index 000000000000..b016d1e0ea44
--- /dev/null
+++ b/lib/libI77/rsli.c
@@ -0,0 +1,98 @@
+#include "f2c.h"
+#include "fio.h"
+#include "lio.h"
+#include "fmt.h" /* for f__doend */
+
+extern flag f__lquit;
+extern int f__lcount;
+extern char *f__icptr;
+extern char *f__icend;
+extern icilist *f__svic;
+extern int f__icnum, f__recpos;
+
+static int i_getc(Void)
+{
+ if(f__recpos >= f__svic->icirlen) {
+ if (f__recpos++ == f__svic->icirlen)
+ return '\n';
+ z_rnew();
+ }
+ f__recpos++;
+ if(f__icptr >= f__icend) err(f__svic->iciend,(EOF),"internal read");
+ return(*f__icptr++);
+ }
+
+ static
+#ifdef KR_headers
+int i_ungetc(ch, f) int ch; FILE *f;
+#else
+int i_ungetc(int ch, FILE *f)
+#endif
+{
+ if (--f__recpos == f__svic->icirlen)
+ return '\n';
+ if (f__recpos < -1)
+ err(f__svic->icierr,110,"recend");
+ /* *--icptr == ch, and icptr may point to read-only memory */
+ return *--f__icptr /* = ch */;
+ }
+
+ static void
+#ifdef KR_headers
+c_lir(a) icilist *a;
+#else
+c_lir(icilist *a)
+#endif
+{
+ extern int l_eof;
+ f__reading = 1;
+ f__external = 0;
+ f__formatted = 1;
+ f__svic = a;
+ L_len = a->icirlen;
+ f__recpos = -1;
+ f__icnum = f__recpos = 0;
+ f__cursor = 0;
+ l_getc = i_getc;
+ l_ungetc = i_ungetc;
+ l_eof = 0;
+ f__icptr = a->iciunit;
+ f__icend = f__icptr + a->icirlen*a->icirnum;
+ f__cf = 0;
+ f__curunit = 0;
+ f__elist = (cilist *)a;
+ }
+
+
+#ifdef KR_headers
+integer s_rsli(a) icilist *a;
+#else
+integer s_rsli(icilist *a)
+#endif
+{
+ f__lioproc = l_read;
+ f__lquit = 0;
+ f__lcount = 0;
+ c_lir(a);
+ f__doend = 0;
+ return(0);
+ }
+
+integer e_rsli(Void)
+{ return 0; }
+
+#ifdef KR_headers
+integer s_rsni(a) icilist *a;
+#else
+extern int x_rsne(cilist*);
+
+integer s_rsni(icilist *a)
+#endif
+{
+ cilist ca;
+ ca.ciend = a->iciend;
+ ca.cierr = a->icierr;
+ ca.cifmt = a->icifmt;
+ c_lir(a);
+ return x_rsne(&ca);
+ }
diff --git a/lib/libI77/rsne.c b/lib/libI77/rsne.c
new file mode 100644
index 000000000000..4064fd2badad
--- /dev/null
+++ b/lib/libI77/rsne.c
@@ -0,0 +1,565 @@
+#include "f2c.h"
+#include "fio.h"
+#include "lio.h"
+
+#define MAX_NL_CACHE 3 /* maximum number of namelist hash tables to cache */
+#define MAXDIM 20 /* maximum number of subscripts */
+
+ struct dimen {
+ ftnlen extent;
+ ftnlen curval;
+ ftnlen delta;
+ ftnlen stride;
+ };
+ typedef struct dimen dimen;
+
+ struct hashentry {
+ struct hashentry *next;
+ char *name;
+ Vardesc *vd;
+ };
+ typedef struct hashentry hashentry;
+
+ struct hashtab {
+ struct hashtab *next;
+ Namelist *nl;
+ int htsize;
+ hashentry *tab[1];
+ };
+ typedef struct hashtab hashtab;
+
+ static hashtab *nl_cache;
+ static n_nlcache;
+ static hashentry **zot;
+ extern ftnlen f__typesize[];
+
+ extern flag f__lquit;
+ extern int f__lcount, nml_read;
+ extern t_getc(Void);
+
+#ifdef KR_headers
+ extern char *malloc(), *memset();
+
+#ifdef ungetc
+ static int
+un_getc(x,f__cf) int x; FILE *f__cf;
+{ return ungetc(x,f__cf); }
+#else
+#define un_getc ungetc
+ extern int ungetc();
+#endif
+
+#else
+#undef abs
+#undef min
+#undef max
+#include "stdlib.h"
+#include "string.h"
+
+#ifdef ungetc
+ static int
+un_getc(int x, FILE *f__cf)
+{ return ungetc(x,f__cf); }
+#else
+#define un_getc ungetc
+#endif
+#endif
+
+ static Vardesc *
+#ifdef KR_headers
+hash(ht, s) hashtab *ht; register char *s;
+#else
+hash(hashtab *ht, register char *s)
+#endif
+{
+ register int c, x;
+ register hashentry *h;
+ char *s0 = s;
+
+ for(x = 0; c = *s++; x = x & 0x4000 ? ((x << 1) & 0x7fff) + 1 : x << 1)
+ x += c;
+ for(h = *(zot = ht->tab + x % ht->htsize); h; h = h->next)
+ if (!strcmp(s0, h->name))
+ return h->vd;
+ return 0;
+ }
+
+ hashtab *
+#ifdef KR_headers
+mk_hashtab(nl) Namelist *nl;
+#else
+mk_hashtab(Namelist *nl)
+#endif
+{
+ int nht, nv;
+ hashtab *ht;
+ Vardesc *v, **vd, **vde;
+ hashentry *he;
+
+ hashtab **x, **x0, *y;
+ for(x = &nl_cache; y = *x; x0 = x, x = &y->next)
+ if (nl == y->nl)
+ return y;
+ if (n_nlcache >= MAX_NL_CACHE) {
+ /* discard least recently used namelist hash table */
+ y = *x0;
+ free((char *)y->next);
+ y->next = 0;
+ }
+ else
+ n_nlcache++;
+ nv = nl->nvars;
+ if (nv >= 0x4000)
+ nht = 0x7fff;
+ else {
+ for(nht = 1; nht < nv; nht <<= 1);
+ nht += nht - 1;
+ }
+ ht = (hashtab *)malloc(sizeof(hashtab) + (nht-1)*sizeof(hashentry *)
+ + nv*sizeof(hashentry));
+ if (!ht)
+ return 0;
+ he = (hashentry *)&ht->tab[nht];
+ ht->nl = nl;
+ ht->htsize = nht;
+ ht->next = nl_cache;
+ nl_cache = ht;
+ memset((char *)ht->tab, 0, nht*sizeof(hashentry *));
+ vd = nl->vars;
+ vde = vd + nv;
+ while(vd < vde) {
+ v = *vd++;
+ if (!hash(ht, v->name)) {
+ he->next = *zot;
+ *zot = he;
+ he->name = v->name;
+ he->vd = v;
+ he++;
+ }
+ }
+ return ht;
+ }
+
+static char Alpha[256], Alphanum[256];
+
+ static VOID
+nl_init(Void) {
+ register char *s;
+ register int c;
+
+ if(!f__init)
+ f_init();
+ for(s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; c = *s++; )
+ Alpha[c]
+ = Alphanum[c]
+ = Alpha[c + 'a' - 'A']
+ = Alphanum[c + 'a' - 'A']
+ = c;
+ for(s = "0123456789_"; c = *s++; )
+ Alphanum[c] = c;
+ }
+
+#define GETC(x) (x=(*l_getc)())
+#define Ungetc(x,y) (*l_ungetc)(x,y)
+
+ static int
+#ifdef KR_headers
+getname(s, slen) register char *s; int slen;
+#else
+getname(register char *s, int slen)
+#endif
+{
+ register char *se = s + slen - 1;
+ register int ch;
+
+ GETC(ch);
+ if (!(*s++ = Alpha[ch & 0xff])) {
+ if (ch != EOF)
+ ch = 115;
+ errfl(f__elist->cierr, ch, "namelist read");
+ }
+ while(*s = Alphanum[GETC(ch) & 0xff])
+ if (s < se)
+ s++;
+ if (ch == EOF)
+ err(f__elist->cierr, EOF, "namelist read");
+ if (ch > ' ')
+ Ungetc(ch,f__cf);
+ return *s = 0;
+ }
+
+ static int
+#ifdef KR_headers
+getnum(chp, val) int *chp; ftnlen *val;
+#else
+getnum(int *chp, ftnlen *val)
+#endif
+{
+ register int ch, sign;
+ register ftnlen x;
+
+ while(GETC(ch) <= ' ' && ch >= 0);
+ if (ch == '-') {
+ sign = 1;
+ GETC(ch);
+ }
+ else {
+ sign = 0;
+ if (ch == '+')
+ GETC(ch);
+ }
+ x = ch - '0';
+ if (x < 0 || x > 9)
+ return 115;
+ while(GETC(ch) >= '0' && ch <= '9')
+ x = 10*x + ch - '0';
+ while(ch <= ' ' && ch >= 0)
+ GETC(ch);
+ if (ch == EOF)
+ return EOF;
+ *val = sign ? -x : x;
+ *chp = ch;
+ return 0;
+ }
+
+ static int
+#ifdef KR_headers
+getdimen(chp, d, delta, extent, x1)
+ int *chp; dimen *d; ftnlen delta, extent, *x1;
+#else
+getdimen(int *chp, dimen *d, ftnlen delta, ftnlen extent, ftnlen *x1)
+#endif
+{
+ register int k;
+ ftnlen x2, x3;
+
+ if (k = getnum(chp, x1))
+ return k;
+ x3 = 1;
+ if (*chp == ':') {
+ if (k = getnum(chp, &x2))
+ return k;
+ x2 -= *x1;
+ if (*chp == ':') {
+ if (k = getnum(chp, &x3))
+ return k;
+ if (!x3)
+ return 123;
+ x2 /= x3;
+ }
+ if (x2 < 0 || x2 >= extent)
+ return 123;
+ d->extent = x2 + 1;
+ }
+ else
+ d->extent = 1;
+ d->curval = 0;
+ d->delta = delta;
+ d->stride = x3;
+ return 0;
+ }
+
+#ifndef No_Namelist_Questions
+ static Void
+#ifdef KR_headers
+print_ne(a) cilist *a;
+#else
+print_ne(cilist *a)
+#endif
+{
+ flag intext = f__external;
+ int rpsave = f__recpos;
+ FILE *cfsave = f__cf;
+ unit *usave = f__curunit;
+ cilist t;
+ t = *a;
+ t.ciunit = 6;
+ s_wsne(&t);
+ fflush(f__cf);
+ f__external = intext;
+ f__reading = 1;
+ f__recpos = rpsave;
+ f__cf = cfsave;
+ f__curunit = usave;
+ f__elist = a;
+ }
+#endif
+
+ static char where0[] = "namelist read start ";
+
+#ifdef KR_headers
+x_rsne(a) cilist *a;
+#else
+x_rsne(cilist *a)
+#endif
+{
+ int ch, got1, k, n, nd, quote;
+ Namelist *nl;
+ static char where[] = "namelist read";
+ char buf[64];
+ hashtab *ht;
+ Vardesc *v;
+ dimen *dn, *dn0, *dn1;
+ ftnlen *dims, *dims1;
+ ftnlen b, b0, b1, ex, no, no1, nomax, size, span;
+ ftnint type;
+ char *vaddr;
+ long iva, ivae;
+ dimen dimens[MAXDIM], substr;
+
+ if (!Alpha['a'])
+ nl_init();
+ f__reading=1;
+ f__formatted=1;
+ got1 = 0;
+ top:
+ for(;;) switch(GETC(ch)) {
+ case EOF:
+ err(a->ciend,(EOF),where0);
+ case '&':
+ case '$':
+ goto have_amp;
+#ifndef No_Namelist_Questions
+ case '?':
+ print_ne(a);
+ continue;
+#endif
+ default:
+ if (ch <= ' ' && ch >= 0)
+ continue;
+ errfl(a->cierr, 115, where0);
+ }
+ have_amp:
+ if (ch = getname(buf,sizeof(buf)))
+ return ch;
+ nl = (Namelist *)a->cifmt;
+ if (strcmp(buf, nl->name))
+#ifdef No_Bad_Namelist_Skip
+ errfl(a->cierr, 118, where0);
+#else
+ {
+ fprintf(stderr,
+ "Skipping namelist \"%s\": seeking namelist \"%s\".\n",
+ buf, nl->name);
+ fflush(stderr);
+ for(;;) switch(GETC(ch)) {
+ case EOF:
+ err(a->ciend, EOF, where0);
+ case '/':
+ case '&':
+ case '$':
+ if (f__external)
+ e_rsle();
+ else
+ z_rnew();
+ goto top;
+ case '"':
+ case '\'':
+ quote = ch;
+ more_quoted:
+ while(GETC(ch) != quote)
+ if (ch == EOF)
+ err(a->ciend, EOF, where0);
+ if (GETC(ch) == quote)
+ goto more_quoted;
+ Ungetc(ch,f__cf);
+ default:
+ continue;
+ }
+ }
+#endif
+ ht = mk_hashtab(nl);
+ if (!ht)
+ errfl(f__elist->cierr, 113, where0);
+ for(;;) {
+ for(;;) switch(GETC(ch)) {
+ case EOF:
+ if (got1)
+ return 0;
+ err(a->ciend, EOF, where0);
+ case '/':
+ case '$':
+ case '&':
+ return 0;
+ default:
+ if (ch <= ' ' && ch >= 0 || ch == ',')
+ continue;
+ Ungetc(ch,f__cf);
+ if (ch = getname(buf,sizeof(buf)))
+ return ch;
+ goto havename;
+ }
+ havename:
+ v = hash(ht,buf);
+ if (!v)
+ errfl(a->cierr, 119, where);
+ while(GETC(ch) <= ' ' && ch >= 0);
+ vaddr = v->addr;
+ type = v->type;
+ if (type < 0) {
+ size = -type;
+ type = TYCHAR;
+ }
+ else
+ size = f__typesize[type];
+ ivae = size;
+ iva = 0;
+ if (ch == '(' /*)*/ ) {
+ dn = dimens;
+ if (!(dims = v->dims)) {
+ if (type != TYCHAR)
+ errfl(a->cierr, 122, where);
+ if (k = getdimen(&ch, dn, (ftnlen)size,
+ (ftnlen)size, &b))
+ errfl(a->cierr, k, where);
+ if (ch != ')')
+ errfl(a->cierr, 115, where);
+ b1 = dn->extent;
+ if (--b < 0 || b + b1 > size)
+ return 124;
+ iva += b;
+ size = b1;
+ while(GETC(ch) <= ' ' && ch >= 0);
+ goto scalar;
+ }
+ nd = (int)dims[0];
+ nomax = span = dims[1];
+ ivae = iva + size*nomax;
+ if (k = getdimen(&ch, dn, size, nomax, &b))
+ errfl(a->cierr, k, where);
+ no = dn->extent;
+ b0 = dims[2];
+ dims1 = dims += 3;
+ ex = 1;
+ for(n = 1; n++ < nd; dims++) {
+ if (ch != ',')
+ errfl(a->cierr, 115, where);
+ dn1 = dn + 1;
+ span /= *dims;
+ if (k = getdimen(&ch, dn1, dn->delta**dims,
+ span, &b1))
+ errfl(a->cierr, k, where);
+ ex *= *dims;
+ b += b1*ex;
+ no *= dn1->extent;
+ dn = dn1;
+ }
+ if (ch != ')')
+ errfl(a->cierr, 115, where);
+ b -= b0;
+ if (b < 0 || b >= nomax)
+ errfl(a->cierr, 125, where);
+ iva += size * b;
+ dims = dims1;
+ while(GETC(ch) <= ' ' && ch >= 0);
+ no1 = 1;
+ dn0 = dimens;
+ if (type == TYCHAR && ch == '(' /*)*/) {
+ if (k = getdimen(&ch, &substr, size, size, &b))
+ errfl(a->cierr, k, where);
+ if (ch != ')')
+ errfl(a->cierr, 115, where);
+ b1 = substr.extent;
+ if (--b < 0 || b + b1 > size)
+ return 124;
+ iva += b;
+ b0 = size;
+ size = b1;
+ while(GETC(ch) <= ' ' && ch >= 0);
+ if (b1 < b0)
+ goto delta_adj;
+ }
+ for(; dn0 < dn; dn0++) {
+ if (dn0->extent != *dims++ || dn0->stride != 1)
+ break;
+ no1 *= dn0->extent;
+ }
+ if (dn0 == dimens && dimens[0].stride == 1) {
+ no1 = dimens[0].extent;
+ dn0++;
+ }
+ delta_adj:
+ ex = 0;
+ for(dn1 = dn0; dn1 <= dn; dn1++)
+ ex += (dn1->extent-1)
+ * (dn1->delta *= dn1->stride);
+ for(dn1 = dn; dn1 > dn0; dn1--) {
+ ex -= (dn1->extent - 1) * dn1->delta;
+ dn1->delta -= ex;
+ }
+ }
+ else if (dims = v->dims) {
+ no = no1 = dims[1];
+ ivae = iva + no*size;
+ }
+ else
+ scalar:
+ no = no1 = 1;
+ if (ch != '=')
+ errfl(a->cierr, 115, where);
+ got1 = nml_read = 1;
+ f__lcount = 0;
+ readloop:
+ for(;;) {
+ if (iva >= ivae || iva < 0) {
+ f__lquit = 1;
+ goto mustend;
+ }
+ else if (iva + no1*size > ivae)
+ no1 = (ivae - iva)/size;
+ f__lquit = 0;
+ if (k = l_read(&no1, vaddr + iva, size, type))
+ return k;
+ if (f__lquit == 1)
+ return 0;
+ mustend:
+ if (GETC(ch) == '/' || ch == '$' || ch == '&') {
+ f__lquit = 1;
+ return 0;
+ }
+ else if (f__lquit) {
+ while(ch <= ' ' && ch >= 0)
+ GETC(ch);
+ Ungetc(ch,f__cf);
+ if (!Alpha[ch & 0xff] && ch >= 0)
+ errfl(a->cierr, 125, where);
+ break;
+ }
+ Ungetc(ch,f__cf);
+ if ((no -= no1) <= 0)
+ break;
+ for(dn1 = dn0; dn1 <= dn; dn1++) {
+ if (++dn1->curval < dn1->extent) {
+ iva += dn1->delta;
+ goto readloop;
+ }
+ dn1->curval = 0;
+ }
+ break;
+ }
+ }
+ }
+
+ integer
+#ifdef KR_headers
+s_rsne(a) cilist *a;
+#else
+s_rsne(cilist *a)
+#endif
+{
+ extern int l_eof;
+ int n;
+
+ f__external=1;
+ l_eof = 0;
+ if(n = c_le(a))
+ return n;
+ if(f__curunit->uwrt && f__nowreading(f__curunit))
+ err(a->cierr,errno,where0);
+ l_getc = t_getc;
+ l_ungetc = un_getc;
+ f__doend = xrd_SL;
+ if (n = x_rsne(a))
+ return n;
+ return e_rsle();
+ }
diff --git a/lib/libI77/sfe.c b/lib/libI77/sfe.c
new file mode 100644
index 000000000000..6dea23af40fe
--- /dev/null
+++ b/lib/libI77/sfe.c
@@ -0,0 +1,32 @@
+/* sequential formatted external common routines*/
+#include "f2c.h"
+#include "fio.h"
+
+extern char *f__fmtbuf;
+
+integer e_rsfe(Void)
+{ int n;
+ n=en_fio();
+ if (f__cf == stdout)
+ fflush(stdout);
+ else if (f__cf == stderr)
+ fflush(stderr);
+ f__fmtbuf=NULL;
+ return(n);
+}
+#ifdef KR_headers
+c_sfe(a) cilist *a; /* check */
+#else
+c_sfe(cilist *a) /* check */
+#endif
+{ unit *p;
+ if(a->ciunit >= MXUNIT || a->ciunit<0)
+ err(a->cierr,101,"startio");
+ p = &f__units[a->ciunit];
+ if(p->ufd==NULL && fk_open(SEQ,FMT,a->ciunit)) err(a->cierr,114,"sfe")
+ if(!p->ufmt) err(a->cierr,102,"sfe")
+ return(0);
+}
+integer e_wsfe(Void)
+{ return(e_rsfe());
+}
diff --git a/lib/libI77/sue.c b/lib/libI77/sue.c
new file mode 100644
index 000000000000..21f30bf76f12
--- /dev/null
+++ b/lib/libI77/sue.c
@@ -0,0 +1,79 @@
+#include "f2c.h"
+#include "fio.h"
+extern uiolen f__reclen;
+long f__recloc;
+
+#ifdef KR_headers
+c_sue(a) cilist *a;
+#else
+c_sue(cilist *a)
+#endif
+{
+ if(a->ciunit >= MXUNIT || a->ciunit < 0)
+ err(a->cierr,101,"startio");
+ f__external=f__sequential=1;
+ f__formatted=0;
+ f__curunit = &f__units[a->ciunit];
+ f__elist=a;
+ if(f__curunit->ufd==NULL && fk_open(SEQ,UNF,a->ciunit))
+ err(a->cierr,114,"sue");
+ f__cf=f__curunit->ufd;
+ if(f__curunit->ufmt) err(a->cierr,103,"sue")
+ if(!f__curunit->useek) err(a->cierr,103,"sue")
+ return(0);
+}
+#ifdef KR_headers
+integer s_rsue(a) cilist *a;
+#else
+integer s_rsue(cilist *a)
+#endif
+{
+ int n;
+ if(!f__init) f_init();
+ f__reading=1;
+ if(n=c_sue(a)) return(n);
+ f__recpos=0;
+ if(f__curunit->uwrt && f__nowreading(f__curunit))
+ err(a->cierr, errno, "read start");
+ if(fread((char *)&f__reclen,sizeof(uiolen),1,f__cf)
+ != 1)
+ { if(feof(f__cf))
+ { f__curunit->uend = 1;
+ err(a->ciend, EOF, "start");
+ }
+ clearerr(f__cf);
+ err(a->cierr, errno, "start");
+ }
+ return(0);
+}
+#ifdef KR_headers
+integer s_wsue(a) cilist *a;
+#else
+integer s_wsue(cilist *a)
+#endif
+{
+ int n;
+ if(!f__init) f_init();
+ if(n=c_sue(a)) return(n);
+ f__reading=0;
+ f__reclen=0;
+ if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
+ err(a->cierr, errno, "write start");
+ f__recloc=ftell(f__cf);
+ (void) fseek(f__cf,(long)sizeof(uiolen),SEEK_CUR);
+ return(0);
+}
+integer e_wsue(Void)
+{ long loc;
+ (void) fwrite((char *)&f__reclen,sizeof(uiolen),1,f__cf);
+ loc=ftell(f__cf);
+ (void) fseek(f__cf,f__recloc,SEEK_SET);
+ (void) fwrite((char *)&f__reclen,sizeof(uiolen),1,f__cf);
+ (void) fseek(f__cf,loc,SEEK_SET);
+ return(0);
+}
+integer e_rsue(Void)
+{
+ (void) fseek(f__cf,(long)(f__reclen-f__recpos+sizeof(uiolen)),SEEK_CUR);
+ return(0);
+}
diff --git a/lib/libI77/typesize.c b/lib/libI77/typesize.c
new file mode 100644
index 000000000000..1a1f4f796254
--- /dev/null
+++ b/lib/libI77/typesize.c
@@ -0,0 +1,6 @@
+#include "f2c.h"
+
+ftnlen f__typesize[] = { 0, 0, sizeof(shortint), sizeof(integer),
+ sizeof(real), sizeof(doublereal),
+ sizeof(complex), sizeof(doublecomplex),
+ sizeof(logical), sizeof(char) };
diff --git a/lib/libI77/uio.c b/lib/libI77/uio.c
new file mode 100644
index 000000000000..4277dc95c70f
--- /dev/null
+++ b/lib/libI77/uio.c
@@ -0,0 +1,54 @@
+#include "f2c.h"
+#include "fio.h"
+uiolen f__reclen;
+
+#ifdef KR_headers
+do_us(number,ptr,len) ftnint *number; char *ptr; ftnlen len;
+#else
+do_us(ftnint *number, char *ptr, ftnlen len)
+#endif
+{
+ if(f__reading)
+ {
+ f__recpos += (int)(*number * len);
+ if(f__recpos>f__reclen)
+ err(f__elist->cierr, 110, "do_us");
+ if (fread(ptr,(int)len,(int)(*number),f__cf) != *number)
+ err(f__elist->ciend, EOF, "do_us");
+ return(0);
+ }
+ else
+ {
+ f__reclen += *number * len;
+ (void) fwrite(ptr,(int)len,(int)(*number),f__cf);
+ return(0);
+ }
+}
+#ifdef KR_headers
+integer do_ud(number,ptr,len) ftnint *number; char *ptr; ftnlen len;
+#else
+integer do_ud(ftnint *number, char *ptr, ftnlen len)
+#endif
+{
+ f__recpos += (int)(*number * len);
+ if(f__recpos > f__curunit->url && f__curunit->url!=1)
+ err(f__elist->cierr,110,"do_ud");
+ if(f__reading)
+ {
+ if(fread(ptr,(int)len,(int)(*number),f__cf) != *number)
+ err(f__elist->cierr,EOF,"do_ud")
+ else return(0);
+ }
+ (void) fwrite(ptr,(int)len,(int)(*number),f__cf);
+ return(0);
+}
+#ifdef KR_headers
+integer do_uio(number,ptr,len) ftnint *number; char *ptr; ftnlen len;
+#else
+integer do_uio(ftnint *number, char *ptr, ftnlen len)
+#endif
+{
+ if(f__sequential)
+ return(do_us(number,ptr,len));
+ else return(do_ud(number,ptr,len));
+}
diff --git a/lib/libI77/util.c b/lib/libI77/util.c
new file mode 100644
index 000000000000..af068b0a23c5
--- /dev/null
+++ b/lib/libI77/util.c
@@ -0,0 +1,72 @@
+#ifndef NON_UNIX_STDIO
+#include "sys/types.h"
+#include "sys/stat.h"
+#endif
+#include "f2c.h"
+#include "fio.h"
+
+ VOID
+#ifdef KR_headers
+g_char(a,alen,b) char *a,*b; ftnlen alen;
+#else
+g_char(char *a, ftnlen alen, char *b)
+#endif
+{
+ char *x = a + alen, *y = b + alen;
+
+ for(;; y--) {
+ if (x <= a) {
+ *b = 0;
+ return;
+ }
+ if (*--x != ' ')
+ break;
+ }
+ *y-- = 0;
+ do *y-- = *x;
+ while(x-- > a);
+ }
+
+ VOID
+#ifdef KR_headers
+b_char(a,b,blen) char *a,*b; ftnlen blen;
+#else
+b_char(char *a, char *b, ftnlen blen)
+#endif
+{ int i;
+ for(i=0;i<blen && *a!=0;i++) *b++= *a++;
+ for(;i<blen;i++) *b++=' ';
+}
+#ifndef NON_UNIX_STDIO
+#ifdef KR_headers
+long f__inode(a, dev) char *a; int *dev;
+#else
+long f__inode(char *a, int *dev)
+#endif
+{ struct stat x;
+ if(stat(a,&x)<0) return(-1);
+ *dev = x.st_dev;
+ return(x.st_ino);
+}
+#endif
+
+#define INTBOUND sizeof(int)-1
+ VOID
+#ifdef KR_headers
+f__mvgbt(n,len,a,b) char *a,*b;
+#else
+f__mvgbt(int n, int len, char *a, char *b)
+#endif
+{ register int num=n*len;
+ if( ((int)a&INTBOUND)==0 && ((int)b&INTBOUND)==0 && (num&INTBOUND)==0 )
+ { register int *x=(int *)a,*y=(int *)b;
+ num /= sizeof(int);
+ if(x>y) for(;num>0;num--) *y++= *x++;
+ else for(num--;num>=0;num--) *(y+num)= *(x+num);
+ }
+ else
+ { register char *x=a,*y=b;
+ if(x>y) for(;num>0;num--) *y++= *x++;
+ else for(num--;num>=0;num--) *(y+num)= *(x+num);
+ }
+}
diff --git a/lib/libI77/wref.c b/lib/libI77/wref.c
new file mode 100644
index 000000000000..f58faf2562a6
--- /dev/null
+++ b/lib/libI77/wref.c
@@ -0,0 +1,245 @@
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+#include "fp.h"
+#ifndef VAX
+#include "ctype.h"
+#endif
+
+#ifndef KR_headers
+#undef abs
+#undef min
+#undef max
+#include "stdlib.h"
+#include "string.h"
+#endif
+
+#ifdef KR_headers
+wrt_E(p,w,d,e,len) ufloat *p; ftnlen len;
+#else
+wrt_E(ufloat *p, int w, int d, int e, ftnlen len)
+#endif
+{
+ char buf[FMAX+EXPMAXDIGS+4], *s, *se;
+ int d1, delta, e1, i, sign, signspace;
+ double dd;
+#ifndef VAX
+ int e0 = e;
+#endif
+
+ if(e <= 0)
+ e = 2;
+ if(f__scale) {
+ if(f__scale >= d + 2 || f__scale <= -d)
+ goto nogood;
+ }
+ if(f__scale <= 0)
+ --d;
+ if (len == sizeof(real))
+ dd = p->pf;
+ else
+ dd = p->pd;
+ if (dd < 0.) {
+ signspace = sign = 1;
+ dd = -dd;
+ }
+ else {
+ sign = 0;
+ signspace = (int)f__cplus;
+#ifndef VAX
+ if (!dd)
+ dd = 0.; /* avoid -0 */
+#endif
+ }
+ delta = w - (2 /* for the . and the d adjustment above */
+ + 2 /* for the E+ */ + signspace + d + e);
+ if (delta < 0) {
+nogood:
+ while(--w >= 0)
+ PUT('*');
+ return(0);
+ }
+ if (f__scale < 0)
+ d += f__scale;
+ if (d > FMAX) {
+ d1 = d - FMAX;
+ d = FMAX;
+ }
+ else
+ d1 = 0;
+ sprintf(buf,"%#.*E", d, dd);
+#ifndef VAX
+ /* check for NaN, Infinity */
+ if (!isdigit(buf[0])) {
+ switch(buf[0]) {
+ case 'n':
+ case 'N':
+ signspace = 0; /* no sign for NaNs */
+ }
+ delta = w - strlen(buf) - signspace;
+ if (delta < 0)
+ goto nogood;
+ while(--delta >= 0)
+ PUT(' ');
+ if (signspace)
+ PUT(sign ? '-' : '+');
+ for(s = buf; *s; s++)
+ PUT(*s);
+ return 0;
+ }
+#endif
+ se = buf + d + 3;
+ if (f__scale != 1 && dd)
+ sprintf(se, "%+.2d", atoi(se) + 1 - f__scale);
+ s = ++se;
+ if (e < 2) {
+ if (*s != '0')
+ goto nogood;
+ }
+#ifndef VAX
+ /* accommodate 3 significant digits in exponent */
+ if (s[2]) {
+#ifdef Pedantic
+ if (!e0 && !s[3])
+ for(s -= 2, e1 = 2; s[0] = s[1]; s++);
+
+ /* Pedantic gives the behavior that Fortran 77 specifies, */
+ /* i.e., requires that E be specified for exponent fields */
+ /* of more than 3 digits. With Pedantic undefined, we get */
+ /* the behavior that Cray displays -- you get a bigger */
+ /* exponent field if it fits. */
+#else
+ if (!e0) {
+ for(s -= 2, e1 = 2; s[0] = s[1]; s++)
+#ifdef CRAY
+ delta--;
+ if ((delta += 4) < 0)
+ goto nogood
+#endif
+ ;
+ }
+#endif
+ else if (e0 >= 0)
+ goto shift;
+ else
+ e1 = e;
+ }
+ else
+ shift:
+#endif
+ for(s += 2, e1 = 2; *s; ++e1, ++s)
+ if (e1 >= e)
+ goto nogood;
+ while(--delta >= 0)
+ PUT(' ');
+ if (signspace)
+ PUT(sign ? '-' : '+');
+ s = buf;
+ i = f__scale;
+ if (f__scale <= 0) {
+ PUT('.');
+ for(; i < 0; ++i)
+ PUT('0');
+ PUT(*s);
+ s += 2;
+ }
+ else if (f__scale > 1) {
+ PUT(*s);
+ s += 2;
+ while(--i > 0)
+ PUT(*s++);
+ PUT('.');
+ }
+ if (d1) {
+ se -= 2;
+ while(s < se) PUT(*s++);
+ se += 2;
+ do PUT('0'); while(--d1 > 0);
+ }
+ while(s < se)
+ PUT(*s++);
+ if (e < 2)
+ PUT(s[1]);
+ else {
+ while(++e1 <= e)
+ PUT('0');
+ while(*s)
+ PUT(*s++);
+ }
+ return 0;
+ }
+
+#ifdef KR_headers
+wrt_F(p,w,d,len) ufloat *p; ftnlen len;
+#else
+wrt_F(ufloat *p, int w, int d, ftnlen len)
+#endif
+{
+ int d1, sign, n;
+ double x;
+ char *b, buf[MAXINTDIGS+MAXFRACDIGS+4], *s;
+
+ x= (len==sizeof(real)?p->pf:p->pd);
+ if (d < MAXFRACDIGS)
+ d1 = 0;
+ else {
+ d1 = d - MAXFRACDIGS;
+ d = MAXFRACDIGS;
+ }
+ if (x < 0.)
+ { x = -x; sign = 1; }
+ else {
+ sign = 0;
+#ifndef VAX
+ if (!x)
+ x = 0.;
+#endif
+ }
+
+ if (n = f__scale)
+ if (n > 0)
+ do x *= 10.; while(--n > 0);
+ else
+ do x *= 0.1; while(++n < 0);
+
+#ifdef USE_STRLEN
+ sprintf(b = buf, "%#.*f", d, x);
+ n = strlen(b) + d1;
+#else
+ n = sprintf(b = buf, "%#.*f", d, x) + d1;
+#endif
+
+ if (buf[0] == '0' && d)
+ { ++b; --n; }
+ if (sign) {
+ /* check for all zeros */
+ for(s = b;;) {
+ while(*s == '0') s++;
+ switch(*s) {
+ case '.':
+ s++; continue;
+ case 0:
+ sign = 0;
+ }
+ break;
+ }
+ }
+ if (sign || f__cplus)
+ ++n;
+ if (n > w) {
+ while(--w >= 0)
+ PUT('*');
+ return 0;
+ }
+ for(w -= n; --w >= 0; )
+ PUT(' ');
+ if (sign)
+ PUT('-');
+ else if (f__cplus)
+ PUT('+');
+ while(n = *b++)
+ PUT(n);
+ while(--d1 >= 0)
+ PUT('0');
+ return 0;
+ }
diff --git a/lib/libI77/wrtfmt.c b/lib/libI77/wrtfmt.c
new file mode 100644
index 000000000000..ab6bdde1a004
--- /dev/null
+++ b/lib/libI77/wrtfmt.c
@@ -0,0 +1,372 @@
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+#include "local.h"
+extern int f__cursor;
+#ifdef KR_headers
+extern char *f__icvt();
+#else
+extern char *f__icvt(long, int*, int*, int);
+#endif
+int f__hiwater;
+icilist *f__svic;
+char *f__icptr;
+mv_cur(Void) /* shouldn't use fseek because it insists on calling fflush */
+ /* instead we know too much about stdio */
+{
+ if(f__external == 0) {
+ if(f__cursor < 0) {
+ if(f__hiwater < f__recpos)
+ f__hiwater = f__recpos;
+ f__recpos += f__cursor;
+ f__icptr += f__cursor;
+ f__cursor = 0;
+ if(f__recpos < 0)
+ err(f__elist->cierr, 110, "left off");
+ }
+ else if(f__cursor > 0) {
+ if(f__recpos + f__cursor >= f__svic->icirlen)
+ err(f__elist->cierr, 110, "recend");
+ if(f__hiwater <= f__recpos)
+ for(; f__cursor > 0; f__cursor--)
+ (*f__putn)(' ');
+ else if(f__hiwater <= f__recpos + f__cursor) {
+ f__cursor -= f__hiwater - f__recpos;
+ f__icptr += f__hiwater - f__recpos;
+ f__recpos = f__hiwater;
+ for(; f__cursor > 0; f__cursor--)
+ (*f__putn)(' ');
+ }
+ else {
+ f__icptr += f__cursor;
+ f__recpos += f__cursor;
+ }
+ f__cursor = 0;
+ }
+ return(0);
+ }
+ if(f__cursor > 0) {
+ if(f__hiwater <= f__recpos)
+ for(;f__cursor>0;f__cursor--) (*f__putn)(' ');
+ else if(f__hiwater <= f__recpos + f__cursor) {
+#ifndef NON_UNIX_STDIO
+ if(f__cf->_ptr + f__hiwater - f__recpos < buf_end(f__cf))
+ f__cf->_ptr += f__hiwater - f__recpos;
+ else
+#endif
+ (void) fseek(f__cf, (long) (f__hiwater - f__recpos), SEEK_CUR);
+ f__cursor -= f__hiwater - f__recpos;
+ f__recpos = f__hiwater;
+ for(; f__cursor > 0; f__cursor--)
+ (*f__putn)(' ');
+ }
+ else {
+#ifndef NON_UNIX_STDIO
+ if(f__cf->_ptr + f__cursor < buf_end(f__cf))
+ f__cf->_ptr += f__cursor;
+ else
+#endif
+ (void) fseek(f__cf, (long)f__cursor, SEEK_CUR);
+ f__recpos += f__cursor;
+ }
+ }
+ if(f__cursor<0)
+ {
+ if(f__cursor+f__recpos<0) err(f__elist->cierr,110,"left off");
+#ifndef NON_UNIX_STDIO
+ if(f__cf->_ptr + f__cursor >= f__cf->_base)
+ f__cf->_ptr += f__cursor;
+ else
+#endif
+ if(f__curunit && f__curunit->useek)
+ (void) fseek(f__cf,(long)f__cursor,SEEK_CUR);
+ else
+ err(f__elist->cierr,106,"fmt");
+ if(f__hiwater < f__recpos)
+ f__hiwater = f__recpos;
+ f__recpos += f__cursor;
+ f__cursor=0;
+ }
+ return(0);
+}
+
+ static int
+#ifdef KR_headers
+wrt_Z(n,w,minlen,len) Uint *n; int w, minlen; ftnlen len;
+#else
+wrt_Z(Uint *n, int w, int minlen, ftnlen len)
+#endif
+{
+ register char *s, *se;
+ register i, w1;
+ static int one = 1;
+ static char hex[] = "0123456789ABCDEF";
+ s = (char *)n;
+ --len;
+ if (*(char *)&one) {
+ /* little endian */
+ se = s;
+ s += len;
+ i = -1;
+ }
+ else {
+ se = s + len;
+ i = 1;
+ }
+ for(;; s += i)
+ if (s == se || *s)
+ break;
+ w1 = (i*(se-s) << 1) + 1;
+ if (*s & 0xf0)
+ w1++;
+ if (w1 > w)
+ for(i = 0; i < w; i++)
+ (*f__putn)('*');
+ else {
+ if ((minlen -= w1) > 0)
+ w1 += minlen;
+ while(--w >= w1)
+ (*f__putn)(' ');
+ while(--minlen >= 0)
+ (*f__putn)('0');
+ if (!(*s & 0xf0)) {
+ (*f__putn)(hex[*s & 0xf]);
+ if (s == se)
+ return 0;
+ s += i;
+ }
+ for(;; s += i) {
+ (*f__putn)(hex[*s >> 4 & 0xf]);
+ (*f__putn)(hex[*s & 0xf]);
+ if (s == se)
+ break;
+ }
+ }
+ return 0;
+ }
+
+ static int
+#ifdef KR_headers
+wrt_I(n,w,len, base) Uint *n; ftnlen len; register int base;
+#else
+wrt_I(Uint *n, int w, ftnlen len, register int base)
+#endif
+{ int ndigit,sign,spare,i;
+ long x;
+ char *ans;
+ if(len==sizeof(integer)) x=n->il;
+ else if(len == sizeof(char)) x = n->ic;
+#ifdef Allow_TYQUAD
+ else if (len == sizeof(longint)) x = n->ili;
+#endif
+ else x=n->is;
+ ans=f__icvt(x,&ndigit,&sign, base);
+ spare=w-ndigit;
+ if(sign || f__cplus) spare--;
+ if(spare<0)
+ for(i=0;i<w;i++) (*f__putn)('*');
+ else
+ { for(i=0;i<spare;i++) (*f__putn)(' ');
+ if(sign) (*f__putn)('-');
+ else if(f__cplus) (*f__putn)('+');
+ for(i=0;i<ndigit;i++) (*f__putn)(*ans++);
+ }
+ return(0);
+}
+ static int
+#ifdef KR_headers
+wrt_IM(n,w,m,len,base) Uint *n; ftnlen len; int base;
+#else
+wrt_IM(Uint *n, int w, int m, ftnlen len, int base)
+#endif
+{ int ndigit,sign,spare,i,xsign;
+ long x;
+ char *ans;
+ if(sizeof(integer)==len) x=n->il;
+ else if(len == sizeof(char)) x = n->ic;
+ else x=n->is;
+ ans=f__icvt(x,&ndigit,&sign, base);
+ if(sign || f__cplus) xsign=1;
+ else xsign=0;
+ if(ndigit+xsign>w || m+xsign>w)
+ { for(i=0;i<w;i++) (*f__putn)('*');
+ return(0);
+ }
+ if(x==0 && m==0)
+ { for(i=0;i<w;i++) (*f__putn)(' ');
+ return(0);
+ }
+ if(ndigit>=m)
+ spare=w-ndigit-xsign;
+ else
+ spare=w-m-xsign;
+ for(i=0;i<spare;i++) (*f__putn)(' ');
+ if(sign) (*f__putn)('-');
+ else if(f__cplus) (*f__putn)('+');
+ for(i=0;i<m-ndigit;i++) (*f__putn)('0');
+ for(i=0;i<ndigit;i++) (*f__putn)(*ans++);
+ return(0);
+}
+ static int
+#ifdef KR_headers
+wrt_AP(s) char *s;
+#else
+wrt_AP(char *s)
+#endif
+{ char quote;
+ if(f__cursor && mv_cur()) return(mv_cur());
+ quote = *s++;
+ for(;*s;s++)
+ { if(*s!=quote) (*f__putn)(*s);
+ else if(*++s==quote) (*f__putn)(*s);
+ else return(1);
+ }
+ return(1);
+}
+ static int
+#ifdef KR_headers
+wrt_H(a,s) char *s;
+#else
+wrt_H(int a, char *s)
+#endif
+{
+ if(f__cursor && mv_cur()) return(mv_cur());
+ while(a--) (*f__putn)(*s++);
+ return(1);
+}
+#ifdef KR_headers
+wrt_L(n,len, sz) Uint *n; ftnlen sz;
+#else
+wrt_L(Uint *n, int len, ftnlen sz)
+#endif
+{ int i;
+ long x;
+ if(sizeof(long)==sz) x=n->il;
+ else if(sz == sizeof(char)) x = n->ic;
+ else x=n->is;
+ for(i=0;i<len-1;i++)
+ (*f__putn)(' ');
+ if(x) (*f__putn)('T');
+ else (*f__putn)('F');
+ return(0);
+}
+ static int
+#ifdef KR_headers
+wrt_A(p,len) char *p; ftnlen len;
+#else
+wrt_A(char *p, ftnlen len)
+#endif
+{
+ while(len-- > 0) (*f__putn)(*p++);
+ return(0);
+}
+ static int
+#ifdef KR_headers
+wrt_AW(p,w,len) char * p; ftnlen len;
+#else
+wrt_AW(char * p, int w, ftnlen len)
+#endif
+{
+ while(w>len)
+ { w--;
+ (*f__putn)(' ');
+ }
+ while(w-- > 0)
+ (*f__putn)(*p++);
+ return(0);
+}
+
+ static int
+#ifdef KR_headers
+wrt_G(p,w,d,e,len) ufloat *p; ftnlen len;
+#else
+wrt_G(ufloat *p, int w, int d, int e, ftnlen len)
+#endif
+{ double up = 1,x;
+ int i,oldscale=f__scale,n,j;
+ x= len==sizeof(real)?p->pf:p->pd;
+ if(x < 0 ) x = -x;
+ if(x<.1) return(wrt_E(p,w,d,e,len));
+ for(i=0;i<=d;i++,up*=10)
+ { if(x>=up) continue;
+ f__scale=0;
+ if(e==0) n=4;
+ else n=e+2;
+ i=wrt_F(p,w-n,d-i,len);
+ for(j=0;j<n;j++) (*f__putn)(' ');
+ f__scale=oldscale;
+ return(i);
+ }
+ return(wrt_E(p,w,d,e,len));
+}
+#ifdef KR_headers
+w_ed(p,ptr,len) struct syl *p; char *ptr; ftnlen len;
+#else
+w_ed(struct syl *p, char *ptr, ftnlen len)
+#endif
+{
+ if(f__cursor && mv_cur()) return(mv_cur());
+ switch(p->op)
+ {
+ default:
+ fprintf(stderr,"w_ed, unexpected code: %d\n", p->op);
+ sig_die(f__fmtbuf, 1);
+ case I: return(wrt_I((Uint *)ptr,p->p1,len, 10));
+ case IM:
+ return(wrt_IM((Uint *)ptr,p->p1,p->p2,len,10));
+
+ /* O and OM don't work right for character, double, complex, */
+ /* or doublecomplex, and they differ from Fortran 90 in */
+ /* showing a minus sign for negative values. */
+
+ case O: return(wrt_I((Uint *)ptr, p->p1, len, 8));
+ case OM:
+ return(wrt_IM((Uint *)ptr,p->p1,p->p2,len,8));
+ case L: return(wrt_L((Uint *)ptr,p->p1, len));
+ case A: return(wrt_A(ptr,len));
+ case AW:
+ return(wrt_AW(ptr,p->p1,len));
+ case D:
+ case E:
+ case EE:
+ return(wrt_E((ufloat *)ptr,p->p1,p->p2,p->p3,len));
+ case G:
+ case GE:
+ return(wrt_G((ufloat *)ptr,p->p1,p->p2,p->p3,len));
+ case F: return(wrt_F((ufloat *)ptr,p->p1,p->p2,len));
+
+ /* Z and ZM assume 8-bit bytes. */
+
+ case Z: return(wrt_Z((Uint *)ptr,p->p1,0,len));
+ case ZM:
+ return(wrt_Z((Uint *)ptr,p->p1,p->p2,len));
+ }
+}
+#ifdef KR_headers
+w_ned(p) struct syl *p;
+#else
+w_ned(struct syl *p)
+#endif
+{
+ switch(p->op)
+ {
+ default: fprintf(stderr,"w_ned, unexpected code: %d\n", p->op);
+ sig_die(f__fmtbuf, 1);
+ case SLASH:
+ return((*f__donewrec)());
+ case T: f__cursor = p->p1-f__recpos - 1;
+ return(1);
+ case TL: f__cursor -= p->p1;
+ if(f__cursor < -f__recpos) /* TL1000, 1X */
+ f__cursor = -f__recpos;
+ return(1);
+ case TR:
+ case X:
+ f__cursor += p->p1;
+ return(1);
+ case APOS:
+ return(wrt_AP(*(char **)&p->p2));
+ case H:
+ return(wrt_H(p->p1,*(char **)&p->p2));
+ }
+}
diff --git a/lib/libI77/wsfe.c b/lib/libI77/wsfe.c
new file mode 100644
index 000000000000..2d4051285e17
--- /dev/null
+++ b/lib/libI77/wsfe.c
@@ -0,0 +1,80 @@
+/*write sequential formatted external*/
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+#include "local.h"
+extern int f__hiwater;
+
+#ifdef KR_headers
+x_putc(c)
+#else
+x_putc(int c)
+#endif
+{
+ /* this uses \n as an indicator of record-end */
+ if(c == '\n' && f__recpos < f__hiwater) { /* fseek calls fflush, a loss */
+#ifndef NON_UNIX_STDIO
+ if(f__cf->_ptr + f__hiwater - f__recpos < buf_end(f__cf))
+ f__cf->_ptr += f__hiwater - f__recpos;
+ else
+#endif
+ (void) fseek(f__cf, (long)(f__hiwater - f__recpos), SEEK_CUR);
+ }
+ f__recpos++;
+ return putc(c,f__cf);
+}
+x_wSL(Void)
+{
+ (*f__putn)('\n');
+ f__recpos=0;
+ f__cursor = 0;
+ f__hiwater = 0;
+ return(1);
+}
+xw_end(Void)
+{
+ if(f__nonl == 0)
+ (*f__putn)('\n');
+ f__hiwater = f__recpos = f__cursor = 0;
+ return(0);
+}
+xw_rev(Void)
+{
+ if(f__workdone) (*f__putn)('\n');
+ f__hiwater = f__recpos = f__cursor = 0;
+ return(f__workdone=0);
+}
+
+#ifdef KR_headers
+integer s_wsfe(a) cilist *a; /*start*/
+#else
+integer s_wsfe(cilist *a) /*start*/
+#endif
+{ int n;
+ if(!f__init) f_init();
+ if(n=c_sfe(a)) return(n);
+ f__reading=0;
+ f__sequential=1;
+ f__formatted=1;
+ f__external=1;
+ f__elist=a;
+ f__hiwater = f__cursor=f__recpos=0;
+ f__nonl = 0;
+ f__scale=0;
+ f__fmtbuf=a->cifmt;
+ f__curunit = &f__units[a->ciunit];
+ f__cf=f__curunit->ufd;
+ if(pars_f(f__fmtbuf)<0) err(a->cierr,100,"startio");
+ f__putn= x_putc;
+ f__doed= w_ed;
+ f__doned= w_ned;
+ f__doend=xw_end;
+ f__dorevert=xw_rev;
+ f__donewrec=x_wSL;
+ fmt_bg();
+ f__cplus=0;
+ f__cblank=f__curunit->ublnk;
+ if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
+ err(a->cierr,errno,"write start");
+ return(0);
+}
diff --git a/lib/libI77/wsle.c b/lib/libI77/wsle.c
new file mode 100644
index 000000000000..470191be0145
--- /dev/null
+++ b/lib/libI77/wsle.c
@@ -0,0 +1,36 @@
+#include "f2c.h"
+#include "fio.h"
+#include "fmt.h"
+#include "lio.h"
+
+#ifdef KR_headers
+integer s_wsle(a) cilist *a;
+#else
+integer s_wsle(cilist *a)
+#endif
+{
+ int n;
+ if(!f__init) f_init();
+ if(n=c_le(a)) return(n);
+ f__reading=0;
+ f__external=1;
+ f__formatted=1;
+ f__putn = t_putc;
+ f__lioproc = l_write;
+ L_len = LINE;
+ f__donewrec = x_wSL;
+ if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
+ err(a->cierr, errno, "list output start");
+ return(0);
+ }
+
+integer e_wsle(Void)
+{
+ t_putc('\n');
+ f__recpos=0;
+ if (f__cf == stdout)
+ fflush(stdout);
+ else if (f__cf == stderr)
+ fflush(stderr);
+ return(0);
+ }
diff --git a/lib/libI77/wsne.c b/lib/libI77/wsne.c
new file mode 100644
index 000000000000..c3f06234d3c2
--- /dev/null
+++ b/lib/libI77/wsne.c
@@ -0,0 +1,28 @@
+#include "f2c.h"
+#include "fio.h"
+#include "lio.h"
+
+ integer
+#ifdef KR_headers
+s_wsne(a) cilist *a;
+#else
+s_wsne(cilist *a)
+#endif
+{
+ int n;
+
+ if(!f__init)
+ f_init();
+ if(n=c_le(a))
+ return(n);
+ f__reading=0;
+ f__external=1;
+ f__formatted=1;
+ f__putn = t_putc;
+ L_len = LINE;
+ f__donewrec = x_wSL;
+ if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
+ err(a->cierr, errno, "namelist output start");
+ x_wsne(a);
+ return e_wsle();
+ }
diff --git a/lib/libI77/xwsne.c b/lib/libI77/xwsne.c
new file mode 100644
index 000000000000..49e6f0ec4596
--- /dev/null
+++ b/lib/libI77/xwsne.c
@@ -0,0 +1,68 @@
+#include "f2c.h"
+#include "fio.h"
+#include "lio.h"
+#include "fmt.h"
+
+ static VOID
+nl_donewrec(Void)
+{
+ (*f__donewrec)();
+ PUT(' ');
+ }
+
+#ifdef KR_headers
+x_wsne(a) cilist *a;
+#else
+#include "string.h"
+
+ VOID
+x_wsne(cilist *a)
+#endif
+{
+ Namelist *nl;
+ char *s;
+ Vardesc *v, **vd, **vde;
+ ftnint *number, type;
+ ftnlen *dims;
+ ftnlen size;
+ static ftnint one = 1;
+ extern ftnlen f__typesize[];
+
+ nl = (Namelist *)a->cifmt;
+ PUT('&');
+ for(s = nl->name; *s; s++)
+ PUT(*s);
+ PUT(' ');
+ vd = nl->vars;
+ vde = vd + nl->nvars;
+ while(vd < vde) {
+ v = *vd++;
+ s = v->name;
+#ifdef No_Extra_Namelist_Newlines
+ if (f__recpos+strlen(s)+2 >= L_len)
+#endif
+ nl_donewrec();
+ while(*s)
+ PUT(*s++);
+ PUT(' ');
+ PUT('=');
+ number = (dims = v->dims) ? dims + 1 : &one;
+ type = v->type;
+ if (type < 0) {
+ size = -type;
+ type = TYCHAR;
+ }
+ else
+ size = f__typesize[type];
+ l_write(number, v->addr, size, type);
+ if (vd < vde) {
+ if (f__recpos+2 >= L_len)
+ nl_donewrec();
+ PUT(',');
+ PUT(' ');
+ }
+ else if (f__recpos+1 >= L_len)
+ nl_donewrec();
+ }
+ PUT('/');
+ }
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 281f23054cf2..319a528c5a54 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -6,17 +6,23 @@
# from CFLAGS below. To remove these strings from just the system call
# stubs, remove just -DSYSLIBC_SCCS from CFLAGS.
LIB=c
-CFLAGS+=-DLIBC_SCCS -DSYSLIBC_SCCS
+CFLAGS+= -DYP -DLIBC_SCCS -DSYSLIBC_SCCS
AINC= -I${.CURDIR}/${MACHINE}
+INSTALL_PIC_ARCHIVE=
.include "${.CURDIR}/compat-43/Makefile.inc"
.include "${.CURDIR}/db/Makefile.inc"
.include "${.CURDIR}/gen/Makefile.inc"
.include "${.CURDIR}/locale/Makefile.inc"
.include "${.CURDIR}/net/Makefile.inc"
+.include "${.CURDIR}/quad/Makefile.inc"
.include "${.CURDIR}/stdio/Makefile.inc"
.include "${.CURDIR}/stdlib/Makefile.inc"
.include "${.CURDIR}/string/Makefile.inc"
.include "${.CURDIR}/sys/Makefile.inc"
+.include "${.CURDIR}/rpc/Makefile.inc"
+.include "${.CURDIR}/regex/Makefile.inc"
+.include "${.CURDIR}/yp/Makefile.inc"
+.include "${.CURDIR}/${MACHINE}/sys/Makefile.inc"
.include <bsd.lib.mk>
diff --git a/lib/libc/compat-43/creat.2 b/lib/libc/compat-43/creat.2
index d1e1226bf2ef..23670785e397 100644
--- a/lib/libc/compat-43/creat.2
+++ b/lib/libc/compat-43/creat.2
@@ -55,4 +55,5 @@ open(path, O_CREAT | O_TRUNC | O_WRONLY, mode);
.Sh HISTORY
The
.Nm
-function call appeared in Version 6 AT&T UNIX.
+function call appeared in
+.At v6 .
diff --git a/lib/libc/compat-43/sigvec.2 b/lib/libc/compat-43/sigvec.2
index dc4ce5c4c58b..38c9537b09da 100644
--- a/lib/libc/compat-43/sigvec.2
+++ b/lib/libc/compat-43/sigvec.2
@@ -53,7 +53,7 @@ This interface is made obsolete by sigaction(2).
.Ef
.Pp
The system defines a set of signals that may be delivered to a process.
-Signal delivery resembles the occurence of a hardware interrupt:
+Signal delivery resembles the occurrence of a hardware interrupt:
the signal is blocked from further occurrence, the current process
context is saved, and a new one is built. A process may specify a
.Em handler
diff --git a/lib/libc/db/PORT/Makefile b/lib/libc/db/PORT/Makefile
deleted file mode 100644
index 9b0b56b4bf56..000000000000
--- a/lib/libc/db/PORT/Makefile
+++ /dev/null
@@ -1,55 +0,0 @@
-# @(#)Makefile 8.1 (Berkeley) 6/2/93
-
-LIBDB= libdb.a
-OBJ1= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \
- bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \
- bt_stack.o bt_utils.o
-OBJ2= db.o
-OBJ3= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \
- hsearch.o ndbm.o
-OBJ4= mpool.o
-OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \
- rec_seq.o rec_utils.o
-
-# If you don't have memmove(3), add memmove.o to the MISC line.
-#
-# If you don't have mktemp(3) or mkstemp(3), add mktemp.o to the MISC line.
-#
-# If realloc(3) of a NULL pointer on your system isn't the same as
-# a malloc(3) call, add realloc.o to the MISC line.
-#
-# If you don't have snprintf/vsnprintf(3), add snprintf.o to the MISC line.
-# Note, this depends you your having vsprintf(3) -- if you don't, there's
-# no workaround other than changing the source code to not use the snprintf
-# calls. If you have to make that change, check to see if your vsprintf
-# returns a length or a char *; if it's the latter, set VSPRINTF_CHARSTAR
-# in the include/compat.h file.
-MISC=
-
-${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
- ar cq $@ \
- `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort`
- ranlib $@
-
-${OBJ1}:
- ${CC} -c -O -I. -Iinclude -I../btree ../btree/*.c
-${OBJ2}:
- ${CC} -c -O -I. -Iinclude -I../db ../db/*.c
-${OBJ3}:
- ${CC} -c -O -I. -Iinclude -I../hash ../hash/*.c
-${OBJ4}:
- ${CC} -c -O -I. -Iinclude -I../mpool ../mpool/*.c
-${OBJ5}:
- ${CC} -c -O -I. -Iinclude -I../recno ../recno/*.c
-
-memmove.o:
- ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c
-mktemp.o:
- ${CC} -c -O -I. -Iinclude clib/mktemp.c
-realloc.o:
- ${CC} -c -O -I. -Iinclude clib/realloc.c
-snprintf.o:
- ${CC} -c -O -I. -Iinclude clib/snprintf.c
-
-clean:
- rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
diff --git a/lib/libc/db/PORT/README b/lib/libc/db/PORT/README
deleted file mode 100644
index cbe7f1136241..000000000000
--- a/lib/libc/db/PORT/README
+++ /dev/null
@@ -1,60 +0,0 @@
-# @(#)README 8.1 (Berkeley) 6/2/93
-
-This is the directory to use for creating a library of the dbopen(3)
-routines. The Makefile builds the base system. By changing it and
-the compat.h file, you should be able to pick and choose the various
-things your system needs to make libdb run.
-
-The knobs that you may have to turn:
-
-In the Makefile:
- If you don't have mktemp(3) or mkstemp(3) on your system, add
- "mktemp.o" to the MISC list.
-
- If you don't have snprintf(3) on your system, add snprintf.o
- to the MISC list.
-
- If you don't have memmove(3), add memmove.o to the MISC list.
-
-In include/compat.h:
- Before attempting to build this library, you should skim through
- the compat.h file, and adjust it as necessary for your system.
- It's possible to use the #ifndef construct to figure out if a
- #ifdef has been set, but C provides no similar method to figure
- out if a typedef has been done. All of the typedef's are grouped
- at the top of compat.h, your compile errors will tell you which
- ones you need.
-
- Particularly subtle problems can occur if you don't have the
- BYTE_ORDER set right or if the realloc define is wrong.
-
-Some other problems:
- You may see warning messages about illegal pointer combinations.
- It's because systems prototype malloc, calloc and realloc in
- different places. If you want to stop the warnings, find out
- where your system prototypes them, and include it in compat.h,
- or, just prototype them yourself.
-
-To install:
- Programs using the dbopen(3) interface have to include db.h.
- To install the library, you'll need to put db.h (found in the
- directory PORT/include) and the library libdb.a in some place
- accesible to your program.
-
-Hints:
- SunOS 4.1.2 works with ``MISC=realloc.o snprintf.o memmove.o''
- and the include/compat.h realloc ``#if 0'' changed to ``#if 1''.
- SunOS gives a bunch of warning messages on the malloc family
- routines.
-
- Ultrix 4.2A works with ``MISC=realloc.o snprintf.o memmove.o''
- and the include/compat.h realloc ``#if 0'' changed to ``#if 1''
- and BYTE_ORDER changed from BIG_ENDIAN to LITTLE_ENDIAN.
- Ultrix does not give warning messages on the malloc family
- routines.
-
- The recno routines require the mmap(2) call. It wouldn't be
- difficult to port this package to a system without mmap. Change
- rec_open.c to do slightly different initialization and to write
- two new routines for rec_get.c that handle regular files using
- reads and writes.
diff --git a/lib/libc/db/PORT/clib/memmove.c b/lib/libc/db/PORT/clib/memmove.c
deleted file mode 100644
index f90b09c9b73f..000000000000
--- a/lib/libc/db/PORT/clib/memmove.c
+++ /dev/null
@@ -1,139 +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. 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[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-#include <sys/cdefs.h>
-#include <string.h>
-
-/*
- * sizeof(word) MUST BE A POWER OF TWO
- * SO THAT wmask BELOW IS ALL ONES
- */
-typedef int word; /* "word" used for optimal copy speed */
-
-#define wsize sizeof(word)
-#define wmask (wsize - 1)
-
-/*
- * Copy a block of memory, handling overlap.
- * This is the routine that actually implements
- * (the portable versions of) bcopy, memcpy, and memmove.
- */
-#ifdef MEMCOPY
-void *
-memcpy(dst0, src0, length)
-#else
-#ifdef MEMMOVE
-void *
-memmove(dst0, src0, length)
-#else
-void
-bcopy(src0, dst0, length)
-#endif
-#endif
- void *dst0;
- const void *src0;
- register size_t length;
-{
- register char *dst = dst0;
- register const char *src = src0;
- register size_t t;
-
- if (length == 0 || dst == src) /* nothing to do */
- goto done;
-
- /*
- * Macros: loop-t-times; and loop-t-times, t>0
- */
-#define TLOOP(s) if (t) TLOOP1(s)
-#define TLOOP1(s) do { s; } while (--t)
-
- if ((unsigned long)dst < (unsigned long)src) {
- /*
- * Copy forward.
- */
- t = (int)src; /* only need low bits */
- if ((t | (int)dst) & wmask) {
- /*
- * Try to align operands. This cannot be done
- * unless the low bits match.
- */
- if ((t ^ (int)dst) & wmask || length < wsize)
- t = length;
- else
- t = wsize - (t & wmask);
- length -= t;
- TLOOP1(*dst++ = *src++);
- }
- /*
- * Copy whole words, then mop up any trailing bytes.
- */
- t = length / wsize;
- TLOOP(*(word *)dst = *(word *)src; src += wsize; dst += wsize);
- t = length & wmask;
- TLOOP(*dst++ = *src++);
- } else {
- /*
- * Copy backwards. Otherwise essentially the same.
- * Alignment works as before, except that it takes
- * (t&wmask) bytes to align, not wsize-(t&wmask).
- */
- src += length;
- dst += length;
- t = (int)src;
- if ((t | (int)dst) & wmask) {
- if ((t ^ (int)dst) & wmask || length <= wsize)
- t = length;
- else
- t &= wmask;
- length -= t;
- TLOOP1(*--dst = *--src);
- }
- t = length / wsize;
- TLOOP(src -= wsize; dst -= wsize; *(word *)dst = *(word *)src);
- t = length & wmask;
- TLOOP(*--dst = *--src);
- }
-done:
-#if defined(MEMCOPY) || defined(MEMMOVE)
- return (dst0);
-#else
- return;
-#endif
-}
diff --git a/lib/libc/db/PORT/clib/realloc.c b/lib/libc/db/PORT/clib/realloc.c
deleted file mode 100644
index 11e5cd28c5da..000000000000
--- a/lib/libc/db/PORT/clib/realloc.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <sys/types.h>
-
-#include <stdlib.h>
-
-void *
-__fix_realloc(p, n)
- void *p;
- size_t n;
-{
- return (p == 0 ? malloc(n) : realloc(p, n));
-}
diff --git a/lib/libc/db/PORT/clib/snprintf.c b/lib/libc/db/PORT/clib/snprintf.c
deleted file mode 100644
index 2863fa28d62b..000000000000
--- a/lib/libc/db/PORT/clib/snprintf.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <sys/types.h>
-#include <sys/cdefs.h>
-
-#include <compat.h>
-
-#ifdef __STDC__
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-
-int
-#ifdef __STDC__
-snprintf(char *str, size_t n, const char *fmt, ...)
-#else
-snprintf(str, n, fmt, va_alist)
- char *str;
- size_t n;
- const char *fmt;
- va_dcl
-#endif
-{
- va_list ap;
- char *rp;
- int rval;
-#ifdef __STDC__
- va_start(ap, fmt);
-#else
- va_start(ap);
-#endif
-#ifdef VSPRINTF_CHARSTAR
- rp = vsprintf(str, fmt, ap);
- va_end(ap);
- return (strlen(rp));
-#else
- rval = vsprintf(str, fmt, ap);
- va_end(ap);
- return (rval);
-#endif
-}
-
-int
-vsnprintf(str, n, fmt, ap)
- char *str;
- size_t n;
- const char *fmt;
- va_list ap;
-{
-#ifdef VSPRINTF_CHARSTAR
- return (strlen(vsprintf(str, fmt, ap)));
-#else
- return (vsprintf(str, fmt, ap));
-#endif
-}
diff --git a/lib/libc/db/PORT/include/cdefs.h b/lib/libc/db/PORT/include/cdefs.h
deleted file mode 100644
index a04665e30e49..000000000000
--- a/lib/libc/db/PORT/include/cdefs.h
+++ /dev/null
@@ -1,94 +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. 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.
- *
- * @(#)cdefs.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _CDEFS_H_
-#define _CDEFS_H_
-
-#if defined(__cplusplus)
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS };
-#else
-#define __BEGIN_DECLS
-#define __END_DECLS
-#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.
- */
-#if defined(__STDC__) || defined(__cplusplus)
-#define __P(protos) protos /* full-blown ANSI C */
-#define __CONCAT(x,y) x ## y
-#define __STRING(x) #x
-
-#else /* !(__STDC__ || __cplusplus) */
-#define __P(protos) () /* traditional C preprocessor */
-#define __CONCAT(x,y) x/**/y
-#define __STRING(x) "x"
-
-#ifdef __GNUC__
-#define const __const /* GCC: ANSI C with -traditional */
-#define inline __inline
-#define signed __signed
-#define volatile __volatile
-
-#else /* !__GNUC__ */
-#define const /* delete ANSI C keywords */
-#define inline
-#define signed
-#define volatile
-#endif /* !__GNUC__ */
-#endif /* !(__STDC__ || __cplusplus) */
-
-/*
- * GCC has extensions for declaring functions as `pure' (always returns
- * the same value given the same inputs, i.e., has no external state and
- * no side effects) and `dead' (nonreturning). These mainly affect
- * optimization and warnings. Unfortunately, GCC complains if these are
- * used under strict ANSI mode (`gcc -ansi -pedantic'), hence we need to
- * define them only if compiling without this.
- */
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-#define __dead __volatile
-#define __pure __const
-#else
-#define __dead
-#define __pure
-#endif
-
-#endif /* !_CDEFS_H_ */
diff --git a/lib/libc/db/PORT/include/compat.h b/lib/libc/db/PORT/include/compat.h
deleted file mode 100644
index bb3f91466731..000000000000
--- a/lib/libc/db/PORT/include/compat.h
+++ /dev/null
@@ -1,217 +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. 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.
- *
- * @(#)compat.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _COMPAT_H_
-#define _COMPAT_H_
-
-/*
- * If your system doesn't typedef u_long, u_short, or u_char, change
- * the 0 to a 1.
- */
-#if 0
-typedef unsigned long u_long;
-typedef unsigned short u_short;
-typedef unsigned char u_char;
-#endif
-
-/* If your system doesn't typedef size_t, change the 0 to a 1. */
-#if 0
-typedef unsigned int size_t;
-#define SIZE_T_MAX UINT_MAX
-#endif
-
-/*
- * If your system doesn't specify a max size for a SIZE_T, check
- * to make sure this is the right one.
- */
-#ifndef SIZE_T_MAX
-#define SIZE_T_MAX UINT_MAX
-#endif
-
-/*
- * If your system doesn't have the POSIX type for a signal mask,
- * change the 0 to a 1.
- */
-#if 0
-typedef unsigned int sigset_t;
-#endif
-
-/*
- * If your system's vsprintf returns a char *, not an int,
- * change the 0 to a 1.
- */
-#if 0
-#define VSPRINTF_CHARSTAR
-#endif
-
-/*
- * If you don't have POSIX 1003.1 signals, the signal code surrounding the
- * temporary file creation is intended to block all of the possible signals
- * long enough to create the file and unlink it. All of this stuff is
- * intended to use old-style BSD calls to fake POSIX 1003.1 calls.
- */
-#ifdef NO_POSIX_SIGNALS
-#define sigemptyset(set) (*(set) = 0)
-#define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
-#define sigaddset(set,signo) (*(set) |= sigmask(signo), 0)
-#define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0)
-#define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0)
-
-#define SIG_BLOCK 1
-#define SIG_UNBLOCK 2
-#define SIG_SETMASK 3
-
-static int __sigtemp; /* For the use of sigprocmask */
-
-#define sigprocmask(how,set,oset) \
- ((__sigtemp = (((how) == SIG_BLOCK) ? \
- sigblock(0) | *(set) : (((how) == SIG_UNBLOCK) ? \
- sigblock(0) & ~(*(set)) : ((how) == SIG_SETMASK ? \
- *(set) : sigblock(0))))), ((oset) ? \
- (*(oset) = sigsetmask(__sigtemp)) : sigsetmask(__sigtemp)), 0)
-#endif
-
-/*
- * If realloc(3) of a NULL pointer on your system isn't the same as
- * a malloc(3) call, change the 0 to a 1, and add realloc.o to the
- * MISC line in your Makefile.
- */
-#if 0
-#define realloc __fix_realloc
-#endif
-
-/*
- * If your system doesn't have an include file with the appropriate
- * byte order set, make sure you specify the correct one.
- */
-#ifndef BYTE_ORDER
-#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
-#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
-#define BYTE_ORDER BIG_ENDIAN /* Set for your system. */
-#endif
-
-#if defined(SYSV) || defined(SYSTEM5)
-#define index(a, b) strchr(a, b)
-#define rindex(a, b) strrchr(a, b)
-#define bzero(a, b) memset(a, 0, b)
-#define bcmp(a, b, n) memcmp(a, b, n)
-#define bcopy(a, b, n) memmove(b, a, n)
-#endif
-
-#if defined(BSD) || defined(BSD4_3)
-#define strchr(a, b) index(a, b)
-#define strrchr(a, b) rindex(a, b)
-#define memcmp(a, b, n) bcmp(a, b, n)
-#define memmove(a, b, n) bcopy(b, a, n)
-#endif
-
-/*
- * 32-bit machine. The db routines are theoretically independent of
- * the size of u_shorts and u_longs, but I don't know that anyone has
- * ever actually tried it. At a minimum, change the following #define's
- * if you are trying to compile on a different type of system.
- */
-#ifndef USHRT_MAX
-#define USHRT_MAX 0xFFFF
-#define ULONG_MAX 0xFFFFFFFF
-#endif
-
-/* POSIX 1003.1 access mode mask. */
-#ifndef O_ACCMODE
-#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
-#endif
-
-/* POSIX 1003.2 RE limit. */
-#ifndef _POSIX2_RE_DUP_MAX
-#define _POSIX2_RE_DUP_MAX 255
-#endif
-
-/*
- * If you can't provide lock values in the open(2) call. Note, this
- * allows races to happen.
- */
-#ifndef O_EXLOCK
-#define O_EXLOCK 0
-#endif
-
-#ifndef O_SHLOCK
-#define O_SHLOCK 0
-#endif
-
-#ifndef EFTYPE
-#define EFTYPE EINVAL /* POSIX 1003.1 format errno. */
-#endif
-
-#ifndef WCOREDUMP /* 4.4BSD extension */
-#define WCOREDUMP(a) 0
-#endif
-
-#ifndef STDERR_FILENO
-#define STDIN_FILENO 0 /* ANSI C #defines */
-#define STDOUT_FILENO 1
-#define STDERR_FILENO 2
-#endif
-
-#ifndef SEEK_END
-#define SEEK_SET 0 /* POSIX 1003.1 seek values */
-#define SEEK_CUR 1
-#define SEEK_END 2
-#endif
-
-#ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */
-#define S_ISLNK(m) ((m & 0170000) == 0120000)
-#define S_ISSOCK(m) ((m & 0170000) == 0140000)
-#endif
-
-#ifndef _POSIX2_RE_DUP_MAX
-#define _POSIX2_RE_DUP_MAX 255
-#endif
-
-#ifndef NULL /* ANSI C #defines NULL everywhere. */
-#define NULL 0
-#endif
-
-#ifndef MAX
-#define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
-#endif
-#ifndef MIN
-#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
-#endif
-
-#ifndef _BSD_VA_LIST_
-#define _BSD_VA_LIST_ char *
-#endif
-
-#endif /* !_COMPAT_H_ */
diff --git a/lib/libc/db/PORT/include/db.h b/lib/libc/db/PORT/include/db.h
deleted file mode 100644
index 2b7de273a517..000000000000
--- a/lib/libc/db/PORT/include/db.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/*-
- * 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. 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.
- *
- * @(#)db.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _DB_H_
-#define _DB_H_
-
-#include <sys/types.h>
-#include <sys/cdefs.h>
-#include <machine/endian.h>
-
-#define RET_ERROR -1 /* Return values. */
-#define RET_SUCCESS 0
-#define RET_SPECIAL 1
-
-#define MAX_PAGE_NUMBER ULONG_MAX /* >= # of pages in a file */
-typedef u_long pgno_t;
-#define MAX_PAGE_OFFSET USHRT_MAX /* >= # of bytes in a page */
-typedef u_short indx_t;
-#define MAX_REC_NUMBER ULONG_MAX /* >= # of records in a tree */
-typedef u_long 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;
-
-#define __USE_OPEN_FLAGS \
- (O_CREAT|O_EXCL|O_EXLOCK|O_RDONLY|O_RDWR|O_SHLOCK|O_TRUNC)
-
-/* Access method description structure. */
-typedef struct __db {
- DBTYPE type; /* underlying db type */
- int (*close) __P((struct __db *));
- int (*del) __P((const struct __db *, const DBT *, u_int));
- int (*fd) __P((const struct __db *));
- int (*get) __P((const struct __db *, const DBT *, DBT *, u_int));
- int (*put) __P((const struct __db *, DBT *, const DBT *, u_int));
- int (*seq) __P((const struct __db *, DBT *, DBT *, u_int));
- int (*sync) __P((const struct __db *, u_int));
- void *internal; /* access method private */
-} DB;
-
-#define BTREEMAGIC 0x053162
-#define BTREEVERSION 3
-
-/* Structure used to pass parameters to the btree routines. */
-typedef struct {
-#define R_DUP 0x01 /* duplicate keys */
- u_long flags;
- int cachesize; /* bytes to cache */
- int maxkeypage; /* maximum keys per page */
- int minkeypage; /* minimum keys per page */
- int psize; /* page size */
- /* comparison, prefix functions */
- int (*compare) __P((const DBT *, const DBT *));
- int (*prefix) __P((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 {
- int bsize; /* bucket size */
- int ffactor; /* fill factor */
- int nelem; /* number of elements */
- int cachesize; /* bytes to cache */
- /* hash function */
- int (*hash) __P((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 */
- u_long flags;
- int cachesize; /* bytes to cache */
- int psize; /* page size */
- int lorder; /* byte order */
- size_t reclen; /* record length (fixed-length records) */
- u_char bval; /* delimiting byte (variable-length records */
- char *bfname; /* btree file name */
-} RECNOINFO;
-
-/*
- * Little endian <==> big endian long swap macros.
- * BLSWAP swap a memory location
- * BLPSWAP swap a referenced memory location
- * BLSWAP_COPY swap from one location to another
- */
-#define BLSWAP(a) { \
- u_long _tmp = a; \
- ((char *)&a)[0] = ((char *)&_tmp)[3]; \
- ((char *)&a)[1] = ((char *)&_tmp)[2]; \
- ((char *)&a)[2] = ((char *)&_tmp)[1]; \
- ((char *)&a)[3] = ((char *)&_tmp)[0]; \
-}
-#define BLPSWAP(a) { \
- u_long _tmp = *(u_long *)a; \
- ((char *)a)[0] = ((char *)&_tmp)[3]; \
- ((char *)a)[1] = ((char *)&_tmp)[2]; \
- ((char *)a)[2] = ((char *)&_tmp)[1]; \
- ((char *)a)[3] = ((char *)&_tmp)[0]; \
-}
-#define BLSWAP_COPY(a, b) { \
- ((char *)&(b))[0] = ((char *)&(a))[3]; \
- ((char *)&(b))[1] = ((char *)&(a))[2]; \
- ((char *)&(b))[2] = ((char *)&(a))[1]; \
- ((char *)&(b))[3] = ((char *)&(a))[0]; \
-}
-
-/*
- * Little endian <==> big endian short swap macros.
- * BSSWAP swap a memory location
- * BSPSWAP swap a referenced memory location
- * BSSWAP_COPY swap from one location to another
- */
-#define BSSWAP(a) { \
- u_short _tmp = a; \
- ((char *)&a)[0] = ((char *)&_tmp)[1]; \
- ((char *)&a)[1] = ((char *)&_tmp)[0]; \
-}
-#define BSPSWAP(a) { \
- u_short _tmp = *(u_short *)a; \
- ((char *)a)[0] = ((char *)&_tmp)[1]; \
- ((char *)a)[1] = ((char *)&_tmp)[0]; \
-}
-#define BSSWAP_COPY(a, b) { \
- ((char *)&(b))[0] = ((char *)&(a))[1]; \
- ((char *)&(b))[1] = ((char *)&(a))[0]; \
-}
-
-__BEGIN_DECLS
-DB *dbopen __P((const char *, int, int, DBTYPE, const void *));
-
-#ifdef __DBINTERFACE_PRIVATE
-DB *__bt_open __P((const char *, int, int, const BTREEINFO *));
-DB *__hash_open __P((const char *, int, int, const HASHINFO *));
-DB *__rec_open __P((const char *, int, int, const RECNOINFO *));
-void __dbpanic __P((DB *dbp));
-#endif
-__END_DECLS
-#endif /* !_DB_H_ */
diff --git a/lib/libc/db/PORT/include/mpool.h b/lib/libc/db/PORT/include/mpool.h
deleted file mode 100644
index 910e0782aa9d..000000000000
--- a/lib/libc/db/PORT/include/mpool.h
+++ /dev/null
@@ -1,135 +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. 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.
- *
- * @(#)mpool.h 8.1 (Berkeley) 6/2/93
- */
-
-/*
- * The memory pool scheme is a simple one. Each in memory page is referenced
- * by a bucket which is threaded in three ways. All active pages are threaded
- * on a hash chain (hashed by the page number) and an lru chain. Inactive
- * pages are threaded on a free chain. Each reference to a memory pool is
- * handed an MPOOL which is the opaque cookie passed to all of the memory
- * routines.
- */
-#define HASHSIZE 128
-#define HASHKEY(pgno) ((pgno - 1) % HASHSIZE)
-
-/* The BKT structures are the elements of the lists. */
-typedef struct BKT {
- struct BKT *hnext; /* next hash bucket */
- struct BKT *hprev; /* previous hash bucket */
- struct BKT *cnext; /* next free/lru bucket */
- struct BKT *cprev; /* previous free/lru bucket */
- 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 */
- unsigned long flags; /* flags */
-} BKT;
-
-/* The BKTHDR structures are the heads of the lists. */
-typedef struct BKTHDR {
- struct BKT *hnext; /* next hash bucket */
- struct BKT *hprev; /* previous hash bucket */
- struct BKT *cnext; /* next free/lru bucket */
- struct BKT *cprev; /* previous free/lru bucket */
-} BKTHDR;
-
-typedef struct MPOOL {
- BKTHDR free; /* The free list. */
- BKTHDR lru; /* The LRU list. */
- BKTHDR hashtable[HASHSIZE]; /* Hashed list by page number. */
- 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. */
- u_long pagesize; /* File page size. */
- int fd; /* File descriptor. */
- /* Page in conversion routine. */
- void (*pgin) __P((void *, pgno_t, void *));
- /* Page out conversion routine. */
- void (*pgout) __P((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;
-
-#ifdef __MPOOLINTERFACE_PRIVATE
-/* Macros to insert/delete into/from hash chain. */
-#define rmhash(bp) { \
- (bp)->hprev->hnext = (bp)->hnext; \
- (bp)->hnext->hprev = (bp)->hprev; \
-}
-#define inshash(bp, pg) { \
- hp = &mp->hashtable[HASHKEY(pg)]; \
- (bp)->hnext = hp->hnext; \
- (bp)->hprev = (struct BKT *)hp; \
- hp->hnext->hprev = (bp); \
- hp->hnext = (bp); \
-}
-
-/* Macros to insert/delete into/from lru and free chains. */
-#define rmchain(bp) { \
- (bp)->cprev->cnext = (bp)->cnext; \
- (bp)->cnext->cprev = (bp)->cprev; \
-}
-#define inschain(bp, dp) { \
- (bp)->cnext = (dp)->cnext; \
- (bp)->cprev = (struct BKT *)(dp); \
- (dp)->cnext->cprev = (bp); \
- (dp)->cnext = (bp); \
-}
-#endif
-
-__BEGIN_DECLS
-MPOOL *mpool_open __P((DBT *, int, pgno_t, pgno_t));
-void mpool_filter __P((MPOOL *, void (*)(void *, pgno_t, void *),
- void (*)(void *, pgno_t, void *), void *));
-void *mpool_new __P((MPOOL *, pgno_t *));
-void *mpool_get __P((MPOOL *, pgno_t, u_int));
-int mpool_put __P((MPOOL *, void *, u_int));
-int mpool_sync __P((MPOOL *));
-int mpool_close __P((MPOOL *));
-#ifdef STATISTICS
-void mpool_stat __P((MPOOL *));
-#endif
-__END_DECLS
diff --git a/lib/libc/db/PORT/sys b/lib/libc/db/PORT/sys
deleted file mode 120000
index 2996fba35632..000000000000
--- a/lib/libc/db/PORT/sys
+++ /dev/null
@@ -1 +0,0 @@
-include \ No newline at end of file
diff --git a/lib/libc/db/README b/lib/libc/db/README
deleted file mode 120000
index 974cf28e0083..000000000000
--- a/lib/libc/db/README
+++ /dev/null
@@ -1 +0,0 @@
-VERSION \ No newline at end of file
diff --git a/lib/libc/db/VERSION b/lib/libc/db/VERSION
index ceca0b2061bd..972d3517311a 100644
--- a/lib/libc/db/VERSION
+++ b/lib/libc/db/VERSION
@@ -1,6 +1,6 @@
-# @(#)VERSION 8.1 (Berkeley) 6/6/93
+# @(#)VERSION 8.8 (Berkeley) 12/19/93
-This is version 1.6 of the Berkeley DB code.
+This is version 1.73 of the Berkeley DB code.
If your version of the DB code doesn't have a copy of
this version file, it's really old, please update it!
@@ -8,16 +8,42 @@ this version file, it's really old, please update it!
New versions of this software are periodically made
available by anonymous ftp from ftp.cs.berkeley.edu,
in the file ucb/4bsd/db.tar.Z, or from ftp.uu.net.
+If you'd like to get 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.
============================================
-1.5 -> 1.6 06 Jun 1993
+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
+
+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.
@@ -30,16 +56,16 @@ bostic@cs.berkeley.edu.
Change sync routines to take a flag argument, recno
uses this to sync out the underlying btree.
-1.3 -> 1.4 10 May 1993
+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 1 May 1993
+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
+1.1 -> 1.2 15 Apr 1993
No bug fixes, only compatibility hacks.
============================================
@@ -50,9 +76,9 @@ Distribution contents:
VERSION This file.
btree B+tree routines.
db Dbopen(3) interface routine.
- doc USENIX papers.
+ doc USENIX papers, formatted man pages.
hash Extended linear hashing routines.
- man Man pages.
+ man Unformatted man pages.
mpool Memory pool routines.
- recno Fixed/variable length routines.
+ recno Fixed/variable length record routines.
test Test package.
diff --git a/lib/libc/db/btree/bt_close.c b/lib/libc/db/btree/bt_close.c
index 22c739b7b78b..5ff2adff9c8f 100644
--- a/lib/libc/db/btree/bt_close.c
+++ b/lib/libc/db/btree/bt_close.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_close.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)bt_close.c 8.2 (Berkeley) 9/7/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -69,6 +69,12 @@ __bt_close(dbp)
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;
+ }
+
/*
* Delete any already deleted record that we've been saving
* because the cursor pointed to it.
@@ -114,13 +120,20 @@ __bt_sync(dbp, flags)
PAGE *h;
void *p;
+ 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);
}
- t = dbp->internal;
-
if (ISSET(t, B_INMEM | B_RDONLY) || !ISSET(t, B_MODIFIED))
return (RET_SUCCESS);
diff --git a/lib/libc/db/btree/bt_delete.c b/lib/libc/db/btree/bt_delete.c
index 326618b1f609..e512c8423da2 100644
--- a/lib/libc/db/btree/bt_delete.c
+++ b/lib/libc/db/btree/bt_delete.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_delete.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)bt_delete.c 8.2 (Berkeley) 9/7/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -70,10 +70,18 @@ __bt_delete(dbp, key, flags)
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 (ISSET(t, B_RDONLY)) {
errno = EPERM;
return (RET_ERROR);
}
+
switch(flags) {
case 0:
status = bt_bdelete(t, key);
diff --git a/lib/libc/db/btree/bt_get.c b/lib/libc/db/btree/bt_get.c
index 4f473bc4f110..28b2d603dfe5 100644
--- a/lib/libc/db/btree/bt_get.c
+++ b/lib/libc/db/btree/bt_get.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_get.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)bt_get.c 8.2 (Berkeley) 9/7/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -70,11 +70,20 @@ __bt_get(dbp, key, data, flags)
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);
}
- t = dbp->internal;
+
if ((e = __bt_search(t, key, &exact)) == NULL)
return (RET_ERROR);
if (!exact) {
@@ -99,7 +108,14 @@ __bt_get(dbp, key, data, flags)
}
status = __bt_ret(t, e, NULL, data);
- mpool_put(t->bt_mp, e->page, 0);
+ /*
+ * If the user is doing concurrent access, we copied the
+ * key/data, toss the page.
+ */
+ if (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/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c
index f918124042e8..feeffa4c6bf2 100644
--- a/lib/libc/db/btree/bt_open.c
+++ b/lib/libc/db/btree/bt_open.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_open.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)bt_open.c 8.3 (Berkeley) 9/16/93";
#endif /* LIBC_SCCS and not lint */
/*
@@ -83,9 +83,9 @@ static int tmp __P((void));
*
*/
DB *
-__bt_open(fname, flags, mode, openinfo)
+__bt_open(fname, flags, mode, openinfo, dflags)
const char *fname;
- int flags, mode;
+ int flags, mode, dflags;
const BTREEINFO *openinfo;
{
BTMETA m;
@@ -156,19 +156,17 @@ __bt_open(fname, flags, mode, openinfo)
/* Allocate and initialize DB and BTREE structures. */
if ((t = malloc(sizeof(BTREE))) == NULL)
goto err;
- t->bt_fd = -1; /* Don't close unopened fd on error. */
- if ((t->bt_dbp = dbp = malloc(sizeof(DB))) == NULL)
- goto err;
+ memset(t, 0, sizeof(BTREE));
t->bt_bcursor.pgno = P_INVALID;
- t->bt_bcursor.index = 0;
- t->bt_stack = NULL;
- t->bt_sp = t->bt_maxstack = 0;
- t->bt_kbuf = t->bt_dbuf = NULL;
- t->bt_kbufsz = t->bt_dbufsz = 0;
+ 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 = malloc(sizeof(DB))) == NULL)
+ goto err;
t->bt_flags = 0;
if (t->bt_lorder != machine_lorder)
SET(t, B_NEEDSWAP);
@@ -199,8 +197,7 @@ __bt_open(fname, flags, mode, openinfo)
goto einval;
}
- if ((t->bt_fd =
- open(fname, flags & __USE_OPEN_FLAGS, mode)) < 0)
+ if ((t->bt_fd = open(fname, flags, mode)) < 0)
goto err;
} else {
@@ -314,6 +311,14 @@ __bt_open(fname, flags, mode, openinfo)
if (nroot(t) == RET_ERROR)
goto err;
+ /* Global flags. */
+ if (dflags & DB_LOCK)
+ SET(t, B_DB_LOCK);
+ if (dflags & DB_SHMEM)
+ SET(t, B_DB_SHMEM);
+ if (dflags & DB_TXN)
+ SET(t, B_DB_TXN);
+
return (dbp);
einval: errno = EINVAL;
@@ -420,6 +425,13 @@ __bt_fd(dbp)
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 (ISSET(t, B_INMEM)) {
errno = ENOENT;
return (-1);
diff --git a/lib/libc/db/btree/bt_put.c b/lib/libc/db/btree/bt_put.c
index 2e0918b8f0d8..11a211b15a63 100644
--- a/lib/libc/db/btree/bt_put.c
+++ b/lib/libc/db/btree/bt_put.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_put.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)bt_put.c 8.3 (Berkeley) 9/16/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -82,6 +82,12 @@ __bt_put(dbp, key, data, flags)
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 (!ISSET(t, B_SEQINIT))
@@ -260,7 +266,6 @@ bt_fast(t, key, data, exactp)
const DBT *key, *data;
int *exactp;
{
- EPG e;
PAGE *h;
size_t nbytes;
int cmp;
@@ -269,8 +274,8 @@ bt_fast(t, key, data, exactp)
t->bt_order = NOT;
return (NULL);
}
- e.page = h;
- e.index = t->bt_last.index;
+ 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
@@ -281,19 +286,19 @@ bt_fast(t, key, data, exactp)
goto miss;
if (t->bt_order == FORWARD) {
- if (e.page->nextpg != P_INVALID)
+ if (t->bt_cur.page->nextpg != P_INVALID)
goto miss;
- if (e.index != NEXTINDEX(h) - 1)
+ if (t->bt_cur.index != NEXTINDEX(h) - 1)
goto miss;
- if ((cmp = __bt_cmp(t, key, &e)) < 0)
+ if ((cmp = __bt_cmp(t, key, &t->bt_cur)) < 0)
goto miss;
- t->bt_last.index = cmp ? ++e.index : e.index;
+ t->bt_last.index = cmp ? ++t->bt_cur.index : t->bt_cur.index;
} else {
- if (e.page->prevpg != P_INVALID)
+ if (t->bt_cur.page->prevpg != P_INVALID)
goto miss;
- if (e.index != 0)
+ if (t->bt_cur.index != 0)
goto miss;
- if ((cmp = __bt_cmp(t, key, &e)) > 0)
+ if ((cmp = __bt_cmp(t, key, &t->bt_cur)) > 0)
goto miss;
t->bt_last.index = 0;
}
@@ -301,7 +306,7 @@ bt_fast(t, key, data, exactp)
#ifdef STATISTICS
++bt_cache_hit;
#endif
- return (&e);
+ return (&t->bt_cur);
miss:
#ifdef STATISTICS
diff --git a/lib/libc/db/btree/bt_search.c b/lib/libc/db/btree/bt_search.c
index 06aba1126bda..a164173d0173 100644
--- a/lib/libc/db/btree/bt_search.c
+++ b/lib/libc/db/btree/bt_search.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_search.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)bt_search.c 8.4 (Berkeley) 12/10/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -45,6 +45,9 @@ static char sccsid[] = "@(#)bt_search.c 8.1 (Berkeley) 6/4/93";
#include <db.h>
#include "btree.h"
+static int bt_snext __P((BTREE *, PAGE *, const DBT *, int *));
+static int bt_sprev __P((BTREE *, PAGE *, const DBT *, int *));
+
/*
* __BT_SEARCH -- Search a btree for a key.
*
@@ -54,12 +57,9 @@ static char sccsid[] = "@(#)bt_search.c 8.1 (Berkeley) 6/4/93";
* exactp: pointer to exact match flag
*
* Returns:
- * EPG for matching record, if any, or the EPG for the location of the
- * key, if it were inserted into the tree.
- *
- * Warnings:
- * The EPG returned is in static memory, and will be overwritten by the
- * next search of any kind in any tree.
+ * 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(t, key, exactp)
@@ -67,11 +67,10 @@ __bt_search(t, key, exactp)
const DBT *key;
int *exactp;
{
- register indx_t index;
- register int base, cmp, lim;
- register PAGE *h;
+ PAGE *h, *n;
+ indx_t index;
pgno_t pg;
- static EPG e;
+ int base, cmp, lim;
BT_CLR(t);
for (pg = P_ROOT;;) {
@@ -79,13 +78,13 @@ __bt_search(t, key, exactp)
return (NULL);
/* Do a binary search on the current page. */
- e.page = h;
+ t->bt_cur.page = h;
for (base = 0, lim = NEXTINDEX(h); lim; lim >>= 1) {
- e.index = index = base + (lim >> 1);
- if ((cmp = __bt_cmp(t, key, &e)) == 0) {
+ t->bt_cur.index = index = base + (lim >> 1);
+ if ((cmp = __bt_cmp(t, key, &t->bt_cur)) == 0) {
if (h->flags & P_BLEAF) {
*exactp = 1;
- return (&e);
+ return (&t->bt_cur);
}
goto next;
}
@@ -95,11 +94,26 @@ __bt_search(t, key, exactp)
}
}
- /* If it's a leaf page, we're done. */
+ /*
+ * If it's a leaf page, and duplicates aren't allowed, we're
+ * done. If duplicates are allowed, it's possible that there
+ * were duplicate keys on duplicate pages, and they were later
+ * deleted, so we could be on a page with no matches while
+ * there are matches on other pages. If we're at the start or
+ * end of a page, check on both sides.
+ */
if (h->flags & P_BLEAF) {
- e.index = base;
+ t->bt_cur.index = base;
*exactp = 0;
- return (&e);
+ if (!ISSET(t, B_NODUPS)) {
+ if (base == 0 &&
+ bt_sprev(t, h, key, exactp))
+ return (&t->bt_cur);
+ if (base == NEXTINDEX(h) &&
+ bt_snext(t, h, key, exactp))
+ return (&t->bt_cur);
+ }
+ return (&t->bt_cur);
}
/*
@@ -117,3 +131,105 @@ next: if (__bt_push(t, h->pgno, index) == RET_ERROR)
mpool_put(t->bt_mp, h, 0);
}
}
+
+/*
+ * BT_SNEXT -- Check for an exact match after the key.
+ *
+ * Parameters:
+ * t: tree to search
+ * h: current page.
+ * key: key to find
+ * exactp: pointer to exact match flag
+ *
+ * Returns:
+ * If an exact match found.
+ */
+static int
+bt_snext(t, h, key, exactp)
+ BTREE *t;
+ PAGE *h;
+ const DBT *key;
+ int *exactp;
+{
+ EPG e;
+ PAGE *tp;
+ pgno_t pg;
+
+ /* Skip until reach the end of the tree or a key. */
+ for (pg = h->nextpg; pg != P_INVALID;) {
+ if ((tp = mpool_get(t->bt_mp, pg, 0)) == NULL) {
+ mpool_put(t->bt_mp, h, 0);
+ return (NULL);
+ }
+ if (NEXTINDEX(tp) != 0)
+ break;
+ pg = tp->prevpg;
+ mpool_put(t->bt_mp, tp, 0);
+ }
+ /*
+ * The key is either an exact match, or not as good as
+ * the one we already have.
+ */
+ if (pg != P_INVALID) {
+ e.page = tp;
+ e.index = NEXTINDEX(tp) - 1;
+ if (__bt_cmp(t, key, &e) == 0) {
+ mpool_put(t->bt_mp, h, 0);
+ t->bt_cur = e;
+ *exactp = 1;
+ return (1);
+ }
+ }
+ return (0);
+}
+
+/*
+ * BT_SPREV -- Check for an exact match before the key.
+ *
+ * Parameters:
+ * t: tree to search
+ * h: current page.
+ * key: key to find
+ * exactp: pointer to exact match flag
+ *
+ * Returns:
+ * If an exact match found.
+ */
+static int
+bt_sprev(t, h, key, exactp)
+ BTREE *t;
+ PAGE *h;
+ const DBT *key;
+ int *exactp;
+{
+ EPG e;
+ PAGE *tp;
+ pgno_t pg;
+
+ /* Skip until reach the beginning of the tree or a key. */
+ for (pg = h->prevpg; pg != P_INVALID;) {
+ if ((tp = mpool_get(t->bt_mp, pg, 0)) == NULL) {
+ mpool_put(t->bt_mp, h, 0);
+ return (NULL);
+ }
+ if (NEXTINDEX(tp) != 0)
+ break;
+ pg = tp->prevpg;
+ mpool_put(t->bt_mp, tp, 0);
+ }
+ /*
+ * The key is either an exact match, or not as good as
+ * the one we already have.
+ */
+ if (pg != P_INVALID) {
+ e.page = tp;
+ e.index = NEXTINDEX(tp) - 1;
+ if (__bt_cmp(t, key, &e) == 0) {
+ mpool_put(t->bt_mp, h, 0);
+ t->bt_cur = e;
+ *exactp = 1;
+ return (1);
+ }
+ }
+ return (0);
+}
diff --git a/lib/libc/db/btree/bt_seq.c b/lib/libc/db/btree/bt_seq.c
index 03f8f09a2837..182ef7080d5e 100644
--- a/lib/libc/db/btree/bt_seq.c
+++ b/lib/libc/db/btree/bt_seq.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_seq.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)bt_seq.c 8.2 (Berkeley) 9/7/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -86,12 +86,19 @@ __bt_seq(dbp, key, data, flags)
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.
*/
- t = dbp->internal;
switch(flags) {
case R_NEXT:
case R_PREV:
@@ -116,7 +123,15 @@ __bt_seq(dbp, key, data, flags)
/* Update the actual cursor. */
t->bt_bcursor.pgno = e.page->pgno;
t->bt_bcursor.index = e.index;
- mpool_put(t->bt_mp, e.page, 0);
+
+ /*
+ * If the user is doing concurrent access, we copied the
+ * key/data, toss the page.
+ */
+ if (ISSET(t, B_DB_LOCK))
+ mpool_put(t->bt_mp, e.page, 0);
+ else
+ t->bt_pinned = e.page;
SET(t, B_SEQINIT);
}
return (status);
diff --git a/lib/libc/db/btree/bt_utils.c b/lib/libc/db/btree/bt_utils.c
index 452eb87e4253..ad8eb97a2f22 100644
--- a/lib/libc/db/btree/bt_utils.c
+++ b/lib/libc/db/btree/bt_utils.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_utils.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)bt_utils.c 8.2 (Berkeley) 9/7/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -70,11 +70,17 @@ __bt_ret(t, e, key, data)
bl = GETBLEAF(e->page, e->index);
+ /*
+ * We always copy big keys/data to make them contigous. Otherwise,
+ * we leave the page pinned and don't copy unless the user specified
+ * concurrent access.
+ */
if (bl->flags & P_BIGDATA) {
if (__ovfl_get(t, bl->bytes + bl->ksize,
&data->size, &t->bt_dbuf, &t->bt_dbufsz))
return (RET_ERROR);
- } else {
+ data->data = t->bt_dbuf;
+ } else if (ISSET(t, B_DB_LOCK)) {
/* Use +1 in case the first record retrieved is 0 length. */
if (bl->dsize + 1 > t->bt_dbufsz) {
if ((p = realloc(t->bt_dbuf, bl->dsize + 1)) == NULL)
@@ -84,8 +90,11 @@ __bt_ret(t, e, key, data)
}
memmove(t->bt_dbuf, bl->bytes + bl->ksize, bl->dsize);
data->size = bl->dsize;
+ data->data = t->bt_dbuf;
+ } else {
+ data->size = bl->dsize;
+ data->data = bl->bytes + bl->ksize;
}
- data->data = t->bt_dbuf;
if (key == NULL)
return (RET_SUCCESS);
@@ -94,7 +103,8 @@ __bt_ret(t, e, key, data)
if (__ovfl_get(t, bl->bytes,
&key->size, &t->bt_kbuf, &t->bt_kbufsz))
return (RET_ERROR);
- } else {
+ key->data = t->bt_kbuf;
+ } else if (ISSET(t, B_DB_LOCK)) {
if (bl->ksize > t->bt_kbufsz) {
if ((p = realloc(t->bt_kbuf, bl->ksize)) == NULL)
return (RET_ERROR);
@@ -103,8 +113,11 @@ __bt_ret(t, e, key, data)
}
memmove(t->bt_kbuf, bl->bytes, bl->ksize);
key->size = bl->ksize;
+ key->data = t->bt_kbuf;
+ } else {
+ key->size = bl->ksize;
+ key->data = bl->bytes;
}
- key->data = t->bt_kbuf;
return (RET_SUCCESS);
}
diff --git a/lib/libc/db/btree/btree.h b/lib/libc/db/btree/btree.h
index 1e393236b09c..d32e52aa1741 100644
--- a/lib/libc/db/btree/btree.h
+++ b/lib/libc/db/btree/btree.h
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)btree.h 8.1 (Berkeley) 6/4/93
+ * @(#)btree.h 8.4 (Berkeley) 12/18/93
*/
#include <mpool.h>
@@ -59,7 +59,7 @@
* (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 {
+typedef struct _page {
pgno_t pgno; /* this page's page number */
pgno_t prevpg; /* left sibling */
pgno_t nextpg; /* right sibling */
@@ -111,7 +111,7 @@ typedef struct PAGE {
* somewhat special and can cause duplicate internal and leaf page records and
* some minor modifications of the above rule.
*/
-typedef struct BINTERNAL {
+typedef struct _binternal {
size_t ksize; /* key size */
pgno_t pgno; /* page number stored on */
#define P_BIGDATA 0x01 /* overflow data */
@@ -142,7 +142,7 @@ typedef struct BINTERNAL {
* 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 {
+typedef struct _rinternal {
recno_t nrecs; /* number of records */
pgno_t pgno; /* page number stored below */
} RINTERNAL;
@@ -163,7 +163,7 @@ typedef struct RINTERNAL {
}
/* For the btree leaf pages, the item is a key and data pair. */
-typedef struct BLEAF {
+typedef struct _bleaf {
size_t ksize; /* size of key */
size_t dsize; /* size of data */
u_char flags; /* P_BIGDATA, P_BIGKEY */
@@ -196,7 +196,7 @@ typedef struct BLEAF {
}
/* For the recno leaf pages, the item is a data entry. */
-typedef struct RLEAF {
+typedef struct _rleaf {
size_t dsize; /* size of data */
u_char flags; /* P_BIGDATA */
char bytes[1];
@@ -238,12 +238,12 @@ typedef struct RLEAF {
* duplicate keys make it impossible. This scheme does require extra work
* though, to make sure that we don't perform an operation on a deleted key.
*/
-typedef struct EPGNO {
+typedef struct _epgno {
pgno_t pgno; /* the page number */
indx_t index; /* the index on the page */
} EPGNO;
-typedef struct EPG {
+typedef struct _epg {
PAGE *page; /* the (pinned) page */
indx_t index; /* the index on the page */
} EPG;
@@ -253,7 +253,7 @@ typedef struct EPG {
* 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 {
+typedef struct _btmeta {
u_long m_magic; /* magic number */
u_long m_version; /* version */
u_long m_psize; /* page size */
@@ -265,11 +265,14 @@ typedef struct BTMETA {
} BTMETA;
/* The in-memory btree/recno data structure. */
-typedef struct BTREE {
+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 */
+
EPGNO bt_bcursor; /* B: btree cursor */
recno_t bt_rcursor; /* R: recno cursor (1-based) */
@@ -291,7 +294,7 @@ typedef struct BTREE {
indx_t bt_ovflsize; /* cut-off for key/data overflow */
int bt_lorder; /* byte order */
/* sorted order */
- enum { NOT, BACK, FORWARD, } bt_order;
+ enum { NOT, BACK, FORWARD } bt_order;
EPGNO bt_last; /* last insert */
/* B: key comparison function */
@@ -299,7 +302,7 @@ typedef struct BTREE {
/* B: prefix comparison function */
int (*bt_pfx) __P((const DBT *, const DBT *));
/* R: recno input function */
- int (*bt_irec) __P((struct BTREE *, recno_t));
+ int (*bt_irec) __P((struct _btree *, recno_t));
FILE *bt_rfp; /* R: record FILE pointer */
int bt_rfd; /* R: record file descriptor */
@@ -324,17 +327,21 @@ typedef struct BTREE {
#define B_NEEDSWAP 0x00010 /* if byte order requires swapping */
#define B_NODUPS 0x00020 /* no duplicate keys permitted */
#define B_RDONLY 0x00040 /* read-only tree */
+#define R_RECNO 0x00080 /* record oriented tree */
#define B_SEQINIT 0x00100 /* sequential scan initialized */
#define R_CLOSEFP 0x00200 /* opened a file pointer */
#define R_EOF 0x00400 /* end of input file reached. */
#define R_FIXLEN 0x00800 /* fixed length records */
#define R_MEMMAPPED 0x01000 /* memory mapped file. */
-#define R_RECNO 0x00080 /* record oriented tree */
#define R_INMEM 0x02000 /* in-memory file */
#define R_MODIFIED 0x04000 /* modified file */
#define R_RDONLY 0x08000 /* read-only file */
+#define B_DB_LOCK 0x10000 /* DB_LOCK specified. */
+#define B_DB_SHMEM 0x20000 /* DB_SHMEM specified. */
+#define B_DB_TXN 0x40000 /* DB_TXN specified. */
+
u_long bt_flags; /* btree state */
} BTREE;
diff --git a/lib/libc/db/btree/extern.h b/lib/libc/db/btree/extern.h
index 99b6f31b73e8..bcb10535fccc 100644
--- a/lib/libc/db/btree/extern.h
+++ b/lib/libc/db/btree/extern.h
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)extern.h 8.1 (Berkeley) 6/4/93
+ * @(#)extern.h 8.2 (Berkeley) 9/7/93
*/
int __bt_close __P((DB *));
@@ -45,7 +45,6 @@ EPG *__bt_first __P((BTREE *, const DBT *, int *));
int __bt_free __P((BTREE *, PAGE *));
int __bt_get __P((const DB *, const DBT *, DBT *, u_int));
PAGE *__bt_new __P((BTREE *, pgno_t *));
-DB *__bt_open __P((const char *, int, int, const BTREEINFO *));
void __bt_pgin __P((void *, pgno_t, void *));
void __bt_pgout __P((void *, pgno_t, void *));
int __bt_push __P((BTREE *, pgno_t, int));
diff --git a/lib/libc/db/db/db.c b/lib/libc/db/db/db.c
index e31d48cef418..52e8a363036f 100644
--- a/lib/libc/db/db/db.c
+++ b/lib/libc/db/db/db.c
@@ -32,12 +32,13 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)db.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)db.c 8.3 (Berkeley) 9/13/93";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <errno.h>
+#include <fcntl.h>
#include <stddef.h>
#include <stdio.h>
@@ -51,14 +52,24 @@ dbopen(fname, flags, mode, type, openinfo)
DBTYPE type;
const void *openinfo;
{
- switch (type) {
- case DB_BTREE:
- return (__bt_open(fname, flags, mode, openinfo));
- case DB_HASH:
- return (__hash_open(fname, flags, mode, openinfo));
- case DB_RECNO:
- return (__rec_open(fname, flags, mode, openinfo));
- }
+
+#define DB_FLAGS (DB_LOCK | DB_SHMEM | DB_TXN)
+#define USE_OPEN_FLAGS \
+ (O_CREAT | O_EXCL | O_EXLOCK | O_NONBLOCK | O_RDONLY | \
+ O_RDWR | O_SHLOCK | O_TRUNC)
+
+ if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0)
+ switch (type) {
+ case DB_BTREE:
+ return (__bt_open(fname, flags & USE_OPEN_FLAGS,
+ mode, openinfo, flags & DB_FLAGS));
+ case DB_HASH:
+ return (__hash_open(fname, flags & USE_OPEN_FLAGS,
+ mode, openinfo, flags & DB_FLAGS));
+ case DB_RECNO:
+ return (__rec_open(fname, flags & USE_OPEN_FLAGS,
+ mode, openinfo, flags & DB_FLAGS));
+ }
errno = EINVAL;
return (NULL);
}
diff --git a/lib/libc/db/doc/btree.3.ps b/lib/libc/db/doc/btree.3.ps
deleted file mode 100644
index 7ae6af965b44..000000000000
--- a/lib/libc/db/doc/btree.3.ps
+++ /dev/null
@@ -1,364 +0,0 @@
-%!PS-Adobe-3.0
-%%Creator: groff version 1.08
-%%DocumentNeededResources: font Times-Roman
-%%+ font Times-Bold
-%%+ font Times-Italic
-%%DocumentSuppliedResources: procset grops 1.08 0
-%%Pages: 2
-%%PageOrder: Ascend
-%%Orientation: Portrait
-%%EndComments
-%%BeginProlog
-%%BeginResource: procset grops 1.08 0
-/setpacking where{
-pop
-currentpacking
-true setpacking
-}if
-/grops 120 dict dup begin
-/SC 32 def
-/A/show load def
-/B{0 SC 3 -1 roll widthshow}bind def
-/C{0 exch ashow}bind def
-/D{0 exch 0 SC 5 2 roll awidthshow}bind def
-/E{0 rmoveto show}bind def
-/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
-/G{0 rmoveto 0 exch ashow}bind def
-/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/I{0 exch rmoveto show}bind def
-/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
-/K{0 exch rmoveto 0 exch ashow}bind def
-/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/M{rmoveto show}bind def
-/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
-/O{rmoveto 0 exch ashow}bind def
-/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/Q{moveto show}bind def
-/R{moveto 0 SC 3 -1 roll widthshow}bind def
-/S{moveto 0 exch ashow}bind def
-/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/SF{
-findfont exch
-[exch dup 0 exch 0 exch neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/MF{
-findfont
-[5 2 roll
-0 3 1 roll
-neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/level0 0 def
-/RES 0 def
-/PL 0 def
-/LS 0 def
-/PLG{
-gsave newpath clippath pathbbox grestore
-exch pop add exch pop
-}bind def
-/BP{
-/level0 save def
-1 setlinecap
-1 setlinejoin
-72 RES div dup scale
-LS{
-90 rotate
-}{
-0 PL translate
-}ifelse
-1 -1 scale
-}bind def
-/EP{
-level0 restore
-showpage
-}bind def
-/DA{
-newpath arcn stroke
-}bind def
-/SN{
-transform
-.25 sub exch .25 sub exch
-round .25 add exch round .25 add exch
-itransform
-}bind def
-/DL{
-SN
-moveto
-SN
-lineto stroke
-}bind def
-/DC{
-newpath 0 360 arc closepath
-}bind def
-/TM matrix def
-/DE{
-TM currentmatrix pop
-translate scale newpath 0 0 .5 0 360 arc closepath
-TM setmatrix
-}bind def
-/RC/rcurveto load def
-/RL/rlineto load def
-/ST/stroke load def
-/MT/moveto load def
-/CL/closepath load def
-/FL{
-currentgray exch setgray fill setgray
-}bind def
-/BL/fill load def
-/LW/setlinewidth load def
-/RE{
-findfont
-dup maxlength 1 index/FontName known not{1 add}if dict begin
-{
-1 index/FID ne{def}{pop pop}ifelse
-}forall
-/Encoding exch def
-dup/FontName exch def
-currentdict end definefont pop
-}bind def
-/DEFS 0 def
-/EBEGIN{
-moveto
-DEFS begin
-}bind def
-/EEND/end load def
-/CNT 0 def
-/level1 0 def
-/PBEGIN{
-/level1 save def
-translate
-div 3 1 roll div exch scale
-neg exch neg exch translate
-0 setgray
-0 setlinecap
-1 setlinewidth
-0 setlinejoin
-10 setmiterlimit
-[]0 setdash
-/setstrokeadjust where{
-pop
-false setstrokeadjust
-}if
-/setoverprint where{
-pop
-false setoverprint
-}if
-newpath
-/CNT countdictstack def
-userdict begin
-/showpage{}def
-}bind def
-/PEND{
-clear
-countdictstack CNT sub{end}repeat
-level1 restore
-}bind def
-end def
-/setpacking where{
-pop
-setpacking
-}if
-%%EndResource
-%%IncludeResource: font Times-Roman
-%%IncludeResource: font Times-Bold
-%%IncludeResource: font Times-Italic
-grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL
-792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron
-/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space
-/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft
-/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four
-/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C
-/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash
-/bracketright/circumflex/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q
-/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase
-/guillemotleft/guillemotright/bullet/florin/fraction/perthousand/dagger
-/daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
-/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
-/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar
-/section/dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus
-/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu
-/paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guilsinglright
-/onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde
-/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute
-/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
-/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute
-/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve
-/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex
-/udieresis/yacute/thorn/ydieresis]def/Times-Italic@0 ENC0/Times-Italic RE
-/Times-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE
-%%EndProlog
-%%Page: 1 1
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 378.84(BTREE\(3\) BTREE\(3\))72 48 R/F1 9/Times-Bold@0
-SF -.18(NA)72 84 S(ME).18 E F0(btree \255 btree database access method)108 96 Q
-F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF(#include <sys/types.h>)108 124.8 Q
-(#include <db)108 136.8 Q(.h>)-.4 E F1(DESCRIPTION)72 153.6 Q F0 .198
-(The routine)108 165.6 R/F3 10/Times-Italic@0 SF(dbopen)2.698 E F0 .198
-(is the library interf)2.698 F .198(ace to database \214les.)-.1 F .198
-(One of the supported \214le formats is btree \214les.)5.198 F .974
-(The general description of the database access methods is in)108 177.6 R F3
-(dbopen)3.475 E F0 .975(\(3\), this manual page describes only).24 F
-(the btree speci\214c information.)108 189.6 Q(The btree data structure is a s\
-orted, balanced tree structure storing associated k)108 206.4 Q -.15(ey)-.1 G
-(/data pairs.).15 E .504(The btree access method speci\214c data structure pro)
-108 223.2 R .504(vided to)-.15 F F3(dbopen)3.004 E F0 .503
-(is de\214ned in the <db)3.003 F .503(.h> include \214le as)-.4 F(follo)108
-235.2 Q(ws:)-.25 E(typedef struct {)108 252 Q(u_long \215ags;)144 264 Q
-(u_int cachesize;)144 276 Q(inde)144 288 Q(x_t psize;)-.15 E(int lorder;)144
-300 Q(int mink)144 312 Q -.15(ey)-.1 G(page;).15 E
-(int \(*compare\)\(const DBT *k)144 324 Q -.15(ey)-.1 G(1, const DBT *k).15 E
--.15(ey)-.1 G(2\);).15 E(int \(*pre\214x\)\(const DBT *k)144 336 Q -.15(ey)-.1
-G(1, const DBT *k).15 E -.15(ey)-.1 G(2\);).15 E 2.5(}B)108 348 S(TREEINFO;)
-121.97 348 Q(The elements of this structure are as follo)108 364.8 Q(ws:)-.25 E
-14.61(\215ags The)108 381.6 R(\215ag v)2.5 E(alue is speci\214ed by)-.25 E F3
-(or)2.5 E F0('ing an).73 E 2.5(yo)-.15 G 2.5(ft)313.2 381.6 S(he follo)321.81
-381.6 Q(wing v)-.25 E(alues:)-.25 E(R_DUP)144 398.4 Q 1.296(Permit duplicate k)
-180 410.4 R -.15(ey)-.1 G 3.796(si).15 G 3.796(nt)275.578 410.4 S 1.296
-(he tree, i.e. permit insertion if the k)287.154 410.4 R 1.596 -.15(ey t)-.1 H
-3.796(ob).15 G 3.796(ei)466.878 410.4 S 1.296(nserted already)477.894 410.4 R
--.15(ex)180 422.4 S 1.935(ists in the tree.).15 F 1.935(The def)6.935 F 1.935
-(ault beha)-.1 F(vior)-.2 E 4.435(,a)-.4 G 4.435(sd)358.215 422.4 S 1.935
-(escribed in)371.54 422.4 R F3(dbopen)4.435 E F0 1.935(\(3\), is to o).24 F
--.15(ve)-.15 G 1.935(rwrite a).15 F .148(matching k)180 434.4 R .448 -.15(ey w)
--.1 H .148(hen inserting a ne).15 F 2.649(wk)-.25 G .449 -.15(ey o)329.709
-434.4 T 2.649(rt).15 G 2.649(of)355.407 434.4 S .149(ail if the R_NOO)366.286
-434.4 R(VER)-.5 E .149(WRITE \215ag is speci-)-.55 F 5.972(\214ed. The)180
-446.4 R 3.472(R_DUP \215ag is o)5.972 F -.15(ve)-.15 G 3.472
-(rridden by the R_NOO).15 F(VER)-.5 E 3.471(WRITE \215ag, and if the)-.55 F
-(R_NOO)180 458.4 Q(VER)-.5 E .781
-(WRITE \215ag is speci\214ed, attempts to insert duplicate k)-.55 F -.15(ey)-.1
-G 3.282(si).15 G .782(nto the tree will)474.604 458.4 R -.1(fa)180 470.4 S(il.)
-.1 E 1.13(If the database contains duplicate k)180 487.2 R -.15(ey)-.1 G 1.129
-(s, the order of retrie).15 F -.25(va)-.25 G 3.629(lo).25 G 3.629(fk)439.644
-487.2 S -.15(ey)451.503 487.2 S 1.129(/data pairs is unde-).15 F .837
-(\214ned if the)180 499.2 R F3 -.1(ge)3.337 G(t).1 E F0 .837
-(routine is used, ho)3.337 F(we)-.25 E -.15(ve)-.25 G -.4(r,).15 G F3(seq)3.737
-E F0 .838(routine calls with the R_CURSOR \215ag set)3.337 F(will al)180 511.2
-Q -.1(wa)-.1 G(ys return the logical `).1 E(`\214rst')-.74 E 2.5('o)-.74 G 2.5
-(fa)333.85 511.2 S .3 -.15(ny g)344.12 511.2 T(roup of duplicate k).15 E -.15
-(ey)-.1 G(s.).15 E(cachesize)108 528 Q 3.056(As)144 540 S .556
-(uggested maximum size \(in bytes\) of the memory cache.)158.166 540 R .555
-(This v)5.556 F .555(alue is)-.25 F F2(only)3.055 E F0(advisory)3.055 E 3.055
-(,a)-.65 G .555(nd the)514.725 540 R .759
-(access method will allocate more memory rather than f)144 552 R 3.259
-(ail. Since)-.1 F -2.15 -.25(ev e)3.259 H .76(ry search e).25 F .76
-(xamines the root)-.15 F .055
-(page of the tree, caching the most recently used pages substantially impro)144
-564 R -.15(ve)-.15 G 2.554(sa).15 G .054(ccess time.)459.578 564 R .054
-(In addi-)5.054 F .661(tion, ph)144 576 R .662(ysical writes are delayed as lo\
-ng as possible, so a moderate cache can reduce the number)-.05 F .601
-(of I/O operations signi\214cantly)144 588 R 5.601(.O)-.65 G -.15(bv)280.744
-588 S(iously).15 E 3.101(,u)-.65 G .601(sing a cache increases \(b)324.995 588
-R .6(ut only increases\) the lik)-.2 F(eli-)-.1 E .19(hood of corruption or lo\
-st data if the system crashes while a tree is being modi\214ed.)144 600 R(If)
-5.191 E F3(cac)2.691 E(hesize)-.15 E F0(is)2.691 E 2.5(0\()144 612 S
-(no size is speci\214ed\) a def)154.83 612 Q(ault cache is used.)-.1 E 12.95
-(psize P)108 628.8 R .45
-(age size is the size \(in bytes\) of the pages used for nodes in the tree.)
--.15 F .449(The minimum page size is)5.449 F .442
-(512 bytes and the maximum page size is 64K.)144 640.8 R(If)5.442 E F3(psize)
-2.942 E F0 .442(is 0 \(no page size is speci\214ed\) a page size)2.942 F
-(is chosen based on the underlying \214le system I/O block size.)144 652.8 Q
-9.62(lorder The)108 669.6 R 1.597(byte order for inte)4.097 F 1.596
-(gers in the stored database metadata.)-.15 F 1.596
-(The number should represent the)6.596 F .688(order as an inte)144 681.6 R .689
-(ger; for e)-.15 F .689(xample, big endian order w)-.15 F .689
-(ould be the number 4,321.)-.1 F(If)5.689 E F3(lor)3.189 E(der)-.37 E F0 .689
-(is 0 \(no)3.189 F(order is speci\214ed\) the current host order is used.)144
-693.6 Q(1)535 768 Q EP
-%%Page: 2 2
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 378.84(BTREE\(3\) BTREE\(3\))72 48 R(mink)108 84 Q -.15
-(ey)-.1 G(page).15 E 1.423(The minimum number of k)144 96 R -.15(ey)-.1 G 3.923
-(sw).15 G 1.422(hich will be stored on an)282.245 96 R 3.922(ys)-.15 G 1.422
-(ingle page.)400.618 96 R 1.422(This v)6.422 F 1.422(alue is used to)-.25 F
-.257(determine which k)144 108 R -.15(ey)-.1 G 2.757(sw).15 G .257
-(ill be stored on o)242.001 108 R -.15(ve)-.15 G(r\215o).15 E 2.757(wp)-.25 G
-.257(ages, i.e. if a k)348.006 108 R .558 -.15(ey o)-.1 H 2.758(rd).15 G .258
-(ata item is longer than the)435.11 108 R 1.102(pagesize di)144 120 R 1.102
-(vided by the mink)-.25 F -.15(ey)-.1 G 1.102(page v).15 F 1.102
-(alue, it will be stored on o)-.25 F -.15(ve)-.15 G(r\215o).15 E 3.602(wp)-.25
-G 1.102(ages instead of in the)451.164 120 R(page itself.)144 132 Q(If)5 E/F1
-10/Times-Italic@0 SF(mink)2.5 E -.3(ey)-.1 G(pa).3 E -.1(ge)-.1 G F0
-(is 0 \(no minimum number of k)2.6 E -.15(ey)-.1 G 2.5(si).15 G 2.5(ss)392.84
-132 S(peci\214ed\) a v)403.12 132 Q(alue of 2 is used.)-.25 E(compare)108 148.8
-Q .751(Compare is the k)144 160.8 R 1.051 -.15(ey c)-.1 H .751
-(omparison function.).15 F .751(It must return an inte)5.751 F .752
-(ger less than, equal to, or greater)-.15 F .913(than zero if the \214rst k)144
-172.8 R 1.213 -.15(ey a)-.1 H -.18(rg).15 G .913
-(ument is considered to be respecti).18 F -.15(ve)-.25 G .913
-(ly less than, equal to, or greater).15 F .352(than the second k)144 184.8 R
-.652 -.15(ey a)-.1 H -.18(rg).15 G 2.852(ument. The).18 F .353
-(same comparison function must be used on a gi)2.852 F -.15(ve)-.25 G 2.853(nt)
-.15 G .353(ree e)503.127 184.8 R -.15(ve)-.25 G(ry).15 E .817
-(time it is opened.)144 196.8 R(If)5.817 E F1(compar)3.317 E(e)-.37 E F0 .817
-(is NULL \(no comparison function is speci\214ed\), the k)3.317 F -.15(ey)-.1 G
-3.316(sa).15 G .816(re com-)508.364 196.8 R(pared le)144 208.8 Q(xically)-.15 E
-2.5(,w)-.65 G(ith shorter k)214.57 208.8 Q -.15(ey)-.1 G 2.5(sc).15 G
-(onsidered less than longer k)282.92 208.8 Q -.15(ey)-.1 G(s.).15 E 10.17
-(pre\214x Pre\214x)108 225.6 R .291(is the pre\214x comparison function.)2.791
-F .292(If speci\214ed, this routine must return the number of bytes)5.291 F
-.937(of the second k)144 237.6 R 1.237 -.15(ey a)-.1 H -.18(rg).15 G .937
-(ument which are necessary to determine that it is greater than the \214rst k)
-.18 F -.15(ey)-.1 G(ar)144 249.6 Q 3.477(gument. If)-.18 F .977(the k)3.477 F
--.15(ey)-.1 G 3.477(sa).15 G .977(re equal, the k)241.898 249.6 R 1.277 -.15
-(ey l)-.1 H .978(ength should be returned.).15 F .978
-(Note, the usefulness of this)5.978 F .558(routine is v)144 261.6 R .558
-(ery data dependent, b)-.15 F .558
-(ut, in some data sets can produce signi\214cantly reduced tree sizes)-.2 F
-.354(and search times.)144 273.6 R(If)5.354 E F1(pr)2.854 E(e\214x)-.37 E F0
-.354(is NULL \(no pre\214x function is speci\214ed\),)2.854 F/F2 10
-/Times-Bold@0 SF(and)2.854 E F0 .354(no comparison function)2.854 F .193
-(is speci\214ed, a def)144 285.6 R .193(ault le)-.1 F .193
-(xical comparison routine is used.)-.15 F(If)5.192 E F1(pr)2.692 E(e\214x)-.37
-E F0 .192(is NULL and a comparison rou-)2.692 F
-(tine is speci\214ed, no pre\214x comparison is done.)144 297.6 Q .79
-(If the \214le already e)108 314.4 R .79(xists \(and the O_TR)-.15 F .79
-(UNC \215ag is not speci\214ed\), the v)-.4 F .79
-(alues speci\214ed for the parameters)-.25 F
-(\215ags, lorder and psize are ignored in f)108 326.4 Q -.2(avo)-.1 G 2.5(ro).2
-G 2.5(ft)284.4 326.4 S(he v)293.01 326.4 Q(alues used when the tree w)-.25 E
-(as created.)-.1 E -.15(Fo)108 343.2 S(rw).15 E
-(ard sequential scans of a tree are from the least k)-.1 E .3 -.15(ey t)-.1 H
-2.5(ot).15 G(he greatest.)348.55 343.2 Q 1.043(Space freed up by deleting k)108
-360 R -.15(ey)-.1 G 1.043(/data pairs from the tree is ne).15 F -.15(ve)-.25 G
-3.543(rr).15 G 1.043(eclaimed, although it is normally made)378.686 360 R -.2
-(av)108 372 S 1.394(ailable for reuse.)-.05 F 1.394
-(This means that the btree storage structure is gro)6.394 F(w-only)-.25 E 6.395
-(.T)-.65 G 1.395(he only solutions are to)441.09 372 R -.2(avo)108 384 S(id e)
-.2 E(xcessi)-.15 E .3 -.15(ve d)-.25 H
-(eletions, or to create a fresh tree periodically from a scan of an e).15 E
-(xisting one.)-.15 E .344(Searches, insertions, and deletions in a btree will \
-all complete in O lg base N where base is the a)108 400.8 R -.15(ve)-.2 G .343
-(rage \214ll).15 F -.1(fa)108 412.8 S(ctor).1 E 5.798(.O)-.55 G .799
-(ften, inserting ordered data into btrees results in a lo)146.188 412.8 R 3.299
-<778c>-.25 G .799(ll f)377.505 412.8 R(actor)-.1 E 5.799(.T)-.55 G .799
-(his implementation has been)423.443 412.8 R(modi\214ed to mak)108 424.8 Q 2.5
-(eo)-.1 G(rdered insertion the best case, resulting in a much better than norm\
-al page \214ll f)185.4 424.8 Q(actor)-.1 E(.)-.55 E/F3 9/Times-Bold@0 SF
-(SEE ALSO)72 441.6 Q F1(dbopen)108 453.6 Q F0(\(3\),).24 E F1(hash)2.5 E F0
-(\(3\),).28 E F1(mpool)2.5 E F0(\(3\),).51 E F1 -.37(re)2.5 G(cno).37 E F0
-(\(3\)).18 E F1(The Ubiquitous B-tr)108 477.6 Q(ee)-.37 E F0 2.5(,D).18 G
-(ouglas Comer)209.47 477.6 Q 2.5(,A)-.4 G(CM Comput. Surv)276.72 477.6 Q 2.5
-(.1)-.65 G(1, 2 \(June 1979\), 121-138.)360.25 477.6 Q F1(Pr)108 501.6 Q 1.588
-(e\214x B-tr)-.37 F(ees)-.37 E F0 4.088(,B).27 G 1.587(ayer and Unterauer)
-177.636 501.6 R 4.087(,A)-.4 G 1.587(CM T)270.447 501.6 R 1.587
-(ransactions on Database Systems, V)-.35 F 1.587(ol. 2, 1 \(March 1977\),)-1.29
-F(11-26.)108 513.6 Q F1(The Art of Computer Pr)108 537.6 Q -.1(og)-.45 G -.15
-(ra).1 G(mming V).15 E(ol. 3: Sorting and Sear)-1.11 E -.15(ch)-.37 G(ing).15 E
-F0 2.5(,D).22 G(.E. Knuth, 1968, pp 471-480.)382 537.6 Q F3 -.09(BU)72 554.4 S
-(GS).09 E F0(Only big and little endian byte order is supported.)108 566.4 Q(2)
-535 768 Q EP
-%%Trailer
-end
-%%EOF
diff --git a/lib/libc/db/doc/dbopen.3.ps b/lib/libc/db/doc/dbopen.3.ps
deleted file mode 100644
index 872c82e771c9..000000000000
--- a/lib/libc/db/doc/dbopen.3.ps
+++ /dev/null
@@ -1,496 +0,0 @@
-%!PS-Adobe-3.0
-%%Creator: groff version 1.08
-%%DocumentNeededResources: font Times-Roman
-%%+ font Times-Bold
-%%+ font Times-Italic
-%%DocumentSuppliedResources: procset grops 1.08 0
-%%Pages: 4
-%%PageOrder: Ascend
-%%Orientation: Portrait
-%%EndComments
-%%BeginProlog
-%%BeginResource: procset grops 1.08 0
-/setpacking where{
-pop
-currentpacking
-true setpacking
-}if
-/grops 120 dict dup begin
-/SC 32 def
-/A/show load def
-/B{0 SC 3 -1 roll widthshow}bind def
-/C{0 exch ashow}bind def
-/D{0 exch 0 SC 5 2 roll awidthshow}bind def
-/E{0 rmoveto show}bind def
-/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
-/G{0 rmoveto 0 exch ashow}bind def
-/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/I{0 exch rmoveto show}bind def
-/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
-/K{0 exch rmoveto 0 exch ashow}bind def
-/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/M{rmoveto show}bind def
-/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
-/O{rmoveto 0 exch ashow}bind def
-/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/Q{moveto show}bind def
-/R{moveto 0 SC 3 -1 roll widthshow}bind def
-/S{moveto 0 exch ashow}bind def
-/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/SF{
-findfont exch
-[exch dup 0 exch 0 exch neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/MF{
-findfont
-[5 2 roll
-0 3 1 roll
-neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/level0 0 def
-/RES 0 def
-/PL 0 def
-/LS 0 def
-/PLG{
-gsave newpath clippath pathbbox grestore
-exch pop add exch pop
-}bind def
-/BP{
-/level0 save def
-1 setlinecap
-1 setlinejoin
-72 RES div dup scale
-LS{
-90 rotate
-}{
-0 PL translate
-}ifelse
-1 -1 scale
-}bind def
-/EP{
-level0 restore
-showpage
-}bind def
-/DA{
-newpath arcn stroke
-}bind def
-/SN{
-transform
-.25 sub exch .25 sub exch
-round .25 add exch round .25 add exch
-itransform
-}bind def
-/DL{
-SN
-moveto
-SN
-lineto stroke
-}bind def
-/DC{
-newpath 0 360 arc closepath
-}bind def
-/TM matrix def
-/DE{
-TM currentmatrix pop
-translate scale newpath 0 0 .5 0 360 arc closepath
-TM setmatrix
-}bind def
-/RC/rcurveto load def
-/RL/rlineto load def
-/ST/stroke load def
-/MT/moveto load def
-/CL/closepath load def
-/FL{
-currentgray exch setgray fill setgray
-}bind def
-/BL/fill load def
-/LW/setlinewidth load def
-/RE{
-findfont
-dup maxlength 1 index/FontName known not{1 add}if dict begin
-{
-1 index/FID ne{def}{pop pop}ifelse
-}forall
-/Encoding exch def
-dup/FontName exch def
-currentdict end definefont pop
-}bind def
-/DEFS 0 def
-/EBEGIN{
-moveto
-DEFS begin
-}bind def
-/EEND/end load def
-/CNT 0 def
-/level1 0 def
-/PBEGIN{
-/level1 save def
-translate
-div 3 1 roll div exch scale
-neg exch neg exch translate
-0 setgray
-0 setlinecap
-1 setlinewidth
-0 setlinejoin
-10 setmiterlimit
-[]0 setdash
-/setstrokeadjust where{
-pop
-false setstrokeadjust
-}if
-/setoverprint where{
-pop
-false setoverprint
-}if
-newpath
-/CNT countdictstack def
-userdict begin
-/showpage{}def
-}bind def
-/PEND{
-clear
-countdictstack CNT sub{end}repeat
-level1 restore
-}bind def
-end def
-/setpacking where{
-pop
-setpacking
-}if
-%%EndResource
-%%IncludeResource: font Times-Roman
-%%IncludeResource: font Times-Bold
-%%IncludeResource: font Times-Italic
-grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL
-792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron
-/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space
-/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft
-/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four
-/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C
-/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash
-/bracketright/circumflex/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q
-/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase
-/guillemotleft/guillemotright/bullet/florin/fraction/perthousand/dagger
-/daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
-/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
-/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar
-/section/dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus
-/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu
-/paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guilsinglright
-/onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde
-/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute
-/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
-/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute
-/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve
-/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex
-/udieresis/yacute/thorn/ydieresis]def/Times-Italic@0 ENC0/Times-Italic RE
-/Times-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE
-%%EndProlog
-%%Page: 1 1
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1993 DBOPEN\(3\))72 48 R/F1 9
-/Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0
-(dbopen \255 database access methods)108 96 Q F1(SYNOPSIS)72 112.8 Q/F2 10
-/Times-Bold@0 SF(#include <sys/types.h>)108 124.8 Q(#include <limits.h>)108
-136.8 Q(#include <db)108 148.8 Q(.h>)-.4 E(DB *)108 172.8 Q
-(dbopen\(const char *\214le, int \215ags, int mode, DBTYPE type,)108 184.8 Q
-(const v)158 196.8 Q(oid *openinf)-.1 E(o\);)-.25 E F1(DESCRIPTION)72 213.6 Q
-/F3 10/Times-Italic@0 SF(Dbopen)108 225.6 Q F0 .032(is the library interf)2.532
-F .031(ace to database \214les.)-.1 F .031
-(The supported \214le formats are btree, hashed and UNIX \214le)5.031 F 2.82
-(oriented. The)108 237.6 R .32
-(btree format is a representation of a sorted, balanced tree structure.)2.82 F
-.321(The hashed format is an)5.321 F -.15(ex)108 249.6 S .424
-(tensible, dynamic hashing scheme.).15 F .423
-(The \215at-\214le format is a byte stream \214le with \214x)5.423 F .423
-(ed or v)-.15 F .423(ariable length)-.25 F 2.906(records. The)108 261.6 R .407
-(formats and \214le format speci\214c information are described in detail in t\
-heir respecti)2.906 F .707 -.15(ve m)-.25 H(anual).15 E(pages)108 273.6 Q F3
-(btr)2.5 E(ee)-.37 E F0(\(3\),).18 E F3(hash)2.5 E F0(\(3\) and).28 E F3 -.37
-(re)2.5 G(cno).37 E F0(\(3\).).18 E .433(Dbopen opens)108 290.4 R F3(\214le)
-2.933 E F0 .433(for reading and/or writing.)2.933 F .433(Files ne)5.433 F -.15
-(ve)-.25 G 2.933(ri).15 G .433(ntended to be preserv)346.737 290.4 R .433
-(ed on disk may be created)-.15 F(by setting the \214le parameter to NULL.)108
-302.4 Q(The)108 319.2 Q F3<8d61>4.661 E(gs)-.1 E F0(and)4.661 E F3 2.161
-(mode ar)4.661 F(guments)-.37 E F0 2.161(are as speci\214ed to the)4.661 F F3
-(open)4.661 E F0 2.162(\(2\) routine, ho).24 F(we)-.25 E -.15(ve)-.25 G 2.962
--.4(r, o).15 H 2.162(nly the O_CREA).4 F -.74(T,)-1.11 G 2.597
-(O_EXCL, O_EXLOCK, O_RDONL)108 331.2 R 5.177 -1.29(Y, O)-1 H(_RD)1.29 E 2.597
-(WR, O_SHLOCK and O_TR)-.3 F 2.596(UNC \215ags are meaningful.)-.4 F
-(\(Note, opening a database \214le O_WR)108 343.2 Q(ONL)-.4 E 2.5(Yi)-1 G 2.5
-(sn)289.62 343.2 S(ot possible.\))301.01 343.2 Q(The)108 360 Q F3(type)5.337 E
-F0(ar)5.337 E 2.837(gument is of type DBTYPE \(as de\214ned in the <db)-.18 F
-2.838(.h> include \214le\) and may be set to)-.4 F
-(DB_BTREE, DB_HASH or DB_RECNO.)108 372 Q(The)108 388.8 Q F3(openinfo)2.85 E F0
-(ar)2.85 E .349(gument is a pointer to an access method speci\214c structure d\
-escribed in the access method')-.18 F(s)-.55 E .03(manual page.)108 400.8 R(If)
-5.03 E F3(openinfo)2.53 E F0 .031(is NULL, each access method will use def)2.53
-F .031(aults appropriate for the system and the)-.1 F(access method.)108 412.8
-Q F3(Dbopen)108 429.6 Q F0 .416
-(returns a pointer to a DB structure on success and NULL on error)2.917 F 5.416
-(.T)-.55 G .416(he DB structure is de\214ned in)423.21 429.6 R(the <db)108
-441.6 Q(.h> include \214le, and contains at least the follo)-.4 E
-(wing \214elds:)-.25 E(typedef struct {)108 465.6 Q(DBTYPE type;)144 477.6 Q
-(int \(*close\)\(const DB *db\);)144 489.6 Q
-(int \(*del\)\(const DB *db, const DBT *k)144 501.6 Q -.15(ey)-.1 G 2.5(,u)-.5
-G(_int \215ags\);)318.92 501.6 Q(int \(*fd\)\(const DB *db\);)144 513.6 Q
-(int \(*get\)\(const DB *db, DBT *k)144 525.6 Q -.15(ey)-.1 G 2.5(,D)-.5 G
-(BT *data, u_int \215ags\);)297.53 525.6 Q(int \(*put\)\(const DB *db, DBT *k)
-144 537.6 Q -.15(ey)-.1 G 2.5(,c)-.5 G(onst DBT *data,)295.31 537.6 Q
-(u_int \215ags\);)194 549.6 Q(int \(*sync\)\(const DB *db, u_int \215ags\);)144
-561.6 Q(int \(*seq\)\(const DB *db, DBT *k)144 573.6 Q -.15(ey)-.1 G 2.5(,D)-.5
-G(BT *data, u_int \215ags\);)298.64 573.6 Q 2.5(}D)108 585.6 S(B;)122.52 585.6
-Q .101
-(These elements describe a database type and a set of functions performing v)
-108 602.4 R .101(arious actions.)-.25 F .101(These functions)5.101 F(tak)108
-614.4 Q 3.039(eap)-.1 G .539(ointer to a structure as returned by)140.078 614.4
-R F3(dbopen)3.038 E F0 3.038(,a).24 G .538
-(nd sometimes one or more pointers to k)323.196 614.4 R -.15(ey)-.1 G .538
-(/data struc-).15 F(tures and a \215ag v)108 626.4 Q(alue.)-.25 E 16.28
-(type The)108 643.2 R
-(type of the underlying access method \(and \214le format\).)2.5 E 12.95
-(close A)108 660 R .988(pointer to a routine to \215ush an)3.488 F 3.489(yc)
--.15 G .989(ached information to disk, free an)293.968 660 R 3.489(ya)-.15 G
-.989(llocated resources, and)446.662 660 R .112
-(close the underlying \214le\(s\).)144 672 R .111(Since k)5.112 F -.15(ey)-.1 G
-.111(/data pairs may be cached in memory).15 F 2.611(,f)-.65 G .111
-(ailing to sync the \214le)455.666 672 R .494(with a)144 684 R F3(close)2.994 E
-F0(or)2.994 E F3(sync)2.994 E F0 .495
-(function may result in inconsistent or lost information.)2.994 F F3(Close)
-5.495 E F0 .495(routines return)2.995 F(-1 on error \(setting)144 696 Q F3
-(errno)2.5 E F0 2.5(\)a).18 G(nd 0 on success.)254.43 696 Q 21.28(del A)108
-712.8 R(pointer to a routine to remo)2.5 E .3 -.15(ve k)-.15 H -.15(ey).05 G
-(/data pairs from the database.).15 E 209.835(24, May)72 768 R(1)535 768 Q EP
-%%Page: 2 2
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1993 DBOPEN\(3\))72 48 R
-(The parameter)144 84 Q/F1 10/Times-Italic@0 SF<8d61>2.5 E(g)-.1 E F0
-(may be set to the follo)2.5 E(wing v)-.25 E(alue:)-.25 E(R_CURSOR)144 100.8 Q
-.289(Delete the record referenced by the cursor)180 112.8 R 5.288(.T)-.55 G
-.288(he cursor must ha)363.342 112.8 R .588 -.15(ve p)-.2 H(re).15 E .288
-(viously been initial-)-.25 F(ized.)180 124.8 Q F1(Delete)144 141.6 Q F0 .03
-(routines return -1 on error \(setting)2.53 F F1(errno)2.53 E F0 .03
-(\), 0 on success, and 1 if the speci\214ed).18 F F1 -.1(ke)2.53 G(y)-.2 E F0
--.1(wa)2.53 G 2.53(sn).1 G .03(ot in)521.91 141.6 R(the \214le.)144 153.6 Q
-25.17(fd A)108 170.4 R .451
-(pointer to a routine which returns a \214le descriptor representati)2.951 F
-.75 -.15(ve o)-.25 H 2.95(ft).15 G .45(he underlying database.)431.73 170.4 R
-(A)5.45 E .942(\214le descriptor referencing the same \214le will be returned \
-to all processes which call)144 182.4 R F1(dbopen)3.442 E F0(with)3.442 E 1.629
-(the same)144 194.4 R F1(\214le)4.129 E F0 4.129(name. This)4.129 F 1.628
-(\214le descriptor may be safely used as a ar)4.128 F 1.628(gument to the)-.18
-F F1(fcntl)4.128 E F0 1.628(\(2\) and).51 F F1(\215oc)144 206.4 Q(k)-.2 E F0
-.425(\(2\) locking functions.).67 F .425
-(The \214le descriptor is not necessarily associated with an)5.425 F 2.925(yo)
--.15 G 2.925(ft)492.7 206.4 S .425(he under)501.735 206.4 R(-)-.2 E .198
-(lying \214les used by the access method.)144 218.4 R .198
-(No \214le descriptor is a)5.198 F -.25(va)-.2 G .198
-(ilable for in memory databases.).25 F F1(Fd)5.198 E F0
-(routines return -1 on error \(setting)144 230.4 Q F1(errno)2.5 E F0
-(\), and the \214le descriptor on success.).18 E 21.28(get A)108 247.2 R
-(pointer to a routine which is the interf)2.5 E .001(ace for k)-.1 F -.15(ey)
--.1 G .001(ed retrie).15 F -.25(va)-.25 G 2.501(lf).25 G .001
-(rom the database.)399.755 247.2 R .001(The address and)5.001 F .061
-(length of the data associated with the speci\214ed)144 259.2 R F1 -.1(ke)2.561
-G(y)-.2 E F0 .06(are returned in the structure referenced by)2.561 F F1(data)
-2.56 E F0(.).26 E F1(Get)144 271.2 Q F0(routines return -1 on error \(setting)
-2.5 E F1(errno)2.5 E F0(\), 0 on success, and 1 if the).18 E F1 -.1(ke)2.5 G(y)
--.2 E F0 -.1(wa)2.5 G 2.5(sn).1 G(ot in the \214le.)471.66 271.2 Q 20.72(put A)
-108 288 R(pointer to a routine to store k)2.5 E -.15(ey)-.1 G
-(/data pairs in the database.).15 E(The parameter)144 304.8 Q F1<8d61>2.5 E(g)
--.1 E F0(may be set to one of the follo)2.5 E(wing v)-.25 E(alues:)-.25 E
-(R_CURSOR)144 321.6 Q .051(Replace the k)180 333.6 R -.15(ey)-.1 G .051
-(/data pair referenced by the cursor).15 F 5.052(.T)-.55 G .052
-(he cursor must ha)393.98 333.6 R .352 -.15(ve p)-.2 H(re).15 E .052
-(viously been)-.25 F(initialized.)180 345.6 Q(R_IAFTER)144 362.4 Q 1.165
-(Append the data immediately after the data referenced by)180 374.4 R F1 -.1
-(ke)3.664 G(y)-.2 E F0 3.664(,c).32 G 1.164(reating a ne)446.758 374.4 R 3.664
-(wk)-.25 G -.15(ey)511.27 374.4 S(/data).15 E(pair)180 386.4 Q 6.065(.T)-.55 G
-1.065(he record number of the appended k)209.675 386.4 R -.15(ey)-.1 G 1.065
-(/data pair is returned in the).15 F F1 -.1(ke)3.565 G(y)-.2 E F0(structure.)
-3.565 E(\(Applicable only to the DB_RECNO access method.\))180 398.4 Q
-(R_IBEFORE)144 415.2 Q 1.293
-(Insert the data immediately before the data referenced by)180 427.2 R F1 -.1
-(ke)3.793 G(y)-.2 E F0 3.793(,c).32 G 1.293(reating a ne)446.371 427.2 R 3.793
-(wk)-.25 G -.15(ey)511.27 427.2 S(/data).15 E(pair)180 439.2 Q 6.54(.T)-.55 G
-1.54(he record number of the inserted k)210.15 439.2 R -.15(ey)-.1 G 1.541
-(/data pair is returned in the).15 F F1 -.1(ke)4.041 G(y)-.2 E F0(structure.)
-4.041 E(\(Applicable only to the DB_RECNO access method.\))180 451.2 Q(R_NOO)
-144 468 Q(VER)-.5 E(WRITE)-.55 E(Enter the ne)180 480 Q 2.5(wk)-.25 G -.15(ey)
-242.69 480 S(/data pair only if the k).15 E .3 -.15(ey d)-.1 H(oes not pre).15
-E(viously e)-.25 E(xist.)-.15 E(R_SETCURSOR)144 496.8 Q 1.36(Store the k)180
-508.8 R -.15(ey)-.1 G 1.36(/data pair).15 F 3.86(,s)-.4 G 1.359
-(etting or initializing the position of the cursor to reference it.)283.94
-508.8 R(\(Applicable only to the DB_BTREE and DB_RECNO access methods.\))180
-520.8 Q .563(R_SETCURSOR is a)144 537.6 R -.25(va)-.2 G .564
-(ilable only for the DB_BTREE and DB_RECNO access methods because).25 F
-(it implies that the k)144 549.6 Q -.15(ey)-.1 G 2.5(sh).15 G -2.25 -.2(av e)
-241.81 549.6 T(an inherent order which does not change.)2.7 E .416
-(R_IAFTER and R_IBEFORE are a)144 566.4 R -.25(va)-.2 G .416
-(ilable only for the DB_RECNO access method because the).25 F(y)-.15 E 1.221
-(each imply that the access method is able to create ne)144 578.4 R 3.722(wk)
--.25 G -.15(ey)385.644 578.4 S 3.722(s. This).15 F 1.222(is only true if the k)
-3.722 F -.15(ey)-.1 G 3.722(sa).15 G(re)532.23 578.4 Q
-(ordered and independent, record numbers for e)144 590.4 Q(xample.)-.15 E .289
-(The def)144 607.2 R .289(ault beha)-.1 F .289(vior of the)-.2 F F1(put)2.789 E
-F0 .289(routines is to enter the ne)2.789 F 2.789(wk)-.25 G -.15(ey)388.998
-607.2 S .288(/data pair).15 F 2.788(,r)-.4 G .288(eplacing an)444.284 607.2 R
-2.788(yp)-.15 G(re)503.03 607.2 Q(viously)-.25 E -.15(ex)144 619.2 S(isting k)
-.15 E -.15(ey)-.1 G(.)-.5 E F1(Put)144 636 Q F0 .37
-(routines return -1 on error \(setting)2.87 F F1(errno)2.87 E F0 .37
-(\), 0 on success, and 1 if the R_NOO).18 F(VER)-.5 E(WRITE)-.55 E F1<8d61>2.87
-E(g)-.1 E F0 -.1(wa)144 648 S 2.5(ss).1 G(et and the k)165.84 648 Q .3 -.15
-(ey a)-.1 H(lready e).15 E(xists in the \214le.)-.15 E 20.17(seq A)108 664.8 R
-.002(pointer to a routine which is the interf)2.502 F .002
-(ace for sequential retrie)-.1 F -.25(va)-.25 G 2.502(lf).25 G .002
-(rom the database.)416.694 664.8 R .001(The address)5.001 F .219
-(and length of the k)144 676.8 R .519 -.15(ey a)-.1 H .219
-(re returned in the structure referenced by).15 F F1 -.1(ke)2.72 G(y)-.2 E F0
-2.72(,a).32 G .22(nd the address and length of)426.42 676.8 R
-(the data are returned in the structure referenced by)144 688.8 Q F1(data)2.5 E
-F0(.).26 E .937(Sequential k)144 705.6 R -.15(ey)-.1 G .937(/data pair retrie)
-.15 F -.25(va)-.25 G 3.437(lm).25 G .936(ay be)289.748 705.6 R .936(gin at an)
--.15 F 3.436(yt)-.15 G .936(ime, and the position of the `)359.292 705.6 R
-(`cursor')-.74 E 3.436('i)-.74 G 3.436(sn)519.894 705.6 S(ot)532.22 705.6 Q(af)
-144 717.6 Q 1.585(fected by calls to the)-.25 F F1(del)4.085 E F0(,).51 E F1
--.1(ge)4.085 G(t).1 E F0(,).68 E F1(put)4.086 E F0 4.086(,o).68 G(r)308.452
-717.6 Q F1(sync)4.086 E F0 4.086(routines. Modi\214cations)4.086 F 1.586
-(to the database during a)4.086 F 1.404(sequential scan will be re\215ected in\
- the scan, i.e. records inserted behind the cursor will not be)144 729.6 R
-209.835(24, May)72 768 R(2)535 768 Q EP
-%%Page: 3 3
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1993 DBOPEN\(3\))72 48 R
-(returned while records inserted in front of the cursor will be returned.)144
-84 Q(The \215ag v)144 100.8 Q(alue)-.25 E/F1 10/Times-Bold@0 SF(must)2.5 E F0
-(be set to one of the follo)2.5 E(wing v)-.25 E(alues:)-.25 E(R_CURSOR)144
-117.6 Q .523(The data associated with the speci\214ed k)180 129.6 R .824 -.15
-(ey i)-.1 H 3.024(sr).15 G 3.024(eturned. This)367.236 129.6 R(dif)3.024 E .524
-(fers from the)-.25 F/F2 10/Times-Italic@0 SF -.1(ge)3.024 G(t).1 E F0
-(routines)3.024 E 1.143
-(in that it sets or initializes the cursor to the location of the k)180 141.6 R
-1.443 -.15(ey a)-.1 H 3.642(sw).15 G 3.642(ell. \(Note,)464.924 141.6 R 1.142
-(for the)3.642 F 1.275(DB_BTREE access method, the returned k)180 153.6 R 1.575
--.15(ey i)-.1 H 3.775(sn).15 G 1.276(ot necessarily an e)386.425 153.6 R 1.276
-(xact match for the)-.15 F .598(speci\214ed k)180 165.6 R -.15(ey)-.1 G 5.598
-(.T)-.5 G .598(he returned k)246.396 165.6 R .898 -.15(ey i)-.1 H 3.098(st).15
-G .598(he smallest k)325.188 165.6 R .898 -.15(ey g)-.1 H .598
-(reater than or equal to the speci\214ed).15 F -.1(ke)180 177.6 S 1.3 -.65
-(y, p)-.05 H(ermitting partial k).65 E .3 -.15(ey m)-.1 H
-(atches and range searches.\)).15 E(R_FIRST)144 194.4 Q 1.043(The \214rst k)180
-206.4 R -.15(ey)-.1 G 1.044(/data pair of the database is returned, and the cu\
-rsor is set or initialized to).15 F(reference it.)180 218.4 Q(R_LAST)144 235.2
-Q .085(The last k)180 247.2 R -.15(ey)-.1 G .085(/data pair of the database is\
- returned, and the cursor is set or initialized to ref-).15 F(erence it.)180
-259.2 Q(\(Applicable only to the DB_BTREE and DB_RECNO access methods.\))5 E
-(R_NEXT)144 276 Q(Retrie)180 288 Q .604 -.15(ve t)-.25 H .304(he k).15 F -.15
-(ey)-.1 G .304(/data pair immediately after the cursor).15 F 5.304(.I)-.55 G
-2.804(ft)410.622 288 S .305(he cursor is not yet set, this is)419.536 288 R
-(the same as the R_FIRST \215ag.)180 300 Q(R_PREV)144 316.8 Q(Retrie)180 328.8
-Q .755 -.15(ve t)-.25 H .455(he k).15 F -.15(ey)-.1 G .455
-(/data pair immediately before the cursor).15 F 5.455(.I)-.55 G 2.955(ft)419.05
-328.8 S .454(he cursor is not yet set, this)428.115 328.8 R .62
-(is the same as the R_LAST \215ag.)180 340.8 R .621
-(\(Applicable only to the DB_BTREE and DB_RECNO)5.621 F(access methods.\))180
-352.8 Q .911(R_LAST and R_PREV are a)144 369.6 R -.25(va)-.2 G .911
-(ilable only for the DB_BTREE and DB_RECNO access methods).25 F(because the)144
-381.6 Q 2.5(ye)-.15 G(ach imply that the k)202.16 381.6 Q -.15(ey)-.1 G 2.5(sh)
-.15 G -2.25 -.2(av e)302.18 381.6 T(an inherent order which does not change.)
-2.7 E F2(Seq)144 398.4 Q F0 .061(routines return -1 on error \(setting)2.561 F
-F2(errno)2.561 E F0 .061(\), 0 on success and 1 if there are no k).18 F -.15
-(ey)-.1 G .061(/data pairs less).15 F .35
-(than or greater than the speci\214ed or current k)144 410.4 R -.15(ey)-.1 G
-5.349(.I)-.5 G 2.849(ft)346.467 410.4 S .349
-(he DB_RECNO access method is being used,)355.426 410.4 R .025
-(and if the database \214le is a character special \214le and no complete k)144
-422.4 R -.15(ey)-.1 G .025(/data pairs are currently a).15 F -.25(va)-.2 G(il-)
-.25 E(able, the)144 434.4 Q F2(seq)2.5 E F0(routines return 2.)2.5 E 15.17
-(sync A)108 451.2 R .458(pointer to a routine to \215ush an)2.958 F 2.957(yc)
--.15 G .457(ached information to disk.)289.72 451.2 R .457
-(If the database is in memory only)5.457 F(,)-.65 E(the)144 463.2 Q F2(sync)2.5
-E F0(routine has no ef)2.5 E(fect and will al)-.25 E -.1(wa)-.1 G(ys succeed.)
-.1 E(The \215ag v)144 480 Q(alue may be set to the follo)-.25 E(wing v)-.25 E
-(alue:)-.25 E(R_RECNOSYNC)144 496.8 Q .077(If the DB_RECNO access method is be\
-ing used, this \215ag causes the sync routine to apply)180 508.8 R .75(to the \
-btree \214le which underlies the recno \214le, not the recno \214le itself.)180
-520.8 R .75(\(See the)5.75 F F2(bfname)3.25 E F0(\214eld of the)180 532.8 Q F2
--.37(re)2.5 G(cno).37 E F0(\(3\) manual page for more information.\)).18 E F2
-(Sync)144 549.6 Q F0(routines return -1 on error \(setting)2.5 E F2(errno)2.5 E
-F0 2.5(\)a).18 G(nd 0 on success.)336.91 549.6 Q/F3 9/Times-Bold@0 SF(KEY/D)72
-566.4 Q -1.35 -.855(AT A)-.315 H -.666(PA)3.105 G(IRS).666 E F0 .134
-(Access to all \214le types is based on k)108 578.4 R -.15(ey)-.1 G .134
-(/data pairs.).15 F .134(Both k)5.134 F -.15(ey)-.1 G 2.634(sa).15 G .134
-(nd data are represented by the follo)359.078 578.4 R .135(wing data)-.25 F
-(structure:)108 590.4 Q(typedef struct {)108 607.2 Q -.2(vo)144 619.2 S
-(id *data;).2 E(size_t size;)144 631.2 Q 2.5(}D)108 643.2 S(BT)122.52 643.2 Q
-(;)-.55 E(The elements of the DBT structure are de\214ned as follo)108 660 Q
-(ws:)-.25 E 16.84(data A)108 676.8 R(pointer to a byte string.)2.5 E 17.95
-(size The)108 693.6 R(length of the byte string.)2.5 E -2.15 -.25(Ke y)108
-710.4 T .829(and data byte strings may reference strings of essentially unlimi\
-ted length although an)3.579 F 3.328(yt)-.15 G 1.028 -.1(wo o)492.894 710.4 T
-3.328(ft).1 G(hem)522.78 710.4 Q 1.133(must \214t into a)108 722.4 R -.25(va)
--.2 G 1.134(ilable memory at the same time.).25 F 1.134
-(It should be noted that the access methods pro)6.134 F 1.134(vide no)-.15 F
-209.835(24, May)72 768 R(3)535 768 Q EP
-%%Page: 4 4
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 169.84(DBOPEN\(3\) 1993 DBOPEN\(3\))72 48 R
-(guarantees about byte string alignment.)108 84 Q/F1 9/Times-Bold@0 SF(ERR)72
-100.8 Q(ORS)-.27 E F0(The)108 112.8 Q/F2 10/Times-Italic@0 SF(dbopen)3.389 E F0
-.889(routine may f)3.389 F .889(ail and set)-.1 F F2(errno)3.388 E F0 .888
-(for an)3.388 F 3.388(yo)-.15 G 3.388(ft)324.376 112.8 S .888
-(he errors speci\214ed for the library routines)333.874 112.8 R F2(open)3.388 E
-F0(\(2\)).24 E(and)108 124.8 Q F2(malloc)2.5 E F0(\(3\) or the follo).31 E
-(wing:)-.25 E([EFTYPE])108 141.6 Q 2.5<418c>144 153.6 S
-(le is incorrectly formatted.)159.28 153.6 Q([EINV)108 170.4 Q(AL])-1.35 E
-2.812(Ap)144 182.4 S .313(arameter has been speci\214ed \(hash function, pad b\
-yte etc.\) that is incompatible with the current)159.032 182.4 R .406
-(\214le speci\214cation or which is not meaningful for the function \(for e)144
-194.4 R .405(xample, use of the cursor with-)-.15 F .099
-(out prior initialization\) or there is a mismatch between the v)144 206.4 R .1
-(ersion number of \214le and the softw)-.15 F(are.)-.1 E(The)108 223.2 Q F2
-(close)3.469 E F0 .969(routines may f)3.469 F .969(ail and set)-.1 F F2(errno)
-3.469 E F0 .969(for an)3.469 F 3.469(yo)-.15 G 3.469(ft)320.18 223.2 S .969
-(he errors speci\214ed for the library routines)329.759 223.2 R F2(close)3.468
-E F0(\(2\),).18 E F2 -.37(re)108 235.2 S(ad).37 E F0(\(2\),).77 E F2(write)2.5
-E F0(\(2\),).18 E F2(fr)2.5 E(ee)-.37 E F0(\(3\), or).18 E F2(fsync)2.5 E F0
-(\(2\).).31 E(The)108 252 Q F2(del)2.969 E F0(,).51 E F2 -.1(ge)2.969 G(t).1 E
-F0(,).68 E F2(put)2.969 E F0(and)2.969 E F2(seq)2.969 E F0 .469(routines may f)
-2.969 F .469(ail and set)-.1 F F2(errno)2.97 E F0 .47(for an)2.97 F 2.97(yo)
--.15 G 2.97(ft)377.59 252 S .47(he errors speci\214ed for the library rou-)
-386.67 252 R(tines)108 264 Q F2 -.37(re)2.5 G(ad).37 E F0(\(2\),).77 E F2
-(write)2.5 E F0(\(2\),).18 E F2(fr)2.5 E(ee)-.37 E F0(\(3\) or).18 E F2(malloc)
-2.5 E F0(\(3\).).31 E(The)108 280.8 Q F2(fd)2.5 E F0(routines will f)2.5 E
-(ail and set)-.1 E F2(errno)2.5 E F0(to ENOENT for in memory databases.)2.5 E
-(The)108 297.6 Q F2(sync)2.5 E F0(routines may f)2.5 E(ail and set)-.1 E F2
-(errno)2.5 E F0(for an)2.5 E 2.5(yo)-.15 G 2.5(ft)307.71 297.6 S
-(he errors speci\214ed for the library routine)316.32 297.6 Q F2(fsync)2.5 E F0
-(\(2\).).31 E F1(SEE ALSO)72 314.4 Q F2(btr)108 326.4 Q(ee)-.37 E F0(\(3\),).18
-E F2(hash)2.5 E F0(\(3\),).28 E F2(mpool)2.5 E F0(\(3\),).51 E F2 -.37(re)2.5 G
-(cno).37 E F0(\(3\)).18 E F1 -.09(BU)72 343.2 S(GS).09 E F0 .399
-(The typedef DBT is a mnemonic for `)108 355.2 R .399(`data base thang')-.74 F
-.399(', and w)-.74 F .399(as used because noone could think of a rea-)-.1 F
-(sonable name that w)108 367.2 Q(asn')-.1 E 2.5(ta)-.18 G(lready used.)216.03
-367.2 Q(The \214le descriptor interf)108 384 Q
-(ace is a kluge and will be deleted in a future v)-.1 E(ersion of the interf)
--.15 E(ace.)-.1 E(None of the access methods pro)108 400.8 Q(vide an)-.15 E 2.5
-(yf)-.15 G(orm of concurrent access, locking, or transactions.)275.16 400.8 Q
-209.835(24, May)72 768 R(4)535 768 Q EP
-%%Trailer
-end
-%%EOF
diff --git a/lib/libc/db/doc/hash.3.ps b/lib/libc/db/doc/hash.3.ps
deleted file mode 100644
index 8551b86d8ff2..000000000000
--- a/lib/libc/db/doc/hash.3.ps
+++ /dev/null
@@ -1,289 +0,0 @@
-%!PS-Adobe-3.0
-%%Creator: groff version 1.08
-%%DocumentNeededResources: font Times-Roman
-%%+ font Times-Bold
-%%+ font Times-Italic
-%%DocumentSuppliedResources: procset grops 1.08 0
-%%Pages: 2
-%%PageOrder: Ascend
-%%Orientation: Portrait
-%%EndComments
-%%BeginProlog
-%%BeginResource: procset grops 1.08 0
-/setpacking where{
-pop
-currentpacking
-true setpacking
-}if
-/grops 120 dict dup begin
-/SC 32 def
-/A/show load def
-/B{0 SC 3 -1 roll widthshow}bind def
-/C{0 exch ashow}bind def
-/D{0 exch 0 SC 5 2 roll awidthshow}bind def
-/E{0 rmoveto show}bind def
-/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
-/G{0 rmoveto 0 exch ashow}bind def
-/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/I{0 exch rmoveto show}bind def
-/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
-/K{0 exch rmoveto 0 exch ashow}bind def
-/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/M{rmoveto show}bind def
-/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
-/O{rmoveto 0 exch ashow}bind def
-/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/Q{moveto show}bind def
-/R{moveto 0 SC 3 -1 roll widthshow}bind def
-/S{moveto 0 exch ashow}bind def
-/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/SF{
-findfont exch
-[exch dup 0 exch 0 exch neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/MF{
-findfont
-[5 2 roll
-0 3 1 roll
-neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/level0 0 def
-/RES 0 def
-/PL 0 def
-/LS 0 def
-/PLG{
-gsave newpath clippath pathbbox grestore
-exch pop add exch pop
-}bind def
-/BP{
-/level0 save def
-1 setlinecap
-1 setlinejoin
-72 RES div dup scale
-LS{
-90 rotate
-}{
-0 PL translate
-}ifelse
-1 -1 scale
-}bind def
-/EP{
-level0 restore
-showpage
-}bind def
-/DA{
-newpath arcn stroke
-}bind def
-/SN{
-transform
-.25 sub exch .25 sub exch
-round .25 add exch round .25 add exch
-itransform
-}bind def
-/DL{
-SN
-moveto
-SN
-lineto stroke
-}bind def
-/DC{
-newpath 0 360 arc closepath
-}bind def
-/TM matrix def
-/DE{
-TM currentmatrix pop
-translate scale newpath 0 0 .5 0 360 arc closepath
-TM setmatrix
-}bind def
-/RC/rcurveto load def
-/RL/rlineto load def
-/ST/stroke load def
-/MT/moveto load def
-/CL/closepath load def
-/FL{
-currentgray exch setgray fill setgray
-}bind def
-/BL/fill load def
-/LW/setlinewidth load def
-/RE{
-findfont
-dup maxlength 1 index/FontName known not{1 add}if dict begin
-{
-1 index/FID ne{def}{pop pop}ifelse
-}forall
-/Encoding exch def
-dup/FontName exch def
-currentdict end definefont pop
-}bind def
-/DEFS 0 def
-/EBEGIN{
-moveto
-DEFS begin
-}bind def
-/EEND/end load def
-/CNT 0 def
-/level1 0 def
-/PBEGIN{
-/level1 save def
-translate
-div 3 1 roll div exch scale
-neg exch neg exch translate
-0 setgray
-0 setlinecap
-1 setlinewidth
-0 setlinejoin
-10 setmiterlimit
-[]0 setdash
-/setstrokeadjust where{
-pop
-false setstrokeadjust
-}if
-/setoverprint where{
-pop
-false setoverprint
-}if
-newpath
-/CNT countdictstack def
-userdict begin
-/showpage{}def
-}bind def
-/PEND{
-clear
-countdictstack CNT sub{end}repeat
-level1 restore
-}bind def
-end def
-/setpacking where{
-pop
-setpacking
-}if
-%%EndResource
-%%IncludeResource: font Times-Roman
-%%IncludeResource: font Times-Bold
-%%IncludeResource: font Times-Italic
-grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL
-792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron
-/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space
-/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft
-/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four
-/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C
-/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash
-/bracketright/circumflex/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q
-/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase
-/guillemotleft/guillemotright/bullet/florin/fraction/perthousand/dagger
-/daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
-/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
-/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar
-/section/dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus
-/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu
-/paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guilsinglright
-/onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde
-/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute
-/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls
-/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute
-/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve
-/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex
-/udieresis/yacute/thorn/ydieresis]def/Times-Italic@0 ENC0/Times-Italic RE
-/Times-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE
-%%EndProlog
-%%Page: 1 1
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 182.62(HASH\(3\) 1993 HASH\(3\))72 48 R/F1 9
-/Times-Bold@0 SF -.18(NA)72 84 S(ME).18 E F0
-(hash \255 hash database access method)108 96 Q F1(SYNOPSIS)72 112.8 Q/F2 10
-/Times-Bold@0 SF(#include <sys/types.h>)108 124.8 Q(#include <db)108 136.8 Q
-(.h>)-.4 E F1(DESCRIPTION)72 153.6 Q F0 .29(The routine)108 165.6 R/F3 10
-/Times-Italic@0 SF(dbopen)2.79 E F0 .29(is the library interf)2.79 F .29
-(ace to database \214les.)-.1 F .29
-(One of the supported \214le formats is hash \214les.)5.29 F .974
-(The general description of the database access methods is in)108 177.6 R F3
-(dbopen)3.475 E F0 .975(\(3\), this manual page describes only).24 F
-(the hash speci\214c information.)108 189.6 Q(The hash data structure is an e)
-108 206.4 Q(xtensible, dynamic hashing scheme.)-.15 E .83
-(The access method speci\214c data structure pro)108 223.2 R .83(vided to)-.15
-F F3(dbopen)3.33 E F0 .83(is de\214ned in the <db)3.33 F .83
-(.h> include \214le as fol-)-.4 F(lo)108 235.2 Q(ws:)-.25 E(typedef struct {)
-108 259.2 Q(int bsize;)144 271.2 Q(int cachesize;)144 283.2 Q(int f)144 295.2 Q
--.1(fa)-.25 G(ctor;).1 E(u_long \(*hash\)\(const v)144 307.2 Q
-(oid *, size_t\);)-.2 E(int lorder;)144 319.2 Q(int nelem;)144 331.2 Q 2.5(}H)
-108 343.2 S(ASHINFO;)122.52 343.2 Q
-(The elements of this structure are as follo)108 360 Q(ws:)-.25 E(bsize)108
-376.8 Q F3(Bsize)144 376.8 Q F0 1.393(de\214nes the hash table b)3.893 F(uck)
--.2 E 1.393(et size, and is, by def)-.1 F 1.394(ault, 256 bytes.)-.1 F 1.394
-(It may be preferable to)6.394 F
-(increase the page size for disk-resident tables and tables with lar)144 388.8
-Q(ge data items.)-.18 E(cachesize)108 405.6 Q 3.16(As)144 417.6 S .66
-(uggested maximum size, in bytes, of the memory cache.)158.27 417.6 R .659
-(This v)5.659 F .659(alue is)-.25 F F2(only)3.159 E F0(advisory)3.159 E 3.159
-(,a)-.65 G .659(nd the)514.621 417.6 R
-(access method will allocate more memory rather than f)144 429.6 Q(ail.)-.1 E
--2.1 -.25(ff a)108 446.4 T(ctor).25 E F3(Ffactor)9.7 E F0 .482
-(indicates a desired density within the hash table.)2.981 F .482
-(It is an approximation of the number of)5.482 F -.1(ke)144 458.4 S .429
-(ys allo)-.05 F .429(wed to accumulate in an)-.25 F 2.929(yo)-.15 G .429(ne b)
-291.454 458.4 R(uck)-.2 E .429(et, determining when the hash table gro)-.1 F
-.428(ws or shrinks.)-.25 F(The def)144 470.4 Q(ault v)-.1 E(alue is 8.)-.25 E
-(hash)108 487.2 Q F3(Hash)144 487.2 Q F0 .1(is a user de\214ned hash function.)
-2.6 F .1(Since no hash function performs equally well on all possible)5.1 F
-.924(data, the user may \214nd that the b)144 499.2 R .923
-(uilt-in hash function does poorly on a particular data set.)-.2 F(User)5.923 E
-1.408(speci\214ed hash functions must tak)144 511.2 R 3.909(et)-.1 G 1.609 -.1
-(wo a)293.431 511.2 T -.18(rg).1 G 1.409
-(uments \(a pointer to a byte string and a length\) and).18 F
-(return an u_long to be used as the hash v)144 523.2 Q(alue.)-.25 E 9.62
-(lorder The)108 540 R 1.597(byte order for inte)4.097 F 1.596
-(gers in the stored database metadata.)-.15 F 1.596
-(The number should represent the)6.596 F .688(order as an inte)144 552 R .689
-(ger; for e)-.15 F .689(xample, big endian order w)-.15 F .689
-(ould be the number 4,321.)-.1 F(If)5.689 E F3(lor)3.189 E(der)-.37 E F0 .689
-(is 0 \(no)3.189 F .822(order is speci\214ed\) the current host order is used.)
-144 564 R .822(If the)5.822 F .822(\214le already e)5.822 F .821
-(xists, the speci\214ed v)-.15 F .821(alue is)-.25 F(ignored and the v)144 576
-Q(alue speci\214ed when the tree w)-.25 E(as created is used.)-.1 E(nelem)108
-592.8 Q F3(Nelem)144 592.8 Q F0 .701
-(is an estimate of the \214nal size of the hash table.)3.2 F .701
-(If not set or set too lo)5.701 F 2.001 -.65(w, h)-.25 H .701(ash tables will)
-.65 F -.15(ex)144 604.8 S .448(pand gracefully as k).15 F -.15(ey)-.1 G 2.948
-(sa).15 G .448(re entered, although a slight performance de)255.912 604.8 R
-.447(gradation may be noticed.)-.15 F(The def)144 616.8 Q(ault v)-.1 E
-(alue is 1.)-.25 E .79(If the \214le already e)108 633.6 R .79
-(xists \(and the O_TR)-.15 F .79(UNC \215ag is not speci\214ed\), the v)-.4 F
-.79(alues speci\214ed for the parameters)-.25 F(bsize, f)108 645.6 Q -.1(fa)
--.25 G(ctor).1 E 2.5(,l)-.4 G(order and nelem are ignored and the v)167.23
-645.6 Q(alues speci\214ed when the tree w)-.25 E(as created are used.)-.1 E
-1.232(If a hash function is speci\214ed,)108 662.4 R F3(hash_open)3.731 E F0
-1.231(will attempt to determine if the hash function speci\214ed is the)3.731 F
-(same as the one with which the database w)108 674.4 Q(as created, and will f)
--.1 E(ail if it is not.)-.1 E(Backw)108 691.2 Q .861(ard compatible interf)-.1
-F .861(aces to the routines described in)-.1 F F3(dbm)3.362 E F0 .862
-(\(3\), and).32 F F3(ndbm)3.362 E F0 .862(\(3\) are pro).32 F .862(vided, ho)
--.15 F(we)-.25 E -.15(ve)-.25 G -.4(r,).15 G(these interf)108 703.2 Q
-(aces are not compatible with pre)-.1 E(vious \214le formats.)-.25 E 214.835
-(6, June)72 768 R(1)535 768 Q EP
-%%Page: 2 2
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF 182.62(HASH\(3\) 1993 HASH\(3\))72 48 R/F1 9
-/Times-Bold@0 SF(SEE ALSO)72 84 Q/F2 10/Times-Italic@0 SF(btr)108 96 Q(ee)-.37
-E F0(\(3\),).18 E F2(dbopen)2.5 E F0(\(3\),).24 E F2(mpool)2.5 E F0(\(3\),).51
-E F2 -.37(re)2.5 G(cno).37 E F0(\(3\)).18 E F2(Dynamic Hash T)108 108 Q(ables)
--.92 E F0 2.5(,P).27 G(er)206.79 108 Q(-Ak)-.2 E 2.5(eL)-.1 G
-(arson, Communications of the A)242.86 108 Q(CM, April 1988.)-.4 E F2 2.5(AN)
-108 120 S .3 -.15(ew H)123.28 120 T(ash P).15 E(ac)-.8 E(ka)-.2 E .2 -.1(ge f)
--.1 H(or UNIX).1 E F0 2.5(,M).94 G(ar)248.41 120 Q(go Seltzer)-.18 E 2.5(,U)-.4
-G(SENIX Proceedings, W)308.09 120 Q(inter 1991.)-.4 E F1 -.09(BU)72 136.8 S(GS)
-.09 E F0(Only big and little endian byte order is supported.)108 148.8 Q
-214.835(6, June)72 768 R(2)535 768 Q EP
-%%Trailer
-end
-%%EOF
diff --git a/lib/libc/db/doc/hash.ps b/lib/libc/db/doc/hash.ps
deleted file mode 100644
index 601e375d6c40..000000000000
--- a/lib/libc/db/doc/hash.ps
+++ /dev/null
@@ -1,12209 +0,0 @@
-%!PS-Adobe-1.0
-%%Creator: utopia:margo (& Seltzer,608-13E,8072,)
-%%Title: stdin (ditroff)
-%%CreationDate: Tue Dec 11 15:06:45 1990
-%%EndComments
-% @(#)psdit.pro 1.3 4/15/88
-% lib/psdit.pro -- prolog for psdit (ditroff) files
-% Copyright (c) 1984, 1985 Adobe Systems Incorporated. All Rights Reserved.
-% last edit: shore Sat Nov 23 20:28:03 1985
-% RCSID: $Header: /a/cvs/386BSD/src/lib/libc/db/doc/hash.ps,v 1.1 1993/06/16 02:20:49 rgrimes Exp $
-
-% Changed by Edward Wang (edward@ucbarpa.berkeley.edu) to handle graphics,
-% 17 Feb, 87.
-
-/$DITroff 140 dict def $DITroff begin
-/fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def
-/xi{0 72 11 mul translate 72 resolution div dup neg scale 0 0 moveto
- /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F
- /pagesave save def}def
-/PB{save /psv exch def currentpoint translate
- resolution 72 div dup neg scale 0 0 moveto}def
-/PE{psv restore}def
-/arctoobig 90 def /arctoosmall .05 def
-/m1 matrix def /m2 matrix def /m3 matrix def /oldmat matrix def
-/tan{dup sin exch cos div}def
-/point{resolution 72 div mul}def
-/dround {transform round exch round exch itransform}def
-/xT{/devname exch def}def
-/xr{/mh exch def /my exch def /resolution exch def}def
-/xp{}def
-/xs{docsave restore end}def
-/xt{}def
-/xf{/fontname exch def /slotno exch def fontnames slotno get fontname eq not
- {fonts slotno fontname findfont put fontnames slotno fontname put}if}def
-/xH{/fontheight exch def F}def
-/xS{/fontslant exch def F}def
-/s{/fontsize exch def /fontheight fontsize def F}def
-/f{/fontnum exch def F}def
-/F{fontheight 0 le{/fontheight fontsize def}if
- fonts fontnum get fontsize point 0 0 fontheight point neg 0 0 m1 astore
- fontslant 0 ne{1 0 fontslant tan 1 0 0 m2 astore m3 concatmatrix}if
- makefont setfont .04 fontsize point mul 0 dround pop setlinewidth}def
-/X{exch currentpoint exch pop moveto show}def
-/N{3 1 roll moveto show}def
-/Y{exch currentpoint pop exch moveto show}def
-/S{show}def
-/ditpush{}def/ditpop{}def
-/AX{3 -1 roll currentpoint exch pop moveto 0 exch ashow}def
-/AN{4 2 roll moveto 0 exch ashow}def
-/AY{3 -1 roll currentpoint pop exch moveto 0 exch ashow}def
-/AS{0 exch ashow}def
-/MX{currentpoint exch pop moveto}def
-/MY{currentpoint pop exch moveto}def
-/MXY{moveto}def
-/cb{pop}def % action on unknown char -- nothing for now
-/n{}def/w{}def
-/p{pop showpage pagesave restore /pagesave save def}def
-/Dt{/Dlinewidth exch def}def 1 Dt
-/Ds{/Ddash exch def}def -1 Ds
-/Di{/Dstipple exch def}def 1 Di
-/Dsetlinewidth{2 Dlinewidth mul setlinewidth}def
-/Dsetdash{Ddash 4 eq{[8 12]}{Ddash 16 eq{[32 36]}
- {Ddash 20 eq{[32 12 8 12]}{[]}ifelse}ifelse}ifelse 0 setdash}def
-/Dstroke{gsave Dsetlinewidth Dsetdash 1 setlinecap stroke grestore
- currentpoint newpath moveto}def
-/Dl{rlineto Dstroke}def
-/arcellipse{/diamv exch def /diamh exch def oldmat currentmatrix pop
- currentpoint translate 1 diamv diamh div scale /rad diamh 2 div def
- currentpoint exch rad add exch rad -180 180 arc oldmat setmatrix}def
-/Dc{dup arcellipse Dstroke}def
-/De{arcellipse Dstroke}def
-/Da{/endv exch def /endh exch def /centerv exch def /centerh exch def
- /cradius centerv centerv mul centerh centerh mul add sqrt def
- /eradius endv endv mul endh endh mul add sqrt def
- /endang endv endh atan def
- /startang centerv neg centerh neg atan def
- /sweep startang endang sub dup 0 lt{360 add}if def
- sweep arctoobig gt
- {/midang startang sweep 2 div sub def /midrad cradius eradius add 2 div def
- /midh midang cos midrad mul def /midv midang sin midrad mul def
- midh neg midv neg endh endv centerh centerv midh midv Da
- Da}
- {sweep arctoosmall ge
- {/controldelt 1 sweep 2 div cos sub 3 sweep 2 div sin mul div 4 mul def
- centerv neg controldelt mul centerh controldelt mul
- endv neg controldelt mul centerh add endh add
- endh controldelt mul centerv add endv add
- centerh endh add centerv endv add rcurveto Dstroke}
- {centerh endh add centerv endv add rlineto Dstroke}
- ifelse}
- ifelse}def
-/Dpatterns[
-[%cf[widthbits]
-[8<0000000000000010>]
-[8<0411040040114000>]
-[8<0204081020408001>]
-[8<0000103810000000>]
-[8<6699996666999966>]
-[8<0000800100001008>]
-[8<81c36666c3810000>]
-[8<0f0e0c0800000000>]
-[8<0000000000000010>]
-[8<0411040040114000>]
-[8<0204081020408001>]
-[8<0000001038100000>]
-[8<6699996666999966>]
-[8<0000800100001008>]
-[8<81c36666c3810000>]
-[8<0f0e0c0800000000>]
-[8<0042660000246600>]
-[8<0000990000990000>]
-[8<0804020180402010>]
-[8<2418814242811824>]
-[8<6699996666999966>]
-[8<8000000008000000>]
-[8<00001c3e363e1c00>]
-[8<0000000000000000>]
-[32<00000040000000c00000004000000040000000e0000000000000000000000000>]
-[32<00000000000060000000900000002000000040000000f0000000000000000000>]
-[32<000000000000000000e0000000100000006000000010000000e0000000000000>]
-[32<00000000000000002000000060000000a0000000f00000002000000000000000>]
-[32<0000000e0000000000000000000000000000000f000000080000000e00000001>]
-[32<0000090000000600000000000000000000000000000007000000080000000e00>]
-[32<00010000000200000004000000040000000000000000000000000000000f0000>]
-[32<0900000006000000090000000600000000000000000000000000000006000000>]]
-[%ug
-[8<0000020000000000>]
-[8<0000020000002000>]
-[8<0004020000002000>]
-[8<0004020000402000>]
-[8<0004060000402000>]
-[8<0004060000406000>]
-[8<0006060000406000>]
-[8<0006060000606000>]
-[8<00060e0000606000>]
-[8<00060e000060e000>]
-[8<00070e000060e000>]
-[8<00070e000070e000>]
-[8<00070e020070e000>]
-[8<00070e020070e020>]
-[8<04070e020070e020>]
-[8<04070e024070e020>]
-[8<04070e064070e020>]
-[8<04070e064070e060>]
-[8<06070e064070e060>]
-[8<06070e066070e060>]
-[8<06070f066070e060>]
-[8<06070f066070f060>]
-[8<060f0f066070f060>]
-[8<060f0f0660f0f060>]
-[8<060f0f0760f0f060>]
-[8<060f0f0760f0f070>]
-[8<0e0f0f0760f0f070>]
-[8<0e0f0f07e0f0f070>]
-[8<0e0f0f0fe0f0f070>]
-[8<0e0f0f0fe0f0f0f0>]
-[8<0f0f0f0fe0f0f0f0>]
-[8<0f0f0f0ff0f0f0f0>]
-[8<1f0f0f0ff0f0f0f0>]
-[8<1f0f0f0ff1f0f0f0>]
-[8<1f0f0f8ff1f0f0f0>]
-[8<1f0f0f8ff1f0f0f8>]
-[8<9f0f0f8ff1f0f0f8>]
-[8<9f0f0f8ff9f0f0f8>]
-[8<9f0f0f9ff9f0f0f8>]
-[8<9f0f0f9ff9f0f0f9>]
-[8<9f8f0f9ff9f0f0f9>]
-[8<9f8f0f9ff9f8f0f9>]
-[8<9f8f1f9ff9f8f0f9>]
-[8<9f8f1f9ff9f8f1f9>]
-[8<bf8f1f9ff9f8f1f9>]
-[8<bf8f1f9ffbf8f1f9>]
-[8<bf8f1fdffbf8f1f9>]
-[8<bf8f1fdffbf8f1fd>]
-[8<ff8f1fdffbf8f1fd>]
-[8<ff8f1fdffff8f1fd>]
-[8<ff8f1ffffff8f1fd>]
-[8<ff8f1ffffff8f1ff>]
-[8<ff9f1ffffff8f1ff>]
-[8<ff9f1ffffff9f1ff>]
-[8<ff9f9ffffff9f1ff>]
-[8<ff9f9ffffff9f9ff>]
-[8<ffbf9ffffff9f9ff>]
-[8<ffbf9ffffffbf9ff>]
-[8<ffbfdffffffbf9ff>]
-[8<ffbfdffffffbfdff>]
-[8<ffffdffffffbfdff>]
-[8<ffffdffffffffdff>]
-[8<fffffffffffffdff>]
-[8<ffffffffffffffff>]]
-[%mg
-[8<8000000000000000>]
-[8<0822080080228000>]
-[8<0204081020408001>]
-[8<40e0400000000000>]
-[8<66999966>]
-[8<8001000010080000>]
-[8<81c36666c3810000>]
-[8<f0e0c08000000000>]
-[16<07c00f801f003e007c00f800f001e003c007800f001f003e007c00f801f003e0>]
-[16<1f000f8007c003e001f000f8007c003e001f800fc007e003f001f8007c003e00>]
-[8<c3c300000000c3c3>]
-[16<0040008001000200040008001000200040008000000100020004000800100020>]
-[16<0040002000100008000400020001800040002000100008000400020001000080>]
-[16<1fc03fe07df0f8f8f07de03fc01f800fc01fe03ff07df8f87df03fe01fc00f80>]
-[8<80>]
-[8<8040201000000000>]
-[8<84cc000048cc0000>]
-[8<9900009900000000>]
-[8<08040201804020100800020180002010>]
-[8<2418814242811824>]
-[8<66999966>]
-[8<8000000008000000>]
-[8<70f8d8f870000000>]
-[8<0814224180402010>]
-[8<aa00440a11a04400>]
-[8<018245aa45820100>]
-[8<221c224180808041>]
-[8<88000000>]
-[8<0855800080550800>]
-[8<2844004482440044>]
-[8<0810204080412214>]
-[8<00>]]]def
-/Dfill{
- transform /maxy exch def /maxx exch def
- transform /miny exch def /minx exch def
- minx maxx gt{/minx maxx /maxx minx def def}if
- miny maxy gt{/miny maxy /maxy miny def def}if
- Dpatterns Dstipple 1 sub get exch 1 sub get
- aload pop /stip exch def /stipw exch def /stiph 128 def
- /imatrix[stipw 0 0 stiph 0 0]def
- /tmatrix[stipw 0 0 stiph 0 0]def
- /minx minx cvi stiph idiv stiph mul def
- /miny miny cvi stipw idiv stipw mul def
- gsave eoclip 0 setgray
- miny stiph maxy{
- tmatrix exch 5 exch put
- minx stipw maxx{
- tmatrix exch 4 exch put tmatrix setmatrix
- stipw stiph true imatrix {stip} imagemask
- }for
- }for
- grestore
-}def
-/Dp{Dfill Dstroke}def
-/DP{Dfill currentpoint newpath moveto}def
-end
-
-/ditstart{$DITroff begin
- /nfonts 60 def % NFONTS makedev/ditroff dependent!
- /fonts[nfonts{0}repeat]def
- /fontnames[nfonts{()}repeat]def
-/docsave save def
-}def
-
-% character outcalls
-/oc{
- /pswid exch def /cc exch def /name exch def
- /ditwid pswid fontsize mul resolution mul 72000 div def
- /ditsiz fontsize resolution mul 72 div def
- ocprocs name known{ocprocs name get exec}{name cb}ifelse
-}def
-/fractm [.65 0 0 .6 0 0] def
-/fraction{
- /fden exch def /fnum exch def gsave /cf currentfont def
- cf fractm makefont setfont 0 .3 dm 2 copy neg rmoveto
- fnum show rmoveto currentfont cf setfont(\244)show setfont fden show
- grestore ditwid 0 rmoveto
-}def
-/oce{grestore ditwid 0 rmoveto}def
-/dm{ditsiz mul}def
-/ocprocs 50 dict def ocprocs begin
-(14){(1)(4)fraction}def
-(12){(1)(2)fraction}def
-(34){(3)(4)fraction}def
-(13){(1)(3)fraction}def
-(23){(2)(3)fraction}def
-(18){(1)(8)fraction}def
-(38){(3)(8)fraction}def
-(58){(5)(8)fraction}def
-(78){(7)(8)fraction}def
-(sr){gsave 0 .06 dm rmoveto(\326)show oce}def
-(is){gsave 0 .15 dm rmoveto(\362)show oce}def
-(->){gsave 0 .02 dm rmoveto(\256)show oce}def
-(<-){gsave 0 .02 dm rmoveto(\254)show oce}def
-(==){gsave 0 .05 dm rmoveto(\272)show oce}def
-(uc){gsave currentpoint 400 .009 dm mul add translate
- 8 -8 scale ucseal oce}def
-end
-
-% an attempt at a PostScript FONT to implement ditroff special chars
-% this will enable us to
-% cache the little buggers
-% generate faster, more compact PS out of psdit
-% confuse everyone (including myself)!
-50 dict dup begin
-/FontType 3 def
-/FontName /DIThacks def
-/FontMatrix [.001 0 0 .001 0 0] def
-/FontBBox [-260 -260 900 900] def% a lie but ...
-/Encoding 256 array def
-0 1 255{Encoding exch /.notdef put}for
-Encoding
- dup 8#040/space put %space
- dup 8#110/rc put %right ceil
- dup 8#111/lt put %left top curl
- dup 8#112/bv put %bold vert
- dup 8#113/lk put %left mid curl
- dup 8#114/lb put %left bot curl
- dup 8#115/rt put %right top curl
- dup 8#116/rk put %right mid curl
- dup 8#117/rb put %right bot curl
- dup 8#120/rf put %right floor
- dup 8#121/lf put %left floor
- dup 8#122/lc put %left ceil
- dup 8#140/sq put %square
- dup 8#141/bx put %box
- dup 8#142/ci put %circle
- dup 8#143/br put %box rule
- dup 8#144/rn put %root extender
- dup 8#145/vr put %vertical rule
- dup 8#146/ob put %outline bullet
- dup 8#147/bu put %bullet
- dup 8#150/ru put %rule
- dup 8#151/ul put %underline
- pop
-/DITfd 100 dict def
-/BuildChar{0 begin
- /cc exch def /fd exch def
- /charname fd /Encoding get cc get def
- /charwid fd /Metrics get charname get def
- /charproc fd /CharProcs get charname get def
- charwid 0 fd /FontBBox get aload pop setcachedevice
- 2 setlinejoin 40 setlinewidth
- newpath 0 0 moveto gsave charproc grestore
- end}def
-/BuildChar load 0 DITfd put
-/CharProcs 50 dict def
-CharProcs begin
-/space{}def
-/.notdef{}def
-/ru{500 0 rls}def
-/rn{0 840 moveto 500 0 rls}def
-/vr{0 800 moveto 0 -770 rls}def
-/bv{0 800 moveto 0 -1000 rls}def
-/br{0 840 moveto 0 -1000 rls}def
-/ul{0 -140 moveto 500 0 rls}def
-/ob{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath stroke}def
-/bu{200 250 rmoveto currentpoint newpath 200 0 360 arc closepath fill}def
-/sq{80 0 rmoveto currentpoint dround newpath moveto
- 640 0 rlineto 0 640 rlineto -640 0 rlineto closepath stroke}def
-/bx{80 0 rmoveto currentpoint dround newpath moveto
- 640 0 rlineto 0 640 rlineto -640 0 rlineto closepath fill}def
-/ci{500 360 rmoveto currentpoint newpath 333 0 360 arc
- 50 setlinewidth stroke}def
-
-/lt{0 -200 moveto 0 550 rlineto currx 800 2cx s4 add exch s4 a4p stroke}def
-/lb{0 800 moveto 0 -550 rlineto currx -200 2cx s4 add exch s4 a4p stroke}def
-/rt{0 -200 moveto 0 550 rlineto currx 800 2cx s4 sub exch s4 a4p stroke}def
-/rb{0 800 moveto 0 -500 rlineto currx -200 2cx s4 sub exch s4 a4p stroke}def
-/lk{0 800 moveto 0 300 -300 300 s4 arcto pop pop 1000 sub
- 0 300 4 2 roll s4 a4p 0 -200 lineto stroke}def
-/rk{0 800 moveto 0 300 s2 300 s4 arcto pop pop 1000 sub
- 0 300 4 2 roll s4 a4p 0 -200 lineto stroke}def
-/lf{0 800 moveto 0 -1000 rlineto s4 0 rls}def
-/rf{0 800 moveto 0 -1000 rlineto s4 neg 0 rls}def
-/lc{0 -200 moveto 0 1000 rlineto s4 0 rls}def
-/rc{0 -200 moveto 0 1000 rlineto s4 neg 0 rls}def
-end
-
-/Metrics 50 dict def Metrics begin
-/.notdef 0 def
-/space 500 def
-/ru 500 def
-/br 0 def
-/lt 416 def
-/lb 416 def
-/rt 416 def
-/rb 416 def
-/lk 416 def
-/rk 416 def
-/rc 416 def
-/lc 416 def
-/rf 416 def
-/lf 416 def
-/bv 416 def
-/ob 350 def
-/bu 350 def
-/ci 750 def
-/bx 750 def
-/sq 750 def
-/rn 500 def
-/ul 500 def
-/vr 0 def
-end
-
-DITfd begin
-/s2 500 def /s4 250 def /s3 333 def
-/a4p{arcto pop pop pop pop}def
-/2cx{2 copy exch}def
-/rls{rlineto stroke}def
-/currx{currentpoint pop}def
-/dround{transform round exch round exch itransform} def
-end
-end
-/DIThacks exch definefont pop
-ditstart
-(psc)xT
-576 1 1 xr
-1(Times-Roman)xf 1 f
-2(Times-Italic)xf 2 f
-3(Times-Bold)xf 3 f
-4(Times-BoldItalic)xf 4 f
-5(Helvetica)xf 5 f
-6(Helvetica-Bold)xf 6 f
-7(Courier)xf 7 f
-8(Courier-Bold)xf 8 f
-9(Symbol)xf 9 f
-10(DIThacks)xf 10 f
-10 s
-1 f
-xi
-%%EndProlog
-
-%%Page: 1 1
-10 s 10 xH 0 xS 1 f
-3 f
-22 s
-1249 626(A)N
-1420(N)X
-1547(ew)X
-1796(H)X
-1933(ashing)X
-2467(P)X
-2574(ackage)X
-3136(for)X
-3405(U)X
-3532(N)X
-3659(IX)X
-2 f
-20 s
-3855 562(1)N
-1 f
-12 s
-1607 779(Margo)N
-1887(Seltzer)X
-9 f
-2179(-)X
-1 f
-2256(University)X
-2686(of)X
-2790(California,)X
-3229(Berkeley)X
-2015 875(Ozan)N
-2242(Yigit)X
-9 f
-2464(-)X
-1 f
-2541(York)X
-2762(University)X
-3 f
-2331 1086(ABSTRACT)N
-1 f
-10 s
-1152 1222(UNIX)N
-1385(support)X
-1657(of)X
-1756(disk)X
-1921(oriented)X
-2216(hashing)X
-2497(was)X
-2654(originally)X
-2997(provided)X
-3314(by)X
-2 f
-3426(dbm)X
-1 f
-3595([ATT79])X
-3916(and)X
-1152 1310(subsequently)N
-1595(improved)X
-1927(upon)X
-2112(in)X
-2 f
-2199(ndbm)X
-1 f
-2402([BSD86].)X
-2735(In)X
-2826(AT&T)X
-3068(System)X
-3327(V,)X
-3429(in-memory)X
-3809(hashed)X
-1152 1398(storage)N
-1420(and)X
-1572(access)X
-1814(support)X
-2090(was)X
-2251(added)X
-2479(in)X
-2577(the)X
-2 f
-2711(hsearch)X
-1 f
-3000(library)X
-3249(routines)X
-3542([ATT85].)X
-3907(The)X
-1152 1486(result)N
-1367(is)X
-1457(a)X
-1530(system)X
-1789(with)X
-1968(two)X
-2125(incompatible)X
-2580(hashing)X
-2865(schemes,)X
-3193(each)X
-3377(with)X
-3555(its)X
-3666(own)X
-3840(set)X
-3965(of)X
-1152 1574(shortcomings.)N
-1152 1688(This)N
-1316(paper)X
-1517(presents)X
-1802(the)X
-1922(design)X
-2152(and)X
-2289(performance)X
-2717(characteristics)X
-3198(of)X
-3286(a)X
-3343(new)X
-3498(hashing)X
-3768(package)X
-1152 1776(providing)N
-1483(a)X
-1539(superset)X
-1822(of)X
-1909(the)X
-2027(functionality)X
-2456(provided)X
-2761(by)X
-2 f
-2861(dbm)X
-1 f
-3019(and)X
-2 f
-3155(hsearch)X
-1 f
-3409(.)X
-3469(The)X
-3614(new)X
-3768(package)X
-1152 1864(uses)N
-1322(linear)X
-1537(hashing)X
-1818(to)X
-1912(provide)X
-2189(ef\256cient)X
-2484(support)X
-2755(of)X
-2853(both)X
-3026(memory)X
-3324(based)X
-3538(and)X
-3685(disk)X
-3849(based)X
-1152 1952(hash)N
-1319(tables)X
-1526(with)X
-1688(performance)X
-2115(superior)X
-2398(to)X
-2480(both)X
-2 f
-2642(dbm)X
-1 f
-2800(and)X
-2 f
-2936(hsearch)X
-1 f
-3210(under)X
-3413(most)X
-3588(conditions.)X
-3 f
-1380 2128(Introduction)N
-1 f
-892 2260(Current)N
-1196(UNIX)X
-1456(systems)X
-1768(offer)X
-1984(two)X
-2163(forms)X
-2409(of)X
-720 2348(hashed)N
-973(data)X
-1137(access.)X
-2 f
-1413(Dbm)X
-1 f
-1599(and)X
-1745(its)X
-1850(derivatives)X
-2231(provide)X
-720 2436(keyed)N
-939(access)X
-1171(to)X
-1259(disk)X
-1418(resident)X
-1698(data)X
-1858(while)X
-2 f
-2062(hsearch)X
-1 f
-2342(pro-)X
-720 2524(vides)N
-929(access)X
-1175(for)X
-1309(memory)X
-1616(resident)X
-1910(data.)X
-2124(These)X
-2356(two)X
-720 2612(access)N
-979(methods)X
-1302(are)X
-1453(incompatible)X
-1923(in)X
-2037(that)X
-2209(memory)X
-720 2700(resident)N
-1011(hash)X
-1195(tables)X
-1419(may)X
-1593(not)X
-1731(be)X
-1843(stored)X
-2075(on)X
-2191(disk)X
-2360(and)X
-720 2788(disk)N
-884(resident)X
-1169(tables)X
-1387(cannot)X
-1632(be)X
-1739(read)X
-1909(into)X
-2063(memory)X
-2360(and)X
-720 2876(accessed)N
-1022(using)X
-1215(the)X
-1333(in-memory)X
-1709(routines.)X
-2 f
-892 2990(Dbm)N
-1 f
-1091(has)X
-1241(several)X
-1512(shortcomings.)X
-2026(Since)X
-2247(data)X
-2423(is)X
-720 3078(assumed)N
-1032(to)X
-1130(be)X
-1242(disk)X
-1411(resident,)X
-1721(each)X
-1905(access)X
-2146(requires)X
-2440(a)X
-720 3166(system)N
-963(call,)X
-1120(and)X
-1257(almost)X
-1491(certainly,)X
-1813(a)X
-1869(disk)X
-2022(operation.)X
-2365(For)X
-720 3254(extremely)N
-1072(large)X
-1264(databases,)X
-1623(where)X
-1851(caching)X
-2131(is)X
-2214(unlikely)X
-720 3342(to)N
-810(be)X
-914(effective,)X
-1244(this)X
-1386(is)X
-1466(acceptable,)X
-1853(however,)X
-2177(when)X
-2378(the)X
-720 3430(database)N
-1022(is)X
-1100(small)X
-1298(\(i.e.)X
-1447(the)X
-1569(password)X
-1896(\256le\),)X
-2069(performance)X
-720 3518(improvements)N
-1204(can)X
-1342(be)X
-1443(obtained)X
-1744(through)X
-2018(caching)X
-2293(pages)X
-720 3606(of)N
-818(the)X
-947(database)X
-1255(in)X
-1348(memory.)X
-1685(In)X
-1782(addition,)X
-2 f
-2094(dbm)X
-1 f
-2262(cannot)X
-720 3694(store)N
-902(data)X
-1062(items)X
-1261(whose)X
-1492(total)X
-1660(key)X
-1802(and)X
-1943(data)X
-2102(size)X
-2252(exceed)X
-720 3782(the)N
-850(page)X
-1034(size)X
-1191(of)X
-1290(the)X
-1420(hash)X
-1599(table.)X
-1827(Similarly,)X
-2176(if)X
-2257(two)X
-2409(or)X
-720 3870(more)N
-907(keys)X
-1076(produce)X
-1357(the)X
-1477(same)X
-1664(hash)X
-1833(value)X
-2029(and)X
-2166(their)X
-2334(total)X
-720 3958(size)N
-876(exceeds)X
-1162(the)X
-1291(page)X
-1474(size,)X
-1650(the)X
-1779(table)X
-1966(cannot)X
-2210(store)X
-2396(all)X
-720 4046(the)N
-838(colliding)X
-1142(keys.)X
-892 4160(The)N
-1050(in-memory)X
-2 f
-1439(hsearch)X
-1 f
-1725(routines)X
-2015(have)X
-2199(different)X
-720 4248(shortcomings.)N
-1219(First,)X
-1413(the)X
-1539(notion)X
-1771(of)X
-1865(a)X
-1928(single)X
-2146(hash)X
-2320(table)X
-720 4336(is)N
-807(embedded)X
-1171(in)X
-1266(the)X
-1397(interface,)X
-1732(preventing)X
-2108(an)X
-2217(applica-)X
-720 4424(tion)N
-902(from)X
-1116(accessing)X
-1482(multiple)X
-1806(tables)X
-2050(concurrently.)X
-720 4512(Secondly,)N
-1063(the)X
-1186(routine)X
-1438(to)X
-1525(create)X
-1743(a)X
-1804(hash)X
-1976(table)X
-2157(requires)X
-2440(a)X
-720 4600(parameter)N
-1066(which)X
-1286(declares)X
-1573(the)X
-1694(size)X
-1842(of)X
-1932(the)X
-2053(hash)X
-2223(table.)X
-2422(If)X
-720 4688(this)N
-856(size)X
-1001(is)X
-1074(set)X
-1183(too)X
-1305(low,)X
-1465(performance)X
-1892(degradation)X
-2291(or)X
-2378(the)X
-720 4776(inability)N
-1008(to)X
-1092(add)X
-1230(items)X
-1425(to)X
-1509(the)X
-1628(table)X
-1805(may)X
-1964(result.)X
-2223(In)X
-2311(addi-)X
-720 4864(tion,)N
-2 f
-910(hsearch)X
-1 f
-1210(requires)X
-1515(that)X
-1681(the)X
-1825(application)X
-2226(allocate)X
-720 4952(memory)N
-1037(for)X
-1181(the)X
-1329(key)X
-1495(and)X
-1661(data)X
-1845(items.)X
-2108(Lastly,)X
-2378(the)X
-2 f
-720 5040(hsearch)N
-1 f
-1013(routines)X
-1310(provide)X
-1594(no)X
-1713(interface)X
-2034(to)X
-2135(store)X
-2329(hash)X
-720 5128(tables)N
-927(on)X
-1027(disk.)X
-16 s
-720 5593 MXY
-864 0 Dl
-2 f
-8 s
-760 5648(1)N
-1 f
-9 s
-5673(UNIX)Y
-990(is)X
-1056(a)X
-1106(registered)X
-1408(trademark)X
-1718(of)X
-1796(AT&T.)X
-10 s
-2878 2128(The)N
-3032(goal)X
-3199(of)X
-3295(our)X
-3431(work)X
-3625(was)X
-3779(to)X
-3870(design)X
-4108(and)X
-4253(imple-)X
-2706 2216(ment)N
-2900(a)X
-2970(new)X
-3138(package)X
-3436(that)X
-3590(provides)X
-3899(a)X
-3968(superset)X
-4264(of)X
-4364(the)X
-2706 2304(functionality)N
-3144(of)X
-3240(both)X
-2 f
-3411(dbm)X
-1 f
-3578(and)X
-2 f
-3723(hsearch)X
-1 f
-3977(.)X
-4045(The)X
-4198(package)X
-2706 2392(had)N
-2871(to)X
-2982(overcome)X
-3348(the)X
-3495(interface)X
-3826(shortcomings)X
-4306(cited)X
-2706 2480(above)N
-2930(and)X
-3078(its)X
-3185(implementation)X
-3719(had)X
-3867(to)X
-3961(provide)X
-4238(perfor-)X
-2706 2568(mance)N
-2942(equal)X
-3142(or)X
-3235(superior)X
-3524(to)X
-3612(that)X
-3758(of)X
-3851(the)X
-3975(existing)X
-4253(imple-)X
-2706 2656(mentations.)N
-3152(In)X
-3274(order)X
-3498(to)X
-3614(provide)X
-3913(a)X
-4003(compact)X
-4329(disk)X
-2706 2744(representation,)N
-3224(graceful)X
-3531(table)X
-3729(growth,)X
-4018(and)X
-4176(expected)X
-2706 2832(constant)N
-3033(time)X
-3234(performance,)X
-3720(we)X
-3873(selected)X
-4191(Litwin's)X
-2706 2920(linear)N
-2923(hashing)X
-3206(algorithm)X
-3551([LAR88,)X
-3872(LIT80].)X
-4178(We)X
-4324(then)X
-2706 3008(enhanced)N
-3037(the)X
-3161(algorithm)X
-3498(to)X
-3586(handle)X
-3826(page)X
-4004(over\257ows)X
-4346(and)X
-2706 3096(large)N
-2900(key)X
-3049(handling)X
-3362(with)X
-3537(a)X
-3606(single)X
-3830(mechanism,)X
-4248(named)X
-2706 3184(buddy-in-waiting.)N
-3 f
-2975 3338(Existing)N
-3274(UNIX)X
-3499(Hashing)X
-3802(Techniques)X
-1 f
-2878 3470(Over)N
-3076(the)X
-3210(last)X
-3357(decade,)X
-3637(several)X
-3901(dynamic)X
-4213(hashing)X
-2706 3558(schemes)N
-3000(have)X
-3174(been)X
-3348(developed)X
-3700(for)X
-3816(the)X
-3936(UNIX)X
-4159(timeshar-)X
-2706 3646(ing)N
-2856(system,)X
-3146(starting)X
-3433(with)X
-3622(the)X
-3767(inclusion)X
-4107(of)X
-2 f
-4221(dbm)X
-1 f
-4359(,)X
-4426(a)X
-2706 3734(minimal)N
-3008(database)X
-3321(library)X
-3571(written)X
-3834(by)X
-3950(Ken)X
-4120(Thompson)X
-2706 3822([THOM90],)N
-3141(in)X
-3248(the)X
-3391(Seventh)X
-3694(Edition)X
-3974(UNIX)X
-4220(system.)X
-2706 3910(Since)N
-2916(then,)X
-3106(an)X
-3214(extended)X
-3536(version)X
-3804(of)X
-3903(the)X
-4032(same)X
-4228(library,)X
-2 f
-2706 3998(ndbm)N
-1 f
-2884(,)X
-2933(and)X
-3078(a)X
-3142(public-domain)X
-3637(clone)X
-3839(of)X
-3934(the)X
-4060(latter,)X
-2 f
-4273(sdbm)X
-1 f
-4442(,)X
-2706 4086(have)N
-2902(been)X
-3098(developed.)X
-3491(Another)X
-3797 0.1645(interface-compatible)AX
-2706 4174(library)N
-2 f
-2950(gdbm)X
-1 f
-3128(,)X
-3178(was)X
-3333(recently)X
-3622(made)X
-3826(available)X
-4145(as)X
-4241(part)X
-4395(of)X
-2706 4262(the)N
-2829(Free)X
-2997(Software)X
-3312(Foundation's)X
-3759(\(FSF\))X
-3970(software)X
-4271(distri-)X
-2706 4350(bution.)N
-2878 4464(All)N
-3017(of)X
-3121(these)X
-3323(implementations)X
-3893(are)X
-4029(based)X
-4248(on)X
-4364(the)X
-2706 4552(idea)N
-2871(of)X
-2969(revealing)X
-3299(just)X
-3445(enough)X
-3711(bits)X
-3856(of)X
-3953(a)X
-4019(hash)X
-4196(value)X
-4400(to)X
-2706 4640(locate)N
-2920(a)X
-2978(page)X
-3151(in)X
-3234(a)X
-3291(single)X
-3503(access.)X
-3770(While)X
-2 f
-3987(dbm/ndbm)X
-1 f
-4346(and)X
-2 f
-2706 4728(sdbm)N
-1 f
-2908(map)X
-3079(the)X
-3210(hash)X
-3390(value)X
-3597(directly)X
-3874(to)X
-3968(a)X
-4036(disk)X
-4201(address,)X
-2 f
-2706 4816(gdbm)N
-1 f
-2921(uses)X
-3096(the)X
-3231(hash)X
-3414(value)X
-3624(to)X
-3722(index)X
-3936(into)X
-4096(a)X
-2 f
-4168(directory)X
-1 f
-2706 4904([ENB88])N
-3020(containing)X
-3378(disk)X
-3531(addresses.)X
-2878 5018(The)N
-2 f
-3033(hsearch)X
-1 f
-3317(routines)X
-3605(in)X
-3697(System)X
-3962(V)X
-4049(are)X
-4177(designed)X
-2706 5106(to)N
-2804(provide)X
-3085(memory-resident)X
-3669(hash)X
-3852(tables.)X
-4115(Since)X
-4328(data)X
-2706 5194(access)N
-2948(does)X
-3131(not)X
-3269(require)X
-3533(disk)X
-3702(access,)X
-3964(simple)X
-4213(hashing)X
-2706 5282(schemes)N
-3010(which)X
-3238(may)X
-3408(require)X
-3667(multiple)X
-3964(probes)X
-4209(into)X
-4364(the)X
-2706 5370(table)N
-2889(are)X
-3015(used.)X
-3209(A)X
-3294(more)X
-3486(interesting)X
-3851(version)X
-4114(of)X
-2 f
-4208(hsearch)X
-1 f
-2706 5458(is)N
-2784(a)X
-2845(public)X
-3070(domain)X
-3335(library,)X
-2 f
-3594(dynahash)X
-1 f
-3901(,)X
-3945(that)X
-4089(implements)X
-2706 5546(Larson's)N
-3036(in-memory)X
-3440(adaptation)X
-3822([LAR88])X
-4164(of)X
-4279(linear)X
-2706 5634(hashing)N
-2975([LIT80].)X
-3 f
-720 5960(USENIX)N
-9 f
-1042(-)X
-3 f
-1106(Winter)X
-1371('91)X
-9 f
-1498(-)X
-3 f
-1562(Dallas,)X
-1815(TX)X
-1 f
-4424(1)X
-
-2 p
-%%Page: 2 2
-10 s 10 xH 0 xS 1 f
-3 f
-432 258(A)N
-510(New)X
-682(Hashing)X
-985(Package)X
-1290(for)X
-1413(UNIX)X
-3663(Seltzer)X
-3920(&)X
-4007(Yigit)X
-2 f
-1074 538(dbm)N
-1 f
-1232(and)X
-2 f
-1368(ndbm)X
-1 f
-604 670(The)N
-2 f
-760(dbm)X
-1 f
-928(and)X
-2 f
-1074(ndbm)X
-1 f
-1282(library)X
-1526(implementations)X
-2089(are)X
-432 758(based)N
-667(on)X
-799(the)X
-949(same)X
-1166(algorithm)X
-1529(by)X
-1661(Ken)X
-1846(Thompson)X
-432 846([THOM90,)N
-824(TOR88,)X
-1113(WAL84],)X
-1452(but)X
-1582(differ)X
-1789(in)X
-1879(their)X
-2054(pro-)X
-432 934(grammatic)N
-801(interfaces.)X
-1160(The)X
-1311(latter)X
-1502(is)X
-1581(a)X
-1643(modi\256ed)X
-1952(version)X
-432 1022(of)N
-533(the)X
-665(former)X
-918(which)X
-1148(adds)X
-1328(support)X
-1601(for)X
-1728(multiple)X
-2027(data-)X
-432 1110(bases)N
-634(to)X
-724(be)X
-828(open)X
-1011(concurrently.)X
-1484(The)X
-1636(discussion)X
-1996(of)X
-2090(the)X
-432 1198(algorithm)N
-774(that)X
-925(follows)X
-1196(is)X
-1280(applicable)X
-1640(to)X
-1732(both)X
-2 f
-1904(dbm)X
-1 f
-2072(and)X
-2 f
-432 1286(ndbm)N
-1 f
-610(.)X
-604 1400(The)N
-760(basic)X
-956(structure)X
-1268(of)X
-2 f
-1366(dbm)X
-1 f
-1535(calls)X
-1712(for)X
-1836(\256xed-sized)X
-432 1488(disk)N
-612(blocks)X
-868(\(buckets\))X
-1214(and)X
-1377(an)X
-2 f
-1499(access)X
-1 f
-1755(function)X
-2068(that)X
-432 1576(maps)N
-623(a)X
-681(key)X
-819(to)X
-902(a)X
-959(bucket.)X
-1234(The)X
-1380(interface)X
-1683(routines)X
-1962(use)X
-2090(the)X
-2 f
-432 1664(access)N
-1 f
-673(function)X
-970(to)X
-1062(obtain)X
-1292(the)X
-1420(appropriate)X
-1816(bucket)X
-2060(in)X
-2152(a)X
-432 1752(single)N
-643(disk)X
-796(access.)X
-604 1866(Within)N
-869(the)X
-2 f
-1010(access)X
-1 f
-1263(function,)X
-1593(a)X
-1672(bit-randomizing)X
-432 1954(hash)N
-610(function)X
-2 f
-8 s
-877 1929(2)N
-1 f
-10 s
-940 1954(is)N
-1024(used)X
-1202(to)X
-1294(convert)X
-1565(a)X
-1631(key)X
-1777(into)X
-1931(a)X
-1997(32-bit)X
-432 2042(hash)N
-605(value.)X
-825(Out)X
-971(of)X
-1064(these)X
-1254(32)X
-1359(bits,)X
-1519(only)X
-1686(as)X
-1778(many)X
-1981(bits)X
-2121(as)X
-432 2130(necessary)N
-773(are)X
-900(used)X
-1075(to)X
-1165(determine)X
-1514(the)X
-1639(particular)X
-1974(bucket)X
-432 2218(on)N
-533(which)X
-750(a)X
-807(key)X
-944(resides.)X
-1228(An)X
-1347(in-memory)X
-1724(bitmap)X
-1967(is)X
-2041(used)X
-432 2306(to)N
-533(determine)X
-893(how)X
-1070(many)X
-1287(bits)X
-1441(are)X
-1579(required.)X
-1905(Each)X
-2104(bit)X
-432 2394(indicates)N
-746(whether)X
-1033(its)X
-1136(associated)X
-1494(bucket)X
-1736(has)X
-1871(been)X
-2051(split)X
-432 2482(yet)N
-562(\(a)X
-657(0)X
-728(indicating)X
-1079(that)X
-1230(the)X
-1359(bucket)X
-1604(has)X
-1742(not)X
-1875(yet)X
-2004(split\).)X
-432 2570(The)N
-590(use)X
-730(of)X
-830(the)X
-961(hash)X
-1141(function)X
-1441(and)X
-1590(the)X
-1720(bitmap)X
-1974(is)X
-2059(best)X
-432 2658(described)N
-769(by)X
-878(stepping)X
-1177(through)X
-1454(database)X
-1759(creation)X
-2046(with)X
-432 2746(multiple)N
-718(invocations)X
-1107(of)X
-1194(a)X
-2 f
-1250(store)X
-1 f
-1430(operation.)X
-604 2860(Initially,)N
-906(the)X
-1033(hash)X
-1209(table)X
-1394(contains)X
-1690(a)X
-1755(single)X
-1974(bucket)X
-432 2948(\(bucket)N
-711(0\),)X
-836(the)X
-972(bit)X
-1094(map)X
-1270(contains)X
-1575(a)X
-1649(single)X
-1878(bit)X
-2000(\(bit)X
-2148(0)X
-432 3036(corresponding)N
-913(to)X
-997(bucket)X
-1233(0\),)X
-1342(and)X
-1480(0)X
-1542(bits)X
-1699(of)X
-1788(a)X
-1846(hash)X
-2014(value)X
-432 3124(are)N
-560(examined)X
-901(to)X
-992(determine)X
-1342(where)X
-1568(a)X
-1633(key)X
-1778(is)X
-1860(placed)X
-2099(\(in)X
-432 3212(bucket)N
-670(0\).)X
-801(When)X
-1017(bucket)X
-1255(0)X
-1319(is)X
-1396(full,)X
-1551(its)X
-1650(bit)X
-1758(in)X
-1844(the)X
-1966(bitmap)X
-432 3300(\(bit)N
-564(0\))X
-652(is)X
-726(set,)X
-856(and)X
-993(its)X
-1089(contents)X
-1377(are)X
-1497(split)X
-1655(between)X
-1943(buckets)X
-432 3388(0)N
-499(and)X
-641(1,)X
-727(by)X
-833(considering)X
-1233(the)X
-1357(0)X
-2 f
-7 s
-3356(th)Y
-10 s
-1 f
-1480 3388(bit)N
-1590(\(the)X
-1741(lowest)X
-1976(bit)X
-2086(not)X
-432 3476(previously)N
-800(examined\))X
-1169(of)X
-1266(the)X
-1393(hash)X
-1569(value)X
-1772(for)X
-1895(each)X
-2072(key)X
-432 3564(within)N
-668(the)X
-798(bucket.)X
-1064(Given)X
-1292(a)X
-1359(well-designed)X
-1840(hash)X
-2018(func-)X
-432 3652(tion,)N
-613(approximately)X
-1112(half)X
-1273(of)X
-1376(the)X
-1510(keys)X
-1693(will)X
-1853(have)X
-2041(hash)X
-432 3740(values)N
-666(with)X
-837(the)X
-964(0)X
-2 f
-7 s
-3708(th)Y
-10 s
-1 f
-1090 3740(bit)N
-1203(set.)X
-1341(All)X
-1471(such)X
-1646(keys)X
-1821(and)X
-1965(associ-)X
-432 3828(ated)N
-586(data)X
-740(are)X
-859(moved)X
-1097(to)X
-1179(bucket)X
-1413(1,)X
-1493(and)X
-1629(the)X
-1747(rest)X
-1883(remain)X
-2126(in)X
-432 3916(bucket)N
-666(0.)X
-604 4030(After)N
-804(this)X
-949(split,)X
-1135(the)X
-1262(\256le)X
-1393(now)X
-1560(contains)X
-1856(two)X
-2005(buck-)X
-432 4118(ets,)N
-562(and)X
-699(the)X
-818(bitmap)X
-1061(contains)X
-1349(three)X
-1530(bits:)X
-1687(the)X
-1805(0)X
-2 f
-7 s
-4086(th)Y
-10 s
-1 f
-1922 4118(bit)N
-2026(is)X
-2099(set)X
-432 4206(to)N
-525(indicate)X
-810(a)X
-876(bucket)X
-1120(0)X
-1190(split)X
-1357(when)X
-1561(no)X
-1671(bits)X
-1816(of)X
-1913(the)X
-2041(hash)X
-432 4294(value)N
-648(are)X
-789(considered,)X
-1199(and)X
-1357(two)X
-1519(more)X
-1726(unset)X
-1937(bits)X
-2094(for)X
-432 4382(buckets)N
-706(0)X
-775(and)X
-920(1.)X
-1029(The)X
-1183(placement)X
-1542(of)X
-1638(an)X
-1742(incoming)X
-2072(key)X
-432 4470(now)N
-604(requires)X
-897(examination)X
-1327(of)X
-1428(the)X
-1560(0)X
-2 f
-7 s
-4438(th)Y
-10 s
-1 f
-1691 4470(bit)N
-1809(of)X
-1910(the)X
-2041(hash)X
-432 4558(value,)N
-667(and)X
-824(the)X
-963(key)X
-1119(is)X
-1212(placed)X
-1462(either)X
-1685(in)X
-1787(bucket)X
-2041(0)X
-2121(or)X
-432 4646(bucket)N
-674(1.)X
-782(If)X
-864(either)X
-1075(bucket)X
-1317(0)X
-1385(or)X
-1480(bucket)X
-1722(1)X
-1790(\256lls)X
-1937(up,)X
-2064(it)X
-2135(is)X
-432 4734(split)N
-598(as)X
-693(before,)X
-947(its)X
-1050(bit)X
-1162(is)X
-1243(set)X
-1360(in)X
-1450(the)X
-1576(bitmap,)X
-1846(and)X
-1990(a)X
-2054(new)X
-432 4822(set)N
-541(of)X
-628(unset)X
-817(bits)X
-952(are)X
-1071(added)X
-1283(to)X
-1365(the)X
-1483(bitmap.)X
-604 4936(Each)N
-791(time)X
-959(we)X
-1079(consider)X
-1376(a)X
-1437(new)X
-1596(bit)X
-1705(\(bit)X
-1841(n\),)X
-1953(we)X
-2072(add)X
-432 5024(2)N
-2 f
-7 s
-4992(n)Y
-9 f
-509(+)X
-1 f
-540(1)X
-10 s
-595 5024(bits)N
-737(to)X
-826(the)X
-951(bitmap)X
-1199(and)X
-1341(obtain)X
-1567(2)X
-2 f
-7 s
-4992(n)Y
-9 f
-1644(+)X
-1 f
-1675(1)X
-10 s
-1729 5024(more)N
-1920(address-)X
-432 5112(able)N
-595(buckets)X
-869(in)X
-960(the)X
-1087(\256le.)X
-1258(As)X
-1376(a)X
-1441(result,)X
-1668(the)X
-1795(bitmap)X
-2045(con-)X
-432 5200(tains)N
-618(the)X
-751(previous)X
-1062(2)X
-2 f
-7 s
-5168(n)Y
-9 f
-1139(+)X
-1 f
-1170(1)X
-2 f
-10 s
-9 f
-5200(-)Y
-1 f
-1242(1)X
-1317(bits)X
-1467(\(1)X
-2 f
-9 f
-1534(+)X
-1 f
-1578(2)X
-2 f
-9 f
-(+)S
-1 f
-1662(4)X
-2 f
-9 f
-(+)S
-1 f
-1746(...)X
-2 f
-9 f
-(+)S
-1 f
-1850(2)X
-2 f
-7 s
-5168(n)Y
-10 s
-1 f
-1931 5200(\))N
-1992(which)X
-432 5288(trace)N
-649(the)X
-807(entire)X
-2 f
-1050(split)X
-1247(history)X
-1 f
-1529(of)X
-1656(the)X
-1813(addressable)X
-16 s
-432 5433 MXY
-864 0 Dl
-2 f
-8 s
-472 5488(2)N
-1 f
-9 s
-523 5513(This)N
-670(bit-randomizing)X
-1153(property)X
-1416(is)X
-1482(important)X
-1780(to)X
-1854(obtain)X
-2052(radi-)X
-432 5593(cally)N
-599(different)X
-874(hash)X
-1033(values)X
-1244(for)X
-1355(nearly)X
-1562(identical)X
-1836(keys,)X
-2012(which)X
-432 5673(in)N
-506(turn)X
-640(avoids)X
-846(clustering)X
-1148(of)X
-1226(such)X
-1376(keys)X
-1526(in)X
-1600(a)X
-1650(single)X
-1840(bucket.)X
-10 s
-2418 538(buckets.)N
-2590 652(Given)N
-2809(a)X
-2868(key)X
-3007(and)X
-3146(the)X
-3267(bitmap)X
-3512(created)X
-3768(by)X
-3871(this)X
-4009(algo-)X
-2418 740(rithm,)N
-2638(we)X
-2759(\256rst)X
-2910(examine)X
-3209(bit)X
-3320(0)X
-3386(of)X
-3479(the)X
-3603(bitmap)X
-3851(\(the)X
-4002(bit)X
-4112(to)X
-2418 828(consult)N
-2673(when)X
-2871(0)X
-2934(bits)X
-3072(of)X
-3162(the)X
-3283(hash)X
-3453(value)X
-3650(are)X
-3772(being)X
-3973(exam-)X
-2418 916(ined\).)N
-2631(If)X
-2713(it)X
-2785(is)X
-2866(set)X
-2982(\(indicating)X
-3356(that)X
-3503(the)X
-3628(bucket)X
-3869(split\),)X
-4080(we)X
-2418 1004(begin)N
-2617(considering)X
-3012(the)X
-3131(bits)X
-3267(of)X
-3355(the)X
-3473(32-bit)X
-3684(hash)X
-3851(value.)X
-4085(As)X
-2418 1092(bit)N
-2525(n)X
-2587(is)X
-2662(revealed,)X
-2977(a)X
-3035(mask)X
-3226(equal)X
-3422(to)X
-3506(2)X
-2 f
-7 s
-1060(n)Y
-9 f
-3583(+)X
-1 f
-3614(1)X
-2 f
-10 s
-9 f
-1092(-)Y
-1 f
-3686(1)X
-3748(will)X
-3894(yield)X
-4076(the)X
-2418 1180(current)N
-2675(bucket)X
-2918(address.)X
-3228(Adding)X
-3496(2)X
-2 f
-7 s
-1148(n)Y
-9 f
-3573(+)X
-1 f
-3604(1)X
-2 f
-10 s
-9 f
-1180(-)Y
-1 f
-3676(1)X
-3744(to)X
-3834(the)X
-3960(bucket)X
-2418 1268(address)N
-2701(identi\256es)X
-3035(which)X
-3272(bit)X
-3397(in)X
-3500(the)X
-3639(bitmap)X
-3902(must)X
-4098(be)X
-2418 1356(checked.)N
-2743(We)X
-2876(continue)X
-3173(revealing)X
-3493(bits)X
-3628(of)X
-3715(the)X
-3833(hash)X
-4000(value)X
-2418 1444(until)N
-2591(all)X
-2698(set)X
-2814(bits)X
-2955(in)X
-3043(the)X
-3167(bitmap)X
-3415(are)X
-3540(exhausted.)X
-3907(The)X
-4058(fol-)X
-2418 1532(lowing)N
-2682(algorithm,)X
-3055(a)X
-3133(simpli\256cation)X
-3614(of)X
-3723(the)X
-3863(algorithm)X
-2418 1620(due)N
-2565(to)X
-2658(Ken)X
-2823(Thompson)X
-3196([THOM90,)X
-3590(TOR88],)X
-3908(uses)X
-4076(the)X
-2418 1708(hash)N
-2625(value)X
-2839(and)X
-2995(the)X
-3133(bitmap)X
-3395(to)X
-3497(calculate)X
-3823(the)X
-3960(bucket)X
-2418 1796(address)N